summaryrefslogtreecommitdiffstats
path: root/Utilities/cmlibarchive
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-11-05 21:29:30 (GMT)
committerBrad King <brad.king@kitware.com>2009-11-05 21:29:30 (GMT)
commitdb05eb1b3cfb0b01a2325f745c516639503b2486 (patch)
treec3534cf99679cb3c3116dfb8d9a9607198a5bc89 /Utilities/cmlibarchive
parentd7ef7e9416e4fd758c4777d63aeb0ee1a40d87d2 (diff)
downloadCMake-db05eb1b3cfb0b01a2325f745c516639503b2486.zip
CMake-db05eb1b3cfb0b01a2325f745c516639503b2486.tar.gz
CMake-db05eb1b3cfb0b01a2325f745c516639503b2486.tar.bz2
libarchive: Fix try-compile for SIZE_MAX
This constant may be defined in one of a few headers. We teach the try-compile for it to test all the headers together instead of only one header.
Diffstat (limited to 'Utilities/cmlibarchive')
-rw-r--r--Utilities/cmlibarchive/CMakeLists.txt33
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_ar.c3
2 files changed, 15 insertions, 21 deletions
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
index 636ca14..990bee2 100644
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -416,32 +416,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)
- IF(HAVE_INTTYPES_H)
- CHECK_SYMBOL_EXISTS(INT64_MAX "inttypes.h" HAVE_DECL_INT64_MAX)
- CHECK_SYMBOL_EXISTS(INT64_MIN "inttypes.h" HAVE_DECL_INT64_MIN)
- CHECK_SYMBOL_EXISTS(UINT32_MAX "inttypes.h" HAVE_DECL_UINT32_MAX)
- CHECK_SYMBOL_EXISTS(UINT64_MAX "inttypes.h" HAVE_DECL_UINT64_MAX)
- CHECK_SYMBOL_EXISTS(SIZE_MAX "inttypes.h" HAVE_DECL_SIZE_MAX)
- ELSE(HAVE_INTTYPES_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_INTTYPES_H)
-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)
#
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_ar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_ar.c
index 0513cf4..bacfbbc 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_ar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_ar.c
@@ -40,6 +40,9 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_ar.c,v 1.12 2
#ifdef HAVE_STRING_H
#include <string.h>
#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
#include "archive.h"
#include "archive_entry.h"