mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-30 04:38:32 +00:00
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.
This commit is contained in:
parent
a084fd0528
commit
450c358881
30
configure
vendored
30
configure
vendored
|
@ -10102,34 +10102,32 @@ fi
|
|||
LDDLLFLAGS="-fPIC" ;;
|
||||
esac
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-z,defs" >&5
|
||||
printf %s "checking whether the compiler supports -Wl,-z,defs... " >&6; }
|
||||
if test ${ac_cv_cflags__Wl__z_defs+y}
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -Wl,-z,defs works correctly" >&5
|
||||
printf %s "checking whether -Wl,-z,defs works correctly... " >&6; }
|
||||
if test ${ac_cv_wl_z_defs+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
ac_wine_try_cflags_saved=$CFLAGS
|
||||
CFLAGS="$CFLAGS -Wl,-z,defs"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $UNIXDLLFLAGS $UNIXLDFLAGS -Wl,-z,defs"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
int main(int argc, char **argv) { return 0; }
|
||||
extern char **environ; char **envp; void myfunc(void) { envp = environ; }
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
ac_cv_cflags__Wl__z_defs=yes
|
||||
ac_cv_wl_z_defs=yes
|
||||
else $as_nop
|
||||
ac_cv_cflags__Wl__z_defs=no
|
||||
ac_cv_wl_z_defs=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS=$ac_wine_try_cflags_saved
|
||||
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"
|
||||
CFLAGS=$ac_save_cflags
|
||||
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 "checking whether the compiler supports -Wl,--export-dynamic... " >&6; }
|
||||
if test ${ac_cv_cflags__Wl___export_dynamic+y}
|
||||
|
|
10
configure.ac
10
configure.ac
|
@ -765,7 +765,15 @@ case $host_os in
|
|||
LDDLLFLAGS="-fPIC" ;;
|
||||
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"])
|
||||
WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs"
|
||||
|
||||
|
|
Loading…
Reference in a new issue