1 dnl cloned from autoconf 2.13 acspecific.m4
2 AC_DEFUN([AC_C_LONG_LONG],
3 [AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
4 [if test "$GCC" = yes; then
7 AC_TRY_RUN([int main() {
9 exit(sizeof(long long) < sizeof(long)); }],
10 ac_cv_c_long_long=yes, ac_cv_c_long_long=no)
12 if test $ac_cv_c_long_long = yes; then
13 AC_DEFINE(HAVE_LONG_LONG)
17 dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
19 AC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
20 [AC_REQUIRE([AC_STRUCT_TM])dnl
21 AC_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)])
25 if test "$ac_cv_struct_tm_zone" = yes; then
26 AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
28 AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
30 changequote(<<, >>)dnl
32 #ifndef tzname /* For SGI. */
33 extern char *tzname[]; /* RS6000 and others reject char **tzname. */
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])
41 AC_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)])
45 if test "$ac_cv_struct_tm_isdst" = yes; then
46 AC_DEFINE(HAVE_TM_ISDST)
48 AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
50 changequote(<<, >>)dnl
52 #ifndef daylight /* In case IRIX #defines this, too */
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)
62 dnl from autoconf 2.13 acgeneral.m4, with patch:
63 dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
64 dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
65 dnl From: eggert@twinsun.com (Paul Eggert)
66 dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
67 dnl Newsgroups: gnu.utils.bug
69 dnl now include <stdint.h> if available
71 dnl AC_CHECK_TYPE2_STDC(TYPE, DEFAULT)
72 AC_DEFUN([AC_CHECK_TYPE2_STDC],
73 [AC_REQUIRE([AC_HEADER_STDC])dnl
74 AC_REQUIRE([AC_HEADER_STDINT])dnl
75 AC_MSG_CHECKING(for $1)
76 AC_CACHE_VAL(ac_cv_type_$1,
78 [(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
82 #include <sys/types.h>
86 #endif], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")])dnl
87 if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then
91 AC_DEFINE_UNQUOTED($1, $2)
95 dnl from autoconf 2.13 acgeneral.m4, with additional third argument
96 dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE [, INCLUDES]])
97 AC_DEFUN([AC_CHECK_SIZEOF_INCLUDES],
98 [dnl The name to #define.
99 define([AC_TYPE_NAME], translit(sizeof_$1, [[[a-z *]]], [[[A-Z_P]]]))dnl
100 dnl The cache variable name.
101 define([AC_CV_NAME], translit(ac_cv_sizeof_$1, [[[ *]]], [[[_p]]]))dnl
102 AC_MSG_CHECKING(size of $1)
103 AC_CACHE_VAL(AC_CV_NAME,
108 FILE *f=fopen("conftestval", "w");
110 fprintf(f, "%d\n", sizeof($1));
112 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
113 AC_MSG_RESULT($AC_CV_NAME)
114 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
115 undefine([AC_TYPE_NAME])dnl
116 undefine([AC_CV_NAME])dnl
119 dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE])
120 AC_DEFUN([AC_CHECK_SIZEOF_STDC_HEADERS],
121 [AC_REQUIRE([AC_HEADER_STDC])dnl
122 AC_REQUIRE([AC_HEADER_STDINT])dnl
123 AC_CHECK_SIZEOF_INCLUDES($1, $2,
127 #include <sys/types.h>
135 dnl AC_CHECK_TYPE_STDC(TYPE, DEFAULT)
136 AC_DEFUN([AC_CHECK_TYPE_STDC],
137 [AC_REQUIRE([AC_HEADER_STDC])dnl
138 AC_REQUIRE([AC_HEADER_STDINT])dnl
139 AC_MSG_CHECKING(for $1)
140 AC_CACHE_VAL(ac_cv_type_$1,
142 [(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
146 #include <sys/types.h>
150 #endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
151 AC_MSG_RESULT($ac_cv_type_$1)
152 if test $ac_cv_type_$1 = no; then
158 AC_DEFUN([AC_HEADER_STDINT], [AC_CHECK_HEADERS(stdint.h)])
162 dnl By default, many hosts won't let programs access large files;
163 dnl one must use special compiler options to get large-file access to work.
164 dnl For more details about this brain damage please see:
165 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
167 dnl Written by Paul Eggert <eggert@twinsun.com>.
169 dnl Internal subroutine of AC_SYS_LARGEFILE.
170 dnl AC_SYS_LARGEFILE_TEST_INCLUDES
171 AC_DEFUN([AC_SYS_LARGEFILE_TEST_INCLUDES],
172 [[#include <sys/types.h>
173 /* Check that off_t can represent 2**63 - 1 correctly.
174 We can't simply "#define LARGE_OFF_T 9223372036854775807",
175 since some C++ compilers masquerading as C compilers
176 incorrectly reject 9223372036854775807. */
177 # define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
178 int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
179 && LARGE_OFF_T % 2147483647 == 1)
183 dnl Internal subroutine of AC_SYS_LARGEFILE.
184 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLU=
186 AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
187 [AC_CACHE_CHECK([for $1 value needed for large files], $3,
192 [AC_TRY_COMPILE([#define $1 $2]
197 if test "[$]$3" != no; then
198 AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
201 AC_DEFUN([AC_SYS_LARGEFILE],
202 [AC_REQUIRE([AC_PROG_CC])
203 AC_ARG_ENABLE(largefile,
204 [ --disable-largefile omit support for large files])
205 if test "$enable_largefile" != no; then
207 AC_CACHE_CHECK([for special C compiler options needed for large files=
209 ac_cv_sys_largefile_CC,
210 [ac_cv_sys_largefile_CC=no
211 if test "$GCC" != yes; then
212 # IRIX 6.2 and later do not support large files by default,
213 # so use the C compiler's -n32 option if that helps.
214 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
217 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
218 ac_cv_sys_largefile_CC=' -n32')
221 if test "$ac_cv_sys_largefile_CC" != no; then
222 CC="$CC$ac_cv_sys_largefile_CC"
225 AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
226 ac_cv_sys_file_offset_bits,
227 [Number of bits in a file offset, on hosts where this is settable.],
228 AC_SYS_LARGEFILE_TEST_INCLUDES)
229 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
230 ac_cv_sys_large_files,
231 [Define for large files, on AIX-style hosts.],
232 AC_SYS_LARGEFILE_TEST_INCLUDES)
236 AC_DEFUN([AC_FUNC_FSEEKO],
237 [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
238 ac_cv_sys_largefile_source,
239 [Define to make fseeko visible on some hosts (e.g. glibc 2.2).],
240 [#include <stdio.h>], [return !fseeko;])
241 # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
242 # in glibc 2.1.3, but that breaks too many other things.
243 # If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
245 AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko,
246 [ac_cv_func_fseeko=no
247 AC_TRY_LINK([#include <stdio.h>],
248 [return fseeko && fseeko (stdin, 0, 0);],
249 [ac_cv_func_fseeko=yes])])
250 if test $ac_cv_func_fseeko != no; then
251 AC_DEFINE(HAVE_FSEEKO, 1,
252 [Define if fseeko (and presumably ftello) exists and is declared.])