1dnl cloned from autoconf 2.13 acspecific.m4 2AC_DEFUN([AC_C_LONG_LONG], 3[AC_CACHE_CHECK(for long long, ac_cv_c_long_long, 4[if test "$GCC" = yes; then 5 ac_cv_c_long_long=yes 6else 7AC_TRY_RUN([int main() { 8long long foo = 0; 9exit(sizeof(long long) < sizeof(long)); }], 10ac_cv_c_long_long=yes, ac_cv_c_long_long=no) 11fi]) 12if test $ac_cv_c_long_long = yes; then 13 AC_DEFINE(HAVE_LONG_LONG) 14fi 15]) 16 17dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight 18 19AC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT], 20[AC_REQUIRE([AC_STRUCT_TM])dnl 21AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone, 22[AC_TRY_COMPILE([#include <sys/types.h> 23#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;], 24 ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)]) 25if test "$ac_cv_struct_tm_zone" = yes; then 26 AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE]) 27fi 28AC_CACHE_CHECK(for tzname, ac_cv_var_tzname, 29[AC_TRY_LINK( 30changequote(<<, >>)dnl 31<<#include <time.h> 32#ifndef tzname /* For SGI. */ 33extern char *tzname[]; /* RS6000 and others reject char **tzname. */ 34#endif>>, 35changequote([, ])dnl 36[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)]) 37 if test $ac_cv_var_tzname = yes; then 38 AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME]) 39 fi 40 41AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst, 42[AC_TRY_COMPILE([#include <sys/types.h> 43#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;], 44 ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)]) 45if test "$ac_cv_struct_tm_isdst" = yes; then 46 AC_DEFINE(HAVE_TM_ISDST) 47fi 48AC_CACHE_CHECK(for daylight, ac_cv_var_daylight, 49[AC_TRY_LINK( 50changequote(<<, >>)dnl 51<<#include <time.h> 52#ifndef daylight /* In case IRIX #defines this, too */ 53extern int daylight; 54#endif>>, 55changequote([, ])dnl 56[atoi(daylight);], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)]) 57 if test $ac_cv_var_daylight = yes; then 58 AC_DEFINE(HAVE_DAYLIGHT) 59 fi 60]) 61 62dnl from autoconf 2.13 acgeneral.m4, with patch: 63dnl Date: Fri, 15 Jan 1999 05:52:41 -0800 64dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com> 65dnl From: eggert@twinsun.com (Paul Eggert) 66dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars 67dnl Newsgroups: gnu.utils.bug 68dnl 69dnl now include <stdint.h> if available 70 71dnl AC_CHECK_TYPE2_STDC(TYPE, DEFAULT) 72AC_DEFUN([AC_CHECK_TYPE2_STDC], 73[AC_REQUIRE([AC_HEADER_STDC])dnl 74AC_REQUIRE([AC_HEADER_STDINT])dnl 75AC_MSG_CHECKING(for $1) 76AC_CACHE_VAL(ac_cv_type_$1, 77[AC_EGREP_CPP(dnl 78[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]], 79[#if HAVE_STDINT_H 80#include <stdint.h> 81#endif 82#include <sys/types.h> 83#if STDC_HEADERS 84#include <stdlib.h> 85#include <stddef.h> 86#endif], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")])dnl 87if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then 88 AC_MSG_RESULT(yes) 89else 90 AC_MSG_RESULT(no) 91 AC_DEFINE_UNQUOTED($1, $2) 92fi 93]) 94 95dnl from autoconf 2.13 acgeneral.m4, with additional third argument 96dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE [, INCLUDES]]) 97AC_DEFUN([AC_CHECK_SIZEOF_INCLUDES], 98[dnl The name to #define. 99define([AC_TYPE_NAME], translit(sizeof_$1, [[[a-z *]]], [[[A-Z_P]]]))dnl 100dnl The cache variable name. 101define([AC_CV_NAME], translit(ac_cv_sizeof_$1, [[[ *]]], [[[_p]]]))dnl 102AC_MSG_CHECKING(size of $1) 103AC_CACHE_VAL(AC_CV_NAME, 104[AC_TRY_RUN([$3 105#include <stdio.h> 106main() 107{ 108 FILE *f=fopen("conftestval", "w"); 109 if (!f) exit(1); 110 fprintf(f, "%d\n", sizeof($1)); 111 exit(0); 112}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl 113AC_MSG_RESULT($AC_CV_NAME) 114AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) 115undefine([AC_TYPE_NAME])dnl 116undefine([AC_CV_NAME])dnl 117]) 118 119dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE]) 120AC_DEFUN([AC_CHECK_SIZEOF_STDC_HEADERS], 121[AC_REQUIRE([AC_HEADER_STDC])dnl 122AC_REQUIRE([AC_HEADER_STDINT])dnl 123AC_CHECK_SIZEOF_INCLUDES($1, $2, 124[#if HAVE_STDINT_H 125#include <stdint.h> 126#endif 127#include <sys/types.h> 128#ifdef STDC_HEADERS 129#include <stdlib.h> 130#endif 131]) 132]) 133 134 135dnl AC_CHECK_TYPE_STDC(TYPE, DEFAULT) 136AC_DEFUN([AC_CHECK_TYPE_STDC], 137[AC_REQUIRE([AC_HEADER_STDC])dnl 138AC_REQUIRE([AC_HEADER_STDINT])dnl 139AC_MSG_CHECKING(for $1) 140AC_CACHE_VAL(ac_cv_type_$1, 141[AC_EGREP_CPP(dnl 142[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]], 143[#if HAVE_STDINT_H 144#include <stdint.h> 145#endif 146#include <sys/types.h> 147#if STDC_HEADERS 148#include <stdlib.h> 149#include <stddef.h> 150#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl 151AC_MSG_RESULT($ac_cv_type_$1) 152if test $ac_cv_type_$1 = no; then 153 AC_DEFINE($1, $2) 154fi 155]) 156 157dnl AC_HEADER_STDINT 158AC_DEFUN([AC_HEADER_STDINT], [AC_CHECK_HEADERS(stdint.h)]) 159 160dnl By default, many hosts won't let programs access large files; 161dnl one must use special compiler options to get large-file access to work. 162dnl For more details about this brain damage please see: 163dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html 164 165dnl Written by Paul Eggert <eggert@twinsun.com>. 166 167dnl Internal subroutine of AC_SYS_LARGEFILE. 168dnl AC_SYS_LARGEFILE_TEST_INCLUDES 169AC_DEFUN([AC_SYS_LARGEFILE_TEST_INCLUDES], 170 [[#include <sys/types.h> 171 /* Check that off_t can represent 2**63 - 1 correctly. 172 We can't simply "#define LARGE_OFF_T 9223372036854775807", 173 since some C++ compilers masquerading as C compilers 174 incorrectly reject 9223372036854775807. */ 175# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) 176 int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 177 && LARGE_OFF_T % 2147483647 == 1) 178 ? 1 : -1]; 179 ]]) 180 181dnl Internal subroutine of AC_SYS_LARGEFILE. 182dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLU= 183DES, FUNCTION-BODY) 184AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE], 185 [AC_CACHE_CHECK([for $1 value needed for large files], $3, 186 [$3=no 187 AC_TRY_COMPILE([$5], 188 [$6], 189 , 190 [AC_TRY_COMPILE([#define $1 $2] 191[$5] 192 , 193 [$6], 194 [$3=$2])])]) 195 if test "[$]$3" != no; then 196 AC_DEFINE_UNQUOTED([$1], [$]$3, [$4]) 197 fi]) 198 199AC_DEFUN([AC_SYS_LARGEFILE], 200 [AC_REQUIRE([AC_PROG_CC]) 201 AC_ARG_ENABLE(largefile, 202 [ --disable-largefile omit support for large files]) 203 if test "$enable_largefile" != no; then 204 205 AC_CACHE_CHECK([for special C compiler options needed for large files= 206], 207 ac_cv_sys_largefile_CC, 208 [ac_cv_sys_largefile_CC=no 209 if test "$GCC" != yes; then 210 # IRIX 6.2 and later do not support large files by default, 211 # so use the C compiler's -n32 option if that helps. 212 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , , 213 [ac_save_CC="$CC" 214 CC="$CC -n32" 215 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , 216 ac_cv_sys_largefile_CC=' -n32') 217 CC="$ac_save_CC"]) 218 fi]) 219 if test "$ac_cv_sys_largefile_CC" != no; then 220 CC="$CC$ac_cv_sys_largefile_CC" 221 fi 222 223 AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, 224 ac_cv_sys_file_offset_bits, 225 [Number of bits in a file offset, on hosts where this is settable.], 226 AC_SYS_LARGEFILE_TEST_INCLUDES) 227 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, 228 ac_cv_sys_large_files, 229 [Define for large files, on AIX-style hosts.], 230 AC_SYS_LARGEFILE_TEST_INCLUDES) 231 fi 232 ]) 233 234AC_DEFUN([AC_FUNC_FSEEKO], 235 [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1, 236 ac_cv_sys_largefile_source, 237 [Define to make fseeko visible on some hosts (e.g. glibc 2.2).], 238 [#include <stdio.h>], [return !fseeko;]) 239 # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug 240 # in glibc 2.1.3, but that breaks too many other things. 241 # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. 242 243 AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko, 244 [ac_cv_func_fseeko=no 245 AC_TRY_LINK([#include <stdio.h>], 246 [return fseeko && fseeko (stdin, 0, 0);], 247 [ac_cv_func_fseeko=yes])]) 248 if test $ac_cv_func_fseeko != no; then 249 AC_DEFINE(HAVE_FSEEKO, 1, 250 [Define if fseeko (and presumably ftello) exists and is declared.]) 251 fi]) 252 253# From Paul Eggert. 254 255# BeOS 5 has <wchar.h> but does not define mbstate_t, 256# so you can't declare an object of that type. 257# Check for this incompatibility with Standard C. 258 259# Include stdlib.h first, because otherwise this test would fail on Linux 260# (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits 261# a syntax error in wchar.h due to the use of undefined __int32_t. 262AC_DEFUN([AC_MBSTATE_T], 263 [ 264 AC_CHECK_HEADERS(stdlib.h) 265 266 AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t, 267 [AC_TRY_COMPILE([ 268#if HAVE_STDLIB_H 269# include <stdlib.h> 270#endif 271#include <wchar.h>], 272 [mbstate_t x; return sizeof x;], 273 ac_cv_type_mbstate_t=yes, 274 ac_cv_type_mbstate_t=no)]) 275 if test $ac_cv_type_mbstate_t = no; then 276 AC_DEFINE(mbstate_t, int, 277 [Define to a type if <wchar.h> does not define.]) 278 fi]) 279 280 281