]> git.saurik.com Git - bison.git/blob - aclocal.m4
* tests/atconfig.in (CPPFLAGS): Add.
[bison.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p4
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 # Do all the work for Automake. This macro actually does too much --
14 # some checks are only needed if your package does certain things.
15 # But this isn't really a big deal.
16
17 # serial 1
18
19 dnl Usage:
20 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
21
22 AC_DEFUN(AM_INIT_AUTOMAKE,
23 [AC_REQUIRE([AC_PROG_INSTALL])
24 PACKAGE=[$1]
25 AC_SUBST(PACKAGE)
26 VERSION=[$2]
27 AC_SUBST(VERSION)
28 dnl test to see if srcdir already configured
29 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
30 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
31 fi
32 ifelse([$3],,
33 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
34 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
35 AC_REQUIRE([AM_SANITY_CHECK])
36 AC_REQUIRE([AC_ARG_PROGRAM])
37 dnl FIXME This is truly gross.
38 missing_dir=`cd $ac_aux_dir && pwd`
39 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
40 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
41 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
42 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
43 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
44 AC_REQUIRE([AC_PROG_MAKE_SET])])
45
46 #
47 # Check to make sure that the build environment is sane.
48 #
49
50 AC_DEFUN(AM_SANITY_CHECK,
51 [AC_MSG_CHECKING([whether build environment is sane])
52 # Just in case
53 sleep 1
54 echo timestamp > conftestfile
55 # Do `set' in a subshell so we don't clobber the current shell's
56 # arguments. Must try -L first in case configure is actually a
57 # symlink; some systems play weird games with the mod time of symlinks
58 # (eg FreeBSD returns the mod time of the symlink's containing
59 # directory).
60 if (
61 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
62 if test "[$]*" = "X"; then
63 # -L didn't work.
64 set X `ls -t $srcdir/configure conftestfile`
65 fi
66 if test "[$]*" != "X $srcdir/configure conftestfile" \
67 && test "[$]*" != "X conftestfile $srcdir/configure"; then
68
69 # If neither matched, then we have a broken ls. This can happen
70 # if, for instance, CONFIG_SHELL is bash and it inherits a
71 # broken ls alias from the environment. This has actually
72 # happened. Such a system could not be considered "sane".
73 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
74 alias in your environment])
75 fi
76
77 test "[$]2" = conftestfile
78 )
79 then
80 # Ok.
81 :
82 else
83 AC_MSG_ERROR([newly created file is older than distributed files!
84 Check your system clock])
85 fi
86 rm -f conftest*
87 AC_MSG_RESULT(yes)])
88
89 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
90 dnl The program must properly implement --version.
91 AC_DEFUN(AM_MISSING_PROG,
92 [AC_MSG_CHECKING(for working $2)
93 # Run test in a subshell; some versions of sh will print an error if
94 # an executable is not found, even if stderr is redirected.
95 # Redirect stdin to placate older versions of autoconf. Sigh.
96 if ($2 --version) < /dev/null > /dev/null 2>&1; then
97 $1=$2
98 AC_MSG_RESULT(found)
99 else
100 $1="$3/missing $2"
101 AC_MSG_RESULT(missing)
102 fi
103 AC_SUBST($1)])
104
105 # Like AC_CONFIG_HEADER, but automatically create stamp file.
106
107 AC_DEFUN(AM_CONFIG_HEADER,
108 [AC_PREREQ([2.12])
109 AC_CONFIG_HEADER([$1])
110 dnl When config.status generates a header, we must update the stamp-h file.
111 dnl This file resides in the same directory as the config header
112 dnl that is generated. We must strip everything past the first ":",
113 dnl and everything past the last "/".
114 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
115 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
116 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
117 <<am_indx=1
118 for am_file in <<$1>>; do
119 case " <<$>>CONFIG_HEADERS " in
120 *" <<$>>am_file "*<<)>>
121 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
122 ;;
123 esac
124 am_indx=`expr "<<$>>am_indx" + 1`
125 done<<>>dnl>>)
126 changequote([,]))])
127
128
129 # serial 2
130
131 # Single argument says where are built sources to test, relative to the
132 # built test directory. Maybe omitted if the same (flat distribution).
133
134 AC_DEFUN([AT_CONFIG],
135 [AT_TESTPATH=ifelse([$1], [], [.], [$1])
136 AC_SUBST([AT_TESTPATH])
137 # Try to be compatible with both Autoconf 2.13 and 2.50.
138 if test -z "$ECHO_C$ECHO_N$ECHO_T"; then
139 ECHO_C="$ac_c"
140 ECHO_N="$ac_n"
141 ECHO_T="$ac_t"
142 AC_SUBST([ECHO_C])
143 AC_SUBST([ECHO_N])
144 AC_SUBST([ECHO_T])
145 fi
146 ])
147
148 #serial 1
149 # This test replaces the one in autoconf.
150 # Currently this macro should have the same name as the autoconf macro
151 # because gettext's gettext.m4 (distributed in the automake package)
152 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
153 # give these diagnostics:
154 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
155 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
156
157 undefine([AC_ISC_POSIX])
158
159 AC_DEFUN([AC_ISC_POSIX],
160 [
161 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
162 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
163 ]
164 )
165
166
167 # serial 1
168
169 # @defmac AC_PROG_CC_STDC
170 # @maindex PROG_CC_STDC
171 # @ovindex CC
172 # If the C compiler in not in ANSI C mode by default, try to add an option
173 # to output variable @code{CC} to make it so. This macro tries various
174 # options that select ANSI C on some system or another. It considers the
175 # compiler to be in ANSI C mode if it handles function prototypes correctly.
176 #
177 # If you use this macro, you should check after calling it whether the C
178 # compiler has been set to accept ANSI C; if not, the shell variable
179 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
180 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
181 # program @code{ansi2knr}, which comes with Ghostscript.
182 # @end defmac
183
184 AC_DEFUN(AM_PROG_CC_STDC,
185 [AC_REQUIRE([AC_PROG_CC])
186 AC_BEFORE([$0], [AC_C_INLINE])
187 AC_BEFORE([$0], [AC_C_CONST])
188 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
189 dnl a magic option to avoid problems with ANSI preprocessor commands
190 dnl like #elif.
191 dnl FIXME: can't do this because then AC_AIX won't work due to a
192 dnl circular dependency.
193 dnl AC_BEFORE([$0], [AC_PROG_CPP])
194 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
195 AC_CACHE_VAL(am_cv_prog_cc_stdc,
196 [am_cv_prog_cc_stdc=no
197 ac_save_CC="$CC"
198 # Don't try gcc -ansi; that turns off useful extensions and
199 # breaks some systems' header files.
200 # AIX -qlanglvl=ansi
201 # Ultrix and OSF/1 -std1
202 # HP-UX -Aa -D_HPUX_SOURCE
203 # SVR4 -Xc -D__EXTENSIONS__
204 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
205 do
206 CC="$ac_save_CC $ac_arg"
207 AC_TRY_COMPILE(
208 [#include <stdarg.h>
209 #include <stdio.h>
210 #include <sys/types.h>
211 #include <sys/stat.h>
212 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
213 struct buf { int x; };
214 FILE * (*rcsopen) (struct buf *, struct stat *, int);
215 static char *e (p, i)
216 char **p;
217 int i;
218 {
219 return p[i];
220 }
221 static char *f (char * (*g) (char **, int), char **p, ...)
222 {
223 char *s;
224 va_list v;
225 va_start (v,p);
226 s = g (p, va_arg (v,int));
227 va_end (v);
228 return s;
229 }
230 int test (int i, double x);
231 struct s1 {int (*f) (int a);};
232 struct s2 {int (*f) (double a);};
233 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
234 int argc;
235 char **argv;
236 ], [
237 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
238 ],
239 [am_cv_prog_cc_stdc="$ac_arg"; break])
240 done
241 CC="$ac_save_CC"
242 ])
243 if test -z "$am_cv_prog_cc_stdc"; then
244 AC_MSG_RESULT([none needed])
245 else
246 AC_MSG_RESULT($am_cv_prog_cc_stdc)
247 fi
248 case "x$am_cv_prog_cc_stdc" in
249 x|xno) ;;
250 *) CC="$CC $am_cv_prog_cc_stdc" ;;
251 esac
252 ])
253
254 # serial 1 -*- Autoconf -*-
255
256 # BISON_AC_PROG_GNU_M4
257 # --------------------
258 # Check for GNU m4, at least 1.3 (supports frozen files).
259 AC_DEFUN([BISON_AC_PROG_GNU_M4],
260 [AC_PATH_PROGS(M4, gm4 gnum4 m4, m4)
261 AC_CACHE_CHECK([whether m4 supports frozen files],
262 [ac_cv_prog_gnu_m4],
263 [ac_cv_prog_gnu_m4=no
264 if test x"$M4" != x; then
265 case `$M4 --help < /dev/null 2>&1` in
266 *reload-state*) ac_cv_prog_gnu_m4=yes ;;
267 esac
268 fi])
269 ])# BISON_AC_PROG_GNU_M4
270
271 AC_DEFUN(BISON_WARNING,
272 [AC_MSG_CHECKING(whether compiler accepts $1)
273 AC_SUBST(WARNING_CFLAGS)
274 ac_save_CFLAGS="$CFLAGS"
275 CFLAGS="$CFLAGS $1"
276 AC_TRY_COMPILE(,
277 [int x;],
278 WARNING_CFLAGS="$WARNING_CFLAGS $1"
279 AC_MSG_RESULT(yes),
280 AC_MSG_RESULT(no))
281 CFLAGS="$ac_save_CFLAGS"])
282
283
284 # serial 1
285
286 AC_DEFUN(AM_C_PROTOTYPES,
287 [AC_REQUIRE([AM_PROG_CC_STDC])
288 AC_REQUIRE([AC_PROG_CPP])
289 AC_MSG_CHECKING([for function prototypes])
290 if test "$am_cv_prog_cc_stdc" != no; then
291 AC_MSG_RESULT(yes)
292 AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
293 U= ANSI2KNR=
294 else
295 AC_MSG_RESULT(no)
296 U=_ ANSI2KNR=./ansi2knr
297 # Ensure some checks needed by ansi2knr itself.
298 AC_HEADER_STDC
299 AC_CHECK_HEADERS(string.h)
300 fi
301 AC_SUBST(U)dnl
302 AC_SUBST(ANSI2KNR)dnl
303 ])
304
305 #serial 3
306
307 dnl From Jim Meyering.
308 dnl Determine whether malloc accepts 0 as its argument.
309 dnl If it doesn't, arrange to use the replacement function.
310 dnl
311
312 AC_DEFUN(jm_FUNC_MALLOC,
313 [
314 dnl xmalloc.c requires that this symbol be defined so it doesn't
315 dnl mistakenly use a broken malloc -- as it might if this test were omitted.
316 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
317 [Define if the malloc check has been performed. ])
318
319 AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
320 [AC_TRY_RUN([
321 char *malloc ();
322 int
323 main ()
324 {
325 exit (malloc (0) ? 0 : 1);
326 }
327 ],
328 jm_cv_func_working_malloc=yes,
329 jm_cv_func_working_malloc=no,
330 dnl When crosscompiling, assume malloc is broken.
331 jm_cv_func_working_malloc=no)
332 ])
333 if test $jm_cv_func_working_malloc = no; then
334 AC_SUBST(LIBOBJS)
335 LIBOBJS="$LIBOBJS malloc.$ac_objext"
336 AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
337 [Define to rpl_malloc if the replacement function should be used.])
338 fi
339 ])
340
341 #serial 3
342
343 dnl From Jim Meyering.
344 dnl Determine whether realloc works when both arguments are 0.
345 dnl If it doesn't, arrange to use the replacement function.
346 dnl
347
348 AC_DEFUN(jm_FUNC_REALLOC,
349 [
350 dnl xmalloc.c requires that this symbol be defined so it doesn't
351 dnl mistakenly use a broken realloc -- as it might if this test were omitted.
352 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
353 [Define if the realloc check has been performed. ])
354
355 AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
356 [AC_TRY_RUN([
357 char *realloc ();
358 int
359 main ()
360 {
361 exit (realloc (0, 0) ? 0 : 1);
362 }
363 ],
364 jm_cv_func_working_realloc=yes,
365 jm_cv_func_working_realloc=no,
366 dnl When crosscompiling, assume realloc is broken.
367 jm_cv_func_working_realloc=no)
368 ])
369 if test $jm_cv_func_working_realloc = no; then
370 AC_SUBST(LIBOBJS)
371 LIBOBJS="$LIBOBJS realloc.$ac_objext"
372 AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
373 [Define to rpl_realloc if the replacement function should be used.])
374 fi
375 ])
376
377 #serial 1
378
379 dnl These are the prerequisite macros for files in the lib/
380 dnl directories of Bison.
381
382 AC_DEFUN([jm_PREREQ_QUOTEARG],
383 [
384 AC_CHECK_FUNCS(isascii iswprint mbrtowc)
385 AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
386 AC_HEADER_STDC
387 AC_C_BACKSLASH_A
388 AC_MBSTATE_T
389 AM_C_PROTOTYPES
390 ])
391
392 #serial 3
393
394 dnl From Paul Eggert.
395
396 AC_DEFUN(AC_C_BACKSLASH_A,
397 [
398 AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
399 [AC_TRY_COMPILE([],
400 [
401 #if '\a' == 'a'
402 syntax error;
403 #endif
404 char buf['\a' == 'a' ? -1 : 1];
405 buf[0] = '\a';
406 return buf[0] != "\a"[0];
407 ],
408 ac_cv_c_backslash_a=yes,
409 ac_cv_c_backslash_a=no)])
410 if test $ac_cv_c_backslash_a = yes; then
411 AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
412 [Define if backslash-a works in C strings.])
413 fi
414 ])
415
416 # serial 8
417
418 # From Paul Eggert.
419
420 # BeOS 5 has <wchar.h> but does not define mbstate_t,
421 # so you can't declare an object of that type.
422 # Check for this incompatibility with Standard C.
423
424 # Include stdlib.h first, because otherwise this test would fail on Linux
425 # (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
426 # a syntax error in wchar.h due to the use of undefined __int32_t.
427
428 AC_DEFUN(AC_MBSTATE_T,
429 [
430 AC_CHECK_HEADERS(stdlib.h)
431
432 AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
433 [AC_TRY_COMPILE([
434 #if HAVE_STDLIB_H
435 # include <stdlib.h>
436 #endif
437 #include <wchar.h>],
438 [mbstate_t x; return sizeof x;],
439 ac_cv_type_mbstate_t=yes,
440 ac_cv_type_mbstate_t=no)])
441 if test $ac_cv_type_mbstate_t = no; then
442 AC_DEFINE(mbstate_t, int,
443 [Define to a type if <wchar.h> does not define.])
444 fi])
445
446 #serial 1
447
448 dnl FIXME: put these prerequisite-only *.m4 files in a separate
449 dnl directory -- otherwise, they'll conflict with existing files.
450
451 dnl These are the prerequisite macros for GNU's error.c file.
452 AC_DEFUN(jm_PREREQ_ERROR,
453 [
454 AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
455 AC_HEADER_STDC
456 AC_FUNC_STRERROR_R
457 ])
458
459 #serial 1002
460 # Experimental replacement for the function in the latest CVS autoconf.
461 # If the compile-test says strerror_r doesn't work, then resort to a
462 # `run'-test that works on BeOS and segfaults on DEC Unix.
463 # Use with the error.c file in ../lib.
464
465 undefine([AC_FUNC_STRERROR_R])
466
467 # AC_FUNC_STRERROR_R
468 # ------------------
469 AC_DEFUN([AC_FUNC_STRERROR_R],
470 [AC_CHECK_DECLS([strerror_r])
471 AC_CHECK_FUNCS([strerror_r])
472 if test $ac_cv_func_strerror_r = yes; then
473 AC_CHECK_HEADERS(string.h)
474 AC_CACHE_CHECK([for working strerror_r],
475 ac_cv_func_strerror_r_works,
476 [
477 AC_TRY_COMPILE(
478 [
479 # include <stdio.h>
480 # if HAVE_STRING_H
481 # include <string.h>
482 # endif
483 ],
484 [
485 char buf[100];
486 char x = *strerror_r (0, buf, sizeof buf);
487 ],
488 ac_cv_func_strerror_r_works=yes,
489 ac_cv_func_strerror_r_works=no
490 )
491 if test $ac_cv_func_strerror_r_works = no; then
492 # strerror_r seems not to work, but now we have to choose between
493 # systems that have relatively inaccessible declarations for the
494 # function. BeOS and DEC UNIX 4.0 fall in this category, but the
495 # former has a strerror_r that returns char*, while the latter
496 # has a strerror_r that returns `int'.
497 # This test should segfault on the DEC system.
498 AC_TRY_RUN(
499 [
500 # include <stdio.h>
501 # include <string.h>
502 # include <ctype.h>
503
504 extern char *strerror_r ();
505
506 int
507 main ()
508 {
509 char buf[100];
510 char x = *strerror_r (0, buf, sizeof buf);
511 exit (!isalpha (x));
512 }
513 ],
514 ac_cv_func_strerror_r_works=yes,
515 ac_cv_func_strerror_r_works=no,
516 ac_cv_func_strerror_r_works=no)
517 fi
518 ])
519 if test $ac_cv_func_strerror_r_works = yes; then
520 AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
521 [Define to 1 if `strerror_r' returns a string.])
522 fi
523 fi
524 ])# AC_FUNC_STRERROR_R
525
526 # Macro to add for using GNU gettext.
527 # Ulrich Drepper <drepper@cygnus.com>, 1995.
528 #
529 # This file can be copied and used freely without restrictions. It can
530 # be used in projects which are not available under the GNU General Public
531 # License but which still want to provide support for the GNU gettext
532 # functionality.
533 # Please note that the actual code of GNU gettext is covered by the GNU
534 # General Public License and is *not* in the public domain.
535
536 # serial 10
537
538 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
539 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
540 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
541 dnl depending on --{enable,disable}-{shared,static} and on the presence of
542 dnl AM-DISABLE-SHARED). Otherwise, a static library
543 dnl $(top_builddir)/intl/libintl.a will be created.
544 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
545 dnl implementations (in libc or libintl) without the ngettext() function
546 dnl will be ignored.
547 dnl LIBDIR is used to find the intl libraries. If empty,
548 dnl the value `$(top_builddir)/intl/' is used.
549 dnl
550 dnl The result of the configuration is one of three cases:
551 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
552 dnl and used.
553 dnl Catalog format: GNU --> install in $(datadir)
554 dnl Catalog extension: .mo after installation, .gmo in source tree
555 dnl 2) GNU gettext has been found in the system's C library.
556 dnl Catalog format: GNU --> install in $(datadir)
557 dnl Catalog extension: .mo after installation, .gmo in source tree
558 dnl 3) No internationalization, always use English msgid.
559 dnl Catalog format: none
560 dnl Catalog extension: none
561 dnl The use of .gmo is historical (it was needed to avoid overwriting the
562 dnl GNU format catalogs when building on a platform with an X/Open gettext),
563 dnl but we keep it in order not to force irrelevant filename changes on the
564 dnl maintainers.
565 dnl
566 AC_DEFUN([AM_WITH_NLS],
567 [AC_MSG_CHECKING([whether NLS is requested])
568 dnl Default is enabled NLS
569 AC_ARG_ENABLE(nls,
570 [ --disable-nls do not use Native Language Support],
571 USE_NLS=$enableval, USE_NLS=yes)
572 AC_MSG_RESULT($USE_NLS)
573 AC_SUBST(USE_NLS)
574
575 BUILD_INCLUDED_LIBINTL=no
576 USE_INCLUDED_LIBINTL=no
577 INTLLIBS=
578
579 dnl If we use NLS figure out what method
580 if test "$USE_NLS" = "yes"; then
581 AC_DEFINE(ENABLE_NLS, 1,
582 [Define to 1 if translation of program messages to the user's native language
583 is requested.])
584 AC_MSG_CHECKING([whether included gettext is requested])
585 AC_ARG_WITH(included-gettext,
586 [ --with-included-gettext use the GNU gettext library included here],
587 nls_cv_force_use_gnu_gettext=$withval,
588 nls_cv_force_use_gnu_gettext=no)
589 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
590
591 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
592 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
593 dnl User does not insist on using GNU NLS library. Figure out what
594 dnl to use. If GNU gettext is available we use this. Else we have
595 dnl to fall back to GNU NLS library.
596 CATOBJEXT=NONE
597
598 dnl Add a version number to the cache macros.
599 define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
600 define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
601
602 AC_CHECK_HEADER(libintl.h,
603 [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
604 [AC_TRY_LINK([#include <libintl.h>
605 extern int _nl_msg_cat_cntr;],
606 [bindtextdomain ("", "");
607 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
608 gt_cv_func_gnugettext_libc=yes,
609 gt_cv_func_gnugettext_libc=no)])
610
611 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
612 AC_CACHE_CHECK([for GNU gettext in libintl],
613 gt_cv_func_gnugettext_libintl,
614 [gt_save_LIBS="$LIBS"
615 LIBS="$LIBS -lintl $LIBICONV"
616 AC_TRY_LINK([#include <libintl.h>
617 extern int _nl_msg_cat_cntr;],
618 [bindtextdomain ("", "");
619 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
620 gt_cv_func_gnugettext_libintl=yes,
621 gt_cv_func_gnugettext_libintl=no)
622 LIBS="$gt_save_LIBS"])
623 fi
624
625 dnl If an already present or preinstalled GNU gettext() is found,
626 dnl use it. But if this macro is used in GNU gettext, and GNU
627 dnl gettext is already preinstalled in libintl, we update this
628 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
629 if test "$gt_cv_func_gnugettext_libc" = "yes" \
630 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
631 && test "$PACKAGE" != gettext; }; then
632 AC_DEFINE(HAVE_GETTEXT, 1,
633 [Define if the GNU gettext() function is already present or preinstalled.])
634
635 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
636 dnl If iconv() is in a separate libiconv library, then anyone
637 dnl linking with libintl{.a,.so} also needs to link with
638 dnl libiconv.
639 INTLLIBS="-lintl $LIBICONV"
640 fi
641
642 gt_save_LIBS="$LIBS"
643 LIBS="$LIBS $INTLLIBS"
644 AC_CHECK_FUNCS(dcgettext)
645 LIBS="$gt_save_LIBS"
646
647 dnl Search for GNU msgfmt in the PATH.
648 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
649 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
650 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
651
652 dnl Search for GNU xgettext in the PATH.
653 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
654 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
655
656 CATOBJEXT=.gmo
657 fi
658 ])
659
660 if test "$CATOBJEXT" = "NONE"; then
661 dnl GNU gettext is not found in the C library.
662 dnl Fall back on GNU gettext library.
663 nls_cv_use_gnu_gettext=yes
664 fi
665 fi
666
667 if test "$nls_cv_use_gnu_gettext" = "yes"; then
668 dnl Mark actions used to generate GNU NLS library.
669 INTLOBJS="\$(GETTOBJS)"
670 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
671 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
672 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
673 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
674 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
675 AC_SUBST(MSGFMT)
676 BUILD_INCLUDED_LIBINTL=yes
677 USE_INCLUDED_LIBINTL=yes
678 CATOBJEXT=.gmo
679 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
680 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
681 fi
682
683 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
684 dnl Test whether we really found GNU msgfmt.
685 if test "$GMSGFMT" != ":"; then
686 dnl If it is no GNU msgfmt we define it as : so that the
687 dnl Makefiles still can work.
688 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
689 : ;
690 else
691 AC_MSG_RESULT(
692 [found msgfmt program is not GNU msgfmt; ignore it])
693 GMSGFMT=":"
694 fi
695 fi
696
697 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
698 dnl Test whether we really found GNU xgettext.
699 if test "$XGETTEXT" != ":"; then
700 dnl If it is no GNU xgettext we define it as : so that the
701 dnl Makefiles still can work.
702 if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
703 : ;
704 else
705 AC_MSG_RESULT(
706 [found xgettext program is not GNU xgettext; ignore it])
707 XGETTEXT=":"
708 fi
709 fi
710
711 dnl We need to process the po/ directory.
712 POSUB=po
713 fi
714 AC_OUTPUT_COMMANDS(
715 [for ac_file in $CONFIG_FILES; do
716 # Support "outfile[:infile[:infile...]]"
717 case "$ac_file" in
718 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
719 esac
720 # PO directories have a Makefile.in generated from Makefile.in.in.
721 case "$ac_file" in */Makefile.in)
722 # Adjust a relative srcdir.
723 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
724 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
725 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
726 # In autoconf-2.13 it is called $ac_given_srcdir.
727 # In autoconf-2.50 it is called $srcdir.
728 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
729 case "$ac_given_srcdir" in
730 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
731 /*) top_srcdir="$ac_given_srcdir" ;;
732 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
733 esac
734 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
735 rm -f "$ac_dir/POTFILES"
736 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
737 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
738 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
739 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
740 fi
741 ;;
742 esac
743 done])
744
745
746 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
747 dnl to 'yes' because some of the testsuite requires it.
748 if test "$PACKAGE" = gettext; then
749 BUILD_INCLUDED_LIBINTL=yes
750 fi
751
752 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
753 dnl because plural.y uses bison specific features. It requires at least
754 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
755 dnl compile.
756 dnl bison is only needed for the maintainer (who touches plural.y). But in
757 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
758 dnl the rule in general Makefile. Now, some people carelessly touch the
759 dnl files or have a broken "make" program, hence the plural.c rule will
760 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
761 dnl present or too old.
762 AC_CHECK_PROGS([INTLBISON], [bison])
763 if test -z "$INTLBISON"; then
764 ac_verc_fail=yes
765 else
766 dnl Found it, now check the version.
767 AC_MSG_CHECKING([version of bison])
768 changequote(<<,>>)dnl
769 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'`
770 case $ac_prog_version in
771 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
772 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
773 changequote([,])dnl
774 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
775 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
776 esac
777 AC_MSG_RESULT([$ac_prog_version])
778 fi
779 if test $ac_verc_fail = yes; then
780 INTLBISON=:
781 fi
782
783 dnl These rules are solely for the distribution goal. While doing this
784 dnl we only have to keep exactly one list of the available catalogs
785 dnl in configure.in.
786 for lang in $ALL_LINGUAS; do
787 GMOFILES="$GMOFILES $lang.gmo"
788 POFILES="$POFILES $lang.po"
789 done
790
791 dnl Make all variables we use known to autoconf.
792 AC_SUBST(BUILD_INCLUDED_LIBINTL)
793 AC_SUBST(USE_INCLUDED_LIBINTL)
794 AC_SUBST(CATALOGS)
795 AC_SUBST(CATOBJEXT)
796 AC_SUBST(GMOFILES)
797 AC_SUBST(INTLLIBS)
798 AC_SUBST(INTLOBJS)
799 AC_SUBST(POFILES)
800 AC_SUBST(POSUB)
801
802 dnl For backward compatibility. Some configure.ins may be using this.
803 nls_cv_header_intl=
804 nls_cv_header_libgt=
805
806 dnl For backward compatibility. Some Makefiles may be using this.
807 DATADIRNAME=share
808 AC_SUBST(DATADIRNAME)
809
810 dnl For backward compatibility. Some Makefiles may be using this.
811 INSTOBJEXT=.mo
812 AC_SUBST(INSTOBJEXT)
813
814 dnl For backward compatibility. Some Makefiles may be using this.
815 GENCAT=gencat
816 AC_SUBST(GENCAT)
817 ])
818
819 dnl Usage: Just like AM_WITH_NLS, which see.
820 AC_DEFUN([AM_GNU_GETTEXT],
821 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
822 AC_REQUIRE([AC_PROG_CC])dnl
823 AC_REQUIRE([AC_CANONICAL_HOST])dnl
824 AC_REQUIRE([AC_PROG_RANLIB])dnl
825 AC_REQUIRE([AC_ISC_POSIX])dnl
826 AC_REQUIRE([AC_HEADER_STDC])dnl
827 AC_REQUIRE([AC_C_CONST])dnl
828 AC_REQUIRE([AC_C_INLINE])dnl
829 AC_REQUIRE([AC_TYPE_OFF_T])dnl
830 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
831 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
832 AC_REQUIRE([AC_FUNC_MMAP])dnl
833 AC_REQUIRE([jm_GLIBC21])dnl
834
835 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
836 stdlib.h string.h unistd.h sys/param.h])
837 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
838 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
839 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
840
841 AM_ICONV
842 AM_LANGINFO_CODESET
843 AM_LC_MESSAGES
844 AM_WITH_NLS([$1],[$2],[$3])
845
846 if test "x$CATOBJEXT" != "x"; then
847 if test "x$ALL_LINGUAS" = "x"; then
848 LINGUAS=
849 else
850 AC_MSG_CHECKING(for catalogs to be installed)
851 NEW_LINGUAS=
852 for presentlang in $ALL_LINGUAS; do
853 useit=no
854 for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
855 # Use the presentlang catalog if desiredlang is
856 # a. equal to presentlang, or
857 # b. a variant of presentlang (because in this case,
858 # presentlang can be used as a fallback for messages
859 # which are not translated in the desiredlang catalog).
860 case "$desiredlang" in
861 "$presentlang"*) useit=yes;;
862 esac
863 done
864 if test $useit = yes; then
865 NEW_LINGUAS="$NEW_LINGUAS $presentlang"
866 fi
867 done
868 LINGUAS=$NEW_LINGUAS
869 AC_MSG_RESULT($LINGUAS)
870 fi
871
872 dnl Construct list of names of catalog files to be constructed.
873 if test -n "$LINGUAS"; then
874 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
875 fi
876 fi
877
878 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
879 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
880 dnl Try to locate is.
881 MKINSTALLDIRS=
882 if test -n "$ac_aux_dir"; then
883 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
884 fi
885 if test -z "$MKINSTALLDIRS"; then
886 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
887 fi
888 AC_SUBST(MKINSTALLDIRS)
889
890 dnl Enable libtool support if the surrounding package wishes it.
891 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
892 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
893 ])
894
895 # Search path for a program which passes the given test.
896 # Ulrich Drepper <drepper@cygnus.com>, 1996.
897 #
898 # This file can be copied and used freely without restrictions. It can
899 # be used in projects which are not available under the GNU General Public
900 # License but which still want to provide support for the GNU gettext
901 # functionality.
902 # Please note that the actual code of GNU gettext is covered by the GNU
903 # General Public License and is *not* in the public domain.
904
905 # serial 2
906
907 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
908 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
909 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
910 [# Extract the first word of "$2", so it can be a program name with args.
911 set dummy $2; ac_word=[$]2
912 AC_MSG_CHECKING([for $ac_word])
913 AC_CACHE_VAL(ac_cv_path_$1,
914 [case "[$]$1" in
915 /*)
916 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
917 ;;
918 *)
919 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
920 for ac_dir in ifelse([$5], , $PATH, [$5]); do
921 test -z "$ac_dir" && ac_dir=.
922 if test -f $ac_dir/$ac_word; then
923 if [$3]; then
924 ac_cv_path_$1="$ac_dir/$ac_word"
925 break
926 fi
927 fi
928 done
929 IFS="$ac_save_ifs"
930 dnl If no 4th arg is given, leave the cache variable unset,
931 dnl so AC_PATH_PROGS will keep looking.
932 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
933 ])dnl
934 ;;
935 esac])dnl
936 $1="$ac_cv_path_$1"
937 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
938 AC_MSG_RESULT([$]$1)
939 else
940 AC_MSG_RESULT(no)
941 fi
942 AC_SUBST($1)dnl
943 ])
944
945 #serial 2
946
947 # Test for the GNU C Library, version 2.1 or newer.
948 # From Bruno Haible.
949
950 AC_DEFUN([jm_GLIBC21],
951 [
952 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
953 ac_cv_gnu_library_2_1,
954 [AC_EGREP_CPP([Lucky GNU user],
955 [
956 #include <features.h>
957 #ifdef __GNU_LIBRARY__
958 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
959 Lucky GNU user
960 #endif
961 #endif
962 ],
963 ac_cv_gnu_library_2_1=yes,
964 ac_cv_gnu_library_2_1=no)
965 ]
966 )
967 AC_SUBST(GLIBC21)
968 GLIBC21="$ac_cv_gnu_library_2_1"
969 ]
970 )
971
972 #serial AM2
973
974 dnl From Bruno Haible.
975
976 AC_DEFUN([AM_ICONV],
977 [
978 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
979 dnl those with the standalone portable GNU libiconv installed).
980
981 AC_ARG_WITH([libiconv-prefix],
982 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
983 for dir in `echo "$withval" | tr : ' '`; do
984 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
985 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
986 done
987 ])
988
989 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
990 am_cv_func_iconv="no, consider installing GNU libiconv"
991 am_cv_lib_iconv=no
992 AC_TRY_LINK([#include <stdlib.h>
993 #include <iconv.h>],
994 [iconv_t cd = iconv_open("","");
995 iconv(cd,NULL,NULL,NULL,NULL);
996 iconv_close(cd);],
997 am_cv_func_iconv=yes)
998 if test "$am_cv_func_iconv" != yes; then
999 am_save_LIBS="$LIBS"
1000 LIBS="$LIBS -liconv"
1001 AC_TRY_LINK([#include <stdlib.h>
1002 #include <iconv.h>],
1003 [iconv_t cd = iconv_open("","");
1004 iconv(cd,NULL,NULL,NULL,NULL);
1005 iconv_close(cd);],
1006 am_cv_lib_iconv=yes
1007 am_cv_func_iconv=yes)
1008 LIBS="$am_save_LIBS"
1009 fi
1010 ])
1011 if test "$am_cv_func_iconv" = yes; then
1012 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
1013 AC_MSG_CHECKING([for iconv declaration])
1014 AC_CACHE_VAL(am_cv_proto_iconv, [
1015 AC_TRY_COMPILE([
1016 #include <stdlib.h>
1017 #include <iconv.h>
1018 extern
1019 #ifdef __cplusplus
1020 "C"
1021 #endif
1022 #if defined(__STDC__) || defined(__cplusplus)
1023 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1024 #else
1025 size_t iconv();
1026 #endif
1027 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
1028 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);"])
1029 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
1030 AC_MSG_RESULT([$]{ac_t:-
1031 }[$]am_cv_proto_iconv)
1032 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
1033 [Define as const if the declaration of iconv() needs const.])
1034 fi
1035 LIBICONV=
1036 if test "$am_cv_lib_iconv" = yes; then
1037 LIBICONV="-liconv"
1038 fi
1039 AC_SUBST(LIBICONV)
1040 ])
1041
1042 #serial AM1
1043
1044 dnl From Bruno Haible.
1045
1046 AC_DEFUN([AM_LANGINFO_CODESET],
1047 [
1048 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
1049 [AC_TRY_LINK([#include <langinfo.h>],
1050 [char* cs = nl_langinfo(CODESET);],
1051 am_cv_langinfo_codeset=yes,
1052 am_cv_langinfo_codeset=no)
1053 ])
1054 if test $am_cv_langinfo_codeset = yes; then
1055 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
1056 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
1057 fi
1058 ])
1059
1060 # Check whether LC_MESSAGES is available in <locale.h>.
1061 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1062 #
1063 # This file can be copied and used freely without restrictions. It can
1064 # be used in projects which are not available under the GNU General Public
1065 # License but which still want to provide support for the GNU gettext
1066 # functionality.
1067 # Please note that the actual code of GNU gettext is covered by the GNU
1068 # General Public License and is *not* in the public domain.
1069
1070 # serial 2
1071
1072 AC_DEFUN([AM_LC_MESSAGES],
1073 [if test $ac_cv_header_locale_h = yes; then
1074 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1075 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1076 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1077 if test $am_cv_val_LC_MESSAGES = yes; then
1078 AC_DEFINE(HAVE_LC_MESSAGES, 1,
1079 [Define if your <locale.h> file defines LC_MESSAGES.])
1080 fi
1081 fi])
1082