]>
Commit | Line | Data |
---|---|---|
1e24cc5b | 1 | dnl aclocal.m4 generated automatically by aclocal 1.4-p4 |
705db0b5 AD |
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 | ||
1e24cc5b AD |
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 | ||
705db0b5 AD |
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 | ||
1e24cc5b | 254 | # serial 1 -*- Autoconf -*- |
705db0b5 AD |
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) | |
1e24cc5b AD |
261 | AC_CACHE_CHECK([whether m4 supports frozen files], |
262 | [ac_cv_prog_gnu_m4], | |
705db0b5 AD |
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 | |
1e24cc5b AD |
268 | fi]) |
269 | ])# BISON_AC_PROG_GNU_M4 | |
705db0b5 AD |
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 | ||
5141b016 AD |
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 | ||
705db0b5 AD |
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 Public License | |
531 | # but which still want to provide support for the GNU gettext functionality. | |
532 | # Please note that the actual code is *not* freely available. | |
533 | ||
1e24cc5b AD |
534 | # serial 9 |
535 | ||
536 | dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). | |
537 | dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library | |
538 | dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, | |
539 | dnl depending on --{enable,disable}-{shared,static} and on the presence of | |
540 | dnl AM-DISABLE-SHARED). Otherwise, a static library | |
541 | dnl $(top_builddir)/intl/libintl.a will be created. | |
542 | dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext | |
543 | dnl implementations (in libc or libintl) without the ngettext() function | |
544 | dnl will be ignored. | |
545 | dnl LIBDIR is used to find the intl libraries. If empty, | |
546 | dnl the value `$(top_builddir)/intl/' is used. | |
547 | dnl | |
548 | dnl The result of the configuration is one of three cases: | |
549 | dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled | |
550 | dnl and used. | |
551 | dnl Catalog format: GNU --> install in $(datadir) | |
552 | dnl Catalog extension: .mo after installation, .gmo in source tree | |
553 | dnl 2) GNU gettext has been found in the system's C library. | |
554 | dnl Catalog format: GNU --> install in $(datadir) | |
555 | dnl Catalog extension: .mo after installation, .gmo in source tree | |
556 | dnl 3) No internationalization, always use English msgid. | |
557 | dnl Catalog format: none | |
558 | dnl Catalog extension: none | |
559 | dnl The use of .gmo is historical (it was needed to avoid overwriting the | |
560 | dnl GNU format catalogs when building on a platform with an X/Open gettext), | |
561 | dnl but we keep it in order not to force irrelevant filename changes on the | |
562 | dnl maintainers. | |
563 | dnl | |
564 | AC_DEFUN([AM_WITH_NLS], | |
705db0b5 AD |
565 | [AC_MSG_CHECKING([whether NLS is requested]) |
566 | dnl Default is enabled NLS | |
567 | AC_ARG_ENABLE(nls, | |
568 | [ --disable-nls do not use Native Language Support], | |
569 | USE_NLS=$enableval, USE_NLS=yes) | |
570 | AC_MSG_RESULT($USE_NLS) | |
571 | AC_SUBST(USE_NLS) | |
572 | ||
1e24cc5b | 573 | BUILD_INCLUDED_LIBINTL=no |
705db0b5 | 574 | USE_INCLUDED_LIBINTL=no |
1e24cc5b | 575 | INTLLIBS= |
705db0b5 AD |
576 | |
577 | dnl If we use NLS figure out what method | |
578 | if test "$USE_NLS" = "yes"; then | |
1e24cc5b AD |
579 | AC_DEFINE(ENABLE_NLS, 1, |
580 | [Define to 1 if translation of program messages to the user's native language | |
581 | is requested.]) | |
705db0b5 AD |
582 | AC_MSG_CHECKING([whether included gettext is requested]) |
583 | AC_ARG_WITH(included-gettext, | |
584 | [ --with-included-gettext use the GNU gettext library included here], | |
585 | nls_cv_force_use_gnu_gettext=$withval, | |
586 | nls_cv_force_use_gnu_gettext=no) | |
587 | AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) | |
588 | ||
589 | nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" | |
590 | if test "$nls_cv_force_use_gnu_gettext" != "yes"; then | |
591 | dnl User does not insist on using GNU NLS library. Figure out what | |
1e24cc5b AD |
592 | dnl to use. If GNU gettext is available we use this. Else we have |
593 | dnl to fall back to GNU NLS library. | |
705db0b5 AD |
594 | CATOBJEXT=NONE |
595 | ||
1e24cc5b AD |
596 | dnl Add a version number to the cache macros. |
597 | define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc]) | |
598 | define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl]) | |
705db0b5 | 599 | |
1e24cc5b AD |
600 | AC_CHECK_HEADER(libintl.h, |
601 | [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, | |
602 | [AC_TRY_LINK([#include <libintl.h> | |
603 | extern int _nl_msg_cat_cntr;], | |
604 | [bindtextdomain ("", ""); | |
605 | return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], | |
606 | gt_cv_func_gnugettext_libc=yes, | |
607 | gt_cv_func_gnugettext_libc=no)]) | |
608 | ||
609 | if test "$gt_cv_func_gnugettext_libc" != "yes"; then | |
610 | AC_CACHE_CHECK([for GNU gettext in libintl], | |
611 | gt_cv_func_gnugettext_libintl, | |
612 | [gt_save_LIBS="$LIBS" | |
613 | LIBS="$LIBS -lintl $LIBICONV" | |
614 | AC_TRY_LINK([#include <libintl.h> | |
615 | extern int _nl_msg_cat_cntr;], | |
616 | [bindtextdomain ("", ""); | |
617 | return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], | |
618 | gt_cv_func_gnugettext_libintl=yes, | |
619 | gt_cv_func_gnugettext_libintl=no) | |
620 | LIBS="$gt_save_LIBS"]) | |
705db0b5 AD |
621 | fi |
622 | ||
1e24cc5b AD |
623 | dnl If an already present or preinstalled GNU gettext() is found, |
624 | dnl use it. But if this macro is used in GNU gettext, and GNU | |
625 | dnl gettext is already preinstalled in libintl, we update this | |
626 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) | |
627 | if test "$gt_cv_func_gnugettext_libc" = "yes" \ | |
628 | || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ | |
629 | && test "$PACKAGE" != gettext; }; then | |
630 | AC_DEFINE(HAVE_GETTEXT, 1, | |
631 | [Define if the GNU gettext() function is already present or preinstalled.]) | |
632 | ||
633 | if test "$gt_cv_func_gnugettext_libintl" = "yes"; then | |
634 | dnl If iconv() is in a separate libiconv library, then anyone | |
635 | dnl linking with libintl{.a,.so} also needs to link with | |
636 | dnl libiconv. | |
637 | INTLLIBS="-lintl $LIBICONV" | |
638 | fi | |
639 | ||
640 | gt_save_LIBS="$LIBS" | |
641 | LIBS="$LIBS $INTLLIBS" | |
642 | AC_CHECK_FUNCS(dcgettext) | |
643 | LIBS="$gt_save_LIBS" | |
644 | ||
645 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, | |
646 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl | |
647 | if test "$MSGFMT" != "no"; then | |
648 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) | |
649 | fi | |
650 | ||
651 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | |
652 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) | |
653 | ||
654 | CATOBJEXT=.gmo | |
655 | fi | |
705db0b5 AD |
656 | ]) |
657 | ||
658 | if test "$CATOBJEXT" = "NONE"; then | |
1e24cc5b | 659 | dnl GNU gettext is not found in the C library. |
705db0b5 AD |
660 | dnl Fall back on GNU gettext library. |
661 | nls_cv_use_gnu_gettext=yes | |
662 | fi | |
663 | fi | |
664 | ||
665 | if test "$nls_cv_use_gnu_gettext" = "yes"; then | |
666 | dnl Mark actions used to generate GNU NLS library. | |
667 | INTLOBJS="\$(GETTOBJS)" | |
668 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, | |
669 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) | |
670 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) | |
671 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | |
672 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) | |
673 | AC_SUBST(MSGFMT) | |
1e24cc5b | 674 | BUILD_INCLUDED_LIBINTL=yes |
705db0b5 AD |
675 | USE_INCLUDED_LIBINTL=yes |
676 | CATOBJEXT=.gmo | |
1e24cc5b AD |
677 | INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" |
678 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` | |
705db0b5 AD |
679 | fi |
680 | ||
681 | dnl Test whether we really found GNU xgettext. | |
682 | if test "$XGETTEXT" != ":"; then | |
683 | dnl If it is no GNU xgettext we define it as : so that the | |
684 | dnl Makefiles still can work. | |
685 | if $XGETTEXT --omit-header /dev/null 2> /dev/null; then | |
686 | : ; | |
687 | else | |
688 | AC_MSG_RESULT( | |
689 | [found xgettext program is not GNU xgettext; ignore it]) | |
690 | XGETTEXT=":" | |
691 | fi | |
692 | fi | |
693 | ||
1e24cc5b | 694 | dnl We need to process the po/ directory. |
705db0b5 | 695 | POSUB=po |
705db0b5 | 696 | fi |
705db0b5 | 697 | AC_OUTPUT_COMMANDS( |
1e24cc5b AD |
698 | [for ac_file in $CONFIG_FILES; do |
699 | # Support "outfile[:infile[:infile...]]" | |
700 | case "$ac_file" in | |
701 | *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; | |
702 | esac | |
703 | # PO directories have a Makefile.in generated from Makefile.in.in. | |
704 | case "$ac_file" in */Makefile.in) | |
705 | # Adjust a relative srcdir. | |
706 | ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` | |
707 | ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" | |
708 | ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` | |
709 | test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" | |
710 | case "$ac_given_srcdir" in | |
711 | .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; | |
712 | /*) top_srcdir="$ac_given_srcdir" ;; | |
713 | *) top_srcdir="$ac_dots$ac_given_srcdir" ;; | |
714 | esac | |
715 | if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then | |
716 | rm -f "$ac_dir/POTFILES" | |
717 | test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" | |
718 | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" | |
719 | test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" | |
720 | sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" | |
721 | fi | |
722 | ;; | |
723 | esac | |
724 | done]) | |
725 | ||
726 | ||
727 | dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL | |
728 | dnl to 'yes' because some of the testsuite requires it. | |
705db0b5 | 729 | if test "$PACKAGE" = gettext; then |
1e24cc5b AD |
730 | BUILD_INCLUDED_LIBINTL=yes |
731 | fi | |
732 | ||
733 | dnl intl/plural.c is generated from intl/plural.y. It requires bison, | |
734 | dnl because plural.y uses bison specific features. It requires at least | |
735 | dnl bison-1.26 because earlier versions generate a plural.c that doesn't | |
736 | dnl compile. | |
737 | dnl bison is only needed for the maintainer (who touches plural.y). But in | |
738 | dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put | |
739 | dnl the rule in general Makefile. Now, some people carelessly touch the | |
740 | dnl files or have a broken "make" program, hence the plural.c rule will | |
741 | dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not | |
742 | dnl present or too old. | |
743 | AC_CHECK_PROGS([INTLBISON], [bison]) | |
744 | if test -z "$INTLBISON"; then | |
745 | ac_verc_fail=yes | |
746 | else | |
747 | dnl Found it, now check the version. | |
748 | AC_MSG_CHECKING([version of bison]) | |
749 | changequote(<<,>>)dnl | |
750 | ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'` | |
751 | case $ac_prog_version in | |
752 | '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; | |
753 | 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) | |
754 | changequote([,])dnl | |
755 | ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; | |
756 | *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; | |
757 | esac | |
758 | AC_MSG_RESULT([$ac_prog_version]) | |
759 | fi | |
760 | if test $ac_verc_fail = yes; then | |
761 | INTLBISON=: | |
705db0b5 AD |
762 | fi |
763 | ||
764 | dnl These rules are solely for the distribution goal. While doing this | |
765 | dnl we only have to keep exactly one list of the available catalogs | |
766 | dnl in configure.in. | |
767 | for lang in $ALL_LINGUAS; do | |
768 | GMOFILES="$GMOFILES $lang.gmo" | |
769 | POFILES="$POFILES $lang.po" | |
770 | done | |
771 | ||
772 | dnl Make all variables we use known to autoconf. | |
1e24cc5b | 773 | AC_SUBST(BUILD_INCLUDED_LIBINTL) |
705db0b5 AD |
774 | AC_SUBST(USE_INCLUDED_LIBINTL) |
775 | AC_SUBST(CATALOGS) | |
776 | AC_SUBST(CATOBJEXT) | |
705db0b5 | 777 | AC_SUBST(GMOFILES) |
705db0b5 AD |
778 | AC_SUBST(INTLLIBS) |
779 | AC_SUBST(INTLOBJS) | |
780 | AC_SUBST(POFILES) | |
781 | AC_SUBST(POSUB) | |
1e24cc5b AD |
782 | |
783 | dnl For backward compatibility. Some configure.ins may be using this. | |
784 | nls_cv_header_intl= | |
785 | nls_cv_header_libgt= | |
786 | ||
787 | dnl For backward compatibility. Some Makefiles may be using this. | |
788 | DATADIRNAME=share | |
789 | AC_SUBST(DATADIRNAME) | |
790 | ||
791 | dnl For backward compatibility. Some Makefiles may be using this. | |
792 | INSTOBJEXT=.mo | |
793 | AC_SUBST(INSTOBJEXT) | |
794 | ||
795 | dnl For backward compatibility. Some Makefiles may be using this. | |
796 | GENCAT=gencat | |
797 | AC_SUBST(GENCAT) | |
705db0b5 AD |
798 | ]) |
799 | ||
1e24cc5b AD |
800 | dnl Usage: Just like AM_WITH_NLS, which see. |
801 | AC_DEFUN([AM_GNU_GETTEXT], | |
705db0b5 AD |
802 | [AC_REQUIRE([AC_PROG_MAKE_SET])dnl |
803 | AC_REQUIRE([AC_PROG_CC])dnl | |
1e24cc5b | 804 | AC_REQUIRE([AC_CANONICAL_HOST])dnl |
705db0b5 AD |
805 | AC_REQUIRE([AC_PROG_RANLIB])dnl |
806 | AC_REQUIRE([AC_ISC_POSIX])dnl | |
807 | AC_REQUIRE([AC_HEADER_STDC])dnl | |
808 | AC_REQUIRE([AC_C_CONST])dnl | |
809 | AC_REQUIRE([AC_C_INLINE])dnl | |
810 | AC_REQUIRE([AC_TYPE_OFF_T])dnl | |
811 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl | |
812 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl | |
813 | AC_REQUIRE([AC_FUNC_MMAP])dnl | |
1e24cc5b | 814 | AC_REQUIRE([jm_GLIBC21])dnl |
705db0b5 | 815 | |
1e24cc5b AD |
816 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ |
817 | stdlib.h string.h unistd.h sys/param.h]) | |
818 | AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ | |
819 | getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ | |
820 | strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) | |
705db0b5 | 821 | |
1e24cc5b AD |
822 | AM_ICONV |
823 | AM_LANGINFO_CODESET | |
705db0b5 | 824 | AM_LC_MESSAGES |
1e24cc5b | 825 | AM_WITH_NLS([$1],[$2],[$3]) |
705db0b5 AD |
826 | |
827 | if test "x$CATOBJEXT" != "x"; then | |
828 | if test "x$ALL_LINGUAS" = "x"; then | |
829 | LINGUAS= | |
830 | else | |
831 | AC_MSG_CHECKING(for catalogs to be installed) | |
832 | NEW_LINGUAS= | |
1e24cc5b AD |
833 | for presentlang in $ALL_LINGUAS; do |
834 | useit=no | |
835 | for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do | |
836 | # Use the presentlang catalog if desiredlang is | |
837 | # a. equal to presentlang, or | |
838 | # b. a variant of presentlang (because in this case, | |
839 | # presentlang can be used as a fallback for messages | |
840 | # which are not translated in the desiredlang catalog). | |
841 | case "$desiredlang" in | |
842 | "$presentlang"*) useit=yes;; | |
843 | esac | |
844 | done | |
845 | if test $useit = yes; then | |
846 | NEW_LINGUAS="$NEW_LINGUAS $presentlang" | |
847 | fi | |
705db0b5 AD |
848 | done |
849 | LINGUAS=$NEW_LINGUAS | |
850 | AC_MSG_RESULT($LINGUAS) | |
851 | fi | |
852 | ||
853 | dnl Construct list of names of catalog files to be constructed. | |
854 | if test -n "$LINGUAS"; then | |
855 | for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done | |
856 | fi | |
857 | fi | |
858 | ||
705db0b5 | 859 | dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly |
1e24cc5b | 860 | dnl find the mkinstalldirs script in another subdir but $(top_srcdir). |
705db0b5 AD |
861 | dnl Try to locate is. |
862 | MKINSTALLDIRS= | |
863 | if test -n "$ac_aux_dir"; then | |
1e24cc5b | 864 | MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" |
705db0b5 AD |
865 | fi |
866 | if test -z "$MKINSTALLDIRS"; then | |
867 | MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" | |
868 | fi | |
869 | AC_SUBST(MKINSTALLDIRS) | |
870 | ||
1e24cc5b AD |
871 | dnl Enable libtool support if the surrounding package wishes it. |
872 | INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) | |
873 | AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) | |
705db0b5 AD |
874 | ]) |
875 | ||
876 | # Search path for a program which passes the given test. | |
877 | # Ulrich Drepper <drepper@cygnus.com>, 1996. | |
878 | # | |
879 | # This file can be copied and used freely without restrictions. It can | |
880 | # be used in projects which are not available under the GNU Public License | |
881 | # but which still want to provide support for the GNU gettext functionality. | |
882 | # Please note that the actual code is *not* freely available. | |
883 | ||
884 | # serial 1 | |
885 | ||
886 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, | |
887 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) | |
1e24cc5b | 888 | AC_DEFUN([AM_PATH_PROG_WITH_TEST], |
705db0b5 AD |
889 | [# Extract the first word of "$2", so it can be a program name with args. |
890 | set dummy $2; ac_word=[$]2 | |
891 | AC_MSG_CHECKING([for $ac_word]) | |
892 | AC_CACHE_VAL(ac_cv_path_$1, | |
893 | [case "[$]$1" in | |
894 | /*) | |
895 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. | |
896 | ;; | |
897 | *) | |
898 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
899 | for ac_dir in ifelse([$5], , $PATH, [$5]); do | |
900 | test -z "$ac_dir" && ac_dir=. | |
901 | if test -f $ac_dir/$ac_word; then | |
902 | if [$3]; then | |
903 | ac_cv_path_$1="$ac_dir/$ac_word" | |
904 | break | |
905 | fi | |
906 | fi | |
907 | done | |
908 | IFS="$ac_save_ifs" | |
909 | dnl If no 4th arg is given, leave the cache variable unset, | |
910 | dnl so AC_PATH_PROGS will keep looking. | |
911 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" | |
912 | ])dnl | |
913 | ;; | |
914 | esac])dnl | |
915 | $1="$ac_cv_path_$1" | |
916 | if test -n "[$]$1"; then | |
917 | AC_MSG_RESULT([$]$1) | |
918 | else | |
919 | AC_MSG_RESULT(no) | |
920 | fi | |
921 | AC_SUBST($1)dnl | |
922 | ]) | |
923 | ||
1e24cc5b AD |
924 | #serial 2 |
925 | ||
926 | # Test for the GNU C Library, version 2.1 or newer. | |
927 | # From Bruno Haible. | |
928 | ||
929 | AC_DEFUN([jm_GLIBC21], | |
930 | [ | |
931 | AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, | |
932 | ac_cv_gnu_library_2_1, | |
933 | [AC_EGREP_CPP([Lucky GNU user], | |
934 | [ | |
935 | #include <features.h> | |
936 | #ifdef __GNU_LIBRARY__ | |
937 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) | |
938 | Lucky GNU user | |
939 | #endif | |
940 | #endif | |
941 | ], | |
942 | ac_cv_gnu_library_2_1=yes, | |
943 | ac_cv_gnu_library_2_1=no) | |
944 | ] | |
945 | ) | |
946 | AC_SUBST(GLIBC21) | |
947 | GLIBC21="$ac_cv_gnu_library_2_1" | |
948 | ] | |
949 | ) | |
950 | ||
951 | #serial AM2 | |
952 | ||
953 | dnl From Bruno Haible. | |
954 | ||
955 | AC_DEFUN([AM_ICONV], | |
956 | [ | |
957 | dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and | |
958 | dnl those with the standalone portable GNU libiconv installed). | |
959 | ||
960 | AC_ARG_WITH([libiconv-prefix], | |
961 | [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ | |
962 | for dir in `echo "$withval" | tr : ' '`; do | |
963 | if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi | |
964 | if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi | |
965 | done | |
966 | ]) | |
967 | ||
968 | AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ | |
969 | am_cv_func_iconv="no, consider installing GNU libiconv" | |
970 | am_cv_lib_iconv=no | |
971 | AC_TRY_LINK([#include <stdlib.h> | |
972 | #include <iconv.h>], | |
973 | [iconv_t cd = iconv_open("",""); | |
974 | iconv(cd,NULL,NULL,NULL,NULL); | |
975 | iconv_close(cd);], | |
976 | am_cv_func_iconv=yes) | |
977 | if test "$am_cv_func_iconv" != yes; then | |
978 | am_save_LIBS="$LIBS" | |
979 | LIBS="$LIBS -liconv" | |
980 | AC_TRY_LINK([#include <stdlib.h> | |
981 | #include <iconv.h>], | |
982 | [iconv_t cd = iconv_open("",""); | |
983 | iconv(cd,NULL,NULL,NULL,NULL); | |
984 | iconv_close(cd);], | |
985 | am_cv_lib_iconv=yes | |
986 | am_cv_func_iconv=yes) | |
987 | LIBS="$am_save_LIBS" | |
988 | fi | |
989 | ]) | |
990 | if test "$am_cv_func_iconv" = yes; then | |
991 | AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) | |
992 | AC_MSG_CHECKING([for iconv declaration]) | |
993 | AC_CACHE_VAL(am_cv_proto_iconv, [ | |
994 | AC_TRY_COMPILE([ | |
995 | #include <stdlib.h> | |
996 | #include <iconv.h> | |
997 | extern | |
998 | #ifdef __cplusplus | |
999 | "C" | |
1000 | #endif | |
1001 | #if defined(__STDC__) || defined(__cplusplus) | |
1002 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); | |
1003 | #else | |
1004 | size_t iconv(); | |
1005 | #endif | |
1006 | ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") | |
1007 | 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);"]) | |
1008 | am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` | |
1009 | AC_MSG_RESULT([$]{ac_t:- | |
1010 | }[$]am_cv_proto_iconv) | |
1011 | AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, | |
1012 | [Define as const if the declaration of iconv() needs const.]) | |
1013 | fi | |
1014 | LIBICONV= | |
1015 | if test "$am_cv_lib_iconv" = yes; then | |
1016 | LIBICONV="-liconv" | |
1017 | fi | |
1018 | AC_SUBST(LIBICONV) | |
1019 | ]) | |
1020 | ||
1021 | #serial AM1 | |
1022 | ||
1023 | dnl From Bruno Haible. | |
1024 | ||
1025 | AC_DEFUN([AM_LANGINFO_CODESET], | |
1026 | [ | |
1027 | AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, | |
1028 | [AC_TRY_LINK([#include <langinfo.h>], | |
1029 | [char* cs = nl_langinfo(CODESET);], | |
1030 | am_cv_langinfo_codeset=yes, | |
1031 | am_cv_langinfo_codeset=no) | |
1032 | ]) | |
1033 | if test $am_cv_langinfo_codeset = yes; then | |
1034 | AC_DEFINE(HAVE_LANGINFO_CODESET, 1, | |
1035 | [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) | |
1036 | fi | |
1037 | ]) | |
1038 | ||
705db0b5 AD |
1039 | # Check whether LC_MESSAGES is available in <locale.h>. |
1040 | # Ulrich Drepper <drepper@cygnus.com>, 1995. | |
1041 | # | |
1042 | # This file can be copied and used freely without restrictions. It can | |
1043 | # be used in projects which are not available under the GNU Public License | |
1044 | # but which still want to provide support for the GNU gettext functionality. | |
1045 | # Please note that the actual code is *not* freely available. | |
1046 | ||
1e24cc5b | 1047 | # serial 2 |
705db0b5 | 1048 | |
1e24cc5b | 1049 | AC_DEFUN([AM_LC_MESSAGES], |
705db0b5 AD |
1050 | [if test $ac_cv_header_locale_h = yes; then |
1051 | AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, | |
1052 | [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], | |
1053 | am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) | |
1054 | if test $am_cv_val_LC_MESSAGES = yes; then | |
1055 | AC_DEFINE(HAVE_LC_MESSAGES, 1, | |
1e24cc5b | 1056 | [Define if your <locale.h> file defines LC_MESSAGES.]) |
705db0b5 AD |
1057 | fi |
1058 | fi]) | |
1059 |