From bbf1953051386c6ad94c812f0265bfafeaad633c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 5 Jul 2020 18:16:00 +0200 Subject: [PATCH] Improve error messages if configure build test fails under macOS Telling people to try using a different SDK was rather confusing if they didn't specify any SDK in the first place and not very helpful if the problem was due to specifying an incompatible minimum OS version, so fix both problems at once by using the appropriate error message depending on the configure options actually used. --- configure | 36 +++++++++++++++--------------------- configure.in | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/configure b/configure index 6ad269e234..c14085a4af 100755 --- a/configure +++ b/configure @@ -1028,7 +1028,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -1455,7 +1454,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1708,15 +1706,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1854,7 +1843,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -2007,7 +1996,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -18650,6 +18638,8 @@ if test "x$wxUSE_MACOSX_SDK" = "xno"; then wxUSE_MACOSX_SDK= elif test "x$wxUSE_MACOSX_SDK" = "xyes"; then wxUSE_MACOSX_SDK="`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" +elif test "x$wxUSE_MACOSX_SDK" != "x"; then + macosx_sdk_specified=yes fi @@ -18700,6 +18690,8 @@ $as_echo "$as_me: WARNING: Could not determine deployment target from SDKSetting fi elif test "x$wxUSE_MACOSX_VERSION_MIN" = "x"; then wxUSE_MACOSX_VERSION_MIN=10.10 +else + macosx_minver_specified=yes fi if test "x$MACOSX_SDK_OPTS" != "x"; then @@ -18728,6 +18720,14 @@ if test "$HAVE_CXX11" = "1" ; then fi if test "x$retest_macosx_linking" = "xyes"; then + if test "x$macosx_sdk_specified" = "xyes"; then + error_message="no, try using a different SDK or using the default one." + elif test "x$macosx_minver_specified" = "xyes"; then + error_message="no, try using a different min OS version or omitting it." + else + error_message="no, check that Xcode command line tools are installed." + fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -18751,10 +18751,7 @@ if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no. Try a different SDK -See \`config.log' for more details" "$LINENO" 5; }; exit 1 + as_fn_error $? "$error_message" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -18788,10 +18785,7 @@ if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no. Try a different SDK -See \`config.log' for more details" "$LINENO" 5; }; exit 1 + as_fn_error $? "$error_message" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext diff --git a/configure.in b/configure.in index a50f88dd9f..b8da4f823f 100644 --- a/configure.in +++ b/configure.in @@ -1253,6 +1253,8 @@ if test "x$wxUSE_MACOSX_SDK" = "xno"; then elif test "x$wxUSE_MACOSX_SDK" = "xyes"; then dnl Try to use the default SDK. wxUSE_MACOSX_SDK="`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" +elif test "x$wxUSE_MACOSX_SDK" != "x"; then + macosx_sdk_specified=yes fi @@ -1305,6 +1307,8 @@ dnl We need to quote the next line where we don't need macros and do need [] in fi elif test "x$wxUSE_MACOSX_VERSION_MIN" = "x"; then wxUSE_MACOSX_VERSION_MIN=10.10 +else + macosx_minver_specified=yes fi if test "x$MACOSX_SDK_OPTS" != "x"; then @@ -1341,14 +1345,22 @@ dnl If either an SDK or a version option was added, make sure that we can dnl still compile and link both C and C++. If we didn't do this, then most dnl of the remaining tests would fail. if test "x$retest_macosx_linking" = "xyes"; then + if test "x$macosx_sdk_specified" = "xyes"; then + error_message="no, try using a different SDK or using the default one." + elif test "x$macosx_minver_specified" = "xyes"; then + error_message="no, try using a different min OS version or omitting it." + else + error_message="no, check that Xcode command line tools are installed." + fi + AC_LANG_PUSH(C) AC_MSG_CHECKING([if C compiler ($CC) works with SDK/version options]) - AC_TRY_LINK([],[],[AC_MSG_RESULT([yes])],[AC_MSG_FAILURE([no. Try a different SDK]); exit 1]) + AC_TRY_LINK([],[],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([$error_message])]) AC_LANG_POP() AC_LANG_PUSH(C++) AC_MSG_CHECKING([if C++ compiler ($CXX) works with SDK/version options]) - AC_TRY_LINK([],[],[AC_MSG_RESULT([yes])],[AC_MSG_FAILURE([no. Try a different SDK]); exit 1]) + AC_TRY_LINK([],[],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([$error_message])]) AC_LANG_POP() fi