From: Brad King Date: Mon, 16 Nov 2009 16:28:51 +0000 (-0500) Subject: Simplify try-compile for SIZE_MAX X-Git-Tag: v2.8.0~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=159c809bfb33d28d2256d66ba20c04f255d03d95;p=thirdparty%2Flibarchive.git Simplify try-compile for SIZE_MAX 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 94c0e92f2..0fe15ab9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) #