Add support for universal builds to <inttypes.h>.
authorBruno Haible <bruno@clisp.org>
Thu, 25 Dec 2008 18:40:14 +0000 (19:40 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 25 Dec 2008 18:40:14 +0000 (19:40 +0100)
ChangeLog
lib/inttypes.in.h
m4/inttypes.m4
modules/inttypes

index 408d169..dec7912 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2008-12-25  Bruno Haible  <bruno@clisp.org>
 
+       Add support for universal builds to <inttypes.h>.
+       * lib/inttypes.in.h (_PRI64_PREFIX, _PRIu64_PREFIX, _SCN64_PREFIX,
+       _SCNu64_PREFIX): In Apple
+       universal builds, define directly, using _LP64.
+       * m4/inttypes.m4 (gl_INTTYPES_H): In Apple universal builds, set
+       INT64_MAX_EQ_LONG_MAX and UINT64_MAX_EQ_ULONG_MAX to -1.
+       * modules/inttypes (Depends-on): Add multiarch.
+       (Makefile.am): Substitute APPLE_UNIVERSAL_BUILD.
+
        Add support for universal builds to <stdint.h>.
        * lib/stdint.in.h (PDFDIFF_MIN, PTRDIFF_MAX, SIZE_MAX): In Apple
        universal builds, define directly, using _LP64.
index bd9d0d2..33cec2d 100644 (file)
 #  endif
 # endif
 # ifdef INT64_MAX
-#  if @INT64_MAX_EQ_LONG_MAX@
+#  if (@APPLE_UNIVERSAL_BUILD@ ? _LP64 : @INT64_MAX_EQ_LONG_MAX@)
 #   define _PRI64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _PRI64_PREFIX "I64"
 #  endif
 # endif
 # ifdef UINT64_MAX
-#  if @UINT64_MAX_EQ_ULONG_MAX@
+#  if (@APPLE_UNIVERSAL_BUILD@ ? _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
 #   define _PRIu64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _PRIu64_PREFIX "I64"
 #  endif
 # endif
 # ifdef INT64_MAX
-#  if @INT64_MAX_EQ_LONG_MAX@
+#  if (@APPLE_UNIVERSAL_BUILD@ ? _LP64 : @INT64_MAX_EQ_LONG_MAX@)
 #   define _SCN64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _SCN64_PREFIX "I64"
 #  endif
 # endif
 # ifdef UINT64_MAX
-#  if @UINT64_MAX_EQ_ULONG_MAX@
+#  if (@APPLE_UNIVERSAL_BUILD@ ? _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
 #   define _SCNu64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _SCNu64_PREFIX "I64"
index d84cead..448bce6 100644 (file)
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 12
+# inttypes.m4 serial 13
 dnl Copyright (C) 2006-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,
@@ -144,6 +144,8 @@ const char *l = /* implicit string concatenation */
     AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
     gl_CHECK_NEXT_HEADERS([inttypes.h])
 
+    AC_REQUIRE([gl_MULTIARCH])
+
     dnl Ensure that <stdint.h> defines the limit macros, since gnulib's
     dnl <inttypes.h> relies on them.  This macro is only needed when a
     dnl C++ compiler is in use; it has no effect for a C compiler.
@@ -212,21 +214,29 @@ const char *l = /* implicit string concatenation */
       [defined INT32_MAX && defined INTMAX_MAX],
       [INT32_MAX < INTMAX_MAX],
       [sizeof (int) < sizeof (long long int)])
-    gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
-      [INT64_MAX_EQ_LONG_MAX],
-      [defined INT64_MAX],
-      [INT64_MAX == LONG_MAX],
-      [sizeof (long long int) == sizeof (long int)])
+    if test $APPLE_UNIVERSAL_BUILD = 0; then
+      gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
+        [INT64_MAX_EQ_LONG_MAX],
+        [defined INT64_MAX],
+        [INT64_MAX == LONG_MAX],
+        [sizeof (long long int) == sizeof (long int)])
+    else
+      INT64_MAX_EQ_LONG_MAX=-1
+    fi
     gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
       [UINT32_MAX_LT_UINTMAX_MAX],
       [defined UINT32_MAX && defined UINTMAX_MAX],
       [UINT32_MAX < UINTMAX_MAX],
       [sizeof (unsigned int) < sizeof (unsigned long long int)])
-    gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
-      [UINT64_MAX_EQ_ULONG_MAX],
-      [defined UINT64_MAX],
-      [UINT64_MAX == ULONG_MAX],
-      [sizeof (unsigned long long int) == sizeof (unsigned long int)])
+    if test $APPLE_UNIVERSAL_BUILD = 0; then
+      gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
+        [UINT64_MAX_EQ_ULONG_MAX],
+        [defined UINT64_MAX],
+        [UINT64_MAX == ULONG_MAX],
+        [sizeof (unsigned long long int) == sizeof (unsigned long int)])
+    else
+      UINT64_MAX_EQ_ULONG_MAX=-1
+    fi
 
     INTTYPES_H='inttypes.h'
   fi
index e66c491..61c5d3f 100644 (file)
@@ -9,6 +9,7 @@ m4/inttypes.m4
 Depends-on:
 include_next
 link-warning
+multiarch
 stdint
 
 configure.ac:
@@ -27,6 +28,7 @@ inttypes.h: inttypes.in.h
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \
              -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \
+             -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
              -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
              -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
              -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \