1 2AC_DEFUN_ONCE(AC__LIBREPLACE_ONLY_CC_CHECKS_START, 3[ 4echo "LIBREPLACE_CC_CHECKS: START" 5]) 6 7AC_DEFUN_ONCE(AC__LIBREPLACE_ONLY_CC_CHECKS_END, 8[ 9echo "LIBREPLACE_CC_CHECKS: END" 10]) 11 12dnl 13dnl 14dnl AC_LIBREPLACE_CC_CHECKS 15dnl 16dnl Note: we need to use m4_define instead of AC_DEFUN because 17dnl of the ordering of tests 18dnl 19dnl 20m4_define(AC_LIBREPLACE_CC_CHECKS, 21[ 22AC__LIBREPLACE_ONLY_CC_CHECKS_START 23 24dnl stop the C89 attempt by autoconf - if autoconf detects -Ae it will enable it 25dnl which conflicts with C99 on HPUX 26ac_cv_prog_cc_Ae=no 27 28savedCFLAGS=$CFLAGS 29AC_PROG_CC 30CFLAGS=$savedCFLAGS 31 32dnl don't try for C99 if we are using gcc, as otherwise we 33dnl lose immediate structure constants 34if test x"$GCC" != x"yes" ; then 35AC_PROG_CC_C99 36fi 37 38if test x"$GCC" = x"yes" ; then 39 AC_MSG_CHECKING([for version of gcc]) 40 GCC_VERSION=`$CC -dumpversion` 41 AC_MSG_RESULT(${GCC_VERSION}) 42fi 43AC_USE_SYSTEM_EXTENSIONS 44AC_C_BIGENDIAN 45AC_C_INLINE 46LIBREPLACE_C99_STRUCT_INIT([],[AC_MSG_WARN([c99 structure initializer are not supported])]) 47 48AC_PROG_INSTALL 49 50AC_ISC_POSIX 51AC_EXTENSION_FLAG(_XOPEN_SOURCE_EXTENDED) 52AC_EXTENSION_FLAG(_OSF_SOURCE) 53 54AC_SYS_LARGEFILE 55 56dnl Add #include for broken IRIX header files 57case "$host_os" in 58 *irix6*) AC_ADD_INCLUDE(<standards.h>) 59 ;; 60 *hpux*) 61 # mmap on HPUX is completely broken... 62 AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken]) 63 if test "`uname -r`" = "B.11.11"; then 64 AC_MSG_WARN([Enabling HPUX 11.11 header bug workaround]) 65 CFLAGS="$CFLAGS -D_LARGEFILE64_SUPPORT -D__LP64__ -DO_LARGEFILE=04000" 66 fi 67 if test "`uname -r`" = "B.11.23"; then 68 AC_MSG_WARN([Enabling HPUX 11.23 machine/sys/getppdp.h bug workaround]) 69 CFLAGS="$CFLAGS -D_MACHINE_SYS_GETPPDP_INCLUDED" 70 fi 71 ;; 72 *aix*) 73 AC_DEFINE(BROKEN_STRNDUP, 1, [Whether strndup is broken]) 74 AC_DEFINE(BROKEN_STRNLEN, 1, [Whether strnlen is broken]) 75 if test "${GCC}" != "yes"; then 76 ## for funky AIX compiler using strncpy() 77 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000" 78 fi 79 ;; 80 # 81 # VOS may need to have POSIX support and System V compatibility enabled. 82 # 83 *vos*) 84 case "$CFLAGS" in 85 *-D_POSIX_C_SOURCE*);; 86 *) 87 CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L" 88 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support]) 89 ;; 90 esac 91 case "$CFLAGS" in 92 *-D_SYSV*|*-D_SVID_SOURCE*);; 93 *) 94 CFLAGS="$CFLAGS -D_SYSV" 95 AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility]) 96 ;; 97 esac 98 ;; 99esac 100 101 102 103AC_CHECK_HEADERS([standards.h]) 104 105# Solaris needs HAVE_LONG_LONG defined 106AC_CHECK_TYPES(long long) 107 108AC_CHECK_TYPE(uint_t, unsigned int) 109AC_CHECK_TYPE(int8_t, char) 110AC_CHECK_TYPE(uint8_t, unsigned char) 111AC_CHECK_TYPE(int16_t, short) 112AC_CHECK_TYPE(uint16_t, unsigned short) 113AC_CHECK_TYPE(int32_t, long) 114AC_CHECK_TYPE(uint32_t, unsigned long) 115AC_CHECK_TYPE(int64_t, long long) 116AC_CHECK_TYPE(uint64_t, unsigned long long) 117 118AC_CHECK_TYPE(size_t, unsigned int) 119AC_CHECK_TYPE(ssize_t, int) 120 121AC_CHECK_SIZEOF(int) 122AC_CHECK_SIZEOF(char) 123AC_CHECK_SIZEOF(short) 124AC_CHECK_SIZEOF(long) 125AC_CHECK_SIZEOF(long long) 126 127AC_CHECK_SIZEOF(off_t) 128AC_CHECK_SIZEOF(size_t) 129AC_CHECK_SIZEOF(ssize_t) 130 131AC_CHECK_TYPE(intptr_t, unsigned long long) 132AC_CHECK_TYPE(ptrdiff_t, unsigned long long) 133 134if test x"$ac_cv_type_long_long" != x"yes";then 135 AC_MSG_ERROR([LIBREPLACE needs type 'long long']) 136fi 137if test $ac_cv_sizeof_long_long -lt 8;then 138 AC_MSG_ERROR([LIBREPLACE needs sizeof(long long) >= 8]) 139fi 140 141############################################ 142# check if the compiler can do immediate structures 143AC_SUBST(libreplace_cv_immediate_structures) 144AC_CACHE_CHECK([for immediate structures],libreplace_cv_immediate_structures,[ 145 AC_TRY_COMPILE([ 146 #include <stdio.h> 147 ],[ 148 typedef struct {unsigned x;} FOOBAR; 149 #define X_FOOBAR(x) ((FOOBAR) { x }) 150 #define FOO_ONE X_FOOBAR(1) 151 FOOBAR f = FOO_ONE; 152 static const struct { 153 FOOBAR y; 154 } f2[] = { 155 {FOO_ONE} 156 }; 157 ], 158 libreplace_cv_immediate_structures=yes, 159 libreplace_cv_immediate_structures=no, 160 libreplace_cv_immediate_structures=cross) 161]) 162if test x"$libreplace_cv_immediate_structures" = x"yes"; then 163 AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES,1,[Whether the compiler supports immediate structures]) 164fi 165 166AC__LIBREPLACE_ONLY_CC_CHECKS_END 167]) dnl end AC_LIBREPLACE_CC_CHECKS 168