Commit 450c3588 authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

configure: Don't use -Wl,-z,defs if it causes link errors with 'environ'.

Fixes undefined reference link error in msv1_0 on FreeBSD. Reported by Gerald Pfeifer.
parent a084fd05
...@@ -10102,34 +10102,32 @@ fi ...@@ -10102,34 +10102,32 @@ fi
LDDLLFLAGS="-fPIC" ;; LDDLLFLAGS="-fPIC" ;;
esac esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-z,defs" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -Wl,-z,defs works correctly" >&5
printf %s "checking whether the compiler supports -Wl,-z,defs... " >&6; } printf %s "checking whether -Wl,-z,defs works correctly... " >&6; }
if test ${ac_cv_cflags__Wl__z_defs+y} if test ${ac_cv_wl_z_defs+y}
then : then :
printf %s "(cached) " >&6 printf %s "(cached) " >&6
else $as_nop else $as_nop
ac_wine_try_cflags_saved=$CFLAGS ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wl,-z,defs" CFLAGS="$CFLAGS $UNIXDLLFLAGS $UNIXLDFLAGS -Wl,-z,defs"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
int main(int argc, char **argv) { return 0; } extern char **environ; char **envp; void myfunc(void) { envp = environ; }
_ACEOF _ACEOF
if ac_fn_c_try_link "$LINENO" if ac_fn_c_try_link "$LINENO"
then : then :
ac_cv_cflags__Wl__z_defs=yes ac_cv_wl_z_defs=yes
else $as_nop else $as_nop
ac_cv_cflags__Wl__z_defs=no ac_cv_wl_z_defs=no
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \ rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved CFLAGS=$ac_save_cflags
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__z_defs" >&5
printf "%s\n" "$ac_cv_cflags__Wl__z_defs" >&6; }
if test "x$ac_cv_cflags__Wl__z_defs" = xyes
then :
UNIXLDFLAGS="$UNIXLDFLAGS -Wl,-z,defs"
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_wl_z_defs" >&5
printf "%s\n" "$ac_cv_wl_z_defs" >&6; }
test $ac_cv_wl_z_defs != yes || as_fn_append UNIXLDFLAGS " -Wl,-z,defs"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--export-dynamic" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--export-dynamic" >&5
printf %s "checking whether the compiler supports -Wl,--export-dynamic... " >&6; } printf %s "checking whether the compiler supports -Wl,--export-dynamic... " >&6; }
if test ${ac_cv_cflags__Wl___export_dynamic+y} if test ${ac_cv_cflags__Wl___export_dynamic+y}
......
...@@ -765,7 +765,15 @@ case $host_os in ...@@ -765,7 +765,15 @@ case $host_os in
LDDLLFLAGS="-fPIC" ;; LDDLLFLAGS="-fPIC" ;;
esac esac
WINE_TRY_CFLAGS([-Wl,-z,defs],[UNIXLDFLAGS="$UNIXLDFLAGS -Wl,-z,defs"]) AC_CACHE_CHECK([whether -Wl,-z,defs works correctly], ac_cv_wl_z_defs,
[ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $UNIXDLLFLAGS $UNIXLDFLAGS -Wl,-z,defs"
dnl On FreeBSD, shared libraries using environ fail to link with -Wl,-z,defs
AC_LINK_IFELSE([AC_LANG_SOURCE([[extern char **environ; char **envp; void myfunc(void) { envp = environ; }]])],
[ac_cv_wl_z_defs=yes],[ac_cv_wl_z_defs=no])
CFLAGS=$ac_save_cflags])
test $ac_cv_wl_z_defs != yes || AS_VAR_APPEND([UNIXLDFLAGS],[" -Wl,-z,defs"])
WINE_TRY_CFLAGS([-Wl,--export-dynamic],[WINELOADER_LDFLAGS="-Wl,--export-dynamic"]) WINE_TRY_CFLAGS([-Wl,--export-dynamic],[WINELOADER_LDFLAGS="-Wl,--export-dynamic"])
WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs" WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment