]> git.ipfire.org Git - thirdparty/bash.git/blame - aclocal.m4
Bash-4.2 direxpand with patch 27
[thirdparty/bash.git] / aclocal.m4
CommitLineData
ccc6cda3
JA
1dnl
2dnl Bash specific tests
3dnl
4dnl Some derived from PDKSH 5.1.3 autoconf tests
5dnl
f73dda09
JA
6
7AC_DEFUN(BASH_C_LONG_LONG,
8[AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
9[if test "$GCC" = yes; then
10 ac_cv_c_long_long=yes
11else
12AC_TRY_RUN([
13int
ccc6cda3
JA
14main()
15{
f73dda09
JA
16long long foo = 0;
17exit(sizeof(long long) < sizeof(long));
ccc6cda3 18}
f73dda09
JA
19], ac_cv_c_long_long=yes, ac_cv_c_long_long=no)
20fi])
21if test $ac_cv_c_long_long = yes; then
22 AC_DEFINE(HAVE_LONG_LONG, 1, [Define if the `long long' type works.])
ccc6cda3
JA
23fi
24])
25
f73dda09
JA
26dnl
27dnl This is very similar to AC_C_LONG_DOUBLE, with the fix for IRIX
28dnl (< changed to <=) added.
29dnl
30AC_DEFUN(BASH_C_LONG_DOUBLE,
31[AC_CACHE_CHECK(for long double, ac_cv_c_long_double,
32[if test "$GCC" = yes; then
33 ac_cv_c_long_double=yes
34else
35AC_TRY_RUN([
36int
ccc6cda3
JA
37main()
38{
f73dda09
JA
39 /* The Stardent Vistra knows sizeof(long double), but does not
40 support it. */
41 long double foo = 0.0;
42 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
43 /* On IRIX 5.3, the compiler converts long double to double with a warning,
44 but compiles this successfully. */
45 exit(sizeof(long double) <= sizeof(double));
ccc6cda3 46}
f73dda09
JA
47], ac_cv_c_long_double=yes, ac_cv_c_long_double=no)
48fi])
49if test $ac_cv_c_long_double = yes; then
50 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if the `long double' type works.])
ccc6cda3
JA
51fi
52])
53
f73dda09
JA
54dnl
55dnl Check for <inttypes.h>. This is separated out so that it can be
56dnl AC_REQUIREd.
57dnl
58dnl BASH_HEADER_INTTYPES
59AC_DEFUN(BASH_HEADER_INTTYPES,
60[
61 AC_CHECK_HEADERS(inttypes.h)
62])
63
ccc6cda3
JA
64dnl
65dnl check for typedef'd symbols in header files, but allow the caller to
66dnl specify the include files to be checked in addition to the default
67dnl
68dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND])
69AC_DEFUN(BASH_CHECK_TYPE,
f73dda09
JA
70[
71AC_REQUIRE([AC_HEADER_STDC])dnl
72AC_REQUIRE([BASH_HEADER_INTTYPES])
ccc6cda3
JA
73AC_MSG_CHECKING(for $1)
74AC_CACHE_VAL(bash_cv_type_$1,
75[AC_EGREP_CPP($1, [#include <sys/types.h>
76#if STDC_HEADERS
77#include <stdlib.h>
f73dda09
JA
78#include <stddef.h>
79#endif
80#if HAVE_INTTYPES_H
81#include <inttypes.h>
ccc6cda3 82#endif
0001803f
CR
83#if HAVE_STDINT_H
84#include <stdint.h>
85#endif
ccc6cda3
JA
86$2
87], bash_cv_type_$1=yes, bash_cv_type_$1=no)])
88AC_MSG_RESULT($bash_cv_type_$1)
89ifelse($#, 4, [if test $bash_cv_type_$1 = yes; then
90 AC_DEFINE($4)
91 fi])
92if test $bash_cv_type_$1 = no; then
f73dda09 93 AC_DEFINE_UNQUOTED($1, $3)
ccc6cda3
JA
94fi
95])
96
97dnl
f73dda09 98dnl BASH_CHECK_DECL(FUNC)
ccc6cda3 99dnl
f73dda09
JA
100dnl Check for a declaration of FUNC in stdlib.h and inttypes.h like
101dnl AC_CHECK_DECL
102dnl
103AC_DEFUN(BASH_CHECK_DECL,
104[
105AC_REQUIRE([AC_HEADER_STDC])
106AC_REQUIRE([BASH_HEADER_INTTYPES])
107AC_CACHE_CHECK([for declaration of $1], bash_cv_decl_$1,
108[AC_TRY_LINK(
109[
110#if STDC_HEADERS
111# include <stdlib.h>
112#endif
113#if HAVE_INTTYPES_H
114# include <inttypes.h>
115#endif
116],
117[return !$1;],
118bash_cv_decl_$1=yes, bash_cv_decl_$1=no)])
119bash_tr_func=HAVE_DECL_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
120if test $bash_cv_decl_$1 = yes; then
121 AC_DEFINE_UNQUOTED($bash_tr_func, 1)
122else
123 AC_DEFINE_UNQUOTED($bash_tr_func, 0)
124fi
125])
126
127AC_DEFUN(BASH_DECL_PRINTF,
128[AC_MSG_CHECKING(for declaration of printf in <stdio.h>)
129AC_CACHE_VAL(bash_cv_printf_declared,
130[AC_TRY_RUN([
131#include <stdio.h>
132#ifdef __STDC__
133typedef int (*_bashfunc)(const char *, ...);
134#else
135typedef int (*_bashfunc)();
136#endif
ccc6cda3
JA
137main()
138{
f73dda09
JA
139_bashfunc pf;
140pf = (_bashfunc) printf;
141exit(pf == 0);
142}
143], bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
144 [AC_MSG_WARN(cannot check printf declaration if cross compiling -- defaulting to yes)
145 bash_cv_printf_declared=yes]
146)])
147AC_MSG_RESULT($bash_cv_printf_declared)
148if test $bash_cv_printf_declared = yes; then
149AC_DEFINE(PRINTF_DECLARED)
150fi
ccc6cda3 151])
f73dda09
JA
152
153AC_DEFUN(BASH_DECL_SBRK,
154[AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>)
155AC_CACHE_VAL(bash_cv_sbrk_declared,
156[AC_EGREP_HEADER(sbrk, unistd.h,
157 bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)])
158AC_MSG_RESULT($bash_cv_sbrk_declared)
159if test $bash_cv_sbrk_declared = yes; then
160AC_DEFINE(SBRK_DECLARED)
ccc6cda3
JA
161fi
162])
163
164dnl
165dnl Check for sys_siglist[] or _sys_siglist[]
166dnl
e8ce775d
JA
167AC_DEFUN(BASH_DECL_UNDER_SYS_SIGLIST,
168[AC_MSG_CHECKING([for _sys_siglist in signal.h or unistd.h])
169AC_CACHE_VAL(bash_cv_decl_under_sys_siglist,
170[AC_TRY_COMPILE([
171#include <sys/types.h>
172#include <signal.h>
173#ifdef HAVE_UNISTD_H
174#include <unistd.h>
175#endif], [ char *msg = _sys_siglist[2]; ],
176 bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no,
b72432fd 177 [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl
e8ce775d
JA
178AC_MSG_RESULT($bash_cv_decl_under_sys_siglist)
179if test $bash_cv_decl_under_sys_siglist = yes; then
180AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED)
181fi
182])
183
ccc6cda3 184AC_DEFUN(BASH_UNDER_SYS_SIGLIST,
e8ce775d
JA
185[AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
186AC_MSG_CHECKING([for _sys_siglist in system C library])
ccc6cda3
JA
187AC_CACHE_VAL(bash_cv_under_sys_siglist,
188[AC_TRY_RUN([
189#include <sys/types.h>
190#include <signal.h>
191#ifdef HAVE_UNISTD_H
192#include <unistd.h>
193#endif
e8ce775d 194#ifndef UNDER_SYS_SIGLIST_DECLARED
ccc6cda3
JA
195extern char *_sys_siglist[];
196#endif
197main()
198{
e8ce775d 199char *msg = (char *)_sys_siglist[2];
ccc6cda3
JA
200exit(msg == 0);
201}],
cce855bc 202 bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
b72432fd 203 [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)
cce855bc 204 bash_cv_under_sys_siglist=no])])
ccc6cda3
JA
205AC_MSG_RESULT($bash_cv_under_sys_siglist)
206if test $bash_cv_under_sys_siglist = yes; then
207AC_DEFINE(HAVE_UNDER_SYS_SIGLIST)
208fi
209])
210
211AC_DEFUN(BASH_SYS_SIGLIST,
212[AC_REQUIRE([AC_DECL_SYS_SIGLIST])
213AC_MSG_CHECKING([for sys_siglist in system C library])
214AC_CACHE_VAL(bash_cv_sys_siglist,
215[AC_TRY_RUN([
216#include <sys/types.h>
217#include <signal.h>
218#ifdef HAVE_UNISTD_H
219#include <unistd.h>
220#endif
3185942a 221#if !HAVE_DECL_SYS_SIGLIST
ccc6cda3
JA
222extern char *sys_siglist[];
223#endif
224main()
225{
226char *msg = sys_siglist[2];
227exit(msg == 0);
228}],
cce855bc 229 bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no,
b72432fd 230 [AC_MSG_WARN(cannot check for sys_siglist if cross compiling -- defaulting to no)
cce855bc 231 bash_cv_sys_siglist=no])])
ccc6cda3
JA
232AC_MSG_RESULT($bash_cv_sys_siglist)
233if test $bash_cv_sys_siglist = yes; then
234AC_DEFINE(HAVE_SYS_SIGLIST)
235fi
236])
237
f73dda09
JA
238dnl Check for the various permutations of sys_siglist and make sure we
239dnl compile in siglist.o if they're not defined
240AC_DEFUN(BASH_CHECK_SYS_SIGLIST, [
241AC_REQUIRE([BASH_SYS_SIGLIST])
242AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
243AC_REQUIRE([BASH_FUNC_STRSIGNAL])
244if test "$bash_cv_sys_siglist" = no && test "$bash_cv_under_sys_siglist" = no && test "$bash_cv_have_strsignal" = no; then
245 SIGLIST_O=siglist.o
246else
247 SIGLIST_O=
248fi
249AC_SUBST([SIGLIST_O])
250])
251
ccc6cda3
JA
252dnl Check for sys_errlist[] and sys_nerr, check for declaration
253AC_DEFUN(BASH_SYS_ERRLIST,
254[AC_MSG_CHECKING([for sys_errlist and sys_nerr])
255AC_CACHE_VAL(bash_cv_sys_errlist,
256[AC_TRY_LINK([#include <errno.h>],
257[extern char *sys_errlist[];
258 extern int sys_nerr;
259 char *msg = sys_errlist[sys_nerr - 1];],
260 bash_cv_sys_errlist=yes, bash_cv_sys_errlist=no)])dnl
261AC_MSG_RESULT($bash_cv_sys_errlist)
262if test $bash_cv_sys_errlist = yes; then
263AC_DEFINE(HAVE_SYS_ERRLIST)
264fi
265])
266
f73dda09
JA
267dnl
268dnl Check if dup2() does not clear the close on exec flag
269dnl
270AC_DEFUN(BASH_FUNC_DUP2_CLOEXEC_CHECK,
271[AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag)
272AC_CACHE_VAL(bash_cv_dup2_broken,
273[AC_TRY_RUN([
274#include <sys/types.h>
275#include <fcntl.h>
276main()
277{
278 int fd1, fd2, fl;
279 fd1 = open("/dev/null", 2);
280 if (fcntl(fd1, 2, 1) < 0)
281 exit(1);
282 fd2 = dup2(fd1, 1);
283 if (fd2 < 0)
284 exit(2);
285 fl = fcntl(fd2, 1, 0);
286 /* fl will be 1 if dup2 did not reset the close-on-exec flag. */
287 exit(fl != 1);
288}
289], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no,
290 [AC_MSG_WARN(cannot check dup2 if cross compiling -- defaulting to no)
291 bash_cv_dup2_broken=no])
292])
293AC_MSG_RESULT($bash_cv_dup2_broken)
294if test $bash_cv_dup2_broken = yes; then
295AC_DEFINE(DUP2_BROKEN)
296fi
297])
298
299AC_DEFUN(BASH_FUNC_STRSIGNAL,
300[AC_MSG_CHECKING([for the existence of strsignal])
301AC_CACHE_VAL(bash_cv_have_strsignal,
302[AC_TRY_LINK([#include <sys/types.h>
303#include <signal.h>],
304[char *s = (char *)strsignal(2);],
305 bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)])
306AC_MSG_RESULT($bash_cv_have_strsignal)
307if test $bash_cv_have_strsignal = yes; then
308AC_DEFINE(HAVE_STRSIGNAL)
309fi
310])
311
ccc6cda3
JA
312dnl Check to see if opendir will open non-directories (not a nice thing)
313AC_DEFUN(BASH_FUNC_OPENDIR_CHECK,
314[AC_REQUIRE([AC_HEADER_DIRENT])dnl
315AC_MSG_CHECKING(if opendir() opens non-directories)
316AC_CACHE_VAL(bash_cv_opendir_not_robust,
317[AC_TRY_RUN([
318#include <stdio.h>
319#include <sys/types.h>
320#include <fcntl.h>
321#ifdef HAVE_UNISTD_H
322# include <unistd.h>
323#endif /* HAVE_UNISTD_H */
324#if defined(HAVE_DIRENT_H)
325# include <dirent.h>
326#else
327# define dirent direct
328# ifdef HAVE_SYS_NDIR_H
329# include <sys/ndir.h>
330# endif /* SYSNDIR */
331# ifdef HAVE_SYS_DIR_H
332# include <sys/dir.h>
333# endif /* SYSDIR */
334# ifdef HAVE_NDIR_H
335# include <ndir.h>
336# endif
337#endif /* HAVE_DIRENT_H */
338main()
339{
340DIR *dir;
bb70624e 341int fd, err;
3185942a 342err = mkdir("bash-aclocal", 0700);
bb70624e
JA
343if (err < 0) {
344 perror("mkdir");
345 exit(1);
346}
3185942a
JA
347unlink("bash-aclocal/not_a_directory");
348fd = open("bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666);
ccc6cda3
JA
349write(fd, "\n", 1);
350close(fd);
3185942a
JA
351dir = opendir("bash-aclocal/not_a_directory");
352unlink("bash-aclocal/not_a_directory");
353rmdir("bash-aclocal");
ccc6cda3
JA
354exit (dir == 0);
355}], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
b72432fd 356 [AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
cce855bc
JA
357 bash_cv_opendir_not_robust=no]
358)])
ccc6cda3
JA
359AC_MSG_RESULT($bash_cv_opendir_not_robust)
360if test $bash_cv_opendir_not_robust = yes; then
361AC_DEFINE(OPENDIR_NOT_ROBUST)
362fi
363])
364
365dnl
366AC_DEFUN(BASH_TYPE_SIGHANDLER,
367[AC_MSG_CHECKING([whether signal handlers are of type void])
368AC_CACHE_VAL(bash_cv_void_sighandler,
369[AC_TRY_COMPILE([#include <sys/types.h>
370#include <signal.h>
371#ifdef signal
372#undef signal
373#endif
374#ifdef __cplusplus
375extern "C"
376#endif
377void (*signal ()) ();],
378[int i;], bash_cv_void_sighandler=yes, bash_cv_void_sighandler=no)])dnl
379AC_MSG_RESULT($bash_cv_void_sighandler)
380if test $bash_cv_void_sighandler = yes; then
381AC_DEFINE(VOID_SIGHANDLER)
382fi
383])
384
bb70624e
JA
385dnl
386dnl A signed 16-bit integer quantity
387dnl
388AC_DEFUN(BASH_TYPE_BITS16_T,
389[
390if test "$ac_cv_sizeof_short" = 2; then
391 AC_CHECK_TYPE(bits16_t, short)
392elif test "$ac_cv_sizeof_char" = 2; then
393 AC_CHECK_TYPE(bits16_t, char)
394else
395 AC_CHECK_TYPE(bits16_t, short)
396fi
397])
398
399dnl
400dnl An unsigned 16-bit integer quantity
401dnl
402AC_DEFUN(BASH_TYPE_U_BITS16_T,
403[
404if test "$ac_cv_sizeof_short" = 2; then
405 AC_CHECK_TYPE(u_bits16_t, unsigned short)
406elif test "$ac_cv_sizeof_char" = 2; then
407 AC_CHECK_TYPE(u_bits16_t, unsigned char)
408else
409 AC_CHECK_TYPE(u_bits16_t, unsigned short)
410fi
411])
412
413dnl
414dnl A signed 32-bit integer quantity
415dnl
416AC_DEFUN(BASH_TYPE_BITS32_T,
cce855bc 417[
b72432fd 418if test "$ac_cv_sizeof_int" = 4; then
bb70624e 419 AC_CHECK_TYPE(bits32_t, int)
b72432fd 420elif test "$ac_cv_sizeof_long" = 4; then
bb70624e 421 AC_CHECK_TYPE(bits32_t, long)
cce855bc 422else
bb70624e 423 AC_CHECK_TYPE(bits32_t, int)
cce855bc
JA
424fi
425])
426
bb70624e
JA
427dnl
428dnl An unsigned 32-bit integer quantity
429dnl
430AC_DEFUN(BASH_TYPE_U_BITS32_T,
cce855bc 431[
b72432fd 432if test "$ac_cv_sizeof_int" = 4; then
bb70624e 433 AC_CHECK_TYPE(u_bits32_t, unsigned int)
b72432fd 434elif test "$ac_cv_sizeof_long" = 4; then
bb70624e 435 AC_CHECK_TYPE(u_bits32_t, unsigned long)
cce855bc 436else
bb70624e 437 AC_CHECK_TYPE(u_bits32_t, unsigned int)
cce855bc
JA
438fi
439])
440
441AC_DEFUN(BASH_TYPE_PTRDIFF_T,
442[
b72432fd
JA
443if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then
444 AC_CHECK_TYPE(ptrdiff_t, int)
445elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then
446 AC_CHECK_TYPE(ptrdiff_t, long)
f73dda09
JA
447elif test "$ac_cv_type_long_long" = yes && test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_char_p"; then
448 AC_CHECK_TYPE(ptrdiff_t, [long long])
cce855bc 449else
b72432fd 450 AC_CHECK_TYPE(ptrdiff_t, int)
cce855bc 451fi
b72432fd
JA
452])
453
bb70624e
JA
454dnl
455dnl A signed 64-bit quantity
456dnl
b72432fd
JA
457AC_DEFUN(BASH_TYPE_BITS64_T,
458[
f73dda09 459if test "$ac_cv_sizeof_char_p" = 8; then
b72432fd
JA
460 AC_CHECK_TYPE(bits64_t, char *)
461elif test "$ac_cv_sizeof_double" = 8; then
462 AC_CHECK_TYPE(bits64_t, double)
f73dda09
JA
463elif test -n "$ac_cv_type_long_long" && test "$ac_cv_sizeof_long_long" = 8; then
464 AC_CHECK_TYPE(bits64_t, [long long])
b72432fd
JA
465elif test "$ac_cv_sizeof_long" = 8; then
466 AC_CHECK_TYPE(bits64_t, long)
cce855bc 467else
b72432fd 468 AC_CHECK_TYPE(bits64_t, double)
cce855bc
JA
469fi
470])
471
f73dda09
JA
472AC_DEFUN(BASH_TYPE_LONG_LONG,
473[
474AC_CACHE_CHECK([for long long], bash_cv_type_long_long,
475[AC_TRY_LINK([
476long long ll = 1; int i = 63;],
477[
478long long llm = (long long) -1;
479return ll << i | ll >> i | llm / ll | llm % ll;
480], bash_cv_type_long_long='long long', bash_cv_type_long_long='long')])
481if test "$bash_cv_type_long_long" = 'long long'; then
482 AC_DEFINE(HAVE_LONG_LONG, 1)
483fi
484])
485
486AC_DEFUN(BASH_TYPE_UNSIGNED_LONG_LONG,
487[
488AC_CACHE_CHECK([for unsigned long long], bash_cv_type_unsigned_long_long,
489[AC_TRY_LINK([
490unsigned long long ull = 1; int i = 63;],
491[
492unsigned long long ullmax = (unsigned long long) -1;
493return ull << i | ull >> i | ullmax / ull | ullmax % ull;
494], bash_cv_type_unsigned_long_long='unsigned long long',
495 bash_cv_type_unsigned_long_long='unsigned long')])
496if test "$bash_cv_type_unsigned_long_long" = 'unsigned long long'; then
497 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1)
498fi
499])
500
501dnl
502dnl Type of struct rlimit fields: some systems (OSF/1, NetBSD, RISC/os 5.0)
503dnl have a rlim_t, others (4.4BSD based systems) use quad_t, others use
504dnl long and still others use int (HP-UX 9.01, SunOS 4.1.3). To simplify
505dnl matters, this just checks for rlim_t, quad_t, or long.
506dnl
507AC_DEFUN(BASH_TYPE_RLIMIT,
508[AC_MSG_CHECKING(for size and type of struct rlimit fields)
509AC_CACHE_VAL(bash_cv_type_rlimit,
510[AC_TRY_COMPILE([#include <sys/types.h>
511#include <sys/resource.h>],
512[rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[
513AC_TRY_RUN([
514#include <sys/types.h>
515#include <sys/time.h>
516#include <sys/resource.h>
517main()
518{
519#ifdef HAVE_QUAD_T
520 struct rlimit rl;
521 if (sizeof(rl.rlim_cur) == sizeof(quad_t))
522 exit(0);
523#endif
524 exit(1);
525}], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long,
526 [AC_MSG_WARN(cannot check quad_t if cross compiling -- defaulting to long)
527 bash_cv_type_rlimit=long])])
528])
529AC_MSG_RESULT($bash_cv_type_rlimit)
530if test $bash_cv_type_rlimit = quad_t; then
531AC_DEFINE(RLIMTYPE, quad_t)
532elif test $bash_cv_type_rlimit = rlim_t; then
533AC_DEFINE(RLIMTYPE, rlim_t)
ccc6cda3
JA
534fi
535])
536
17345e5a
JA
537AC_DEFUN(BASH_TYPE_SIG_ATOMIC_T,
538[AC_CACHE_CHECK([for sig_atomic_t in signal.h], ac_cv_have_sig_atomic_t,
539[AC_TRY_LINK([
540#include <signal.h>
541],[ sig_atomic_t x; ],
542ac_cv_have_sig_atomic_t=yes, ac_cv_have_sig_atomic_t=no)])
543if test "$ac_cv_have_sig_atomic_t" = "no"
544then
545 AC_CHECK_TYPE(sig_atomic_t,int)
546fi
547])
548
ccc6cda3
JA
549AC_DEFUN(BASH_FUNC_LSTAT,
550[dnl Cannot use AC_CHECK_FUNCS(lstat) because Linux defines lstat() as an
551dnl inline function in <sys/stat.h>.
552AC_CACHE_CHECK([for lstat], bash_cv_func_lstat,
553[AC_TRY_LINK([
554#include <sys/types.h>
555#include <sys/stat.h>
cce855bc 556],[ lstat(".",(struct stat *)0); ],
ccc6cda3
JA
557bash_cv_func_lstat=yes, bash_cv_func_lstat=no)])
558if test $bash_cv_func_lstat = yes; then
559 AC_DEFINE(HAVE_LSTAT)
560fi
561])
562
bb70624e
JA
563AC_DEFUN(BASH_FUNC_INET_ATON,
564[
565AC_CACHE_CHECK([for inet_aton], bash_cv_func_inet_aton,
566[AC_TRY_LINK([
567#include <sys/types.h>
568#include <netinet/in.h>
569#include <arpa/inet.h>
570struct in_addr ap;], [ inet_aton("127.0.0.1", &ap); ],
571bash_cv_func_inet_aton=yes, bash_cv_func_inet_aton=no)])
572if test $bash_cv_func_inet_aton = yes; then
573 AC_DEFINE(HAVE_INET_ATON)
f73dda09
JA
574else
575 AC_LIBOBJ(inet_aton)
ccc6cda3
JA
576fi
577])
578
579AC_DEFUN(BASH_FUNC_GETENV,
580[AC_MSG_CHECKING(to see if getenv can be redefined)
581AC_CACHE_VAL(bash_cv_getenv_redef,
582[AC_TRY_RUN([
583#ifdef HAVE_UNISTD_H
584# include <unistd.h>
585#endif
586#ifndef __STDC__
587# ifndef const
588# define const
589# endif
590#endif
591char *
592getenv (name)
593#if defined (__linux__) || defined (__bsdi__) || defined (convex)
594 const char *name;
595#else
596 char const *name;
597#endif /* !__linux__ && !__bsdi__ && !convex */
598{
599return "42";
600}
601main()
602{
603char *s;
604/* The next allows this program to run, but does not allow bash to link
605 when it redefines getenv. I'm not really interested in figuring out
606 why not. */
607#if defined (NeXT)
608exit(1);
609#endif
610s = getenv("ABCDE");
611exit(s == 0); /* force optimizer to leave getenv in */
612}
613], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no,
b72432fd 614 [AC_MSG_WARN(cannot check getenv redefinition if cross compiling -- defaulting to yes)
cce855bc
JA
615 bash_cv_getenv_redef=yes]
616)])
ccc6cda3
JA
617AC_MSG_RESULT($bash_cv_getenv_redef)
618if test $bash_cv_getenv_redef = yes; then
619AC_DEFINE(CAN_REDEFINE_GETENV)
620fi
621])
622
7117c2d2
JA
623# We should check for putenv before calling this
624AC_DEFUN(BASH_FUNC_STD_PUTENV,
625[
626AC_REQUIRE([AC_HEADER_STDC])
627AC_REQUIRE([AC_C_PROTOTYPES])
628AC_CACHE_CHECK([for standard-conformant putenv declaration], bash_cv_std_putenv,
629[AC_TRY_LINK([
630#if STDC_HEADERS
631#include <stdlib.h>
632#include <stddef.h>
633#endif
634#ifndef __STDC__
635# ifndef const
636# define const
637# endif
638#endif
639#ifdef PROTOTYPES
640extern int putenv (char *);
641#else
642extern int putenv ();
643#endif
644],
645[return (putenv == 0);],
646bash_cv_std_putenv=yes, bash_cv_std_putenv=no
647)])
648if test $bash_cv_std_putenv = yes; then
649AC_DEFINE(HAVE_STD_PUTENV)
650fi
651])
652
653# We should check for unsetenv before calling this
654AC_DEFUN(BASH_FUNC_STD_UNSETENV,
655[
656AC_REQUIRE([AC_HEADER_STDC])
657AC_REQUIRE([AC_C_PROTOTYPES])
658AC_CACHE_CHECK([for standard-conformant unsetenv declaration], bash_cv_std_unsetenv,
659[AC_TRY_LINK([
660#if STDC_HEADERS
661#include <stdlib.h>
662#include <stddef.h>
663#endif
664#ifndef __STDC__
665# ifndef const
666# define const
667# endif
668#endif
669#ifdef PROTOTYPES
670extern int unsetenv (const char *);
671#else
672extern int unsetenv ();
673#endif
674],
675[return (unsetenv == 0);],
676bash_cv_std_unsetenv=yes, bash_cv_std_unsetenv=no
677)])
678if test $bash_cv_std_unsetenv = yes; then
679AC_DEFINE(HAVE_STD_UNSETENV)
680fi
681])
682
ccc6cda3
JA
683AC_DEFUN(BASH_FUNC_ULIMIT_MAXFDS,
684[AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize)
685AC_CACHE_VAL(bash_cv_ulimit_maxfds,
686[AC_TRY_RUN([
687main()
688{
689long maxfds = ulimit(4, 0L);
690exit (maxfds == -1L);
691}
cce855bc 692], bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
b72432fd 693 [AC_MSG_WARN(cannot check ulimit if cross compiling -- defaulting to no)
cce855bc
JA
694 bash_cv_ulimit_maxfds=no]
695)])
ccc6cda3
JA
696AC_MSG_RESULT($bash_cv_ulimit_maxfds)
697if test $bash_cv_ulimit_maxfds = yes; then
698AC_DEFINE(ULIMIT_MAXFDS)
699fi
700])
701
ccc6cda3 702AC_DEFUN(BASH_FUNC_GETCWD,
3185942a 703[AC_MSG_CHECKING([if getcwd() will dynamically allocate memory with 0 size])
b80f6443 704AC_CACHE_VAL(bash_cv_getcwd_malloc,
ccc6cda3
JA
705[AC_TRY_RUN([
706#include <stdio.h>
707#ifdef HAVE_UNISTD_H
708#include <unistd.h>
709#endif
710
ccc6cda3
JA
711main()
712{
b80f6443
JA
713 char *xpwd;
714 xpwd = getcwd(0, 0);
715 exit (xpwd == 0);
ccc6cda3 716}
b80f6443
JA
717], bash_cv_getcwd_malloc=yes, bash_cv_getcwd_malloc=no,
718 [AC_MSG_WARN(cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no)
719 bash_cv_getcwd_malloc=no]
cce855bc 720)])
b80f6443
JA
721AC_MSG_RESULT($bash_cv_getcwd_malloc)
722if test $bash_cv_getcwd_malloc = no; then
ccc6cda3 723AC_DEFINE(GETCWD_BROKEN)
f73dda09
JA
724AC_LIBOBJ(getcwd)
725fi
726])
727
728dnl
729dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every
730dnl system, we can't use AC_PREREQ
731dnl
732AC_DEFUN(BASH_FUNC_GETHOSTBYNAME,
733[if test "X$bash_cv_have_gethostbyname" = "X"; then
734_bash_needmsg=yes
735else
736AC_MSG_CHECKING(for gethostbyname in socket library)
737_bash_needmsg=
738fi
739AC_CACHE_VAL(bash_cv_have_gethostbyname,
740[AC_TRY_LINK([#include <netdb.h>],
741[ struct hostent *hp;
742 hp = gethostbyname("localhost");
743], bash_cv_have_gethostbyname=yes, bash_cv_have_gethostbyname=no)]
744)
745if test "X$_bash_needmsg" = Xyes; then
746 AC_MSG_CHECKING(for gethostbyname in socket library)
747fi
748AC_MSG_RESULT($bash_cv_have_gethostbyname)
749if test "$bash_cv_have_gethostbyname" = yes; then
750AC_DEFINE(HAVE_GETHOSTBYNAME)
751fi
752])
753
754AC_DEFUN(BASH_FUNC_FNMATCH_EXTMATCH,
755[AC_MSG_CHECKING(if fnmatch does extended pattern matching with FNM_EXTMATCH)
756AC_CACHE_VAL(bash_cv_fnm_extmatch,
757[AC_TRY_RUN([
758#include <fnmatch.h>
759
760main()
761{
762#ifdef FNM_EXTMATCH
763 exit (0);
764#else
765 exit (1);
766#endif
767}
768], bash_cv_fnm_extmatch=yes, bash_cv_fnm_extmatch=no,
769 [AC_MSG_WARN(cannot check FNM_EXTMATCH if cross compiling -- defaulting to no)
770 bash_cv_fnm_extmatch=no])
771])
772AC_MSG_RESULT($bash_cv_fnm_extmatch)
773if test $bash_cv_fnm_extmatch = yes; then
774AC_DEFINE(HAVE_LIBC_FNM_EXTMATCH)
775fi
776])
777
778AC_DEFUN(BASH_FUNC_POSIX_SETJMP,
779[AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
780AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp)
781AC_CACHE_VAL(bash_cv_func_sigsetjmp,
782[AC_TRY_RUN([
783#ifdef HAVE_UNISTD_H
784#include <unistd.h>
785#endif
786#include <sys/types.h>
787#include <signal.h>
788#include <setjmp.h>
789
790main()
791{
792#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
793exit (1);
794#else
795
796int code;
797sigset_t set, oset;
798sigjmp_buf xx;
799
800/* get the mask */
801sigemptyset(&set);
802sigemptyset(&oset);
803sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set);
804sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
805
806/* save it */
807code = sigsetjmp(xx, 1);
808if (code)
809 exit(0); /* could get sigmask and compare to oset here. */
810
811/* change it */
812sigaddset(&set, SIGINT);
813sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
814
815/* and siglongjmp */
816siglongjmp(xx, 10);
817exit(1);
818#endif
819}], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
820 [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing)
821 bash_cv_func_sigsetjmp=missing]
822)])
823AC_MSG_RESULT($bash_cv_func_sigsetjmp)
824if test $bash_cv_func_sigsetjmp = present; then
825AC_DEFINE(HAVE_POSIX_SIGSETJMP)
826fi
827])
828
829AC_DEFUN(BASH_FUNC_STRCOLL,
830[
831AC_MSG_CHECKING(whether or not strcoll and strcmp differ)
832AC_CACHE_VAL(bash_cv_func_strcoll_broken,
833[AC_TRY_RUN([
834#include <stdio.h>
835#if defined (HAVE_LOCALE_H)
836#include <locale.h>
837#endif
838
839main(c, v)
840int c;
841char *v[];
842{
843 int r1, r2;
844 char *deflocale, *defcoll;
845
846#ifdef HAVE_SETLOCALE
847 deflocale = setlocale(LC_ALL, "");
848 defcoll = setlocale(LC_COLLATE, "");
849#endif
850
851#ifdef HAVE_STRCOLL
852 /* These two values are taken from tests/glob-test. */
853 r1 = strcoll("abd", "aXd");
854#else
855 r1 = 0;
856#endif
857 r2 = strcmp("abd", "aXd");
858
859 /* These two should both be greater than 0. It is permissible for
860 a system to return different values, as long as the sign is the
861 same. */
862
863 /* Exit with 1 (failure) if these two values are both > 0, since
864 this tests whether strcoll(3) is broken with respect to strcmp(3)
865 in the default locale. */
866 exit (r1 > 0 && r2 > 0);
867}
868], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
869 [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no)
870 bash_cv_func_strcoll_broken=no]
871)])
872AC_MSG_RESULT($bash_cv_func_strcoll_broken)
873if test $bash_cv_func_strcoll_broken = yes; then
874AC_DEFINE(STRCOLL_BROKEN)
875fi
876])
877
878AC_DEFUN(BASH_FUNC_PRINTF_A_FORMAT,
879[AC_MSG_CHECKING([for printf floating point output in hex notation])
880AC_CACHE_VAL(bash_cv_printf_a_format,
881[AC_TRY_RUN([
882#include <stdio.h>
883#include <string.h>
884
885int
886main()
887{
888 double y = 0.0;
889 char abuf[1024];
890
891 sprintf(abuf, "%A", y);
892 exit(strchr(abuf, 'P') == (char *)0);
893}
894], bash_cv_printf_a_format=yes, bash_cv_printf_a_format=no,
895 [AC_MSG_WARN(cannot check printf if cross compiling -- defaulting to no)
896 bash_cv_printf_a_format=no]
897)])
898AC_MSG_RESULT($bash_cv_printf_a_format)
899if test $bash_cv_printf_a_format = yes; then
900AC_DEFINE(HAVE_PRINTF_A_FORMAT)
901fi
902])
903
904AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC,
905[
906AC_CHECK_MEMBER(struct termios.c_line, AC_DEFINE(TERMIOS_LDISC), ,[
907#include <sys/types.h>
908#include <termios.h>
909])
910])
911
912AC_DEFUN(BASH_STRUCT_TERMIO_LDISC,
913[
914AC_CHECK_MEMBER(struct termio.c_line, AC_DEFINE(TERMIO_LDISC), ,[
915#include <sys/types.h>
916#include <termio.h>
917])
918])
919
920dnl
921dnl Like AC_STRUCT_ST_BLOCKS, but doesn't muck with LIBOBJS
922dnl
923dnl sets bash_cv_struct_stat_st_blocks
924dnl
925dnl unused for now; we'll see how AC_CHECK_MEMBERS works
926dnl
927AC_DEFUN(BASH_STRUCT_ST_BLOCKS,
928[
929AC_MSG_CHECKING([for struct stat.st_blocks])
930AC_CACHE_VAL(bash_cv_struct_stat_st_blocks,
931[AC_TRY_COMPILE(
932[
933#include <sys/types.h>
934#include <sys/stat.h>
935],
936[
937main()
938{
939static struct stat a;
940if (a.st_blocks) return 0;
941return 0;
942}
943], bash_cv_struct_stat_st_blocks=yes, bash_cv_struct_stat_st_blocks=no)
944])
945AC_MSG_RESULT($bash_cv_struct_stat_st_blocks)
946if test "$bash_cv_struct_stat_st_blocks" = "yes"; then
947AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS)
948fi
949])
950
0628567a 951AC_DEFUN([BASH_CHECK_LIB_TERMCAP],
f73dda09
JA
952[
953if test "X$bash_cv_termcap_lib" = "X"; then
954_bash_needmsg=yes
955else
956AC_MSG_CHECKING(which library has the termcap functions)
957_bash_needmsg=
958fi
959AC_CACHE_VAL(bash_cv_termcap_lib,
b80f6443
JA
960[AC_CHECK_FUNC(tgetent, bash_cv_termcap_lib=libc,
961 [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
7117c2d2 962 [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo,
f73dda09
JA
963 [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
964 [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
b80f6443 965 bash_cv_termcap_lib=gnutermcap)])])])])])
f73dda09
JA
966if test "X$_bash_needmsg" = "Xyes"; then
967AC_MSG_CHECKING(which library has the termcap functions)
968fi
969AC_MSG_RESULT(using $bash_cv_termcap_lib)
970if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
971LDFLAGS="$LDFLAGS -L./lib/termcap"
972TERMCAP_LIB="./lib/termcap/libtermcap.a"
973TERMCAP_DEP="./lib/termcap/libtermcap.a"
974elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
975TERMCAP_LIB=-ltermcap
976TERMCAP_DEP=
977elif test $bash_cv_termcap_lib = libtinfo; then
978TERMCAP_LIB=-ltinfo
979TERMCAP_DEP=
980elif test $bash_cv_termcap_lib = libncurses; then
981TERMCAP_LIB=-lncurses
982TERMCAP_DEP=
b80f6443
JA
983elif test $bash_cv_termcap_lib = libc; then
984TERMCAP_LIB=
985TERMCAP_DEP=
f73dda09
JA
986else
987TERMCAP_LIB=-lcurses
988TERMCAP_DEP=
989fi
990])
991
992dnl
993dnl Check for the presence of getpeername in libsocket.
994dnl If libsocket is present, check for libnsl and add it to LIBS if
995dnl it's there, since most systems with libsocket require linking
996dnl with libnsl as well. This should only be called if getpeername
997dnl was not found in libc.
998dnl
999dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT
1000dnl AS WELL
1001dnl
1002AC_DEFUN(BASH_CHECK_LIB_SOCKET,
1003[
1004if test "X$bash_cv_have_socklib" = "X"; then
1005_bash_needmsg=
1006else
1007AC_MSG_CHECKING(for socket library)
1008_bash_needmsg=yes
1009fi
1010AC_CACHE_VAL(bash_cv_have_socklib,
1011[AC_CHECK_LIB(socket, getpeername,
1012 bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)])
1013if test "X$_bash_needmsg" = Xyes; then
1014 AC_MSG_RESULT($bash_cv_have_socklib)
1015 _bash_needmsg=
1016fi
1017if test $bash_cv_have_socklib = yes; then
1018 # check for libnsl, add it to LIBS if present
1019 if test "X$bash_cv_have_libnsl" = "X"; then
1020 _bash_needmsg=
1021 else
1022 AC_MSG_CHECKING(for libnsl)
1023 _bash_needmsg=yes
1024 fi
1025 AC_CACHE_VAL(bash_cv_have_libnsl,
1026 [AC_CHECK_LIB(nsl, t_open,
1027 bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)])
1028 if test "X$_bash_needmsg" = Xyes; then
1029 AC_MSG_RESULT($bash_cv_have_libnsl)
1030 _bash_needmsg=
1031 fi
1032 if test $bash_cv_have_libnsl = yes; then
1033 LIBS="-lsocket -lnsl $LIBS"
1034 else
1035 LIBS="-lsocket $LIBS"
1036 fi
1037 AC_DEFINE(HAVE_LIBSOCKET)
1038 AC_DEFINE(HAVE_GETPEERNAME)
ccc6cda3
JA
1039fi
1040])
1041
1042AC_DEFUN(BASH_STRUCT_DIRENT_D_INO,
1043[AC_REQUIRE([AC_HEADER_DIRENT])
b80f6443 1044AC_MSG_CHECKING(for struct dirent.d_ino)
ccc6cda3
JA
1045AC_CACHE_VAL(bash_cv_dirent_has_dino,
1046[AC_TRY_COMPILE([
1047#include <stdio.h>
1048#include <sys/types.h>
1049#ifdef HAVE_UNISTD_H
1050# include <unistd.h>
1051#endif /* HAVE_UNISTD_H */
1052#if defined(HAVE_DIRENT_H)
1053# include <dirent.h>
1054#else
1055# define dirent direct
1056# ifdef HAVE_SYS_NDIR_H
1057# include <sys/ndir.h>
1058# endif /* SYSNDIR */
1059# ifdef HAVE_SYS_DIR_H
1060# include <sys/dir.h>
1061# endif /* SYSDIR */
1062# ifdef HAVE_NDIR_H
1063# include <ndir.h>
1064# endif
1065#endif /* HAVE_DIRENT_H */
1066],[
1067struct dirent d; int z; z = d.d_ino;
1068], bash_cv_dirent_has_dino=yes, bash_cv_dirent_has_dino=no)])
1069AC_MSG_RESULT($bash_cv_dirent_has_dino)
1070if test $bash_cv_dirent_has_dino = yes; then
b80f6443 1071AC_DEFINE(HAVE_STRUCT_DIRENT_D_INO)
ccc6cda3
JA
1072fi
1073])
1074
d166f048
JA
1075AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO,
1076[AC_REQUIRE([AC_HEADER_DIRENT])
b80f6443 1077AC_MSG_CHECKING(for struct dirent.d_fileno)
d166f048
JA
1078AC_CACHE_VAL(bash_cv_dirent_has_d_fileno,
1079[AC_TRY_COMPILE([
1080#include <stdio.h>
1081#include <sys/types.h>
1082#ifdef HAVE_UNISTD_H
1083# include <unistd.h>
1084#endif /* HAVE_UNISTD_H */
1085#if defined(HAVE_DIRENT_H)
1086# include <dirent.h>
1087#else
1088# define dirent direct
1089# ifdef HAVE_SYS_NDIR_H
1090# include <sys/ndir.h>
1091# endif /* SYSNDIR */
1092# ifdef HAVE_SYS_DIR_H
1093# include <sys/dir.h>
1094# endif /* SYSDIR */
1095# ifdef HAVE_NDIR_H
1096# include <ndir.h>
1097# endif
1098#endif /* HAVE_DIRENT_H */
1099],[
1100struct dirent d; int z; z = d.d_fileno;
1101], bash_cv_dirent_has_d_fileno=yes, bash_cv_dirent_has_d_fileno=no)])
1102AC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
1103if test $bash_cv_dirent_has_d_fileno = yes; then
b80f6443
JA
1104AC_DEFINE(HAVE_STRUCT_DIRENT_D_FILENO)
1105fi
1106])
1107
1108AC_DEFUN(BASH_STRUCT_DIRENT_D_NAMLEN,
1109[AC_REQUIRE([AC_HEADER_DIRENT])
1110AC_MSG_CHECKING(for struct dirent.d_namlen)
1111AC_CACHE_VAL(bash_cv_dirent_has_d_namlen,
1112[AC_TRY_COMPILE([
1113#include <stdio.h>
1114#include <sys/types.h>
1115#ifdef HAVE_UNISTD_H
1116# include <unistd.h>
1117#endif /* HAVE_UNISTD_H */
1118#if defined(HAVE_DIRENT_H)
1119# include <dirent.h>
1120#else
1121# define dirent direct
1122# ifdef HAVE_SYS_NDIR_H
1123# include <sys/ndir.h>
1124# endif /* SYSNDIR */
1125# ifdef HAVE_SYS_DIR_H
1126# include <sys/dir.h>
1127# endif /* SYSDIR */
1128# ifdef HAVE_NDIR_H
1129# include <ndir.h>
1130# endif
1131#endif /* HAVE_DIRENT_H */
1132],[
1133struct dirent d; int z; z = d.d_namlen;
1134], bash_cv_dirent_has_d_namlen=yes, bash_cv_dirent_has_d_namlen=no)])
1135AC_MSG_RESULT($bash_cv_dirent_has_d_namlen)
1136if test $bash_cv_dirent_has_d_namlen = yes; then
1137AC_DEFINE(HAVE_STRUCT_DIRENT_D_NAMLEN)
d166f048
JA
1138fi
1139])
1140
f73dda09
JA
1141AC_DEFUN(BASH_STRUCT_TIMEVAL,
1142[AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
1143AC_CACHE_VAL(bash_cv_struct_timeval,
1144[
1145AC_EGREP_HEADER(struct timeval, sys/time.h,
1146 bash_cv_struct_timeval=yes,
1147 AC_EGREP_HEADER(struct timeval, time.h,
1148 bash_cv_struct_timeval=yes,
1149 bash_cv_struct_timeval=no))
1150])
1151AC_MSG_RESULT($bash_cv_struct_timeval)
1152if test $bash_cv_struct_timeval = yes; then
1153 AC_DEFINE(HAVE_TIMEVAL)
1154fi
1155])
1156
b80f6443
JA
1157AC_DEFUN(BASH_STRUCT_TIMEZONE,
1158[AC_MSG_CHECKING(for struct timezone in sys/time.h and time.h)
1159AC_CACHE_VAL(bash_cv_struct_timezone,
1160[
1161AC_EGREP_HEADER(struct timezone, sys/time.h,
1162 bash_cv_struct_timezone=yes,
1163 AC_EGREP_HEADER(struct timezone, time.h,
1164 bash_cv_struct_timezone=yes,
1165 bash_cv_struct_timezone=no))
1166])
1167AC_MSG_RESULT($bash_cv_struct_timezone)
1168if test $bash_cv_struct_timezone = yes; then
1169 AC_DEFINE(HAVE_STRUCT_TIMEZONE)
1170fi
1171])
1172
f73dda09
JA
1173AC_DEFUN(BASH_STRUCT_WINSIZE,
1174[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h)
1175AC_CACHE_VAL(bash_cv_struct_winsize_header,
1176[AC_TRY_COMPILE([#include <sys/types.h>
1177#include <sys/ioctl.h>], [struct winsize x;],
1178 bash_cv_struct_winsize_header=ioctl_h,
1179 [AC_TRY_COMPILE([#include <sys/types.h>
1180#include <termios.h>], [struct winsize x;],
1181 bash_cv_struct_winsize_header=termios_h, bash_cv_struct_winsize_header=other)
1182])])
1183if test $bash_cv_struct_winsize_header = ioctl_h; then
1184 AC_MSG_RESULT(sys/ioctl.h)
1185 AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
1186elif test $bash_cv_struct_winsize_header = termios_h; then
1187 AC_MSG_RESULT(termios.h)
1188 AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS)
1189else
1190 AC_MSG_RESULT(not found)
1191fi
1192])
1193
1194dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
1195AC_DEFUN(BASH_SYS_SIGNAL_VINTAGE,
1196[AC_REQUIRE([AC_TYPE_SIGNAL])
1197AC_MSG_CHECKING(for type of signal functions)
1198AC_CACHE_VAL(bash_cv_signal_vintage,
1199[
1200 AC_TRY_LINK([#include <signal.h>],[
1201 sigset_t ss;
1202 struct sigaction sa;
1203 sigemptyset(&ss); sigsuspend(&ss);
1204 sigaction(SIGINT, &sa, (struct sigaction *) 0);
1205 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
1206 ], bash_cv_signal_vintage=posix,
1207 [
1208 AC_TRY_LINK([#include <signal.h>], [
1209 int mask = sigmask(SIGINT);
1210 sigsetmask(mask); sigblock(mask); sigpause(mask);
1211 ], bash_cv_signal_vintage=4.2bsd,
1212 [
1213 AC_TRY_LINK([
1214 #include <signal.h>
1215 RETSIGTYPE foo() { }], [
1216 int mask = sigmask(SIGINT);
1217 sigset(SIGINT, foo); sigrelse(SIGINT);
1218 sighold(SIGINT); sigpause(SIGINT);
1219 ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7
1220 )]
1221 )]
1222)
1223])
1224AC_MSG_RESULT($bash_cv_signal_vintage)
1225if test "$bash_cv_signal_vintage" = posix; then
1226AC_DEFINE(HAVE_POSIX_SIGNALS)
1227elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
1228AC_DEFINE(HAVE_BSD_SIGNALS)
1229elif test "$bash_cv_signal_vintage" = svr3; then
1230AC_DEFINE(HAVE_USG_SIGHOLD)
1231fi
1232])
1233
1234dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process.
1235AC_DEFUN(BASH_SYS_PGRP_SYNC,
1236[AC_REQUIRE([AC_FUNC_GETPGRP])
1237AC_MSG_CHECKING(whether pgrps need synchronization)
1238AC_CACHE_VAL(bash_cv_pgrp_pipe,
1239[AC_TRY_RUN([
1240#ifdef HAVE_UNISTD_H
1241# include <unistd.h>
1242#endif
1243main()
1244{
1245# ifdef GETPGRP_VOID
1246# define getpgID() getpgrp()
1247# else
1248# define getpgID() getpgrp(0)
1249# define setpgid(x,y) setpgrp(x,y)
1250# endif
1251 int pid1, pid2, fds[2];
1252 int status;
1253 char ok;
1254
1255 switch (pid1 = fork()) {
1256 case -1:
1257 exit(1);
1258 case 0:
1259 setpgid(0, getpid());
1260 exit(0);
1261 }
1262 setpgid(pid1, pid1);
1263
1264 sleep(2); /* let first child die */
1265
1266 if (pipe(fds) < 0)
1267 exit(2);
1268
1269 switch (pid2 = fork()) {
1270 case -1:
1271 exit(3);
1272 case 0:
1273 setpgid(0, pid1);
1274 ok = getpgID() == pid1;
1275 write(fds[1], &ok, 1);
1276 exit(0);
1277 }
1278 setpgid(pid2, pid1);
1279
1280 close(fds[1]);
1281 if (read(fds[0], &ok, 1) != 1)
1282 exit(4);
1283 wait(&status);
1284 wait(&status);
1285 exit(ok ? 0 : 5);
1286}
1287], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
1288 [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
1289 bash_cv_pgrp_pipe=no])
1290])
1291AC_MSG_RESULT($bash_cv_pgrp_pipe)
1292if test $bash_cv_pgrp_pipe = yes; then
1293AC_DEFINE(PGRP_PIPE)
1294fi
1295])
1296
1297AC_DEFUN(BASH_SYS_REINSTALL_SIGHANDLERS,
ccc6cda3 1298[AC_REQUIRE([AC_TYPE_SIGNAL])
f73dda09 1299AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
ccc6cda3
JA
1300AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
1301AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
1302[AC_TRY_RUN([
1303#include <signal.h>
1304#ifdef HAVE_UNISTD_H
1305#include <unistd.h>
1306#endif
1307
1308typedef RETSIGTYPE sigfunc();
1309
1310int nsigint;
1311
1312#ifdef HAVE_POSIX_SIGNALS
1313sigfunc *
1314set_signal_handler(sig, handler)
1315 int sig;
1316 sigfunc *handler;
1317{
1318 struct sigaction act, oact;
1319 act.sa_handler = handler;
1320 act.sa_flags = 0;
1321 sigemptyset (&act.sa_mask);
1322 sigemptyset (&oact.sa_mask);
1323 sigaction (sig, &act, &oact);
1324 return (oact.sa_handler);
1325}
1326#else
1327#define set_signal_handler(s, h) signal(s, h)
1328#endif
1329
1330RETSIGTYPE
1331sigint(s)
1332int s;
1333{
1334 nsigint++;
1335}
1336
1337main()
1338{
1339 nsigint = 0;
1340 set_signal_handler(SIGINT, sigint);
1341 kill((int)getpid(), SIGINT);
1342 kill((int)getpid(), SIGINT);
1343 exit(nsigint != 2);
1344}
1345], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
b72432fd 1346 [AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting to no)
cce855bc
JA
1347 bash_cv_must_reinstall_sighandlers=no]
1348)])
ccc6cda3
JA
1349AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
1350if test $bash_cv_must_reinstall_sighandlers = yes; then
1351AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
1352fi
1353])
1354
ccc6cda3 1355dnl check that some necessary job control definitions are present
f73dda09
JA
1356AC_DEFUN(BASH_SYS_JOB_CONTROL_MISSING,
1357[AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
ccc6cda3
JA
1358AC_MSG_CHECKING(for presence of necessary job control definitions)
1359AC_CACHE_VAL(bash_cv_job_control_missing,
1360[AC_TRY_RUN([
1361#include <sys/types.h>
1362#ifdef HAVE_SYS_WAIT_H
1363#include <sys/wait.h>
1364#endif
1365#ifdef HAVE_UNISTD_H
1366#include <unistd.h>
1367#endif
1368#include <signal.h>
1369
1370/* Add more tests in here as appropriate. */
1371main()
1372{
1373/* signal type */
1374#if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS)
1375exit(1);
1376#endif
1377
1378/* signals and tty control. */
1379#if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT)
1380exit (1);
1381#endif
1382
1383/* process control */
1384#if !defined (WNOHANG) || !defined (WUNTRACED)
1385exit(1);
1386#endif
1387
1388/* Posix systems have tcgetpgrp and waitpid. */
1389#if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP)
1390exit(1);
1391#endif
1392
1393#if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID)
1394exit(1);
1395#endif
1396
1397/* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */
1398#if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3)
1399exit(1);
1400#endif
1401
1402exit(0);
cce855bc 1403}], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
b72432fd 1404 [AC_MSG_WARN(cannot check job control if cross-compiling -- defaulting to missing)
cce855bc
JA
1405 bash_cv_job_control_missing=missing]
1406)])
ccc6cda3
JA
1407AC_MSG_RESULT($bash_cv_job_control_missing)
1408if test $bash_cv_job_control_missing = missing; then
1409AC_DEFINE(JOB_CONTROL_MISSING)
1410fi
1411])
1412
1413dnl check whether named pipes are present
1414dnl this requires a previous check for mkfifo, but that is awkward to specify
1415AC_DEFUN(BASH_SYS_NAMED_PIPES,
1416[AC_MSG_CHECKING(for presence of named pipes)
1417AC_CACHE_VAL(bash_cv_sys_named_pipes,
1418[AC_TRY_RUN([
1419#include <sys/types.h>
1420#include <sys/stat.h>
1421#ifdef HAVE_UNISTD_H
1422#include <unistd.h>
1423#endif
1424
1425/* Add more tests in here as appropriate. */
1426main()
1427{
bb70624e 1428int fd, err;
ccc6cda3
JA
1429
1430#if defined (HAVE_MKFIFO)
1431exit (0);
1432#endif
1433
1434#if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO))
1435exit (1);
1436#endif
1437
1438#if defined (NeXT)
1439exit (1);
1440#endif
3185942a 1441err = mkdir("bash-aclocal", 0700);
bb70624e
JA
1442if (err < 0) {
1443 perror ("mkdir");
1444 exit(1);
1445}
3185942a 1446fd = mknod ("bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
bb70624e 1447if (fd == -1) {
3185942a 1448 rmdir ("bash-aclocal");
ccc6cda3 1449 exit (1);
bb70624e 1450}
ccc6cda3 1451close(fd);
3185942a
JA
1452unlink ("bash-aclocal/sh-np-autoconf");
1453rmdir ("bash-aclocal");
ccc6cda3 1454exit(0);
cce855bc 1455}], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
b72432fd 1456 [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
cce855bc
JA
1457 bash_cv_sys_named_pipes=missing]
1458)])
ccc6cda3
JA
1459AC_MSG_RESULT($bash_cv_sys_named_pipes)
1460if test $bash_cv_sys_named_pipes = missing; then
1461AC_DEFINE(NAMED_PIPES_MISSING)
1462fi
1463])
1464
f73dda09
JA
1465AC_DEFUN(BASH_SYS_DEFAULT_MAIL_DIR,
1466[AC_MSG_CHECKING(for default mail directory)
1467AC_CACHE_VAL(bash_cv_mail_dir,
1468[if test -d /var/mail; then
1469 bash_cv_mail_dir=/var/mail
f73dda09
JA
1470 elif test -d /var/spool/mail; then
1471 bash_cv_mail_dir=/var/spool/mail
7117c2d2
JA
1472 elif test -d /usr/mail; then
1473 bash_cv_mail_dir=/usr/mail
f73dda09
JA
1474 elif test -d /usr/spool/mail; then
1475 bash_cv_mail_dir=/usr/spool/mail
1476 else
1477 bash_cv_mail_dir=unknown
1478 fi
1479])
1480AC_MSG_RESULT($bash_cv_mail_dir)
7117c2d2 1481AC_DEFINE_UNQUOTED(DEFAULT_MAIL_DIRECTORY, "$bash_cv_mail_dir")
ccc6cda3
JA
1482])
1483
1484AC_DEFUN(BASH_HAVE_TIOCGWINSZ,
1485[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
1486AC_CACHE_VAL(bash_cv_tiocgwinsz_in_ioctl,
1487[AC_TRY_COMPILE([#include <sys/types.h>
1488#include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
1489 bash_cv_tiocgwinsz_in_ioctl=yes,bash_cv_tiocgwinsz_in_ioctl=no)])
1490AC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl)
1491if test $bash_cv_tiocgwinsz_in_ioctl = yes; then
1492AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
1493fi
1494])
1495
1496AC_DEFUN(BASH_HAVE_TIOCSTAT,
1497[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
1498AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl,
1499[AC_TRY_COMPILE([#include <sys/types.h>
1500#include <sys/ioctl.h>], [int x = TIOCSTAT;],
1501 bash_cv_tiocstat_in_ioctl=yes,bash_cv_tiocstat_in_ioctl=no)])
1502AC_MSG_RESULT($bash_cv_tiocstat_in_ioctl)
1503if test $bash_cv_tiocstat_in_ioctl = yes; then
1504AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL)
1505fi
1506])
1507
1508AC_DEFUN(BASH_HAVE_FIONREAD,
1509[AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
1510AC_CACHE_VAL(bash_cv_fionread_in_ioctl,
1511[AC_TRY_COMPILE([#include <sys/types.h>
1512#include <sys/ioctl.h>], [int x = FIONREAD;],
1513 bash_cv_fionread_in_ioctl=yes,bash_cv_fionread_in_ioctl=no)])
1514AC_MSG_RESULT($bash_cv_fionread_in_ioctl)
1515if test $bash_cv_fionread_in_ioctl = yes; then
1516AC_DEFINE(FIONREAD_IN_SYS_IOCTL)
1517fi
1518])
1519
d166f048
JA
1520dnl
1521dnl See if speed_t is declared in <sys/types.h>. Some versions of linux
1522dnl require a definition of speed_t each time <termcap.h> is included,
1523dnl but you can only get speed_t if you include <termios.h> (on some
1524dnl versions) or <sys/types.h> (on others).
1525dnl
f73dda09 1526AC_DEFUN(BASH_CHECK_SPEED_T,
d166f048
JA
1527[AC_MSG_CHECKING(for speed_t in sys/types.h)
1528AC_CACHE_VAL(bash_cv_speed_t_in_sys_types,
1529[AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;],
1530 bash_cv_speed_t_in_sys_types=yes,bash_cv_speed_t_in_sys_types=no)])
1531AC_MSG_RESULT($bash_cv_speed_t_in_sys_types)
1532if test $bash_cv_speed_t_in_sys_types = yes; then
1533AC_DEFINE(SPEED_T_IN_SYS_TYPES)
1534fi
1535])
1536
ccc6cda3 1537AC_DEFUN(BASH_CHECK_GETPW_FUNCS,
28ef6c31
JA
1538[AC_MSG_CHECKING(whether getpw functions are declared in pwd.h)
1539AC_CACHE_VAL(bash_cv_getpw_declared,
1540[AC_EGREP_CPP(getpwuid,
1541[
1542#include <sys/types.h>
1543#ifdef HAVE_UNISTD_H
1544# include <unistd.h>
1545#endif
ccc6cda3 1546#include <pwd.h>
28ef6c31
JA
1547],
1548bash_cv_getpw_declared=yes,bash_cv_getpw_declared=no)])
1549AC_MSG_RESULT($bash_cv_getpw_declared)
1550if test $bash_cv_getpw_declared = yes; then
ccc6cda3
JA
1551AC_DEFINE(HAVE_GETPW_DECLS)
1552fi
1553])
1554
1555AC_DEFUN(BASH_CHECK_DEV_FD,
1556[AC_MSG_CHECKING(whether /dev/fd is available)
1557AC_CACHE_VAL(bash_cv_dev_fd,
0628567a 1558[bash_cv_dev_fd=""
3185942a 1559if test -d /dev/fd && (exec test -r /dev/fd/0 < /dev/null) ; then
95732b49 1560# check for systems like FreeBSD 5 that only provide /dev/fd/[012]
3185942a 1561 if (exec test -r /dev/fd/3 3</dev/null) ; then
95732b49
JA
1562 bash_cv_dev_fd=standard
1563 else
1564 bash_cv_dev_fd=absent
1565 fi
0628567a
JA
1566fi
1567if test -z "$bash_cv_dev_fd" ; then
3185942a 1568 if test -d /proc/self/fd && (exec test -r /proc/self/fd/0 < /dev/null) ; then
0628567a
JA
1569 bash_cv_dev_fd=whacky
1570 else
1571 bash_cv_dev_fd=absent
1572 fi
1573fi
ccc6cda3
JA
1574])
1575AC_MSG_RESULT($bash_cv_dev_fd)
1576if test $bash_cv_dev_fd = "standard"; then
1577 AC_DEFINE(HAVE_DEV_FD)
1578 AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/")
1579elif test $bash_cv_dev_fd = "whacky"; then
1580 AC_DEFINE(HAVE_DEV_FD)
1581 AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/")
1582fi
1583])
1584
bb70624e
JA
1585AC_DEFUN(BASH_CHECK_DEV_STDIN,
1586[AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
1587AC_CACHE_VAL(bash_cv_dev_stdin,
3185942a 1588[if test -d /dev/fd && (exec test -r /dev/stdin < /dev/null) ; then
bb70624e 1589 bash_cv_dev_stdin=present
3185942a 1590 elif test -d /proc/self/fd && (exec test -r /dev/stdin < /dev/null) ; then
bb70624e
JA
1591 bash_cv_dev_stdin=present
1592 else
1593 bash_cv_dev_stdin=absent
1594 fi
1595])
1596AC_MSG_RESULT($bash_cv_dev_stdin)
1597if test $bash_cv_dev_stdin = "present"; then
1598 AC_DEFINE(HAVE_DEV_STDIN)
1599fi
1600])
1601
ccc6cda3
JA
1602dnl
1603dnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions
1604dnl
f73dda09 1605AC_DEFUN(BASH_CHECK_KERNEL_RLIMIT,
ccc6cda3
JA
1606[AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines])
1607AC_CACHE_VAL(bash_cv_kernel_rlimit,
1608[AC_TRY_COMPILE([
1609#include <sys/types.h>
1610#include <sys/resource.h>
1611],
1612[
1613 int f;
1614 f = RLIMIT_DATA;
1615], bash_cv_kernel_rlimit=no,
cce855bc
JA
1616[AC_TRY_COMPILE([
1617#include <sys/types.h>
1618#define _KERNEL
1619#include <sys/resource.h>
1620#undef _KERNEL
1621],
1622[
ccc6cda3
JA
1623 int f;
1624 f = RLIMIT_DATA;
cce855bc 1625], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)]
ccc6cda3
JA
1626)])
1627AC_MSG_RESULT($bash_cv_kernel_rlimit)
1628if test $bash_cv_kernel_rlimit = yes; then
1629AC_DEFINE(RLIMIT_NEEDS_KERNEL)
1630fi
1631])
d166f048 1632
b72432fd
JA
1633dnl
1634dnl Check for 64-bit off_t -- used for malloc alignment
1635dnl
1636dnl C does not allow duplicate case labels, so the compile will fail if
1637dnl sizeof(off_t) is > 4.
1638dnl
1639AC_DEFUN(BASH_CHECK_OFF_T_64,
1640[AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64,
1641AC_TRY_COMPILE([
1642#ifdef HAVE_UNISTD_H
1643#include <unistd.h>
1644#endif
1645#include <sys/types.h>
1646],[
1647switch (0) case 0: case (sizeof (off_t) <= 4):;
1648], bash_cv_off_t_64=no, bash_cv_off_t_64=yes))
1649if test $bash_cv_off_t_64 = yes; then
1650 AC_DEFINE(HAVE_OFF_T_64)
1651fi])
bb70624e 1652
28ef6c31
JA
1653AC_DEFUN(BASH_CHECK_RTSIGS,
1654[AC_MSG_CHECKING(for unusable real-time signals due to large values)
1655AC_CACHE_VAL(bash_cv_unusable_rtsigs,
1656[AC_TRY_RUN([
1657#include <sys/types.h>
1658#include <signal.h>
1659
1660#ifndef NSIG
1661# define NSIG 64
1662#endif
1663
1664main ()
1665{
1666 int n_sigs = 2 * NSIG;
1667#ifdef SIGRTMIN
1668 int rtmin = SIGRTMIN;
1669#else
1670 int rtmin = 0;
1671#endif
1672
1673 exit(rtmin < n_sigs);
1674}], bash_cv_unusable_rtsigs=yes, bash_cv_unusable_rtsigs=no,
1675 [AC_MSG_WARN(cannot check real-time signals if cross compiling -- defaulting to yes)
1676 bash_cv_unusable_rtsigs=yes]
1677)])
1678AC_MSG_RESULT($bash_cv_unusable_rtsigs)
1679if test $bash_cv_unusable_rtsigs = yes; then
1680AC_DEFINE(UNUSABLE_RT_SIGNALS)
1681fi
1682])
f73dda09 1683
7117c2d2
JA
1684dnl
1685dnl check for availability of multibyte characters and functions
1686dnl
0628567a
JA
1687dnl geez, I wish I didn't have to check for all of this stuff separately
1688dnl
7117c2d2
JA
1689AC_DEFUN(BASH_CHECK_MULTIBYTE,
1690[
1691AC_CHECK_HEADERS(wctype.h)
1692AC_CHECK_HEADERS(wchar.h)
1693AC_CHECK_HEADERS(langinfo.h)
1694
b80f6443 1695AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))
0001803f 1696AC_CHECK_FUNC(mbscasecmp, AC_DEFINE(HAVE_MBSCMP))
3185942a 1697AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP))
495aee44 1698AC_CHECK_FUNC(mbsnrtowcs, AC_DEFINE(HAVE_MBSNRTOWCS))
3185942a 1699AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
0628567a 1700
495aee44 1701
0001803f
CR
1702AC_REPLACE_FUNCS(mbschr)
1703
0628567a
JA
1704AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB))
1705AC_CHECK_FUNC(wcscoll, AC_DEFINE(HAVE_WCSCOLL))
b80f6443 1706AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP))
0628567a
JA
1707AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
1708AC_CHECK_FUNC(wctype, AC_DEFINE(HAVE_WCTYPE))
7117c2d2 1709
495aee44
CR
1710AC_REPLACE_FUNCS(wcswidth)
1711
0628567a
JA
1712dnl checks for both mbrtowc and mbstate_t
1713AC_FUNC_MBRTOWC
1714if test $ac_cv_func_mbrtowc = yes; then
7117c2d2
JA
1715 AC_DEFINE(HAVE_MBSTATE_T)
1716fi
1717
0628567a
JA
1718AC_CHECK_FUNCS(iswlower iswupper towlower towupper iswctype)
1719
7117c2d2
JA
1720AC_CACHE_CHECK([for nl_langinfo and CODESET], bash_cv_langinfo_codeset,
1721[AC_TRY_LINK(
1722[#include <langinfo.h>],
1723[char* cs = nl_langinfo(CODESET);],
1724bash_cv_langinfo_codeset=yes, bash_cv_langinfo_codeset=no)])
1725if test $bash_cv_langinfo_codeset = yes; then
1726 AC_DEFINE(HAVE_LANGINFO_CODESET)
1727fi
1728
0628567a
JA
1729dnl check for wchar_t in <wchar.h>
1730AC_CACHE_CHECK([for wchar_t in wchar.h], bash_cv_type_wchar_t,
1731[AC_TRY_COMPILE(
1732[#include <wchar.h>
1733],
1734[
1735 wchar_t foo;
1736 foo = 0;
1737], bash_cv_type_wchar_t=yes, bash_cv_type_wchar_t=no)])
1738if test $bash_cv_type_wchar_t = yes; then
1739 AC_DEFINE(HAVE_WCHAR_T, 1, [systems should define this type here])
1740fi
1741
1742dnl check for wctype_t in <wctype.h>
1743AC_CACHE_CHECK([for wctype_t in wctype.h], bash_cv_type_wctype_t,
1744[AC_TRY_COMPILE(
1745[#include <wctype.h>],
1746[
1747 wctype_t foo;
1748 foo = 0;
1749], bash_cv_type_wctype_t=yes, bash_cv_type_wctype_t=no)])
1750if test $bash_cv_type_wctype_t = yes; then
1751 AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here])
1752fi
1753
1754dnl check for wint_t in <wctype.h>
1755AC_CACHE_CHECK([for wint_t in wctype.h], bash_cv_type_wint_t,
1756[AC_TRY_COMPILE(
1757[#include <wctype.h>],
1758[
1759 wint_t foo;
1760 foo = 0;
1761], bash_cv_type_wint_t=yes, bash_cv_type_wint_t=no)])
1762if test $bash_cv_type_wint_t = yes; then
1763 AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])
1764fi
1765
0001803f
CR
1766if test "$am_cv_func_iconv" = yes; then
1767 OLDLIBS="$LIBS"
1768 LIBS="$LIBS $LIBICONV"
1769 AC_CHECK_FUNCS(locale_charset)
1770 LIBS="$OLDLIBS"
1771fi
1772
7117c2d2
JA
1773])
1774
f73dda09
JA
1775dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
1776dnl require:
1777dnl AC_PROG_CC
1778dnl BASH_CHECK_LIB_TERMCAP
1779
0628567a 1780AC_DEFUN([RL_LIB_READLINE_VERSION],
f73dda09
JA
1781[
1782AC_REQUIRE([BASH_CHECK_LIB_TERMCAP])
1783
1784AC_MSG_CHECKING([version of installed readline library])
1785
1786# What a pain in the ass this is.
1787
1788# save cpp and ld options
1789_save_CFLAGS="$CFLAGS"
1790_save_LDFLAGS="$LDFLAGS"
1791_save_LIBS="$LIBS"
1792
1793# Don't set ac_cv_rl_prefix if the caller has already assigned a value. This
1794# allows the caller to do something like $_rl_prefix=$withval if the user
1795# specifies --with-installed-readline=PREFIX as an argument to configure
1796
1797if test -z "$ac_cv_rl_prefix"; then
1798test "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix}
1799fi
1800
1801eval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include
1802eval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib
1803
1804LIBS="$LIBS -lreadline ${TERMCAP_LIB}"
1805CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}"
1806LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}"
1807
b80f6443
JA
1808AC_CACHE_VAL(ac_cv_rl_version,
1809[AC_TRY_RUN([
f73dda09
JA
1810#include <stdio.h>
1811#include <readline/readline.h>
1812
95732b49
JA
1813extern int rl_gnu_readline_p;
1814
f73dda09
JA
1815main()
1816{
1817 FILE *fp;
1818 fp = fopen("conftest.rlv", "w");
95732b49
JA
1819 if (fp == 0)
1820 exit(1);
1821 if (rl_gnu_readline_p != 1)
1822 fprintf(fp, "0.0\n");
1823 else
1824 fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0");
f73dda09
JA
1825 fclose(fp);
1826 exit(0);
1827}
1828],
1829ac_cv_rl_version=`cat conftest.rlv`,
1830ac_cv_rl_version='0.0',
b80f6443 1831ac_cv_rl_version='4.2')])
f73dda09
JA
1832
1833CFLAGS="$_save_CFLAGS"
1834LDFLAGS="$_save_LDFLAGS"
1835LIBS="$_save_LIBS"
1836
1837RL_MAJOR=0
1838RL_MINOR=0
1839
1840# (
1841case "$ac_cv_rl_version" in
18422*|3*|4*|5*|6*|7*|8*|9*)
1843 RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'`
7117c2d2 1844 RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[[a-zA-Z]]*$::'`
f73dda09
JA
1845 ;;
1846esac
1847
1848# (((
1849case $RL_MAJOR in
1850[[0-9][0-9]]) _RL_MAJOR=$RL_MAJOR ;;
1851[[0-9]]) _RL_MAJOR=0$RL_MAJOR ;;
1852*) _RL_MAJOR=00 ;;
1853esac
1854
1855# (((
1856case $RL_MINOR in
1857[[0-9][0-9]]) _RL_MINOR=$RL_MINOR ;;
1858[[0-9]]) _RL_MINOR=0$RL_MINOR ;;
1859*) _RL_MINOR=00 ;;
1860esac
1861
1862RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}"
1863
1864# Readline versions greater than 4.2 have these defines in readline.h
1865
1866if test $ac_cv_rl_version = '0.0' ; then
1867 AC_MSG_WARN([Could not test version of installed readline library.])
1868elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then
1869 # set these for use by the caller
1870 RL_PREFIX=$ac_cv_rl_prefix
1871 RL_LIBDIR=$ac_cv_rl_libdir
1872 RL_INCLUDEDIR=$ac_cv_rl_includedir
1873 AC_MSG_RESULT($ac_cv_rl_version)
1874else
1875
1876AC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library])
1877AC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library])
1878AC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library])
1879
1880AC_SUBST(RL_VERSION)
1881AC_SUBST(RL_MAJOR)
1882AC_SUBST(RL_MINOR)
1883
1884# set these for use by the caller
1885RL_PREFIX=$ac_cv_rl_prefix
1886RL_LIBDIR=$ac_cv_rl_libdir
1887RL_INCLUDEDIR=$ac_cv_rl_includedir
1888
1889AC_MSG_RESULT($ac_cv_rl_version)
1890
1891fi
1892])
b80f6443
JA
1893
1894AC_DEFUN(BASH_FUNC_CTYPE_NONASCII,
1895[
1896AC_MSG_CHECKING(whether the ctype macros accept non-ascii characters)
1897AC_CACHE_VAL(bash_cv_func_ctype_nonascii,
1898[AC_TRY_RUN([
1899#ifdef HAVE_LOCALE_H
1900#include <locale.h>
1901#endif
1902#include <stdio.h>
1903#include <ctype.h>
1904
1905main(c, v)
1906int c;
1907char *v[];
1908{
1909 char *deflocale;
1910 unsigned char x;
1911 int r1, r2;
1912
1913#ifdef HAVE_SETLOCALE
1914 /* We take a shot here. If that locale is not known, try the
1915 system default. We try this one because '\342' (226) is
1916 known to be a printable character in that locale. */
1917 deflocale = setlocale(LC_ALL, "en_US.ISO8859-1");
1918 if (deflocale == 0)
1919 deflocale = setlocale(LC_ALL, "");
1920#endif
1921
1922 x = '\342';
1923 r1 = isprint(x);
1924 x -= 128;
1925 r2 = isprint(x);
1926 exit (r1 == 0 || r2 == 0);
1927}
1928], bash_cv_func_ctype_nonascii=yes, bash_cv_func_ctype_nonascii=no,
1929 [AC_MSG_WARN(cannot check ctype macros if cross compiling -- defaulting to no)
1930 bash_cv_func_ctype_nonascii=no]
1931)])
1932AC_MSG_RESULT($bash_cv_func_ctype_nonascii)
1933if test $bash_cv_func_ctype_nonascii = yes; then
1934AC_DEFINE(CTYPE_NON_ASCII)
1935fi
1936])
1937
95732b49
JA
1938AC_DEFUN(BASH_CHECK_WCONTINUED,
1939[
1940AC_MSG_CHECKING(whether WCONTINUED flag to waitpid is unavailable or available but broken)
1941AC_CACHE_VAL(bash_cv_wcontinued_broken,
1942[AC_TRY_RUN([
1943#include <sys/types.h>
1944#include <sys/wait.h>
1945#include <unistd.h>
1946#include <errno.h>
1947
1948#ifndef errno
1949extern int errno;
1950#endif
1951main()
1952{
1953 int x;
1954
1955 x = waitpid(-1, (int *)0, WNOHANG|WCONTINUED);
1956 if (x == -1 && errno == EINVAL)
1957 exit (1);
1958 else
1959 exit (0);
1960}
1961], bash_cv_wcontinued_broken=no,bash_cv_wcontinued_broken=yes,
1962 [AC_MSG_WARN(cannot check WCONTINUED if cross compiling -- defaulting to no)
1963 bash_cv_wcontinued_broken=no]
1964)])
1965AC_MSG_RESULT($bash_cv_wcontinued_broken)
1966if test $bash_cv_wcontinued_broken = yes; then
1967AC_DEFINE(WCONTINUED_BROKEN)
1968fi
1969])
1970
b80f6443
JA
1971dnl
1972dnl tests added for bashdb
1973dnl
1974
1975
1976AC_DEFUN([AM_PATH_LISPDIR],
1977 [AC_ARG_WITH(lispdir, AC_HELP_STRING([--with-lispdir], [override the default lisp directory]),
1978 [ lispdir="$withval"
1979 AC_MSG_CHECKING([where .elc files should go])
1980 AC_MSG_RESULT([$lispdir])],
1981 [
1982 # If set to t, that means we are running in a shell under Emacs.
1983 # If you have an Emacs named "t", then use the full path.
1984 test x"$EMACS" = xt && EMACS=
1985 AC_CHECK_PROGS(EMACS, emacs xemacs, no)
1986 if test $EMACS != "no"; then
1987 if test x${lispdir+set} != xset; then
1988 AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [dnl
1989 am_cv_lispdir=`$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' | sed -n -e 's,/$,,' -e '/.*\/lib\/\(x\?emacs\/site-lisp\)$/{s,,${libdir}/\1,;p;q;}' -e '/.*\/share\/\(x\?emacs\/site-lisp\)$/{s,,${datadir}/\1,;p;q;}'`
1990 if test -z "$am_cv_lispdir"; then
1991 am_cv_lispdir='${datadir}/emacs/site-lisp'
1992 fi
1993 ])
1994 lispdir="$am_cv_lispdir"
1995 fi
1996 fi
1997 ])
1998 AC_SUBST(lispdir)
1999])
2000
2001dnl
2002dnl tests added for gettext
2003dnl
2004# codeset.m4 serial AM1 (gettext-0.10.40)
2005dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2006dnl This file is free software, distributed under the terms of the GNU
2007dnl General Public License. As a special exception to the GNU General
2008dnl Public License, this file may be distributed as part of a program
2009dnl that contains a configuration script generated by Autoconf, under
2010dnl the same distribution terms as the rest of that program.
2011
2012dnl From Bruno Haible.
2013
2014AC_DEFUN([AM_LANGINFO_CODESET],
2015[
2016 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
2017 [AC_TRY_LINK([#include <langinfo.h>],
2018 [char* cs = nl_langinfo(CODESET);],
2019 am_cv_langinfo_codeset=yes,
2020 am_cv_langinfo_codeset=no)
2021 ])
2022 if test $am_cv_langinfo_codeset = yes; then
2023 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
2024 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
2025 fi
2026])
2027# gettext.m4 serial 20 (gettext-0.12)
2028dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
2029dnl This file is free software, distributed under the terms of the GNU
2030dnl General Public License. As a special exception to the GNU General
2031dnl Public License, this file may be distributed as part of a program
2032dnl that contains a configuration script generated by Autoconf, under
2033dnl the same distribution terms as the rest of that program.
2034dnl
2035dnl This file can can be used in projects which are not available under
2036dnl the GNU General Public License or the GNU Library General Public
2037dnl License but which still want to provide support for the GNU gettext
2038dnl functionality.
2039dnl Please note that the actual code of the GNU gettext library is covered
2040dnl by the GNU Library General Public License, and the rest of the GNU
2041dnl gettext package package is covered by the GNU General Public License.
2042dnl They are *not* in the public domain.
2043
2044dnl Authors:
2045dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
2046dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
2047
2048dnl Macro to add for using GNU gettext.
2049
2050dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
2051dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
2052dnl default (if it is not specified or empty) is 'no-libtool'.
2053dnl INTLSYMBOL should be 'external' for packages with no intl directory,
2054dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
2055dnl If INTLSYMBOL is 'use-libtool', then a libtool library
2056dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
2057dnl depending on --{enable,disable}-{shared,static} and on the presence of
2058dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
2059dnl $(top_builddir)/intl/libintl.a will be created.
2060dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
2061dnl implementations (in libc or libintl) without the ngettext() function
2062dnl will be ignored. If NEEDSYMBOL is specified and is
2063dnl 'need-formatstring-macros', then GNU gettext implementations that don't
2064dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
2065dnl INTLDIR is used to find the intl libraries. If empty,
2066dnl the value `$(top_builddir)/intl/' is used.
2067dnl
2068dnl The result of the configuration is one of three cases:
2069dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
2070dnl and used.
2071dnl Catalog format: GNU --> install in $(datadir)
2072dnl Catalog extension: .mo after installation, .gmo in source tree
2073dnl 2) GNU gettext has been found in the system's C library.
2074dnl Catalog format: GNU --> install in $(datadir)
2075dnl Catalog extension: .mo after installation, .gmo in source tree
2076dnl 3) No internationalization, always use English msgid.
2077dnl Catalog format: none
2078dnl Catalog extension: none
2079dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
2080dnl The use of .gmo is historical (it was needed to avoid overwriting the
2081dnl GNU format catalogs when building on a platform with an X/Open gettext),
2082dnl but we keep it in order not to force irrelevant filename changes on the
2083dnl maintainers.
2084dnl
2085AC_DEFUN([AM_GNU_GETTEXT],
2086[
2087 dnl Argument checking.
2088 ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
2089 [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
2090])])])])])
2091 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
2092 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
2093])])])])
2094 define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
2095 define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
2096
2097 AC_REQUIRE([AM_PO_SUBDIRS])dnl
2098 ifelse(gt_included_intl, yes, [
2099 AC_REQUIRE([AM_INTL_SUBDIR])dnl
2100 ])
2101
2102 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
2103 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2104 AC_REQUIRE([AC_LIB_RPATH])
2105
2106 dnl Sometimes libintl requires libiconv, so first search for libiconv.
2107 dnl Ideally we would do this search only after the
2108 dnl if test "$USE_NLS" = "yes"; then
2109 dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
2110 dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
2111 dnl the configure script would need to contain the same shell code
2112 dnl again, outside any 'if'. There are two solutions:
2113 dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
2114 dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
2115 dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
2116 dnl documented, we avoid it.
2117 ifelse(gt_included_intl, yes, , [
2118 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
2119 ])
2120
2121 dnl Set USE_NLS.
2122 AM_NLS
2123
2124 ifelse(gt_included_intl, yes, [
2125 BUILD_INCLUDED_LIBINTL=no
2126 USE_INCLUDED_LIBINTL=no
2127 ])
2128 LIBINTL=
2129 LTLIBINTL=
2130 POSUB=
2131
2132 dnl If we use NLS figure out what method
2133 if test "$USE_NLS" = "yes"; then
2134 gt_use_preinstalled_gnugettext=no
2135 ifelse(gt_included_intl, yes, [
2136 AC_MSG_CHECKING([whether included gettext is requested])
2137 AC_ARG_WITH(included-gettext,
2138 [ --with-included-gettext use the GNU gettext library included here],
2139 nls_cv_force_use_gnu_gettext=$withval,
2140 nls_cv_force_use_gnu_gettext=no)
2141 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2142
2143 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2144 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2145 ])
2146 dnl User does not insist on using GNU NLS library. Figure out what
2147 dnl to use. If GNU gettext is available we use this. Else we have
2148 dnl to fall back to GNU NLS library.
2149
2150 dnl Add a version number to the cache macros.
2151 define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
2152 define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
2153 define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
2154
2155 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
2156 [AC_TRY_LINK([#include <libintl.h>
2157]ifelse([$2], [need-formatstring-macros],
2158[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2159#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2160#endif
2161changequote(,)dnl
2162typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2163changequote([,])dnl
2164], [])[extern int _nl_msg_cat_cntr;
2165extern int *_nl_domain_bindings;],
2166 [bindtextdomain ("", "");
2167return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
2168 gt_cv_func_gnugettext_libc=yes,
2169 gt_cv_func_gnugettext_libc=no)])
2170
2171 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
2172 dnl Sometimes libintl requires libiconv, so first search for libiconv.
2173 ifelse(gt_included_intl, yes, , [
2174 AM_ICONV_LINK
2175 ])
2176 dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
2177 dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
2178 dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
2179 dnl even if libiconv doesn't exist.
2180 AC_LIB_LINKFLAGS_BODY([intl])
2181 AC_CACHE_CHECK([for GNU gettext in libintl],
2182 gt_cv_func_gnugettext_libintl,
2183 [gt_save_CPPFLAGS="$CPPFLAGS"
2184 CPPFLAGS="$CPPFLAGS $INCINTL"
2185 gt_save_LIBS="$LIBS"
2186 LIBS="$LIBS $LIBINTL"
2187 dnl Now see whether libintl exists and does not depend on libiconv.
2188 AC_TRY_LINK([#include <libintl.h>
2189]ifelse([$2], [need-formatstring-macros],
2190[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2191#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2192#endif
2193changequote(,)dnl
2194typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2195changequote([,])dnl
2196], [])[extern int _nl_msg_cat_cntr;
2197extern
2198#ifdef __cplusplus
2199"C"
2200#endif
2201const char *_nl_expand_alias ();],
2202 [bindtextdomain ("", "");
2203return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
2204 gt_cv_func_gnugettext_libintl=yes,
2205 gt_cv_func_gnugettext_libintl=no)
2206 dnl Now see whether libintl exists and depends on libiconv.
2207 if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
2208 LIBS="$LIBS $LIBICONV"
2209 AC_TRY_LINK([#include <libintl.h>
2210]ifelse([$2], [need-formatstring-macros],
2211[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2212#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2213#endif
2214changequote(,)dnl
2215typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2216changequote([,])dnl
2217], [])[extern int _nl_msg_cat_cntr;
2218extern
2219#ifdef __cplusplus
2220"C"
2221#endif
2222const char *_nl_expand_alias ();],
2223 [bindtextdomain ("", "");
2224return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
2225 [LIBINTL="$LIBINTL $LIBICONV"
2226 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
2227 gt_cv_func_gnugettext_libintl=yes
2228 ])
2229 fi
2230 CPPFLAGS="$gt_save_CPPFLAGS"
2231 LIBS="$gt_save_LIBS"])
2232 fi
2233
2234 dnl If an already present or preinstalled GNU gettext() is found,
2235 dnl use it. But if this macro is used in GNU gettext, and GNU
2236 dnl gettext is already preinstalled in libintl, we update this
2237 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
2238 if test "$gt_cv_func_gnugettext_libc" = "yes" \
2239 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
2240 && test "$PACKAGE" != gettext-runtime \
2241 && test "$PACKAGE" != gettext-tools; }; then
2242 gt_use_preinstalled_gnugettext=yes
2243 else
2244 dnl Reset the values set by searching for libintl.
2245 LIBINTL=
2246 LTLIBINTL=
2247 INCINTL=
2248 fi
2249
2250 ifelse(gt_included_intl, yes, [
2251 if test "$gt_use_preinstalled_gnugettext" != "yes"; then
2252 dnl GNU gettext is not found in the C library.
2253 dnl Fall back on included GNU gettext library.
2254 nls_cv_use_gnu_gettext=yes
2255 fi
2256 fi
2257
2258 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2259 dnl Mark actions used to generate GNU NLS library.
2260 BUILD_INCLUDED_LIBINTL=yes
2261 USE_INCLUDED_LIBINTL=yes
2262 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
2263 LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
2264 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
2265 fi
2266
2267 if test "$gt_use_preinstalled_gnugettext" = "yes" \
2268 || test "$nls_cv_use_gnu_gettext" = "yes"; then
2269 dnl Mark actions to use GNU gettext tools.
2270 CATOBJEXT=.gmo
2271 fi
2272 ])
2273
2274 if test "$gt_use_preinstalled_gnugettext" = "yes" \
2275 || test "$nls_cv_use_gnu_gettext" = "yes"; then
2276 AC_DEFINE(ENABLE_NLS, 1,
2277 [Define to 1 if translation of program messages to the user's native language
2278 is requested.])
2279 else
2280 USE_NLS=no
2281 fi
2282 fi
2283
2284 AC_MSG_CHECKING([whether to use NLS])
2285 AC_MSG_RESULT([$USE_NLS])
2286 if test "$USE_NLS" = "yes"; then
2287 AC_MSG_CHECKING([where the gettext function comes from])
2288 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
2289 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2290 gt_source="external libintl"
2291 else
2292 gt_source="libc"
2293 fi
2294 else
2295 gt_source="included intl directory"
2296 fi
2297 AC_MSG_RESULT([$gt_source])
2298 fi
2299
2300 if test "$USE_NLS" = "yes"; then
2301
2302 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
2303 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2304 AC_MSG_CHECKING([how to link with libintl])
2305 AC_MSG_RESULT([$LIBINTL])
2306 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
2307 fi
2308
2309 dnl For backward compatibility. Some packages may be using this.
2310 AC_DEFINE(HAVE_GETTEXT, 1,
2311 [Define if the GNU gettext() function is already present or preinstalled.])
2312 AC_DEFINE(HAVE_DCGETTEXT, 1,
2313 [Define if the GNU dcgettext() function is already present or preinstalled.])
2314 fi
2315
2316 dnl We need to process the po/ directory.
2317 POSUB=po
2318 fi
2319
2320 ifelse(gt_included_intl, yes, [
2321 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
2322 dnl to 'yes' because some of the testsuite requires it.
2323 if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
2324 BUILD_INCLUDED_LIBINTL=yes
2325 fi
2326
2327 dnl Make all variables we use known to autoconf.
2328 AC_SUBST(BUILD_INCLUDED_LIBINTL)
2329 AC_SUBST(USE_INCLUDED_LIBINTL)
2330 AC_SUBST(CATOBJEXT)
2331
2332 dnl For backward compatibility. Some configure.ins may be using this.
2333 nls_cv_header_intl=
2334 nls_cv_header_libgt=
2335
2336 dnl For backward compatibility. Some Makefiles may be using this.
2337 DATADIRNAME=share
2338 AC_SUBST(DATADIRNAME)
2339
2340 dnl For backward compatibility. Some Makefiles may be using this.
2341 INSTOBJEXT=.mo
2342 AC_SUBST(INSTOBJEXT)
2343
2344 dnl For backward compatibility. Some Makefiles may be using this.
2345 GENCAT=gencat
2346 AC_SUBST(GENCAT)
2347
2348 dnl For backward compatibility. Some Makefiles may be using this.
2349 if test "$USE_INCLUDED_LIBINTL" = yes; then
2350 INTLOBJS="\$(GETTOBJS)"
2351 fi
2352 AC_SUBST(INTLOBJS)
2353
2354 dnl Enable libtool support if the surrounding package wishes it.
2355 INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
2356 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
2357 ])
2358
2359 dnl For backward compatibility. Some Makefiles may be using this.
2360 INTLLIBS="$LIBINTL"
2361 AC_SUBST(INTLLIBS)
2362
2363 dnl Make all documented variables known to autoconf.
2364 AC_SUBST(LIBINTL)
2365 AC_SUBST(LTLIBINTL)
2366 AC_SUBST(POSUB)
2367])
2368
2369
2370dnl Checks for all prerequisites of the intl subdirectory,
2371dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
2372dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
2373AC_DEFUN([AM_INTL_SUBDIR],
2374[
2375 AC_REQUIRE([AC_PROG_INSTALL])dnl
2376 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
2377 AC_REQUIRE([AC_PROG_CC])dnl
2378 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2379 AC_REQUIRE([AC_PROG_RANLIB])dnl
2380 AC_REQUIRE([AC_ISC_POSIX])dnl
2381 AC_REQUIRE([AC_HEADER_STDC])dnl
2382 AC_REQUIRE([AC_C_CONST])dnl
2383 AC_REQUIRE([AC_C_INLINE])dnl
2384 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2385 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2386 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2387 AC_REQUIRE([AC_FUNC_MMAP])dnl
2388 AC_REQUIRE([jm_GLIBC21])dnl
2389 AC_REQUIRE([gt_INTDIV0])dnl
2390 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
2391 AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
2392 AC_REQUIRE([gt_INTTYPES_PRI])dnl
2393
2394 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
2395stdlib.h string.h unistd.h sys/param.h])
2396 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
3185942a 2397geteuid getgid getuid mempcpy munmap putenv setenv setlocale localeconv stpcpy \
b80f6443
JA
2398strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
2399__fsetlocking])
2400
2401 AM_ICONV
2402 AM_LANGINFO_CODESET
2403 if test $ac_cv_header_locale_h = yes; then
2404 AM_LC_MESSAGES
2405 fi
2406
2407 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
2408 dnl because plural.y uses bison specific features. It requires at least
2409 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
2410 dnl compile.
2411 dnl bison is only needed for the maintainer (who touches plural.y). But in
2412 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
2413 dnl the rule in general Makefile. Now, some people carelessly touch the
2414 dnl files or have a broken "make" program, hence the plural.c rule will
2415 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
2416 dnl present or too old.
2417 AC_CHECK_PROGS([INTLBISON], [bison])
2418 if test -z "$INTLBISON"; then
2419 ac_verc_fail=yes
2420 else
2421 dnl Found it, now check the version.
2422 AC_MSG_CHECKING([version of bison])
2423changequote(<<,>>)dnl
2424 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
2425 case $ac_prog_version in
2426 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2427 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
2428changequote([,])dnl
2429 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
2430 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
2431 esac
2432 AC_MSG_RESULT([$ac_prog_version])
2433 fi
2434 if test $ac_verc_fail = yes; then
2435 INTLBISON=:
2436 fi
2437])
2438
2439
2440dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
2441AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
2442# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
2443dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2444dnl This file is free software, distributed under the terms of the GNU
2445dnl General Public License. As a special exception to the GNU General
2446dnl Public License, this file may be distributed as part of a program
2447dnl that contains a configuration script generated by Autoconf, under
2448dnl the same distribution terms as the rest of that program.
2449
2450# Test for the GNU C Library, version 2.1 or newer.
2451# From Bruno Haible.
2452
2453AC_DEFUN([jm_GLIBC21],
2454 [
2455 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
2456 ac_cv_gnu_library_2_1,
2457 [AC_EGREP_CPP([Lucky GNU user],
2458 [
2459#include <features.h>
2460#ifdef __GNU_LIBRARY__
2461 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
2462 Lucky GNU user
2463 #endif
2464#endif
2465 ],
2466 ac_cv_gnu_library_2_1=yes,
2467 ac_cv_gnu_library_2_1=no)
2468 ]
2469 )
2470 AC_SUBST(GLIBC21)
2471 GLIBC21="$ac_cv_gnu_library_2_1"
2472 ]
2473)
2474# iconv.m4 serial AM4 (gettext-0.11.3)
2475dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2476dnl This file is free software, distributed under the terms of the GNU
2477dnl General Public License. As a special exception to the GNU General
2478dnl Public License, this file may be distributed as part of a program
2479dnl that contains a configuration script generated by Autoconf, under
2480dnl the same distribution terms as the rest of that program.
2481
2482dnl From Bruno Haible.
2483
2484AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
2485[
2486 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
2487 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2488 AC_REQUIRE([AC_LIB_RPATH])
2489
2490 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2491 dnl accordingly.
2492 AC_LIB_LINKFLAGS_BODY([iconv])
2493])
2494
2495AC_DEFUN([AM_ICONV_LINK],
2496[
2497 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
2498 dnl those with the standalone portable GNU libiconv installed).
2499
2500 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2501 dnl accordingly.
2502 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
2503
2504 dnl Add $INCICONV to CPPFLAGS before performing the following checks,
2505 dnl because if the user has installed libiconv and not disabled its use
2506 dnl via --without-libiconv-prefix, he wants to use it. The first
2507 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
2508 am_save_CPPFLAGS="$CPPFLAGS"
2509 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
2510
2511 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
2512 am_cv_func_iconv="no, consider installing GNU libiconv"
2513 am_cv_lib_iconv=no
2514 AC_TRY_LINK([#include <stdlib.h>
2515#include <iconv.h>],
2516 [iconv_t cd = iconv_open("","");
2517 iconv(cd,NULL,NULL,NULL,NULL);
2518 iconv_close(cd);],
2519 am_cv_func_iconv=yes)
2520 if test "$am_cv_func_iconv" != yes; then
2521 am_save_LIBS="$LIBS"
2522 LIBS="$LIBS $LIBICONV"
2523 AC_TRY_LINK([#include <stdlib.h>
2524#include <iconv.h>],
2525 [iconv_t cd = iconv_open("","");
2526 iconv(cd,NULL,NULL,NULL,NULL);
2527 iconv_close(cd);],
2528 am_cv_lib_iconv=yes
2529 am_cv_func_iconv=yes)
2530 LIBS="$am_save_LIBS"
2531 fi
2532 ])
2533 if test "$am_cv_func_iconv" = yes; then
2534 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2535 fi
2536 if test "$am_cv_lib_iconv" = yes; then
2537 AC_MSG_CHECKING([how to link with libiconv])
2538 AC_MSG_RESULT([$LIBICONV])
2539 else
2540 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
2541 dnl either.
2542 CPPFLAGS="$am_save_CPPFLAGS"
2543 LIBICONV=
2544 LTLIBICONV=
2545 fi
2546 AC_SUBST(LIBICONV)
2547 AC_SUBST(LTLIBICONV)
2548])
2549
2550AC_DEFUN([AM_ICONV],
2551[
2552 AM_ICONV_LINK
2553 if test "$am_cv_func_iconv" = yes; then
2554 AC_MSG_CHECKING([for iconv declaration])
2555 AC_CACHE_VAL(am_cv_proto_iconv, [
2556 AC_TRY_COMPILE([
2557#include <stdlib.h>
2558#include <iconv.h>
2559extern
2560#ifdef __cplusplus
2561"C"
2562#endif
2563#if defined(__STDC__) || defined(__cplusplus)
2564size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
2565#else
2566size_t iconv();
2567#endif
2568], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
2569 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);"])
2570 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
2571 AC_MSG_RESULT([$]{ac_t:-
2572 }[$]am_cv_proto_iconv)
2573 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
2574 [Define as const if the declaration of iconv() needs const.])
2575 fi
2576])
2577# intdiv0.m4 serial 1 (gettext-0.11.3)
2578dnl Copyright (C) 2002 Free Software Foundation, Inc.
2579dnl This file is free software, distributed under the terms of the GNU
2580dnl General Public License. As a special exception to the GNU General
2581dnl Public License, this file may be distributed as part of a program
2582dnl that contains a configuration script generated by Autoconf, under
2583dnl the same distribution terms as the rest of that program.
2584
2585dnl From Bruno Haible.
2586
2587AC_DEFUN([gt_INTDIV0],
2588[
2589 AC_REQUIRE([AC_PROG_CC])dnl
2590 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2591
2592 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
2593 gt_cv_int_divbyzero_sigfpe,
2594 [
2595 AC_TRY_RUN([
2596#include <stdlib.h>
2597#include <signal.h>
2598
2599static void
2600#ifdef __cplusplus
2601sigfpe_handler (int sig)
2602#else
2603sigfpe_handler (sig) int sig;
2604#endif
2605{
2606 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
2607 exit (sig != SIGFPE);
2608}
2609
2610int x = 1;
2611int y = 0;
2612int z;
2613int nan;
2614
2615int main ()
2616{
2617 signal (SIGFPE, sigfpe_handler);
2618/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
2619#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
2620 signal (SIGTRAP, sigfpe_handler);
2621#endif
2622/* Linux/SPARC yields signal SIGILL. */
2623#if defined (__sparc__) && defined (__linux__)
2624 signal (SIGILL, sigfpe_handler);
2625#endif
2626
2627 z = x / y;
2628 nan = y / y;
2629 exit (1);
2630}
2631], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
2632 [
2633 # Guess based on the CPU.
2634 case "$host_cpu" in
2635 alpha* | i[34567]86 | m68k | s390*)
2636 gt_cv_int_divbyzero_sigfpe="guessing yes";;
2637 *)
2638 gt_cv_int_divbyzero_sigfpe="guessing no";;
2639 esac
2640 ])
2641 ])
2642 case "$gt_cv_int_divbyzero_sigfpe" in
2643 *yes) value=1;;
2644 *) value=0;;
2645 esac
2646 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
2647 [Define if integer division by zero raises signal SIGFPE.])
2648])
2649# inttypes.m4 serial 1 (gettext-0.11.4)
2650dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
2651dnl This file is free software, distributed under the terms of the GNU
2652dnl General Public License. As a special exception to the GNU General
2653dnl Public License, this file may be distributed as part of a program
2654dnl that contains a configuration script generated by Autoconf, under
2655dnl the same distribution terms as the rest of that program.
2656
2657dnl From Paul Eggert.
2658
2659# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
2660# <sys/types.h>.
2661
2662AC_DEFUN([gt_HEADER_INTTYPES_H],
2663[
2664 AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
2665 [
2666 AC_TRY_COMPILE(
2667 [#include <sys/types.h>
2668#include <inttypes.h>],
2669 [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
2670 ])
2671 if test $gt_cv_header_inttypes_h = yes; then
2672 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
2673 [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
2674 fi
2675])
2676# inttypes_h.m4 serial 5 (gettext-0.12)
2677dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
2678dnl This file is free software, distributed under the terms of the GNU
2679dnl General Public License. As a special exception to the GNU General
2680dnl Public License, this file may be distributed as part of a program
2681dnl that contains a configuration script generated by Autoconf, under
2682dnl the same distribution terms as the rest of that program.
2683
2684dnl From Paul Eggert.
2685
2686# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
2687# doesn't clash with <sys/types.h>, and declares uintmax_t.
2688
2689AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
2690[
2691 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
2692 [AC_TRY_COMPILE(
2693 [#include <sys/types.h>
2694#include <inttypes.h>],
2695 [uintmax_t i = (uintmax_t) -1;],
2696 jm_ac_cv_header_inttypes_h=yes,
2697 jm_ac_cv_header_inttypes_h=no)])
2698 if test $jm_ac_cv_header_inttypes_h = yes; then
2699 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
2700 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
2701 and declares uintmax_t. ])
2702 fi
2703])
2704# inttypes-pri.m4 serial 1 (gettext-0.11.4)
2705dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
2706dnl This file is free software, distributed under the terms of the GNU
2707dnl General Public License. As a special exception to the GNU General
2708dnl Public License, this file may be distributed as part of a program
2709dnl that contains a configuration script generated by Autoconf, under
2710dnl the same distribution terms as the rest of that program.
2711
2712dnl From Bruno Haible.
2713
2714# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
2715# macros to non-string values. This is the case on AIX 4.3.3.
2716
2717AC_DEFUN([gt_INTTYPES_PRI],
2718[
2719 AC_REQUIRE([gt_HEADER_INTTYPES_H])
2720 if test $gt_cv_header_inttypes_h = yes; then
2721 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
2722 gt_cv_inttypes_pri_broken,
2723 [
2724 AC_TRY_COMPILE([#include <inttypes.h>
2725#ifdef PRId32
2726char *p = PRId32;
2727#endif
2728], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
2729 ])
2730 fi
2731 if test "$gt_cv_inttypes_pri_broken" = yes; then
2732 AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
2733 [Define if <inttypes.h> exists and defines unusable PRI* macros.])
2734 fi
2735])
2736# isc-posix.m4 serial 2 (gettext-0.11.2)
2737dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
2738dnl This file is free software, distributed under the terms of the GNU
2739dnl General Public License. As a special exception to the GNU General
2740dnl Public License, this file may be distributed as part of a program
2741dnl that contains a configuration script generated by Autoconf, under
2742dnl the same distribution terms as the rest of that program.
2743
2744# This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
2745
2746# This test replaces the one in autoconf.
2747# Currently this macro should have the same name as the autoconf macro
2748# because gettext's gettext.m4 (distributed in the automake package)
2749# still uses it. Otherwise, the use in gettext.m4 makes autoheader
2750# give these diagnostics:
2751# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
2752# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
2753
2754undefine([AC_ISC_POSIX])
2755
2756AC_DEFUN([AC_ISC_POSIX],
2757 [
2758 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
2759 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
2760 ]
2761)
2762# lcmessage.m4 serial 3 (gettext-0.11.3)
2763dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
2764dnl This file is free software, distributed under the terms of the GNU
2765dnl General Public License. As a special exception to the GNU General
2766dnl Public License, this file may be distributed as part of a program
2767dnl that contains a configuration script generated by Autoconf, under
2768dnl the same distribution terms as the rest of that program.
2769dnl
2770dnl This file can can be used in projects which are not available under
2771dnl the GNU General Public License or the GNU Library General Public
2772dnl License but which still want to provide support for the GNU gettext
2773dnl functionality.
2774dnl Please note that the actual code of the GNU gettext library is covered
2775dnl by the GNU Library General Public License, and the rest of the GNU
2776dnl gettext package package is covered by the GNU General Public License.
2777dnl They are *not* in the public domain.
2778
2779dnl Authors:
2780dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
2781
2782# Check whether LC_MESSAGES is available in <locale.h>.
2783
2784AC_DEFUN([AM_LC_MESSAGES],
2785[
2786 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2787 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2788 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2789 if test $am_cv_val_LC_MESSAGES = yes; then
2790 AC_DEFINE(HAVE_LC_MESSAGES, 1,
2791 [Define if your <locale.h> file defines LC_MESSAGES.])
2792 fi
2793])
2794# lib-ld.m4 serial 2 (gettext-0.12)
2795dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
2796dnl This file is free software, distributed under the terms of the GNU
2797dnl General Public License. As a special exception to the GNU General
2798dnl Public License, this file may be distributed as part of a program
2799dnl that contains a configuration script generated by Autoconf, under
2800dnl the same distribution terms as the rest of that program.
2801
2802dnl Subroutines of libtool.m4,
2803dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
2804dnl with libtool.m4.
2805
2806dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
2807AC_DEFUN([AC_LIB_PROG_LD_GNU],
2808[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
2809[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
2810if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
2811 acl_cv_prog_gnu_ld=yes
2812else
2813 acl_cv_prog_gnu_ld=no
2814fi])
2815with_gnu_ld=$acl_cv_prog_gnu_ld
2816])
2817
2818dnl From libtool-1.4. Sets the variable LD.
2819AC_DEFUN([AC_LIB_PROG_LD],
2820[AC_ARG_WITH(gnu-ld,
2821[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
2822test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
2823AC_REQUIRE([AC_PROG_CC])dnl
2824AC_REQUIRE([AC_CANONICAL_HOST])dnl
2825# Prepare PATH_SEPARATOR.
2826# The user is always right.
2827if test "${PATH_SEPARATOR+set}" != set; then
2828 echo "#! /bin/sh" >conf$$.sh
2829 echo "exit 0" >>conf$$.sh
2830 chmod +x conf$$.sh
2831 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
2832 PATH_SEPARATOR=';'
2833 else
2834 PATH_SEPARATOR=:
2835 fi
2836 rm -f conf$$.sh
2837fi
2838ac_prog=ld
2839if test "$GCC" = yes; then
2840 # Check if gcc -print-prog-name=ld gives a path.
2841 AC_MSG_CHECKING([for ld used by GCC])
2842 case $host in
2843 *-*-mingw*)
2844 # gcc leaves a trailing carriage return which upsets mingw
2845 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
2846 *)
2847 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
2848 esac
2849 case $ac_prog in
2850 # Accept absolute paths.
2851 [[\\/]* | [A-Za-z]:[\\/]*)]
2852 [re_direlt='/[^/][^/]*/\.\./']
2853 # Canonicalize the path of ld
2854 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
2855 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
2856 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
2857 done
2858 test -z "$LD" && LD="$ac_prog"
2859 ;;
2860 "")
2861 # If it fails, then pretend we aren't using GCC.
2862 ac_prog=ld
2863 ;;
2864 *)
2865 # If it is relative, then search for the first ld in PATH.
2866 with_gnu_ld=unknown
2867 ;;
2868 esac
2869elif test "$with_gnu_ld" = yes; then
2870 AC_MSG_CHECKING([for GNU ld])
2871else
2872 AC_MSG_CHECKING([for non-GNU ld])
2873fi
2874AC_CACHE_VAL(acl_cv_path_LD,
2875[if test -z "$LD"; then
2876 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
2877 for ac_dir in $PATH; do
2878 test -z "$ac_dir" && ac_dir=.
2879 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
2880 acl_cv_path_LD="$ac_dir/$ac_prog"
2881 # Check to see if the program is GNU ld. I'd rather use --version,
2882 # but apparently some GNU ld's only accept -v.
2883 # Break only if it was the GNU/non-GNU ld that we prefer.
2884 if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
2885 test "$with_gnu_ld" != no && break
2886 else
2887 test "$with_gnu_ld" != yes && break
2888 fi
2889 fi
2890 done
2891 IFS="$ac_save_ifs"
2892else
2893 acl_cv_path_LD="$LD" # Let the user override the test with a path.
2894fi])
2895LD="$acl_cv_path_LD"
2896if test -n "$LD"; then
2897 AC_MSG_RESULT($LD)
2898else
2899 AC_MSG_RESULT(no)
2900fi
2901test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
2902AC_LIB_PROG_LD_GNU
2903])
2904# lib-link.m4 serial 4 (gettext-0.12)
2905dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
2906dnl This file is free software, distributed under the terms of the GNU
2907dnl General Public License. As a special exception to the GNU General
2908dnl Public License, this file may be distributed as part of a program
2909dnl that contains a configuration script generated by Autoconf, under
2910dnl the same distribution terms as the rest of that program.
2911
2912dnl From Bruno Haible.
2913
2914dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
2915dnl the libraries corresponding to explicit and implicit dependencies.
2916dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
2917dnl augments the CPPFLAGS variable.
2918AC_DEFUN([AC_LIB_LINKFLAGS],
2919[
2920 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2921 AC_REQUIRE([AC_LIB_RPATH])
2922 define([Name],[translit([$1],[./-], [___])])
2923 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2924 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2925 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
2926 AC_LIB_LINKFLAGS_BODY([$1], [$2])
2927 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
2928 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
2929 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
2930 ])
2931 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
2932 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
2933 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
2934 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2935 AC_SUBST([LIB]NAME)
2936 AC_SUBST([LTLIB]NAME)
2937 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
2938 dnl results of this search when this library appears as a dependency.
2939 HAVE_LIB[]NAME=yes
2940 undefine([Name])
2941 undefine([NAME])
2942])
2943
2944dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
2945dnl searches for libname and the libraries corresponding to explicit and
2946dnl implicit dependencies, together with the specified include files and
2947dnl the ability to compile and link the specified testcode. If found, it
2948dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
2949dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
2950dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
2951dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
2952AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
2953[
2954 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2955 AC_REQUIRE([AC_LIB_RPATH])
2956 define([Name],[translit([$1],[./-], [___])])
2957 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2958 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2959
2960 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
2961 dnl accordingly.
2962 AC_LIB_LINKFLAGS_BODY([$1], [$2])
2963
2964 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
2965 dnl because if the user has installed lib[]Name and not disabled its use
2966 dnl via --without-lib[]Name-prefix, he wants to use it.
2967 ac_save_CPPFLAGS="$CPPFLAGS"
2968 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2969
2970 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
2971 ac_save_LIBS="$LIBS"
2972 LIBS="$LIBS $LIB[]NAME"
2973 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
2974 LIBS="$ac_save_LIBS"
2975 ])
2976 if test "$ac_cv_lib[]Name" = yes; then
2977 HAVE_LIB[]NAME=yes
2978 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
2979 AC_MSG_CHECKING([how to link with lib[]$1])
2980 AC_MSG_RESULT([$LIB[]NAME])
2981 else
2982 HAVE_LIB[]NAME=no
2983 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
2984 dnl $INC[]NAME either.
2985 CPPFLAGS="$ac_save_CPPFLAGS"
2986 LIB[]NAME=
2987 LTLIB[]NAME=
2988 fi
2989 AC_SUBST([HAVE_LIB]NAME)
2990 AC_SUBST([LIB]NAME)
2991 AC_SUBST([LTLIB]NAME)
2992 undefine([Name])
2993 undefine([NAME])
2994])
2995
2996dnl Determine the platform dependent parameters needed to use rpath:
2997dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
2998dnl hardcode_direct, hardcode_minus_L.
2999AC_DEFUN([AC_LIB_RPATH],
3000[
3001 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
3002 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
3003 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
3004 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
3005 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
3006 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
3007 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
3008 . ./conftest.sh
3009 rm -f ./conftest.sh
3010 acl_cv_rpath=done
3011 ])
3012 wl="$acl_cv_wl"
3013 libext="$acl_cv_libext"
3014 shlibext="$acl_cv_shlibext"
3015 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
3016 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
3017 hardcode_direct="$acl_cv_hardcode_direct"
3018 hardcode_minus_L="$acl_cv_hardcode_minus_L"
3019 dnl Determine whether the user wants rpath handling at all.
3020 AC_ARG_ENABLE(rpath,
3021 [ --disable-rpath do not hardcode runtime library paths],
3022 :, enable_rpath=yes)
3023])
3024
3025dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
3026dnl the libraries corresponding to explicit and implicit dependencies.
3027dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
3028AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
3029[
3030 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
3031 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
3032 dnl By default, look in $includedir and $libdir.
3033 use_additional=yes
3034 AC_LIB_WITH_FINAL_PREFIX([
3035 eval additional_includedir=\"$includedir\"
3036 eval additional_libdir=\"$libdir\"
3037 ])
3038 AC_LIB_ARG_WITH([lib$1-prefix],
3039[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
3040 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
3041[
3042 if test "X$withval" = "Xno"; then
3043 use_additional=no
3044 else
3045 if test "X$withval" = "X"; then
3046 AC_LIB_WITH_FINAL_PREFIX([
3047 eval additional_includedir=\"$includedir\"
3048 eval additional_libdir=\"$libdir\"
3049 ])
3050 else
3051 additional_includedir="$withval/include"
3052 additional_libdir="$withval/lib"
3053 fi
3054 fi
3055])
3056 dnl Search the library and its dependencies in $additional_libdir and
3057 dnl $LDFLAGS. Using breadth-first-seach.
3058 LIB[]NAME=
3059 LTLIB[]NAME=
3060 INC[]NAME=
3061 rpathdirs=
3062 ltrpathdirs=
3063 names_already_handled=
3064 names_next_round='$1 $2'
3065 while test -n "$names_next_round"; do
3066 names_this_round="$names_next_round"
3067 names_next_round=
3068 for name in $names_this_round; do
3069 already_handled=
3070 for n in $names_already_handled; do
3071 if test "$n" = "$name"; then
3072 already_handled=yes
3073 break
3074 fi
3075 done
3076 if test -z "$already_handled"; then
3077 names_already_handled="$names_already_handled $name"
3078 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
3079 dnl or AC_LIB_HAVE_LINKFLAGS call.
3080 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
3081 eval value=\"\$HAVE_LIB$uppername\"
3082 if test -n "$value"; then
3083 if test "$value" = yes; then
3084 eval value=\"\$LIB$uppername\"
3085 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
3086 eval value=\"\$LTLIB$uppername\"
3087 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
3088 else
3089 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
3090 dnl that this library doesn't exist. So just drop it.
3091 :
3092 fi
3093 else
3094 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
3095 dnl and the already constructed $LIBNAME/$LTLIBNAME.
3096 found_dir=
3097 found_la=
3098 found_so=
3099 found_a=
3100 if test $use_additional = yes; then
3101 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
3102 found_dir="$additional_libdir"
3103 found_so="$additional_libdir/lib$name.$shlibext"
3104 if test -f "$additional_libdir/lib$name.la"; then
3105 found_la="$additional_libdir/lib$name.la"
3106 fi
3107 else
3108 if test -f "$additional_libdir/lib$name.$libext"; then
3109 found_dir="$additional_libdir"
3110 found_a="$additional_libdir/lib$name.$libext"
3111 if test -f "$additional_libdir/lib$name.la"; then
3112 found_la="$additional_libdir/lib$name.la"
3113 fi
3114 fi
3115 fi
3116 fi
3117 if test "X$found_dir" = "X"; then
3118 for x in $LDFLAGS $LTLIB[]NAME; do
3119 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3120 case "$x" in
3121 -L*)
3122 dir=`echo "X$x" | sed -e 's/^X-L//'`
3123 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
3124 found_dir="$dir"
3125 found_so="$dir/lib$name.$shlibext"
3126 if test -f "$dir/lib$name.la"; then
3127 found_la="$dir/lib$name.la"
3128 fi
3129 else
3130 if test -f "$dir/lib$name.$libext"; then
3131 found_dir="$dir"
3132 found_a="$dir/lib$name.$libext"
3133 if test -f "$dir/lib$name.la"; then
3134 found_la="$dir/lib$name.la"
3135 fi
3136 fi
3137 fi
3138 ;;
3139 esac
3140 if test "X$found_dir" != "X"; then
3141 break
3142 fi
3143 done
3144 fi
3145 if test "X$found_dir" != "X"; then
3146 dnl Found the library.
3147 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
3148 if test "X$found_so" != "X"; then
3149 dnl Linking with a shared library. We attempt to hardcode its
3150 dnl directory into the executable's runpath, unless it's the
3151 dnl standard /usr/lib.
3152 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
3153 dnl No hardcoding is needed.
3154 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3155 else
3156 dnl Use an explicit option to hardcode DIR into the resulting
3157 dnl binary.
3158 dnl Potentially add DIR to ltrpathdirs.
3159 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
3160 haveit=
3161 for x in $ltrpathdirs; do
3162 if test "X$x" = "X$found_dir"; then
3163 haveit=yes
3164 break
3165 fi
3166 done
3167 if test -z "$haveit"; then
3168 ltrpathdirs="$ltrpathdirs $found_dir"
3169 fi
3170 dnl The hardcoding into $LIBNAME is system dependent.
3171 if test "$hardcode_direct" = yes; then
3172 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
3173 dnl resulting binary.
3174 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3175 else
3176 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
3177 dnl Use an explicit option to hardcode DIR into the resulting
3178 dnl binary.
3179 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3180 dnl Potentially add DIR to rpathdirs.
3181 dnl The rpathdirs will be appended to $LIBNAME at the end.
3182 haveit=
3183 for x in $rpathdirs; do
3184 if test "X$x" = "X$found_dir"; then
3185 haveit=yes
3186 break
3187 fi
3188 done
3189 if test -z "$haveit"; then
3190 rpathdirs="$rpathdirs $found_dir"
3191 fi
3192 else
3193 dnl Rely on "-L$found_dir".
3194 dnl But don't add it if it's already contained in the LDFLAGS
3195 dnl or the already constructed $LIBNAME
3196 haveit=
3197 for x in $LDFLAGS $LIB[]NAME; do
3198 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3199 if test "X$x" = "X-L$found_dir"; then
3200 haveit=yes
3201 break
3202 fi
3203 done
3204 if test -z "$haveit"; then
3205 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
3206 fi
3207 if test "$hardcode_minus_L" != no; then
3208 dnl FIXME: Not sure whether we should use
3209 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
3210 dnl here.
3211 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3212 else
3213 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
3214 dnl here, because this doesn't fit in flags passed to the
3215 dnl compiler. So give up. No hardcoding. This affects only
3216 dnl very old systems.
3217 dnl FIXME: Not sure whether we should use
3218 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
3219 dnl here.
3220 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
3221 fi
3222 fi
3223 fi
3224 fi
3225 else
3226 if test "X$found_a" != "X"; then
3227 dnl Linking with a static library.
3228 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
3229 else
3230 dnl We shouldn't come here, but anyway it's good to have a
3231 dnl fallback.
3232 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
3233 fi
3234 fi
3235 dnl Assume the include files are nearby.
3236 additional_includedir=
3237 case "$found_dir" in
3238 */lib | */lib/)
3239 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
3240 additional_includedir="$basedir/include"
3241 ;;
3242 esac
3243 if test "X$additional_includedir" != "X"; then
3244 dnl Potentially add $additional_includedir to $INCNAME.
3245 dnl But don't add it
3246 dnl 1. if it's the standard /usr/include,
3247 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
3248 dnl 3. if it's already present in $CPPFLAGS or the already
3249 dnl constructed $INCNAME,
3250 dnl 4. if it doesn't exist as a directory.
3251 if test "X$additional_includedir" != "X/usr/include"; then
3252 haveit=
3253 if test "X$additional_includedir" = "X/usr/local/include"; then
3254 if test -n "$GCC"; then
3255 case $host_os in
3256 linux*) haveit=yes;;
3257 esac
3258 fi
3259 fi
3260 if test -z "$haveit"; then
3261 for x in $CPPFLAGS $INC[]NAME; do
3262 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3263 if test "X$x" = "X-I$additional_includedir"; then
3264 haveit=yes
3265 break
3266 fi
3267 done
3268 if test -z "$haveit"; then
3269 if test -d "$additional_includedir"; then
3270 dnl Really add $additional_includedir to $INCNAME.
3271 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
3272 fi
3273 fi
3274 fi
3275 fi
3276 fi
3277 dnl Look for dependencies.
3278 if test -n "$found_la"; then
3279 dnl Read the .la file. It defines the variables
3280 dnl dlname, library_names, old_library, dependency_libs, current,
3281 dnl age, revision, installed, dlopen, dlpreopen, libdir.
3282 save_libdir="$libdir"
3283 case "$found_la" in
3284 */* | *\\*) . "$found_la" ;;
3285 *) . "./$found_la" ;;
3286 esac
3287 libdir="$save_libdir"
3288 dnl We use only dependency_libs.
3289 for dep in $dependency_libs; do
3290 case "$dep" in
3291 -L*)
3292 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
3293 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
3294 dnl But don't add it
3295 dnl 1. if it's the standard /usr/lib,
3296 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
3297 dnl 3. if it's already present in $LDFLAGS or the already
3298 dnl constructed $LIBNAME,
3299 dnl 4. if it doesn't exist as a directory.
3300 if test "X$additional_libdir" != "X/usr/lib"; then
3301 haveit=
3302 if test "X$additional_libdir" = "X/usr/local/lib"; then
3303 if test -n "$GCC"; then
3304 case $host_os in
3305 linux*) haveit=yes;;
3306 esac
3307 fi
3308 fi
3309 if test -z "$haveit"; then
3310 haveit=
3311 for x in $LDFLAGS $LIB[]NAME; do
3312 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3313 if test "X$x" = "X-L$additional_libdir"; then
3314 haveit=yes
3315 break
3316 fi
3317 done
3318 if test -z "$haveit"; then
3319 if test -d "$additional_libdir"; then
3320 dnl Really add $additional_libdir to $LIBNAME.
3321 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
3322 fi
3323 fi
3324 haveit=
3325 for x in $LDFLAGS $LTLIB[]NAME; do
3326 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3327 if test "X$x" = "X-L$additional_libdir"; then
3328 haveit=yes
3329 break
3330 fi
3331 done
3332 if test -z "$haveit"; then
3333 if test -d "$additional_libdir"; then
3334 dnl Really add $additional_libdir to $LTLIBNAME.
3335 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
3336 fi
3337 fi
3338 fi
3339 fi
3340 ;;
3341 -R*)
3342 dir=`echo "X$dep" | sed -e 's/^X-R//'`
3343 if test "$enable_rpath" != no; then
3344 dnl Potentially add DIR to rpathdirs.
3345 dnl The rpathdirs will be appended to $LIBNAME at the end.
3346 haveit=
3347 for x in $rpathdirs; do
3348 if test "X$x" = "X$dir"; then
3349 haveit=yes
3350 break
3351 fi
3352 done
3353 if test -z "$haveit"; then
3354 rpathdirs="$rpathdirs $dir"
3355 fi
3356 dnl Potentially add DIR to ltrpathdirs.
3357 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
3358 haveit=
3359 for x in $ltrpathdirs; do
3360 if test "X$x" = "X$dir"; then
3361 haveit=yes
3362 break
3363 fi
3364 done
3365 if test -z "$haveit"; then
3366 ltrpathdirs="$ltrpathdirs $dir"
3367 fi
3368 fi
3369 ;;
3370 -l*)
3371 dnl Handle this in the next round.
3372 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
3373 ;;
3374 *.la)
3375 dnl Handle this in the next round. Throw away the .la's
3376 dnl directory; it is already contained in a preceding -L
3377 dnl option.
3378 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
3379 ;;
3380 *)
3381 dnl Most likely an immediate library name.
3382 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
3383 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
3384 ;;
3385 esac
3386 done
3387 fi
3388 else
3389 dnl Didn't find the library; assume it is in the system directories
3390 dnl known to the linker and runtime loader. (All the system
3391 dnl directories known to the linker should also be known to the
3392 dnl runtime loader, otherwise the system is severely misconfigured.)
3393 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
3394 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
3395 fi
3396 fi
3397 fi
3398 done
3399 done
3400 if test "X$rpathdirs" != "X"; then
3401 if test -n "$hardcode_libdir_separator"; then
3402 dnl Weird platform: only the last -rpath option counts, the user must
3403 dnl pass all path elements in one option. We can arrange that for a
3404 dnl single library, but not when more than one $LIBNAMEs are used.
3405 alldirs=
3406 for found_dir in $rpathdirs; do
3407 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
3408 done
3409 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
3410 acl_save_libdir="$libdir"
3411 libdir="$alldirs"
3412 eval flag=\"$hardcode_libdir_flag_spec\"
3413 libdir="$acl_save_libdir"
3414 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
3415 else
3416 dnl The -rpath options are cumulative.
3417 for found_dir in $rpathdirs; do
3418 acl_save_libdir="$libdir"
3419 libdir="$found_dir"
3420 eval flag=\"$hardcode_libdir_flag_spec\"
3421 libdir="$acl_save_libdir"
3422 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
3423 done
3424 fi
3425 fi
3426 if test "X$ltrpathdirs" != "X"; then
3427 dnl When using libtool, the option that works for both libraries and
3428 dnl executables is -R. The -R options are cumulative.
3429 for found_dir in $ltrpathdirs; do
3430 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
3431 done
3432 fi
3433])
3434
3435dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
3436dnl unless already present in VAR.
3437dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
3438dnl contains two or three consecutive elements that belong together.
3439AC_DEFUN([AC_LIB_APPENDTOVAR],
3440[
3441 for element in [$2]; do
3442 haveit=
3443 for x in $[$1]; do
3444 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3445 if test "X$x" = "X$element"; then
3446 haveit=yes
3447 break
3448 fi
3449 done
3450 if test -z "$haveit"; then
3451 [$1]="${[$1]}${[$1]:+ }$element"
3452 fi
3453 done
3454])
3455# lib-prefix.m4 serial 2 (gettext-0.12)
3456dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
3457dnl This file is free software, distributed under the terms of the GNU
3458dnl General Public License. As a special exception to the GNU General
3459dnl Public License, this file may be distributed as part of a program
3460dnl that contains a configuration script generated by Autoconf, under
3461dnl the same distribution terms as the rest of that program.
3462
3463dnl From Bruno Haible.
3464
3465dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
3466dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
3467dnl require excessive bracketing.
3468ifdef([AC_HELP_STRING],
3469[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
3470[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
3471
3472dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
3473dnl to access previously installed libraries. The basic assumption is that
3474dnl a user will want packages to use other packages he previously installed
3475dnl with the same --prefix option.
3476dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
3477dnl libraries, but is otherwise very convenient.
3478AC_DEFUN([AC_LIB_PREFIX],
3479[
3480 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
3481 AC_REQUIRE([AC_PROG_CC])
3482 AC_REQUIRE([AC_CANONICAL_HOST])
3483 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
3484 dnl By default, look in $includedir and $libdir.
3485 use_additional=yes
3486 AC_LIB_WITH_FINAL_PREFIX([
3487 eval additional_includedir=\"$includedir\"
3488 eval additional_libdir=\"$libdir\"
3489 ])
3490 AC_LIB_ARG_WITH([lib-prefix],
3491[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
3492 --without-lib-prefix don't search for libraries in includedir and libdir],
3493[
3494 if test "X$withval" = "Xno"; then
3495 use_additional=no
3496 else
3497 if test "X$withval" = "X"; then
3498 AC_LIB_WITH_FINAL_PREFIX([
3499 eval additional_includedir=\"$includedir\"
3500 eval additional_libdir=\"$libdir\"
3501 ])
3502 else
3503 additional_includedir="$withval/include"
3504 additional_libdir="$withval/lib"
3505 fi
3506 fi
3507])
3508 if test $use_additional = yes; then
3509 dnl Potentially add $additional_includedir to $CPPFLAGS.
3510 dnl But don't add it
3511 dnl 1. if it's the standard /usr/include,
3512 dnl 2. if it's already present in $CPPFLAGS,
3513 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
3514 dnl 4. if it doesn't exist as a directory.
3515 if test "X$additional_includedir" != "X/usr/include"; then
3516 haveit=
3517 for x in $CPPFLAGS; do
3518 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3519 if test "X$x" = "X-I$additional_includedir"; then
3520 haveit=yes
3521 break
3522 fi
3523 done
3524 if test -z "$haveit"; then
3525 if test "X$additional_includedir" = "X/usr/local/include"; then
3526 if test -n "$GCC"; then
3527 case $host_os in
3528 linux*) haveit=yes;;
3529 esac
3530 fi
3531 fi
3532 if test -z "$haveit"; then
3533 if test -d "$additional_includedir"; then
3534 dnl Really add $additional_includedir to $CPPFLAGS.
3535 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
3536 fi
3537 fi
3538 fi
3539 fi
3540 dnl Potentially add $additional_libdir to $LDFLAGS.
3541 dnl But don't add it
3542 dnl 1. if it's the standard /usr/lib,
3543 dnl 2. if it's already present in $LDFLAGS,
3544 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
3545 dnl 4. if it doesn't exist as a directory.
3546 if test "X$additional_libdir" != "X/usr/lib"; then
3547 haveit=
3548 for x in $LDFLAGS; do
3549 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3550 if test "X$x" = "X-L$additional_libdir"; then
3551 haveit=yes
3552 break
3553 fi
3554 done
3555 if test -z "$haveit"; then
3556 if test "X$additional_libdir" = "X/usr/local/lib"; then
3557 if test -n "$GCC"; then
3558 case $host_os in
3559 linux*) haveit=yes;;
3560 esac
3561 fi
3562 fi
3563 if test -z "$haveit"; then
3564 if test -d "$additional_libdir"; then
3565 dnl Really add $additional_libdir to $LDFLAGS.
3566 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
3567 fi
3568 fi
3569 fi
3570 fi
3571 fi
3572])
3573
3574dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
3575dnl acl_final_exec_prefix, containing the values to which $prefix and
3576dnl $exec_prefix will expand at the end of the configure script.
3577AC_DEFUN([AC_LIB_PREPARE_PREFIX],
3578[
3579 dnl Unfortunately, prefix and exec_prefix get only finally determined
3580 dnl at the end of configure.
3581 if test "X$prefix" = "XNONE"; then
3582 acl_final_prefix="$ac_default_prefix"
3583 else
3584 acl_final_prefix="$prefix"
3585 fi
3586 if test "X$exec_prefix" = "XNONE"; then
3587 acl_final_exec_prefix='${prefix}'
3588 else
3589 acl_final_exec_prefix="$exec_prefix"
3590 fi
3591 acl_save_prefix="$prefix"
3592 prefix="$acl_final_prefix"
3593 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
3594 prefix="$acl_save_prefix"
3595])
3596
3597dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
3598dnl variables prefix and exec_prefix bound to the values they will have
3599dnl at the end of the configure script.
3600AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
3601[
3602 acl_save_prefix="$prefix"
3603 prefix="$acl_final_prefix"
3604 acl_save_exec_prefix="$exec_prefix"
3605 exec_prefix="$acl_final_exec_prefix"
3606 $1
3607 exec_prefix="$acl_save_exec_prefix"
3608 prefix="$acl_save_prefix"
3609])
3610# nls.m4 serial 1 (gettext-0.12)
3611dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
3612dnl This file is free software, distributed under the terms of the GNU
3613dnl General Public License. As a special exception to the GNU General
3614dnl Public License, this file may be distributed as part of a program
3615dnl that contains a configuration script generated by Autoconf, under
3616dnl the same distribution terms as the rest of that program.
3617dnl
3618dnl This file can can be used in projects which are not available under
3619dnl the GNU General Public License or the GNU Library General Public
3620dnl License but which still want to provide support for the GNU gettext
3621dnl functionality.
3622dnl Please note that the actual code of the GNU gettext library is covered
3623dnl by the GNU Library General Public License, and the rest of the GNU
3624dnl gettext package package is covered by the GNU General Public License.
3625dnl They are *not* in the public domain.
3626
3627dnl Authors:
3628dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3629dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3630
3631AC_DEFUN([AM_NLS],
3632[
3633 AC_MSG_CHECKING([whether NLS is requested])
3634 dnl Default is enabled NLS
3635 AC_ARG_ENABLE(nls,
3636 [ --disable-nls do not use Native Language Support],
3637 USE_NLS=$enableval, USE_NLS=yes)
3638 AC_MSG_RESULT($USE_NLS)
3639 AC_SUBST(USE_NLS)
3640])
3641
3642AC_DEFUN([AM_MKINSTALLDIRS],
3643[
3644 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
3645 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
3646 dnl Try to locate it.
3647 MKINSTALLDIRS=
3648 if test -n "$ac_aux_dir"; then
3649 case "$ac_aux_dir" in
3650 /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
3651 *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
3652 esac
3653 fi
3654 if test -z "$MKINSTALLDIRS"; then
3655 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
3656 fi
3657 AC_SUBST(MKINSTALLDIRS)
3658])
3659# po.m4 serial 1 (gettext-0.12)
3660dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
3661dnl This file is free software, distributed under the terms of the GNU
3662dnl General Public License. As a special exception to the GNU General
3663dnl Public License, this file may be distributed as part of a program
3664dnl that contains a configuration script generated by Autoconf, under
3665dnl the same distribution terms as the rest of that program.
3666dnl
3667dnl This file can can be used in projects which are not available under
3668dnl the GNU General Public License or the GNU Library General Public
3669dnl License but which still want to provide support for the GNU gettext
3670dnl functionality.
3671dnl Please note that the actual code of the GNU gettext library is covered
3672dnl by the GNU Library General Public License, and the rest of the GNU
3673dnl gettext package package is covered by the GNU General Public License.
3674dnl They are *not* in the public domain.
3675
3676dnl Authors:
3677dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3678dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3679
3680dnl Checks for all prerequisites of the po subdirectory.
3681AC_DEFUN([AM_PO_SUBDIRS],
3682[
3683 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3684 AC_REQUIRE([AC_PROG_INSTALL])dnl
3685 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
3686 AC_REQUIRE([AM_NLS])dnl
3687
3688 dnl Perform the following tests also if --disable-nls has been given,
3689 dnl because they are needed for "make dist" to work.
3690
3691 dnl Search for GNU msgfmt in the PATH.
3692 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
3693 dnl The second test excludes FreeBSD msgfmt.
3694 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
3695 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
3696 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
3697 :)
3698 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
3699
3700 dnl Search for GNU xgettext 0.12 or newer in the PATH.
3701 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
3702 dnl The second test excludes FreeBSD xgettext.
3703 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
3704 [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
3705 (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
3706 :)
3707 dnl Remove leftover from FreeBSD xgettext call.
3708 rm -f messages.po
3709
3710 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
3711 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
3712 [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
3713
3714 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
3715 dnl Test whether we really found GNU msgfmt.
3716 if test "$GMSGFMT" != ":"; then
3717 dnl If it is no GNU msgfmt we define it as : so that the
3718 dnl Makefiles still can work.
3719 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
3720 (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
3721 : ;
3722 else
3723 GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
3724 AC_MSG_RESULT(
3725 [found $GMSGFMT program is not GNU msgfmt; ignore it])
3726 GMSGFMT=":"
3727 fi
3728 fi
3729
3730 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
3731 dnl Test whether we really found GNU xgettext.
3732 if test "$XGETTEXT" != ":"; then
3733 dnl If it is no GNU xgettext we define it as : so that the
3734 dnl Makefiles still can work.
3735 if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
3736 (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
3737 : ;
3738 else
3739 AC_MSG_RESULT(
3740 [found xgettext program is not GNU xgettext; ignore it])
3741 XGETTEXT=":"
3742 fi
3743 dnl Remove leftover from FreeBSD xgettext call.
3744 rm -f messages.po
3745 fi
3746
3747 AC_OUTPUT_COMMANDS([
3748 for ac_file in $CONFIG_FILES; do
3749 # Support "outfile[:infile[:infile...]]"
3750 case "$ac_file" in
3751 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
3752 esac
3753 # PO directories have a Makefile.in generated from Makefile.in.in.
3754 case "$ac_file" in */Makefile.in)
3755 # Adjust a relative srcdir.
3756 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
3757 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
3758 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
3759 # In autoconf-2.13 it is called $ac_given_srcdir.
3760 # In autoconf-2.50 it is called $srcdir.
3761 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
3762 case "$ac_given_srcdir" in
3763 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
3764 /*) top_srcdir="$ac_given_srcdir" ;;
3765 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
3766 esac
3767 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
3768 rm -f "$ac_dir/POTFILES"
3769 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
3770 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
3771 POMAKEFILEDEPS="POTFILES.in"
3772 # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
3773 # on $ac_dir but don't depend on user-specified configuration
3774 # parameters.
3775 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
3776 # The LINGUAS file contains the set of available languages.
3777 if test -n "$OBSOLETE_ALL_LINGUAS"; then
3778 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
3779 fi
3780 ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
3781 # Hide the ALL_LINGUAS assigment from automake.
3782 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
3783 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
3784 else
3785 # The set of available languages was given in configure.in.
3786 eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
3787 fi
3788 case "$ac_given_srcdir" in
3789 .) srcdirpre= ;;
3790 *) srcdirpre='$(srcdir)/' ;;
3791 esac
3792 POFILES=
3793 GMOFILES=
3794 UPDATEPOFILES=
3795 DUMMYPOFILES=
3796 for lang in $ALL_LINGUAS; do
3797 POFILES="$POFILES $srcdirpre$lang.po"
3798 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
3799 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
3800 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
3801 done
3802 # CATALOGS depends on both $ac_dir and the user's LINGUAS
3803 # environment variable.
3804 INST_LINGUAS=
3805 if test -n "$ALL_LINGUAS"; then
3806 for presentlang in $ALL_LINGUAS; do
3807 useit=no
3808 if test "%UNSET%" != "$LINGUAS"; then
3809 desiredlanguages="$LINGUAS"
3810 else
3811 desiredlanguages="$ALL_LINGUAS"
3812 fi
3813 for desiredlang in $desiredlanguages; do
3814 # Use the presentlang catalog if desiredlang is
3815 # a. equal to presentlang, or
3816 # b. a variant of presentlang (because in this case,
3817 # presentlang can be used as a fallback for messages
3818 # which are not translated in the desiredlang catalog).
3819 case "$desiredlang" in
3820 "$presentlang"*) useit=yes;;
3821 esac
3822 done
3823 if test $useit = yes; then
3824 INST_LINGUAS="$INST_LINGUAS $presentlang"
3825 fi
3826 done
3827 fi
3828 CATALOGS=
3829 if test -n "$INST_LINGUAS"; then
3830 for lang in $INST_LINGUAS; do
3831 CATALOGS="$CATALOGS $lang.gmo"
3832 done
3833 fi
3834 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
3835 sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
3836 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
3837 if test -f "$f"; then
3838 case "$f" in
3839 *.orig | *.bak | *~) ;;
3840 *) cat "$f" >> "$ac_dir/Makefile" ;;
3841 esac
3842 fi
3843 done
3844 fi
3845 ;;
3846 esac
3847 done],
3848 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
3849 # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
3850 # from automake.
3851 eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
3852 # Capture the value of LINGUAS because we need it to compute CATALOGS.
3853 LINGUAS="${LINGUAS-%UNSET%}"
3854 ])
3855])
3856# progtest.m4 serial 3 (gettext-0.12)
3857dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
3858dnl This file is free software, distributed under the terms of the GNU
3859dnl General Public License. As a special exception to the GNU General
3860dnl Public License, this file may be distributed as part of a program
3861dnl that contains a configuration script generated by Autoconf, under
3862dnl the same distribution terms as the rest of that program.
3863dnl
3864dnl This file can can be used in projects which are not available under
3865dnl the GNU General Public License or the GNU Library General Public
3866dnl License but which still want to provide support for the GNU gettext
3867dnl functionality.
3868dnl Please note that the actual code of the GNU gettext library is covered
3869dnl by the GNU Library General Public License, and the rest of the GNU
3870dnl gettext package package is covered by the GNU General Public License.
3871dnl They are *not* in the public domain.
3872
3873dnl Authors:
3874dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
3875
3876# Search path for a program which passes the given test.
3877
3878dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
3879dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
3880AC_DEFUN([AM_PATH_PROG_WITH_TEST],
3881[
3882# Prepare PATH_SEPARATOR.
3883# The user is always right.
3884if test "${PATH_SEPARATOR+set}" != set; then
3885 echo "#! /bin/sh" >conf$$.sh
3886 echo "exit 0" >>conf$$.sh
3887 chmod +x conf$$.sh
3888 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
3889 PATH_SEPARATOR=';'
3890 else
3891 PATH_SEPARATOR=:
3892 fi
3893 rm -f conf$$.sh
3894fi
3895
3896# Find out how to test for executable files. Don't use a zero-byte file,
3897# as systems may use methods other than mode bits to determine executability.
3898cat >conf$$.file <<_ASEOF
3899#! /bin/sh
3900exit 0
3901_ASEOF
3902chmod +x conf$$.file
3903if test -x conf$$.file >/dev/null 2>&1; then
3904 ac_executable_p="test -x"
3905else
3906 ac_executable_p="test -f"
3907fi
3908rm -f conf$$.file
3909
3910# Extract the first word of "$2", so it can be a program name with args.
3911set dummy $2; ac_word=[$]2
3912AC_MSG_CHECKING([for $ac_word])
3913AC_CACHE_VAL(ac_cv_path_$1,
3914[case "[$]$1" in
3915 [[\\/]]* | ?:[[\\/]]*)
3916 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
3917 ;;
3918 *)
3919 ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
3920 for ac_dir in ifelse([$5], , $PATH, [$5]); do
3921 IFS="$ac_save_IFS"
3922 test -z "$ac_dir" && ac_dir=.
3923 for ac_exec_ext in '' $ac_executable_extensions; do
3924 if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
3925 if [$3]; then
3926 ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
3927 break 2
3928 fi
3929 fi
3930 done
3931 done
3932 IFS="$ac_save_IFS"
3933dnl If no 4th arg is given, leave the cache variable unset,
3934dnl so AC_PATH_PROGS will keep looking.
3935ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
3936])dnl
3937 ;;
3938esac])dnl
3939$1="$ac_cv_path_$1"
3940if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
3941 AC_MSG_RESULT([$]$1)
3942else
3943 AC_MSG_RESULT(no)
3944fi
3945AC_SUBST($1)dnl
3946])
3947# stdint_h.m4 serial 3 (gettext-0.12)
3948dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3949dnl This file is free software, distributed under the terms of the GNU
3950dnl General Public License. As a special exception to the GNU General
3951dnl Public License, this file may be distributed as part of a program
3952dnl that contains a configuration script generated by Autoconf, under
3953dnl the same distribution terms as the rest of that program.
3954
3955dnl From Paul Eggert.
3956
3957# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
3958# doesn't clash with <sys/types.h>, and declares uintmax_t.
3959
3960AC_DEFUN([jm_AC_HEADER_STDINT_H],
3961[
3962 AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
3963 [AC_TRY_COMPILE(
3964 [#include <sys/types.h>
3965#include <stdint.h>],
3966 [uintmax_t i = (uintmax_t) -1;],
3967 jm_ac_cv_header_stdint_h=yes,
3968 jm_ac_cv_header_stdint_h=no)])
3969 if test $jm_ac_cv_header_stdint_h = yes; then
3970 AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
3971 [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
3972 and declares uintmax_t. ])
3973 fi
3974])
3975# uintmax_t.m4 serial 7 (gettext-0.12)
3976dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3977dnl This file is free software, distributed under the terms of the GNU
3978dnl General Public License. As a special exception to the GNU General
3979dnl Public License, this file may be distributed as part of a program
3980dnl that contains a configuration script generated by Autoconf, under
3981dnl the same distribution terms as the rest of that program.
3982
3983dnl From Paul Eggert.
3984
3985AC_PREREQ(2.13)
3986
3987# Define uintmax_t to 'unsigned long' or 'unsigned long long'
3988# if it is not already defined in <stdint.h> or <inttypes.h>.
3989
3990AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
3991[
3992 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
3993 AC_REQUIRE([jm_AC_HEADER_STDINT_H])
3994 if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
3995 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3996 test $ac_cv_type_unsigned_long_long = yes \
3997 && ac_type='unsigned long long' \
3998 || ac_type='unsigned long'
3999 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
4000 [Define to unsigned long or unsigned long long
4001 if <stdint.h> and <inttypes.h> don't define.])
4002 else
4003 AC_DEFINE(HAVE_UINTMAX_T, 1,
4004 [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
4005 fi
4006])
4007# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40)
4008dnl Copyright (C) 1999-2002 Free Software Foundation, Inc.
4009dnl This file is free software, distributed under the terms of the GNU
4010dnl General Public License. As a special exception to the GNU General
4011dnl Public License, this file may be distributed as part of a program
4012dnl that contains a configuration script generated by Autoconf, under
4013dnl the same distribution terms as the rest of that program.
4014
4015dnl From Paul Eggert.
4016
4017AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
4018[
4019 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
4020 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
4021 [unsigned long long ullmax = (unsigned long long) -1;
4022 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
4023 ac_cv_type_unsigned_long_long=yes,
4024 ac_cv_type_unsigned_long_long=no)])
4025 if test $ac_cv_type_unsigned_long_long = yes; then
4026 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
4027 [Define if you have the unsigned long long type.])
4028 fi
4029])
3185942a
JA
4030
4031dnl From gnulib
4032AC_DEFUN([BASH_FUNC_FPURGE],
4033[
4034 AC_CHECK_FUNCS_ONCE([fpurge])
4035 AC_CHECK_FUNCS_ONCE([__fpurge])
4036 AC_CHECK_DECLS([fpurge], , , [#include <stdio.h>])
4037])
0001803f
CR
4038
4039AC_DEFUN([BASH_FUNC_SNPRINTF],
4040[
4041 AC_CHECK_FUNCS_ONCE([snprintf])
4042 if test X$ac_cv_func_snprintf = Xyes; then
4043 AC_CACHE_CHECK([for standard-conformant snprintf], [bash_cv_func_snprintf],
4044 [AC_TRY_RUN([
4045#include <stdio.h>
4046
4047main()
4048{
4049 int n;
4050 n = snprintf (0, 0, "%s", "0123456");
4051 exit(n != 7);
4052}
4053], bash_cv_func_snprintf=yes, bash_cv_func_snprintf=no,
4054 [AC_MSG_WARN([cannot check standard snprintf if cross-compiling])
4055 bash_cv_func_snprintf=yes]
4056)])
4057 if test $bash_cv_func_snprintf = no; then
4058 ac_cv_func_snprintf=no
4059 fi
4060 fi
4061 if test $ac_cv_func_snprintf = no; then
4062 AC_DEFINE(HAVE_SNPRINTF, 0,
4063 [Define if you have a standard-conformant snprintf function.])
4064 fi
4065])
4066
4067AC_DEFUN([BASH_FUNC_VSNPRINTF],
4068[
4069 AC_CHECK_FUNCS_ONCE([vsnprintf])
4070 if test X$ac_cv_func_vsnprintf = Xyes; then
4071 AC_CACHE_CHECK([for standard-conformant vsnprintf], [bash_cv_func_vsnprintf],
4072 [AC_TRY_RUN([
4073#if HAVE_STDARG_H
4074#include <stdarg.h>
4075#else
4076#include <varargs.h>
4077#endif
4078#include <stdio.h>
4079#include <stdlib.h>
4080
4081static int
4082#if HAVE_STDARG_H
4083foo(const char *fmt, ...)
4084#else
4085foo(format, va_alist)
4086 const char *format;
4087 va_dcl
4088#endif
4089{
4090 va_list args;
4091 int n;
4092
4093#if HAVE_STDARG_H
4094 va_start(args, fmt);
4095#else
4096 va_start(args);
4097#endif
4098 n = vsnprintf(0, 0, fmt, args);
4099 va_end (args);
4100 return n;
4101}
4102
4103main()
4104{
4105 int n;
4106 n = foo("%s", "0123456");
4107 exit(n != 7);
4108}
4109], bash_cv_func_vsnprintf=yes, bash_cv_func_vsnprintf=no,
4110 [AC_MSG_WARN([cannot check standard vsnprintf if cross-compiling])
4111 bash_cv_func_vsnprintf=yes]
4112)])
4113 if test $bash_cv_func_vsnprintf = no; then
4114 ac_cv_func_vsnprintf=no
4115 fi
4116 fi
4117 if test $ac_cv_func_vsnprintf = no; then
4118 AC_DEFINE(HAVE_VSNPRINTF, 0,
4119 [Define if you have a standard-conformant vsnprintf function.])
4120 fi
4121])
495aee44
CR
4122
4123AC_DEFUN(BASH_STRUCT_WEXITSTATUS_OFFSET,
4124[AC_MSG_CHECKING(for offset of exit status in return status from wait)
4125AC_CACHE_VAL(bash_cv_wexitstatus_offset,
4126[AC_RUN_IFELSE([
4127#include <stdlib.h>
4128#include <unistd.h>
4129
4130#include <sys/wait.h>
4131
4132main(c, v)
4133 int c;
4134 char **v;
4135{
4136 pid_t pid, p;
4137 int s, i, n;
4138
4139 s = 0;
4140 pid = fork();
4141 if (pid == 0)
4142 exit (42);
4143
4144 /* wait for the process */
4145 p = wait(&s);
4146 if (p != pid)
4147 exit (255);
4148
4149 /* crack s */
4150 for (i = 0; i < (sizeof(s) - 8); i++)
4151 {
4152 n = (s >> i) & 0xff;
4153 if (n == 42)
4154 exit (i);
4155 }
4156
4157 exit (254);
4158}
4159], bash_cv_wexitstatus_offset=0, bash_cv_wexitstatus_offset=$?,
4160 [AC_MSG_WARN(cannot check WEXITSTATUS offset if cross compiling -- defaulting to 0)
4161 bash_cv_wexitstatus_offset=0]
4162)])
4163if test "$bash_cv_wexitstatus_offset" -gt 32 ; then
4164 AC_MSG_WARN(bad exit status from test program -- defaulting to 0)
4165 bash_cv_wexitstatus_offset=0
4166fi
4167AC_MSG_RESULT($bash_cv_wexitstatus_offset)
4168AC_DEFINE_UNQUOTED([WEXITSTATUS_OFFSET], [$bash_cv_wexitstatus_offset], [Offset of exit status in wait status word])
4169])