https://github.com/python/cpython/commit/c2a551a30b520e520b084eec251f168549e1a3f0
commit: c2a551a30b520e520b084eec251f168549e1a3f0
branch: main
author: Erlend E. Aasland <[email protected]>
committer: erlend-aasland <[email protected]>
date: 2024-04-13T09:05:07+02:00
summary:

gh-96398: Detect GCC compatible compilers in configure (#117825)

Introduce a cached variable $ac_cv_gcc_compat and set it to 'yes' if
the C preprocessor defines the __GNUC__ macro.

files:
M configure
M configure.ac

diff --git a/configure b/configure
index 027ef83807b939..799c9e98dc599b 100755
--- a/configure
+++ b/configure
@@ -6317,6 +6317,34 @@ fi
 
 
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC compatible 
compiler" >&5
+printf %s "checking for GCC compatible compiler... " >&6; }
+if test ${ac_cv_gcc_compat+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                #if !defined(__GNUC__)
+                  #error "not GCC compatible"
+                #else
+                  /* GCC compatible! */
+                #endif
+
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"
+then :
+  ac_cv_gcc_compat=yes
+else $as_nop
+  ac_cv_gcc_compat=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_compat" >&5
+printf "%s\n" "$ac_cv_gcc_compat" >&6; }
+
+
 
 preset_cxx="$CXX"
 if test -z "$CXX"
@@ -11579,7 +11607,6 @@ printf "%s\n" "#define size_t unsigned int" >>confdefs.h
 
 fi
 
-
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uid_t in 
sys/types.h" >&5
 printf %s "checking for uid_t in sys/types.h... " >&6; }
 if test ${ac_cv_type_uid_t+y}
diff --git a/configure.ac b/configure.ac
index 35b3a4e129e0ef..6769ab2bfe1e59 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1025,6 +1025,18 @@ rm -f conftest.c conftest.out
 # _POSIX_SOURCE, _POSIX_1_SOURCE, and more
 AC_USE_SYSTEM_EXTENSIONS
 
+AC_CACHE_CHECK([for GCC compatible compiler],
+               [ac_cv_gcc_compat],
+               [AC_PREPROC_IFELSE([AC_LANG_SOURCE([
+                #if !defined(__GNUC__)
+                  #error "not GCC compatible"
+                #else
+                  /* GCC compatible! */
+                #endif
+               ], [])],
+               [ac_cv_gcc_compat=yes],
+               [ac_cv_gcc_compat=no])])
+
 AC_SUBST([CXX])
 
 preset_cxx="$CXX"

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to