diff --git a/acinclude.m4 b/acinclude.m4 index 6d34f5fa68..ea9a256863 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1445,9 +1445,9 @@ dnl Save build info for test runner to pick up and log AC_DEFUN([CURL_PREPARE_BUILDINFO], [ curl_pflags="" - case $host in - *-apple-*) curl_pflags="${curl_pflags} APPLE";; - esac + if test "$curl_cv_apple" = 'yes'; then + curl_pflags="${curl_pflags} APPLE" + fi case $host in *-*-*bsd*|*-*-aix*|*-*-hpux*|*-*-interix*|*-*-irix*|*-*-linux*|*-*-solaris*|*-*-sunos*|*-apple-*|*-*-cygwin*|*-*-msys*) curl_pflags="${curl_pflags} UNIX";; @@ -1561,27 +1561,13 @@ dnl with very low deployment targets. dnl AC_DEFUN([CURL_DARWIN_CFLAGS], [ - - tst_cflags="no" - case $host in - *-apple-*) - tst_cflags="yes" - ;; - esac - - AC_MSG_CHECKING([for good-to-use Darwin CFLAGS]) - AC_MSG_RESULT([$tst_cflags]); - - if test "$tst_cflags" = "yes"; then - old_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Werror=partial-availability" - AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - CFLAGS=$old_CFLAGS]) - fi - + old_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Werror=partial-availability" + AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + CFLAGS=$old_CFLAGS]) ]) diff --git a/configure.ac b/configure.ac index c975474ded..e475aa9019 100644 --- a/configure.ac +++ b/configure.ac @@ -596,9 +596,8 @@ case $host in *-apple-*) curl_cv_apple='yes';; esac -CURL_DARWIN_CFLAGS - if test "$curl_cv_apple" = 'yes'; then + CURL_DARWIN_CFLAGS CURL_SUPPORTS_BUILTIN_AVAILABLE fi @@ -1939,51 +1938,48 @@ if test x"$want_gss" = xyes; then LIBS="-lgss $LIBS" link_pkgconfig=1 elif test -z "$GSSAPI_LIB_DIR"; then - case $host in - *-apple-*) - LIBS="-lgssapi_krb5 -lresolv $LIBS" - ;; - *) - if test $GSSAPI_ROOT != "/usr"; then - CURL_CHECK_PKGCONFIG(mit-krb5-gssapi, $GSSAPI_ROOT/lib/pkgconfig) - else - CURL_CHECK_PKGCONFIG(mit-krb5-gssapi) - fi - if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then - dnl krb5-config doesn't have --libs-only-L or similar, put everything - dnl into LIBS - gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi` - LIBS="$gss_libs $LIBS" - elif test "$PKGCONFIG" != "no"; then - gss_libs=`$PKGCONFIG --libs mit-krb5-gssapi` - LIBS="$gss_libs $LIBS" - link_pkgconfig=1 - elif test -f "$KRB5CONFIG"; then - dnl krb5-config doesn't have --libs-only-L or similar, put everything - dnl into LIBS - gss_libs=`$KRB5CONFIG --libs gssapi` - LIBS="$gss_libs $LIBS" - link_pkgconfig=1 - else - case $host in - *-hp-hpux*) - gss_libname="gss" - ;; - *) - gss_libname="gssapi" - ;; - esac + if test "$curl_cv_apple" = 'yes'; then + LIBS="-lgssapi_krb5 -lresolv $LIBS" + else + if test $GSSAPI_ROOT != "/usr"; then + CURL_CHECK_PKGCONFIG(mit-krb5-gssapi, $GSSAPI_ROOT/lib/pkgconfig) + else + CURL_CHECK_PKGCONFIG(mit-krb5-gssapi) + fi + if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then + dnl krb5-config doesn't have --libs-only-L or similar, put everything + dnl into LIBS + gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi` + LIBS="$gss_libs $LIBS" + elif test "$PKGCONFIG" != "no"; then + gss_libs=`$PKGCONFIG --libs mit-krb5-gssapi` + LIBS="$gss_libs $LIBS" + link_pkgconfig=1 + elif test -f "$KRB5CONFIG"; then + dnl krb5-config doesn't have --libs-only-L or similar, put everything + dnl into LIBS + gss_libs=`$KRB5CONFIG --libs gssapi` + LIBS="$gss_libs $LIBS" + link_pkgconfig=1 + else + case $host in + *-hp-hpux*) + gss_libname="gss" + ;; + *) + gss_libname="gssapi" + ;; + esac - if test "$GSSAPI_ROOT" != "yes"; then - LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff" - LDFLAGSPC="$LDFLAGSPC -L$GSSAPI_ROOT/lib$libsuff" - LIBS="-l$gss_libname $LIBS" - else - LIBS="-l$gss_libname $LIBS" - fi + if test "$GSSAPI_ROOT" != "yes"; then + LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff" + LDFLAGSPC="$LDFLAGSPC -L$GSSAPI_ROOT/lib$libsuff" + LIBS="-l$gss_libname $LIBS" + else + LIBS="-l$gss_libname $LIBS" fi - ;; - esac + fi + fi else LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR" LDFLAGSPC="$LDFLAGSPC $GSSAPI_LIB_DIR" @@ -2738,36 +2734,34 @@ dnl Check for the presence of AppleIDN dnl ********************************************************************** tst_links_appleidn='no' -case $host in - *-apple-*) - AC_MSG_CHECKING([whether to build with Apple IDN]) - OPT_IDN="default" - AC_ARG_WITH(apple-idn, +if test "$curl_cv_apple" = 'yes'; then + AC_MSG_CHECKING([whether to build with Apple IDN]) + OPT_IDN="default" + AC_ARG_WITH(apple-idn, AS_HELP_STRING([--with-apple-idn],[Enable AppleIDN]) AS_HELP_STRING([--without-apple-idn],[Disable AppleIDN]), - [OPT_IDN=$withval]) - case "$OPT_IDN" in - yes) - dnl --with-apple-idn option used - AC_MSG_RESULT([yes, check]) - AC_CHECK_LIB(icucore, uidna_openUTS46, - [ - AC_CHECK_HEADERS(unicode/uidna.h, - curl_idn_msg="enabled (AppleIDN)" - AC_DEFINE(USE_APPLE_IDN, 1, [if AppleIDN]) - USE_APPLE_IDN=1 - IDN_ENABLED=1 - LIBS="-licucore -liconv $LIBS" - tst_links_appleidn='yes' - ) - ]) - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac - ;; -esac + [OPT_IDN=$withval]) + case "$OPT_IDN" in + yes) + dnl --with-apple-idn option used + AC_MSG_RESULT([yes, check]) + AC_CHECK_LIB(icucore, uidna_openUTS46, + [ + AC_CHECK_HEADERS(unicode/uidna.h, + curl_idn_msg="enabled (AppleIDN)" + AC_DEFINE(USE_APPLE_IDN, 1, [if AppleIDN]) + USE_APPLE_IDN=1 + IDN_ENABLED=1 + LIBS="-licucore -liconv $LIBS" + tst_links_appleidn='yes' + ) + ]) + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi dnl ********************************************************************** dnl Check for the presence of libidn2 @@ -4143,7 +4137,7 @@ AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1) CURL_CHECK_LIB_ARES CURL_CHECK_OPTION_THREADED_RESOLVER -if test "$ipv6" = yes; then +if test "$ipv6" = yes -a "$curl_cv_apple" = 'yes'; then CURL_DARWIN_SYSTEMCONFIGURATION fi diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4 index bf233ff3a0..7d204ab86c 100644 --- a/m4/curl-functions.m4 +++ b/m4/curl-functions.m4 @@ -1408,11 +1408,10 @@ AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [ # if test "$curl_cv_func_getaddrinfo" = "yes"; then AC_MSG_CHECKING([if getaddrinfo is threadsafe]) - case $host in - *-apple-*) - dnl Darwin 6.0 and macOS 10.2.X and newer - tst_tsafe_getaddrinfo="yes" - esac + if test "$curl_cv_apple" = 'yes'; then + dnl Darwin 6.0 and macOS 10.2.X and newer + tst_tsafe_getaddrinfo="yes" + fi case $host_os in aix[[1234]].* | aix5.[[01]].*) dnl AIX 5.1 and older @@ -4398,21 +4397,18 @@ dnl CURL_LIBRARY_PATH variable. It keeps the LD_LIBRARY_PATH dnl changes contained within this macro. AC_DEFUN([CURL_RUN_IFELSE], [ - case $host in - *-apple-*) - AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4) - ;; - *) - oldcc=$CC - old=$LD_LIBRARY_PATH - CC="sh ./run-compiler" - LD_LIBRARY_PATH=$CURL_LIBRARY_PATH:$old - export LD_LIBRARY_PATH - AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4) - LD_LIBRARY_PATH=$old # restore - CC=$oldcc - ;; - esac + if test "$curl_cv_apple" = 'yes'; then + AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4) + else + oldcc=$CC + old=$LD_LIBRARY_PATH + CC="sh ./run-compiler" + LD_LIBRARY_PATH=$CURL_LIBRARY_PATH:$old + export LD_LIBRARY_PATH + AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4) + LD_LIBRARY_PATH=$old # restore + CC=$oldcc + fi ]) dnl CURL_COVERAGE diff --git a/m4/curl-rustls.m4 b/m4/curl-rustls.m4 index 5cd5cf1fb6..40d7af05df 100644 --- a/m4/curl-rustls.m4 +++ b/m4/curl-rustls.m4 @@ -80,17 +80,14 @@ if test "x$OPT_RUSTLS" != xno; then LDFLAGS="$LDFLAGS $addld" LDFLAGSPC="$LDFLAGSPC $addld" if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" + CPPFLAGS="$CPPFLAGS $addcflags" fi - case $host in - *-apple-*) - RUSTLS_LDFLAGS="-framework Security -framework Foundation" - ;; - *) - RUSTLS_LDFLAGS="-lpthread -ldl -lm" - ;; - esac + if test "$curl_cv_apple" = 'yes'; then + RUSTLS_LDFLAGS="-framework Security -framework Foundation" + else + RUSTLS_LDFLAGS="-lpthread -ldl -lm" + fi AC_CHECK_LIB(rustls, rustls_connection_read, [ AC_DEFINE(USE_RUSTLS, 1, [if Rustls is enabled]) diff --git a/m4/curl-sysconfig.m4 b/m4/curl-sysconfig.m4 index a0ddc0ba55..3215e7d3db 100644 --- a/m4/curl-sysconfig.m4 +++ b/m4/curl-sysconfig.m4 @@ -24,34 +24,28 @@ AC_DEFUN([CURL_DARWIN_SYSTEMCONFIGURATION], [ AC_MSG_CHECKING([whether to link macOS CoreFoundation, CoreServices, and SystemConfiguration frameworks]) -case $host in - *-apple-*) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - #include - #include - ]],[[ - #if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) - return 0; - #else - #error Not macOS - #endif - ]]) - ],[ - build_for_macos="yes" - ],[ - build_for_macos="no" - ]) - if test "x$build_for_macos" != xno; then - AC_MSG_RESULT(yes) - SYSCONFIG_LDFLAGS='-framework CoreFoundation -framework CoreServices -framework SystemConfiguration' - LDFLAGS="$LDFLAGS $SYSCONFIG_LDFLAGS" - LDFLAGSPC="$LDFLAGSPC $SYSCONFIG_LDFLAGS" - else - AC_MSG_RESULT(no) - fi - ;; - *) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + #include + #include + ]],[[ + #if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + return 0; + #else + #error Not macOS + #endif + ]]) + ],[ + build_for_macos="yes" + ],[ + build_for_macos="no" + ]) + if test "x$build_for_macos" != xno; then + AC_MSG_RESULT(yes) + SYSCONFIG_LDFLAGS='-framework CoreFoundation -framework CoreServices -framework SystemConfiguration' + LDFLAGS="$LDFLAGS $SYSCONFIG_LDFLAGS" + LDFLAGSPC="$LDFLAGSPC $SYSCONFIG_LDFLAGS" + else AC_MSG_RESULT(no) -esac + fi ])