[Python-checkins] cpython: - Issue #14324: Fix configure tests for cross builds.

matthias.klose python-checkins at python.org
Thu Mar 15 19:51:58 CET 2012


http://hg.python.org/cpython/rev/fbbf9c187662
changeset:   75704:fbbf9c187662
parent:      75694:52597f888e7a
user:        Matthias Klose <doko at ubuntu.com>
date:        Thu Mar 15 19:31:06 2012 +0100
summary:
  - Issue #14324: Fix configure tests for cross builds.

when using gcc, use a compilation test for the cross build check for long long format.

files:
  Misc/NEWS    |   2 ++
  configure    |  31 ++++++++++++++++++++++++++++++-
  configure.ac |  18 +++++++++++++++++-
  3 files changed, 49 insertions(+), 2 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -111,6 +111,8 @@
 
 - Issue #14321: Do not run pgen during the build if files are up to date.
 
+- Issue #14324: Fix configure tests for cross builds.
+
 Extension Modules
 -----------------
 
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -13805,7 +13805,36 @@
   $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then :
-  ac_cv_have_long_long_format=no
+  ac_cv_have_long_long_format="cross -- assuming no"
+   if test x$GCC = xyes; then
+    save_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS -Werror -Wformat"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+        #include <stdio.h>
+        #include <stddef.h>
+
+int
+main ()
+{
+
+      char *buffer;
+      sprintf(buffer, "%lld", (long long)123);
+      sprintf(buffer, "%lld", (long long)-123);
+      sprintf(buffer, "%llu", (unsigned long long)123);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_have_long_long_format=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    CFLAGS=$save_CFLAGS
+   fi
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -4128,7 +4128,23 @@
   ]]])],
   [ac_cv_have_long_long_format=yes],
   [ac_cv_have_long_long_format=no],
-  [ac_cv_have_long_long_format=no])
+  [ac_cv_have_long_long_format="cross -- assuming no"
+   if test x$GCC = xyes; then
+    save_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS -Werror -Wformat"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+        #include <stdio.h>
+        #include <stddef.h>
+      ]], [[
+      char *buffer;
+      sprintf(buffer, "%lld", (long long)123);
+      sprintf(buffer, "%lld", (long long)-123);
+      sprintf(buffer, "%llu", (unsigned long long)123);
+      ]])],
+      ac_cv_have_long_long_format=yes
+    )
+    CFLAGS=$save_CFLAGS
+   fi])
   )
   AC_MSG_RESULT($ac_cv_have_long_long_format)
 fi

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list