Add support for universal builds to vasnprintf.
authorBruno Haible <bruno@clisp.org>
Thu, 25 Dec 2008 19:18:10 +0000 (20:18 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 25 Dec 2008 19:18:10 +0000 (20:18 +0100)
17 files changed:
ChangeLog
m4/printf.m4
modules/fprintf-posix
modules/snprintf-posix
modules/sprintf-posix
modules/unistdio/u16-u16-vasnprintf
modules/unistdio/u16-vasnprintf
modules/unistdio/u32-u32-vasnprintf
modules/unistdio/u32-vasnprintf
modules/unistdio/u8-u8-vasnprintf
modules/unistdio/u8-vasnprintf
modules/unistdio/ulc-vasnprintf
modules/vasnprintf-posix
modules/vasprintf-posix
modules/vfprintf-posix
modules/vsnprintf-posix
modules/vsprintf-posix

index dec7912cbfec122bc6f6ab4f3e66f51009510942..e31385251252265843c982006270015e3de9b58b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 2008-12-25  Bruno Haible  <bruno@clisp.org>
 
+       Add support for universal builds to vasnprintf.
+       * m4/printf.m4 (gl_PRINTF_ENOMEM): Require gl_MULTIARCH. In Apple
+       universal builds, guess no.
+       * modules/vasnprintf-posix (Depends-on): Add multiarch.
+       * modules/vasprintf-posix (Depends-on): Likewise.
+       * modules/fprintf-posix (Depends-on): Likewise.
+       * modules/vfprintf-posix (Depends-on): Likewise.
+       * modules/snprintf-posix (Depends-on): Likewise.
+       * modules/vsnprintf-posix (Depends-on): Likewise.
+       * modules/sprintf-posix (Depends-on): Likewise.
+       * modules/vsprintf-posix (Depends-on): Likewise.
+       * modules/unistdio/u8-vasnprintf (Depends-on): Likewise.
+       * modules/unistdio/u8-u8-vasnprintf (Depends-on): Likewise.
+       * modules/unistdio/u16-vasnprintf (Depends-on): Likewise.
+       * modules/unistdio/u16-u16-vasnprintf (Depends-on): Likewise.
+       * modules/unistdio/u32-vasnprintf (Depends-on): Likewise.
+       * modules/unistdio/u32-u32-vasnprintf (Depends-on): Likewise.
+       * modules/unistdio/ulc-vasnprintf (Depends-on): Likewise.
+
        Add support for universal builds to <inttypes.h>.
        * lib/inttypes.in.h (_PRI64_PREFIX, _PRIu64_PREFIX, _SCN64_PREFIX,
        _SCNu64_PREFIX): In Apple
index df26c13ecc3427aa7a598d46b818e68f086c5e17..474a635575f28cf0a4320789cb53e913cd30fc75 100644 (file)
@@ -1,4 +1,4 @@
-# printf.m4 serial 24
+# printf.m4 serial 25
 dnl Copyright (C) 2003, 2007-2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -811,13 +811,15 @@ dnl Result is gl_cv_func_printf_enomem.
 AC_DEFUN([gl_PRINTF_ENOMEM],
 [
   AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gl_MULTIARCH])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CACHE_CHECK([whether printf survives out-of-memory conditions],
     [gl_cv_func_printf_enomem],
     [
       gl_cv_func_printf_enomem="guessing no"
       if test "$cross_compiling" = no; then
-        AC_LANG_CONFTEST([AC_LANG_SOURCE([
+        if test $APPLE_UNIVERSAL_BUILD = 0; then
+          AC_LANG_CONFTEST([AC_LANG_SOURCE([
 ]GL_NOCRASH[
 changequote(,)dnl
 #include <stdio.h>
@@ -866,21 +868,27 @@ int main()
 }
 changequote([,])dnl
           ])])
-        if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
-          (./conftest
-           result=$?
-           if test $result != 0 && test $result != 77; then result=1; fi
-           exit $result
-          ) >/dev/null 2>/dev/null
-          case $? in
-            0) gl_cv_func_printf_enomem="yes" ;;
-            77) gl_cv_func_printf_enomem="guessing no" ;;
-            *) gl_cv_func_printf_enomem="no" ;;
-          esac
+          if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+            (./conftest
+             result=$?
+             if test $result != 0 && test $result != 77; then result=1; fi
+             exit $result
+            ) >/dev/null 2>/dev/null
+            case $? in
+              0) gl_cv_func_printf_enomem="yes" ;;
+              77) gl_cv_func_printf_enomem="guessing no" ;;
+              *) gl_cv_func_printf_enomem="no" ;;
+            esac
+          else
+            gl_cv_func_printf_enomem="guessing no"
+          fi
+          rm -fr conftest*
         else
+          dnl A universal build on Apple MacOS X platforms.
+          dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode.
+          dnl But we need a configuration result that is valid in both modes.
           gl_cv_func_printf_enomem="guessing no"
         fi
-        rm -fr conftest*
       fi
       if test "$gl_cv_func_printf_enomem" = "guessing no"; then
 changequote(,)dnl
index 2472c33a42b4740d73e4d492a55c39279fcf5fd9..2f22ebda8df665c61cff4b2b30aae0e4314cf961 100644 (file)
@@ -21,6 +21,7 @@ fpucw
 nocrash
 printf-safe
 errno
+multiarch
 
 configure.ac:
 gl_FUNC_FPRINTF_POSIX
index 106997b4521ec6a35bcab6832b9536831a2751db..28c8fe37e0ce7afc18524fac466f053f8d19993e 100644 (file)
@@ -19,6 +19,7 @@ signbit
 fpucw
 nocrash
 printf-safe
+multiarch
 
 configure.ac:
 gl_FUNC_SNPRINTF_POSIX
index 964463dd445b9f0b3a95fad9023c40d3f89d3c26..e432bd882ea38703cea2af4452dc338a11ecb363 100644 (file)
@@ -21,6 +21,7 @@ nocrash
 printf-safe
 stdint
 errno
+multiarch
 
 configure.ac:
 gl_FUNC_SPRINTF_POSIX
index 4d5b6c7655762a283bd45c35dc26867966ebb2ec..1c8bdcd1b108575005710d166979c302a756dcbf 100644 (file)
@@ -42,6 +42,7 @@ alloca-opt
 localcharset
 xsize
 errno
+multiarch
 
 configure.ac:
 gl_PREREQ_VASNPRINTF_WITH_EXTRAS
index 206ca634c4bbd1f1700884da196fd9f826e7616d..7c5c7a7e55a34ad04474e3c14e1bb814459c7ad3 100644 (file)
@@ -42,6 +42,7 @@ alloca-opt
 localcharset
 xsize
 errno
+multiarch
 
 configure.ac:
 gl_PREREQ_VASNPRINTF_WITH_EXTRAS
index 94a1cac4b5134f964dff25eaa59bc5f322857c4c..d12105582005656b4ecb22bae697b9a797bbb832 100644 (file)
@@ -42,6 +42,7 @@ alloca-opt
 localcharset
 xsize
 errno
+multiarch
 
 configure.ac:
 gl_PREREQ_VASNPRINTF_WITH_EXTRAS
index 69a5449ae7091216eb690d1803a1ac01ca19eb0e..cdf5a37c89b1a17cd37b8f06c5188f363bcf32d8 100644 (file)
@@ -42,6 +42,7 @@ alloca-opt
 localcharset
 xsize
 errno
+multiarch
 
 configure.ac:
 gl_PREREQ_VASNPRINTF_WITH_EXTRAS
index a35e9e0120ce5c09d8b4728535b77859fb72c978..305e12b294196fd20582de0b51016af45642af49 100644 (file)
@@ -42,6 +42,7 @@ alloca-opt
 localcharset
 xsize
 errno
+multiarch
 
 configure.ac:
 gl_PREREQ_VASNPRINTF_WITH_EXTRAS
index a7aa3ca4557a612df415b0c0c70d647b7b35c418..9957d8b769f8a68d3a0c2dfbba67a3a30ec592f1 100644 (file)
@@ -42,6 +42,7 @@ alloca-opt
 localcharset
 xsize
 errno
+multiarch
 
 configure.ac:
 gl_PREREQ_VASNPRINTF_WITH_EXTRAS
index d8c9f8aed06df45f19d5cf406bab0920c9a5b0e8..cab2bdfe87e8205203aa70d3be34e96fa386c7fe 100644 (file)
@@ -40,6 +40,7 @@ alloca-opt
 localcharset
 xsize
 errno
+multiarch
 
 configure.ac:
 gl_PREREQ_VASNPRINTF_WITH_EXTRAS
index 0eefa5802d6a5d66ae608fbd94b7fea572890fe8..2e47814fc21242fc2bc9bad54495b8133417c3aa 100644 (file)
@@ -18,6 +18,7 @@ signbit
 fpucw
 nocrash
 printf-safe
+multiarch
 
 configure.ac:
 gl_FUNC_VASNPRINTF_POSIX
index e6068004188c0558fffe7039ccbafef59db5514f..1fc33857c007ae8fd8ed289f481790ee666ca515 100644 (file)
@@ -18,6 +18,7 @@ signbit
 fpucw
 nocrash
 printf-safe
+multiarch
 
 configure.ac:
 gl_FUNC_VASPRINTF_POSIX
index a501f812db02287624a71d5e6e2e09e5f075989e..b622564151fc64eba5a63d4f2b1e8841fe96d18f 100644 (file)
@@ -21,6 +21,7 @@ fpucw
 nocrash
 printf-safe
 errno
+multiarch
 
 configure.ac:
 gl_FUNC_VFPRINTF_POSIX
index 187dc32e79bc2af6df9076971a34b87041b85516..dda0c3214e906971f8f26e33c1eebb11f6118b93 100644 (file)
@@ -19,6 +19,7 @@ signbit
 fpucw
 nocrash
 printf-safe
+multiarch
 
 configure.ac:
 gl_FUNC_VSNPRINTF_POSIX
index f5c5ec7c6145737960b92369af1f92bd6aea3299..96730b34653806923fce9078e9d278027256e775 100644 (file)
@@ -21,6 +21,7 @@ nocrash
 printf-safe
 stdint
 errno
+multiarch
 
 configure.ac:
 gl_FUNC_VSPRINTF_POSIX