2 dnl Bash specific tests
4 dnl Some derived from PDKSH 5.1.3 autoconf tests
7 AC_DEFUN(BASH_C_LONG_LONG,
8 [AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
9 [if test "$GCC" = yes; then
17 exit(sizeof(long long) < sizeof(long));
19 ], ac_cv_c_long_long=yes, ac_cv_c_long_long=no)
21 if test $ac_cv_c_long_long = yes; then
22 AC_DEFINE(HAVE_LONG_LONG, 1, [Define if the `long long' type works.])
27 dnl This is very similar to AC_C_LONG_DOUBLE, with the fix for IRIX
28 dnl (< changed to <=) added.
30 AC_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
39 /* The Stardent Vistra knows sizeof(long double), but does not
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));
47 ], ac_cv_c_long_double=yes, ac_cv_c_long_double=no)
49 if test $ac_cv_c_long_double = yes; then
50 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if the `long double' type works.])
55 dnl Check for <inttypes.h>. This is separated out so that it can be
58 dnl BASH_HEADER_INTTYPES
59 AC_DEFUN(BASH_HEADER_INTTYPES,
61 AC_CHECK_HEADERS(inttypes.h)
65 dnl check for typedef'd symbols in header files, but allow the caller to
66 dnl specify the include files to be checked in addition to the default
68 dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND])
69 AC_DEFUN(BASH_CHECK_TYPE,
71 AC_REQUIRE([AC_HEADER_STDC])dnl
72 AC_REQUIRE([BASH_HEADER_INTTYPES])
73 AC_MSG_CHECKING(for $1)
74 AC_CACHE_VAL(bash_cv_type_$1,
75 [AC_EGREP_CPP($1, [#include <sys/types.h>
84 ], bash_cv_type_$1=yes, bash_cv_type_$1=no)])
85 AC_MSG_RESULT($bash_cv_type_$1)
86 ifelse($#, 4, [if test $bash_cv_type_$1 = yes; then
89 if test $bash_cv_type_$1 = no; then
90 AC_DEFINE_UNQUOTED($1, $3)
95 dnl BASH_CHECK_DECL(FUNC)
97 dnl Check for a declaration of FUNC in stdlib.h and inttypes.h like
100 AC_DEFUN(BASH_CHECK_DECL,
102 AC_REQUIRE([AC_HEADER_STDC])
103 AC_REQUIRE([BASH_HEADER_INTTYPES])
104 AC_CACHE_CHECK([for declaration of $1], bash_cv_decl_$1,
111 # include <inttypes.h>
115 bash_cv_decl_$1=yes, bash_cv_decl_$1=no)])
116 bash_tr_func=HAVE_DECL_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
117 if test $bash_cv_decl_$1 = yes; then
118 AC_DEFINE_UNQUOTED($bash_tr_func, 1)
120 AC_DEFINE_UNQUOTED($bash_tr_func, 0)
124 AC_DEFUN(BASH_DECL_PRINTF,
125 [AC_MSG_CHECKING(for declaration of printf in <stdio.h>)
126 AC_CACHE_VAL(bash_cv_printf_declared,
130 typedef int (*_bashfunc)(const char *, ...);
132 typedef int (*_bashfunc)();
137 pf = (_bashfunc) printf;
140 ], bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
141 [AC_MSG_WARN(cannot check printf declaration if cross compiling -- defaulting to yes)
142 bash_cv_printf_declared=yes]
144 AC_MSG_RESULT($bash_cv_printf_declared)
145 if test $bash_cv_printf_declared = yes; then
146 AC_DEFINE(PRINTF_DECLARED)
150 AC_DEFUN(BASH_DECL_SBRK,
151 [AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>)
152 AC_CACHE_VAL(bash_cv_sbrk_declared,
153 [AC_EGREP_HEADER(sbrk, unistd.h,
154 bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)])
155 AC_MSG_RESULT($bash_cv_sbrk_declared)
156 if test $bash_cv_sbrk_declared = yes; then
157 AC_DEFINE(SBRK_DECLARED)
162 dnl Check for sys_siglist[] or _sys_siglist[]
164 AC_DEFUN(BASH_DECL_UNDER_SYS_SIGLIST,
165 [AC_MSG_CHECKING([for _sys_siglist in signal.h or unistd.h])
166 AC_CACHE_VAL(bash_cv_decl_under_sys_siglist,
168 #include <sys/types.h>
172 #endif], [ char *msg = _sys_siglist[2]; ],
173 bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no,
174 [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl
175 AC_MSG_RESULT($bash_cv_decl_under_sys_siglist)
176 if test $bash_cv_decl_under_sys_siglist = yes; then
177 AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED)
181 AC_DEFUN(BASH_UNDER_SYS_SIGLIST,
182 [AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
183 AC_MSG_CHECKING([for _sys_siglist in system C library])
184 AC_CACHE_VAL(bash_cv_under_sys_siglist,
186 #include <sys/types.h>
191 #ifndef UNDER_SYS_SIGLIST_DECLARED
192 extern char *_sys_siglist[];
196 char *msg = (char *)_sys_siglist[2];
199 bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
200 [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)
201 bash_cv_under_sys_siglist=no])])
202 AC_MSG_RESULT($bash_cv_under_sys_siglist)
203 if test $bash_cv_under_sys_siglist = yes; then
204 AC_DEFINE(HAVE_UNDER_SYS_SIGLIST)
208 AC_DEFUN(BASH_SYS_SIGLIST,
209 [AC_REQUIRE([AC_DECL_SYS_SIGLIST])
210 AC_MSG_CHECKING([for sys_siglist in system C library])
211 AC_CACHE_VAL(bash_cv_sys_siglist,
213 #include <sys/types.h>
218 #ifndef SYS_SIGLIST_DECLARED
219 extern char *sys_siglist[];
223 char *msg = sys_siglist[2];
226 bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no,
227 [AC_MSG_WARN(cannot check for sys_siglist if cross compiling -- defaulting to no)
228 bash_cv_sys_siglist=no])])
229 AC_MSG_RESULT($bash_cv_sys_siglist)
230 if test $bash_cv_sys_siglist = yes; then
231 AC_DEFINE(HAVE_SYS_SIGLIST)
235 dnl Check for the various permutations of sys_siglist and make sure we
236 dnl compile in siglist.o if they're not defined
237 AC_DEFUN(BASH_CHECK_SYS_SIGLIST, [
238 AC_REQUIRE([BASH_SYS_SIGLIST])
239 AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
240 AC_REQUIRE([BASH_FUNC_STRSIGNAL])
241 if test "$bash_cv_sys_siglist" = no && test "$bash_cv_under_sys_siglist" = no && test "$bash_cv_have_strsignal" = no; then
246 AC_SUBST([SIGLIST_O])
249 dnl Check for sys_errlist[] and sys_nerr, check for declaration
250 AC_DEFUN(BASH_SYS_ERRLIST,
251 [AC_MSG_CHECKING([for sys_errlist and sys_nerr])
252 AC_CACHE_VAL(bash_cv_sys_errlist,
253 [AC_TRY_LINK([#include <errno.h>],
254 [extern char *sys_errlist[];
256 char *msg = sys_errlist[sys_nerr - 1];],
257 bash_cv_sys_errlist=yes, bash_cv_sys_errlist=no)])dnl
258 AC_MSG_RESULT($bash_cv_sys_errlist)
259 if test $bash_cv_sys_errlist = yes; then
260 AC_DEFINE(HAVE_SYS_ERRLIST)
265 dnl Check if dup2() does not clear the close on exec flag
267 AC_DEFUN(BASH_FUNC_DUP2_CLOEXEC_CHECK,
268 [AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag)
269 AC_CACHE_VAL(bash_cv_dup2_broken,
271 #include <sys/types.h>
276 fd1 = open("/dev/null", 2);
277 if (fcntl(fd1, 2, 1) < 0)
282 fl = fcntl(fd2, 1, 0);
283 /* fl will be 1 if dup2 did not reset the close-on-exec flag. */
286 ], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no,
287 [AC_MSG_WARN(cannot check dup2 if cross compiling -- defaulting to no)
288 bash_cv_dup2_broken=no])
290 AC_MSG_RESULT($bash_cv_dup2_broken)
291 if test $bash_cv_dup2_broken = yes; then
292 AC_DEFINE(DUP2_BROKEN)
296 AC_DEFUN(BASH_FUNC_STRSIGNAL,
297 [AC_MSG_CHECKING([for the existence of strsignal])
298 AC_CACHE_VAL(bash_cv_have_strsignal,
299 [AC_TRY_LINK([#include <sys/types.h>
300 #include <signal.h>],
301 [char *s = (char *)strsignal(2);],
302 bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)])
303 AC_MSG_RESULT($bash_cv_have_strsignal)
304 if test $bash_cv_have_strsignal = yes; then
305 AC_DEFINE(HAVE_STRSIGNAL)
309 dnl Check to see if opendir will open non-directories (not a nice thing)
310 AC_DEFUN(BASH_FUNC_OPENDIR_CHECK,
311 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
312 AC_MSG_CHECKING(if opendir() opens non-directories)
313 AC_CACHE_VAL(bash_cv_opendir_not_robust,
316 #include <sys/types.h>
320 #endif /* HAVE_UNISTD_H */
321 #if defined(HAVE_DIRENT_H)
324 # define dirent direct
325 # ifdef HAVE_SYS_NDIR_H
326 # include <sys/ndir.h>
327 # endif /* SYSNDIR */
328 # ifdef HAVE_SYS_DIR_H
329 # include <sys/dir.h>
334 #endif /* HAVE_DIRENT_H */
339 err = mkdir("/tmp/bash-aclocal", 0700);
344 unlink("/tmp/bash-aclocal/not_a_directory");
345 fd = open("/tmp/bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666);
348 dir = opendir("/tmp/bash-aclocal/not_a_directory");
349 unlink("/tmp/bash-aclocal/not_a_directory");
350 rmdir("/tmp/bash-aclocal");
352 }], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
353 [AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
354 bash_cv_opendir_not_robust=no]
356 AC_MSG_RESULT($bash_cv_opendir_not_robust)
357 if test $bash_cv_opendir_not_robust = yes; then
358 AC_DEFINE(OPENDIR_NOT_ROBUST)
363 AC_DEFUN(BASH_TYPE_SIGHANDLER,
364 [AC_MSG_CHECKING([whether signal handlers are of type void])
365 AC_CACHE_VAL(bash_cv_void_sighandler,
366 [AC_TRY_COMPILE([#include <sys/types.h>
374 void (*signal ()) ();],
375 [int i;], bash_cv_void_sighandler=yes, bash_cv_void_sighandler=no)])dnl
376 AC_MSG_RESULT($bash_cv_void_sighandler)
377 if test $bash_cv_void_sighandler = yes; then
378 AC_DEFINE(VOID_SIGHANDLER)
383 dnl A signed 16-bit integer quantity
385 AC_DEFUN(BASH_TYPE_BITS16_T,
387 if test "$ac_cv_sizeof_short" = 2; then
388 AC_CHECK_TYPE(bits16_t, short)
389 elif test "$ac_cv_sizeof_char" = 2; then
390 AC_CHECK_TYPE(bits16_t, char)
392 AC_CHECK_TYPE(bits16_t, short)
397 dnl An unsigned 16-bit integer quantity
399 AC_DEFUN(BASH_TYPE_U_BITS16_T,
401 if test "$ac_cv_sizeof_short" = 2; then
402 AC_CHECK_TYPE(u_bits16_t, unsigned short)
403 elif test "$ac_cv_sizeof_char" = 2; then
404 AC_CHECK_TYPE(u_bits16_t, unsigned char)
406 AC_CHECK_TYPE(u_bits16_t, unsigned short)
411 dnl A signed 32-bit integer quantity
413 AC_DEFUN(BASH_TYPE_BITS32_T,
415 if test "$ac_cv_sizeof_int" = 4; then
416 AC_CHECK_TYPE(bits32_t, int)
417 elif test "$ac_cv_sizeof_long" = 4; then
418 AC_CHECK_TYPE(bits32_t, long)
420 AC_CHECK_TYPE(bits32_t, int)
425 dnl An unsigned 32-bit integer quantity
427 AC_DEFUN(BASH_TYPE_U_BITS32_T,
429 if test "$ac_cv_sizeof_int" = 4; then
430 AC_CHECK_TYPE(u_bits32_t, unsigned int)
431 elif test "$ac_cv_sizeof_long" = 4; then
432 AC_CHECK_TYPE(u_bits32_t, unsigned long)
434 AC_CHECK_TYPE(u_bits32_t, unsigned int)
438 AC_DEFUN(BASH_TYPE_PTRDIFF_T,
440 if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then
441 AC_CHECK_TYPE(ptrdiff_t, int)
442 elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then
443 AC_CHECK_TYPE(ptrdiff_t, long)
444 elif test "$ac_cv_type_long_long" = yes && test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_char_p"; then
445 AC_CHECK_TYPE(ptrdiff_t, [long long])
447 AC_CHECK_TYPE(ptrdiff_t, int)
452 dnl A signed 64-bit quantity
454 AC_DEFUN(BASH_TYPE_BITS64_T,
456 if test "$ac_cv_sizeof_char_p" = 8; then
457 AC_CHECK_TYPE(bits64_t, char *)
458 elif test "$ac_cv_sizeof_double" = 8; then
459 AC_CHECK_TYPE(bits64_t, double)
460 elif test -n "$ac_cv_type_long_long" && test "$ac_cv_sizeof_long_long" = 8; then
461 AC_CHECK_TYPE(bits64_t, [long long])
462 elif test "$ac_cv_sizeof_long" = 8; then
463 AC_CHECK_TYPE(bits64_t, long)
465 AC_CHECK_TYPE(bits64_t, double)
469 AC_DEFUN(BASH_TYPE_LONG_LONG,
471 AC_CACHE_CHECK([for long long], bash_cv_type_long_long,
473 long long ll = 1; int i = 63;],
475 long long llm = (long long) -1;
476 return ll << i | ll >> i | llm / ll | llm % ll;
477 ], bash_cv_type_long_long='long long', bash_cv_type_long_long='long')])
478 if test "$bash_cv_type_long_long" = 'long long'; then
479 AC_DEFINE(HAVE_LONG_LONG, 1)
483 AC_DEFUN(BASH_TYPE_UNSIGNED_LONG_LONG,
485 AC_CACHE_CHECK([for unsigned long long], bash_cv_type_unsigned_long_long,
487 unsigned long long ull = 1; int i = 63;],
489 unsigned long long ullmax = (unsigned long long) -1;
490 return ull << i | ull >> i | ullmax / ull | ullmax % ull;
491 ], bash_cv_type_unsigned_long_long='unsigned long long',
492 bash_cv_type_unsigned_long_long='unsigned long')])
493 if test "$bash_cv_type_unsigned_long_long" = 'unsigned long long'; then
494 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1)
499 dnl Type of struct rlimit fields: some systems (OSF/1, NetBSD, RISC/os 5.0)
500 dnl have a rlim_t, others (4.4BSD based systems) use quad_t, others use
501 dnl long and still others use int (HP-UX 9.01, SunOS 4.1.3). To simplify
502 dnl matters, this just checks for rlim_t, quad_t, or long.
504 AC_DEFUN(BASH_TYPE_RLIMIT,
505 [AC_MSG_CHECKING(for size and type of struct rlimit fields)
506 AC_CACHE_VAL(bash_cv_type_rlimit,
507 [AC_TRY_COMPILE([#include <sys/types.h>
508 #include <sys/resource.h>],
509 [rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[
511 #include <sys/types.h>
512 #include <sys/time.h>
513 #include <sys/resource.h>
518 if (sizeof(rl.rlim_cur) == sizeof(quad_t))
522 }], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long,
523 [AC_MSG_WARN(cannot check quad_t if cross compiling -- defaulting to long)
524 bash_cv_type_rlimit=long])])
526 AC_MSG_RESULT($bash_cv_type_rlimit)
527 if test $bash_cv_type_rlimit = quad_t; then
528 AC_DEFINE(RLIMTYPE, quad_t)
529 elif test $bash_cv_type_rlimit = rlim_t; then
530 AC_DEFINE(RLIMTYPE, rlim_t)
534 AC_DEFUN(BASH_FUNC_LSTAT,
535 [dnl Cannot use AC_CHECK_FUNCS(lstat) because Linux defines lstat() as an
536 dnl inline function in <sys/stat.h>.
537 AC_CACHE_CHECK([for lstat], bash_cv_func_lstat,
539 #include <sys/types.h>
540 #include <sys/stat.h>
541 ],[ lstat(".",(struct stat *)0); ],
542 bash_cv_func_lstat=yes, bash_cv_func_lstat=no)])
543 if test $bash_cv_func_lstat = yes; then
544 AC_DEFINE(HAVE_LSTAT)
548 AC_DEFUN(BASH_FUNC_INET_ATON,
550 AC_CACHE_CHECK([for inet_aton], bash_cv_func_inet_aton,
552 #include <sys/types.h>
553 #include <netinet/in.h>
554 #include <arpa/inet.h>
555 struct in_addr ap;], [ inet_aton("127.0.0.1", &ap); ],
556 bash_cv_func_inet_aton=yes, bash_cv_func_inet_aton=no)])
557 if test $bash_cv_func_inet_aton = yes; then
558 AC_DEFINE(HAVE_INET_ATON)
564 AC_DEFUN(BASH_FUNC_GETENV,
565 [AC_MSG_CHECKING(to see if getenv can be redefined)
566 AC_CACHE_VAL(bash_cv_getenv_redef,
578 #if defined (__linux__) || defined (__bsdi__) || defined (convex)
582 #endif /* !__linux__ && !__bsdi__ && !convex */
589 /* The next allows this program to run, but does not allow bash to link
590 when it redefines getenv. I'm not really interested in figuring out
596 exit(s == 0); /* force optimizer to leave getenv in */
598 ], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no,
599 [AC_MSG_WARN(cannot check getenv redefinition if cross compiling -- defaulting to yes)
600 bash_cv_getenv_redef=yes]
602 AC_MSG_RESULT($bash_cv_getenv_redef)
603 if test $bash_cv_getenv_redef = yes; then
604 AC_DEFINE(CAN_REDEFINE_GETENV)
608 # We should check for putenv before calling this
609 AC_DEFUN(BASH_FUNC_STD_PUTENV,
611 AC_REQUIRE([AC_HEADER_STDC])
612 AC_REQUIRE([AC_C_PROTOTYPES])
613 AC_CACHE_CHECK([for standard-conformant putenv declaration], bash_cv_std_putenv,
625 extern int putenv (char *);
627 extern int putenv ();
630 [return (putenv == 0);],
631 bash_cv_std_putenv=yes, bash_cv_std_putenv=no
633 if test $bash_cv_std_putenv = yes; then
634 AC_DEFINE(HAVE_STD_PUTENV)
638 # We should check for unsetenv before calling this
639 AC_DEFUN(BASH_FUNC_STD_UNSETENV,
641 AC_REQUIRE([AC_HEADER_STDC])
642 AC_REQUIRE([AC_C_PROTOTYPES])
643 AC_CACHE_CHECK([for standard-conformant unsetenv declaration], bash_cv_std_unsetenv,
655 extern int unsetenv (const char *);
657 extern int unsetenv ();
660 [return (unsetenv == 0);],
661 bash_cv_std_unsetenv=yes, bash_cv_std_unsetenv=no
663 if test $bash_cv_std_unsetenv = yes; then
664 AC_DEFINE(HAVE_STD_UNSETENV)
668 AC_DEFUN(BASH_FUNC_ULIMIT_MAXFDS,
669 [AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize)
670 AC_CACHE_VAL(bash_cv_ulimit_maxfds,
674 long maxfds = ulimit(4, 0L);
675 exit (maxfds == -1L);
677 ], bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
678 [AC_MSG_WARN(cannot check ulimit if cross compiling -- defaulting to no)
679 bash_cv_ulimit_maxfds=no]
681 AC_MSG_RESULT($bash_cv_ulimit_maxfds)
682 if test $bash_cv_ulimit_maxfds = yes; then
683 AC_DEFINE(ULIMIT_MAXFDS)
687 AC_DEFUN(BASH_FUNC_GETCWD,
688 [AC_MSG_CHECKING([if getcwd() will dynamically allocate memory])
689 AC_CACHE_VAL(bash_cv_getcwd_malloc,
702 ], bash_cv_getcwd_malloc=yes, bash_cv_getcwd_malloc=no,
703 [AC_MSG_WARN(cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no)
704 bash_cv_getcwd_malloc=no]
706 AC_MSG_RESULT($bash_cv_getcwd_malloc)
707 if test $bash_cv_getcwd_malloc = no; then
708 AC_DEFINE(GETCWD_BROKEN)
714 dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every
715 dnl system, we can't use AC_PREREQ
717 AC_DEFUN(BASH_FUNC_GETHOSTBYNAME,
718 [if test "X$bash_cv_have_gethostbyname" = "X"; then
721 AC_MSG_CHECKING(for gethostbyname in socket library)
724 AC_CACHE_VAL(bash_cv_have_gethostbyname,
725 [AC_TRY_LINK([#include <netdb.h>],
726 [ struct hostent *hp;
727 hp = gethostbyname("localhost");
728 ], bash_cv_have_gethostbyname=yes, bash_cv_have_gethostbyname=no)]
730 if test "X$_bash_needmsg" = Xyes; then
731 AC_MSG_CHECKING(for gethostbyname in socket library)
733 AC_MSG_RESULT($bash_cv_have_gethostbyname)
734 if test "$bash_cv_have_gethostbyname" = yes; then
735 AC_DEFINE(HAVE_GETHOSTBYNAME)
739 AC_DEFUN(BASH_FUNC_FNMATCH_EXTMATCH,
740 [AC_MSG_CHECKING(if fnmatch does extended pattern matching with FNM_EXTMATCH)
741 AC_CACHE_VAL(bash_cv_fnm_extmatch,
753 ], bash_cv_fnm_extmatch=yes, bash_cv_fnm_extmatch=no,
754 [AC_MSG_WARN(cannot check FNM_EXTMATCH if cross compiling -- defaulting to no)
755 bash_cv_fnm_extmatch=no])
757 AC_MSG_RESULT($bash_cv_fnm_extmatch)
758 if test $bash_cv_fnm_extmatch = yes; then
759 AC_DEFINE(HAVE_LIBC_FNM_EXTMATCH)
763 AC_DEFUN(BASH_FUNC_POSIX_SETJMP,
764 [AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
765 AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp)
766 AC_CACHE_VAL(bash_cv_func_sigsetjmp,
771 #include <sys/types.h>
777 #if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
788 sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set);
789 sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
792 code = sigsetjmp(xx, 1);
794 exit(0); /* could get sigmask and compare to oset here. */
797 sigaddset(&set, SIGINT);
798 sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
804 }], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
805 [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing)
806 bash_cv_func_sigsetjmp=missing]
808 AC_MSG_RESULT($bash_cv_func_sigsetjmp)
809 if test $bash_cv_func_sigsetjmp = present; then
810 AC_DEFINE(HAVE_POSIX_SIGSETJMP)
814 AC_DEFUN(BASH_FUNC_STRCOLL,
816 AC_MSG_CHECKING(whether or not strcoll and strcmp differ)
817 AC_CACHE_VAL(bash_cv_func_strcoll_broken,
820 #if defined (HAVE_LOCALE_H)
829 char *deflocale, *defcoll;
831 #ifdef HAVE_SETLOCALE
832 deflocale = setlocale(LC_ALL, "");
833 defcoll = setlocale(LC_COLLATE, "");
837 /* These two values are taken from tests/glob-test. */
838 r1 = strcoll("abd", "aXd");
842 r2 = strcmp("abd", "aXd");
844 /* These two should both be greater than 0. It is permissible for
845 a system to return different values, as long as the sign is the
848 /* Exit with 1 (failure) if these two values are both > 0, since
849 this tests whether strcoll(3) is broken with respect to strcmp(3)
850 in the default locale. */
851 exit (r1 > 0 && r2 > 0);
853 ], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
854 [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no)
855 bash_cv_func_strcoll_broken=no]
857 AC_MSG_RESULT($bash_cv_func_strcoll_broken)
858 if test $bash_cv_func_strcoll_broken = yes; then
859 AC_DEFINE(STRCOLL_BROKEN)
863 AC_DEFUN(BASH_FUNC_PRINTF_A_FORMAT,
864 [AC_MSG_CHECKING([for printf floating point output in hex notation])
865 AC_CACHE_VAL(bash_cv_printf_a_format,
876 sprintf(abuf, "%A", y);
877 exit(strchr(abuf, 'P') == (char *)0);
879 ], bash_cv_printf_a_format=yes, bash_cv_printf_a_format=no,
880 [AC_MSG_WARN(cannot check printf if cross compiling -- defaulting to no)
881 bash_cv_printf_a_format=no]
883 AC_MSG_RESULT($bash_cv_printf_a_format)
884 if test $bash_cv_printf_a_format = yes; then
885 AC_DEFINE(HAVE_PRINTF_A_FORMAT)
889 AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC,
891 AC_CHECK_MEMBER(struct termios.c_line, AC_DEFINE(TERMIOS_LDISC), ,[
892 #include <sys/types.h>
897 AC_DEFUN(BASH_STRUCT_TERMIO_LDISC,
899 AC_CHECK_MEMBER(struct termio.c_line, AC_DEFINE(TERMIO_LDISC), ,[
900 #include <sys/types.h>
906 dnl Like AC_STRUCT_ST_BLOCKS, but doesn't muck with LIBOBJS
908 dnl sets bash_cv_struct_stat_st_blocks
910 dnl unused for now; we'll see how AC_CHECK_MEMBERS works
912 AC_DEFUN(BASH_STRUCT_ST_BLOCKS,
914 AC_MSG_CHECKING([for struct stat.st_blocks])
915 AC_CACHE_VAL(bash_cv_struct_stat_st_blocks,
918 #include <sys/types.h>
919 #include <sys/stat.h>
924 static struct stat a;
925 if (a.st_blocks) return 0;
928 ], bash_cv_struct_stat_st_blocks=yes, bash_cv_struct_stat_st_blocks=no)
930 AC_MSG_RESULT($bash_cv_struct_stat_st_blocks)
931 if test "$bash_cv_struct_stat_st_blocks" = "yes"; then
932 AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS)
936 AC_DEFUN(BASH_CHECK_LIB_TERMCAP,
938 if test "X$bash_cv_termcap_lib" = "X"; then
941 AC_MSG_CHECKING(which library has the termcap functions)
944 AC_CACHE_VAL(bash_cv_termcap_lib,
945 [AC_CHECK_FUNC(tgetent, bash_cv_termcap_lib=libc,
946 [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
947 [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo,
948 [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
949 [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
950 bash_cv_termcap_lib=gnutermcap)])])])])])
951 if test "X$_bash_needmsg" = "Xyes"; then
952 AC_MSG_CHECKING(which library has the termcap functions)
954 AC_MSG_RESULT(using $bash_cv_termcap_lib)
955 if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
956 LDFLAGS="$LDFLAGS -L./lib/termcap"
957 TERMCAP_LIB="./lib/termcap/libtermcap.a"
958 TERMCAP_DEP="./lib/termcap/libtermcap.a"
959 elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
960 TERMCAP_LIB=-ltermcap
962 elif test $bash_cv_termcap_lib = libtinfo; then
965 elif test $bash_cv_termcap_lib = libncurses; then
966 TERMCAP_LIB=-lncurses
968 elif test $bash_cv_termcap_lib = libc; then
978 dnl Check for the presence of getpeername in libsocket.
979 dnl If libsocket is present, check for libnsl and add it to LIBS if
980 dnl it's there, since most systems with libsocket require linking
981 dnl with libnsl as well. This should only be called if getpeername
982 dnl was not found in libc.
984 dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT
987 AC_DEFUN(BASH_CHECK_LIB_SOCKET,
989 if test "X$bash_cv_have_socklib" = "X"; then
992 AC_MSG_CHECKING(for socket library)
995 AC_CACHE_VAL(bash_cv_have_socklib,
996 [AC_CHECK_LIB(socket, getpeername,
997 bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)])
998 if test "X$_bash_needmsg" = Xyes; then
999 AC_MSG_RESULT($bash_cv_have_socklib)
1002 if test $bash_cv_have_socklib = yes; then
1003 # check for libnsl, add it to LIBS if present
1004 if test "X$bash_cv_have_libnsl" = "X"; then
1007 AC_MSG_CHECKING(for libnsl)
1010 AC_CACHE_VAL(bash_cv_have_libnsl,
1011 [AC_CHECK_LIB(nsl, t_open,
1012 bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)])
1013 if test "X$_bash_needmsg" = Xyes; then
1014 AC_MSG_RESULT($bash_cv_have_libnsl)
1017 if test $bash_cv_have_libnsl = yes; then
1018 LIBS="-lsocket -lnsl $LIBS"
1020 LIBS="-lsocket $LIBS"
1022 AC_DEFINE(HAVE_LIBSOCKET)
1023 AC_DEFINE(HAVE_GETPEERNAME)
1027 AC_DEFUN(BASH_STRUCT_DIRENT_D_INO,
1028 [AC_REQUIRE([AC_HEADER_DIRENT])
1029 AC_MSG_CHECKING(for struct dirent.d_ino)
1030 AC_CACHE_VAL(bash_cv_dirent_has_dino,
1033 #include <sys/types.h>
1034 #ifdef HAVE_UNISTD_H
1035 # include <unistd.h>
1036 #endif /* HAVE_UNISTD_H */
1037 #if defined(HAVE_DIRENT_H)
1038 # include <dirent.h>
1040 # define dirent direct
1041 # ifdef HAVE_SYS_NDIR_H
1042 # include <sys/ndir.h>
1043 # endif /* SYSNDIR */
1044 # ifdef HAVE_SYS_DIR_H
1045 # include <sys/dir.h>
1046 # endif /* SYSDIR */
1050 #endif /* HAVE_DIRENT_H */
1052 struct dirent d; int z; z = d.d_ino;
1053 ], bash_cv_dirent_has_dino=yes, bash_cv_dirent_has_dino=no)])
1054 AC_MSG_RESULT($bash_cv_dirent_has_dino)
1055 if test $bash_cv_dirent_has_dino = yes; then
1056 AC_DEFINE(HAVE_STRUCT_DIRENT_D_INO)
1060 AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO,
1061 [AC_REQUIRE([AC_HEADER_DIRENT])
1062 AC_MSG_CHECKING(for struct dirent.d_fileno)
1063 AC_CACHE_VAL(bash_cv_dirent_has_d_fileno,
1066 #include <sys/types.h>
1067 #ifdef HAVE_UNISTD_H
1068 # include <unistd.h>
1069 #endif /* HAVE_UNISTD_H */
1070 #if defined(HAVE_DIRENT_H)
1071 # include <dirent.h>
1073 # define dirent direct
1074 # ifdef HAVE_SYS_NDIR_H
1075 # include <sys/ndir.h>
1076 # endif /* SYSNDIR */
1077 # ifdef HAVE_SYS_DIR_H
1078 # include <sys/dir.h>
1079 # endif /* SYSDIR */
1083 #endif /* HAVE_DIRENT_H */
1085 struct dirent d; int z; z = d.d_fileno;
1086 ], bash_cv_dirent_has_d_fileno=yes, bash_cv_dirent_has_d_fileno=no)])
1087 AC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
1088 if test $bash_cv_dirent_has_d_fileno = yes; then
1089 AC_DEFINE(HAVE_STRUCT_DIRENT_D_FILENO)
1093 AC_DEFUN(BASH_STRUCT_DIRENT_D_NAMLEN,
1094 [AC_REQUIRE([AC_HEADER_DIRENT])
1095 AC_MSG_CHECKING(for struct dirent.d_namlen)
1096 AC_CACHE_VAL(bash_cv_dirent_has_d_namlen,
1099 #include <sys/types.h>
1100 #ifdef HAVE_UNISTD_H
1101 # include <unistd.h>
1102 #endif /* HAVE_UNISTD_H */
1103 #if defined(HAVE_DIRENT_H)
1104 # include <dirent.h>
1106 # define dirent direct
1107 # ifdef HAVE_SYS_NDIR_H
1108 # include <sys/ndir.h>
1109 # endif /* SYSNDIR */
1110 # ifdef HAVE_SYS_DIR_H
1111 # include <sys/dir.h>
1112 # endif /* SYSDIR */
1116 #endif /* HAVE_DIRENT_H */
1118 struct dirent d; int z; z = d.d_namlen;
1119 ], bash_cv_dirent_has_d_namlen=yes, bash_cv_dirent_has_d_namlen=no)])
1120 AC_MSG_RESULT($bash_cv_dirent_has_d_namlen)
1121 if test $bash_cv_dirent_has_d_namlen = yes; then
1122 AC_DEFINE(HAVE_STRUCT_DIRENT_D_NAMLEN)
1126 AC_DEFUN(BASH_STRUCT_TIMEVAL,
1127 [AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
1128 AC_CACHE_VAL(bash_cv_struct_timeval,
1130 AC_EGREP_HEADER(struct timeval, sys/time.h,
1131 bash_cv_struct_timeval=yes,
1132 AC_EGREP_HEADER(struct timeval, time.h,
1133 bash_cv_struct_timeval=yes,
1134 bash_cv_struct_timeval=no))
1136 AC_MSG_RESULT($bash_cv_struct_timeval)
1137 if test $bash_cv_struct_timeval = yes; then
1138 AC_DEFINE(HAVE_TIMEVAL)
1142 AC_DEFUN(BASH_STRUCT_TIMEZONE,
1143 [AC_MSG_CHECKING(for struct timezone in sys/time.h and time.h)
1144 AC_CACHE_VAL(bash_cv_struct_timezone,
1146 AC_EGREP_HEADER(struct timezone, sys/time.h,
1147 bash_cv_struct_timezone=yes,
1148 AC_EGREP_HEADER(struct timezone, time.h,
1149 bash_cv_struct_timezone=yes,
1150 bash_cv_struct_timezone=no))
1152 AC_MSG_RESULT($bash_cv_struct_timezone)
1153 if test $bash_cv_struct_timezone = yes; then
1154 AC_DEFINE(HAVE_STRUCT_TIMEZONE)
1158 AC_DEFUN(BASH_STRUCT_WINSIZE,
1159 [AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h)
1160 AC_CACHE_VAL(bash_cv_struct_winsize_header,
1161 [AC_TRY_COMPILE([#include <sys/types.h>
1162 #include <sys/ioctl.h>], [struct winsize x;],
1163 bash_cv_struct_winsize_header=ioctl_h,
1164 [AC_TRY_COMPILE([#include <sys/types.h>
1165 #include <termios.h>], [struct winsize x;],
1166 bash_cv_struct_winsize_header=termios_h, bash_cv_struct_winsize_header=other)
1168 if test $bash_cv_struct_winsize_header = ioctl_h; then
1169 AC_MSG_RESULT(sys/ioctl.h)
1170 AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
1171 elif test $bash_cv_struct_winsize_header = termios_h; then
1172 AC_MSG_RESULT(termios.h)
1173 AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS)
1175 AC_MSG_RESULT(not found)
1179 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
1180 AC_DEFUN(BASH_SYS_SIGNAL_VINTAGE,
1181 [AC_REQUIRE([AC_TYPE_SIGNAL])
1182 AC_MSG_CHECKING(for type of signal functions)
1183 AC_CACHE_VAL(bash_cv_signal_vintage,
1185 AC_TRY_LINK([#include <signal.h>],[
1187 struct sigaction sa;
1188 sigemptyset(&ss); sigsuspend(&ss);
1189 sigaction(SIGINT, &sa, (struct sigaction *) 0);
1190 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
1191 ], bash_cv_signal_vintage=posix,
1193 AC_TRY_LINK([#include <signal.h>], [
1194 int mask = sigmask(SIGINT);
1195 sigsetmask(mask); sigblock(mask); sigpause(mask);
1196 ], bash_cv_signal_vintage=4.2bsd,
1200 RETSIGTYPE foo() { }], [
1201 int mask = sigmask(SIGINT);
1202 sigset(SIGINT, foo); sigrelse(SIGINT);
1203 sighold(SIGINT); sigpause(SIGINT);
1204 ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7
1209 AC_MSG_RESULT($bash_cv_signal_vintage)
1210 if test "$bash_cv_signal_vintage" = posix; then
1211 AC_DEFINE(HAVE_POSIX_SIGNALS)
1212 elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
1213 AC_DEFINE(HAVE_BSD_SIGNALS)
1214 elif test "$bash_cv_signal_vintage" = svr3; then
1215 AC_DEFINE(HAVE_USG_SIGHOLD)
1219 dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process.
1220 AC_DEFUN(BASH_SYS_PGRP_SYNC,
1221 [AC_REQUIRE([AC_FUNC_GETPGRP])
1222 AC_MSG_CHECKING(whether pgrps need synchronization)
1223 AC_CACHE_VAL(bash_cv_pgrp_pipe,
1225 #ifdef HAVE_UNISTD_H
1226 # include <unistd.h>
1230 # ifdef GETPGRP_VOID
1231 # define getpgID() getpgrp()
1233 # define getpgID() getpgrp(0)
1234 # define setpgid(x,y) setpgrp(x,y)
1236 int pid1, pid2, fds[2];
1240 switch (pid1 = fork()) {
1244 setpgid(0, getpid());
1247 setpgid(pid1, pid1);
1249 sleep(2); /* let first child die */
1254 switch (pid2 = fork()) {
1259 ok = getpgID() == pid1;
1260 write(fds[1], &ok, 1);
1263 setpgid(pid2, pid1);
1266 if (read(fds[0], &ok, 1) != 1)
1272 ], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
1273 [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
1274 bash_cv_pgrp_pipe=no])
1276 AC_MSG_RESULT($bash_cv_pgrp_pipe)
1277 if test $bash_cv_pgrp_pipe = yes; then
1278 AC_DEFINE(PGRP_PIPE)
1282 AC_DEFUN(BASH_SYS_REINSTALL_SIGHANDLERS,
1283 [AC_REQUIRE([AC_TYPE_SIGNAL])
1284 AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
1285 AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
1286 AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
1289 #ifdef HAVE_UNISTD_H
1293 typedef RETSIGTYPE sigfunc();
1297 #ifdef HAVE_POSIX_SIGNALS
1299 set_signal_handler(sig, handler)
1303 struct sigaction act, oact;
1304 act.sa_handler = handler;
1306 sigemptyset (&act.sa_mask);
1307 sigemptyset (&oact.sa_mask);
1308 sigaction (sig, &act, &oact);
1309 return (oact.sa_handler);
1312 #define set_signal_handler(s, h) signal(s, h)
1325 set_signal_handler(SIGINT, sigint);
1326 kill((int)getpid(), SIGINT);
1327 kill((int)getpid(), SIGINT);
1330 ], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
1331 [AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting to no)
1332 bash_cv_must_reinstall_sighandlers=no]
1334 AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
1335 if test $bash_cv_must_reinstall_sighandlers = yes; then
1336 AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
1340 dnl check that some necessary job control definitions are present
1341 AC_DEFUN(BASH_SYS_JOB_CONTROL_MISSING,
1342 [AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
1343 AC_MSG_CHECKING(for presence of necessary job control definitions)
1344 AC_CACHE_VAL(bash_cv_job_control_missing,
1346 #include <sys/types.h>
1347 #ifdef HAVE_SYS_WAIT_H
1348 #include <sys/wait.h>
1350 #ifdef HAVE_UNISTD_H
1355 /* Add more tests in here as appropriate. */
1359 #if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS)
1363 /* signals and tty control. */
1364 #if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT)
1368 /* process control */
1369 #if !defined (WNOHANG) || !defined (WUNTRACED)
1373 /* Posix systems have tcgetpgrp and waitpid. */
1374 #if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP)
1378 #if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID)
1382 /* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */
1383 #if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3)
1388 }], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
1389 [AC_MSG_WARN(cannot check job control if cross-compiling -- defaulting to missing)
1390 bash_cv_job_control_missing=missing]
1392 AC_MSG_RESULT($bash_cv_job_control_missing)
1393 if test $bash_cv_job_control_missing = missing; then
1394 AC_DEFINE(JOB_CONTROL_MISSING)
1398 dnl check whether named pipes are present
1399 dnl this requires a previous check for mkfifo, but that is awkward to specify
1400 AC_DEFUN(BASH_SYS_NAMED_PIPES,
1401 [AC_MSG_CHECKING(for presence of named pipes)
1402 AC_CACHE_VAL(bash_cv_sys_named_pipes,
1404 #include <sys/types.h>
1405 #include <sys/stat.h>
1406 #ifdef HAVE_UNISTD_H
1410 /* Add more tests in here as appropriate. */
1415 #if defined (HAVE_MKFIFO)
1419 #if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO))
1426 err = mkdir("/tmp/bash-aclocal", 0700);
1431 fd = mknod ("/tmp/bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
1433 rmdir ("/tmp/bash-aclocal");
1437 unlink ("/tmp/bash-aclocal/sh-np-autoconf");
1438 rmdir ("/tmp/bash-aclocal");
1440 }], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
1441 [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
1442 bash_cv_sys_named_pipes=missing]
1444 AC_MSG_RESULT($bash_cv_sys_named_pipes)
1445 if test $bash_cv_sys_named_pipes = missing; then
1446 AC_DEFINE(NAMED_PIPES_MISSING)
1450 AC_DEFUN(BASH_SYS_DEFAULT_MAIL_DIR,
1451 [AC_MSG_CHECKING(for default mail directory)
1452 AC_CACHE_VAL(bash_cv_mail_dir,
1453 [if test -d /var/mail; then
1454 bash_cv_mail_dir=/var/mail
1455 elif test -d /var/spool/mail; then
1456 bash_cv_mail_dir=/var/spool/mail
1457 elif test -d /usr/mail; then
1458 bash_cv_mail_dir=/usr/mail
1459 elif test -d /usr/spool/mail; then
1460 bash_cv_mail_dir=/usr/spool/mail
1462 bash_cv_mail_dir=unknown
1465 AC_MSG_RESULT($bash_cv_mail_dir)
1466 AC_DEFINE_UNQUOTED(DEFAULT_MAIL_DIRECTORY, "$bash_cv_mail_dir")
1469 AC_DEFUN(BASH_HAVE_TIOCGWINSZ,
1470 [AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
1471 AC_CACHE_VAL(bash_cv_tiocgwinsz_in_ioctl,
1472 [AC_TRY_COMPILE([#include <sys/types.h>
1473 #include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
1474 bash_cv_tiocgwinsz_in_ioctl=yes,bash_cv_tiocgwinsz_in_ioctl=no)])
1475 AC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl)
1476 if test $bash_cv_tiocgwinsz_in_ioctl = yes; then
1477 AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
1481 AC_DEFUN(BASH_HAVE_TIOCSTAT,
1482 [AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
1483 AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl,
1484 [AC_TRY_COMPILE([#include <sys/types.h>
1485 #include <sys/ioctl.h>], [int x = TIOCSTAT;],
1486 bash_cv_tiocstat_in_ioctl=yes,bash_cv_tiocstat_in_ioctl=no)])
1487 AC_MSG_RESULT($bash_cv_tiocstat_in_ioctl)
1488 if test $bash_cv_tiocstat_in_ioctl = yes; then
1489 AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL)
1493 AC_DEFUN(BASH_HAVE_FIONREAD,
1494 [AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
1495 AC_CACHE_VAL(bash_cv_fionread_in_ioctl,
1496 [AC_TRY_COMPILE([#include <sys/types.h>
1497 #include <sys/ioctl.h>], [int x = FIONREAD;],
1498 bash_cv_fionread_in_ioctl=yes,bash_cv_fionread_in_ioctl=no)])
1499 AC_MSG_RESULT($bash_cv_fionread_in_ioctl)
1500 if test $bash_cv_fionread_in_ioctl = yes; then
1501 AC_DEFINE(FIONREAD_IN_SYS_IOCTL)
1506 dnl See if speed_t is declared in <sys/types.h>. Some versions of linux
1507 dnl require a definition of speed_t each time <termcap.h> is included,
1508 dnl but you can only get speed_t if you include <termios.h> (on some
1509 dnl versions) or <sys/types.h> (on others).
1511 AC_DEFUN(BASH_CHECK_SPEED_T,
1512 [AC_MSG_CHECKING(for speed_t in sys/types.h)
1513 AC_CACHE_VAL(bash_cv_speed_t_in_sys_types,
1514 [AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;],
1515 bash_cv_speed_t_in_sys_types=yes,bash_cv_speed_t_in_sys_types=no)])
1516 AC_MSG_RESULT($bash_cv_speed_t_in_sys_types)
1517 if test $bash_cv_speed_t_in_sys_types = yes; then
1518 AC_DEFINE(SPEED_T_IN_SYS_TYPES)
1522 AC_DEFUN(BASH_CHECK_GETPW_FUNCS,
1523 [AC_MSG_CHECKING(whether getpw functions are declared in pwd.h)
1524 AC_CACHE_VAL(bash_cv_getpw_declared,
1525 [AC_EGREP_CPP(getpwuid,
1527 #include <sys/types.h>
1528 #ifdef HAVE_UNISTD_H
1529 # include <unistd.h>
1533 bash_cv_getpw_declared=yes,bash_cv_getpw_declared=no)])
1534 AC_MSG_RESULT($bash_cv_getpw_declared)
1535 if test $bash_cv_getpw_declared = yes; then
1536 AC_DEFINE(HAVE_GETPW_DECLS)
1540 AC_DEFUN(BASH_CHECK_DEV_FD,
1541 [AC_MSG_CHECKING(whether /dev/fd is available)
1542 AC_CACHE_VAL(bash_cv_dev_fd,
1543 [if test -d /dev/fd && test -r /dev/fd/0 < /dev/null; then
1544 bash_cv_dev_fd=standard
1545 elif test -d /proc/self/fd && test -r /proc/self/fd/0 < /dev/null; then
1546 bash_cv_dev_fd=whacky
1548 bash_cv_dev_fd=absent
1551 AC_MSG_RESULT($bash_cv_dev_fd)
1552 if test $bash_cv_dev_fd = "standard"; then
1553 AC_DEFINE(HAVE_DEV_FD)
1554 AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/")
1555 elif test $bash_cv_dev_fd = "whacky"; then
1556 AC_DEFINE(HAVE_DEV_FD)
1557 AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/")
1561 AC_DEFUN(BASH_CHECK_DEV_STDIN,
1562 [AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
1563 AC_CACHE_VAL(bash_cv_dev_stdin,
1564 [if test -d /dev/fd && test -r /dev/stdin < /dev/null; then
1565 bash_cv_dev_stdin=present
1566 elif test -d /proc/self/fd && test -r /dev/stdin < /dev/null; then
1567 bash_cv_dev_stdin=present
1569 bash_cv_dev_stdin=absent
1572 AC_MSG_RESULT($bash_cv_dev_stdin)
1573 if test $bash_cv_dev_stdin = "present"; then
1574 AC_DEFINE(HAVE_DEV_STDIN)
1579 dnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions
1581 AC_DEFUN(BASH_CHECK_KERNEL_RLIMIT,
1582 [AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines])
1583 AC_CACHE_VAL(bash_cv_kernel_rlimit,
1585 #include <sys/types.h>
1586 #include <sys/resource.h>
1591 ], bash_cv_kernel_rlimit=no,
1593 #include <sys/types.h>
1595 #include <sys/resource.h>
1601 ], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)]
1603 AC_MSG_RESULT($bash_cv_kernel_rlimit)
1604 if test $bash_cv_kernel_rlimit = yes; then
1605 AC_DEFINE(RLIMIT_NEEDS_KERNEL)
1610 dnl Check for 64-bit off_t -- used for malloc alignment
1612 dnl C does not allow duplicate case labels, so the compile will fail if
1613 dnl sizeof(off_t) is > 4.
1615 AC_DEFUN(BASH_CHECK_OFF_T_64,
1616 [AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64,
1618 #ifdef HAVE_UNISTD_H
1621 #include <sys/types.h>
1623 switch (0) case 0: case (sizeof (off_t) <= 4):;
1624 ], bash_cv_off_t_64=no, bash_cv_off_t_64=yes))
1625 if test $bash_cv_off_t_64 = yes; then
1626 AC_DEFINE(HAVE_OFF_T_64)
1629 AC_DEFUN(BASH_CHECK_RTSIGS,
1630 [AC_MSG_CHECKING(for unusable real-time signals due to large values)
1631 AC_CACHE_VAL(bash_cv_unusable_rtsigs,
1633 #include <sys/types.h>
1642 int n_sigs = 2 * NSIG;
1644 int rtmin = SIGRTMIN;
1649 exit(rtmin < n_sigs);
1650 }], bash_cv_unusable_rtsigs=yes, bash_cv_unusable_rtsigs=no,
1651 [AC_MSG_WARN(cannot check real-time signals if cross compiling -- defaulting to yes)
1652 bash_cv_unusable_rtsigs=yes]
1654 AC_MSG_RESULT($bash_cv_unusable_rtsigs)
1655 if test $bash_cv_unusable_rtsigs = yes; then
1656 AC_DEFINE(UNUSABLE_RT_SIGNALS)
1661 dnl check for availability of multibyte characters and functions
1663 AC_DEFUN(BASH_CHECK_MULTIBYTE,
1665 AC_CHECK_HEADERS(wctype.h)
1666 AC_CHECK_HEADERS(wchar.h)
1667 AC_CHECK_HEADERS(langinfo.h)
1669 AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
1670 AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC))
1671 AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))
1672 AC_CHECK_FUNC(wctomb, AC_DEFINE(HAVE_WCTOMB))
1673 AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
1674 AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP))
1676 AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
1678 #include <wchar.h>], [
1681 psp = (mbstate_t *)0;
1682 ], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)])
1683 if test $bash_cv_have_mbstate_t = yes; then
1684 AC_DEFINE(HAVE_MBSTATE_T)
1687 AC_CACHE_CHECK([for nl_langinfo and CODESET], bash_cv_langinfo_codeset,
1689 [#include <langinfo.h>],
1690 [char* cs = nl_langinfo(CODESET);],
1691 bash_cv_langinfo_codeset=yes, bash_cv_langinfo_codeset=no)])
1692 if test $bash_cv_langinfo_codeset = yes; then
1693 AC_DEFINE(HAVE_LANGINFO_CODESET)
1698 dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
1701 dnl BASH_CHECK_LIB_TERMCAP
1703 AC_DEFUN(RL_LIB_READLINE_VERSION,
1705 AC_REQUIRE([BASH_CHECK_LIB_TERMCAP])
1707 AC_MSG_CHECKING([version of installed readline library])
1709 # What a pain in the ass this is.
1711 # save cpp and ld options
1712 _save_CFLAGS="$CFLAGS"
1713 _save_LDFLAGS="$LDFLAGS"
1716 # Don't set ac_cv_rl_prefix if the caller has already assigned a value. This
1717 # allows the caller to do something like $_rl_prefix=$withval if the user
1718 # specifies --with-installed-readline=PREFIX as an argument to configure
1720 if test -z "$ac_cv_rl_prefix"; then
1721 test "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix}
1724 eval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include
1725 eval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib
1727 LIBS="$LIBS -lreadline ${TERMCAP_LIB}"
1728 CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}"
1729 LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}"
1731 AC_CACHE_VAL(ac_cv_rl_version,
1734 #include <readline/readline.h>
1739 fp = fopen("conftest.rlv", "w");
1740 if (fp == 0) exit(1);
1741 fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0");
1746 ac_cv_rl_version=`cat conftest.rlv`,
1747 ac_cv_rl_version='0.0',
1748 ac_cv_rl_version='4.2')])
1750 CFLAGS="$_save_CFLAGS"
1751 LDFLAGS="$_save_LDFLAGS"
1758 case "$ac_cv_rl_version" in
1759 2*|3*|4*|5*|6*|7*|8*|9*)
1760 RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'`
1761 RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[[a-zA-Z]]*$::'`
1767 [[0-9][0-9]]) _RL_MAJOR=$RL_MAJOR ;;
1768 [[0-9]]) _RL_MAJOR=0$RL_MAJOR ;;
1774 [[0-9][0-9]]) _RL_MINOR=$RL_MINOR ;;
1775 [[0-9]]) _RL_MINOR=0$RL_MINOR ;;
1779 RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}"
1781 # Readline versions greater than 4.2 have these defines in readline.h
1783 if test $ac_cv_rl_version = '0.0' ; then
1784 AC_MSG_WARN([Could not test version of installed readline library.])
1785 elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then
1786 # set these for use by the caller
1787 RL_PREFIX=$ac_cv_rl_prefix
1788 RL_LIBDIR=$ac_cv_rl_libdir
1789 RL_INCLUDEDIR=$ac_cv_rl_includedir
1790 AC_MSG_RESULT($ac_cv_rl_version)
1793 AC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library])
1794 AC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library])
1795 AC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library])
1797 AC_SUBST(RL_VERSION)
1801 # set these for use by the caller
1802 RL_PREFIX=$ac_cv_rl_prefix
1803 RL_LIBDIR=$ac_cv_rl_libdir
1804 RL_INCLUDEDIR=$ac_cv_rl_includedir
1806 AC_MSG_RESULT($ac_cv_rl_version)
1811 AC_DEFUN(BASH_FUNC_CTYPE_NONASCII,
1813 AC_MSG_CHECKING(whether the ctype macros accept non-ascii characters)
1814 AC_CACHE_VAL(bash_cv_func_ctype_nonascii,
1816 #ifdef HAVE_LOCALE_H
1830 #ifdef HAVE_SETLOCALE
1831 /* We take a shot here. If that locale is not known, try the
1832 system default. We try this one because '\342' (226) is
1833 known to be a printable character in that locale. */
1834 deflocale = setlocale(LC_ALL, "en_US.ISO8859-1");
1836 deflocale = setlocale(LC_ALL, "");
1843 exit (r1 == 0 || r2 == 0);
1845 ], bash_cv_func_ctype_nonascii=yes, bash_cv_func_ctype_nonascii=no,
1846 [AC_MSG_WARN(cannot check ctype macros if cross compiling -- defaulting to no)
1847 bash_cv_func_ctype_nonascii=no]
1849 AC_MSG_RESULT($bash_cv_func_ctype_nonascii)
1850 if test $bash_cv_func_ctype_nonascii = yes; then
1851 AC_DEFINE(CTYPE_NON_ASCII)
1856 dnl tests added for bashdb
1860 AC_DEFUN([AM_PATH_LISPDIR],
1861 [AC_ARG_WITH(lispdir, AC_HELP_STRING([--with-lispdir], [override the default lisp directory]),
1862 [ lispdir="$withval"
1863 AC_MSG_CHECKING([where .elc files should go])
1864 AC_MSG_RESULT([$lispdir])],
1866 # If set to t, that means we are running in a shell under Emacs.
1867 # If you have an Emacs named "t", then use the full path.
1868 test x"$EMACS" = xt && EMACS=
1869 AC_CHECK_PROGS(EMACS, emacs xemacs, no)
1870 if test $EMACS != "no"; then
1871 if test x${lispdir+set} != xset; then
1872 AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [dnl
1873 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;}'`
1874 if test -z "$am_cv_lispdir"; then
1875 am_cv_lispdir='${datadir}/emacs/site-lisp'
1878 lispdir="$am_cv_lispdir"
1886 dnl tests added for gettext
1888 # codeset.m4 serial AM1 (gettext-0.10.40)
1889 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
1890 dnl This file is free software, distributed under the terms of the GNU
1891 dnl General Public License. As a special exception to the GNU General
1892 dnl Public License, this file may be distributed as part of a program
1893 dnl that contains a configuration script generated by Autoconf, under
1894 dnl the same distribution terms as the rest of that program.
1896 dnl From Bruno Haible.
1898 AC_DEFUN([AM_LANGINFO_CODESET],
1900 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
1901 [AC_TRY_LINK([#include <langinfo.h>],
1902 [char* cs = nl_langinfo(CODESET);],
1903 am_cv_langinfo_codeset=yes,
1904 am_cv_langinfo_codeset=no)
1906 if test $am_cv_langinfo_codeset = yes; then
1907 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
1908 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
1911 # gettext.m4 serial 20 (gettext-0.12)
1912 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
1913 dnl This file is free software, distributed under the terms of the GNU
1914 dnl General Public License. As a special exception to the GNU General
1915 dnl Public License, this file may be distributed as part of a program
1916 dnl that contains a configuration script generated by Autoconf, under
1917 dnl the same distribution terms as the rest of that program.
1919 dnl This file can can be used in projects which are not available under
1920 dnl the GNU General Public License or the GNU Library General Public
1921 dnl License but which still want to provide support for the GNU gettext
1923 dnl Please note that the actual code of the GNU gettext library is covered
1924 dnl by the GNU Library General Public License, and the rest of the GNU
1925 dnl gettext package package is covered by the GNU General Public License.
1926 dnl They are *not* in the public domain.
1929 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1930 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1932 dnl Macro to add for using GNU gettext.
1934 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
1935 dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
1936 dnl default (if it is not specified or empty) is 'no-libtool'.
1937 dnl INTLSYMBOL should be 'external' for packages with no intl directory,
1938 dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
1939 dnl If INTLSYMBOL is 'use-libtool', then a libtool library
1940 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
1941 dnl depending on --{enable,disable}-{shared,static} and on the presence of
1942 dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
1943 dnl $(top_builddir)/intl/libintl.a will be created.
1944 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
1945 dnl implementations (in libc or libintl) without the ngettext() function
1946 dnl will be ignored. If NEEDSYMBOL is specified and is
1947 dnl 'need-formatstring-macros', then GNU gettext implementations that don't
1948 dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
1949 dnl INTLDIR is used to find the intl libraries. If empty,
1950 dnl the value `$(top_builddir)/intl/' is used.
1952 dnl The result of the configuration is one of three cases:
1953 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
1955 dnl Catalog format: GNU --> install in $(datadir)
1956 dnl Catalog extension: .mo after installation, .gmo in source tree
1957 dnl 2) GNU gettext has been found in the system's C library.
1958 dnl Catalog format: GNU --> install in $(datadir)
1959 dnl Catalog extension: .mo after installation, .gmo in source tree
1960 dnl 3) No internationalization, always use English msgid.
1961 dnl Catalog format: none
1962 dnl Catalog extension: none
1963 dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
1964 dnl The use of .gmo is historical (it was needed to avoid overwriting the
1965 dnl GNU format catalogs when building on a platform with an X/Open gettext),
1966 dnl but we keep it in order not to force irrelevant filename changes on the
1969 AC_DEFUN([AM_GNU_GETTEXT],
1971 dnl Argument checking.
1972 ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
1973 [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
1975 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
1976 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
1978 define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
1979 define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
1981 AC_REQUIRE([AM_PO_SUBDIRS])dnl
1982 ifelse(gt_included_intl, yes, [
1983 AC_REQUIRE([AM_INTL_SUBDIR])dnl
1986 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
1987 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1988 AC_REQUIRE([AC_LIB_RPATH])
1990 dnl Sometimes libintl requires libiconv, so first search for libiconv.
1991 dnl Ideally we would do this search only after the
1992 dnl if test "$USE_NLS" = "yes"; then
1993 dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1994 dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
1995 dnl the configure script would need to contain the same shell code
1996 dnl again, outside any 'if'. There are two solutions:
1997 dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
1998 dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
1999 dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
2000 dnl documented, we avoid it.
2001 ifelse(gt_included_intl, yes, , [
2002 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
2008 ifelse(gt_included_intl, yes, [
2009 BUILD_INCLUDED_LIBINTL=no
2010 USE_INCLUDED_LIBINTL=no
2016 dnl If we use NLS figure out what method
2017 if test "$USE_NLS" = "yes"; then
2018 gt_use_preinstalled_gnugettext=no
2019 ifelse(gt_included_intl, yes, [
2020 AC_MSG_CHECKING([whether included gettext is requested])
2021 AC_ARG_WITH(included-gettext,
2022 [ --with-included-gettext use the GNU gettext library included here],
2023 nls_cv_force_use_gnu_gettext=$withval,
2024 nls_cv_force_use_gnu_gettext=no)
2025 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2027 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2028 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2030 dnl User does not insist on using GNU NLS library. Figure out what
2031 dnl to use. If GNU gettext is available we use this. Else we have
2032 dnl to fall back to GNU NLS library.
2034 dnl Add a version number to the cache macros.
2035 define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
2036 define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
2037 define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
2039 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
2040 [AC_TRY_LINK([#include <libintl.h>
2041 ]ifelse([$2], [need-formatstring-macros],
2042 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2043 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2046 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2048 ], [])[extern int _nl_msg_cat_cntr;
2049 extern int *_nl_domain_bindings;],
2050 [bindtextdomain ("", "");
2051 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
2052 gt_cv_func_gnugettext_libc=yes,
2053 gt_cv_func_gnugettext_libc=no)])
2055 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
2056 dnl Sometimes libintl requires libiconv, so first search for libiconv.
2057 ifelse(gt_included_intl, yes, , [
2060 dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
2061 dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
2062 dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
2063 dnl even if libiconv doesn't exist.
2064 AC_LIB_LINKFLAGS_BODY([intl])
2065 AC_CACHE_CHECK([for GNU gettext in libintl],
2066 gt_cv_func_gnugettext_libintl,
2067 [gt_save_CPPFLAGS="$CPPFLAGS"
2068 CPPFLAGS="$CPPFLAGS $INCINTL"
2069 gt_save_LIBS="$LIBS"
2070 LIBS="$LIBS $LIBINTL"
2071 dnl Now see whether libintl exists and does not depend on libiconv.
2072 AC_TRY_LINK([#include <libintl.h>
2073 ]ifelse([$2], [need-formatstring-macros],
2074 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2075 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2078 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2080 ], [])[extern int _nl_msg_cat_cntr;
2085 const char *_nl_expand_alias ();],
2086 [bindtextdomain ("", "");
2087 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
2088 gt_cv_func_gnugettext_libintl=yes,
2089 gt_cv_func_gnugettext_libintl=no)
2090 dnl Now see whether libintl exists and depends on libiconv.
2091 if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
2092 LIBS="$LIBS $LIBICONV"
2093 AC_TRY_LINK([#include <libintl.h>
2094 ]ifelse([$2], [need-formatstring-macros],
2095 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2096 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2099 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2101 ], [])[extern int _nl_msg_cat_cntr;
2106 const char *_nl_expand_alias ();],
2107 [bindtextdomain ("", "");
2108 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
2109 [LIBINTL="$LIBINTL $LIBICONV"
2110 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
2111 gt_cv_func_gnugettext_libintl=yes
2114 CPPFLAGS="$gt_save_CPPFLAGS"
2115 LIBS="$gt_save_LIBS"])
2118 dnl If an already present or preinstalled GNU gettext() is found,
2119 dnl use it. But if this macro is used in GNU gettext, and GNU
2120 dnl gettext is already preinstalled in libintl, we update this
2121 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
2122 if test "$gt_cv_func_gnugettext_libc" = "yes" \
2123 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
2124 && test "$PACKAGE" != gettext-runtime \
2125 && test "$PACKAGE" != gettext-tools; }; then
2126 gt_use_preinstalled_gnugettext=yes
2128 dnl Reset the values set by searching for libintl.
2134 ifelse(gt_included_intl, yes, [
2135 if test "$gt_use_preinstalled_gnugettext" != "yes"; then
2136 dnl GNU gettext is not found in the C library.
2137 dnl Fall back on included GNU gettext library.
2138 nls_cv_use_gnu_gettext=yes
2142 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2143 dnl Mark actions used to generate GNU NLS library.
2144 BUILD_INCLUDED_LIBINTL=yes
2145 USE_INCLUDED_LIBINTL=yes
2146 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
2147 LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
2148 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
2151 if test "$gt_use_preinstalled_gnugettext" = "yes" \
2152 || test "$nls_cv_use_gnu_gettext" = "yes"; then
2153 dnl Mark actions to use GNU gettext tools.
2158 if test "$gt_use_preinstalled_gnugettext" = "yes" \
2159 || test "$nls_cv_use_gnu_gettext" = "yes"; then
2160 AC_DEFINE(ENABLE_NLS, 1,
2161 [Define to 1 if translation of program messages to the user's native language
2168 AC_MSG_CHECKING([whether to use NLS])
2169 AC_MSG_RESULT([$USE_NLS])
2170 if test "$USE_NLS" = "yes"; then
2171 AC_MSG_CHECKING([where the gettext function comes from])
2172 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
2173 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2174 gt_source="external libintl"
2179 gt_source="included intl directory"
2181 AC_MSG_RESULT([$gt_source])
2184 if test "$USE_NLS" = "yes"; then
2186 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
2187 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2188 AC_MSG_CHECKING([how to link with libintl])
2189 AC_MSG_RESULT([$LIBINTL])
2190 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
2193 dnl For backward compatibility. Some packages may be using this.
2194 AC_DEFINE(HAVE_GETTEXT, 1,
2195 [Define if the GNU gettext() function is already present or preinstalled.])
2196 AC_DEFINE(HAVE_DCGETTEXT, 1,
2197 [Define if the GNU dcgettext() function is already present or preinstalled.])
2200 dnl We need to process the po/ directory.
2204 ifelse(gt_included_intl, yes, [
2205 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
2206 dnl to 'yes' because some of the testsuite requires it.
2207 if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
2208 BUILD_INCLUDED_LIBINTL=yes
2211 dnl Make all variables we use known to autoconf.
2212 AC_SUBST(BUILD_INCLUDED_LIBINTL)
2213 AC_SUBST(USE_INCLUDED_LIBINTL)
2216 dnl For backward compatibility. Some configure.ins may be using this.
2218 nls_cv_header_libgt=
2220 dnl For backward compatibility. Some Makefiles may be using this.
2222 AC_SUBST(DATADIRNAME)
2224 dnl For backward compatibility. Some Makefiles may be using this.
2226 AC_SUBST(INSTOBJEXT)
2228 dnl For backward compatibility. Some Makefiles may be using this.
2232 dnl For backward compatibility. Some Makefiles may be using this.
2233 if test "$USE_INCLUDED_LIBINTL" = yes; then
2234 INTLOBJS="\$(GETTOBJS)"
2238 dnl Enable libtool support if the surrounding package wishes it.
2239 INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
2240 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
2243 dnl For backward compatibility. Some Makefiles may be using this.
2247 dnl Make all documented variables known to autoconf.
2254 dnl Checks for all prerequisites of the intl subdirectory,
2255 dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
2256 dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
2257 AC_DEFUN([AM_INTL_SUBDIR],
2259 AC_REQUIRE([AC_PROG_INSTALL])dnl
2260 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
2261 AC_REQUIRE([AC_PROG_CC])dnl
2262 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2263 AC_REQUIRE([AC_PROG_RANLIB])dnl
2264 AC_REQUIRE([AC_ISC_POSIX])dnl
2265 AC_REQUIRE([AC_HEADER_STDC])dnl
2266 AC_REQUIRE([AC_C_CONST])dnl
2267 AC_REQUIRE([AC_C_INLINE])dnl
2268 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2269 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2270 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2271 AC_REQUIRE([AC_FUNC_MMAP])dnl
2272 AC_REQUIRE([jm_GLIBC21])dnl
2273 AC_REQUIRE([gt_INTDIV0])dnl
2274 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
2275 AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
2276 AC_REQUIRE([gt_INTTYPES_PRI])dnl
2278 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
2279 stdlib.h string.h unistd.h sys/param.h])
2280 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
2281 geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
2282 strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
2287 if test $ac_cv_header_locale_h = yes; then
2291 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
2292 dnl because plural.y uses bison specific features. It requires at least
2293 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
2295 dnl bison is only needed for the maintainer (who touches plural.y). But in
2296 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
2297 dnl the rule in general Makefile. Now, some people carelessly touch the
2298 dnl files or have a broken "make" program, hence the plural.c rule will
2299 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
2300 dnl present or too old.
2301 AC_CHECK_PROGS([INTLBISON], [bison])
2302 if test -z "$INTLBISON"; then
2305 dnl Found it, now check the version.
2306 AC_MSG_CHECKING([version of bison])
2307 changequote(<<,>>)dnl
2308 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
2309 case $ac_prog_version in
2310 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2311 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
2313 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
2314 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
2316 AC_MSG_RESULT([$ac_prog_version])
2318 if test $ac_verc_fail = yes; then
2324 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
2325 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
2326 # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
2327 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2328 dnl This file is free software, distributed under the terms of the GNU
2329 dnl General Public License. As a special exception to the GNU General
2330 dnl Public License, this file may be distributed as part of a program
2331 dnl that contains a configuration script generated by Autoconf, under
2332 dnl the same distribution terms as the rest of that program.
2334 # Test for the GNU C Library, version 2.1 or newer.
2335 # From Bruno Haible.
2337 AC_DEFUN([jm_GLIBC21],
2339 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
2340 ac_cv_gnu_library_2_1,
2341 [AC_EGREP_CPP([Lucky GNU user],
2343 #include <features.h>
2344 #ifdef __GNU_LIBRARY__
2345 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
2350 ac_cv_gnu_library_2_1=yes,
2351 ac_cv_gnu_library_2_1=no)
2355 GLIBC21="$ac_cv_gnu_library_2_1"
2358 # iconv.m4 serial AM4 (gettext-0.11.3)
2359 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2360 dnl This file is free software, distributed under the terms of the GNU
2361 dnl General Public License. As a special exception to the GNU General
2362 dnl Public License, this file may be distributed as part of a program
2363 dnl that contains a configuration script generated by Autoconf, under
2364 dnl the same distribution terms as the rest of that program.
2366 dnl From Bruno Haible.
2368 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
2370 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
2371 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2372 AC_REQUIRE([AC_LIB_RPATH])
2374 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2376 AC_LIB_LINKFLAGS_BODY([iconv])
2379 AC_DEFUN([AM_ICONV_LINK],
2381 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
2382 dnl those with the standalone portable GNU libiconv installed).
2384 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2386 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
2388 dnl Add $INCICONV to CPPFLAGS before performing the following checks,
2389 dnl because if the user has installed libiconv and not disabled its use
2390 dnl via --without-libiconv-prefix, he wants to use it. The first
2391 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
2392 am_save_CPPFLAGS="$CPPFLAGS"
2393 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
2395 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
2396 am_cv_func_iconv="no, consider installing GNU libiconv"
2398 AC_TRY_LINK([#include <stdlib.h>
2399 #include <iconv.h>],
2400 [iconv_t cd = iconv_open("","");
2401 iconv(cd,NULL,NULL,NULL,NULL);
2403 am_cv_func_iconv=yes)
2404 if test "$am_cv_func_iconv" != yes; then
2405 am_save_LIBS="$LIBS"
2406 LIBS="$LIBS $LIBICONV"
2407 AC_TRY_LINK([#include <stdlib.h>
2408 #include <iconv.h>],
2409 [iconv_t cd = iconv_open("","");
2410 iconv(cd,NULL,NULL,NULL,NULL);
2413 am_cv_func_iconv=yes)
2414 LIBS="$am_save_LIBS"
2417 if test "$am_cv_func_iconv" = yes; then
2418 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2420 if test "$am_cv_lib_iconv" = yes; then
2421 AC_MSG_CHECKING([how to link with libiconv])
2422 AC_MSG_RESULT([$LIBICONV])
2424 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
2426 CPPFLAGS="$am_save_CPPFLAGS"
2431 AC_SUBST(LTLIBICONV)
2434 AC_DEFUN([AM_ICONV],
2437 if test "$am_cv_func_iconv" = yes; then
2438 AC_MSG_CHECKING([for iconv declaration])
2439 AC_CACHE_VAL(am_cv_proto_iconv, [
2447 #if defined(__STDC__) || defined(__cplusplus)
2448 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
2452 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
2453 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);"])
2454 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
2455 AC_MSG_RESULT([$]{ac_t:-
2456 }[$]am_cv_proto_iconv)
2457 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
2458 [Define as const if the declaration of iconv() needs const.])
2461 # intdiv0.m4 serial 1 (gettext-0.11.3)
2462 dnl Copyright (C) 2002 Free Software Foundation, Inc.
2463 dnl This file is free software, distributed under the terms of the GNU
2464 dnl General Public License. As a special exception to the GNU General
2465 dnl Public License, this file may be distributed as part of a program
2466 dnl that contains a configuration script generated by Autoconf, under
2467 dnl the same distribution terms as the rest of that program.
2469 dnl From Bruno Haible.
2471 AC_DEFUN([gt_INTDIV0],
2473 AC_REQUIRE([AC_PROG_CC])dnl
2474 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2476 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
2477 gt_cv_int_divbyzero_sigfpe,
2485 sigfpe_handler (int sig)
2487 sigfpe_handler (sig) int sig;
2490 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
2491 exit (sig != SIGFPE);
2501 signal (SIGFPE, sigfpe_handler);
2502 /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
2503 #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
2504 signal (SIGTRAP, sigfpe_handler);
2506 /* Linux/SPARC yields signal SIGILL. */
2507 #if defined (__sparc__) && defined (__linux__)
2508 signal (SIGILL, sigfpe_handler);
2515 ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
2517 # Guess based on the CPU.
2519 alpha* | i[34567]86 | m68k | s390*)
2520 gt_cv_int_divbyzero_sigfpe="guessing yes";;
2522 gt_cv_int_divbyzero_sigfpe="guessing no";;
2526 case "$gt_cv_int_divbyzero_sigfpe" in
2530 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
2531 [Define if integer division by zero raises signal SIGFPE.])
2533 # inttypes.m4 serial 1 (gettext-0.11.4)
2534 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
2535 dnl This file is free software, distributed under the terms of the GNU
2536 dnl General Public License. As a special exception to the GNU General
2537 dnl Public License, this file may be distributed as part of a program
2538 dnl that contains a configuration script generated by Autoconf, under
2539 dnl the same distribution terms as the rest of that program.
2541 dnl From Paul Eggert.
2543 # Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
2546 AC_DEFUN([gt_HEADER_INTTYPES_H],
2548 AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
2551 [#include <sys/types.h>
2552 #include <inttypes.h>],
2553 [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
2555 if test $gt_cv_header_inttypes_h = yes; then
2556 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
2557 [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
2560 # inttypes_h.m4 serial 5 (gettext-0.12)
2561 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
2562 dnl This file is free software, distributed under the terms of the GNU
2563 dnl General Public License. As a special exception to the GNU General
2564 dnl Public License, this file may be distributed as part of a program
2565 dnl that contains a configuration script generated by Autoconf, under
2566 dnl the same distribution terms as the rest of that program.
2568 dnl From Paul Eggert.
2570 # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
2571 # doesn't clash with <sys/types.h>, and declares uintmax_t.
2573 AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
2575 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
2577 [#include <sys/types.h>
2578 #include <inttypes.h>],
2579 [uintmax_t i = (uintmax_t) -1;],
2580 jm_ac_cv_header_inttypes_h=yes,
2581 jm_ac_cv_header_inttypes_h=no)])
2582 if test $jm_ac_cv_header_inttypes_h = yes; then
2583 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
2584 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
2585 and declares uintmax_t. ])
2588 # inttypes-pri.m4 serial 1 (gettext-0.11.4)
2589 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
2590 dnl This file is free software, distributed under the terms of the GNU
2591 dnl General Public License. As a special exception to the GNU General
2592 dnl Public License, this file may be distributed as part of a program
2593 dnl that contains a configuration script generated by Autoconf, under
2594 dnl the same distribution terms as the rest of that program.
2596 dnl From Bruno Haible.
2598 # Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
2599 # macros to non-string values. This is the case on AIX 4.3.3.
2601 AC_DEFUN([gt_INTTYPES_PRI],
2603 AC_REQUIRE([gt_HEADER_INTTYPES_H])
2604 if test $gt_cv_header_inttypes_h = yes; then
2605 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
2606 gt_cv_inttypes_pri_broken,
2608 AC_TRY_COMPILE([#include <inttypes.h>
2612 ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
2615 if test "$gt_cv_inttypes_pri_broken" = yes; then
2616 AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
2617 [Define if <inttypes.h> exists and defines unusable PRI* macros.])
2620 # isc-posix.m4 serial 2 (gettext-0.11.2)
2621 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
2622 dnl This file is free software, distributed under the terms of the GNU
2623 dnl General Public License. As a special exception to the GNU General
2624 dnl Public License, this file may be distributed as part of a program
2625 dnl that contains a configuration script generated by Autoconf, under
2626 dnl the same distribution terms as the rest of that program.
2628 # This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
2630 # This test replaces the one in autoconf.
2631 # Currently this macro should have the same name as the autoconf macro
2632 # because gettext's gettext.m4 (distributed in the automake package)
2633 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
2634 # give these diagnostics:
2635 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
2636 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
2638 undefine([AC_ISC_POSIX])
2640 AC_DEFUN([AC_ISC_POSIX],
2642 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
2643 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
2646 # lcmessage.m4 serial 3 (gettext-0.11.3)
2647 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
2648 dnl This file is free software, distributed under the terms of the GNU
2649 dnl General Public License. As a special exception to the GNU General
2650 dnl Public License, this file may be distributed as part of a program
2651 dnl that contains a configuration script generated by Autoconf, under
2652 dnl the same distribution terms as the rest of that program.
2654 dnl This file can can be used in projects which are not available under
2655 dnl the GNU General Public License or the GNU Library General Public
2656 dnl License but which still want to provide support for the GNU gettext
2658 dnl Please note that the actual code of the GNU gettext library is covered
2659 dnl by the GNU Library General Public License, and the rest of the GNU
2660 dnl gettext package package is covered by the GNU General Public License.
2661 dnl They are *not* in the public domain.
2664 dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
2666 # Check whether LC_MESSAGES is available in <locale.h>.
2668 AC_DEFUN([AM_LC_MESSAGES],
2670 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2671 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2672 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2673 if test $am_cv_val_LC_MESSAGES = yes; then
2674 AC_DEFINE(HAVE_LC_MESSAGES, 1,
2675 [Define if your <locale.h> file defines LC_MESSAGES.])
2678 # lib-ld.m4 serial 2 (gettext-0.12)
2679 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
2680 dnl This file is free software, distributed under the terms of the GNU
2681 dnl General Public License. As a special exception to the GNU General
2682 dnl Public License, this file may be distributed as part of a program
2683 dnl that contains a configuration script generated by Autoconf, under
2684 dnl the same distribution terms as the rest of that program.
2686 dnl Subroutines of libtool.m4,
2687 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
2688 dnl with libtool.m4.
2690 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
2691 AC_DEFUN([AC_LIB_PROG_LD_GNU],
2692 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
2693 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
2694 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
2695 acl_cv_prog_gnu_ld=yes
2697 acl_cv_prog_gnu_ld=no
2699 with_gnu_ld=$acl_cv_prog_gnu_ld
2702 dnl From libtool-1.4. Sets the variable LD.
2703 AC_DEFUN([AC_LIB_PROG_LD],
2704 [AC_ARG_WITH(gnu-ld,
2705 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
2706 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
2707 AC_REQUIRE([AC_PROG_CC])dnl
2708 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2709 # Prepare PATH_SEPARATOR.
2710 # The user is always right.
2711 if test "${PATH_SEPARATOR+set}" != set; then
2712 echo "#! /bin/sh" >conf$$.sh
2713 echo "exit 0" >>conf$$.sh
2715 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
2723 if test "$GCC" = yes; then
2724 # Check if gcc -print-prog-name=ld gives a path.
2725 AC_MSG_CHECKING([for ld used by GCC])
2728 # gcc leaves a trailing carriage return which upsets mingw
2729 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
2731 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
2734 # Accept absolute paths.
2735 [[\\/]* | [A-Za-z]:[\\/]*)]
2736 [re_direlt='/[^/][^/]*/\.\./']
2737 # Canonicalize the path of ld
2738 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
2739 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
2740 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
2742 test -z "$LD" && LD="$ac_prog"
2745 # If it fails, then pretend we aren't using GCC.
2749 # If it is relative, then search for the first ld in PATH.
2753 elif test "$with_gnu_ld" = yes; then
2754 AC_MSG_CHECKING([for GNU ld])
2756 AC_MSG_CHECKING([for non-GNU ld])
2758 AC_CACHE_VAL(acl_cv_path_LD,
2759 [if test -z "$LD"; then
2760 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
2761 for ac_dir in $PATH; do
2762 test -z "$ac_dir" && ac_dir=.
2763 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
2764 acl_cv_path_LD="$ac_dir/$ac_prog"
2765 # Check to see if the program is GNU ld. I'd rather use --version,
2766 # but apparently some GNU ld's only accept -v.
2767 # Break only if it was the GNU/non-GNU ld that we prefer.
2768 if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
2769 test "$with_gnu_ld" != no && break
2771 test "$with_gnu_ld" != yes && break
2777 acl_cv_path_LD="$LD" # Let the user override the test with a path.
2779 LD="$acl_cv_path_LD"
2780 if test -n "$LD"; then
2785 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
2788 # lib-link.m4 serial 4 (gettext-0.12)
2789 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
2790 dnl This file is free software, distributed under the terms of the GNU
2791 dnl General Public License. As a special exception to the GNU General
2792 dnl Public License, this file may be distributed as part of a program
2793 dnl that contains a configuration script generated by Autoconf, under
2794 dnl the same distribution terms as the rest of that program.
2796 dnl From Bruno Haible.
2798 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
2799 dnl the libraries corresponding to explicit and implicit dependencies.
2800 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
2801 dnl augments the CPPFLAGS variable.
2802 AC_DEFUN([AC_LIB_LINKFLAGS],
2804 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2805 AC_REQUIRE([AC_LIB_RPATH])
2806 define([Name],[translit([$1],[./-], [___])])
2807 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2808 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2809 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
2810 AC_LIB_LINKFLAGS_BODY([$1], [$2])
2811 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
2812 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
2813 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
2815 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
2816 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
2817 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
2818 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2820 AC_SUBST([LTLIB]NAME)
2821 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
2822 dnl results of this search when this library appears as a dependency.
2828 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
2829 dnl searches for libname and the libraries corresponding to explicit and
2830 dnl implicit dependencies, together with the specified include files and
2831 dnl the ability to compile and link the specified testcode. If found, it
2832 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
2833 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
2834 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
2835 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
2836 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
2838 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2839 AC_REQUIRE([AC_LIB_RPATH])
2840 define([Name],[translit([$1],[./-], [___])])
2841 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2842 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2844 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
2846 AC_LIB_LINKFLAGS_BODY([$1], [$2])
2848 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
2849 dnl because if the user has installed lib[]Name and not disabled its use
2850 dnl via --without-lib[]Name-prefix, he wants to use it.
2851 ac_save_CPPFLAGS="$CPPFLAGS"
2852 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2854 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
2855 ac_save_LIBS="$LIBS"
2856 LIBS="$LIBS $LIB[]NAME"
2857 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
2858 LIBS="$ac_save_LIBS"
2860 if test "$ac_cv_lib[]Name" = yes; then
2862 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
2863 AC_MSG_CHECKING([how to link with lib[]$1])
2864 AC_MSG_RESULT([$LIB[]NAME])
2867 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
2868 dnl $INC[]NAME either.
2869 CPPFLAGS="$ac_save_CPPFLAGS"
2873 AC_SUBST([HAVE_LIB]NAME)
2875 AC_SUBST([LTLIB]NAME)
2880 dnl Determine the platform dependent parameters needed to use rpath:
2881 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
2882 dnl hardcode_direct, hardcode_minus_L.
2883 AC_DEFUN([AC_LIB_RPATH],
2885 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
2886 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
2887 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
2888 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
2889 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
2890 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
2891 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
2897 libext="$acl_cv_libext"
2898 shlibext="$acl_cv_shlibext"
2899 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
2900 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
2901 hardcode_direct="$acl_cv_hardcode_direct"
2902 hardcode_minus_L="$acl_cv_hardcode_minus_L"
2903 dnl Determine whether the user wants rpath handling at all.
2904 AC_ARG_ENABLE(rpath,
2905 [ --disable-rpath do not hardcode runtime library paths],
2906 :, enable_rpath=yes)
2909 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
2910 dnl the libraries corresponding to explicit and implicit dependencies.
2911 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
2912 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
2914 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2915 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2916 dnl By default, look in $includedir and $libdir.
2918 AC_LIB_WITH_FINAL_PREFIX([
2919 eval additional_includedir=\"$includedir\"
2920 eval additional_libdir=\"$libdir\"
2922 AC_LIB_ARG_WITH([lib$1-prefix],
2923 [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
2924 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
2926 if test "X$withval" = "Xno"; then
2929 if test "X$withval" = "X"; then
2930 AC_LIB_WITH_FINAL_PREFIX([
2931 eval additional_includedir=\"$includedir\"
2932 eval additional_libdir=\"$libdir\"
2935 additional_includedir="$withval/include"
2936 additional_libdir="$withval/lib"
2940 dnl Search the library and its dependencies in $additional_libdir and
2941 dnl $LDFLAGS. Using breadth-first-seach.
2947 names_already_handled=
2948 names_next_round='$1 $2'
2949 while test -n "$names_next_round"; do
2950 names_this_round="$names_next_round"
2952 for name in $names_this_round; do
2954 for n in $names_already_handled; do
2955 if test "$n" = "$name"; then
2960 if test -z "$already_handled"; then
2961 names_already_handled="$names_already_handled $name"
2962 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
2963 dnl or AC_LIB_HAVE_LINKFLAGS call.
2964 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
2965 eval value=\"\$HAVE_LIB$uppername\"
2966 if test -n "$value"; then
2967 if test "$value" = yes; then
2968 eval value=\"\$LIB$uppername\"
2969 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
2970 eval value=\"\$LTLIB$uppername\"
2971 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
2973 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
2974 dnl that this library doesn't exist. So just drop it.
2978 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
2979 dnl and the already constructed $LIBNAME/$LTLIBNAME.
2984 if test $use_additional = yes; then
2985 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
2986 found_dir="$additional_libdir"
2987 found_so="$additional_libdir/lib$name.$shlibext"
2988 if test -f "$additional_libdir/lib$name.la"; then
2989 found_la="$additional_libdir/lib$name.la"
2992 if test -f "$additional_libdir/lib$name.$libext"; then
2993 found_dir="$additional_libdir"
2994 found_a="$additional_libdir/lib$name.$libext"
2995 if test -f "$additional_libdir/lib$name.la"; then
2996 found_la="$additional_libdir/lib$name.la"
3001 if test "X$found_dir" = "X"; then
3002 for x in $LDFLAGS $LTLIB[]NAME; do
3003 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3006 dir=`echo "X$x" | sed -e 's/^X-L//'`
3007 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
3009 found_so="$dir/lib$name.$shlibext"
3010 if test -f "$dir/lib$name.la"; then
3011 found_la="$dir/lib$name.la"
3014 if test -f "$dir/lib$name.$libext"; then
3016 found_a="$dir/lib$name.$libext"
3017 if test -f "$dir/lib$name.la"; then
3018 found_la="$dir/lib$name.la"
3024 if test "X$found_dir" != "X"; then
3029 if test "X$found_dir" != "X"; then
3030 dnl Found the library.
3031 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
3032 if test "X$found_so" != "X"; then
3033 dnl Linking with a shared library. We attempt to hardcode its
3034 dnl directory into the executable's runpath, unless it's the
3035 dnl standard /usr/lib.
3036 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
3037 dnl No hardcoding is needed.
3038 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3040 dnl Use an explicit option to hardcode DIR into the resulting
3042 dnl Potentially add DIR to ltrpathdirs.
3043 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
3045 for x in $ltrpathdirs; do
3046 if test "X$x" = "X$found_dir"; then
3051 if test -z "$haveit"; then
3052 ltrpathdirs="$ltrpathdirs $found_dir"
3054 dnl The hardcoding into $LIBNAME is system dependent.
3055 if test "$hardcode_direct" = yes; then
3056 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
3057 dnl resulting binary.
3058 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3060 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
3061 dnl Use an explicit option to hardcode DIR into the resulting
3063 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3064 dnl Potentially add DIR to rpathdirs.
3065 dnl The rpathdirs will be appended to $LIBNAME at the end.
3067 for x in $rpathdirs; do
3068 if test "X$x" = "X$found_dir"; then
3073 if test -z "$haveit"; then
3074 rpathdirs="$rpathdirs $found_dir"
3077 dnl Rely on "-L$found_dir".
3078 dnl But don't add it if it's already contained in the LDFLAGS
3079 dnl or the already constructed $LIBNAME
3081 for x in $LDFLAGS $LIB[]NAME; do
3082 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3083 if test "X$x" = "X-L$found_dir"; then
3088 if test -z "$haveit"; then
3089 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
3091 if test "$hardcode_minus_L" != no; then
3092 dnl FIXME: Not sure whether we should use
3093 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
3095 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3097 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
3098 dnl here, because this doesn't fit in flags passed to the
3099 dnl compiler. So give up. No hardcoding. This affects only
3100 dnl very old systems.
3101 dnl FIXME: Not sure whether we should use
3102 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
3104 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
3110 if test "X$found_a" != "X"; then
3111 dnl Linking with a static library.
3112 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
3114 dnl We shouldn't come here, but anyway it's good to have a
3116 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
3119 dnl Assume the include files are nearby.
3120 additional_includedir=
3121 case "$found_dir" in
3123 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
3124 additional_includedir="$basedir/include"
3127 if test "X$additional_includedir" != "X"; then
3128 dnl Potentially add $additional_includedir to $INCNAME.
3129 dnl But don't add it
3130 dnl 1. if it's the standard /usr/include,
3131 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
3132 dnl 3. if it's already present in $CPPFLAGS or the already
3133 dnl constructed $INCNAME,
3134 dnl 4. if it doesn't exist as a directory.
3135 if test "X$additional_includedir" != "X/usr/include"; then
3137 if test "X$additional_includedir" = "X/usr/local/include"; then
3138 if test -n "$GCC"; then
3140 linux*) haveit=yes;;
3144 if test -z "$haveit"; then
3145 for x in $CPPFLAGS $INC[]NAME; do
3146 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3147 if test "X$x" = "X-I$additional_includedir"; then
3152 if test -z "$haveit"; then
3153 if test -d "$additional_includedir"; then
3154 dnl Really add $additional_includedir to $INCNAME.
3155 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
3161 dnl Look for dependencies.
3162 if test -n "$found_la"; then
3163 dnl Read the .la file. It defines the variables
3164 dnl dlname, library_names, old_library, dependency_libs, current,
3165 dnl age, revision, installed, dlopen, dlpreopen, libdir.
3166 save_libdir="$libdir"
3168 */* | *\\*) . "$found_la" ;;
3169 *) . "./$found_la" ;;
3171 libdir="$save_libdir"
3172 dnl We use only dependency_libs.
3173 for dep in $dependency_libs; do
3176 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
3177 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
3178 dnl But don't add it
3179 dnl 1. if it's the standard /usr/lib,
3180 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
3181 dnl 3. if it's already present in $LDFLAGS or the already
3182 dnl constructed $LIBNAME,
3183 dnl 4. if it doesn't exist as a directory.
3184 if test "X$additional_libdir" != "X/usr/lib"; then
3186 if test "X$additional_libdir" = "X/usr/local/lib"; then
3187 if test -n "$GCC"; then
3189 linux*) haveit=yes;;
3193 if test -z "$haveit"; then
3195 for x in $LDFLAGS $LIB[]NAME; do
3196 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3197 if test "X$x" = "X-L$additional_libdir"; then
3202 if test -z "$haveit"; then
3203 if test -d "$additional_libdir"; then
3204 dnl Really add $additional_libdir to $LIBNAME.
3205 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
3209 for x in $LDFLAGS $LTLIB[]NAME; do
3210 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3211 if test "X$x" = "X-L$additional_libdir"; then
3216 if test -z "$haveit"; then
3217 if test -d "$additional_libdir"; then
3218 dnl Really add $additional_libdir to $LTLIBNAME.
3219 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
3226 dir=`echo "X$dep" | sed -e 's/^X-R//'`
3227 if test "$enable_rpath" != no; then
3228 dnl Potentially add DIR to rpathdirs.
3229 dnl The rpathdirs will be appended to $LIBNAME at the end.
3231 for x in $rpathdirs; do
3232 if test "X$x" = "X$dir"; then
3237 if test -z "$haveit"; then
3238 rpathdirs="$rpathdirs $dir"
3240 dnl Potentially add DIR to ltrpathdirs.
3241 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
3243 for x in $ltrpathdirs; do
3244 if test "X$x" = "X$dir"; then
3249 if test -z "$haveit"; then
3250 ltrpathdirs="$ltrpathdirs $dir"
3255 dnl Handle this in the next round.
3256 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
3259 dnl Handle this in the next round. Throw away the .la's
3260 dnl directory; it is already contained in a preceding -L
3262 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
3265 dnl Most likely an immediate library name.
3266 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
3267 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
3273 dnl Didn't find the library; assume it is in the system directories
3274 dnl known to the linker and runtime loader. (All the system
3275 dnl directories known to the linker should also be known to the
3276 dnl runtime loader, otherwise the system is severely misconfigured.)
3277 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
3278 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
3284 if test "X$rpathdirs" != "X"; then
3285 if test -n "$hardcode_libdir_separator"; then
3286 dnl Weird platform: only the last -rpath option counts, the user must
3287 dnl pass all path elements in one option. We can arrange that for a
3288 dnl single library, but not when more than one $LIBNAMEs are used.
3290 for found_dir in $rpathdirs; do
3291 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
3293 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
3294 acl_save_libdir="$libdir"
3296 eval flag=\"$hardcode_libdir_flag_spec\"
3297 libdir="$acl_save_libdir"
3298 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
3300 dnl The -rpath options are cumulative.
3301 for found_dir in $rpathdirs; do
3302 acl_save_libdir="$libdir"
3304 eval flag=\"$hardcode_libdir_flag_spec\"
3305 libdir="$acl_save_libdir"
3306 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
3310 if test "X$ltrpathdirs" != "X"; then
3311 dnl When using libtool, the option that works for both libraries and
3312 dnl executables is -R. The -R options are cumulative.
3313 for found_dir in $ltrpathdirs; do
3314 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
3319 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
3320 dnl unless already present in VAR.
3321 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
3322 dnl contains two or three consecutive elements that belong together.
3323 AC_DEFUN([AC_LIB_APPENDTOVAR],
3325 for element in [$2]; do
3328 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3329 if test "X$x" = "X$element"; then
3334 if test -z "$haveit"; then
3335 [$1]="${[$1]}${[$1]:+ }$element"
3339 # lib-prefix.m4 serial 2 (gettext-0.12)
3340 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
3341 dnl This file is free software, distributed under the terms of the GNU
3342 dnl General Public License. As a special exception to the GNU General
3343 dnl Public License, this file may be distributed as part of a program
3344 dnl that contains a configuration script generated by Autoconf, under
3345 dnl the same distribution terms as the rest of that program.
3347 dnl From Bruno Haible.
3349 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
3350 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
3351 dnl require excessive bracketing.
3352 ifdef([AC_HELP_STRING],
3353 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
3354 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
3356 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
3357 dnl to access previously installed libraries. The basic assumption is that
3358 dnl a user will want packages to use other packages he previously installed
3359 dnl with the same --prefix option.
3360 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
3361 dnl libraries, but is otherwise very convenient.
3362 AC_DEFUN([AC_LIB_PREFIX],
3364 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
3365 AC_REQUIRE([AC_PROG_CC])
3366 AC_REQUIRE([AC_CANONICAL_HOST])
3367 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
3368 dnl By default, look in $includedir and $libdir.
3370 AC_LIB_WITH_FINAL_PREFIX([
3371 eval additional_includedir=\"$includedir\"
3372 eval additional_libdir=\"$libdir\"
3374 AC_LIB_ARG_WITH([lib-prefix],
3375 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
3376 --without-lib-prefix don't search for libraries in includedir and libdir],
3378 if test "X$withval" = "Xno"; then
3381 if test "X$withval" = "X"; then
3382 AC_LIB_WITH_FINAL_PREFIX([
3383 eval additional_includedir=\"$includedir\"
3384 eval additional_libdir=\"$libdir\"
3387 additional_includedir="$withval/include"
3388 additional_libdir="$withval/lib"
3392 if test $use_additional = yes; then
3393 dnl Potentially add $additional_includedir to $CPPFLAGS.
3394 dnl But don't add it
3395 dnl 1. if it's the standard /usr/include,
3396 dnl 2. if it's already present in $CPPFLAGS,
3397 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
3398 dnl 4. if it doesn't exist as a directory.
3399 if test "X$additional_includedir" != "X/usr/include"; then
3401 for x in $CPPFLAGS; do
3402 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3403 if test "X$x" = "X-I$additional_includedir"; then
3408 if test -z "$haveit"; then
3409 if test "X$additional_includedir" = "X/usr/local/include"; then
3410 if test -n "$GCC"; then
3412 linux*) haveit=yes;;
3416 if test -z "$haveit"; then
3417 if test -d "$additional_includedir"; then
3418 dnl Really add $additional_includedir to $CPPFLAGS.
3419 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
3424 dnl Potentially add $additional_libdir to $LDFLAGS.
3425 dnl But don't add it
3426 dnl 1. if it's the standard /usr/lib,
3427 dnl 2. if it's already present in $LDFLAGS,
3428 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
3429 dnl 4. if it doesn't exist as a directory.
3430 if test "X$additional_libdir" != "X/usr/lib"; then
3432 for x in $LDFLAGS; do
3433 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3434 if test "X$x" = "X-L$additional_libdir"; then
3439 if test -z "$haveit"; then
3440 if test "X$additional_libdir" = "X/usr/local/lib"; then
3441 if test -n "$GCC"; then
3443 linux*) haveit=yes;;
3447 if test -z "$haveit"; then
3448 if test -d "$additional_libdir"; then
3449 dnl Really add $additional_libdir to $LDFLAGS.
3450 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
3458 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
3459 dnl acl_final_exec_prefix, containing the values to which $prefix and
3460 dnl $exec_prefix will expand at the end of the configure script.
3461 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
3463 dnl Unfortunately, prefix and exec_prefix get only finally determined
3464 dnl at the end of configure.
3465 if test "X$prefix" = "XNONE"; then
3466 acl_final_prefix="$ac_default_prefix"
3468 acl_final_prefix="$prefix"
3470 if test "X$exec_prefix" = "XNONE"; then
3471 acl_final_exec_prefix='${prefix}'
3473 acl_final_exec_prefix="$exec_prefix"
3475 acl_save_prefix="$prefix"
3476 prefix="$acl_final_prefix"
3477 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
3478 prefix="$acl_save_prefix"
3481 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
3482 dnl variables prefix and exec_prefix bound to the values they will have
3483 dnl at the end of the configure script.
3484 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
3486 acl_save_prefix="$prefix"
3487 prefix="$acl_final_prefix"
3488 acl_save_exec_prefix="$exec_prefix"
3489 exec_prefix="$acl_final_exec_prefix"
3491 exec_prefix="$acl_save_exec_prefix"
3492 prefix="$acl_save_prefix"
3494 # nls.m4 serial 1 (gettext-0.12)
3495 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
3496 dnl This file is free software, distributed under the terms of the GNU
3497 dnl General Public License. As a special exception to the GNU General
3498 dnl Public License, this file may be distributed as part of a program
3499 dnl that contains a configuration script generated by Autoconf, under
3500 dnl the same distribution terms as the rest of that program.
3502 dnl This file can can be used in projects which are not available under
3503 dnl the GNU General Public License or the GNU Library General Public
3504 dnl License but which still want to provide support for the GNU gettext
3506 dnl Please note that the actual code of the GNU gettext library is covered
3507 dnl by the GNU Library General Public License, and the rest of the GNU
3508 dnl gettext package package is covered by the GNU General Public License.
3509 dnl They are *not* in the public domain.
3512 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3513 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3517 AC_MSG_CHECKING([whether NLS is requested])
3518 dnl Default is enabled NLS
3520 [ --disable-nls do not use Native Language Support],
3521 USE_NLS=$enableval, USE_NLS=yes)
3522 AC_MSG_RESULT($USE_NLS)
3526 AC_DEFUN([AM_MKINSTALLDIRS],
3528 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
3529 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
3530 dnl Try to locate it.
3532 if test -n "$ac_aux_dir"; then
3533 case "$ac_aux_dir" in
3534 /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
3535 *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
3538 if test -z "$MKINSTALLDIRS"; then
3539 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
3541 AC_SUBST(MKINSTALLDIRS)
3543 # po.m4 serial 1 (gettext-0.12)
3544 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
3545 dnl This file is free software, distributed under the terms of the GNU
3546 dnl General Public License. As a special exception to the GNU General
3547 dnl Public License, this file may be distributed as part of a program
3548 dnl that contains a configuration script generated by Autoconf, under
3549 dnl the same distribution terms as the rest of that program.
3551 dnl This file can can be used in projects which are not available under
3552 dnl the GNU General Public License or the GNU Library General Public
3553 dnl License but which still want to provide support for the GNU gettext
3555 dnl Please note that the actual code of the GNU gettext library is covered
3556 dnl by the GNU Library General Public License, and the rest of the GNU
3557 dnl gettext package package is covered by the GNU General Public License.
3558 dnl They are *not* in the public domain.
3561 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3562 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3564 dnl Checks for all prerequisites of the po subdirectory.
3565 AC_DEFUN([AM_PO_SUBDIRS],
3567 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3568 AC_REQUIRE([AC_PROG_INSTALL])dnl
3569 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
3570 AC_REQUIRE([AM_NLS])dnl
3572 dnl Perform the following tests also if --disable-nls has been given,
3573 dnl because they are needed for "make dist" to work.
3575 dnl Search for GNU msgfmt in the PATH.
3576 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
3577 dnl The second test excludes FreeBSD msgfmt.
3578 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
3579 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
3580 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
3582 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
3584 dnl Search for GNU xgettext 0.12 or newer in the PATH.
3585 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
3586 dnl The second test excludes FreeBSD xgettext.
3587 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
3588 [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
3589 (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)],
3591 dnl Remove leftover from FreeBSD xgettext call.
3594 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
3595 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
3596 [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
3598 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
3599 dnl Test whether we really found GNU msgfmt.
3600 if test "$GMSGFMT" != ":"; then
3601 dnl If it is no GNU msgfmt we define it as : so that the
3602 dnl Makefiles still can work.
3603 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
3604 (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
3607 GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
3609 [found $GMSGFMT program is not GNU msgfmt; ignore it])
3614 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
3615 dnl Test whether we really found GNU xgettext.
3616 if test "$XGETTEXT" != ":"; then
3617 dnl If it is no GNU xgettext we define it as : so that the
3618 dnl Makefiles still can work.
3619 if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
3620 (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
3624 [found xgettext program is not GNU xgettext; ignore it])
3627 dnl Remove leftover from FreeBSD xgettext call.
3631 AC_OUTPUT_COMMANDS([
3632 for ac_file in $CONFIG_FILES; do
3633 # Support "outfile[:infile[:infile...]]"
3635 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
3637 # PO directories have a Makefile.in generated from Makefile.in.in.
3638 case "$ac_file" in */Makefile.in)
3639 # Adjust a relative srcdir.
3640 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
3641 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
3642 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
3643 # In autoconf-2.13 it is called $ac_given_srcdir.
3644 # In autoconf-2.50 it is called $srcdir.
3645 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
3646 case "$ac_given_srcdir" in
3647 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
3648 /*) top_srcdir="$ac_given_srcdir" ;;
3649 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
3651 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
3652 rm -f "$ac_dir/POTFILES"
3653 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
3654 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
3655 POMAKEFILEDEPS="POTFILES.in"
3656 # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
3657 # on $ac_dir but don't depend on user-specified configuration
3659 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
3660 # The LINGUAS file contains the set of available languages.
3661 if test -n "$OBSOLETE_ALL_LINGUAS"; then
3662 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
3664 ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
3665 # Hide the ALL_LINGUAS assigment from automake.
3666 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
3667 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
3669 # The set of available languages was given in configure.in.
3670 eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
3672 case "$ac_given_srcdir" in
3674 *) srcdirpre='$(srcdir)/' ;;
3680 for lang in $ALL_LINGUAS; do
3681 POFILES="$POFILES $srcdirpre$lang.po"
3682 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
3683 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
3684 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
3686 # CATALOGS depends on both $ac_dir and the user's LINGUAS
3687 # environment variable.
3689 if test -n "$ALL_LINGUAS"; then
3690 for presentlang in $ALL_LINGUAS; do
3692 if test "%UNSET%" != "$LINGUAS"; then
3693 desiredlanguages="$LINGUAS"
3695 desiredlanguages="$ALL_LINGUAS"
3697 for desiredlang in $desiredlanguages; do
3698 # Use the presentlang catalog if desiredlang is
3699 # a. equal to presentlang, or
3700 # b. a variant of presentlang (because in this case,
3701 # presentlang can be used as a fallback for messages
3702 # which are not translated in the desiredlang catalog).
3703 case "$desiredlang" in
3704 "$presentlang"*) useit=yes;;
3707 if test $useit = yes; then
3708 INST_LINGUAS="$INST_LINGUAS $presentlang"
3713 if test -n "$INST_LINGUAS"; then
3714 for lang in $INST_LINGUAS; do
3715 CATALOGS="$CATALOGS $lang.gmo"
3718 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
3719 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"
3720 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
3721 if test -f "$f"; then
3723 *.orig | *.bak | *~) ;;
3724 *) cat "$f" >> "$ac_dir/Makefile" ;;
3732 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
3733 # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
3735 eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
3736 # Capture the value of LINGUAS because we need it to compute CATALOGS.
3737 LINGUAS="${LINGUAS-%UNSET%}"
3740 # progtest.m4 serial 3 (gettext-0.12)
3741 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
3742 dnl This file is free software, distributed under the terms of the GNU
3743 dnl General Public License. As a special exception to the GNU General
3744 dnl Public License, this file may be distributed as part of a program
3745 dnl that contains a configuration script generated by Autoconf, under
3746 dnl the same distribution terms as the rest of that program.
3748 dnl This file can can be used in projects which are not available under
3749 dnl the GNU General Public License or the GNU Library General Public
3750 dnl License but which still want to provide support for the GNU gettext
3752 dnl Please note that the actual code of the GNU gettext library is covered
3753 dnl by the GNU Library General Public License, and the rest of the GNU
3754 dnl gettext package package is covered by the GNU General Public License.
3755 dnl They are *not* in the public domain.
3758 dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
3760 # Search path for a program which passes the given test.
3762 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
3763 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
3764 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
3766 # Prepare PATH_SEPARATOR.
3767 # The user is always right.
3768 if test "${PATH_SEPARATOR+set}" != set; then
3769 echo "#! /bin/sh" >conf$$.sh
3770 echo "exit 0" >>conf$$.sh
3772 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
3780 # Find out how to test for executable files. Don't use a zero-byte file,
3781 # as systems may use methods other than mode bits to determine executability.
3782 cat >conf$$.file <<_ASEOF
3786 chmod +x conf$$.file
3787 if test -x conf$$.file >/dev/null 2>&1; then
3788 ac_executable_p="test -x"
3790 ac_executable_p="test -f"
3794 # Extract the first word of "$2", so it can be a program name with args.
3795 set dummy $2; ac_word=[$]2
3796 AC_MSG_CHECKING([for $ac_word])
3797 AC_CACHE_VAL(ac_cv_path_$1,
3799 [[\\/]]* | ?:[[\\/]]*)
3800 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
3803 ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
3804 for ac_dir in ifelse([$5], , $PATH, [$5]); do
3806 test -z "$ac_dir" && ac_dir=.
3807 for ac_exec_ext in '' $ac_executable_extensions; do
3808 if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
3810 ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
3817 dnl If no 4th arg is given, leave the cache variable unset,
3818 dnl so AC_PATH_PROGS will keep looking.
3819 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
3824 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
3825 AC_MSG_RESULT([$]$1)
3831 # stdint_h.m4 serial 3 (gettext-0.12)
3832 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3833 dnl This file is free software, distributed under the terms of the GNU
3834 dnl General Public License. As a special exception to the GNU General
3835 dnl Public License, this file may be distributed as part of a program
3836 dnl that contains a configuration script generated by Autoconf, under
3837 dnl the same distribution terms as the rest of that program.
3839 dnl From Paul Eggert.
3841 # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
3842 # doesn't clash with <sys/types.h>, and declares uintmax_t.
3844 AC_DEFUN([jm_AC_HEADER_STDINT_H],
3846 AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
3848 [#include <sys/types.h>
3849 #include <stdint.h>],
3850 [uintmax_t i = (uintmax_t) -1;],
3851 jm_ac_cv_header_stdint_h=yes,
3852 jm_ac_cv_header_stdint_h=no)])
3853 if test $jm_ac_cv_header_stdint_h = yes; then
3854 AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
3855 [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
3856 and declares uintmax_t. ])
3859 # uintmax_t.m4 serial 7 (gettext-0.12)
3860 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3861 dnl This file is free software, distributed under the terms of the GNU
3862 dnl General Public License. As a special exception to the GNU General
3863 dnl Public License, this file may be distributed as part of a program
3864 dnl that contains a configuration script generated by Autoconf, under
3865 dnl the same distribution terms as the rest of that program.
3867 dnl From Paul Eggert.
3871 # Define uintmax_t to 'unsigned long' or 'unsigned long long'
3872 # if it is not already defined in <stdint.h> or <inttypes.h>.
3874 AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
3876 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
3877 AC_REQUIRE([jm_AC_HEADER_STDINT_H])
3878 if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
3879 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3880 test $ac_cv_type_unsigned_long_long = yes \
3881 && ac_type='unsigned long long' \
3882 || ac_type='unsigned long'
3883 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
3884 [Define to unsigned long or unsigned long long
3885 if <stdint.h> and <inttypes.h> don't define.])
3887 AC_DEFINE(HAVE_UINTMAX_T, 1,
3888 [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
3891 # ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40)
3892 dnl Copyright (C) 1999-2002 Free Software Foundation, Inc.
3893 dnl This file is free software, distributed under the terms of the GNU
3894 dnl General Public License. As a special exception to the GNU General
3895 dnl Public License, this file may be distributed as part of a program
3896 dnl that contains a configuration script generated by Autoconf, under
3897 dnl the same distribution terms as the rest of that program.
3899 dnl From Paul Eggert.
3901 AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
3903 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
3904 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
3905 [unsigned long long ullmax = (unsigned long long) -1;
3906 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
3907 ac_cv_type_unsigned_long_long=yes,
3908 ac_cv_type_unsigned_long_long=no)])
3909 if test $ac_cv_type_unsigned_long_long = yes; then
3910 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
3911 [Define if you have the unsigned long long type.])