]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/file/aclocal.m4
Virgin import of Christos Zoulas's FILE 3.37.
[FreeBSD/FreeBSD.git] / contrib / file / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 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 acgeneral.m4, with patch:
30 dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
31 dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
32 dnl From: eggert@twinsun.com (Paul Eggert)
33 dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
34 dnl Newsgroups: gnu.utils.bug
35
36 dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
37
38 AC_DEFUN(AC_STRUCT_TIMEZONE_DAYLIGHT,
39 [AC_REQUIRE([AC_STRUCT_TM])dnl
40 AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
41 [AC_TRY_COMPILE([#include <sys/types.h>
42 #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
43   ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
44 if test "$ac_cv_struct_tm_zone" = yes; then
45   AC_DEFINE(HAVE_TM_ZONE)
46 fi
47 AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
48 [AC_TRY_LINK(
49 changequote(<<, >>)dnl
50 <<#include <time.h>
51 #ifndef tzname /* For SGI.  */
52 extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
53 #endif>>,
54 changequote([, ])dnl
55 [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
56   if test $ac_cv_var_tzname = yes; then
57     AC_DEFINE(HAVE_TZNAME)
58   fi
59
60 AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
61 [AC_TRY_COMPILE([#include <sys/types.h>
62 #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;],
63   ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
64 if test "$ac_cv_struct_tm_isdst" = yes; then
65   AC_DEFINE(HAVE_TM_ISDST)
66 fi
67 AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
68 [AC_TRY_LINK(
69 changequote(<<, >>)dnl
70 <<#include <time.h>
71 #ifndef daylight /* In case IRIX #defines this, too  */
72 extern int daylight;
73 #endif>>,
74 changequote([, ])dnl
75 [atoi(daylight);], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
76   if test $ac_cv_var_daylight = yes; then
77     AC_DEFINE(HAVE_DAYLIGHT)
78   fi
79 ])
80
81 dnl AC_CHECK_TYPE2(TYPE, DEFAULT)
82 AC_DEFUN(AC_CHECK_TYPE2,
83 [AC_REQUIRE([AC_HEADER_STDC])dnl
84 AC_MSG_CHECKING(for $1)
85 AC_CACHE_VAL(ac_cv_type_$1,
86 [AC_EGREP_CPP(dnl
87 changequote(<<,>>)dnl
88 <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
89 changequote([,]), [#include <sys/types.h>
90 #if STDC_HEADERS
91 #include <stdlib.h>
92 #include <stddef.h>
93 #endif], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")])dnl
94 if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then
95   AC_MSG_RESULT(yes)
96 else
97   AC_MSG_RESULT(no)
98   AC_DEFINE_UNQUOTED($1, $2)
99 fi
100 ])
101
102 dnl from autoconf 2.13 acgeneral.m4, with additional third argument
103 dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE, [INCLUDES]])
104 AC_DEFUN(AC_CHECK_SIZEOF_INCLUDES,
105 [changequote(<<, >>)dnl
106 dnl The name to #define.
107 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
108 dnl The cache variable name.
109 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
110 changequote([, ])dnl
111 AC_MSG_CHECKING(size of $1)
112 AC_CACHE_VAL(AC_CV_NAME,
113 [AC_TRY_RUN([$3
114 #include <stdio.h>
115 main()
116 {
117   FILE *f=fopen("conftestval", "w");
118   if (!f) exit(1);
119   fprintf(f, "%d\n", sizeof($1));
120   exit(0);
121 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
122 AC_MSG_RESULT($AC_CV_NAME)
123 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
124 undefine([AC_TYPE_NAME])dnl
125 undefine([AC_CV_NAME])dnl
126 ])
127
128 dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE])
129 AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS,
130 [AC_CHECK_SIZEOF_INCLUDES($1, $2,
131 [#include <sys/types.h>
132 #ifdef STDC_HEADERS
133 #include <stdlib.h>
134 #endif
135 ])
136 ])
137
138 # Do all the work for Automake.  This macro actually does too much --
139 # some checks are only needed if your package does certain things.
140 # But this isn't really a big deal.
141
142 # serial 1
143
144 dnl Usage:
145 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
146
147 AC_DEFUN(AM_INIT_AUTOMAKE,
148 [AC_REQUIRE([AC_PROG_INSTALL])
149 PACKAGE=[$1]
150 AC_SUBST(PACKAGE)
151 VERSION=[$2]
152 AC_SUBST(VERSION)
153 dnl test to see if srcdir already configured
154 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
155   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
156 fi
157 ifelse([$3],,
158 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
159 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
160 AC_REQUIRE([AM_SANITY_CHECK])
161 AC_REQUIRE([AC_ARG_PROGRAM])
162 dnl FIXME This is truly gross.
163 missing_dir=`cd $ac_aux_dir && pwd`
164 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
165 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
166 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
167 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
168 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
169 AC_REQUIRE([AC_PROG_MAKE_SET])])
170
171 #
172 # Check to make sure that the build environment is sane.
173 #
174
175 AC_DEFUN(AM_SANITY_CHECK,
176 [AC_MSG_CHECKING([whether build environment is sane])
177 # Just in case
178 sleep 1
179 echo timestamp > conftestfile
180 # Do `set' in a subshell so we don't clobber the current shell's
181 # arguments.  Must try -L first in case configure is actually a
182 # symlink; some systems play weird games with the mod time of symlinks
183 # (eg FreeBSD returns the mod time of the symlink's containing
184 # directory).
185 if (
186    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
187    if test "[$]*" = "X"; then
188       # -L didn't work.
189       set X `ls -t $srcdir/configure conftestfile`
190    fi
191    if test "[$]*" != "X $srcdir/configure conftestfile" \
192       && test "[$]*" != "X conftestfile $srcdir/configure"; then
193
194       # If neither matched, then we have a broken ls.  This can happen
195       # if, for instance, CONFIG_SHELL is bash and it inherits a
196       # broken ls alias from the environment.  This has actually
197       # happened.  Such a system could not be considered "sane".
198       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
199 alias in your environment])
200    fi
201
202    test "[$]2" = conftestfile
203    )
204 then
205    # Ok.
206    :
207 else
208    AC_MSG_ERROR([newly created file is older than distributed files!
209 Check your system clock])
210 fi
211 rm -f conftest*
212 AC_MSG_RESULT(yes)])
213
214 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
215 dnl The program must properly implement --version.
216 AC_DEFUN(AM_MISSING_PROG,
217 [AC_MSG_CHECKING(for working $2)
218 # Run test in a subshell; some versions of sh will print an error if
219 # an executable is not found, even if stderr is redirected.
220 # Redirect stdin to placate older versions of autoconf.  Sigh.
221 if ($2 --version) < /dev/null > /dev/null 2>&1; then
222    $1=$2
223    AC_MSG_RESULT(found)
224 else
225    $1="$3/missing $2"
226    AC_MSG_RESULT(missing)
227 fi
228 AC_SUBST($1)])
229
230 # Like AC_CONFIG_HEADER, but automatically create stamp file.
231
232 AC_DEFUN(AM_CONFIG_HEADER,
233 [AC_PREREQ([2.12])
234 AC_CONFIG_HEADER([$1])
235 dnl When config.status generates a header, we must update the stamp-h file.
236 dnl This file resides in the same directory as the config header
237 dnl that is generated.  We must strip everything past the first ":",
238 dnl and everything past the last "/".
239 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
240 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
241 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
242 <<am_indx=1
243 for am_file in <<$1>>; do
244   case " <<$>>CONFIG_HEADERS " in
245   *" <<$>>am_file "*<<)>>
246     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
247     ;;
248   esac
249   am_indx=`expr "<<$>>am_indx" + 1`
250 done<<>>dnl>>)
251 changequote([,]))])
252
253 # Define a conditional.
254
255 AC_DEFUN(AM_CONDITIONAL,
256 [AC_SUBST($1_TRUE)
257 AC_SUBST($1_FALSE)
258 if $2; then
259   $1_TRUE=
260   $1_FALSE='#'
261 else
262   $1_TRUE='#'
263   $1_FALSE=
264 fi])
265