Merge from vendor branch DIFFUTILS:
[dragonfly.git] / contrib / file / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p5
2
3 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl cloned from autoconf 2.13 acspecific.m4
14 AC_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
18 else
19 AC_TRY_RUN([int main() {
20 long long foo = 0;
21 exit(sizeof(long long) < sizeof(long)); }],
22 ac_cv_c_long_long=yes, ac_cv_c_long_long=no)
23 fi])
24 if test $ac_cv_c_long_long = yes; then
25   AC_DEFINE(HAVE_LONG_LONG)
26 fi
27 ])
28
29 dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
30
31 AC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
32 [AC_REQUIRE([AC_STRUCT_TM])dnl
33 AC_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)])
37 if test "$ac_cv_struct_tm_zone" = yes; then
38   AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
39 fi
40 AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
41 [AC_TRY_LINK(
42 changequote(<<, >>)dnl
43 <<#include <time.h>
44 #ifndef tzname /* For SGI.  */
45 extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
46 #endif>>,
47 changequote([, ])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
53 AC_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)])
57 if test "$ac_cv_struct_tm_isdst" = yes; then
58   AC_DEFINE(HAVE_TM_ISDST)
59 fi
60 AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
61 [AC_TRY_LINK(
62 changequote(<<, >>)dnl
63 <<#include <time.h>
64 #ifndef daylight /* In case IRIX #defines this, too  */
65 extern int daylight;
66 #endif>>,
67 changequote([, ])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
74 dnl from autoconf 2.13 acgeneral.m4, with patch:
75 dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
76 dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
77 dnl From: eggert@twinsun.com (Paul Eggert)
78 dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
79 dnl Newsgroups: gnu.utils.bug
80 dnl
81 dnl now include <stdint.h> if available
82
83 dnl AC_CHECK_TYPE2_STDC(TYPE, DEFAULT)
84 AC_DEFUN([AC_CHECK_TYPE2_STDC],
85 [AC_REQUIRE([AC_HEADER_STDC])dnl
86 AC_REQUIRE([AC_HEADER_STDINT])dnl
87 AC_MSG_CHECKING(for $1)
88 AC_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
99 if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then
100   AC_MSG_RESULT(yes)
101 else
102   AC_MSG_RESULT(no)
103   AC_DEFINE_UNQUOTED($1, $2)
104 fi
105 ])
106
107 dnl from autoconf 2.13 acgeneral.m4, with additional third argument
108 dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE [, INCLUDES]])
109 AC_DEFUN([AC_CHECK_SIZEOF_INCLUDES],
110 [dnl The name to #define.
111 define([AC_TYPE_NAME], translit(sizeof_$1, [[[a-z *]]], [[[A-Z_P]]]))dnl
112 dnl The cache variable name.
113 define([AC_CV_NAME], translit(ac_cv_sizeof_$1, [[[ *]]], [[[_p]]]))dnl
114 AC_MSG_CHECKING(size of $1)
115 AC_CACHE_VAL(AC_CV_NAME,
116 [AC_TRY_RUN([$3
117 #include <stdio.h>
118 main()
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
125 AC_MSG_RESULT($AC_CV_NAME)
126 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
127 undefine([AC_TYPE_NAME])dnl
128 undefine([AC_CV_NAME])dnl
129 ])
130
131 dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE])
132 AC_DEFUN([AC_CHECK_SIZEOF_STDC_HEADERS],
133 [AC_REQUIRE([AC_HEADER_STDC])dnl
134 AC_REQUIRE([AC_HEADER_STDINT])dnl
135 AC_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
147 dnl AC_CHECK_TYPE_STDC(TYPE, DEFAULT)
148 AC_DEFUN([AC_CHECK_TYPE_STDC],
149 [AC_REQUIRE([AC_HEADER_STDC])dnl
150 AC_REQUIRE([AC_HEADER_STDINT])dnl
151 AC_MSG_CHECKING(for $1)
152 AC_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
163 AC_MSG_RESULT($ac_cv_type_$1)
164 if test $ac_cv_type_$1 = no; then
165   AC_DEFINE($1, $2)
166 fi
167 ])
168
169 dnl AC_HEADER_STDINT
170 AC_DEFUN([AC_HEADER_STDINT], [AC_CHECK_HEADERS(stdint.h)])
171
172 #serial 19
173
174 dnl By default, many hosts won't let programs access large files;
175 dnl one must use special compiler options to get large-file access to work.
176 dnl For more details about this brain damage please see:
177 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
178
179 dnl Written by Paul Eggert <eggert@twinsun.com>.
180
181 dnl Internal subroutine of AC_SYS_LARGEFILE.
182 dnl AC_SYS_LARGEFILE_TEST_INCLUDES
183 AC_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
195 dnl Internal subroutine of AC_SYS_LARGEFILE.
196 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLU=
197 DES, FUNCTION-BODY)
198 AC_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
213 AC_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
248 AC_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
274 dnl Usage:
275 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
276
277 AC_DEFUN([AM_INIT_AUTOMAKE],
278 [AC_REQUIRE([AC_PROG_INSTALL])
279 PACKAGE=[$1]
280 AC_SUBST(PACKAGE)
281 VERSION=[$2]
282 AC_SUBST(VERSION)
283 dnl test to see if srcdir already configured
284 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
285   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
286 fi
287 ifelse([$3],,
288 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
289 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
290 AC_REQUIRE([AM_SANITY_CHECK])
291 AC_REQUIRE([AC_ARG_PROGRAM])
292 dnl FIXME This is truly gross.
293 missing_dir=`cd $ac_aux_dir && pwd`
294 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
295 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
296 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
297 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
298 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
299 AC_REQUIRE([AC_PROG_MAKE_SET])])
300
301 #
302 # Check to make sure that the build environment is sane.
303 #
304
305 AC_DEFUN([AM_SANITY_CHECK],
306 [AC_MSG_CHECKING([whether build environment is sane])
307 # Just in case
308 sleep 1
309 echo 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).
315 if (
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
329 alias in your environment])
330    fi
331
332    test "[$]2" = conftestfile
333    )
334 then
335    # Ok.
336    :
337 else
338    AC_MSG_ERROR([newly created file is older than distributed files!
339 Check your system clock])
340 fi
341 rm -f conftest*
342 AC_MSG_RESULT(yes)])
343
344 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
345 dnl The program must properly implement --version.
346 AC_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.
351 if ($2 --version) < /dev/null > /dev/null 2>&1; then
352    $1=$2
353    AC_MSG_RESULT(found)
354 else
355    $1="$3/missing $2"
356    AC_MSG_RESULT(missing)
357 fi
358 AC_SUBST($1)])
359
360 # Like AC_CONFIG_HEADER, but automatically create stamp file.
361
362 AC_DEFUN([AM_CONFIG_HEADER],
363 [AC_PREREQ([2.12])
364 AC_CONFIG_HEADER([$1])
365 dnl When config.status generates a header, we must update the stamp-h file.
366 dnl This file resides in the same directory as the config header
367 dnl that is generated.  We must strip everything past the first ":",
368 dnl and everything past the last "/".
369 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
370 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
371 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
372 <<am_indx=1
373 for 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`
380 done<<>>dnl>>)
381 changequote([,]))])
382
383 # Define a conditional.
384
385 AC_DEFUN([AM_CONDITIONAL],
386 [AC_SUBST($1_TRUE)
387 AC_SUBST($1_FALSE)
388 if $2; then
389   $1_TRUE=
390   $1_FALSE='#'
391 else
392   $1_TRUE='#'
393   $1_FALSE=
394 fi])
395