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.
This commit is contained in:
Brad King 2009-11-05 16:29:30 -05:00
parent d7ef7e9416
commit db05eb1b3c
2 changed files with 15 additions and 21 deletions

View File

@ -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)
#

View File

@ -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"