]> granicus.if.org Git - python/commitdiff
- Issue #14324: Fix configure tests for cross builds.
authorMatthias Klose <doko@ubuntu.com>
Thu, 15 Mar 2012 18:31:06 +0000 (19:31 +0100)
committerMatthias Klose <doko@ubuntu.com>
Thu, 15 Mar 2012 18:31:06 +0000 (19:31 +0100)
when using gcc, use a compilation test for the cross build check for long long format.

Misc/NEWS
configure
configure.ac

index d41a2b4e41cf7573f801b58e6045de50ea7b2ff4..9bc74d1205733f8e553bfadcb3511dcd81f2f193 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -111,6 +111,8 @@ Build
 
 - 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
 -----------------
 
index a71e128cbf1a4be64596f5e4ca6187500b858f9b..8f5845dbfcb1df6519c3a8878d72a8bb1bad3d51 100755 (executable)
--- a/configure
+++ b/configure
@@ -13805,7 +13805,36 @@ $as_echo_n "checking for %lld and %llu printf() format support... " >&6; }
   $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.  */
index a38a5ccf4fd4332fd9a2cc9b9148d399fea67b39..2bcbedfec6e6afcd65a2c6053e36e20c98197c7d 100644 (file)
@@ -4128,7 +4128,23 @@ then
   ]]])],
   [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