]>
Commit | Line | Data |
---|---|---|
6fc74234 | 1 | # aclocal.m4 generated automatically by aclocal 1.5 |
705db0b5 | 2 | |
6fc74234 AD |
3 | # Copyright 1996, 1997, 1998, 1999, 2000, 2001 |
4 | # Free Software Foundation, Inc. | |
5 | # This file is free software; the Free Software Foundation | |
6 | # gives unlimited permission to copy and/or distribute it, | |
7 | # with or without modifications, as long as this notice is preserved. | |
705db0b5 | 8 | |
6fc74234 AD |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
11 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
12 | # PARTICULAR PURPOSE. | |
705db0b5 AD |
13 | |
14 | # Do all the work for Automake. This macro actually does too much -- | |
15 | # some checks are only needed if your package does certain things. | |
16 | # But this isn't really a big deal. | |
17 | ||
6fc74234 AD |
18 | # serial 5 |
19 | ||
20 | # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be | |
21 | # written in clear, in which case automake, when reading aclocal.m4, | |
22 | # will think it sees a *use*, and therefore will trigger all it's | |
23 | # C support machinery. Also note that it means that autoscan, seeing | |
24 | # CC etc. in the Makefile, will ask for an AC_PROG_CC use... | |
25 | ||
26 | ||
27 | # We require 2.13 because we rely on SHELL being computed by configure. | |
28 | AC_PREREQ([2.13]) | |
29 | ||
30 | # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) | |
31 | # ----------------------------------------------------------- | |
32 | # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED. | |
33 | # The purpose of this macro is to provide the user with a means to | |
34 | # check macros which are provided without letting her know how the | |
35 | # information is coded. | |
36 | # If this macro is not defined by Autoconf, define it here. | |
37 | ifdef([AC_PROVIDE_IFELSE], | |
38 | [], | |
39 | [define([AC_PROVIDE_IFELSE], | |
40 | [ifdef([AC_PROVIDE_$1], | |
41 | [$2], [$3])])]) | |
42 | ||
43 | ||
44 | # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE]) | |
45 | # ---------------------------------------------- | |
46 | AC_DEFUN([AM_INIT_AUTOMAKE], | |
47 | [AC_REQUIRE([AC_PROG_INSTALL])dnl | |
48 | # test to see if srcdir already configured | |
49 | if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && | |
50 | test -f $srcdir/config.status; then | |
51 | AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first]) | |
705db0b5 | 52 | fi |
6fc74234 AD |
53 | |
54 | # Define the identity of the package. | |
55 | PACKAGE=$1 | |
56 | AC_SUBST(PACKAGE)dnl | |
57 | VERSION=$2 | |
58 | AC_SUBST(VERSION)dnl | |
705db0b5 | 59 | ifelse([$3],, |
6fc74234 AD |
60 | [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) |
61 | AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) | |
62 | ||
63 | # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow | |
64 | # the ones we care about. | |
65 | ifdef([m4_pattern_allow], | |
66 | [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl | |
67 | ||
68 | # Autoconf 2.50 always computes EXEEXT. However we need to be | |
69 | # compatible with 2.13, for now. So we always define EXEEXT, but we | |
70 | # don't compute it. | |
71 | AC_SUBST(EXEEXT) | |
72 | # Similar for OBJEXT -- only we only use OBJEXT if the user actually | |
73 | # requests that it be used. This is a bit dumb. | |
74 | : ${OBJEXT=o} | |
75 | AC_SUBST(OBJEXT) | |
76 | ||
77 | # Some tools Automake needs. | |
78 | AC_REQUIRE([AM_SANITY_CHECK])dnl | |
79 | AC_REQUIRE([AC_ARG_PROGRAM])dnl | |
80 | AM_MISSING_PROG(ACLOCAL, aclocal) | |
81 | AM_MISSING_PROG(AUTOCONF, autoconf) | |
82 | AM_MISSING_PROG(AUTOMAKE, automake) | |
83 | AM_MISSING_PROG(AUTOHEADER, autoheader) | |
84 | AM_MISSING_PROG(MAKEINFO, makeinfo) | |
85 | AM_MISSING_PROG(AMTAR, tar) | |
86 | AM_PROG_INSTALL_SH | |
87 | AM_PROG_INSTALL_STRIP | |
88 | # We need awk for the "check" target. The system "awk" is bad on | |
89 | # some platforms. | |
90 | AC_REQUIRE([AC_PROG_AWK])dnl | |
91 | AC_REQUIRE([AC_PROG_MAKE_SET])dnl | |
92 | AC_REQUIRE([AM_DEP_TRACK])dnl | |
93 | AC_REQUIRE([AM_SET_DEPDIR])dnl | |
94 | AC_PROVIDE_IFELSE([AC_PROG_][CC], | |
95 | [_AM_DEPENDENCIES(CC)], | |
96 | [define([AC_PROG_][CC], | |
97 | defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl | |
98 | AC_PROVIDE_IFELSE([AC_PROG_][CXX], | |
99 | [_AM_DEPENDENCIES(CXX)], | |
100 | [define([AC_PROG_][CXX], | |
101 | defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl | |
102 | ]) | |
705db0b5 AD |
103 | |
104 | # | |
105 | # Check to make sure that the build environment is sane. | |
106 | # | |
107 | ||
6fc74234 AD |
108 | # serial 3 |
109 | ||
110 | # AM_SANITY_CHECK | |
111 | # --------------- | |
112 | AC_DEFUN([AM_SANITY_CHECK], | |
705db0b5 AD |
113 | [AC_MSG_CHECKING([whether build environment is sane]) |
114 | # Just in case | |
115 | sleep 1 | |
6fc74234 | 116 | echo timestamp > conftest.file |
705db0b5 AD |
117 | # Do `set' in a subshell so we don't clobber the current shell's |
118 | # arguments. Must try -L first in case configure is actually a | |
119 | # symlink; some systems play weird games with the mod time of symlinks | |
120 | # (eg FreeBSD returns the mod time of the symlink's containing | |
121 | # directory). | |
122 | if ( | |
6fc74234 AD |
123 | set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` |
124 | if test "$[*]" = "X"; then | |
705db0b5 | 125 | # -L didn't work. |
6fc74234 | 126 | set X `ls -t $srcdir/configure conftest.file` |
705db0b5 | 127 | fi |
6fc74234 AD |
128 | rm -f conftest.file |
129 | if test "$[*]" != "X $srcdir/configure conftest.file" \ | |
130 | && test "$[*]" != "X conftest.file $srcdir/configure"; then | |
705db0b5 AD |
131 | |
132 | # If neither matched, then we have a broken ls. This can happen | |
133 | # if, for instance, CONFIG_SHELL is bash and it inherits a | |
134 | # broken ls alias from the environment. This has actually | |
135 | # happened. Such a system could not be considered "sane". | |
136 | AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken | |
137 | alias in your environment]) | |
138 | fi | |
139 | ||
6fc74234 | 140 | test "$[2]" = conftest.file |
705db0b5 AD |
141 | ) |
142 | then | |
143 | # Ok. | |
144 | : | |
145 | else | |
146 | AC_MSG_ERROR([newly created file is older than distributed files! | |
147 | Check your system clock]) | |
148 | fi | |
705db0b5 AD |
149 | AC_MSG_RESULT(yes)]) |
150 | ||
6fc74234 AD |
151 | |
152 | # serial 2 | |
153 | ||
154 | # AM_MISSING_PROG(NAME, PROGRAM) | |
155 | # ------------------------------ | |
156 | AC_DEFUN([AM_MISSING_PROG], | |
157 | [AC_REQUIRE([AM_MISSING_HAS_RUN]) | |
158 | $1=${$1-"${am_missing_run}$2"} | |
159 | AC_SUBST($1)]) | |
160 | ||
161 | ||
162 | # AM_MISSING_HAS_RUN | |
163 | # ------------------ | |
164 | # Define MISSING if not defined so far and test if it supports --run. | |
165 | # If it does, set am_missing_run to use it, otherwise, to nothing. | |
166 | AC_DEFUN([AM_MISSING_HAS_RUN], | |
167 | [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl | |
168 | test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" | |
169 | # Use eval to expand $SHELL | |
170 | if eval "$MISSING --run true"; then | |
171 | am_missing_run="$MISSING --run " | |
705db0b5 | 172 | else |
6fc74234 AD |
173 | am_missing_run= |
174 | am_backtick='`' | |
175 | AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) | |
705db0b5 | 176 | fi |
6fc74234 AD |
177 | ]) |
178 | ||
179 | # AM_AUX_DIR_EXPAND | |
180 | ||
181 | # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets | |
182 | # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to | |
183 | # `$srcdir', `$srcdir/..', or `$srcdir/../..'. | |
184 | # | |
185 | # Of course, Automake must honor this variable whenever it calls a | |
186 | # tool from the auxiliary directory. The problem is that $srcdir (and | |
187 | # therefore $ac_aux_dir as well) can be either absolute or relative, | |
188 | # depending on how configure is run. This is pretty annoying, since | |
189 | # it makes $ac_aux_dir quite unusable in subdirectories: in the top | |
190 | # source directory, any form will work fine, but in subdirectories a | |
191 | # relative path needs to be adjusted first. | |
192 | # | |
193 | # $ac_aux_dir/missing | |
194 | # fails when called from a subdirectory if $ac_aux_dir is relative | |
195 | # $top_srcdir/$ac_aux_dir/missing | |
196 | # fails if $ac_aux_dir is absolute, | |
197 | # fails when called from a subdirectory in a VPATH build with | |
198 | # a relative $ac_aux_dir | |
199 | # | |
200 | # The reason of the latter failure is that $top_srcdir and $ac_aux_dir | |
201 | # are both prefixed by $srcdir. In an in-source build this is usually | |
202 | # harmless because $srcdir is `.', but things will broke when you | |
203 | # start a VPATH build or use an absolute $srcdir. | |
204 | # | |
205 | # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, | |
206 | # iff we strip the leading $srcdir from $ac_aux_dir. That would be: | |
207 | # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` | |
208 | # and then we would define $MISSING as | |
209 | # MISSING="\${SHELL} $am_aux_dir/missing" | |
210 | # This will work as long as MISSING is not called from configure, because | |
211 | # unfortunately $(top_srcdir) has no meaning in configure. | |
212 | # However there are other variables, like CC, which are often used in | |
213 | # configure, and could therefore not use this "fixed" $ac_aux_dir. | |
214 | # | |
215 | # Another solution, used here, is to always expand $ac_aux_dir to an | |
216 | # absolute PATH. The drawback is that using absolute paths prevent a | |
217 | # configured tree to be moved without reconfiguration. | |
218 | ||
219 | AC_DEFUN([AM_AUX_DIR_EXPAND], [ | |
220 | # expand $ac_aux_dir to an absolute path | |
221 | am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` | |
222 | ]) | |
223 | ||
224 | # AM_PROG_INSTALL_SH | |
225 | # ------------------ | |
226 | # Define $install_sh. | |
227 | AC_DEFUN([AM_PROG_INSTALL_SH], | |
228 | [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl | |
229 | install_sh=${install_sh-"$am_aux_dir/install-sh"} | |
230 | AC_SUBST(install_sh)]) | |
231 | ||
232 | # One issue with vendor `install' (even GNU) is that you can't | |
233 | # specify the program used to strip binaries. This is especially | |
234 | # annoying in cross-compiling environments, where the build's strip | |
235 | # is unlikely to handle the host's binaries. | |
236 | # Fortunately install-sh will honor a STRIPPROG variable, so we | |
237 | # always use install-sh in `make install-strip', and initialize | |
238 | # STRIPPROG with the value of the STRIP variable (set by the user). | |
239 | AC_DEFUN([AM_PROG_INSTALL_STRIP], | |
240 | [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl | |
241 | INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" | |
242 | AC_SUBST([INSTALL_STRIP_PROGRAM])]) | |
243 | ||
244 | # serial 4 -*- Autoconf -*- | |
245 | ||
246 | ||
247 | ||
248 | # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be | |
249 | # written in clear, in which case automake, when reading aclocal.m4, | |
250 | # will think it sees a *use*, and therefore will trigger all it's | |
251 | # C support machinery. Also note that it means that autoscan, seeing | |
252 | # CC etc. in the Makefile, will ask for an AC_PROG_CC use... | |
253 | ||
254 | ||
255 | ||
256 | # _AM_DEPENDENCIES(NAME) | |
257 | # --------------------- | |
258 | # See how the compiler implements dependency checking. | |
259 | # NAME is "CC", "CXX" or "OBJC". | |
260 | # We try a few techniques and use that to set a single cache variable. | |
261 | # | |
262 | # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was | |
263 | # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular | |
264 | # dependency, and given that the user is not expected to run this macro, | |
265 | # just rely on AC_PROG_CC. | |
266 | AC_DEFUN([_AM_DEPENDENCIES], | |
267 | [AC_REQUIRE([AM_SET_DEPDIR])dnl | |
268 | AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl | |
269 | AC_REQUIRE([AM_MAKE_INCLUDE])dnl | |
270 | AC_REQUIRE([AM_DEP_TRACK])dnl | |
271 | ||
272 | ifelse([$1], CC, [depcc="$CC" am_compiler_list=], | |
273 | [$1], CXX, [depcc="$CXX" am_compiler_list=], | |
274 | [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'] | |
275 | [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], | |
276 | [depcc="$$1" am_compiler_list=]) | |
277 | ||
278 | AC_CACHE_CHECK([dependency style of $depcc], | |
279 | [am_cv_$1_dependencies_compiler_type], | |
280 | [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then | |
281 | # We make a subdir and do the tests there. Otherwise we can end up | |
282 | # making bogus files that we don't know about and never remove. For | |
283 | # instance it was reported that on HP-UX the gcc test will end up | |
284 | # making a dummy file named `D' -- because `-MD' means `put the output | |
285 | # in D'. | |
286 | mkdir conftest.dir | |
287 | # Copy depcomp to subdir because otherwise we won't find it if we're | |
288 | # using a relative directory. | |
289 | cp "$am_depcomp" conftest.dir | |
290 | cd conftest.dir | |
291 | ||
292 | am_cv_$1_dependencies_compiler_type=none | |
293 | if test "$am_compiler_list" = ""; then | |
294 | am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` | |
295 | fi | |
296 | for depmode in $am_compiler_list; do | |
297 | # We need to recreate these files for each test, as the compiler may | |
298 | # overwrite some of them when testing with obscure command lines. | |
299 | # This happens at least with the AIX C compiler. | |
300 | echo '#include "conftest.h"' > conftest.c | |
301 | echo 'int i;' > conftest.h | |
302 | echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf | |
303 | ||
304 | case $depmode in | |
305 | nosideeffect) | |
306 | # after this tag, mechanisms are not by side-effect, so they'll | |
307 | # only be used when explicitly requested | |
308 | if test "x$enable_dependency_tracking" = xyes; then | |
309 | continue | |
310 | else | |
311 | break | |
312 | fi | |
313 | ;; | |
314 | none) break ;; | |
315 | esac | |
316 | # We check with `-c' and `-o' for the sake of the "dashmstdout" | |
317 | # mode. It turns out that the SunPro C++ compiler does not properly | |
318 | # handle `-M -o', and we need to detect this. | |
319 | if depmode=$depmode \ | |
320 | source=conftest.c object=conftest.o \ | |
321 | depfile=conftest.Po tmpdepfile=conftest.TPo \ | |
322 | $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && | |
323 | grep conftest.h conftest.Po > /dev/null 2>&1 && | |
324 | ${MAKE-make} -s -f confmf > /dev/null 2>&1; then | |
325 | am_cv_$1_dependencies_compiler_type=$depmode | |
326 | break | |
327 | fi | |
328 | done | |
329 | ||
330 | cd .. | |
331 | rm -rf conftest.dir | |
332 | else | |
333 | am_cv_$1_dependencies_compiler_type=none | |
334 | fi | |
335 | ]) | |
336 | $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type" | |
337 | AC_SUBST([$1DEPMODE]) | |
338 | ]) | |
339 | ||
340 | ||
341 | # AM_SET_DEPDIR | |
342 | # ------------- | |
343 | # Choose a directory name for dependency files. | |
344 | # This macro is AC_REQUIREd in _AM_DEPENDENCIES | |
345 | AC_DEFUN([AM_SET_DEPDIR], | |
346 | [rm -f .deps 2>/dev/null | |
347 | mkdir .deps 2>/dev/null | |
348 | if test -d .deps; then | |
349 | DEPDIR=.deps | |
350 | else | |
351 | # MS-DOS does not allow filenames that begin with a dot. | |
352 | DEPDIR=_deps | |
353 | fi | |
354 | rmdir .deps 2>/dev/null | |
355 | AC_SUBST(DEPDIR) | |
356 | ]) | |
357 | ||
358 | ||
359 | # AM_DEP_TRACK | |
360 | # ------------ | |
361 | AC_DEFUN([AM_DEP_TRACK], | |
362 | [AC_ARG_ENABLE(dependency-tracking, | |
363 | [ --disable-dependency-tracking Speeds up one-time builds | |
364 | --enable-dependency-tracking Do not reject slow dependency extractors]) | |
365 | if test "x$enable_dependency_tracking" != xno; then | |
366 | am_depcomp="$ac_aux_dir/depcomp" | |
367 | AMDEPBACKSLASH='\' | |
368 | fi | |
369 | AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) | |
370 | pushdef([subst], defn([AC_SUBST])) | |
371 | subst(AMDEPBACKSLASH) | |
372 | popdef([subst]) | |
373 | ]) | |
374 | ||
375 | # Generate code to set up dependency tracking. | |
376 | # This macro should only be invoked once -- use via AC_REQUIRE. | |
377 | # Usage: | |
378 | # AM_OUTPUT_DEPENDENCY_COMMANDS | |
379 | ||
380 | # | |
381 | # This code is only required when automatic dependency tracking | |
382 | # is enabled. FIXME. This creates each `.P' file that we will | |
383 | # need in order to bootstrap the dependency handling code. | |
384 | AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[ | |
385 | AC_OUTPUT_COMMANDS([ | |
386 | test x"$AMDEP_TRUE" != x"" || | |
387 | for mf in $CONFIG_FILES; do | |
388 | case "$mf" in | |
389 | Makefile) dirpart=.;; | |
390 | */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; | |
391 | *) continue;; | |
392 | esac | |
393 | grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue | |
394 | # Extract the definition of DEP_FILES from the Makefile without | |
395 | # running `make'. | |
396 | DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` | |
397 | test -z "$DEPDIR" && continue | |
398 | # When using ansi2knr, U may be empty or an underscore; expand it | |
399 | U=`sed -n -e '/^U = / s///p' < "$mf"` | |
400 | test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" | |
401 | # We invoke sed twice because it is the simplest approach to | |
402 | # changing $(DEPDIR) to its actual value in the expansion. | |
403 | for file in `sed -n -e ' | |
404 | /^DEP_FILES = .*\\\\$/ { | |
405 | s/^DEP_FILES = // | |
406 | :loop | |
407 | s/\\\\$// | |
408 | p | |
409 | n | |
410 | /\\\\$/ b loop | |
411 | p | |
412 | } | |
413 | /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ | |
414 | sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do | |
415 | # Make sure the directory exists. | |
416 | test -f "$dirpart/$file" && continue | |
417 | fdir=`echo "$file" | sed -e 's|/[^/]*$||'` | |
418 | $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 | |
419 | # echo "creating $dirpart/$file" | |
420 | echo '# dummy' > "$dirpart/$file" | |
421 | done | |
422 | done | |
423 | ], [AMDEP_TRUE="$AMDEP_TRUE" | |
424 | ac_aux_dir="$ac_aux_dir"])]) | |
425 | ||
426 | # AM_MAKE_INCLUDE() | |
427 | # ----------------- | |
428 | # Check to see how make treats includes. | |
429 | AC_DEFUN([AM_MAKE_INCLUDE], | |
430 | [am_make=${MAKE-make} | |
431 | cat > confinc << 'END' | |
432 | doit: | |
433 | @echo done | |
434 | END | |
435 | # If we don't find an include directive, just comment out the code. | |
436 | AC_MSG_CHECKING([for style of include used by $am_make]) | |
437 | am__include='#' | |
438 | am__quote= | |
439 | _am_result=none | |
440 | # First try GNU make style include. | |
441 | echo "include confinc" > confmf | |
442 | # We grep out `Entering directory' and `Leaving directory' | |
443 | # messages which can occur if `w' ends up in MAKEFLAGS. | |
444 | # In particular we don't look at `^make:' because GNU make might | |
445 | # be invoked under some other name (usually "gmake"), in which | |
446 | # case it prints its new name instead of `make'. | |
447 | if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then | |
448 | am__include=include | |
449 | am__quote= | |
450 | _am_result=GNU | |
451 | fi | |
452 | # Now try BSD make style include. | |
453 | if test "$am__include" = "#"; then | |
454 | echo '.include "confinc"' > confmf | |
455 | if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then | |
456 | am__include=.include | |
457 | am__quote='"' | |
458 | _am_result=BSD | |
459 | fi | |
460 | fi | |
461 | AC_SUBST(am__include) | |
462 | AC_SUBST(am__quote) | |
463 | AC_MSG_RESULT($_am_result) | |
464 | rm -f confinc confmf | |
465 | ]) | |
466 | ||
467 | # serial 3 | |
468 | ||
469 | # AM_CONDITIONAL(NAME, SHELL-CONDITION) | |
470 | # ------------------------------------- | |
471 | # Define a conditional. | |
472 | # | |
473 | # FIXME: Once using 2.50, use this: | |
474 | # m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl | |
475 | AC_DEFUN([AM_CONDITIONAL], | |
476 | [ifelse([$1], [TRUE], | |
477 | [errprint(__file__:__line__: [$0: invalid condition: $1 | |
478 | ])dnl | |
479 | m4exit(1)])dnl | |
480 | ifelse([$1], [FALSE], | |
481 | [errprint(__file__:__line__: [$0: invalid condition: $1 | |
482 | ])dnl | |
483 | m4exit(1)])dnl | |
484 | AC_SUBST([$1_TRUE]) | |
485 | AC_SUBST([$1_FALSE]) | |
486 | if $2; then | |
487 | $1_TRUE= | |
488 | $1_FALSE='#' | |
489 | else | |
490 | $1_TRUE='#' | |
491 | $1_FALSE= | |
492 | fi]) | |
705db0b5 AD |
493 | |
494 | # Like AC_CONFIG_HEADER, but automatically create stamp file. | |
495 | ||
6fc74234 AD |
496 | # serial 3 |
497 | ||
498 | # When config.status generates a header, we must update the stamp-h file. | |
499 | # This file resides in the same directory as the config header | |
500 | # that is generated. We must strip everything past the first ":", | |
501 | # and everything past the last "/". | |
502 | ||
503 | AC_PREREQ([2.12]) | |
504 | ||
505 | AC_DEFUN([AM_CONFIG_HEADER], | |
506 | [ifdef([AC_FOREACH],dnl | |
507 | [dnl init our file count if it isn't already | |
508 | m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0])) | |
509 | dnl prepare to store our destination file list for use in config.status | |
510 | AC_FOREACH([_AM_File], [$1], | |
511 | [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*])) | |
512 | m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index)) | |
513 | dnl and add it to the list of files AC keeps track of, along | |
514 | dnl with our hook | |
515 | AC_CONFIG_HEADERS(_AM_File, | |
516 | dnl COMMANDS, [, INIT-CMDS] | |
517 | [# update the timestamp | |
518 | echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index[" | |
519 | ][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS | |
520 | m4_popdef([_AM_Dest])])],dnl | |
521 | [AC_CONFIG_HEADER([$1]) | |
522 | AC_OUTPUT_COMMANDS( | |
523 | ifelse(patsubst([$1], [[^ ]], []), | |
524 | [], | |
525 | [test -z "$CONFIG_HEADERS" || echo timestamp >dnl | |
526 | patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl | |
527 | [am_indx=1 | |
528 | for am_file in $1; do | |
529 | case " \$CONFIG_HEADERS " in | |
530 | *" \$am_file "*) | |
531 | am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\` | |
532 | if test -n "\$am_dir"; then | |
533 | am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\` | |
534 | for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do | |
535 | am_tmpdir=\$am_tmpdir\$am_subdir/ | |
536 | if test ! -d \$am_tmpdir; then | |
537 | mkdir \$am_tmpdir | |
538 | fi | |
539 | done | |
540 | fi | |
541 | echo timestamp > "\$am_dir"stamp-h\$am_indx | |
705db0b5 AD |
542 | ;; |
543 | esac | |
6fc74234 AD |
544 | am_indx=\`expr \$am_indx + 1\` |
545 | done]) | |
546 | ])]) # AM_CONFIG_HEADER | |
547 | ||
548 | # _AM_DIRNAME(PATH) | |
549 | # ----------------- | |
550 | # Like AS_DIRNAME, only do it during macro expansion | |
551 | AC_DEFUN([_AM_DIRNAME], | |
552 | [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, | |
553 | m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1, | |
554 | m4_if(m4_regexp([$1], [^/.*]), -1, | |
555 | [.], | |
556 | m4_patsubst([$1], [^\(/\).*], [\1])), | |
557 | m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), | |
558 | m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl | |
559 | ]) # _AM_DIRNAME | |
705db0b5 AD |
560 | |
561 | ||
562 | # serial 2 | |
563 | ||
564 | # Single argument says where are built sources to test, relative to the | |
565 | # built test directory. Maybe omitted if the same (flat distribution). | |
566 | ||
567 | AC_DEFUN([AT_CONFIG], | |
568 | [AT_TESTPATH=ifelse([$1], [], [.], [$1]) | |
569 | AC_SUBST([AT_TESTPATH]) | |
570 | # Try to be compatible with both Autoconf 2.13 and 2.50. | |
571 | if test -z "$ECHO_C$ECHO_N$ECHO_T"; then | |
572 | ECHO_C="$ac_c" | |
573 | ECHO_N="$ac_n" | |
574 | ECHO_T="$ac_t" | |
575 | AC_SUBST([ECHO_C]) | |
576 | AC_SUBST([ECHO_N]) | |
577 | AC_SUBST([ECHO_T]) | |
578 | fi | |
579 | ]) | |
580 | ||
1e24cc5b AD |
581 | #serial 1 |
582 | # This test replaces the one in autoconf. | |
583 | # Currently this macro should have the same name as the autoconf macro | |
584 | # because gettext's gettext.m4 (distributed in the automake package) | |
585 | # still uses it. Otherwise, the use in gettext.m4 makes autoheader | |
586 | # give these diagnostics: | |
587 | # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX | |
588 | # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX | |
589 | ||
590 | undefine([AC_ISC_POSIX]) | |
591 | ||
592 | AC_DEFUN([AC_ISC_POSIX], | |
593 | [ | |
594 | dnl This test replaces the obsolescent AC_ISC_POSIX kludge. | |
595 | AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) | |
596 | ] | |
597 | ) | |
598 | ||
705db0b5 AD |
599 | |
600 | # serial 1 | |
601 | ||
602 | # @defmac AC_PROG_CC_STDC | |
603 | # @maindex PROG_CC_STDC | |
604 | # @ovindex CC | |
605 | # If the C compiler in not in ANSI C mode by default, try to add an option | |
606 | # to output variable @code{CC} to make it so. This macro tries various | |
607 | # options that select ANSI C on some system or another. It considers the | |
608 | # compiler to be in ANSI C mode if it handles function prototypes correctly. | |
609 | # | |
610 | # If you use this macro, you should check after calling it whether the C | |
611 | # compiler has been set to accept ANSI C; if not, the shell variable | |
612 | # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source | |
613 | # code in ANSI C, you can make an un-ANSIfied copy of it by using the | |
614 | # program @code{ansi2knr}, which comes with Ghostscript. | |
615 | # @end defmac | |
616 | ||
6fc74234 | 617 | AC_DEFUN([AM_PROG_CC_STDC], |
705db0b5 AD |
618 | [AC_REQUIRE([AC_PROG_CC]) |
619 | AC_BEFORE([$0], [AC_C_INLINE]) | |
620 | AC_BEFORE([$0], [AC_C_CONST]) | |
621 | dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require | |
622 | dnl a magic option to avoid problems with ANSI preprocessor commands | |
623 | dnl like #elif. | |
624 | dnl FIXME: can't do this because then AC_AIX won't work due to a | |
625 | dnl circular dependency. | |
626 | dnl AC_BEFORE([$0], [AC_PROG_CPP]) | |
6fc74234 | 627 | AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C]) |
705db0b5 AD |
628 | AC_CACHE_VAL(am_cv_prog_cc_stdc, |
629 | [am_cv_prog_cc_stdc=no | |
630 | ac_save_CC="$CC" | |
631 | # Don't try gcc -ansi; that turns off useful extensions and | |
632 | # breaks some systems' header files. | |
633 | # AIX -qlanglvl=ansi | |
634 | # Ultrix and OSF/1 -std1 | |
6fc74234 AD |
635 | # HP-UX 10.20 and later -Ae |
636 | # HP-UX older versions -Aa -D_HPUX_SOURCE | |
705db0b5 | 637 | # SVR4 -Xc -D__EXTENSIONS__ |
6fc74234 | 638 | for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" |
705db0b5 AD |
639 | do |
640 | CC="$ac_save_CC $ac_arg" | |
641 | AC_TRY_COMPILE( | |
642 | [#include <stdarg.h> | |
643 | #include <stdio.h> | |
644 | #include <sys/types.h> | |
645 | #include <sys/stat.h> | |
646 | /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ | |
647 | struct buf { int x; }; | |
648 | FILE * (*rcsopen) (struct buf *, struct stat *, int); | |
649 | static char *e (p, i) | |
650 | char **p; | |
651 | int i; | |
652 | { | |
653 | return p[i]; | |
654 | } | |
655 | static char *f (char * (*g) (char **, int), char **p, ...) | |
656 | { | |
657 | char *s; | |
658 | va_list v; | |
659 | va_start (v,p); | |
660 | s = g (p, va_arg (v,int)); | |
661 | va_end (v); | |
662 | return s; | |
663 | } | |
664 | int test (int i, double x); | |
665 | struct s1 {int (*f) (int a);}; | |
666 | struct s2 {int (*f) (double a);}; | |
667 | int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); | |
668 | int argc; | |
669 | char **argv; | |
670 | ], [ | |
671 | return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; | |
672 | ], | |
673 | [am_cv_prog_cc_stdc="$ac_arg"; break]) | |
674 | done | |
675 | CC="$ac_save_CC" | |
676 | ]) | |
677 | if test -z "$am_cv_prog_cc_stdc"; then | |
678 | AC_MSG_RESULT([none needed]) | |
679 | else | |
6fc74234 | 680 | AC_MSG_RESULT([$am_cv_prog_cc_stdc]) |
705db0b5 AD |
681 | fi |
682 | case "x$am_cv_prog_cc_stdc" in | |
683 | x|xno) ;; | |
684 | *) CC="$CC $am_cv_prog_cc_stdc" ;; | |
685 | esac | |
686 | ]) | |
687 | ||
1e24cc5b | 688 | # serial 1 -*- Autoconf -*- |
705db0b5 AD |
689 | |
690 | # BISON_AC_PROG_GNU_M4 | |
691 | # -------------------- | |
692 | # Check for GNU m4, at least 1.3 (supports frozen files). | |
693 | AC_DEFUN([BISON_AC_PROG_GNU_M4], | |
694 | [AC_PATH_PROGS(M4, gm4 gnum4 m4, m4) | |
1e24cc5b AD |
695 | AC_CACHE_CHECK([whether m4 supports frozen files], |
696 | [ac_cv_prog_gnu_m4], | |
705db0b5 AD |
697 | [ac_cv_prog_gnu_m4=no |
698 | if test x"$M4" != x; then | |
699 | case `$M4 --help < /dev/null 2>&1` in | |
700 | *reload-state*) ac_cv_prog_gnu_m4=yes ;; | |
701 | esac | |
1e24cc5b AD |
702 | fi]) |
703 | ])# BISON_AC_PROG_GNU_M4 | |
705db0b5 AD |
704 | |
705 | AC_DEFUN(BISON_WARNING, | |
706 | [AC_MSG_CHECKING(whether compiler accepts $1) | |
707 | AC_SUBST(WARNING_CFLAGS) | |
708 | ac_save_CFLAGS="$CFLAGS" | |
709 | CFLAGS="$CFLAGS $1" | |
710 | AC_TRY_COMPILE(, | |
711 | [int x;], | |
712 | WARNING_CFLAGS="$WARNING_CFLAGS $1" | |
713 | AC_MSG_RESULT(yes), | |
714 | AC_MSG_RESULT(no)) | |
715 | CFLAGS="$ac_save_CFLAGS"]) | |
716 | ||
717 | ||
718 | # serial 1 | |
719 | ||
6fc74234 | 720 | AC_DEFUN([AM_C_PROTOTYPES], |
705db0b5 AD |
721 | [AC_REQUIRE([AM_PROG_CC_STDC]) |
722 | AC_REQUIRE([AC_PROG_CPP]) | |
723 | AC_MSG_CHECKING([for function prototypes]) | |
724 | if test "$am_cv_prog_cc_stdc" != no; then | |
725 | AC_MSG_RESULT(yes) | |
726 | AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes]) | |
727 | U= ANSI2KNR= | |
728 | else | |
729 | AC_MSG_RESULT(no) | |
730 | U=_ ANSI2KNR=./ansi2knr | |
705db0b5 | 731 | fi |
6fc74234 AD |
732 | # Ensure some checks needed by ansi2knr itself. |
733 | AC_HEADER_STDC | |
734 | AC_CHECK_HEADERS(string.h) | |
705db0b5 AD |
735 | AC_SUBST(U)dnl |
736 | AC_SUBST(ANSI2KNR)dnl | |
737 | ]) | |
738 | ||
739 | #serial 3 | |
740 | ||
741 | dnl From Jim Meyering. | |
742 | dnl Determine whether malloc accepts 0 as its argument. | |
743 | dnl If it doesn't, arrange to use the replacement function. | |
744 | dnl | |
745 | ||
746 | AC_DEFUN(jm_FUNC_MALLOC, | |
747 | [ | |
748 | dnl xmalloc.c requires that this symbol be defined so it doesn't | |
749 | dnl mistakenly use a broken malloc -- as it might if this test were omitted. | |
750 | AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1, | |
751 | [Define if the malloc check has been performed. ]) | |
752 | ||
753 | AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc, | |
754 | [AC_TRY_RUN([ | |
755 | char *malloc (); | |
756 | int | |
757 | main () | |
758 | { | |
759 | exit (malloc (0) ? 0 : 1); | |
760 | } | |
761 | ], | |
762 | jm_cv_func_working_malloc=yes, | |
763 | jm_cv_func_working_malloc=no, | |
764 | dnl When crosscompiling, assume malloc is broken. | |
765 | jm_cv_func_working_malloc=no) | |
766 | ]) | |
767 | if test $jm_cv_func_working_malloc = no; then | |
768 | AC_SUBST(LIBOBJS) | |
769 | LIBOBJS="$LIBOBJS malloc.$ac_objext" | |
770 | AC_DEFINE_UNQUOTED(malloc, rpl_malloc, | |
771 | [Define to rpl_malloc if the replacement function should be used.]) | |
772 | fi | |
773 | ]) | |
774 | ||
775 | #serial 3 | |
776 | ||
777 | dnl From Jim Meyering. | |
778 | dnl Determine whether realloc works when both arguments are 0. | |
779 | dnl If it doesn't, arrange to use the replacement function. | |
780 | dnl | |
781 | ||
782 | AC_DEFUN(jm_FUNC_REALLOC, | |
783 | [ | |
784 | dnl xmalloc.c requires that this symbol be defined so it doesn't | |
785 | dnl mistakenly use a broken realloc -- as it might if this test were omitted. | |
786 | AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1, | |
787 | [Define if the realloc check has been performed. ]) | |
788 | ||
789 | AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc, | |
790 | [AC_TRY_RUN([ | |
791 | char *realloc (); | |
792 | int | |
793 | main () | |
794 | { | |
795 | exit (realloc (0, 0) ? 0 : 1); | |
796 | } | |
797 | ], | |
798 | jm_cv_func_working_realloc=yes, | |
799 | jm_cv_func_working_realloc=no, | |
800 | dnl When crosscompiling, assume realloc is broken. | |
801 | jm_cv_func_working_realloc=no) | |
802 | ]) | |
803 | if test $jm_cv_func_working_realloc = no; then | |
804 | AC_SUBST(LIBOBJS) | |
805 | LIBOBJS="$LIBOBJS realloc.$ac_objext" | |
806 | AC_DEFINE_UNQUOTED(realloc, rpl_realloc, | |
807 | [Define to rpl_realloc if the replacement function should be used.]) | |
808 | fi | |
809 | ]) | |
810 | ||
811 | #serial 1 | |
812 | ||
813 | dnl These are the prerequisite macros for files in the lib/ | |
814 | dnl directories of Bison. | |
815 | ||
816 | AC_DEFUN([jm_PREREQ_QUOTEARG], | |
817 | [ | |
818 | AC_CHECK_FUNCS(isascii iswprint mbrtowc) | |
819 | AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h) | |
820 | AC_HEADER_STDC | |
821 | AC_C_BACKSLASH_A | |
822 | AC_MBSTATE_T | |
823 | AM_C_PROTOTYPES | |
824 | ]) | |
825 | ||
826 | #serial 3 | |
827 | ||
828 | dnl From Paul Eggert. | |
829 | ||
830 | AC_DEFUN(AC_C_BACKSLASH_A, | |
831 | [ | |
832 | AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a, | |
833 | [AC_TRY_COMPILE([], | |
834 | [ | |
835 | #if '\a' == 'a' | |
836 | syntax error; | |
837 | #endif | |
838 | char buf['\a' == 'a' ? -1 : 1]; | |
839 | buf[0] = '\a'; | |
840 | return buf[0] != "\a"[0]; | |
841 | ], | |
842 | ac_cv_c_backslash_a=yes, | |
843 | ac_cv_c_backslash_a=no)]) | |
844 | if test $ac_cv_c_backslash_a = yes; then | |
845 | AC_DEFINE(HAVE_C_BACKSLASH_A, 1, | |
846 | [Define if backslash-a works in C strings.]) | |
847 | fi | |
848 | ]) | |
849 | ||
850 | # serial 8 | |
851 | ||
852 | # From Paul Eggert. | |
853 | ||
854 | # BeOS 5 has <wchar.h> but does not define mbstate_t, | |
855 | # so you can't declare an object of that type. | |
856 | # Check for this incompatibility with Standard C. | |
857 | ||
858 | # Include stdlib.h first, because otherwise this test would fail on Linux | |
859 | # (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits | |
860 | # a syntax error in wchar.h due to the use of undefined __int32_t. | |
861 | ||
862 | AC_DEFUN(AC_MBSTATE_T, | |
863 | [ | |
864 | AC_CHECK_HEADERS(stdlib.h) | |
865 | ||
866 | AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t, | |
867 | [AC_TRY_COMPILE([ | |
868 | #if HAVE_STDLIB_H | |
869 | # include <stdlib.h> | |
870 | #endif | |
871 | #include <wchar.h>], | |
872 | [mbstate_t x; return sizeof x;], | |
873 | ac_cv_type_mbstate_t=yes, | |
874 | ac_cv_type_mbstate_t=no)]) | |
875 | if test $ac_cv_type_mbstate_t = no; then | |
876 | AC_DEFINE(mbstate_t, int, | |
877 | [Define to a type if <wchar.h> does not define.]) | |
878 | fi]) | |
879 | ||
5141b016 AD |
880 | #serial 1 |
881 | ||
882 | dnl FIXME: put these prerequisite-only *.m4 files in a separate | |
883 | dnl directory -- otherwise, they'll conflict with existing files. | |
884 | ||
885 | dnl These are the prerequisite macros for GNU's error.c file. | |
886 | AC_DEFUN(jm_PREREQ_ERROR, | |
887 | [ | |
888 | AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt) | |
889 | AC_HEADER_STDC | |
890 | AC_FUNC_STRERROR_R | |
891 | ]) | |
892 | ||
893 | #serial 1002 | |
894 | # Experimental replacement for the function in the latest CVS autoconf. | |
895 | # If the compile-test says strerror_r doesn't work, then resort to a | |
896 | # `run'-test that works on BeOS and segfaults on DEC Unix. | |
897 | # Use with the error.c file in ../lib. | |
898 | ||
899 | undefine([AC_FUNC_STRERROR_R]) | |
900 | ||
901 | # AC_FUNC_STRERROR_R | |
902 | # ------------------ | |
903 | AC_DEFUN([AC_FUNC_STRERROR_R], | |
904 | [AC_CHECK_DECLS([strerror_r]) | |
905 | AC_CHECK_FUNCS([strerror_r]) | |
906 | if test $ac_cv_func_strerror_r = yes; then | |
907 | AC_CHECK_HEADERS(string.h) | |
908 | AC_CACHE_CHECK([for working strerror_r], | |
909 | ac_cv_func_strerror_r_works, | |
910 | [ | |
911 | AC_TRY_COMPILE( | |
912 | [ | |
913 | # include <stdio.h> | |
914 | # if HAVE_STRING_H | |
915 | # include <string.h> | |
916 | # endif | |
917 | ], | |
918 | [ | |
919 | char buf[100]; | |
920 | char x = *strerror_r (0, buf, sizeof buf); | |
921 | ], | |
922 | ac_cv_func_strerror_r_works=yes, | |
923 | ac_cv_func_strerror_r_works=no | |
924 | ) | |
925 | if test $ac_cv_func_strerror_r_works = no; then | |
926 | # strerror_r seems not to work, but now we have to choose between | |
927 | # systems that have relatively inaccessible declarations for the | |
928 | # function. BeOS and DEC UNIX 4.0 fall in this category, but the | |
929 | # former has a strerror_r that returns char*, while the latter | |
930 | # has a strerror_r that returns `int'. | |
931 | # This test should segfault on the DEC system. | |
932 | AC_TRY_RUN( | |
933 | [ | |
934 | # include <stdio.h> | |
935 | # include <string.h> | |
936 | # include <ctype.h> | |
937 | ||
938 | extern char *strerror_r (); | |
939 | ||
940 | int | |
941 | main () | |
942 | { | |
943 | char buf[100]; | |
944 | char x = *strerror_r (0, buf, sizeof buf); | |
945 | exit (!isalpha (x)); | |
946 | } | |
947 | ], | |
948 | ac_cv_func_strerror_r_works=yes, | |
949 | ac_cv_func_strerror_r_works=no, | |
950 | ac_cv_func_strerror_r_works=no) | |
951 | fi | |
952 | ]) | |
953 | if test $ac_cv_func_strerror_r_works = yes; then | |
954 | AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1, | |
955 | [Define to 1 if `strerror_r' returns a string.]) | |
956 | fi | |
957 | fi | |
958 | ])# AC_FUNC_STRERROR_R | |
959 | ||
705db0b5 AD |
960 | # Macro to add for using GNU gettext. |
961 | # Ulrich Drepper <drepper@cygnus.com>, 1995. | |
962 | # | |
963 | # This file can be copied and used freely without restrictions. It can | |
53b74c0c AD |
964 | # be used in projects which are not available under the GNU General Public |
965 | # License but which still want to provide support for the GNU gettext | |
966 | # functionality. | |
967 | # Please note that the actual code of GNU gettext is covered by the GNU | |
968 | # General Public License and is *not* in the public domain. | |
705db0b5 | 969 | |
53b74c0c | 970 | # serial 10 |
1e24cc5b AD |
971 | |
972 | dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). | |
973 | dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library | |
974 | dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, | |
975 | dnl depending on --{enable,disable}-{shared,static} and on the presence of | |
976 | dnl AM-DISABLE-SHARED). Otherwise, a static library | |
977 | dnl $(top_builddir)/intl/libintl.a will be created. | |
978 | dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext | |
979 | dnl implementations (in libc or libintl) without the ngettext() function | |
980 | dnl will be ignored. | |
981 | dnl LIBDIR is used to find the intl libraries. If empty, | |
982 | dnl the value `$(top_builddir)/intl/' is used. | |
983 | dnl | |
984 | dnl The result of the configuration is one of three cases: | |
985 | dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled | |
986 | dnl and used. | |
987 | dnl Catalog format: GNU --> install in $(datadir) | |
988 | dnl Catalog extension: .mo after installation, .gmo in source tree | |
989 | dnl 2) GNU gettext has been found in the system's C library. | |
990 | dnl Catalog format: GNU --> install in $(datadir) | |
991 | dnl Catalog extension: .mo after installation, .gmo in source tree | |
992 | dnl 3) No internationalization, always use English msgid. | |
993 | dnl Catalog format: none | |
994 | dnl Catalog extension: none | |
995 | dnl The use of .gmo is historical (it was needed to avoid overwriting the | |
996 | dnl GNU format catalogs when building on a platform with an X/Open gettext), | |
997 | dnl but we keep it in order not to force irrelevant filename changes on the | |
998 | dnl maintainers. | |
999 | dnl | |
1000 | AC_DEFUN([AM_WITH_NLS], | |
705db0b5 AD |
1001 | [AC_MSG_CHECKING([whether NLS is requested]) |
1002 | dnl Default is enabled NLS | |
1003 | AC_ARG_ENABLE(nls, | |
1004 | [ --disable-nls do not use Native Language Support], | |
1005 | USE_NLS=$enableval, USE_NLS=yes) | |
1006 | AC_MSG_RESULT($USE_NLS) | |
1007 | AC_SUBST(USE_NLS) | |
1008 | ||
1e24cc5b | 1009 | BUILD_INCLUDED_LIBINTL=no |
705db0b5 | 1010 | USE_INCLUDED_LIBINTL=no |
1e24cc5b | 1011 | INTLLIBS= |
705db0b5 AD |
1012 | |
1013 | dnl If we use NLS figure out what method | |
1014 | if test "$USE_NLS" = "yes"; then | |
1e24cc5b AD |
1015 | AC_DEFINE(ENABLE_NLS, 1, |
1016 | [Define to 1 if translation of program messages to the user's native language | |
1017 | is requested.]) | |
705db0b5 AD |
1018 | AC_MSG_CHECKING([whether included gettext is requested]) |
1019 | AC_ARG_WITH(included-gettext, | |
1020 | [ --with-included-gettext use the GNU gettext library included here], | |
1021 | nls_cv_force_use_gnu_gettext=$withval, | |
1022 | nls_cv_force_use_gnu_gettext=no) | |
1023 | AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) | |
1024 | ||
1025 | nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" | |
1026 | if test "$nls_cv_force_use_gnu_gettext" != "yes"; then | |
1027 | dnl User does not insist on using GNU NLS library. Figure out what | |
1e24cc5b AD |
1028 | dnl to use. If GNU gettext is available we use this. Else we have |
1029 | dnl to fall back to GNU NLS library. | |
705db0b5 AD |
1030 | CATOBJEXT=NONE |
1031 | ||
1e24cc5b AD |
1032 | dnl Add a version number to the cache macros. |
1033 | define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc]) | |
1034 | define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl]) | |
705db0b5 | 1035 | |
1e24cc5b AD |
1036 | AC_CHECK_HEADER(libintl.h, |
1037 | [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, | |
1038 | [AC_TRY_LINK([#include <libintl.h> | |
1039 | extern int _nl_msg_cat_cntr;], | |
1040 | [bindtextdomain ("", ""); | |
1041 | return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], | |
1042 | gt_cv_func_gnugettext_libc=yes, | |
1043 | gt_cv_func_gnugettext_libc=no)]) | |
1044 | ||
1045 | if test "$gt_cv_func_gnugettext_libc" != "yes"; then | |
1046 | AC_CACHE_CHECK([for GNU gettext in libintl], | |
1047 | gt_cv_func_gnugettext_libintl, | |
1048 | [gt_save_LIBS="$LIBS" | |
1049 | LIBS="$LIBS -lintl $LIBICONV" | |
1050 | AC_TRY_LINK([#include <libintl.h> | |
1051 | extern int _nl_msg_cat_cntr;], | |
1052 | [bindtextdomain ("", ""); | |
1053 | return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], | |
1054 | gt_cv_func_gnugettext_libintl=yes, | |
1055 | gt_cv_func_gnugettext_libintl=no) | |
1056 | LIBS="$gt_save_LIBS"]) | |
705db0b5 AD |
1057 | fi |
1058 | ||
1e24cc5b AD |
1059 | dnl If an already present or preinstalled GNU gettext() is found, |
1060 | dnl use it. But if this macro is used in GNU gettext, and GNU | |
1061 | dnl gettext is already preinstalled in libintl, we update this | |
1062 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) | |
1063 | if test "$gt_cv_func_gnugettext_libc" = "yes" \ | |
1064 | || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ | |
1065 | && test "$PACKAGE" != gettext; }; then | |
1066 | AC_DEFINE(HAVE_GETTEXT, 1, | |
1067 | [Define if the GNU gettext() function is already present or preinstalled.]) | |
1068 | ||
1069 | if test "$gt_cv_func_gnugettext_libintl" = "yes"; then | |
1070 | dnl If iconv() is in a separate libiconv library, then anyone | |
1071 | dnl linking with libintl{.a,.so} also needs to link with | |
1072 | dnl libiconv. | |
1073 | INTLLIBS="-lintl $LIBICONV" | |
1074 | fi | |
1075 | ||
1076 | gt_save_LIBS="$LIBS" | |
1077 | LIBS="$LIBS $INTLLIBS" | |
1078 | AC_CHECK_FUNCS(dcgettext) | |
1079 | LIBS="$gt_save_LIBS" | |
1080 | ||
53b74c0c | 1081 | dnl Search for GNU msgfmt in the PATH. |
1e24cc5b | 1082 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, |
53b74c0c AD |
1083 | [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) |
1084 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) | |
1e24cc5b | 1085 | |
53b74c0c | 1086 | dnl Search for GNU xgettext in the PATH. |
1e24cc5b | 1087 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
53b74c0c | 1088 | [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) |
1e24cc5b AD |
1089 | |
1090 | CATOBJEXT=.gmo | |
1091 | fi | |
705db0b5 AD |
1092 | ]) |
1093 | ||
1094 | if test "$CATOBJEXT" = "NONE"; then | |
1e24cc5b | 1095 | dnl GNU gettext is not found in the C library. |
705db0b5 AD |
1096 | dnl Fall back on GNU gettext library. |
1097 | nls_cv_use_gnu_gettext=yes | |
1098 | fi | |
1099 | fi | |
1100 | ||
1101 | if test "$nls_cv_use_gnu_gettext" = "yes"; then | |
1102 | dnl Mark actions used to generate GNU NLS library. | |
1103 | INTLOBJS="\$(GETTOBJS)" | |
1104 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, | |
53b74c0c | 1105 | [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) |
705db0b5 AD |
1106 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) |
1107 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | |
53b74c0c | 1108 | [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) |
705db0b5 | 1109 | AC_SUBST(MSGFMT) |
1e24cc5b | 1110 | BUILD_INCLUDED_LIBINTL=yes |
705db0b5 AD |
1111 | USE_INCLUDED_LIBINTL=yes |
1112 | CATOBJEXT=.gmo | |
1e24cc5b AD |
1113 | INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" |
1114 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` | |
705db0b5 AD |
1115 | fi |
1116 | ||
53b74c0c AD |
1117 | dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. |
1118 | dnl Test whether we really found GNU msgfmt. | |
1119 | if test "$GMSGFMT" != ":"; then | |
1120 | dnl If it is no GNU msgfmt we define it as : so that the | |
1121 | dnl Makefiles still can work. | |
1122 | if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then | |
1123 | : ; | |
1124 | else | |
1125 | AC_MSG_RESULT( | |
1126 | [found msgfmt program is not GNU msgfmt; ignore it]) | |
1127 | GMSGFMT=":" | |
1128 | fi | |
1129 | fi | |
1130 | ||
1131 | dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. | |
705db0b5 AD |
1132 | dnl Test whether we really found GNU xgettext. |
1133 | if test "$XGETTEXT" != ":"; then | |
1134 | dnl If it is no GNU xgettext we define it as : so that the | |
1135 | dnl Makefiles still can work. | |
53b74c0c | 1136 | if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then |
705db0b5 AD |
1137 | : ; |
1138 | else | |
1139 | AC_MSG_RESULT( | |
1140 | [found xgettext program is not GNU xgettext; ignore it]) | |
1141 | XGETTEXT=":" | |
1142 | fi | |
1143 | fi | |
1144 | ||
1e24cc5b | 1145 | dnl We need to process the po/ directory. |
705db0b5 | 1146 | POSUB=po |
705db0b5 | 1147 | fi |
705db0b5 | 1148 | AC_OUTPUT_COMMANDS( |
1e24cc5b AD |
1149 | [for ac_file in $CONFIG_FILES; do |
1150 | # Support "outfile[:infile[:infile...]]" | |
1151 | case "$ac_file" in | |
1152 | *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; | |
1153 | esac | |
1154 | # PO directories have a Makefile.in generated from Makefile.in.in. | |
1155 | case "$ac_file" in */Makefile.in) | |
1156 | # Adjust a relative srcdir. | |
1157 | ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` | |
1158 | ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" | |
1159 | ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` | |
53b74c0c AD |
1160 | # In autoconf-2.13 it is called $ac_given_srcdir. |
1161 | # In autoconf-2.50 it is called $srcdir. | |
1e24cc5b AD |
1162 | test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" |
1163 | case "$ac_given_srcdir" in | |
1164 | .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; | |
1165 | /*) top_srcdir="$ac_given_srcdir" ;; | |
1166 | *) top_srcdir="$ac_dots$ac_given_srcdir" ;; | |
1167 | esac | |
1168 | if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then | |
1169 | rm -f "$ac_dir/POTFILES" | |
1170 | test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" | |
1171 | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" | |
1172 | test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" | |
1173 | sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" | |
1174 | fi | |
1175 | ;; | |
1176 | esac | |
1177 | done]) | |
1178 | ||
1179 | ||
1180 | dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL | |
1181 | dnl to 'yes' because some of the testsuite requires it. | |
705db0b5 | 1182 | if test "$PACKAGE" = gettext; then |
1e24cc5b AD |
1183 | BUILD_INCLUDED_LIBINTL=yes |
1184 | fi | |
1185 | ||
1186 | dnl intl/plural.c is generated from intl/plural.y. It requires bison, | |
1187 | dnl because plural.y uses bison specific features. It requires at least | |
1188 | dnl bison-1.26 because earlier versions generate a plural.c that doesn't | |
1189 | dnl compile. | |
1190 | dnl bison is only needed for the maintainer (who touches plural.y). But in | |
1191 | dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put | |
1192 | dnl the rule in general Makefile. Now, some people carelessly touch the | |
1193 | dnl files or have a broken "make" program, hence the plural.c rule will | |
1194 | dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not | |
1195 | dnl present or too old. | |
1196 | AC_CHECK_PROGS([INTLBISON], [bison]) | |
1197 | if test -z "$INTLBISON"; then | |
1198 | ac_verc_fail=yes | |
1199 | else | |
1200 | dnl Found it, now check the version. | |
1201 | AC_MSG_CHECKING([version of bison]) | |
1202 | changequote(<<,>>)dnl | |
1203 | ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'` | |
1204 | case $ac_prog_version in | |
1205 | '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; | |
1206 | 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) | |
1207 | changequote([,])dnl | |
1208 | ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; | |
1209 | *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; | |
1210 | esac | |
1211 | AC_MSG_RESULT([$ac_prog_version]) | |
1212 | fi | |
1213 | if test $ac_verc_fail = yes; then | |
1214 | INTLBISON=: | |
705db0b5 AD |
1215 | fi |
1216 | ||
1217 | dnl These rules are solely for the distribution goal. While doing this | |
1218 | dnl we only have to keep exactly one list of the available catalogs | |
1219 | dnl in configure.in. | |
1220 | for lang in $ALL_LINGUAS; do | |
1221 | GMOFILES="$GMOFILES $lang.gmo" | |
1222 | POFILES="$POFILES $lang.po" | |
1223 | done | |
1224 | ||
1225 | dnl Make all variables we use known to autoconf. | |
1e24cc5b | 1226 | AC_SUBST(BUILD_INCLUDED_LIBINTL) |
705db0b5 AD |
1227 | AC_SUBST(USE_INCLUDED_LIBINTL) |
1228 | AC_SUBST(CATALOGS) | |
1229 | AC_SUBST(CATOBJEXT) | |
705db0b5 | 1230 | AC_SUBST(GMOFILES) |
705db0b5 AD |
1231 | AC_SUBST(INTLLIBS) |
1232 | AC_SUBST(INTLOBJS) | |
1233 | AC_SUBST(POFILES) | |
1234 | AC_SUBST(POSUB) | |
1e24cc5b AD |
1235 | |
1236 | dnl For backward compatibility. Some configure.ins may be using this. | |
1237 | nls_cv_header_intl= | |
1238 | nls_cv_header_libgt= | |
1239 | ||
1240 | dnl For backward compatibility. Some Makefiles may be using this. | |
1241 | DATADIRNAME=share | |
1242 | AC_SUBST(DATADIRNAME) | |
1243 | ||
1244 | dnl For backward compatibility. Some Makefiles may be using this. | |
1245 | INSTOBJEXT=.mo | |
1246 | AC_SUBST(INSTOBJEXT) | |
1247 | ||
1248 | dnl For backward compatibility. Some Makefiles may be using this. | |
1249 | GENCAT=gencat | |
1250 | AC_SUBST(GENCAT) | |
705db0b5 AD |
1251 | ]) |
1252 | ||
1e24cc5b AD |
1253 | dnl Usage: Just like AM_WITH_NLS, which see. |
1254 | AC_DEFUN([AM_GNU_GETTEXT], | |
705db0b5 AD |
1255 | [AC_REQUIRE([AC_PROG_MAKE_SET])dnl |
1256 | AC_REQUIRE([AC_PROG_CC])dnl | |
1e24cc5b | 1257 | AC_REQUIRE([AC_CANONICAL_HOST])dnl |
705db0b5 AD |
1258 | AC_REQUIRE([AC_PROG_RANLIB])dnl |
1259 | AC_REQUIRE([AC_ISC_POSIX])dnl | |
1260 | AC_REQUIRE([AC_HEADER_STDC])dnl | |
1261 | AC_REQUIRE([AC_C_CONST])dnl | |
1262 | AC_REQUIRE([AC_C_INLINE])dnl | |
1263 | AC_REQUIRE([AC_TYPE_OFF_T])dnl | |
1264 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl | |
1265 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl | |
1266 | AC_REQUIRE([AC_FUNC_MMAP])dnl | |
1e24cc5b | 1267 | AC_REQUIRE([jm_GLIBC21])dnl |
705db0b5 | 1268 | |
1e24cc5b AD |
1269 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ |
1270 | stdlib.h string.h unistd.h sys/param.h]) | |
1271 | AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ | |
1272 | getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ | |
1273 | strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) | |
705db0b5 | 1274 | |
1e24cc5b AD |
1275 | AM_ICONV |
1276 | AM_LANGINFO_CODESET | |
705db0b5 | 1277 | AM_LC_MESSAGES |
1e24cc5b | 1278 | AM_WITH_NLS([$1],[$2],[$3]) |
705db0b5 AD |
1279 | |
1280 | if test "x$CATOBJEXT" != "x"; then | |
1281 | if test "x$ALL_LINGUAS" = "x"; then | |
1282 | LINGUAS= | |
1283 | else | |
1284 | AC_MSG_CHECKING(for catalogs to be installed) | |
1285 | NEW_LINGUAS= | |
1e24cc5b AD |
1286 | for presentlang in $ALL_LINGUAS; do |
1287 | useit=no | |
1288 | for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do | |
1289 | # Use the presentlang catalog if desiredlang is | |
1290 | # a. equal to presentlang, or | |
1291 | # b. a variant of presentlang (because in this case, | |
1292 | # presentlang can be used as a fallback for messages | |
1293 | # which are not translated in the desiredlang catalog). | |
1294 | case "$desiredlang" in | |
1295 | "$presentlang"*) useit=yes;; | |
1296 | esac | |
1297 | done | |
1298 | if test $useit = yes; then | |
1299 | NEW_LINGUAS="$NEW_LINGUAS $presentlang" | |
1300 | fi | |
705db0b5 AD |
1301 | done |
1302 | LINGUAS=$NEW_LINGUAS | |
1303 | AC_MSG_RESULT($LINGUAS) | |
1304 | fi | |
1305 | ||
1306 | dnl Construct list of names of catalog files to be constructed. | |
1307 | if test -n "$LINGUAS"; then | |
1308 | for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done | |
1309 | fi | |
1310 | fi | |
1311 | ||
705db0b5 | 1312 | dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly |
1e24cc5b | 1313 | dnl find the mkinstalldirs script in another subdir but $(top_srcdir). |
705db0b5 AD |
1314 | dnl Try to locate is. |
1315 | MKINSTALLDIRS= | |
1316 | if test -n "$ac_aux_dir"; then | |
1e24cc5b | 1317 | MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" |
705db0b5 AD |
1318 | fi |
1319 | if test -z "$MKINSTALLDIRS"; then | |
1320 | MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" | |
1321 | fi | |
1322 | AC_SUBST(MKINSTALLDIRS) | |
1323 | ||
1e24cc5b AD |
1324 | dnl Enable libtool support if the surrounding package wishes it. |
1325 | INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) | |
1326 | AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) | |
705db0b5 AD |
1327 | ]) |
1328 | ||
1329 | # Search path for a program which passes the given test. | |
1330 | # Ulrich Drepper <drepper@cygnus.com>, 1996. | |
1331 | # | |
1332 | # This file can be copied and used freely without restrictions. It can | |
53b74c0c AD |
1333 | # be used in projects which are not available under the GNU General Public |
1334 | # License but which still want to provide support for the GNU gettext | |
1335 | # functionality. | |
1336 | # Please note that the actual code of GNU gettext is covered by the GNU | |
1337 | # General Public License and is *not* in the public domain. | |
705db0b5 | 1338 | |
53b74c0c | 1339 | # serial 2 |
705db0b5 AD |
1340 | |
1341 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, | |
1342 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) | |
1e24cc5b | 1343 | AC_DEFUN([AM_PATH_PROG_WITH_TEST], |
705db0b5 AD |
1344 | [# Extract the first word of "$2", so it can be a program name with args. |
1345 | set dummy $2; ac_word=[$]2 | |
1346 | AC_MSG_CHECKING([for $ac_word]) | |
1347 | AC_CACHE_VAL(ac_cv_path_$1, | |
1348 | [case "[$]$1" in | |
1349 | /*) | |
1350 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. | |
1351 | ;; | |
1352 | *) | |
1353 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
1354 | for ac_dir in ifelse([$5], , $PATH, [$5]); do | |
1355 | test -z "$ac_dir" && ac_dir=. | |
1356 | if test -f $ac_dir/$ac_word; then | |
1357 | if [$3]; then | |
1358 | ac_cv_path_$1="$ac_dir/$ac_word" | |
1359 | break | |
1360 | fi | |
1361 | fi | |
1362 | done | |
1363 | IFS="$ac_save_ifs" | |
1364 | dnl If no 4th arg is given, leave the cache variable unset, | |
1365 | dnl so AC_PATH_PROGS will keep looking. | |
1366 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" | |
1367 | ])dnl | |
1368 | ;; | |
1369 | esac])dnl | |
1370 | $1="$ac_cv_path_$1" | |
53b74c0c | 1371 | if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then |
705db0b5 AD |
1372 | AC_MSG_RESULT([$]$1) |
1373 | else | |
1374 | AC_MSG_RESULT(no) | |
1375 | fi | |
1376 | AC_SUBST($1)dnl | |
1377 | ]) | |
1378 | ||
1e24cc5b AD |
1379 | #serial 2 |
1380 | ||
1381 | # Test for the GNU C Library, version 2.1 or newer. | |
1382 | # From Bruno Haible. | |
1383 | ||
1384 | AC_DEFUN([jm_GLIBC21], | |
1385 | [ | |
1386 | AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, | |
1387 | ac_cv_gnu_library_2_1, | |
1388 | [AC_EGREP_CPP([Lucky GNU user], | |
1389 | [ | |
1390 | #include <features.h> | |
1391 | #ifdef __GNU_LIBRARY__ | |
1392 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) | |
1393 | Lucky GNU user | |
1394 | #endif | |
1395 | #endif | |
1396 | ], | |
1397 | ac_cv_gnu_library_2_1=yes, | |
1398 | ac_cv_gnu_library_2_1=no) | |
1399 | ] | |
1400 | ) | |
1401 | AC_SUBST(GLIBC21) | |
1402 | GLIBC21="$ac_cv_gnu_library_2_1" | |
1403 | ] | |
1404 | ) | |
1405 | ||
1406 | #serial AM2 | |
1407 | ||
1408 | dnl From Bruno Haible. | |
1409 | ||
1410 | AC_DEFUN([AM_ICONV], | |
1411 | [ | |
1412 | dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and | |
1413 | dnl those with the standalone portable GNU libiconv installed). | |
1414 | ||
1415 | AC_ARG_WITH([libiconv-prefix], | |
1416 | [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ | |
1417 | for dir in `echo "$withval" | tr : ' '`; do | |
1418 | if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi | |
1419 | if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi | |
1420 | done | |
1421 | ]) | |
1422 | ||
1423 | AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ | |
1424 | am_cv_func_iconv="no, consider installing GNU libiconv" | |
1425 | am_cv_lib_iconv=no | |
1426 | AC_TRY_LINK([#include <stdlib.h> | |
1427 | #include <iconv.h>], | |
1428 | [iconv_t cd = iconv_open("",""); | |
1429 | iconv(cd,NULL,NULL,NULL,NULL); | |
1430 | iconv_close(cd);], | |
1431 | am_cv_func_iconv=yes) | |
1432 | if test "$am_cv_func_iconv" != yes; then | |
1433 | am_save_LIBS="$LIBS" | |
1434 | LIBS="$LIBS -liconv" | |
1435 | AC_TRY_LINK([#include <stdlib.h> | |
1436 | #include <iconv.h>], | |
1437 | [iconv_t cd = iconv_open("",""); | |
1438 | iconv(cd,NULL,NULL,NULL,NULL); | |
1439 | iconv_close(cd);], | |
1440 | am_cv_lib_iconv=yes | |
1441 | am_cv_func_iconv=yes) | |
1442 | LIBS="$am_save_LIBS" | |
1443 | fi | |
1444 | ]) | |
1445 | if test "$am_cv_func_iconv" = yes; then | |
1446 | AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) | |
1447 | AC_MSG_CHECKING([for iconv declaration]) | |
1448 | AC_CACHE_VAL(am_cv_proto_iconv, [ | |
1449 | AC_TRY_COMPILE([ | |
1450 | #include <stdlib.h> | |
1451 | #include <iconv.h> | |
1452 | extern | |
1453 | #ifdef __cplusplus | |
1454 | "C" | |
1455 | #endif | |
1456 | #if defined(__STDC__) || defined(__cplusplus) | |
1457 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); | |
1458 | #else | |
1459 | size_t iconv(); | |
1460 | #endif | |
1461 | ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") | |
1462 | am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) | |
1463 | am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` | |
1464 | AC_MSG_RESULT([$]{ac_t:- | |
1465 | }[$]am_cv_proto_iconv) | |
1466 | AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, | |
1467 | [Define as const if the declaration of iconv() needs const.]) | |
1468 | fi | |
1469 | LIBICONV= | |
1470 | if test "$am_cv_lib_iconv" = yes; then | |
1471 | LIBICONV="-liconv" | |
1472 | fi | |
1473 | AC_SUBST(LIBICONV) | |
1474 | ]) | |
1475 | ||
1476 | #serial AM1 | |
1477 | ||
1478 | dnl From Bruno Haible. | |
1479 | ||
1480 | AC_DEFUN([AM_LANGINFO_CODESET], | |
1481 | [ | |
1482 | AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, | |
1483 | [AC_TRY_LINK([#include <langinfo.h>], | |
1484 | [char* cs = nl_langinfo(CODESET);], | |
1485 | am_cv_langinfo_codeset=yes, | |
1486 | am_cv_langinfo_codeset=no) | |
1487 | ]) | |
1488 | if test $am_cv_langinfo_codeset = yes; then | |
1489 | AC_DEFINE(HAVE_LANGINFO_CODESET, 1, | |
1490 | [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) | |
1491 | fi | |
1492 | ]) | |
1493 | ||
705db0b5 AD |
1494 | # Check whether LC_MESSAGES is available in <locale.h>. |
1495 | # Ulrich Drepper <drepper@cygnus.com>, 1995. | |
1496 | # | |
1497 | # This file can be copied and used freely without restrictions. It can | |
53b74c0c AD |
1498 | # be used in projects which are not available under the GNU General Public |
1499 | # License but which still want to provide support for the GNU gettext | |
1500 | # functionality. | |
1501 | # Please note that the actual code of GNU gettext is covered by the GNU | |
1502 | # General Public License and is *not* in the public domain. | |
705db0b5 | 1503 | |
1e24cc5b | 1504 | # serial 2 |
705db0b5 | 1505 | |
1e24cc5b | 1506 | AC_DEFUN([AM_LC_MESSAGES], |
705db0b5 AD |
1507 | [if test $ac_cv_header_locale_h = yes; then |
1508 | AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, | |
1509 | [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], | |
1510 | am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) | |
1511 | if test $am_cv_val_LC_MESSAGES = yes; then | |
1512 | AC_DEFINE(HAVE_LC_MESSAGES, 1, | |
1e24cc5b | 1513 | [Define if your <locale.h> file defines LC_MESSAGES.]) |
705db0b5 AD |
1514 | fi |
1515 | fi]) | |
1516 |