xref: /freebsd/contrib/file/aclocal.m4 (revision f0adf7f5cdd241db2f2c817683191a6ef64a4e95)
1dnl aclocal.m4 generated automatically by aclocal 1.4-p5
2
3dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13dnl cloned from autoconf 2.13 acspecific.m4
14AC_DEFUN([AC_C_LONG_LONG],
15[AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
16[if test "$GCC" = yes; then
17  ac_cv_c_long_long=yes
18else
19AC_TRY_RUN([int main() {
20long long foo = 0;
21exit(sizeof(long long) < sizeof(long)); }],
22ac_cv_c_long_long=yes, ac_cv_c_long_long=no)
23fi])
24if test $ac_cv_c_long_long = yes; then
25  AC_DEFINE(HAVE_LONG_LONG)
26fi
27])
28
29dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
30
31AC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
32[AC_REQUIRE([AC_STRUCT_TM])dnl
33AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
34[AC_TRY_COMPILE([#include <sys/types.h>
35#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
36  ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
37if test "$ac_cv_struct_tm_zone" = yes; then
38  AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
39fi
40AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
41[AC_TRY_LINK(
42changequote(<<, >>)dnl
43<<#include <time.h>
44#ifndef tzname /* For SGI.  */
45extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
46#endif>>,
47changequote([, ])dnl
48[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
49  if test $ac_cv_var_tzname = yes; then
50    AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
51  fi
52
53AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
54[AC_TRY_COMPILE([#include <sys/types.h>
55#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;],
56  ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
57if test "$ac_cv_struct_tm_isdst" = yes; then
58  AC_DEFINE(HAVE_TM_ISDST)
59fi
60AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
61[AC_TRY_LINK(
62changequote(<<, >>)dnl
63<<#include <time.h>
64#ifndef daylight /* In case IRIX #defines this, too  */
65extern int daylight;
66#endif>>,
67changequote([, ])dnl
68[atoi(daylight);], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
69  if test $ac_cv_var_daylight = yes; then
70    AC_DEFINE(HAVE_DAYLIGHT)
71  fi
72])
73
74dnl from autoconf 2.13 acgeneral.m4, with patch:
75dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
76dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
77dnl From: eggert@twinsun.com (Paul Eggert)
78dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
79dnl Newsgroups: gnu.utils.bug
80dnl
81dnl now include <stdint.h> if available
82
83dnl AC_CHECK_TYPE2_STDC(TYPE, DEFAULT)
84AC_DEFUN([AC_CHECK_TYPE2_STDC],
85[AC_REQUIRE([AC_HEADER_STDC])dnl
86AC_REQUIRE([AC_HEADER_STDINT])dnl
87AC_MSG_CHECKING(for $1)
88AC_CACHE_VAL(ac_cv_type_$1,
89[AC_EGREP_CPP(dnl
90[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
91[#if HAVE_STDINT_H
92#include <stdint.h>
93#endif
94#include <sys/types.h>
95#if STDC_HEADERS
96#include <stdlib.h>
97#include <stddef.h>
98#endif], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")])dnl
99if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then
100  AC_MSG_RESULT(yes)
101else
102  AC_MSG_RESULT(no)
103  AC_DEFINE_UNQUOTED($1, $2)
104fi
105])
106
107dnl from autoconf 2.13 acgeneral.m4, with additional third argument
108dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE [, INCLUDES]])
109AC_DEFUN([AC_CHECK_SIZEOF_INCLUDES],
110[dnl The name to #define.
111define([AC_TYPE_NAME], translit(sizeof_$1, [[[a-z *]]], [[[A-Z_P]]]))dnl
112dnl The cache variable name.
113define([AC_CV_NAME], translit(ac_cv_sizeof_$1, [[[ *]]], [[[_p]]]))dnl
114AC_MSG_CHECKING(size of $1)
115AC_CACHE_VAL(AC_CV_NAME,
116[AC_TRY_RUN([$3
117#include <stdio.h>
118main()
119{
120  FILE *f=fopen("conftestval", "w");
121  if (!f) exit(1);
122  fprintf(f, "%d\n", sizeof($1));
123  exit(0);
124}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
125AC_MSG_RESULT($AC_CV_NAME)
126AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
127undefine([AC_TYPE_NAME])dnl
128undefine([AC_CV_NAME])dnl
129])
130
131dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE])
132AC_DEFUN([AC_CHECK_SIZEOF_STDC_HEADERS],
133[AC_REQUIRE([AC_HEADER_STDC])dnl
134AC_REQUIRE([AC_HEADER_STDINT])dnl
135AC_CHECK_SIZEOF_INCLUDES($1, $2,
136[#if HAVE_STDINT_H
137#include <stdint.h>
138#endif
139#include <sys/types.h>
140#ifdef STDC_HEADERS
141#include <stdlib.h>
142#endif
143])
144])
145
146
147dnl AC_CHECK_TYPE_STDC(TYPE, DEFAULT)
148AC_DEFUN([AC_CHECK_TYPE_STDC],
149[AC_REQUIRE([AC_HEADER_STDC])dnl
150AC_REQUIRE([AC_HEADER_STDINT])dnl
151AC_MSG_CHECKING(for $1)
152AC_CACHE_VAL(ac_cv_type_$1,
153[AC_EGREP_CPP(dnl
154[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
155[#if HAVE_STDINT_H
156#include <stdint.h>
157#endif
158#include <sys/types.h>
159#if STDC_HEADERS
160#include <stdlib.h>
161#include <stddef.h>
162#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
163AC_MSG_RESULT($ac_cv_type_$1)
164if test $ac_cv_type_$1 = no; then
165  AC_DEFINE($1, $2)
166fi
167])
168
169dnl AC_HEADER_STDINT
170AC_DEFUN([AC_HEADER_STDINT], [AC_CHECK_HEADERS(stdint.h)])
171
172#serial 19
173
174dnl By default, many hosts won't let programs access large files;
175dnl one must use special compiler options to get large-file access to work.
176dnl For more details about this brain damage please see:
177dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
178
179dnl Written by Paul Eggert <eggert@twinsun.com>.
180
181dnl Internal subroutine of AC_SYS_LARGEFILE.
182dnl AC_SYS_LARGEFILE_TEST_INCLUDES
183AC_DEFUN([AC_SYS_LARGEFILE_TEST_INCLUDES],
184  [[#include <sys/types.h>
185    /* Check that off_t can represent 2**63 - 1 correctly.
186       We can't simply "#define LARGE_OFF_T 9223372036854775807",
187       since some C++ compilers masquerading as C compilers
188       incorrectly reject 9223372036854775807.  */
189#   define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
190    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
191			&& LARGE_OFF_T % 2147483647 == 1)
192		       ? 1 : -1];
193  ]])
194
195dnl Internal subroutine of AC_SYS_LARGEFILE.
196dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLU=
197DES, FUNCTION-BODY)
198AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
199  [AC_CACHE_CHECK([for $1 value needed for large files], $3,
200     [$3=no
201      AC_TRY_COMPILE([$5],
202	[$6],
203	,
204	[AC_TRY_COMPILE([#define $1 $2]
205[$5]
206	   ,
207	   [$6],
208	   [$3=$2])])])
209   if test "[$]$3" != no; then
210     AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
211   fi])
212
213AC_DEFUN([AC_SYS_LARGEFILE],
214  [AC_REQUIRE([AC_PROG_CC])
215   AC_ARG_ENABLE(largefile,
216     [  --disable-largefile     omit support for large files])
217   if test "$enable_largefile" != no; then
218
219     AC_CACHE_CHECK([for special C compiler options needed for large files=
220],
221       ac_cv_sys_largefile_CC,
222       [ac_cv_sys_largefile_CC=no
223        if test "$GCC" != yes; then
224	  # IRIX 6.2 and later do not support large files by default,
225	  # so use the C compiler's -n32 option if that helps.
226	  AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
227	    [ac_save_CC="$CC"
228	     CC="$CC -n32"
229	     AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
230	       ac_cv_sys_largefile_CC=' -n32')
231	     CC="$ac_save_CC"])
232        fi])
233     if test "$ac_cv_sys_largefile_CC" != no; then
234       CC="$CC$ac_cv_sys_largefile_CC"
235     fi
236
237     AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
238       ac_cv_sys_file_offset_bits,
239       [Number of bits in a file offset, on hosts where this is settable.],
240       AC_SYS_LARGEFILE_TEST_INCLUDES)
241     AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
242       ac_cv_sys_large_files,
243       [Define for large files, on AIX-style hosts.],
244       AC_SYS_LARGEFILE_TEST_INCLUDES)
245   fi
246  ])
247
248AC_DEFUN([AC_FUNC_FSEEKO],
249  [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
250     ac_cv_sys_largefile_source,
251     [Define to make fseeko visible on some hosts (e.g. glibc 2.2).],
252     [#include <stdio.h>], [return !fseeko;])
253   # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
254   # in glibc 2.1.3, but that breaks too many other things.
255   # If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
256
257   AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko,
258     [ac_cv_func_fseeko=no
259      AC_TRY_LINK([#include <stdio.h>],
260        [return fseeko && fseeko (stdin, 0, 0);],
261	[ac_cv_func_fseeko=yes])])
262   if test $ac_cv_func_fseeko != no; then
263     AC_DEFINE(HAVE_FSEEKO, 1,
264       [Define if fseeko (and presumably ftello) exists and is declared.])
265   fi])
266
267
268# Do all the work for Automake.  This macro actually does too much --
269# some checks are only needed if your package does certain things.
270# But this isn't really a big deal.
271
272# serial 1
273
274dnl Usage:
275dnl AM_INIT_AUTOMAKE(package,version, [no-define])
276
277AC_DEFUN([AM_INIT_AUTOMAKE],
278[AC_REQUIRE([AC_PROG_INSTALL])
279PACKAGE=[$1]
280AC_SUBST(PACKAGE)
281VERSION=[$2]
282AC_SUBST(VERSION)
283dnl test to see if srcdir already configured
284if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
285  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
286fi
287ifelse([$3],,
288AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
289AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
290AC_REQUIRE([AM_SANITY_CHECK])
291AC_REQUIRE([AC_ARG_PROGRAM])
292dnl FIXME This is truly gross.
293missing_dir=`cd $ac_aux_dir && pwd`
294AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
295AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
296AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
297AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
298AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
299AC_REQUIRE([AC_PROG_MAKE_SET])])
300
301#
302# Check to make sure that the build environment is sane.
303#
304
305AC_DEFUN([AM_SANITY_CHECK],
306[AC_MSG_CHECKING([whether build environment is sane])
307# Just in case
308sleep 1
309echo timestamp > conftestfile
310# Do `set' in a subshell so we don't clobber the current shell's
311# arguments.  Must try -L first in case configure is actually a
312# symlink; some systems play weird games with the mod time of symlinks
313# (eg FreeBSD returns the mod time of the symlink's containing
314# directory).
315if (
316   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
317   if test "[$]*" = "X"; then
318      # -L didn't work.
319      set X `ls -t $srcdir/configure conftestfile`
320   fi
321   if test "[$]*" != "X $srcdir/configure conftestfile" \
322      && test "[$]*" != "X conftestfile $srcdir/configure"; then
323
324      # If neither matched, then we have a broken ls.  This can happen
325      # if, for instance, CONFIG_SHELL is bash and it inherits a
326      # broken ls alias from the environment.  This has actually
327      # happened.  Such a system could not be considered "sane".
328      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
329alias in your environment])
330   fi
331
332   test "[$]2" = conftestfile
333   )
334then
335   # Ok.
336   :
337else
338   AC_MSG_ERROR([newly created file is older than distributed files!
339Check your system clock])
340fi
341rm -f conftest*
342AC_MSG_RESULT(yes)])
343
344dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
345dnl The program must properly implement --version.
346AC_DEFUN([AM_MISSING_PROG],
347[AC_MSG_CHECKING(for working $2)
348# Run test in a subshell; some versions of sh will print an error if
349# an executable is not found, even if stderr is redirected.
350# Redirect stdin to placate older versions of autoconf.  Sigh.
351if ($2 --version) < /dev/null > /dev/null 2>&1; then
352   $1=$2
353   AC_MSG_RESULT(found)
354else
355   $1="$3/missing $2"
356   AC_MSG_RESULT(missing)
357fi
358AC_SUBST($1)])
359
360# Like AC_CONFIG_HEADER, but automatically create stamp file.
361
362AC_DEFUN([AM_CONFIG_HEADER],
363[AC_PREREQ([2.12])
364AC_CONFIG_HEADER([$1])
365dnl When config.status generates a header, we must update the stamp-h file.
366dnl This file resides in the same directory as the config header
367dnl that is generated.  We must strip everything past the first ":",
368dnl and everything past the last "/".
369AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
370ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
371<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
372<<am_indx=1
373for am_file in <<$1>>; do
374  case " <<$>>CONFIG_HEADERS " in
375  *" <<$>>am_file "*<<)>>
376    echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
377    ;;
378  esac
379  am_indx=`expr "<<$>>am_indx" + 1`
380done<<>>dnl>>)
381changequote([,]))])
382
383# Define a conditional.
384
385AC_DEFUN([AM_CONDITIONAL],
386[AC_SUBST($1_TRUE)
387AC_SUBST($1_FALSE)
388if $2; then
389  $1_TRUE=
390  $1_FALSE='#'
391else
392  $1_TRUE='#'
393  $1_FALSE=
394fi])
395
396