forked from mirrors/tftp-hpa-google
Try to deal with severe AIX <inttypes.h> braindamage
This commit is contained in:
parent
71e9b81cee
commit
818a5408bd
3 changed files with 62 additions and 1 deletions
27
aclocal.m4
vendored
27
aclocal.m4
vendored
|
@ -123,6 +123,32 @@ int deny_severity = 0;
|
|||
AC_MSG_RESULT([no])
|
||||
])])
|
||||
|
||||
dnl ------------------------------------------------------------------------
|
||||
dnl PA_CHECK_INTTYPES_H_SANE
|
||||
dnl
|
||||
dnl At least some versions of AIX 4 have <inttypes.h> macros which are
|
||||
dnl completely broken. Try to detect those.
|
||||
dnl --------------------------------------------------------------------------
|
||||
AH_TEMPLATE([INTTYPES_H_IS_SANE],
|
||||
[Define if the macros in <inttypes.h> are usable])
|
||||
|
||||
AC_DEFUN(PA_CHECK_INTTYPES_H_SANE,
|
||||
[AC_CHECK_HEADERS(inttypes.h,
|
||||
[
|
||||
AC_MSG_CHECKING([if inttypes.h is sane])
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
],
|
||||
[uintmax_t max = UINTMAX_C(0);
|
||||
printf("%"PRIuMAX"\n", max);],
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(INTTYPES_H_IS_SANE),
|
||||
AC_MSG_RESULT([no (AIX, eh?)]))
|
||||
])
|
||||
])
|
||||
|
||||
dnl ------------------------------------------------------------------------
|
||||
dnl PA_WITH_BOOL
|
||||
dnl
|
||||
|
@ -170,3 +196,4 @@ int main()
|
|||
AC_MSG_RESULT(no)
|
||||
])])
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
|
|
33
config.h
33
config.h
|
@ -57,7 +57,9 @@
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#ifdef INTTYPES_H_IS_SANE
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
|
@ -93,6 +95,37 @@ typedef unsigned long uintmax_t;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/* On some version of AIX, <inttypes.h> is buggy to the point of
|
||||
unusability. We have to use macros here, not typedefs, to override. */
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#ifndef INTTYPES_H_IS_SANE
|
||||
#undef PRIdMAX
|
||||
#undef PRIuMAX
|
||||
#undef PRIxMAX
|
||||
#undef INTMAX_C
|
||||
#undef UINTMAX_C
|
||||
#undef HAVE_STRTOUMAX
|
||||
|
||||
#ifdef HAVE_LONG_LONG
|
||||
#define intmax_t long long
|
||||
#define uintmax_t unsigned long long
|
||||
#define PRIdMAX "Ld"
|
||||
#define PRIuMAX "Lu"
|
||||
#define PRIxMAX "Lx"
|
||||
#define INTMAX_C(x) (x##LL)
|
||||
#define UINTMAX_C(x) (x##ULL)
|
||||
#else
|
||||
#define intmax_t long
|
||||
#define uintmax_t unsigned long
|
||||
#define PRIdMAX "ld"
|
||||
#define PRIuMAX "lu"
|
||||
#define PRIxMAX "lx"
|
||||
#define INTMAX_C(x) (x##L)
|
||||
#define UINTMAX_C(x) (x##UL)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Even if intmax_t is defined, we may need this (Solaris 8 braindamage) */
|
||||
#ifndef HAVE_STRTOUMAX
|
||||
#if defined(HAVE_LONG_LONG) && defined(HAVE_STRTOULL)
|
||||
|
|
|
@ -54,10 +54,11 @@ PA_ADD_CFLAGS(-pipe)
|
|||
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(inttypes.h)
|
||||
AC_CHECK_HEADERS(stdint.h)
|
||||
PA_CHECK_INTTYPES_H_SANE
|
||||
AC_CHECK_HEADERS(libgen.h)
|
||||
AC_CHECK_HEADERS(memory.h)
|
||||
AC_CHECK_HEADERS(stddef.h)
|
||||
AC_CHECK_HEADERS(stdint.h)
|
||||
AC_CHECK_HEADERS(stdlib.h)
|
||||
AC_CHECK_HEADERS(string.h)
|
||||
AC_CHECK_HEADERS(strings.h)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue