]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Simplify try-compile for SIZE_MAX
authorBrad King <brad.king@kitware.com>
Mon, 16 Nov 2009 16:28:51 +0000 (11:28 -0500)
committerBrad King <brad.king@kitware.com>
Mon, 16 Nov 2009 16:28:51 +0000 (11:28 -0500)
This constant may be defined in one of a few headers that we always
include anyway.  It is simpler and more reliable to look for the
constant in all the possible headers at once.  Otherwise we would need
to store the result for each header in a separate cache entry.

SVN-Revision: 1655

CMakeLists.txt

index 94c0e92f2b1347340a5760da97a562aeb00ea789..0fe15ab9ae9291c35a14002a6e68cbf47724c3ea 100644 (file)
@@ -408,24 +408,23 @@ ENDIF(HAVE_STRERROR_R)
 #
 # Check defines
 #
+SET(headers "limits.h")
+IF(HAVE_STDINT_H)
+  LIST(APPEND headers "stdint.h")
+ENDIF(HAVE_STDINT_H)
+IF(HAVE_INTTYPES_H)
+  LIST(APPEND headers "inttypes.h")
+ENDIF(HAVE_INTTYPES_H)
 CHECK_SYMBOL_EXISTS(EFTYPE           "errno.h"    HAVE_EFTYPE)
 CHECK_SYMBOL_EXISTS(EILSEQ           "errno.h"    HAVE_EILSEQ)
 CHECK_SYMBOL_EXISTS(D_MD_ORDER       "langinfo.h" HAVE_D_MD_ORDER)
 CHECK_SYMBOL_EXISTS(optarg           "unistd.h"   HAVE_DECL_OPTARG)
 CHECK_SYMBOL_EXISTS(optind           "unistd.h"   HAVE_DECL_OPTIND)
-IF(HAVE_STDINT_H)
-  CHECK_SYMBOL_EXISTS(INT64_MAX      "stdint.h"   HAVE_DECL_INT64_MAX)
-  CHECK_SYMBOL_EXISTS(INT64_MIN      "stdint.h"   HAVE_DECL_INT64_MIN)
-  CHECK_SYMBOL_EXISTS(UINT32_MAX     "stdint.h"   HAVE_DECL_UINT32_MAX)
-  CHECK_SYMBOL_EXISTS(UINT64_MAX     "stdint.h"   HAVE_DECL_UINT64_MAX)
-  CHECK_SYMBOL_EXISTS(SIZE_MAX       "stdint.h"   HAVE_DECL_SIZE_MAX)
-ELSE(HAVE_STDINT_H)
-  CHECK_SYMBOL_EXISTS(INT64_MAX      "limits.h"   HAVE_DECL_INT64_MAX)
-  CHECK_SYMBOL_EXISTS(INT64_MIN      "limits.h"   HAVE_DECL_INT64_MIN)
-  CHECK_SYMBOL_EXISTS(UINT32_MAX     "limits.h"   HAVE_DECL_UINT32_MAX)
-  CHECK_SYMBOL_EXISTS(UINT64_MAX     "limits.h"   HAVE_DECL_UINT64_MAX)
-  CHECK_SYMBOL_EXISTS(SIZE_MAX       "limits.h"   HAVE_DECL_SIZE_MAX)
-ENDIF(HAVE_STDINT_H)
+CHECK_SYMBOL_EXISTS(INT64_MAX        "${headers}" HAVE_DECL_INT64_MAX)
+CHECK_SYMBOL_EXISTS(INT64_MIN        "${headers}" HAVE_DECL_INT64_MIN)
+CHECK_SYMBOL_EXISTS(UINT32_MAX       "${headers}" HAVE_DECL_UINT32_MAX)
+CHECK_SYMBOL_EXISTS(UINT64_MAX       "${headers}" HAVE_DECL_UINT64_MAX)
+CHECK_SYMBOL_EXISTS(SIZE_MAX         "${headers}" HAVE_DECL_SIZE_MAX)
 CHECK_SYMBOL_EXISTS(SSIZE_MAX        "limits.h"   HAVE_DECL_SSIZE_MAX)
 
 #