Work around Solaris 8 braindamage

This commit is contained in:
hpa 2001-11-12 20:27:40 +00:00
parent 403b4a48ff
commit c61e3c499e
2 changed files with 43 additions and 3 deletions

View file

@ -21,9 +21,10 @@
/* Must be included before we include any system headers! */ /* Must be included before we include any system headers! */
#include "acconfig.h" #include "acconfig.h"
/* This is necessary on Solaris */ /* This is necessary on Solaris with gcc */
#define _XPG4_2 #define _XPG4_2
#define _XOPEN_SOURCE #define _XOPEN_SOURCE
#define __EXTENSIONS__
/* Standard includes */ /* Standard includes */
@ -87,7 +88,6 @@ typedef unsigned long long uintmax_t;
#define PRIxMAX "Lx" #define PRIxMAX "Lx"
#define INTMAX_C(x) (x##LL) #define INTMAX_C(x) (x##LL)
#define UINTMAX_C(x) (x##ULL) #define UINTMAX_C(x) (x##ULL)
#define strtoumax(p,e,b) strtoull(p,e,b)
#else #else
typedef long intmax_t; typedef long intmax_t;
typedef unsigned long uintmax_t; typedef unsigned long uintmax_t;
@ -96,10 +96,40 @@ typedef unsigned long uintmax_t;
#define PRIxMAX "lx" #define PRIxMAX "lx"
#define INTMAX_C(x) (x##L) #define INTMAX_C(x) (x##L)
#define UINTMAX_C(x) (x##UL) #define UINTMAX_C(x) (x##UL)
#define strtoumax(p,e,b) strtoul(p,e,b)
#endif #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)
#define strtoumax(p,e,b) ((uintmax_t)strtoull(p,e,b))
#else
#define strtoumax(p,e,b) ((uintmax_t)strtoul(p,e,b))
#endif
#endif
/* A lot of this is old BSD code. Some newer systems don't approve. */
/* The type used by htons(), ntohs() */
#ifndef HAVE_U_SHORT
#ifdef HAVE_UINT16_T
typedef uint16_t u_short;
#else
typedef unsigned short u_short;
#endif
#endif
/* The type used to htonl(), ntohl() */
#ifndef HAVE_U_LONG
#ifdef HAVE_UINT32_T
typedef uint32_t u_long;
#else
typedef unsigned long u_long;
#endif
#endif
/* sysexits.h */
#ifdef HAVE_SYSEXITS_H #ifdef HAVE_SYSEXITS_H
#include <sysexits.h> #include <sysexits.h>
#else #else
@ -139,6 +169,7 @@ typedef unsigned long uintmax_t;
#endif #endif
/* Sometimes IPPORT_TFTP isn't defined */ /* Sometimes IPPORT_TFTP isn't defined */
#ifndef HAVE_IPPORT_TFTP_DEFINITION #ifndef HAVE_IPPORT_TFTP_DEFINITION
#ifndef IPPORT_TFTP #ifndef IPPORT_TFTP
#define IPPORT_TFTP 69 #define IPPORT_TFTP 69

View file

@ -49,6 +49,10 @@ AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_TYPES(intmax_t) AC_CHECK_TYPES(intmax_t)
AC_CHECK_TYPES(long long) AC_CHECK_TYPES(long long)
AC_CHECK_TYPES(uint16_t)
AC_CHECK_TYPES(uint32_t)
AC_CHECK_TYPES(u_short)
AC_CHECK_TYPES(u_long)
AC_TYPE_PID_T AC_TYPE_PID_T
AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR(socket library not found)]) AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR(socket library not found)])
@ -60,9 +64,14 @@ AC_CHECK_FUNCS(setsid)
AC_CHECK_FUNCS(recvmsg) AC_CHECK_FUNCS(recvmsg)
AC_CHECK_FUNCS(setreuid) AC_CHECK_FUNCS(setreuid)
AC_CHECK_FUNCS(setregid) AC_CHECK_FUNCS(setregid)
dnl Solaris 8 has [u]intmax_t but not strtoumax(). How utterly braindamaged.
AC_CHECK_FUNCS(strtoumax)
AC_CHECK_FUNCS(strtoull)
PA_MSGHDR_MSG_CONTROL PA_MSGHDR_MSG_CONTROL
PA_STRUCT_IN_PKTINFO PA_STRUCT_IN_PKTINFO
AH_TEMPLATE([HAVE_IPPORT_TFTP_DEFINITION], AH_TEMPLATE([HAVE_IPPORT_TFTP_DEFINITION],
[Define if netinet/in.h defines IPPORT_TFTP.]) [Define if netinet/in.h defines IPPORT_TFTP.])
PA_HEADER_DEFINES(netinet/in.h, int, IPPORT_TFTP) PA_HEADER_DEFINES(netinet/in.h, int, IPPORT_TFTP)