configure: Fix building of the preloader on the Mac using Xcode 10 or later.

The linker that comes with Xcode 10 requires that libSystem be linked for
dynamic executables (those using dyld) unless -mmacosx-version-min=10.7 (or
earlier) is used.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2018-12-07 15:11:07 -06:00 committed by Alexandre Julliard
parent ae5e029d22
commit 0185ee5d99
2 changed files with 135 additions and 20 deletions

123
configure vendored
View File

@ -8596,6 +8596,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
WINELOADER_LDFLAGS="-Wl,-pie,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,wine_info.plist"
wine_can_build_preloader=yes
WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs -e _start -ldylib1.o -Wl,-image_base,0x7c400000,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,wine_info.plist"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-no_new_main -e _main" >&5
$as_echo_n "checking whether the compiler supports -Wl,-no_new_main -e _main... " >&6; }
@ -8621,7 +8622,116 @@ fi
$as_echo "$ac_cv_cflags__Wl__no_new_main__e__main" >&6; }
if test "x$ac_cv_cflags__Wl__no_new_main__e__main" = xyes; then :
WINEPRELOADER_LDFLAGS="-Wl,-no_new_main $WINEPRELOADER_LDFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-no_new_main -e _main -nostartfiles -nodefaultlibs" >&5
$as_echo_n "checking whether the compiler supports -Wl,-no_new_main -e _main -nostartfiles -nodefaultlibs... " >&6; }
if ${ac_cv_cflags__Wl__no_new_main__e__main__nostartfiles__nodefaultlibs+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -Wl,-no_new_main -e _main -nostartfiles -nodefaultlibs"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(int argc, char **argv) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_cflags__Wl__no_new_main__e__main__nostartfiles__nodefaultlibs=yes
else
ac_cv_cflags__Wl__no_new_main__e__main__nostartfiles__nodefaultlibs=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__no_new_main__e__main__nostartfiles__nodefaultlibs" >&5
$as_echo "$ac_cv_cflags__Wl__no_new_main__e__main__nostartfiles__nodefaultlibs" >&6; }
if test "x$ac_cv_cflags__Wl__no_new_main__e__main__nostartfiles__nodefaultlibs" = xyes; then :
EXTRACFLAGS="$EXTRACFLAGS -Wl,-no_new_main -e _main -nostartfiles -nodefaultlibs"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-no_new_main -e _main -mmacosx-version-min=10.7 -nostartfiles -nodefaultlibs" >&5
$as_echo_n "checking whether the compiler supports -Wl,-no_new_main -e _main -mmacosx-version-min=10.7 -nostartfiles -nodefaultlibs... " >&6; }
if ${ac_cv_cflags__Wl__no_new_main__e__main__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -Wl,-no_new_main -e _main -mmacosx-version-min=10.7 -nostartfiles -nodefaultlibs"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(int argc, char **argv) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_cflags__Wl__no_new_main__e__main__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs=yes
else
ac_cv_cflags__Wl__no_new_main__e__main__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__no_new_main__e__main__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs" >&5
$as_echo "$ac_cv_cflags__Wl__no_new_main__e__main__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs" >&6; }
if test "x$ac_cv_cflags__Wl__no_new_main__e__main__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs" = xyes; then :
WINEPRELOADER_LDFLAGS="-mmacosx-version-min=10.7 $WINEPRELOADER_LDFLAGS"
else
wine_can_build_preloader=no
fi
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -nostartfiles -nodefaultlibs" >&5
$as_echo_n "checking whether the compiler supports -nostartfiles -nodefaultlibs... " >&6; }
if ${ac_cv_cflags__nostartfiles__nodefaultlibs+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -nostartfiles -nodefaultlibs"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(int argc, char **argv) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_cflags__nostartfiles__nodefaultlibs=yes
else
ac_cv_cflags__nostartfiles__nodefaultlibs=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__nostartfiles__nodefaultlibs" >&5
$as_echo "$ac_cv_cflags__nostartfiles__nodefaultlibs" >&6; }
if test "x$ac_cv_cflags__nostartfiles__nodefaultlibs" = xyes; then :
EXTRACFLAGS="$EXTRACFLAGS -nostartfiles -nodefaultlibs"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -mmacosx-version-min=10.7 -nostartfiles -nodefaultlibs" >&5
$as_echo_n "checking whether the compiler supports -mmacosx-version-min=10.7 -nostartfiles -nodefaultlibs... " >&6; }
if ${ac_cv_cflags__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -mmacosx-version-min=10.7 -nostartfiles -nodefaultlibs"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(int argc, char **argv) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_cflags__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs=yes
else
ac_cv_cflags__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs" >&5
$as_echo "$ac_cv_cflags__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs" >&6; }
if test "x$ac_cv_cflags__mmacosx_version_min_10_7__nostartfiles__nodefaultlibs" = xyes; then :
WINEPRELOADER_LDFLAGS="-mmacosx-version-min=10.7 $WINEPRELOADER_LDFLAGS"
else
wine_can_build_preloader=no
fi
fi
fi
if test "$wine_can_build_preloader" = "yes"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-no_pie" >&5
$as_echo_n "checking whether the compiler supports -Wl,-no_pie... " >&6; }
if ${ac_cv_cflags__Wl__no_pie+:} false; then :
@ -8647,6 +8757,11 @@ $as_echo "$ac_cv_cflags__Wl__no_pie" >&6; }
if test "x$ac_cv_cflags__Wl__no_pie" = xyes; then :
WINEPRELOADER_LDFLAGS="-Wl,-no_pie $WINEPRELOADER_LDFLAGS"
fi
test "$wine_binary" = wine || wine_fn_append_file CONFIGURE_TARGETS "loader/wine-preloader"
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
else
as_fn_append wine_warnings "|can't build Wine preloader; many programs won't work"
fi
if test "$ac_cv_header_DiskArbitration_DiskArbitration_h" = "yes"
then
@ -16511,14 +16626,6 @@ case $host_os in
;;
esac
;;
darwin*|macosx*)
case $host_cpu in
*i[3456789]86*|x86_64*)
test "$wine_binary" = wine || wine_fn_append_file CONFIGURE_TARGETS "loader/wine-preloader"
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
;;
esac
;;
esac

View File

@ -770,11 +770,27 @@ case $host_os in
WINELOADER_LDFLAGS="-Wl,-pie,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,wine_info.plist"
wine_can_build_preloader=yes
WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs -e _start -ldylib1.o -Wl,-image_base,0x7c400000,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,wine_info.plist"
WINE_TRY_CFLAGS([-Wl,-no_new_main -e _main],
[WINEPRELOADER_LDFLAGS="-Wl,-no_new_main $WINEPRELOADER_LDFLAGS"])
[WINEPRELOADER_LDFLAGS="-Wl,-no_new_main $WINEPRELOADER_LDFLAGS"
WINE_TRY_CFLAGS([-Wl,-no_new_main -e _main -nostartfiles -nodefaultlibs],,
[WINE_TRY_CFLAGS([-Wl,-no_new_main -e _main -mmacosx-version-min=10.7 -nostartfiles -nodefaultlibs],
[WINEPRELOADER_LDFLAGS="-mmacosx-version-min=10.7 $WINEPRELOADER_LDFLAGS"],
[wine_can_build_preloader=no])])],
[WINE_TRY_CFLAGS([-nostartfiles -nodefaultlibs],,
[WINE_TRY_CFLAGS([-mmacosx-version-min=10.7 -nostartfiles -nodefaultlibs],
[WINEPRELOADER_LDFLAGS="-mmacosx-version-min=10.7 $WINEPRELOADER_LDFLAGS"],
[wine_can_build_preloader=no])])])
if test "$wine_can_build_preloader" = "yes"
then
WINE_TRY_CFLAGS([-Wl,-no_pie],
[WINEPRELOADER_LDFLAGS="-Wl,-no_pie $WINEPRELOADER_LDFLAGS"])
test "$wine_binary" = wine || WINE_IGNORE_FILE("loader/wine-preloader")
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
else
WINE_WARNING([can't build Wine preloader; many programs won't work])
fi
if test "$ac_cv_header_DiskArbitration_DiskArbitration_h" = "yes"
then
@ -2119,14 +2135,6 @@ case $host_os in
;;
esac
;;
darwin*|macosx*)
case $host_cpu in
*i[[3456789]]86*|x86_64*)
test "$wine_binary" = wine || WINE_IGNORE_FILE("loader/wine-preloader")
WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
;;
esac
;;
esac
dnl **** Check for functions ****