]> git.saurik.com Git - bison.git/blob - aclocal.m4
Typos.
[bison.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 # 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
149 # serial 1
150
151 # @defmac AC_PROG_CC_STDC
152 # @maindex PROG_CC_STDC
153 # @ovindex CC
154 # If the C compiler in not in ANSI C mode by default, try to add an option
155 # to output variable @code{CC} to make it so. This macro tries various
156 # options that select ANSI C on some system or another. It considers the
157 # compiler to be in ANSI C mode if it handles function prototypes correctly.
158 #
159 # If you use this macro, you should check after calling it whether the C
160 # compiler has been set to accept ANSI C; if not, the shell variable
161 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
162 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
163 # program @code{ansi2knr}, which comes with Ghostscript.
164 # @end defmac
165
166 AC_DEFUN(AM_PROG_CC_STDC,
167 [AC_REQUIRE([AC_PROG_CC])
168 AC_BEFORE([$0], [AC_C_INLINE])
169 AC_BEFORE([$0], [AC_C_CONST])
170 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
171 dnl a magic option to avoid problems with ANSI preprocessor commands
172 dnl like #elif.
173 dnl FIXME: can't do this because then AC_AIX won't work due to a
174 dnl circular dependency.
175 dnl AC_BEFORE([$0], [AC_PROG_CPP])
176 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
177 AC_CACHE_VAL(am_cv_prog_cc_stdc,
178 [am_cv_prog_cc_stdc=no
179 ac_save_CC="$CC"
180 # Don't try gcc -ansi; that turns off useful extensions and
181 # breaks some systems' header files.
182 # AIX -qlanglvl=ansi
183 # Ultrix and OSF/1 -std1
184 # HP-UX -Aa -D_HPUX_SOURCE
185 # SVR4 -Xc -D__EXTENSIONS__
186 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
187 do
188 CC="$ac_save_CC $ac_arg"
189 AC_TRY_COMPILE(
190 [#include <stdarg.h>
191 #include <stdio.h>
192 #include <sys/types.h>
193 #include <sys/stat.h>
194 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
195 struct buf { int x; };
196 FILE * (*rcsopen) (struct buf *, struct stat *, int);
197 static char *e (p, i)
198 char **p;
199 int i;
200 {
201 return p[i];
202 }
203 static char *f (char * (*g) (char **, int), char **p, ...)
204 {
205 char *s;
206 va_list v;
207 va_start (v,p);
208 s = g (p, va_arg (v,int));
209 va_end (v);
210 return s;
211 }
212 int test (int i, double x);
213 struct s1 {int (*f) (int a);};
214 struct s2 {int (*f) (double a);};
215 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
216 int argc;
217 char **argv;
218 ], [
219 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
220 ],
221 [am_cv_prog_cc_stdc="$ac_arg"; break])
222 done
223 CC="$ac_save_CC"
224 ])
225 if test -z "$am_cv_prog_cc_stdc"; then
226 AC_MSG_RESULT([none needed])
227 else
228 AC_MSG_RESULT($am_cv_prog_cc_stdc)
229 fi
230 case "x$am_cv_prog_cc_stdc" in
231 x|xno) ;;
232 *) CC="$CC $am_cv_prog_cc_stdc" ;;
233 esac
234 ])
235
236 # serial 1
237
238 # BISON_AC_PROG_GNU_M4
239 # --------------------
240 # Check for GNU m4, at least 1.3 (supports frozen files).
241 AC_DEFUN([BISON_AC_PROG_GNU_M4],
242 [AC_PATH_PROGS(M4, gm4 gnum4 m4, m4)
243 AC_CACHE_CHECK(whether m4 supports frozen files, ac_cv_prog_gnu_m4,
244 [ac_cv_prog_gnu_m4=no
245 if test x"$M4" != x; then
246 case `$M4 --help < /dev/null 2>&1` in
247 *reload-state*) ac_cv_prog_gnu_m4=yes ;;
248 esac
249 fi])])
250
251 AC_DEFUN(BISON_WARNING,
252 [AC_MSG_CHECKING(whether compiler accepts $1)
253 AC_SUBST(WARNING_CFLAGS)
254 ac_save_CFLAGS="$CFLAGS"
255 CFLAGS="$CFLAGS $1"
256 AC_TRY_COMPILE(,
257 [int x;],
258 WARNING_CFLAGS="$WARNING_CFLAGS $1"
259 AC_MSG_RESULT(yes),
260 AC_MSG_RESULT(no))
261 CFLAGS="$ac_save_CFLAGS"])
262
263
264 # serial 1
265
266 AC_DEFUN(AM_C_PROTOTYPES,
267 [AC_REQUIRE([AM_PROG_CC_STDC])
268 AC_REQUIRE([AC_PROG_CPP])
269 AC_MSG_CHECKING([for function prototypes])
270 if test "$am_cv_prog_cc_stdc" != no; then
271 AC_MSG_RESULT(yes)
272 AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
273 U= ANSI2KNR=
274 else
275 AC_MSG_RESULT(no)
276 U=_ ANSI2KNR=./ansi2knr
277 # Ensure some checks needed by ansi2knr itself.
278 AC_HEADER_STDC
279 AC_CHECK_HEADERS(string.h)
280 fi
281 AC_SUBST(U)dnl
282 AC_SUBST(ANSI2KNR)dnl
283 ])
284
285 #serial 3
286
287 dnl From Jim Meyering.
288 dnl Determine whether malloc accepts 0 as its argument.
289 dnl If it doesn't, arrange to use the replacement function.
290 dnl
291
292 AC_DEFUN(jm_FUNC_MALLOC,
293 [
294 dnl xmalloc.c requires that this symbol be defined so it doesn't
295 dnl mistakenly use a broken malloc -- as it might if this test were omitted.
296 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
297 [Define if the malloc check has been performed. ])
298
299 AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
300 [AC_TRY_RUN([
301 char *malloc ();
302 int
303 main ()
304 {
305 exit (malloc (0) ? 0 : 1);
306 }
307 ],
308 jm_cv_func_working_malloc=yes,
309 jm_cv_func_working_malloc=no,
310 dnl When crosscompiling, assume malloc is broken.
311 jm_cv_func_working_malloc=no)
312 ])
313 if test $jm_cv_func_working_malloc = no; then
314 AC_SUBST(LIBOBJS)
315 LIBOBJS="$LIBOBJS malloc.$ac_objext"
316 AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
317 [Define to rpl_malloc if the replacement function should be used.])
318 fi
319 ])
320
321 #serial 3
322
323 dnl From Jim Meyering.
324 dnl Determine whether realloc works when both arguments are 0.
325 dnl If it doesn't, arrange to use the replacement function.
326 dnl
327
328 AC_DEFUN(jm_FUNC_REALLOC,
329 [
330 dnl xmalloc.c requires that this symbol be defined so it doesn't
331 dnl mistakenly use a broken realloc -- as it might if this test were omitted.
332 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
333 [Define if the realloc check has been performed. ])
334
335 AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
336 [AC_TRY_RUN([
337 char *realloc ();
338 int
339 main ()
340 {
341 exit (realloc (0, 0) ? 0 : 1);
342 }
343 ],
344 jm_cv_func_working_realloc=yes,
345 jm_cv_func_working_realloc=no,
346 dnl When crosscompiling, assume realloc is broken.
347 jm_cv_func_working_realloc=no)
348 ])
349 if test $jm_cv_func_working_realloc = no; then
350 AC_SUBST(LIBOBJS)
351 LIBOBJS="$LIBOBJS realloc.$ac_objext"
352 AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
353 [Define to rpl_realloc if the replacement function should be used.])
354 fi
355 ])
356
357 #serial 1
358
359 dnl These are the prerequisite macros for files in the lib/
360 dnl directories of Bison.
361
362 AC_DEFUN([jm_PREREQ_QUOTEARG],
363 [
364 AC_CHECK_FUNCS(isascii iswprint mbrtowc)
365 AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
366 AC_HEADER_STDC
367 AC_C_BACKSLASH_A
368 AC_MBSTATE_T
369 AM_C_PROTOTYPES
370 ])
371
372 #serial 3
373
374 dnl From Paul Eggert.
375
376 AC_DEFUN(AC_C_BACKSLASH_A,
377 [
378 AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
379 [AC_TRY_COMPILE([],
380 [
381 #if '\a' == 'a'
382 syntax error;
383 #endif
384 char buf['\a' == 'a' ? -1 : 1];
385 buf[0] = '\a';
386 return buf[0] != "\a"[0];
387 ],
388 ac_cv_c_backslash_a=yes,
389 ac_cv_c_backslash_a=no)])
390 if test $ac_cv_c_backslash_a = yes; then
391 AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
392 [Define if backslash-a works in C strings.])
393 fi
394 ])
395
396 # serial 8
397
398 # From Paul Eggert.
399
400 # BeOS 5 has <wchar.h> but does not define mbstate_t,
401 # so you can't declare an object of that type.
402 # Check for this incompatibility with Standard C.
403
404 # Include stdlib.h first, because otherwise this test would fail on Linux
405 # (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
406 # a syntax error in wchar.h due to the use of undefined __int32_t.
407
408 AC_DEFUN(AC_MBSTATE_T,
409 [
410 AC_CHECK_HEADERS(stdlib.h)
411
412 AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
413 [AC_TRY_COMPILE([
414 #if HAVE_STDLIB_H
415 # include <stdlib.h>
416 #endif
417 #include <wchar.h>],
418 [mbstate_t x; return sizeof x;],
419 ac_cv_type_mbstate_t=yes,
420 ac_cv_type_mbstate_t=no)])
421 if test $ac_cv_type_mbstate_t = no; then
422 AC_DEFINE(mbstate_t, int,
423 [Define to a type if <wchar.h> does not define.])
424 fi])
425
426 # Macro to add for using GNU gettext.
427 # Ulrich Drepper <drepper@cygnus.com>, 1995.
428 #
429 # This file can be copied and used freely without restrictions. It can
430 # be used in projects which are not available under the GNU Public License
431 # but which still want to provide support for the GNU gettext functionality.
432 # Please note that the actual code is *not* freely available.
433
434 # serial 109
435
436 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
437
438 AC_DEFUN(AM_WITH_NLS,
439 [AC_MSG_CHECKING([whether NLS is requested])
440 dnl Default is enabled NLS
441 AC_ARG_ENABLE(nls,
442 [ --disable-nls do not use Native Language Support],
443 USE_NLS=$enableval, USE_NLS=yes)
444 AC_MSG_RESULT($USE_NLS)
445 AC_SUBST(USE_NLS)
446
447 USE_INCLUDED_LIBINTL=no
448
449 dnl If we use NLS figure out what method
450 if test "$USE_NLS" = "yes"; then
451 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested.])
452 AC_MSG_CHECKING([whether included gettext is requested])
453 AC_ARG_WITH(included-gettext,
454 [ --with-included-gettext use the GNU gettext library included here],
455 nls_cv_force_use_gnu_gettext=$withval,
456 nls_cv_force_use_gnu_gettext=no)
457 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
458
459 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
460 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
461 dnl User does not insist on using GNU NLS library. Figure out what
462 dnl to use. If gettext or catgets are available (in this order) we
463 dnl use this. Else we have to fall back to GNU NLS library.
464 dnl catgets is only used if permitted by option --with-catgets.
465 nls_cv_header_intl=
466 nls_cv_header_libgt=
467 CATOBJEXT=NONE
468
469 AC_CHECK_HEADER(libintl.h,
470 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
471 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
472 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
473
474 if test "$gt_cv_func_gettext_libc" != "yes"; then
475 AC_CHECK_LIB(intl, bindtextdomain,
476 [AC_CHECK_LIB(intl, gettext)])
477 fi
478
479 if test "$gt_cv_func_gettext_libc" = "yes" \
480 || test "$ac_cv_lib_intl_gettext" = "yes"; then
481 AC_DEFINE(HAVE_GETTEXT, 1,
482 [Define to 1 if you have gettext and don't want to use GNU gettext.])
483 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
484 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
485 if test "$MSGFMT" != "no"; then
486 AC_CHECK_FUNCS(dcgettext)
487 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
488 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
489 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
490 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
491 return _nl_msg_cat_cntr],
492 [CATOBJEXT=.gmo
493 DATADIRNAME=share],
494 [CATOBJEXT=.mo
495 DATADIRNAME=lib])
496 INSTOBJEXT=.mo
497 fi
498 fi
499 ])
500
501 if test "$CATOBJEXT" = "NONE"; then
502 AC_MSG_CHECKING([whether catgets can be used])
503 AC_ARG_WITH(catgets,
504 [ --with-catgets use catgets functions if available],
505 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
506 AC_MSG_RESULT($nls_cv_use_catgets)
507
508 if test "$nls_cv_use_catgets" = "yes"; then
509 dnl No gettext in C library. Try catgets next.
510 AC_CHECK_LIB(i, main)
511 AC_CHECK_FUNC(catgets,
512 [AC_DEFINE(HAVE_CATGETS, 1,
513 [Define as 1 if you have \`catgets' and don't want to use GNU gettext.])
514 INTLOBJS="\$(CATOBJS)"
515 AC_PATH_PROG(GENCAT, gencat, no)dnl
516 if test "$GENCAT" != "no"; then
517 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
518 if test "$GMSGFMT" = "no"; then
519 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
520 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
521 fi
522 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
523 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
524 USE_INCLUDED_LIBINTL=yes
525 CATOBJEXT=.cat
526 INSTOBJEXT=.cat
527 DATADIRNAME=lib
528 INTLDEPS='$(top_builddir)/intl/libintl.a'
529 INTLLIBS=$INTLDEPS
530 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
531 nls_cv_header_intl=intl/libintl.h
532 nls_cv_header_libgt=intl/libgettext.h
533 fi])
534 fi
535 fi
536
537 if test "$CATOBJEXT" = "NONE"; then
538 dnl Neither gettext nor catgets in included in the C library.
539 dnl Fall back on GNU gettext library.
540 nls_cv_use_gnu_gettext=yes
541 fi
542 fi
543
544 if test "$nls_cv_use_gnu_gettext" = "yes"; then
545 dnl Mark actions used to generate GNU NLS library.
546 INTLOBJS="\$(GETTOBJS)"
547 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
548 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
549 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
550 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
551 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
552 AC_SUBST(MSGFMT)
553 USE_INCLUDED_LIBINTL=yes
554 CATOBJEXT=.gmo
555 INSTOBJEXT=.mo
556 DATADIRNAME=share
557 INTLDEPS='$(top_builddir)/intl/libintl.a'
558 INTLLIBS=$INTLDEPS
559 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
560 nls_cv_header_intl=intl/libintl.h
561 nls_cv_header_libgt=intl/libgettext.h
562 fi
563
564 dnl Test whether we really found GNU xgettext.
565 if test "$XGETTEXT" != ":"; then
566 dnl If it is no GNU xgettext we define it as : so that the
567 dnl Makefiles still can work.
568 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
569 : ;
570 else
571 AC_MSG_RESULT(
572 [found xgettext program is not GNU xgettext; ignore it])
573 XGETTEXT=":"
574 fi
575 fi
576
577 # We need to process the po/ directory.
578 POSUB=po
579 else
580 DATADIRNAME=share
581 nls_cv_header_intl=intl/libintl.h
582 nls_cv_header_libgt=intl/libgettext.h
583 fi
584 if test -z "$nls_cv_header_intl"; then
585 # Clean out junk possibly left behind by a previous configuration.
586 rm -f intl/libintl.h
587 fi
588 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
589 AC_OUTPUT_COMMANDS(
590 [case "$CONFIG_FILES" in *po/Makefile.in*)
591 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
592 esac])
593
594
595 # If this is used in GNU gettext we have to set USE_NLS to `yes'
596 # because some of the sources are only built for this goal.
597 if test "$PACKAGE" = gettext; then
598 USE_NLS=yes
599 USE_INCLUDED_LIBINTL=yes
600 fi
601
602 dnl These rules are solely for the distribution goal. While doing this
603 dnl we only have to keep exactly one list of the available catalogs
604 dnl in configure.in.
605 for lang in $ALL_LINGUAS; do
606 GMOFILES="$GMOFILES $lang.gmo"
607 POFILES="$POFILES $lang.po"
608 done
609
610 dnl Make all variables we use known to autoconf.
611 AC_SUBST(USE_INCLUDED_LIBINTL)
612 AC_SUBST(CATALOGS)
613 AC_SUBST(CATOBJEXT)
614 AC_SUBST(DATADIRNAME)
615 AC_SUBST(GMOFILES)
616 AC_SUBST(INSTOBJEXT)
617 AC_SUBST(INTLDEPS)
618 AC_SUBST(INTLLIBS)
619 AC_SUBST(INTLOBJS)
620 AC_SUBST(POFILES)
621 AC_SUBST(POSUB)
622 ])
623
624 AC_DEFUN(AM_GNU_GETTEXT,
625 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
626 AC_REQUIRE([AC_PROG_CC])dnl
627 AC_REQUIRE([AC_PROG_RANLIB])dnl
628 AC_REQUIRE([AC_ISC_POSIX])dnl
629 AC_REQUIRE([AC_HEADER_STDC])dnl
630 AC_REQUIRE([AC_C_CONST])dnl
631 AC_REQUIRE([AC_C_INLINE])dnl
632 AC_REQUIRE([AC_TYPE_OFF_T])dnl
633 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
634 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
635 AC_REQUIRE([AC_FUNC_MMAP])dnl
636
637 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
638 unistd.h sys/param.h])
639 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
640 strdup __argz_count __argz_stringify __argz_next])
641
642 if test "${ac_cv_func_stpcpy+set}" != "set"; then
643 AC_CHECK_FUNCS(stpcpy)
644 fi
645 if test "${ac_cv_func_stpcpy}" = "yes"; then
646 AC_DEFINE(HAVE_STPCPY, 1,
647 [Define to 1 if you have the \`stpcpy' function.])
648 fi
649
650 AM_LC_MESSAGES
651 AM_WITH_NLS
652
653 if test "x$CATOBJEXT" != "x"; then
654 if test "x$ALL_LINGUAS" = "x"; then
655 LINGUAS=
656 else
657 AC_MSG_CHECKING(for catalogs to be installed)
658 NEW_LINGUAS=
659 for lang in ${LINGUAS=$ALL_LINGUAS}; do
660 case "$ALL_LINGUAS" in
661 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
662 esac
663 done
664 LINGUAS=$NEW_LINGUAS
665 AC_MSG_RESULT($LINGUAS)
666 fi
667
668 dnl Construct list of names of catalog files to be constructed.
669 if test -n "$LINGUAS"; then
670 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
671 fi
672 fi
673
674 dnl The reference to <locale.h> in the installed <libintl.h> file
675 dnl must be resolved because we cannot expect the users of this
676 dnl to define HAVE_LOCALE_H.
677 if test $ac_cv_header_locale_h = yes; then
678 INCLUDE_LOCALE_H="#include <locale.h>"
679 else
680 INCLUDE_LOCALE_H="\
681 /* The system does not provide the header <locale.h>. Take care yourself. */"
682 fi
683 AC_SUBST(INCLUDE_LOCALE_H)
684
685 dnl Determine which catalog format we have (if any is needed)
686 dnl For now we know about two different formats:
687 dnl Linux libc-5 and the normal X/Open format
688 test -d intl || mkdir intl
689 if test "$CATOBJEXT" = ".cat"; then
690 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
691
692 dnl Transform the SED scripts while copying because some dumb SEDs
693 dnl cannot handle comments.
694 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
695 fi
696 dnl po2tbl.sed is always needed.
697 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
698 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
699
700 dnl In the intl/Makefile.in we have a special dependency which makes
701 dnl only sense for gettext. We comment this out for non-gettext
702 dnl packages.
703 if test "$PACKAGE" = "gettext"; then
704 GT_NO="#NO#"
705 GT_YES=
706 else
707 GT_NO=
708 GT_YES="#YES#"
709 fi
710 AC_SUBST(GT_NO)
711 AC_SUBST(GT_YES)
712
713 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
714 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
715 dnl Try to locate is.
716 MKINSTALLDIRS=
717 if test -n "$ac_aux_dir"; then
718 MKINSTALLDIRS="\$(top_srcdir)/$ac_aux_dir/mkinstalldirs"
719 fi
720 if test -z "$MKINSTALLDIRS"; then
721 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
722 fi
723 AC_SUBST(MKINSTALLDIRS)
724
725 dnl *** For now the libtool support in intl/Makefile is not for real.
726 l=
727 AC_SUBST(l)
728
729 dnl Generate list of files to be processed by xgettext which will
730 dnl be included in po/Makefile.
731 test -d po || mkdir po
732 changequote(, )dnl
733 case "$srcdir" in
734 .)
735 posrcprefix="../" ;;
736 /* | [A-Za-z]:*)
737 posrcprefix="$srcdir/" ;;
738 *)
739 posrcprefix="../$srcdir/" ;;
740 esac
741 changequote([, ])dnl
742 rm -f po/POTFILES
743 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
744 < $srcdir/po/POTFILES.in > po/POTFILES
745 ])
746
747 # Search path for a program which passes the given test.
748 # Ulrich Drepper <drepper@cygnus.com>, 1996.
749 #
750 # This file can be copied and used freely without restrictions. It can
751 # be used in projects which are not available under the GNU Public License
752 # but which still want to provide support for the GNU gettext functionality.
753 # Please note that the actual code is *not* freely available.
754
755 # serial 1
756
757 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
758 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
759 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
760 [# Extract the first word of "$2", so it can be a program name with args.
761 set dummy $2; ac_word=[$]2
762 AC_MSG_CHECKING([for $ac_word])
763 AC_CACHE_VAL(ac_cv_path_$1,
764 [case "[$]$1" in
765 /*)
766 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
767 ;;
768 *)
769 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
770 for ac_dir in ifelse([$5], , $PATH, [$5]); do
771 test -z "$ac_dir" && ac_dir=.
772 if test -f $ac_dir/$ac_word; then
773 if [$3]; then
774 ac_cv_path_$1="$ac_dir/$ac_word"
775 break
776 fi
777 fi
778 done
779 IFS="$ac_save_ifs"
780 dnl If no 4th arg is given, leave the cache variable unset,
781 dnl so AC_PATH_PROGS will keep looking.
782 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
783 ])dnl
784 ;;
785 esac])dnl
786 $1="$ac_cv_path_$1"
787 if test -n "[$]$1"; then
788 AC_MSG_RESULT([$]$1)
789 else
790 AC_MSG_RESULT(no)
791 fi
792 AC_SUBST($1)dnl
793 ])
794
795 # Check whether LC_MESSAGES is available in <locale.h>.
796 # Ulrich Drepper <drepper@cygnus.com>, 1995.
797 #
798 # This file can be copied and used freely without restrictions. It can
799 # be used in projects which are not available under the GNU Public License
800 # but which still want to provide support for the GNU gettext functionality.
801 # Please note that the actual code is *not* freely available.
802
803 # serial 1
804
805 AC_DEFUN(AM_LC_MESSAGES,
806 [if test $ac_cv_header_locale_h = yes; then
807 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
808 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
809 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
810 if test $am_cv_val_LC_MESSAGES = yes; then
811 AC_DEFINE(HAVE_LC_MESSAGES, 1,
812 [Define if your locale.h file contains LC_MESSAGES.])
813 fi
814 fi])
815
816 #serial 1
817
818 dnl FIXME: put these prerequisite-only *.m4 files in a separate
819 dnl directory -- otherwise, they'll conflict with existing files.
820
821 dnl These are the prerequisite macros for GNU's error.c file.
822 AC_DEFUN(jm_PREREQ_ERROR,
823 [
824 AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
825 AC_HEADER_STDC
826 ])
827