]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Test whether printf() supports %jd, %ju, %lld, or %llu.
authorTim Kientzle <kientzle@gmail.com>
Fri, 7 Aug 2009 04:01:06 +0000 (00:01 -0400)
committerTim Kientzle <kientzle@gmail.com>
Fri, 7 Aug 2009 04:01:06 +0000 (00:01 -0400)
This needs to be implemented in the autoconf machinery
and tar and cpio need to be taught to use it when printing
very large numbers.

SVN-Revision: 1351

CMakeLists.txt
build/cmake/config.h.in

index 2cd67b5ce0427449dae7cb3aa9ac8abb4a8c16bc..d388955deb5ab4548151062b6effb429550da910 100644 (file)
@@ -46,6 +46,7 @@ IF(WIN32 AND NOT CYGWIN)
 ENDIF(WIN32 AND NOT CYGWIN)
 
 #
+INCLUDE(CheckCSourceRuns)
 INCLUDE(CheckFileOffsetBits)
 INCLUDE(CheckFuncs)
 INCLUDE(CheckHeaders)
@@ -527,6 +528,8 @@ ENDIF(HAVE_SIZEOF_WCHAR_T)
 #
 CHECK_FILE_OFFSET_BITS()
 
+
+
 #
 # Check for Extended Attribute libraries, headers, and functions
 #
@@ -583,9 +586,34 @@ IF(ENABLE_ACL)
   # MacOS has an acl.h that isn't POSIX.  It can be detected by
   # checking for ACL_USER
   CHECK_SYMBOL_EXISTS(ACL_USER         "sys/acl.h" HAVE_ACL_USER)
-
 ENDIF(ENABLE_ACL)
 
+# Check whether printf() supports "%jd"
+CHECK_C_SOURCE_RUNS("
+   #include <stdint.h>
+   #include <stdio.h>
+   #include <string.h>
+   static char buf[100];
+   int main() {
+     sprintf(buf, \"%jd\", (intmax_t)7);
+     if (strcmp(buf, \"7\")) return 1;
+     sprintf(buf, \"%ju\", (uintmax_t)7);
+     return (strcmp(buf, \"7\"));
+   }" HAVE_PRINTF_JD)
+
+# Check whether printf() supports "%lld"
+CHECK_C_SOURCE_RUNS("
+   #include <stdint.h>
+   #include <stdio.h>
+   #include <string.h>
+   static char buf[100];
+   int main() {
+     sprintf(buf, \"%lld\", (long long)7);
+     if (strcmp(buf, \"7\")) return 1;
+     sprintf(buf, \"%llu\", (long long)7);
+     return (strcmp(buf, \"7\"));
+   }" HAVE_PRINTF_LLD)
+
 # Generate "config.h" from "build/cmake/config.h.in"
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in
        ${CMAKE_CURRENT_BINARY_DIR}/config.h)
index 4720aadaf6beaaba5e897b9e278cb020efcca1e6..988d360ee81660c34f3633d492055778c7698a8e 100644 (file)
 /* Define to 1 if you have the <poll.h> header file. */
 #cmakedefine HAVE_POLL_H 1
 
+/* Define to 1 if printf() supports "%ju" and "%jd" */
+#cmakedefine HAVE_PRINTF_JD 1
+
+/* Define to 1 if printf() supports "%llu" and "%lld" */
+#cmakedefine HAVE_PRINTF_LLD 1
+
 /* Define to 1 if you have the <process.h> header file. */
 #cmakedefine HAVE_PROCESS_H 1