]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix 'AC_LINK_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS' (#1139)
authorAmos Jeffries <yadij@users.noreply.github.com>
Tue, 13 Sep 2022 07:25:36 +0000 (07:25 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 13 Sep 2022 07:25:46 +0000 (07:25 +0000)
... produced during bootstrap.sh by autoconf 2.71

AC_USE_SYSTEM_EXTENSIONS needs to be placed after detecting
which OS and compiler are being used. But before any of the
checks detecting capabilities of those OS and compilers.

AC_CANONICAL_HOST is a prerequisite of the simple_host_os logic.
Attach it to that code block instead of the compiler detection
block.

Replace deprecated '$GCC' variable with autoconf cached
'$ac_cv_c_compiler_gnu' variable used as the real source for the
yes/no value of GCC usability after AC_PROG_CC.

configure.ac

index 374ceaee395c6b91380cc5384cfb74a67ccbf169..3bc2a84e37b7b62f5b623803f7d9122a800e030d 100644 (file)
@@ -35,12 +35,29 @@ PRESET_LDFLAGS="$LDFLAGS"
 dnl Set default LDFLAGS
 AS_IF([test "x$LDFLAGS" = "x"],[LDFLAGS="-g"])
 
-# Check for GNU cc
+# check for host OS detail
+AC_CANONICAL_HOST
+AC_MSG_CHECKING([simplified host os])
+simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
+squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
+AS_IF([test -n "$squid_host_os_version"],[
+  squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
+],[
+  squid_host_os="$simple_host_os"
+])
+AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
+# on windows squid_host_os is either mingw or cygwin, version is 32
+
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CXX
+
+# AC_USE_SYSTEM_EXTENSIONS should be called before any macros that run the C compiler.
+AS_IF([test "x$squid_host_os" = "solaris" -a "x$GCC" = "xyes"],[
+  AC_USE_SYSTEM_EXTENSIONS
+])
+
 AC_LANG([C++])
-AC_CANONICAL_HOST
 
 # Clang 3.2 on some CPUs requires -march-native to detect correctly.
 # GCC 4.3+ can also produce faster executables when its used.
@@ -73,23 +90,6 @@ AS_IF([test "x$BUILDCXX" = "x"],[
 ])
 AC_SUBST(BUILDCXX)
 
-AC_MSG_CHECKING([simplified host os])
-simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
-squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
-AS_IF([test -n "$squid_host_os_version"],[
-  squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
-],[
-  squid_host_os="$simple_host_os"
-])
-AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
-# on windows squid_host_os is either mingw or cygwin, version is 32
-
-# this needs to be before any test is run, to have more standard
-# functions available on some Unix sysems (e.g. Solaris)
-AS_IF([test "x$squid_host_os" = "solaris" -a "x$GCC" != "x"],[
-  AC_USE_SYSTEM_EXTENSIONS
-])
-
 # If the user did not specify a C++ version.
 user_cxx=`echo "$PRESET_CXXFLAGS" | grep -o -E "\-std="`
 AS_IF([test "x$user_cxx" = "x"],[