126497Sachednl
226497Sachednl Bash specific tests
326497Sachednl
426497Sachednl Some derived from PDKSH 5.1.3 autoconf tests
526497Sachednl
6119610Sache
7119610SacheAC_DEFUN(BASH_C_LONG_LONG,
8119610Sache[AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
9119610Sache[if test "$GCC" = yes; then
10119610Sache  ac_cv_c_long_long=yes
11119610Sacheelse
12119610SacheAC_TRY_RUN([
13119610Sacheint
1426497Sachemain()
1526497Sache{
16119610Sachelong long foo = 0;
17119610Sacheexit(sizeof(long long) < sizeof(long));
1826497Sache}
19119610Sache], ac_cv_c_long_long=yes, ac_cv_c_long_long=no)
20119610Sachefi])
21119610Sacheif test $ac_cv_c_long_long = yes; then
22119610Sache  AC_DEFINE(HAVE_LONG_LONG, 1, [Define if the `long long' type works.])
2326497Sachefi
2426497Sache])
2526497Sache
26119610Sachednl
27119610Sachednl This is very similar to AC_C_LONG_DOUBLE, with the fix for IRIX
28119610Sachednl (< changed to <=) added.
29119610Sachednl
30119610SacheAC_DEFUN(BASH_C_LONG_DOUBLE,
31119610Sache[AC_CACHE_CHECK(for long double, ac_cv_c_long_double,
32119610Sache[if test "$GCC" = yes; then
33119610Sache  ac_cv_c_long_double=yes
34119610Sacheelse
35119610SacheAC_TRY_RUN([
36119610Sacheint
3726497Sachemain()
3826497Sache{
39119610Sache  /* The Stardent Vistra knows sizeof(long double), but does not
40119610Sache     support it. */
41119610Sache  long double foo = 0.0;
42119610Sache  /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
43119610Sache  /* On IRIX 5.3, the compiler converts long double to double with a warning,
44119610Sache     but compiles this successfully. */
45119610Sache  exit(sizeof(long double) <= sizeof(double));
4626497Sache}
47119610Sache], ac_cv_c_long_double=yes, ac_cv_c_long_double=no)
48119610Sachefi])
49119610Sacheif test $ac_cv_c_long_double = yes; then
50119610Sache  AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if the `long double' type works.])
5126497Sachefi
5226497Sache])
5326497Sache
5426497Sachednl
55119610Sachednl Check for <inttypes.h>.  This is separated out so that it can be
56119610Sachednl AC_REQUIREd.
57119610Sachednl
58119610Sachednl BASH_HEADER_INTTYPES
59119610SacheAC_DEFUN(BASH_HEADER_INTTYPES,
60119610Sache[
61119610Sache AC_CHECK_HEADERS(inttypes.h)
62119610Sache])
63119610Sache
64119610Sachednl
6526497Sachednl check for typedef'd symbols in header files, but allow the caller to
6626497Sachednl specify the include files to be checked in addition to the default
6726497Sachednl 
6826497Sachednl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND])
6926497SacheAC_DEFUN(BASH_CHECK_TYPE,
70119610Sache[
71119610SacheAC_REQUIRE([AC_HEADER_STDC])dnl
72119610SacheAC_REQUIRE([BASH_HEADER_INTTYPES])
7326497SacheAC_MSG_CHECKING(for $1)
7426497SacheAC_CACHE_VAL(bash_cv_type_$1,
7526497Sache[AC_EGREP_CPP($1, [#include <sys/types.h>
7626497Sache#if STDC_HEADERS
7726497Sache#include <stdlib.h>
78119610Sache#include <stddef.h>
7926497Sache#endif
80119610Sache#if HAVE_INTTYPES_H
81119610Sache#include <inttypes.h>
82119610Sache#endif
8326497Sache$2
8426497Sache], bash_cv_type_$1=yes, bash_cv_type_$1=no)])
8526497SacheAC_MSG_RESULT($bash_cv_type_$1)
8626497Sacheifelse($#, 4, [if test $bash_cv_type_$1 = yes; then
8726497Sache	AC_DEFINE($4)
8826497Sache	fi])
8926497Sacheif test $bash_cv_type_$1 = no; then
90119610Sache  AC_DEFINE_UNQUOTED($1, $3)
9126497Sachefi
9226497Sache])
9326497Sache
9426497Sachednl
95119610Sachednl BASH_CHECK_DECL(FUNC)
9626497Sachednl
97119610Sachednl Check for a declaration of FUNC in stdlib.h and inttypes.h like
98119610Sachednl AC_CHECK_DECL
99119610Sachednl
100119610SacheAC_DEFUN(BASH_CHECK_DECL,
101119610Sache[
102119610SacheAC_REQUIRE([AC_HEADER_STDC])
103119610SacheAC_REQUIRE([BASH_HEADER_INTTYPES])
104119610SacheAC_CACHE_CHECK([for declaration of $1], bash_cv_decl_$1,
105119610Sache[AC_TRY_LINK(
106119610Sache[
107119610Sache#if STDC_HEADERS
108119610Sache#  include <stdlib.h>
109119610Sache#endif
110119610Sache#if HAVE_INTTYPES_H
111119610Sache#  include <inttypes.h>
112119610Sache#endif
113119610Sache],
114119610Sache[return !$1;],
115119610Sachebash_cv_decl_$1=yes, bash_cv_decl_$1=no)])
116119610Sachebash_tr_func=HAVE_DECL_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
117119610Sacheif test $bash_cv_decl_$1 = yes; then
118119610Sache  AC_DEFINE_UNQUOTED($bash_tr_func, 1)
119119610Sacheelse
120119610Sache  AC_DEFINE_UNQUOTED($bash_tr_func, 0)
121119610Sachefi
122119610Sache])
123119610Sache
124119610SacheAC_DEFUN(BASH_DECL_PRINTF,
125119610Sache[AC_MSG_CHECKING(for declaration of printf in <stdio.h>)
126119610SacheAC_CACHE_VAL(bash_cv_printf_declared,
127119610Sache[AC_TRY_RUN([
128119610Sache#include <stdio.h>
129119610Sache#ifdef __STDC__
130119610Sachetypedef int (*_bashfunc)(const char *, ...);
131119610Sache#else
132119610Sachetypedef int (*_bashfunc)();
133119610Sache#endif
13426497Sachemain()
13526497Sache{
136119610Sache_bashfunc pf;
137119610Sachepf = (_bashfunc) printf;
138119610Sacheexit(pf == 0);
139119610Sache}
140119610Sache], bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
141119610Sache   [AC_MSG_WARN(cannot check printf declaration if cross compiling -- defaulting to yes)
142119610Sache    bash_cv_printf_declared=yes]
143119610Sache)])
144119610SacheAC_MSG_RESULT($bash_cv_printf_declared)
145119610Sacheif test $bash_cv_printf_declared = yes; then
146119610SacheAC_DEFINE(PRINTF_DECLARED)
147119610Sachefi
14826497Sache])
149119610Sache
150119610SacheAC_DEFUN(BASH_DECL_SBRK,
151119610Sache[AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>)
152119610SacheAC_CACHE_VAL(bash_cv_sbrk_declared,
153119610Sache[AC_EGREP_HEADER(sbrk, unistd.h,
154119610Sache bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)])
155119610SacheAC_MSG_RESULT($bash_cv_sbrk_declared)
156119610Sacheif test $bash_cv_sbrk_declared = yes; then
157119610SacheAC_DEFINE(SBRK_DECLARED)
15826497Sachefi
15926497Sache])
16026497Sache
16126497Sachednl
16226497Sachednl Check for sys_siglist[] or _sys_siglist[]
16326497Sachednl
16435486SacheAC_DEFUN(BASH_DECL_UNDER_SYS_SIGLIST,
16535486Sache[AC_MSG_CHECKING([for _sys_siglist in signal.h or unistd.h])
16635486SacheAC_CACHE_VAL(bash_cv_decl_under_sys_siglist,
16735486Sache[AC_TRY_COMPILE([
16835486Sache#include <sys/types.h>
16935486Sache#include <signal.h>
17035486Sache#ifdef HAVE_UNISTD_H
17135486Sache#include <unistd.h>
17235486Sache#endif], [ char *msg = _sys_siglist[2]; ],
17335486Sache  bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no,
17447558Sache  [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl
17535486SacheAC_MSG_RESULT($bash_cv_decl_under_sys_siglist)
17635486Sacheif test $bash_cv_decl_under_sys_siglist = yes; then
17735486SacheAC_DEFINE(UNDER_SYS_SIGLIST_DECLARED)
17835486Sachefi
17935486Sache])
18035486Sache
18126497SacheAC_DEFUN(BASH_UNDER_SYS_SIGLIST,
18235486Sache[AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
18335486SacheAC_MSG_CHECKING([for _sys_siglist in system C library])
18426497SacheAC_CACHE_VAL(bash_cv_under_sys_siglist,
18526497Sache[AC_TRY_RUN([
18626497Sache#include <sys/types.h>
18726497Sache#include <signal.h>
18826497Sache#ifdef HAVE_UNISTD_H
18926497Sache#include <unistd.h>
19026497Sache#endif
19135486Sache#ifndef UNDER_SYS_SIGLIST_DECLARED
19226497Sacheextern char *_sys_siglist[];
19326497Sache#endif
19426497Sachemain()
19526497Sache{
19635486Sachechar *msg = (char *)_sys_siglist[2];
19726497Sacheexit(msg == 0);
19826497Sache}],
19935486Sache	bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
20047558Sache	[AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)
20135486Sache	 bash_cv_under_sys_siglist=no])])
20226497SacheAC_MSG_RESULT($bash_cv_under_sys_siglist)
20326497Sacheif test $bash_cv_under_sys_siglist = yes; then
20426497SacheAC_DEFINE(HAVE_UNDER_SYS_SIGLIST)
20526497Sachefi
20626497Sache])
20726497Sache
20826497SacheAC_DEFUN(BASH_SYS_SIGLIST,
20926497Sache[AC_REQUIRE([AC_DECL_SYS_SIGLIST])
21026497SacheAC_MSG_CHECKING([for sys_siglist in system C library])
21126497SacheAC_CACHE_VAL(bash_cv_sys_siglist,
21226497Sache[AC_TRY_RUN([
21326497Sache#include <sys/types.h>
21426497Sache#include <signal.h>
21526497Sache#ifdef HAVE_UNISTD_H
21626497Sache#include <unistd.h>
21726497Sache#endif
21826497Sache#ifndef SYS_SIGLIST_DECLARED
21926497Sacheextern char *sys_siglist[];
22026497Sache#endif
22126497Sachemain()
22226497Sache{
22326497Sachechar *msg = sys_siglist[2];
22426497Sacheexit(msg == 0);
22526497Sache}],
22635486Sache	bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no,
22747558Sache	[AC_MSG_WARN(cannot check for sys_siglist if cross compiling -- defaulting to no)
22835486Sache	 bash_cv_sys_siglist=no])])
22926497SacheAC_MSG_RESULT($bash_cv_sys_siglist)
23026497Sacheif test $bash_cv_sys_siglist = yes; then
23126497SacheAC_DEFINE(HAVE_SYS_SIGLIST)
23226497Sachefi
23326497Sache])
23426497Sache
235119610Sachednl Check for the various permutations of sys_siglist and make sure we
236119610Sachednl compile in siglist.o if they're not defined
237119610SacheAC_DEFUN(BASH_CHECK_SYS_SIGLIST, [
238119610SacheAC_REQUIRE([BASH_SYS_SIGLIST])
239119610SacheAC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
240119610SacheAC_REQUIRE([BASH_FUNC_STRSIGNAL])
241119610Sacheif test "$bash_cv_sys_siglist" = no && test "$bash_cv_under_sys_siglist" = no && test "$bash_cv_have_strsignal" = no; then
242119610Sache  SIGLIST_O=siglist.o
243119610Sacheelse
244119610Sache  SIGLIST_O=
245119610Sachefi
246119610SacheAC_SUBST([SIGLIST_O])
247119610Sache])
248119610Sache
24926497Sachednl Check for sys_errlist[] and sys_nerr, check for declaration
25026497SacheAC_DEFUN(BASH_SYS_ERRLIST,
25126497Sache[AC_MSG_CHECKING([for sys_errlist and sys_nerr])
25226497SacheAC_CACHE_VAL(bash_cv_sys_errlist,
25326497Sache[AC_TRY_LINK([#include <errno.h>],
25426497Sache[extern char *sys_errlist[];
25526497Sache extern int sys_nerr;
25626497Sache char *msg = sys_errlist[sys_nerr - 1];],
25726497Sache    bash_cv_sys_errlist=yes, bash_cv_sys_errlist=no)])dnl
25826497SacheAC_MSG_RESULT($bash_cv_sys_errlist)
25926497Sacheif test $bash_cv_sys_errlist = yes; then
26026497SacheAC_DEFINE(HAVE_SYS_ERRLIST)
26126497Sachefi
26226497Sache])
26326497Sache
264119610Sachednl
265119610Sachednl Check if dup2() does not clear the close on exec flag
266119610Sachednl
267119610SacheAC_DEFUN(BASH_FUNC_DUP2_CLOEXEC_CHECK,
268119610Sache[AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag)
269119610SacheAC_CACHE_VAL(bash_cv_dup2_broken,
270119610Sache[AC_TRY_RUN([
271119610Sache#include <sys/types.h>
272119610Sache#include <fcntl.h>
273119610Sachemain()
274119610Sache{
275119610Sache  int fd1, fd2, fl;
276119610Sache  fd1 = open("/dev/null", 2);
277119610Sache  if (fcntl(fd1, 2, 1) < 0)
278119610Sache    exit(1);
279119610Sache  fd2 = dup2(fd1, 1);
280119610Sache  if (fd2 < 0)
281119610Sache    exit(2);
282119610Sache  fl = fcntl(fd2, 1, 0);
283119610Sache  /* fl will be 1 if dup2 did not reset the close-on-exec flag. */
284119610Sache  exit(fl != 1);
285119610Sache}
286119610Sache], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no,
287119610Sache    [AC_MSG_WARN(cannot check dup2 if cross compiling -- defaulting to no)
288119610Sache     bash_cv_dup2_broken=no])
289119610Sache])
290119610SacheAC_MSG_RESULT($bash_cv_dup2_broken)
291119610Sacheif test $bash_cv_dup2_broken = yes; then
292119610SacheAC_DEFINE(DUP2_BROKEN)
293119610Sachefi
294119610Sache])
295119610Sache
296119610SacheAC_DEFUN(BASH_FUNC_STRSIGNAL,
297119610Sache[AC_MSG_CHECKING([for the existence of strsignal])
298119610SacheAC_CACHE_VAL(bash_cv_have_strsignal,
299119610Sache[AC_TRY_LINK([#include <sys/types.h>
300119610Sache#include <signal.h>],
301119610Sache[char *s = (char *)strsignal(2);],
302119610Sache bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)])
303119610SacheAC_MSG_RESULT($bash_cv_have_strsignal)
304119610Sacheif test $bash_cv_have_strsignal = yes; then
305119610SacheAC_DEFINE(HAVE_STRSIGNAL)
306119610Sachefi
307119610Sache])
308119610Sache
30926497Sachednl Check to see if opendir will open non-directories (not a nice thing)
31026497SacheAC_DEFUN(BASH_FUNC_OPENDIR_CHECK,
31126497Sache[AC_REQUIRE([AC_HEADER_DIRENT])dnl
31226497SacheAC_MSG_CHECKING(if opendir() opens non-directories)
31326497SacheAC_CACHE_VAL(bash_cv_opendir_not_robust,
31426497Sache[AC_TRY_RUN([
31526497Sache#include <stdio.h>
31626497Sache#include <sys/types.h>
31726497Sache#include <fcntl.h>
31826497Sache#ifdef HAVE_UNISTD_H
31926497Sache# include <unistd.h>
32026497Sache#endif /* HAVE_UNISTD_H */
32126497Sache#if defined(HAVE_DIRENT_H)
32226497Sache# include <dirent.h>
32326497Sache#else
32426497Sache# define dirent direct
32526497Sache# ifdef HAVE_SYS_NDIR_H
32626497Sache#  include <sys/ndir.h>
32726497Sache# endif /* SYSNDIR */
32826497Sache# ifdef HAVE_SYS_DIR_H
32926497Sache#  include <sys/dir.h>
33026497Sache# endif /* SYSDIR */
33126497Sache# ifdef HAVE_NDIR_H
33226497Sache#  include <ndir.h>
33326497Sache# endif
33426497Sache#endif /* HAVE_DIRENT_H */
33526497Sachemain()
33626497Sache{
33726497SacheDIR *dir;
33858310Sacheint fd, err;
33958310Sacheerr = mkdir("/tmp/bash-aclocal", 0700);
34058310Sacheif (err < 0) {
34158310Sache  perror("mkdir");
34258310Sache  exit(1);
34358310Sache}
34458310Sacheunlink("/tmp/bash-aclocal/not_a_directory");
34558310Sachefd = open("/tmp/bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666);
34626497Sachewrite(fd, "\n", 1);
34726497Sacheclose(fd);
34858310Sachedir = opendir("/tmp/bash-aclocal/not_a_directory");
34958310Sacheunlink("/tmp/bash-aclocal/not_a_directory");
35058310Sachermdir("/tmp/bash-aclocal");
35126497Sacheexit (dir == 0);
35226497Sache}], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
35347558Sache    [AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
35435486Sache     bash_cv_opendir_not_robust=no]
35535486Sache)])
35626497SacheAC_MSG_RESULT($bash_cv_opendir_not_robust)
35726497Sacheif test $bash_cv_opendir_not_robust = yes; then
35826497SacheAC_DEFINE(OPENDIR_NOT_ROBUST)
35926497Sachefi
36026497Sache])
36126497Sache
36226497Sachednl
36326497SacheAC_DEFUN(BASH_TYPE_SIGHANDLER,
36426497Sache[AC_MSG_CHECKING([whether signal handlers are of type void])
36526497SacheAC_CACHE_VAL(bash_cv_void_sighandler,
36626497Sache[AC_TRY_COMPILE([#include <sys/types.h>
36726497Sache#include <signal.h>
36826497Sache#ifdef signal
36926497Sache#undef signal
37026497Sache#endif
37126497Sache#ifdef __cplusplus
37226497Sacheextern "C"
37326497Sache#endif
37426497Sachevoid (*signal ()) ();],
37526497Sache[int i;], bash_cv_void_sighandler=yes, bash_cv_void_sighandler=no)])dnl
37626497SacheAC_MSG_RESULT($bash_cv_void_sighandler)
37726497Sacheif test $bash_cv_void_sighandler = yes; then
37826497SacheAC_DEFINE(VOID_SIGHANDLER)
37926497Sachefi
38026497Sache])
38126497Sache
38258310Sachednl
38358310Sachednl A signed 16-bit integer quantity
38458310Sachednl
38558310SacheAC_DEFUN(BASH_TYPE_BITS16_T,
38635486Sache[
38758310Sacheif test "$ac_cv_sizeof_short" = 2; then
38858310Sache  AC_CHECK_TYPE(bits16_t, short)
38958310Sacheelif test "$ac_cv_sizeof_char" = 2; then
39058310Sache  AC_CHECK_TYPE(bits16_t, char)
39158310Sacheelse
39258310Sache  AC_CHECK_TYPE(bits16_t, short)
39358310Sachefi
39458310Sache])
39558310Sache
39658310Sachednl
39758310Sachednl An unsigned 16-bit integer quantity
39858310Sachednl
39958310SacheAC_DEFUN(BASH_TYPE_U_BITS16_T,
40058310Sache[
40158310Sacheif test "$ac_cv_sizeof_short" = 2; then
40258310Sache  AC_CHECK_TYPE(u_bits16_t, unsigned short)
40358310Sacheelif test "$ac_cv_sizeof_char" = 2; then
40458310Sache  AC_CHECK_TYPE(u_bits16_t, unsigned char)
40558310Sacheelse
40658310Sache  AC_CHECK_TYPE(u_bits16_t, unsigned short)
40758310Sachefi
40858310Sache])
40958310Sache
41058310Sachednl
41158310Sachednl A signed 32-bit integer quantity
41258310Sachednl
41358310SacheAC_DEFUN(BASH_TYPE_BITS32_T,
41458310Sache[
41547558Sacheif test "$ac_cv_sizeof_int" = 4; then
41658310Sache  AC_CHECK_TYPE(bits32_t, int)
41747558Sacheelif test "$ac_cv_sizeof_long" = 4; then
41858310Sache  AC_CHECK_TYPE(bits32_t, long)
41935486Sacheelse
42058310Sache  AC_CHECK_TYPE(bits32_t, int)
42135486Sachefi
42235486Sache])
42335486Sache
42458310Sachednl
42558310Sachednl An unsigned 32-bit integer quantity
42658310Sachednl
42758310SacheAC_DEFUN(BASH_TYPE_U_BITS32_T,
42835486Sache[
42947558Sacheif test "$ac_cv_sizeof_int" = 4; then
43058310Sache  AC_CHECK_TYPE(u_bits32_t, unsigned int)
43147558Sacheelif test "$ac_cv_sizeof_long" = 4; then
43258310Sache  AC_CHECK_TYPE(u_bits32_t, unsigned long)
43335486Sacheelse
43458310Sache  AC_CHECK_TYPE(u_bits32_t, unsigned int)
43535486Sachefi
43635486Sache])
43735486Sache
43835486SacheAC_DEFUN(BASH_TYPE_PTRDIFF_T,
43935486Sache[
44047558Sacheif test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then
44147558Sache  AC_CHECK_TYPE(ptrdiff_t, int)
44247558Sacheelif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then
44347558Sache  AC_CHECK_TYPE(ptrdiff_t, long)
444119610Sacheelif test "$ac_cv_type_long_long" = yes && test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_char_p"; then
445119610Sache  AC_CHECK_TYPE(ptrdiff_t, [long long])
44635486Sacheelse
44747558Sache  AC_CHECK_TYPE(ptrdiff_t, int)
44835486Sachefi
44947558Sache])
45047558Sache
45158310Sachednl
45258310Sachednl A signed 64-bit quantity
45358310Sachednl
45447558SacheAC_DEFUN(BASH_TYPE_BITS64_T,
45547558Sache[
456119610Sacheif test "$ac_cv_sizeof_char_p" = 8; then
45747558Sache  AC_CHECK_TYPE(bits64_t, char *)
45847558Sacheelif test "$ac_cv_sizeof_double" = 8; then
45947558Sache  AC_CHECK_TYPE(bits64_t, double)
460119610Sacheelif test -n "$ac_cv_type_long_long" && test "$ac_cv_sizeof_long_long" = 8; then
461119610Sache  AC_CHECK_TYPE(bits64_t, [long long])
46247558Sacheelif test "$ac_cv_sizeof_long" = 8; then
46347558Sache  AC_CHECK_TYPE(bits64_t, long)
46435486Sacheelse
46547558Sache  AC_CHECK_TYPE(bits64_t, double)
46635486Sachefi
46735486Sache])
46835486Sache
469119610SacheAC_DEFUN(BASH_TYPE_LONG_LONG,
470119610Sache[
471119610SacheAC_CACHE_CHECK([for long long], bash_cv_type_long_long,
472119610Sache[AC_TRY_LINK([
473119610Sachelong long ll = 1; int i = 63;],
474119610Sache[
475119610Sachelong long llm = (long long) -1;
476119610Sachereturn ll << i | ll >> i | llm / ll | llm % ll;
477119610Sache], bash_cv_type_long_long='long long', bash_cv_type_long_long='long')])
478119610Sacheif test "$bash_cv_type_long_long" = 'long long'; then
479119610Sache  AC_DEFINE(HAVE_LONG_LONG, 1)
48026497Sachefi
48126497Sache])
48226497Sache
483119610SacheAC_DEFUN(BASH_TYPE_UNSIGNED_LONG_LONG,
484119610Sache[
485119610SacheAC_CACHE_CHECK([for unsigned long long], bash_cv_type_unsigned_long_long,
486119610Sache[AC_TRY_LINK([
487119610Sacheunsigned long long ull = 1; int i = 63;],
488119610Sache[
489119610Sacheunsigned long long ullmax = (unsigned long long) -1;
490119610Sachereturn ull << i | ull >> i | ullmax / ull | ullmax % ull;
491119610Sache], bash_cv_type_unsigned_long_long='unsigned long long',
492119610Sache   bash_cv_type_unsigned_long_long='unsigned long')])
493119610Sacheif test "$bash_cv_type_unsigned_long_long" = 'unsigned long long'; then
494119610Sache  AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1)
495119610Sachefi
496119610Sache])
497119610Sache
498119610Sachednl
499119610Sachednl Type of struct rlimit fields: some systems (OSF/1, NetBSD, RISC/os 5.0)
500119610Sachednl have a rlim_t, others (4.4BSD based systems) use quad_t, others use
501119610Sachednl long and still others use int (HP-UX 9.01, SunOS 4.1.3).  To simplify
502119610Sachednl matters, this just checks for rlim_t, quad_t, or long.
503119610Sachednl
504119610SacheAC_DEFUN(BASH_TYPE_RLIMIT,
505119610Sache[AC_MSG_CHECKING(for size and type of struct rlimit fields)
506119610SacheAC_CACHE_VAL(bash_cv_type_rlimit,
507119610Sache[AC_TRY_COMPILE([#include <sys/types.h>
508119610Sache#include <sys/resource.h>],
509119610Sache[rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[
510119610SacheAC_TRY_RUN([
511119610Sache#include <sys/types.h>
512119610Sache#include <sys/time.h>
513119610Sache#include <sys/resource.h>
514119610Sachemain()
515119610Sache{
516119610Sache#ifdef HAVE_QUAD_T
517119610Sache  struct rlimit rl;
518119610Sache  if (sizeof(rl.rlim_cur) == sizeof(quad_t))
519119610Sache    exit(0);
520119610Sache#endif
521119610Sache  exit(1);
522119610Sache}], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long,
523119610Sache        [AC_MSG_WARN(cannot check quad_t if cross compiling -- defaulting to long)
524119610Sache         bash_cv_type_rlimit=long])])
525119610Sache])
526119610SacheAC_MSG_RESULT($bash_cv_type_rlimit)
527119610Sacheif test $bash_cv_type_rlimit = quad_t; then
528119610SacheAC_DEFINE(RLIMTYPE, quad_t)
529119610Sacheelif test $bash_cv_type_rlimit = rlim_t; then
530119610SacheAC_DEFINE(RLIMTYPE, rlim_t)
531119610Sachefi
532119610Sache])
533119610Sache
53426497SacheAC_DEFUN(BASH_FUNC_LSTAT,
53526497Sache[dnl Cannot use AC_CHECK_FUNCS(lstat) because Linux defines lstat() as an
53626497Sachednl inline function in <sys/stat.h>.
53726497SacheAC_CACHE_CHECK([for lstat], bash_cv_func_lstat,
53826497Sache[AC_TRY_LINK([
53926497Sache#include <sys/types.h>
54026497Sache#include <sys/stat.h>
54135486Sache],[ lstat(".",(struct stat *)0); ],
54226497Sachebash_cv_func_lstat=yes, bash_cv_func_lstat=no)])
54326497Sacheif test $bash_cv_func_lstat = yes; then
54426497Sache  AC_DEFINE(HAVE_LSTAT)
54526497Sachefi
54626497Sache])
54726497Sache
54858310SacheAC_DEFUN(BASH_FUNC_INET_ATON,
54958310Sache[
55058310SacheAC_CACHE_CHECK([for inet_aton], bash_cv_func_inet_aton,
55158310Sache[AC_TRY_LINK([
55258310Sache#include <sys/types.h>
55358310Sache#include <netinet/in.h>
55458310Sache#include <arpa/inet.h>
55558310Sachestruct in_addr ap;], [ inet_aton("127.0.0.1", &ap); ],
55658310Sachebash_cv_func_inet_aton=yes, bash_cv_func_inet_aton=no)])
55758310Sacheif test $bash_cv_func_inet_aton = yes; then
55858310Sache  AC_DEFINE(HAVE_INET_ATON)
559119610Sacheelse
560119610Sache  AC_LIBOBJ(inet_aton)
56158310Sachefi
56258310Sache])
56358310Sache
56426497SacheAC_DEFUN(BASH_FUNC_GETENV,
56526497Sache[AC_MSG_CHECKING(to see if getenv can be redefined)
56626497SacheAC_CACHE_VAL(bash_cv_getenv_redef,
56726497Sache[AC_TRY_RUN([
56826497Sache#ifdef HAVE_UNISTD_H
56926497Sache#  include <unistd.h>
57026497Sache#endif
57126497Sache#ifndef __STDC__
57226497Sache#  ifndef const
57326497Sache#    define const
57426497Sache#  endif
57526497Sache#endif
57626497Sachechar *
57726497Sachegetenv (name)
57826497Sache#if defined (__linux__) || defined (__bsdi__) || defined (convex)
57926497Sache     const char *name;
58026497Sache#else
58126497Sache     char const *name;
58226497Sache#endif /* !__linux__ && !__bsdi__ && !convex */
58326497Sache{
58426497Sachereturn "42";
58526497Sache}
58626497Sachemain()
58726497Sache{
58826497Sachechar *s;
58926497Sache/* The next allows this program to run, but does not allow bash to link
59026497Sache   when it redefines getenv.  I'm not really interested in figuring out
59126497Sache   why not. */
59226497Sache#if defined (NeXT)
59326497Sacheexit(1);
59426497Sache#endif
59526497Saches = getenv("ABCDE");
59626497Sacheexit(s == 0);	/* force optimizer to leave getenv in */
59726497Sache}
59826497Sache], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no,
59947558Sache   [AC_MSG_WARN(cannot check getenv redefinition if cross compiling -- defaulting to yes)
60035486Sache    bash_cv_getenv_redef=yes]
60135486Sache)])
60226497SacheAC_MSG_RESULT($bash_cv_getenv_redef)
60326497Sacheif test $bash_cv_getenv_redef = yes; then
60426497SacheAC_DEFINE(CAN_REDEFINE_GETENV)
60526497Sachefi
60626497Sache])
60726497Sache
608119610Sache# We should check for putenv before calling this
609119610SacheAC_DEFUN(BASH_FUNC_STD_PUTENV,
610119610Sache[
611119610SacheAC_REQUIRE([AC_HEADER_STDC])
612119610SacheAC_REQUIRE([AC_C_PROTOTYPES])
613119610SacheAC_CACHE_CHECK([for standard-conformant putenv declaration], bash_cv_std_putenv,
614119610Sache[AC_TRY_LINK([
615119610Sache#if STDC_HEADERS
616119610Sache#include <stdlib.h>
617119610Sache#include <stddef.h>
618119610Sache#endif
619119610Sache#ifndef __STDC__
620119610Sache#  ifndef const
621119610Sache#    define const
622119610Sache#  endif
623119610Sache#endif
624119610Sache#ifdef PROTOTYPES
625119610Sacheextern int putenv (char *);
62626497Sache#else
627119610Sacheextern int putenv ();
62826497Sache#endif
629119610Sache],
630119610Sache[return (putenv == 0);],
631119610Sachebash_cv_std_putenv=yes, bash_cv_std_putenv=no
63235486Sache)])
633119610Sacheif test $bash_cv_std_putenv = yes; then
634119610SacheAC_DEFINE(HAVE_STD_PUTENV)
63526497Sachefi
63626497Sache])
63726497Sache
638119610Sache# We should check for unsetenv before calling this
639119610SacheAC_DEFUN(BASH_FUNC_STD_UNSETENV,
640119610Sache[
641119610SacheAC_REQUIRE([AC_HEADER_STDC])
642119610SacheAC_REQUIRE([AC_C_PROTOTYPES])
643119610SacheAC_CACHE_CHECK([for standard-conformant unsetenv declaration], bash_cv_std_unsetenv,
644119610Sache[AC_TRY_LINK([
645119610Sache#if STDC_HEADERS
646119610Sache#include <stdlib.h>
647119610Sache#include <stddef.h>
648119610Sache#endif
649119610Sache#ifndef __STDC__
650119610Sache#  ifndef const
651119610Sache#    define const
652119610Sache#  endif
653119610Sache#endif
654119610Sache#ifdef PROTOTYPES
655119610Sacheextern int unsetenv (const char *);
656119610Sache#else
657119610Sacheextern int unsetenv ();
658119610Sache#endif
659119610Sache],
660119610Sache[return (unsetenv == 0);],
661119610Sachebash_cv_std_unsetenv=yes, bash_cv_std_unsetenv=no
662119610Sache)])
663119610Sacheif test $bash_cv_std_unsetenv = yes; then
664119610SacheAC_DEFINE(HAVE_STD_UNSETENV)
665119610Sachefi
666119610Sache])
667119610Sache
66826497SacheAC_DEFUN(BASH_FUNC_ULIMIT_MAXFDS,
66926497Sache[AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize)
67026497SacheAC_CACHE_VAL(bash_cv_ulimit_maxfds,
67126497Sache[AC_TRY_RUN([
67226497Sachemain()
67326497Sache{
67426497Sachelong maxfds = ulimit(4, 0L);
67526497Sacheexit (maxfds == -1L);
67626497Sache}
67735486Sache], bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
67847558Sache   [AC_MSG_WARN(cannot check ulimit if cross compiling -- defaulting to no)
67935486Sache    bash_cv_ulimit_maxfds=no]
68035486Sache)])
68126497SacheAC_MSG_RESULT($bash_cv_ulimit_maxfds)
68226497Sacheif test $bash_cv_ulimit_maxfds = yes; then
68326497SacheAC_DEFINE(ULIMIT_MAXFDS)
68426497Sachefi
68526497Sache])
68626497Sache
68726497SacheAC_DEFUN(BASH_FUNC_GETCWD,
688136644Sache[AC_MSG_CHECKING([if getcwd() will dynamically allocate memory])
689136644SacheAC_CACHE_VAL(bash_cv_getcwd_malloc,
69026497Sache[AC_TRY_RUN([
69126497Sache#include <stdio.h>
69226497Sache#ifdef HAVE_UNISTD_H
69326497Sache#include <unistd.h>
69426497Sache#endif
69526497Sache
69626497Sachemain()
69726497Sache{
698136644Sache	char	*xpwd;
699136644Sache	xpwd = getcwd(0, 0);
700136644Sache	exit (xpwd == 0);
70126497Sache}
702136644Sache], bash_cv_getcwd_malloc=yes, bash_cv_getcwd_malloc=no,
703136644Sache   [AC_MSG_WARN(cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no)
704136644Sache    bash_cv_getcwd_malloc=no]
70535486Sache)])
706136644SacheAC_MSG_RESULT($bash_cv_getcwd_malloc)
707136644Sacheif test $bash_cv_getcwd_malloc = no; then
70826497SacheAC_DEFINE(GETCWD_BROKEN)
709119610SacheAC_LIBOBJ(getcwd)
71026497Sachefi
71126497Sache])
71226497Sache
713119610Sachednl
714119610Sachednl This needs BASH_CHECK_SOCKLIB, but since that's not called on every
715119610Sachednl system, we can't use AC_PREREQ
716119610Sachednl
717119610SacheAC_DEFUN(BASH_FUNC_GETHOSTBYNAME,
718119610Sache[if test "X$bash_cv_have_gethostbyname" = "X"; then
719119610Sache_bash_needmsg=yes
720119610Sacheelse
721119610SacheAC_MSG_CHECKING(for gethostbyname in socket library)
722119610Sache_bash_needmsg=
723119610Sachefi
724119610SacheAC_CACHE_VAL(bash_cv_have_gethostbyname,
725119610Sache[AC_TRY_LINK([#include <netdb.h>],
726119610Sache[ struct hostent *hp;
727119610Sache  hp = gethostbyname("localhost");
728119610Sache], bash_cv_have_gethostbyname=yes, bash_cv_have_gethostbyname=no)]
729119610Sache)
730119610Sacheif test "X$_bash_needmsg" = Xyes; then
731119610Sache    AC_MSG_CHECKING(for gethostbyname in socket library)
732119610Sachefi
733119610SacheAC_MSG_RESULT($bash_cv_have_gethostbyname)
734119610Sacheif test "$bash_cv_have_gethostbyname" = yes; then
735119610SacheAC_DEFINE(HAVE_GETHOSTBYNAME)
736119610Sachefi
737119610Sache])
738119610Sache
739119610SacheAC_DEFUN(BASH_FUNC_FNMATCH_EXTMATCH,
740119610Sache[AC_MSG_CHECKING(if fnmatch does extended pattern matching with FNM_EXTMATCH)
741119610SacheAC_CACHE_VAL(bash_cv_fnm_extmatch,
742119610Sache[AC_TRY_RUN([
743119610Sache#include <fnmatch.h>
744119610Sache
745119610Sachemain()
746119610Sache{
747119610Sache#ifdef FNM_EXTMATCH
748119610Sache  exit (0);
749119610Sache#else
750119610Sache  exit (1);
751119610Sache#endif
752119610Sache}
753119610Sache], bash_cv_fnm_extmatch=yes, bash_cv_fnm_extmatch=no,
754119610Sache    [AC_MSG_WARN(cannot check FNM_EXTMATCH if cross compiling -- defaulting to no)
755119610Sache     bash_cv_fnm_extmatch=no])
756119610Sache])
757119610SacheAC_MSG_RESULT($bash_cv_fnm_extmatch)
758119610Sacheif test $bash_cv_fnm_extmatch = yes; then
759119610SacheAC_DEFINE(HAVE_LIBC_FNM_EXTMATCH)
760119610Sachefi
761119610Sache])
762119610Sache
763119610SacheAC_DEFUN(BASH_FUNC_POSIX_SETJMP,
764119610Sache[AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
765119610SacheAC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp)
766119610SacheAC_CACHE_VAL(bash_cv_func_sigsetjmp,
767119610Sache[AC_TRY_RUN([
768119610Sache#ifdef HAVE_UNISTD_H
769119610Sache#include <unistd.h>
770119610Sache#endif
771119610Sache#include <sys/types.h>
772119610Sache#include <signal.h>
773119610Sache#include <setjmp.h>
774119610Sache
775119610Sachemain()
776119610Sache{
777119610Sache#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
778119610Sacheexit (1);
779119610Sache#else
780119610Sache
781119610Sacheint code;
782119610Sachesigset_t set, oset;
783119610Sachesigjmp_buf xx;
784119610Sache
785119610Sache/* get the mask */
786119610Sachesigemptyset(&set);
787119610Sachesigemptyset(&oset);
788119610Sachesigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set);
789119610Sachesigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
790119610Sache
791119610Sache/* save it */
792119610Sachecode = sigsetjmp(xx, 1);
793119610Sacheif (code)
794119610Sache  exit(0);	/* could get sigmask and compare to oset here. */
795119610Sache
796119610Sache/* change it */
797119610Sachesigaddset(&set, SIGINT);
798119610Sachesigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
799119610Sache
800119610Sache/* and siglongjmp */
801119610Sachesiglongjmp(xx, 10);
802119610Sacheexit(1);
803119610Sache#endif
804119610Sache}], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
805119610Sache    [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing)
806119610Sache     bash_cv_func_sigsetjmp=missing]
807119610Sache)])
808119610SacheAC_MSG_RESULT($bash_cv_func_sigsetjmp)
809119610Sacheif test $bash_cv_func_sigsetjmp = present; then
810119610SacheAC_DEFINE(HAVE_POSIX_SIGSETJMP)
811119610Sachefi
812119610Sache])
813119610Sache
814119610SacheAC_DEFUN(BASH_FUNC_STRCOLL,
815119610Sache[
816119610SacheAC_MSG_CHECKING(whether or not strcoll and strcmp differ)
817119610SacheAC_CACHE_VAL(bash_cv_func_strcoll_broken,
818119610Sache[AC_TRY_RUN([
819119610Sache#include <stdio.h>
820119610Sache#if defined (HAVE_LOCALE_H)
821119610Sache#include <locale.h>
822119610Sache#endif
823119610Sache
824119610Sachemain(c, v)
825119610Sacheint     c;
826119610Sachechar    *v[];
827119610Sache{
828119610Sache        int     r1, r2;
829119610Sache        char    *deflocale, *defcoll;
830119610Sache
831119610Sache#ifdef HAVE_SETLOCALE
832119610Sache        deflocale = setlocale(LC_ALL, "");
833119610Sache	defcoll = setlocale(LC_COLLATE, "");
834119610Sache#endif
835119610Sache
836119610Sache#ifdef HAVE_STRCOLL
837119610Sache	/* These two values are taken from tests/glob-test. */
838119610Sache        r1 = strcoll("abd", "aXd");
839119610Sache#else
840119610Sache	r1 = 0;
841119610Sache#endif
842119610Sache        r2 = strcmp("abd", "aXd");
843119610Sache
844119610Sache	/* These two should both be greater than 0.  It is permissible for
845119610Sache	   a system to return different values, as long as the sign is the
846119610Sache	   same. */
847119610Sache
848119610Sache        /* Exit with 1 (failure) if these two values are both > 0, since
849119610Sache	   this tests whether strcoll(3) is broken with respect to strcmp(3)
850119610Sache	   in the default locale. */
851119610Sache	exit (r1 > 0 && r2 > 0);
852119610Sache}
853119610Sache], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
854119610Sache   [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no)
855119610Sache    bash_cv_func_strcoll_broken=no]
856119610Sache)])
857119610SacheAC_MSG_RESULT($bash_cv_func_strcoll_broken)
858119610Sacheif test $bash_cv_func_strcoll_broken = yes; then
859119610SacheAC_DEFINE(STRCOLL_BROKEN)
860119610Sachefi
861119610Sache])
862119610Sache
863119610SacheAC_DEFUN(BASH_FUNC_PRINTF_A_FORMAT,
864119610Sache[AC_MSG_CHECKING([for printf floating point output in hex notation])
865119610SacheAC_CACHE_VAL(bash_cv_printf_a_format,
866119610Sache[AC_TRY_RUN([
867119610Sache#include <stdio.h>
868119610Sache#include <string.h>
869119610Sache
870119610Sacheint
871119610Sachemain()
872119610Sache{
873119610Sache	double y = 0.0;
874119610Sache	char abuf[1024];
875119610Sache
876119610Sache	sprintf(abuf, "%A", y);
877119610Sache	exit(strchr(abuf, 'P') == (char *)0);
878119610Sache}
879119610Sache], bash_cv_printf_a_format=yes, bash_cv_printf_a_format=no,
880119610Sache   [AC_MSG_WARN(cannot check printf if cross compiling -- defaulting to no)
881119610Sache    bash_cv_printf_a_format=no]
882119610Sache)])
883119610SacheAC_MSG_RESULT($bash_cv_printf_a_format)
884119610Sacheif test $bash_cv_printf_a_format = yes; then
885119610SacheAC_DEFINE(HAVE_PRINTF_A_FORMAT)
886119610Sachefi
887119610Sache])
888119610Sache
889119610SacheAC_DEFUN(BASH_STRUCT_TERMIOS_LDISC,
890119610Sache[
891119610SacheAC_CHECK_MEMBER(struct termios.c_line, AC_DEFINE(TERMIOS_LDISC), ,[
892119610Sache#include <sys/types.h>
893119610Sache#include <termios.h>
894119610Sache])
895119610Sache])
896119610Sache
897119610SacheAC_DEFUN(BASH_STRUCT_TERMIO_LDISC,
898119610Sache[
899119610SacheAC_CHECK_MEMBER(struct termio.c_line, AC_DEFINE(TERMIO_LDISC), ,[
900119610Sache#include <sys/types.h>
901119610Sache#include <termio.h>
902119610Sache])
903119610Sache])
904119610Sache
905119610Sachednl
906119610Sachednl Like AC_STRUCT_ST_BLOCKS, but doesn't muck with LIBOBJS
907119610Sachednl
908119610Sachednl sets bash_cv_struct_stat_st_blocks
909119610Sachednl
910119610Sachednl unused for now; we'll see how AC_CHECK_MEMBERS works
911119610Sachednl
912119610SacheAC_DEFUN(BASH_STRUCT_ST_BLOCKS,
913119610Sache[
914119610SacheAC_MSG_CHECKING([for struct stat.st_blocks])
915119610SacheAC_CACHE_VAL(bash_cv_struct_stat_st_blocks,
916119610Sache[AC_TRY_COMPILE(
917119610Sache[
918119610Sache#include <sys/types.h>
919119610Sache#include <sys/stat.h>
920119610Sache],
921119610Sache[
922119610Sachemain()
923119610Sache{
924119610Sachestatic struct stat a;
925119610Sacheif (a.st_blocks) return 0;
926119610Sachereturn 0;
927119610Sache}
928119610Sache], bash_cv_struct_stat_st_blocks=yes, bash_cv_struct_stat_st_blocks=no)
929119610Sache])
930119610SacheAC_MSG_RESULT($bash_cv_struct_stat_st_blocks)
931119610Sacheif test "$bash_cv_struct_stat_st_blocks" = "yes"; then
932119610SacheAC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS)
933119610Sachefi
934119610Sache])
935119610Sache
936165670SacheAC_DEFUN([BASH_CHECK_LIB_TERMCAP],
937119610Sache[
938119610Sacheif test "X$bash_cv_termcap_lib" = "X"; then
939119610Sache_bash_needmsg=yes
940119610Sacheelse
941119610SacheAC_MSG_CHECKING(which library has the termcap functions)
942119610Sache_bash_needmsg=
943119610Sachefi
944119610SacheAC_CACHE_VAL(bash_cv_termcap_lib,
945136644Sache[AC_CHECK_FUNC(tgetent, bash_cv_termcap_lib=libc,
946136644Sache  [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
947119610Sache    [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo,
948119610Sache        [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
949119610Sache	    [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
950136644Sache	        bash_cv_termcap_lib=gnutermcap)])])])])])
951119610Sacheif test "X$_bash_needmsg" = "Xyes"; then
952119610SacheAC_MSG_CHECKING(which library has the termcap functions)
953119610Sachefi
954119610SacheAC_MSG_RESULT(using $bash_cv_termcap_lib)
955119610Sacheif test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
956119610SacheLDFLAGS="$LDFLAGS -L./lib/termcap"
957119610SacheTERMCAP_LIB="./lib/termcap/libtermcap.a"
958119610SacheTERMCAP_DEP="./lib/termcap/libtermcap.a"
959119610Sacheelif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
960119610SacheTERMCAP_LIB=-ltermcap
961119610SacheTERMCAP_DEP=
962119610Sacheelif test $bash_cv_termcap_lib = libtinfo; then
963119610SacheTERMCAP_LIB=-ltinfo
964119610SacheTERMCAP_DEP=
965119610Sacheelif test $bash_cv_termcap_lib = libncurses; then
966119610SacheTERMCAP_LIB=-lncurses
967119610SacheTERMCAP_DEP=
968136644Sacheelif test $bash_cv_termcap_lib = libc; then
969136644SacheTERMCAP_LIB=
970136644SacheTERMCAP_DEP=
971119610Sacheelse
972119610SacheTERMCAP_LIB=-lcurses
973119610SacheTERMCAP_DEP=
974119610Sachefi
975119610Sache])
976119610Sache
977119610Sachednl
978119610Sachednl Check for the presence of getpeername in libsocket.
979119610Sachednl If libsocket is present, check for libnsl and add it to LIBS if
980119610Sachednl it's there, since most systems with libsocket require linking
981119610Sachednl with libnsl as well.  This should only be called if getpeername
982119610Sachednl was not found in libc.
983119610Sachednl
984119610Sachednl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT
985119610Sachednl	  AS WELL
986119610Sachednl
987119610SacheAC_DEFUN(BASH_CHECK_LIB_SOCKET,
988119610Sache[
989119610Sacheif test "X$bash_cv_have_socklib" = "X"; then
990119610Sache_bash_needmsg=
991119610Sacheelse
992119610SacheAC_MSG_CHECKING(for socket library)
993119610Sache_bash_needmsg=yes
994119610Sachefi
995119610SacheAC_CACHE_VAL(bash_cv_have_socklib,
996119610Sache[AC_CHECK_LIB(socket, getpeername,
997119610Sache        bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)])
998119610Sacheif test "X$_bash_needmsg" = Xyes; then
999119610Sache  AC_MSG_RESULT($bash_cv_have_socklib)
1000119610Sache  _bash_needmsg=
1001119610Sachefi
1002119610Sacheif test $bash_cv_have_socklib = yes; then
1003119610Sache  # check for libnsl, add it to LIBS if present
1004119610Sache  if test "X$bash_cv_have_libnsl" = "X"; then
1005119610Sache    _bash_needmsg=
1006119610Sache  else
1007119610Sache    AC_MSG_CHECKING(for libnsl)
1008119610Sache    _bash_needmsg=yes
1009119610Sache  fi
1010119610Sache  AC_CACHE_VAL(bash_cv_have_libnsl,
1011119610Sache	   [AC_CHECK_LIB(nsl, t_open,
1012119610Sache		 bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)])
1013119610Sache  if test "X$_bash_needmsg" = Xyes; then
1014119610Sache    AC_MSG_RESULT($bash_cv_have_libnsl)
1015119610Sache    _bash_needmsg=
1016119610Sache  fi
1017119610Sache  if test $bash_cv_have_libnsl = yes; then
1018119610Sache    LIBS="-lsocket -lnsl $LIBS"
1019119610Sache  else
1020119610Sache    LIBS="-lsocket $LIBS"
1021119610Sache  fi
1022119610Sache  AC_DEFINE(HAVE_LIBSOCKET)
1023119610Sache  AC_DEFINE(HAVE_GETPEERNAME)
1024119610Sachefi
1025119610Sache])
1026119610Sache
102726497SacheAC_DEFUN(BASH_STRUCT_DIRENT_D_INO,
102826497Sache[AC_REQUIRE([AC_HEADER_DIRENT])
1029136644SacheAC_MSG_CHECKING(for struct dirent.d_ino)
103026497SacheAC_CACHE_VAL(bash_cv_dirent_has_dino,
103126497Sache[AC_TRY_COMPILE([
103226497Sache#include <stdio.h>
103326497Sache#include <sys/types.h>
103426497Sache#ifdef HAVE_UNISTD_H
103526497Sache# include <unistd.h>
103626497Sache#endif /* HAVE_UNISTD_H */
103726497Sache#if defined(HAVE_DIRENT_H)
103826497Sache# include <dirent.h>
103926497Sache#else
104026497Sache# define dirent direct
104126497Sache# ifdef HAVE_SYS_NDIR_H
104226497Sache#  include <sys/ndir.h>
104326497Sache# endif /* SYSNDIR */
104426497Sache# ifdef HAVE_SYS_DIR_H
104526497Sache#  include <sys/dir.h>
104626497Sache# endif /* SYSDIR */
104726497Sache# ifdef HAVE_NDIR_H
104826497Sache#  include <ndir.h>
104926497Sache# endif
105026497Sache#endif /* HAVE_DIRENT_H */
105126497Sache],[
105226497Sachestruct dirent d; int z; z = d.d_ino;
105326497Sache], bash_cv_dirent_has_dino=yes, bash_cv_dirent_has_dino=no)])
105426497SacheAC_MSG_RESULT($bash_cv_dirent_has_dino)
105526497Sacheif test $bash_cv_dirent_has_dino = yes; then
1056136644SacheAC_DEFINE(HAVE_STRUCT_DIRENT_D_INO)
105726497Sachefi
105826497Sache])
105926497Sache
106026497SacheAC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO,
106126497Sache[AC_REQUIRE([AC_HEADER_DIRENT])
1062136644SacheAC_MSG_CHECKING(for struct dirent.d_fileno)
106326497SacheAC_CACHE_VAL(bash_cv_dirent_has_d_fileno,
106426497Sache[AC_TRY_COMPILE([
106526497Sache#include <stdio.h>
106626497Sache#include <sys/types.h>
106726497Sache#ifdef HAVE_UNISTD_H
106826497Sache# include <unistd.h>
106926497Sache#endif /* HAVE_UNISTD_H */
107026497Sache#if defined(HAVE_DIRENT_H)
107126497Sache# include <dirent.h>
107226497Sache#else
107326497Sache# define dirent direct
107426497Sache# ifdef HAVE_SYS_NDIR_H
107526497Sache#  include <sys/ndir.h>
107626497Sache# endif /* SYSNDIR */
107726497Sache# ifdef HAVE_SYS_DIR_H
107826497Sache#  include <sys/dir.h>
107926497Sache# endif /* SYSDIR */
108026497Sache# ifdef HAVE_NDIR_H
108126497Sache#  include <ndir.h>
108226497Sache# endif
108326497Sache#endif /* HAVE_DIRENT_H */
108426497Sache],[
108526497Sachestruct dirent d; int z; z = d.d_fileno;
108626497Sache], bash_cv_dirent_has_d_fileno=yes, bash_cv_dirent_has_d_fileno=no)])
108726497SacheAC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
108826497Sacheif test $bash_cv_dirent_has_d_fileno = yes; then
1089136644SacheAC_DEFINE(HAVE_STRUCT_DIRENT_D_FILENO)
109026497Sachefi
109126497Sache])
109226497Sache
1093136644SacheAC_DEFUN(BASH_STRUCT_DIRENT_D_NAMLEN,
1094136644Sache[AC_REQUIRE([AC_HEADER_DIRENT])
1095136644SacheAC_MSG_CHECKING(for struct dirent.d_namlen)
1096136644SacheAC_CACHE_VAL(bash_cv_dirent_has_d_namlen,
1097136644Sache[AC_TRY_COMPILE([
1098136644Sache#include <stdio.h>
1099136644Sache#include <sys/types.h>
1100136644Sache#ifdef HAVE_UNISTD_H
1101136644Sache# include <unistd.h>
1102136644Sache#endif /* HAVE_UNISTD_H */
1103136644Sache#if defined(HAVE_DIRENT_H)
1104136644Sache# include <dirent.h>
1105136644Sache#else
1106136644Sache# define dirent direct
1107136644Sache# ifdef HAVE_SYS_NDIR_H
1108136644Sache#  include <sys/ndir.h>
1109136644Sache# endif /* SYSNDIR */
1110136644Sache# ifdef HAVE_SYS_DIR_H
1111136644Sache#  include <sys/dir.h>
1112136644Sache# endif /* SYSDIR */
1113136644Sache# ifdef HAVE_NDIR_H
1114136644Sache#  include <ndir.h>
1115136644Sache# endif
1116136644Sache#endif /* HAVE_DIRENT_H */
1117136644Sache],[
1118136644Sachestruct dirent d; int z; z = d.d_namlen;
1119136644Sache], bash_cv_dirent_has_d_namlen=yes, bash_cv_dirent_has_d_namlen=no)])
1120136644SacheAC_MSG_RESULT($bash_cv_dirent_has_d_namlen)
1121136644Sacheif test $bash_cv_dirent_has_d_namlen = yes; then
1122136644SacheAC_DEFINE(HAVE_STRUCT_DIRENT_D_NAMLEN)
1123136644Sachefi
1124136644Sache])
1125136644Sache
1126119610SacheAC_DEFUN(BASH_STRUCT_TIMEVAL,
1127119610Sache[AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
1128119610SacheAC_CACHE_VAL(bash_cv_struct_timeval,
1129119610Sache[
1130119610SacheAC_EGREP_HEADER(struct timeval, sys/time.h,
1131119610Sache		bash_cv_struct_timeval=yes,
1132119610Sache		AC_EGREP_HEADER(struct timeval, time.h,
1133119610Sache			bash_cv_struct_timeval=yes,
1134119610Sache			bash_cv_struct_timeval=no))
1135119610Sache])
1136119610SacheAC_MSG_RESULT($bash_cv_struct_timeval)
1137119610Sacheif test $bash_cv_struct_timeval = yes; then
1138119610Sache  AC_DEFINE(HAVE_TIMEVAL)
1139119610Sachefi
1140119610Sache])
1141119610Sache
1142136644SacheAC_DEFUN(BASH_STRUCT_TIMEZONE,
1143136644Sache[AC_MSG_CHECKING(for struct timezone in sys/time.h and time.h)
1144136644SacheAC_CACHE_VAL(bash_cv_struct_timezone,
1145136644Sache[
1146136644SacheAC_EGREP_HEADER(struct timezone, sys/time.h,
1147136644Sache		bash_cv_struct_timezone=yes,
1148136644Sache		AC_EGREP_HEADER(struct timezone, time.h,
1149136644Sache			bash_cv_struct_timezone=yes,
1150136644Sache			bash_cv_struct_timezone=no))
1151136644Sache])
1152136644SacheAC_MSG_RESULT($bash_cv_struct_timezone)
1153136644Sacheif test $bash_cv_struct_timezone = yes; then
1154136644Sache  AC_DEFINE(HAVE_STRUCT_TIMEZONE)
1155136644Sachefi
1156136644Sache])
1157136644Sache
1158119610SacheAC_DEFUN(BASH_STRUCT_WINSIZE,
1159119610Sache[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h)
1160119610SacheAC_CACHE_VAL(bash_cv_struct_winsize_header,
1161119610Sache[AC_TRY_COMPILE([#include <sys/types.h>
1162119610Sache#include <sys/ioctl.h>], [struct winsize x;],
1163119610Sache  bash_cv_struct_winsize_header=ioctl_h,
1164119610Sache  [AC_TRY_COMPILE([#include <sys/types.h>
1165119610Sache#include <termios.h>], [struct winsize x;],
1166119610Sache  bash_cv_struct_winsize_header=termios_h, bash_cv_struct_winsize_header=other)
1167119610Sache])])
1168119610Sacheif test $bash_cv_struct_winsize_header = ioctl_h; then
1169119610Sache  AC_MSG_RESULT(sys/ioctl.h)
1170119610Sache  AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
1171119610Sacheelif test $bash_cv_struct_winsize_header = termios_h; then
1172119610Sache  AC_MSG_RESULT(termios.h)
1173119610Sache  AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS)
1174119610Sacheelse
1175119610Sache  AC_MSG_RESULT(not found)
1176119610Sachefi
1177119610Sache])
1178119610Sache
1179119610Sachednl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
1180119610SacheAC_DEFUN(BASH_SYS_SIGNAL_VINTAGE,
118126497Sache[AC_REQUIRE([AC_TYPE_SIGNAL])
1182119610SacheAC_MSG_CHECKING(for type of signal functions)
1183119610SacheAC_CACHE_VAL(bash_cv_signal_vintage,
1184119610Sache[
1185119610Sache  AC_TRY_LINK([#include <signal.h>],[
1186119610Sache    sigset_t ss;
1187119610Sache    struct sigaction sa;
1188119610Sache    sigemptyset(&ss); sigsuspend(&ss);
1189119610Sache    sigaction(SIGINT, &sa, (struct sigaction *) 0);
1190119610Sache    sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
1191119610Sache  ], bash_cv_signal_vintage=posix,
1192119610Sache  [
1193119610Sache    AC_TRY_LINK([#include <signal.h>], [
1194119610Sache	int mask = sigmask(SIGINT);
1195119610Sache	sigsetmask(mask); sigblock(mask); sigpause(mask);
1196119610Sache    ], bash_cv_signal_vintage=4.2bsd,
1197119610Sache    [
1198119610Sache      AC_TRY_LINK([
1199119610Sache	#include <signal.h>
1200119610Sache	RETSIGTYPE foo() { }], [
1201119610Sache		int mask = sigmask(SIGINT);
1202119610Sache		sigset(SIGINT, foo); sigrelse(SIGINT);
1203119610Sache		sighold(SIGINT); sigpause(SIGINT);
1204119610Sache        ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7
1205119610Sache    )]
1206119610Sache  )]
1207119610Sache)
1208119610Sache])
1209119610SacheAC_MSG_RESULT($bash_cv_signal_vintage)
1210119610Sacheif test "$bash_cv_signal_vintage" = posix; then
1211119610SacheAC_DEFINE(HAVE_POSIX_SIGNALS)
1212119610Sacheelif test "$bash_cv_signal_vintage" = "4.2bsd"; then
1213119610SacheAC_DEFINE(HAVE_BSD_SIGNALS)
1214119610Sacheelif test "$bash_cv_signal_vintage" = svr3; then
1215119610SacheAC_DEFINE(HAVE_USG_SIGHOLD)
1216119610Sachefi
1217119610Sache])
1218119610Sache
1219119610Sachednl Check if the pgrp of setpgrp() can't be the pid of a zombie process.
1220119610SacheAC_DEFUN(BASH_SYS_PGRP_SYNC,
1221119610Sache[AC_REQUIRE([AC_FUNC_GETPGRP])
1222119610SacheAC_MSG_CHECKING(whether pgrps need synchronization)
1223119610SacheAC_CACHE_VAL(bash_cv_pgrp_pipe,
1224119610Sache[AC_TRY_RUN([
1225119610Sache#ifdef HAVE_UNISTD_H
1226119610Sache#  include <unistd.h>
1227119610Sache#endif
1228119610Sachemain()
1229119610Sache{
1230119610Sache# ifdef GETPGRP_VOID
1231119610Sache#  define getpgID()	getpgrp()
1232119610Sache# else
1233119610Sache#  define getpgID()	getpgrp(0)
1234119610Sache#  define setpgid(x,y)	setpgrp(x,y)
1235119610Sache# endif
1236119610Sache	int pid1, pid2, fds[2];
1237119610Sache	int status;
1238119610Sache	char ok;
1239119610Sache
1240119610Sache	switch (pid1 = fork()) {
1241119610Sache	  case -1:
1242119610Sache	    exit(1);
1243119610Sache	  case 0:
1244119610Sache	    setpgid(0, getpid());
1245119610Sache	    exit(0);
1246119610Sache	}
1247119610Sache	setpgid(pid1, pid1);
1248119610Sache
1249119610Sache	sleep(2);	/* let first child die */
1250119610Sache
1251119610Sache	if (pipe(fds) < 0)
1252119610Sache	  exit(2);
1253119610Sache
1254119610Sache	switch (pid2 = fork()) {
1255119610Sache	  case -1:
1256119610Sache	    exit(3);
1257119610Sache	  case 0:
1258119610Sache	    setpgid(0, pid1);
1259119610Sache	    ok = getpgID() == pid1;
1260119610Sache	    write(fds[1], &ok, 1);
1261119610Sache	    exit(0);
1262119610Sache	}
1263119610Sache	setpgid(pid2, pid1);
1264119610Sache
1265119610Sache	close(fds[1]);
1266119610Sache	if (read(fds[0], &ok, 1) != 1)
1267119610Sache	  exit(4);
1268119610Sache	wait(&status);
1269119610Sache	wait(&status);
1270119610Sache	exit(ok ? 0 : 5);
1271119610Sache}
1272119610Sache], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
1273119610Sache   [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
1274119610Sache    bash_cv_pgrp_pipe=no])
1275119610Sache])
1276119610SacheAC_MSG_RESULT($bash_cv_pgrp_pipe)
1277119610Sacheif test $bash_cv_pgrp_pipe = yes; then
1278119610SacheAC_DEFINE(PGRP_PIPE)
1279119610Sachefi
1280119610Sache])
1281119610Sache
1282119610SacheAC_DEFUN(BASH_SYS_REINSTALL_SIGHANDLERS,
1283119610Sache[AC_REQUIRE([AC_TYPE_SIGNAL])
1284119610SacheAC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
128526497SacheAC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
128626497SacheAC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
128726497Sache[AC_TRY_RUN([
128826497Sache#include <signal.h>
128926497Sache#ifdef HAVE_UNISTD_H
129026497Sache#include <unistd.h>
129126497Sache#endif
129226497Sache
129326497Sachetypedef RETSIGTYPE sigfunc();
129426497Sache
129526497Sacheint nsigint;
129626497Sache
129726497Sache#ifdef HAVE_POSIX_SIGNALS
129826497Sachesigfunc *
129926497Sacheset_signal_handler(sig, handler)
130026497Sache     int sig;
130126497Sache     sigfunc *handler;
130226497Sache{
130326497Sache  struct sigaction act, oact;
130426497Sache  act.sa_handler = handler;
130526497Sache  act.sa_flags = 0;
130626497Sache  sigemptyset (&act.sa_mask);
130726497Sache  sigemptyset (&oact.sa_mask);
130826497Sache  sigaction (sig, &act, &oact);
130926497Sache  return (oact.sa_handler);
131026497Sache}
131126497Sache#else
131226497Sache#define set_signal_handler(s, h) signal(s, h)
131326497Sache#endif
131426497Sache
131526497SacheRETSIGTYPE
131626497Sachesigint(s)
131726497Sacheint s;
131826497Sache{
131926497Sache  nsigint++;
132026497Sache}
132126497Sache
132226497Sachemain()
132326497Sache{
132426497Sache	nsigint = 0;
132526497Sache	set_signal_handler(SIGINT, sigint);
132626497Sache	kill((int)getpid(), SIGINT);
132726497Sache	kill((int)getpid(), SIGINT);
132826497Sache	exit(nsigint != 2);
132926497Sache}
133026497Sache], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
133147558Sache   [AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting to no)
133235486Sache    bash_cv_must_reinstall_sighandlers=no]
133335486Sache)])
133426497SacheAC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
133526497Sacheif test $bash_cv_must_reinstall_sighandlers = yes; then
133626497SacheAC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
133726497Sachefi
133826497Sache])
133926497Sache
134026497Sachednl check that some necessary job control definitions are present
1341119610SacheAC_DEFUN(BASH_SYS_JOB_CONTROL_MISSING,
1342119610Sache[AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
134326497SacheAC_MSG_CHECKING(for presence of necessary job control definitions)
134426497SacheAC_CACHE_VAL(bash_cv_job_control_missing,
134526497Sache[AC_TRY_RUN([
134626497Sache#include <sys/types.h>
134726497Sache#ifdef HAVE_SYS_WAIT_H
134826497Sache#include <sys/wait.h>
134926497Sache#endif
135026497Sache#ifdef HAVE_UNISTD_H
135126497Sache#include <unistd.h>
135226497Sache#endif
135326497Sache#include <signal.h>
135426497Sache
135526497Sache/* Add more tests in here as appropriate. */
135626497Sachemain()
135726497Sache{
135826497Sache/* signal type */
135926497Sache#if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS)
136026497Sacheexit(1);
136126497Sache#endif
136226497Sache
136326497Sache/* signals and tty control. */
136426497Sache#if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT)
136526497Sacheexit (1);
136626497Sache#endif
136726497Sache
136826497Sache/* process control */
136926497Sache#if !defined (WNOHANG) || !defined (WUNTRACED) 
137026497Sacheexit(1);
137126497Sache#endif
137226497Sache
137326497Sache/* Posix systems have tcgetpgrp and waitpid. */
137426497Sache#if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP)
137526497Sacheexit(1);
137626497Sache#endif
137726497Sache
137826497Sache#if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID)
137926497Sacheexit(1);
138026497Sache#endif
138126497Sache
138226497Sache/* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */
138326497Sache#if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3)
138426497Sacheexit(1);
138526497Sache#endif
138626497Sache
138726497Sacheexit(0);
138835486Sache}], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
138947558Sache    [AC_MSG_WARN(cannot check job control if cross-compiling -- defaulting to missing)
139035486Sache     bash_cv_job_control_missing=missing]
139135486Sache)])
139226497SacheAC_MSG_RESULT($bash_cv_job_control_missing)
139326497Sacheif test $bash_cv_job_control_missing = missing; then
139426497SacheAC_DEFINE(JOB_CONTROL_MISSING)
139526497Sachefi
139626497Sache])
139726497Sache
139826497Sachednl check whether named pipes are present
139926497Sachednl this requires a previous check for mkfifo, but that is awkward to specify
140026497SacheAC_DEFUN(BASH_SYS_NAMED_PIPES,
140126497Sache[AC_MSG_CHECKING(for presence of named pipes)
140226497SacheAC_CACHE_VAL(bash_cv_sys_named_pipes,
140326497Sache[AC_TRY_RUN([
140426497Sache#include <sys/types.h>
140526497Sache#include <sys/stat.h>
140626497Sache#ifdef HAVE_UNISTD_H
140726497Sache#include <unistd.h>
140826497Sache#endif
140926497Sache
141026497Sache/* Add more tests in here as appropriate. */
141126497Sachemain()
141226497Sache{
141358310Sacheint fd, err;
141426497Sache
141526497Sache#if defined (HAVE_MKFIFO)
141626497Sacheexit (0);
141726497Sache#endif
141826497Sache
141926497Sache#if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO))
142026497Sacheexit (1);
142126497Sache#endif
142226497Sache
142326497Sache#if defined (NeXT)
142426497Sacheexit (1);
142526497Sache#endif
142658310Sacheerr = mkdir("/tmp/bash-aclocal", 0700);
142758310Sacheif (err < 0) {
142858310Sache  perror ("mkdir");
142958310Sache  exit(1);
143058310Sache}
143158310Sachefd = mknod ("/tmp/bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
143258310Sacheif (fd == -1) {
143358310Sache  rmdir ("/tmp/bash-aclocal");
143426497Sache  exit (1);
143558310Sache}
143626497Sacheclose(fd);
143758310Sacheunlink ("/tmp/bash-aclocal/sh-np-autoconf");
143858310Sachermdir ("/tmp/bash-aclocal");
143926497Sacheexit(0);
144035486Sache}], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
144147558Sache    [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
144235486Sache     bash_cv_sys_named_pipes=missing]
144335486Sache)])
144426497SacheAC_MSG_RESULT($bash_cv_sys_named_pipes)
144526497Sacheif test $bash_cv_sys_named_pipes = missing; then
144626497SacheAC_DEFINE(NAMED_PIPES_MISSING)
144726497Sachefi
144826497Sache])
144926497Sache
1450119610SacheAC_DEFUN(BASH_SYS_DEFAULT_MAIL_DIR,
1451119610Sache[AC_MSG_CHECKING(for default mail directory)
1452119610SacheAC_CACHE_VAL(bash_cv_mail_dir,
1453119610Sache[if test -d /var/mail; then
1454119610Sache   bash_cv_mail_dir=/var/mail
1455119610Sache elif test -d /var/spool/mail; then
1456119610Sache   bash_cv_mail_dir=/var/spool/mail
1457119610Sache elif test -d /usr/mail; then
1458119610Sache   bash_cv_mail_dir=/usr/mail
1459119610Sache elif test -d /usr/spool/mail; then
1460119610Sache   bash_cv_mail_dir=/usr/spool/mail
1461119610Sache else
1462119610Sache   bash_cv_mail_dir=unknown
1463119610Sache fi
146426497Sache])
1465119610SacheAC_MSG_RESULT($bash_cv_mail_dir)
1466119610SacheAC_DEFINE_UNQUOTED(DEFAULT_MAIL_DIRECTORY, "$bash_cv_mail_dir")
1467119610Sache])
146826497Sache
146926497SacheAC_DEFUN(BASH_HAVE_TIOCGWINSZ,
147026497Sache[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
147126497SacheAC_CACHE_VAL(bash_cv_tiocgwinsz_in_ioctl,
147226497Sache[AC_TRY_COMPILE([#include <sys/types.h>
147326497Sache#include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
147426497Sache  bash_cv_tiocgwinsz_in_ioctl=yes,bash_cv_tiocgwinsz_in_ioctl=no)])
147526497SacheAC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl)
147626497Sacheif test $bash_cv_tiocgwinsz_in_ioctl = yes; then   
147726497SacheAC_DEFINE(GWINSZ_IN_SYS_IOCTL)
147826497Sachefi
147926497Sache])
148026497Sache
148126497SacheAC_DEFUN(BASH_HAVE_TIOCSTAT,
148226497Sache[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
148326497SacheAC_CACHE_VAL(bash_cv_tiocstat_in_ioctl,
148426497Sache[AC_TRY_COMPILE([#include <sys/types.h>
148526497Sache#include <sys/ioctl.h>], [int x = TIOCSTAT;],
148626497Sache  bash_cv_tiocstat_in_ioctl=yes,bash_cv_tiocstat_in_ioctl=no)])
148726497SacheAC_MSG_RESULT($bash_cv_tiocstat_in_ioctl)
148826497Sacheif test $bash_cv_tiocstat_in_ioctl = yes; then   
148926497SacheAC_DEFINE(TIOCSTAT_IN_SYS_IOCTL)
149026497Sachefi
149126497Sache])
149226497Sache
149326497SacheAC_DEFUN(BASH_HAVE_FIONREAD,
149426497Sache[AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
149526497SacheAC_CACHE_VAL(bash_cv_fionread_in_ioctl,
149626497Sache[AC_TRY_COMPILE([#include <sys/types.h>
149726497Sache#include <sys/ioctl.h>], [int x = FIONREAD;],
149826497Sache  bash_cv_fionread_in_ioctl=yes,bash_cv_fionread_in_ioctl=no)])
149926497SacheAC_MSG_RESULT($bash_cv_fionread_in_ioctl)
150026497Sacheif test $bash_cv_fionread_in_ioctl = yes; then   
150126497SacheAC_DEFINE(FIONREAD_IN_SYS_IOCTL)
150226497Sachefi
150326497Sache])
150426497Sache
150526497Sachednl
150626497Sachednl See if speed_t is declared in <sys/types.h>.  Some versions of linux
150726497Sachednl require a definition of speed_t each time <termcap.h> is included,
150826497Sachednl but you can only get speed_t if you include <termios.h> (on some
150926497Sachednl versions) or <sys/types.h> (on others).
151026497Sachednl
1511119610SacheAC_DEFUN(BASH_CHECK_SPEED_T,
151226497Sache[AC_MSG_CHECKING(for speed_t in sys/types.h)
151326497SacheAC_CACHE_VAL(bash_cv_speed_t_in_sys_types,
151426497Sache[AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;],
151526497Sache  bash_cv_speed_t_in_sys_types=yes,bash_cv_speed_t_in_sys_types=no)])
151626497SacheAC_MSG_RESULT($bash_cv_speed_t_in_sys_types)
151726497Sacheif test $bash_cv_speed_t_in_sys_types = yes; then   
151826497SacheAC_DEFINE(SPEED_T_IN_SYS_TYPES)
151926497Sachefi
152026497Sache])
152126497Sache
152226497SacheAC_DEFUN(BASH_CHECK_GETPW_FUNCS,
152375406Sache[AC_MSG_CHECKING(whether getpw functions are declared in pwd.h)
152475406SacheAC_CACHE_VAL(bash_cv_getpw_declared,
152575406Sache[AC_EGREP_CPP(getpwuid,
152675406Sache[
152775406Sache#include <sys/types.h>
152875406Sache#ifdef HAVE_UNISTD_H
152975406Sache#  include <unistd.h>
153075406Sache#endif
153126497Sache#include <pwd.h>
153275406Sache],
153375406Sachebash_cv_getpw_declared=yes,bash_cv_getpw_declared=no)])
153475406SacheAC_MSG_RESULT($bash_cv_getpw_declared)
153575406Sacheif test $bash_cv_getpw_declared = yes; then
153626497SacheAC_DEFINE(HAVE_GETPW_DECLS)
153726497Sachefi
153826497Sache])
153926497Sache
154026497SacheAC_DEFUN(BASH_CHECK_DEV_FD,
154126497Sache[AC_MSG_CHECKING(whether /dev/fd is available)
154226497SacheAC_CACHE_VAL(bash_cv_dev_fd,
1543165670Sache[bash_cv_dev_fd=""
1544165670Sacheif test -d /dev/fd  && test -r /dev/fd/0 < /dev/null; then
1545157184Sache# check for systems like FreeBSD 5 that only provide /dev/fd/[012]
1546165670Sache   exec 3</dev/null
1547157184Sache   if test -r /dev/fd/3; then
1548157184Sache     bash_cv_dev_fd=standard
1549157184Sache   else
1550157184Sache     bash_cv_dev_fd=absent
1551157184Sache   fi
1552157184Sache   exec 3<&-
1553165670Sachefi
1554165670Sacheif test -z "$bash_cv_dev_fd" ; then 
1555165670Sache  if test -d /proc/self/fd && test -r /proc/self/fd/0 < /dev/null; then
1556165670Sache    bash_cv_dev_fd=whacky
1557165670Sache  else
1558165670Sache    bash_cv_dev_fd=absent
1559165670Sache  fi
1560165670Sachefi
156126497Sache])
156226497SacheAC_MSG_RESULT($bash_cv_dev_fd)
156326497Sacheif test $bash_cv_dev_fd = "standard"; then
156426497Sache  AC_DEFINE(HAVE_DEV_FD)
156526497Sache  AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/")
156626497Sacheelif test $bash_cv_dev_fd = "whacky"; then
156726497Sache  AC_DEFINE(HAVE_DEV_FD)
156826497Sache  AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/")
156926497Sachefi
157026497Sache])
157126497Sache
157258310SacheAC_DEFUN(BASH_CHECK_DEV_STDIN,
157358310Sache[AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
157458310SacheAC_CACHE_VAL(bash_cv_dev_stdin,
1575136644Sache[if test -d /dev/fd && test -r /dev/stdin < /dev/null; then
157658310Sache   bash_cv_dev_stdin=present
1577136644Sache elif test -d /proc/self/fd && test -r /dev/stdin < /dev/null; then
157858310Sache   bash_cv_dev_stdin=present
157958310Sache else
158058310Sache   bash_cv_dev_stdin=absent
158158310Sache fi
158258310Sache])
158358310SacheAC_MSG_RESULT($bash_cv_dev_stdin)
158458310Sacheif test $bash_cv_dev_stdin = "present"; then
158558310Sache  AC_DEFINE(HAVE_DEV_STDIN)
158658310Sachefi
158758310Sache])
158858310Sache
158926497Sachednl
159026497Sachednl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions
159126497Sachednl
1592119610SacheAC_DEFUN(BASH_CHECK_KERNEL_RLIMIT,
159326497Sache[AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines])
159426497SacheAC_CACHE_VAL(bash_cv_kernel_rlimit,
159526497Sache[AC_TRY_COMPILE([
159626497Sache#include <sys/types.h>
159726497Sache#include <sys/resource.h>
159826497Sache],
159926497Sache[
160026497Sache  int f;
160126497Sache  f = RLIMIT_DATA;
160226497Sache], bash_cv_kernel_rlimit=no,
160335486Sache[AC_TRY_COMPILE([
160435486Sache#include <sys/types.h>
160535486Sache#define _KERNEL
160635486Sache#include <sys/resource.h>
160735486Sache#undef _KERNEL
160835486Sache],
160935486Sache[
161026497Sache	int f;
161126497Sache        f = RLIMIT_DATA;
161235486Sache], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)]
161326497Sache)])
161426497SacheAC_MSG_RESULT($bash_cv_kernel_rlimit)
161526497Sacheif test $bash_cv_kernel_rlimit = yes; then
161626497SacheAC_DEFINE(RLIMIT_NEEDS_KERNEL)
161726497Sachefi
161826497Sache])
161926497Sache
162035486Sachednl
162147558Sachednl Check for 64-bit off_t -- used for malloc alignment
162247558Sachednl
162347558Sachednl C does not allow duplicate case labels, so the compile will fail if
162447558Sachednl sizeof(off_t) is > 4.
162547558Sachednl
162647558SacheAC_DEFUN(BASH_CHECK_OFF_T_64,
162747558Sache[AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64,
162847558SacheAC_TRY_COMPILE([
162947558Sache#ifdef HAVE_UNISTD_H
163047558Sache#include <unistd.h>
163147558Sache#endif
163247558Sache#include <sys/types.h>
163347558Sache],[
163447558Sacheswitch (0) case 0: case (sizeof (off_t) <= 4):;
163547558Sache], bash_cv_off_t_64=no, bash_cv_off_t_64=yes))
163647558Sacheif test $bash_cv_off_t_64 = yes; then
163747558Sache        AC_DEFINE(HAVE_OFF_T_64)
163847558Sachefi])
163958310Sache
164075406SacheAC_DEFUN(BASH_CHECK_RTSIGS,
164175406Sache[AC_MSG_CHECKING(for unusable real-time signals due to large values)
164275406SacheAC_CACHE_VAL(bash_cv_unusable_rtsigs,
164375406Sache[AC_TRY_RUN([
164475406Sache#include <sys/types.h>
164575406Sache#include <signal.h>
164675406Sache
164775406Sache#ifndef NSIG
164875406Sache#  define NSIG 64
164975406Sache#endif
165075406Sache
165175406Sachemain ()
165275406Sache{
165375406Sache  int n_sigs = 2 * NSIG;
165475406Sache#ifdef SIGRTMIN
165575406Sache  int rtmin = SIGRTMIN;
165675406Sache#else
165775406Sache  int rtmin = 0;
165875406Sache#endif
165975406Sache
166075406Sache  exit(rtmin < n_sigs);
166175406Sache}], bash_cv_unusable_rtsigs=yes, bash_cv_unusable_rtsigs=no,
166275406Sache    [AC_MSG_WARN(cannot check real-time signals if cross compiling -- defaulting to yes)
166375406Sache     bash_cv_unusable_rtsigs=yes]
166475406Sache)])
166575406SacheAC_MSG_RESULT($bash_cv_unusable_rtsigs)
166675406Sacheif test $bash_cv_unusable_rtsigs = yes; then
166775406SacheAC_DEFINE(UNUSABLE_RT_SIGNALS)
166875406Sachefi
166975406Sache])
1670119610Sache
1671119610Sachednl
1672119610Sachednl check for availability of multibyte characters and functions
1673119610Sachednl
1674165670Sachednl geez, I wish I didn't have to check for all of this stuff separately
1675165670Sachednl
1676119610SacheAC_DEFUN(BASH_CHECK_MULTIBYTE,
1677119610Sache[
1678119610SacheAC_CHECK_HEADERS(wctype.h)
1679119610SacheAC_CHECK_HEADERS(wchar.h)
1680119610SacheAC_CHECK_HEADERS(langinfo.h)
1681119610Sache
1682119610SacheAC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
1683136644SacheAC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))
1684165670Sache
1685165670SacheAC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB))
1686165670SacheAC_CHECK_FUNC(wcscoll, AC_DEFINE(HAVE_WCSCOLL))
1687165670SacheAC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP))
1688119610SacheAC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
1689165670SacheAC_CHECK_FUNC(wctype, AC_DEFINE(HAVE_WCTYPE))
1690119610Sache
1691165670Sachednl checks for both mbrtowc and mbstate_t
1692165670SacheAC_FUNC_MBRTOWC
1693165670Sacheif test $ac_cv_func_mbrtowc = yes; then
1694119610Sache	AC_DEFINE(HAVE_MBSTATE_T)
1695119610Sachefi
1696119610Sache
1697165670SacheAC_CHECK_FUNCS(iswlower iswupper towlower towupper iswctype)
1698165670Sache
1699119610SacheAC_CACHE_CHECK([for nl_langinfo and CODESET], bash_cv_langinfo_codeset,
1700119610Sache[AC_TRY_LINK(
1701119610Sache[#include <langinfo.h>],
1702119610Sache[char* cs = nl_langinfo(CODESET);],
1703119610Sachebash_cv_langinfo_codeset=yes, bash_cv_langinfo_codeset=no)])
1704119610Sacheif test $bash_cv_langinfo_codeset = yes; then
1705119610Sache  AC_DEFINE(HAVE_LANGINFO_CODESET)
1706119610Sachefi
1707119610Sache
1708165670Sachednl check for wchar_t in <wchar.h>
1709165670SacheAC_CACHE_CHECK([for wchar_t in wchar.h], bash_cv_type_wchar_t,
1710165670Sache[AC_TRY_COMPILE(
1711165670Sache[#include <wchar.h>
1712165670Sache],
1713165670Sache[
1714165670Sache        wchar_t foo;
1715165670Sache        foo = 0;
1716165670Sache], bash_cv_type_wchar_t=yes, bash_cv_type_wchar_t=no)])
1717165670Sacheif test $bash_cv_type_wchar_t = yes; then
1718165670Sache        AC_DEFINE(HAVE_WCHAR_T, 1, [systems should define this type here])
1719165670Sachefi
1720165670Sache
1721165670Sachednl check for wctype_t in <wctype.h>
1722165670SacheAC_CACHE_CHECK([for wctype_t in wctype.h], bash_cv_type_wctype_t,
1723165670Sache[AC_TRY_COMPILE(
1724165670Sache[#include <wctype.h>],
1725165670Sache[
1726165670Sache        wctype_t foo;
1727165670Sache        foo = 0;
1728165670Sache], bash_cv_type_wctype_t=yes, bash_cv_type_wctype_t=no)])
1729165670Sacheif test $bash_cv_type_wctype_t = yes; then
1730165670Sache        AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here])
1731165670Sachefi
1732165670Sache
1733165670Sachednl check for wint_t in <wctype.h>
1734165670SacheAC_CACHE_CHECK([for wint_t in wctype.h], bash_cv_type_wint_t,
1735165670Sache[AC_TRY_COMPILE(
1736165670Sache[#include <wctype.h>],
1737165670Sache[
1738165670Sache        wint_t foo;
1739165670Sache        foo = 0;
1740165670Sache], bash_cv_type_wint_t=yes, bash_cv_type_wint_t=no)])
1741165670Sacheif test $bash_cv_type_wint_t = yes; then
1742165670Sache        AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])
1743165670Sachefi
1744165670Sache
1745119610Sache])
1746119610Sache
1747119610Sachednl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
1748119610Sachednl require:
1749119610Sachednl	AC_PROG_CC
1750119610Sachednl	BASH_CHECK_LIB_TERMCAP
1751119610Sache
1752165670SacheAC_DEFUN([RL_LIB_READLINE_VERSION],
1753119610Sache[
1754119610SacheAC_REQUIRE([BASH_CHECK_LIB_TERMCAP])
1755119610Sache
1756119610SacheAC_MSG_CHECKING([version of installed readline library])
1757119610Sache
1758119610Sache# What a pain in the ass this is.
1759119610Sache
1760119610Sache# save cpp and ld options
1761119610Sache_save_CFLAGS="$CFLAGS"
1762119610Sache_save_LDFLAGS="$LDFLAGS"
1763119610Sache_save_LIBS="$LIBS"
1764119610Sache
1765119610Sache# Don't set ac_cv_rl_prefix if the caller has already assigned a value.  This
1766119610Sache# allows the caller to do something like $_rl_prefix=$withval if the user
1767119610Sache# specifies --with-installed-readline=PREFIX as an argument to configure
1768119610Sache
1769119610Sacheif test -z "$ac_cv_rl_prefix"; then
1770119610Sachetest "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix}
1771119610Sachefi
1772119610Sache
1773119610Sacheeval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include
1774119610Sacheeval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib
1775119610Sache
1776119610SacheLIBS="$LIBS -lreadline ${TERMCAP_LIB}"
1777119610SacheCFLAGS="$CFLAGS -I${ac_cv_rl_includedir}"
1778119610SacheLDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}"
1779119610Sache
1780136644SacheAC_CACHE_VAL(ac_cv_rl_version,
1781136644Sache[AC_TRY_RUN([
1782119610Sache#include <stdio.h>
1783119610Sache#include <readline/readline.h>
1784119610Sache
1785157184Sacheextern int rl_gnu_readline_p;
1786157184Sache
1787119610Sachemain()
1788119610Sache{
1789119610Sache	FILE *fp;
1790119610Sache	fp = fopen("conftest.rlv", "w");
1791157184Sache	if (fp == 0)
1792157184Sache		exit(1);
1793157184Sache	if (rl_gnu_readline_p != 1)
1794157184Sache		fprintf(fp, "0.0\n");
1795157184Sache	else
1796157184Sache		fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0");
1797119610Sache	fclose(fp);
1798119610Sache	exit(0);
1799119610Sache}
1800119610Sache],
1801119610Sacheac_cv_rl_version=`cat conftest.rlv`,
1802119610Sacheac_cv_rl_version='0.0',
1803136644Sacheac_cv_rl_version='4.2')])
1804119610Sache
1805119610SacheCFLAGS="$_save_CFLAGS"
1806119610SacheLDFLAGS="$_save_LDFLAGS"
1807119610SacheLIBS="$_save_LIBS"
1808119610Sache
1809119610SacheRL_MAJOR=0
1810119610SacheRL_MINOR=0
1811119610Sache
1812119610Sache# (
1813119610Sachecase "$ac_cv_rl_version" in
1814119610Sache2*|3*|4*|5*|6*|7*|8*|9*)
1815119610Sache	RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'`
1816119610Sache	RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[[a-zA-Z]]*$::'`
1817119610Sache	;;
1818119610Sacheesac
1819119610Sache
1820119610Sache# (((
1821119610Sachecase $RL_MAJOR in
1822119610Sache[[0-9][0-9]])	_RL_MAJOR=$RL_MAJOR ;;
1823119610Sache[[0-9]])	_RL_MAJOR=0$RL_MAJOR ;;
1824119610Sache*)		_RL_MAJOR=00 ;;
1825119610Sacheesac
1826119610Sache
1827119610Sache# (((
1828119610Sachecase $RL_MINOR in
1829119610Sache[[0-9][0-9]])	_RL_MINOR=$RL_MINOR ;;
1830119610Sache[[0-9]])	_RL_MINOR=0$RL_MINOR ;;
1831119610Sache*)		_RL_MINOR=00 ;;
1832119610Sacheesac
1833119610Sache
1834119610SacheRL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}"
1835119610Sache
1836119610Sache# Readline versions greater than 4.2 have these defines in readline.h
1837119610Sache
1838119610Sacheif test $ac_cv_rl_version = '0.0' ; then
1839119610Sache	AC_MSG_WARN([Could not test version of installed readline library.])
1840119610Sacheelif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then
1841119610Sache	# set these for use by the caller
1842119610Sache	RL_PREFIX=$ac_cv_rl_prefix
1843119610Sache	RL_LIBDIR=$ac_cv_rl_libdir
1844119610Sache	RL_INCLUDEDIR=$ac_cv_rl_includedir
1845119610Sache	AC_MSG_RESULT($ac_cv_rl_version)
1846119610Sacheelse
1847119610Sache
1848119610SacheAC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library])
1849119610SacheAC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library])
1850119610SacheAC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library])
1851119610Sache
1852119610SacheAC_SUBST(RL_VERSION)
1853119610SacheAC_SUBST(RL_MAJOR)
1854119610SacheAC_SUBST(RL_MINOR)
1855119610Sache
1856119610Sache# set these for use by the caller
1857119610SacheRL_PREFIX=$ac_cv_rl_prefix
1858119610SacheRL_LIBDIR=$ac_cv_rl_libdir
1859119610SacheRL_INCLUDEDIR=$ac_cv_rl_includedir
1860119610Sache
1861119610SacheAC_MSG_RESULT($ac_cv_rl_version)
1862119610Sache
1863119610Sachefi
1864119610Sache])
1865136644Sache
1866136644SacheAC_DEFUN(BASH_FUNC_CTYPE_NONASCII,
1867136644Sache[
1868136644SacheAC_MSG_CHECKING(whether the ctype macros accept non-ascii characters)
1869136644SacheAC_CACHE_VAL(bash_cv_func_ctype_nonascii,
1870136644Sache[AC_TRY_RUN([
1871136644Sache#ifdef HAVE_LOCALE_H
1872136644Sache#include <locale.h>
1873136644Sache#endif
1874136644Sache#include <stdio.h>
1875136644Sache#include <ctype.h>
1876136644Sache
1877136644Sachemain(c, v)
1878136644Sacheint	c;
1879136644Sachechar	*v[];
1880136644Sache{
1881136644Sache	char	*deflocale;
1882136644Sache	unsigned char x;
1883136644Sache	int	r1, r2;
1884136644Sache
1885136644Sache#ifdef HAVE_SETLOCALE
1886136644Sache	/* We take a shot here.  If that locale is not known, try the
1887136644Sache	   system default.  We try this one because '\342' (226) is
1888136644Sache	   known to be a printable character in that locale. */
1889136644Sache	deflocale = setlocale(LC_ALL, "en_US.ISO8859-1");
1890136644Sache	if (deflocale == 0)
1891136644Sache		deflocale = setlocale(LC_ALL, "");
1892136644Sache#endif
1893136644Sache
1894136644Sache	x = '\342';
1895136644Sache	r1 = isprint(x);
1896136644Sache	x -= 128;
1897136644Sache	r2 = isprint(x);
1898136644Sache	exit (r1 == 0 || r2 == 0);
1899136644Sache}
1900136644Sache], bash_cv_func_ctype_nonascii=yes, bash_cv_func_ctype_nonascii=no,
1901136644Sache   [AC_MSG_WARN(cannot check ctype macros if cross compiling -- defaulting to no)
1902136644Sache    bash_cv_func_ctype_nonascii=no]
1903136644Sache)])
1904136644SacheAC_MSG_RESULT($bash_cv_func_ctype_nonascii)
1905136644Sacheif test $bash_cv_func_ctype_nonascii = yes; then
1906136644SacheAC_DEFINE(CTYPE_NON_ASCII)
1907136644Sachefi
1908136644Sache])
1909136644Sache
1910157184SacheAC_DEFUN(BASH_CHECK_WCONTINUED,
1911157184Sache[
1912157184SacheAC_MSG_CHECKING(whether WCONTINUED flag to waitpid is unavailable or available but broken)
1913157184SacheAC_CACHE_VAL(bash_cv_wcontinued_broken,
1914157184Sache[AC_TRY_RUN([
1915157184Sache#include <sys/types.h>
1916157184Sache#include <sys/wait.h>
1917157184Sache#include <unistd.h>
1918157184Sache#include <errno.h>
1919157184Sache
1920157184Sache#ifndef errno
1921157184Sacheextern int errno;
1922157184Sache#endif
1923157184Sachemain()
1924157184Sache{
1925157184Sache	int	x;
1926157184Sache
1927157184Sache	x = waitpid(-1, (int *)0, WNOHANG|WCONTINUED);
1928157184Sache	if (x == -1 && errno == EINVAL)
1929157184Sache		exit (1);
1930157184Sache	else
1931157184Sache		exit (0);
1932157184Sache}
1933157184Sache], bash_cv_wcontinued_broken=no,bash_cv_wcontinued_broken=yes,
1934157184Sache   [AC_MSG_WARN(cannot check WCONTINUED if cross compiling -- defaulting to no)
1935157184Sache    bash_cv_wcontinued_broken=no]
1936157184Sache)])
1937157184SacheAC_MSG_RESULT($bash_cv_wcontinued_broken)
1938157184Sacheif test $bash_cv_wcontinued_broken = yes; then
1939157184SacheAC_DEFINE(WCONTINUED_BROKEN)
1940157184Sachefi
1941157184Sache])
1942157184Sache
1943136644Sachednl
1944136644Sachednl tests added for bashdb
1945136644Sachednl
1946136644Sache
1947136644Sache
1948136644SacheAC_DEFUN([AM_PATH_LISPDIR],
1949136644Sache [AC_ARG_WITH(lispdir, AC_HELP_STRING([--with-lispdir], [override the default lisp directory]),
1950136644Sache  [ lispdir="$withval" 
1951136644Sache    AC_MSG_CHECKING([where .elc files should go])
1952136644Sache    AC_MSG_RESULT([$lispdir])],
1953136644Sache  [
1954136644Sache  # If set to t, that means we are running in a shell under Emacs.
1955136644Sache  # If you have an Emacs named "t", then use the full path.
1956136644Sache  test x"$EMACS" = xt && EMACS=
1957136644Sache  AC_CHECK_PROGS(EMACS, emacs xemacs, no)
1958136644Sache  if test $EMACS != "no"; then
1959136644Sache    if test x${lispdir+set} != xset; then
1960136644Sache      AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [dnl
1961136644Sache	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;}'`
1962136644Sache	if test -z "$am_cv_lispdir"; then
1963136644Sache	  am_cv_lispdir='${datadir}/emacs/site-lisp'
1964136644Sache	fi
1965136644Sache      ])
1966136644Sache      lispdir="$am_cv_lispdir"
1967136644Sache    fi
1968136644Sache  fi
1969136644Sache ])
1970136644Sache AC_SUBST(lispdir)
1971136644Sache])
1972136644Sache
1973136644Sachednl
1974136644Sachednl tests added for gettext
1975136644Sachednl
1976136644Sache# codeset.m4 serial AM1 (gettext-0.10.40)
1977136644Sachednl Copyright (C) 2000-2002 Free Software Foundation, Inc.
1978136644Sachednl This file is free software, distributed under the terms of the GNU
1979136644Sachednl General Public License.  As a special exception to the GNU General
1980136644Sachednl Public License, this file may be distributed as part of a program
1981136644Sachednl that contains a configuration script generated by Autoconf, under
1982136644Sachednl the same distribution terms as the rest of that program.
1983136644Sache
1984136644Sachednl From Bruno Haible.
1985136644Sache
1986136644SacheAC_DEFUN([AM_LANGINFO_CODESET],
1987136644Sache[
1988136644Sache  AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
1989136644Sache    [AC_TRY_LINK([#include <langinfo.h>],
1990136644Sache      [char* cs = nl_langinfo(CODESET);],
1991136644Sache      am_cv_langinfo_codeset=yes,
1992136644Sache      am_cv_langinfo_codeset=no)
1993136644Sache    ])
1994136644Sache  if test $am_cv_langinfo_codeset = yes; then
1995136644Sache    AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
1996136644Sache      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
1997136644Sache  fi
1998136644Sache])
1999136644Sache# gettext.m4 serial 20 (gettext-0.12)
2000136644Sachednl Copyright (C) 1995-2003 Free Software Foundation, Inc.
2001136644Sachednl This file is free software, distributed under the terms of the GNU
2002136644Sachednl General Public License.  As a special exception to the GNU General
2003136644Sachednl Public License, this file may be distributed as part of a program
2004136644Sachednl that contains a configuration script generated by Autoconf, under
2005136644Sachednl the same distribution terms as the rest of that program.
2006136644Sachednl
2007136644Sachednl This file can can be used in projects which are not available under
2008136644Sachednl the GNU General Public License or the GNU Library General Public
2009136644Sachednl License but which still want to provide support for the GNU gettext
2010136644Sachednl functionality.
2011136644Sachednl Please note that the actual code of the GNU gettext library is covered
2012136644Sachednl by the GNU Library General Public License, and the rest of the GNU
2013136644Sachednl gettext package package is covered by the GNU General Public License.
2014136644Sachednl They are *not* in the public domain.
2015136644Sache
2016136644Sachednl Authors:
2017136644Sachednl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
2018136644Sachednl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
2019136644Sache
2020136644Sachednl Macro to add for using GNU gettext.
2021136644Sache
2022136644Sachednl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
2023136644Sachednl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
2024136644Sachednl    default (if it is not specified or empty) is 'no-libtool'.
2025136644Sachednl    INTLSYMBOL should be 'external' for packages with no intl directory,
2026136644Sachednl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
2027136644Sachednl    If INTLSYMBOL is 'use-libtool', then a libtool library
2028136644Sachednl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
2029136644Sachednl    depending on --{enable,disable}-{shared,static} and on the presence of
2030136644Sachednl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
2031136644Sachednl    $(top_builddir)/intl/libintl.a will be created.
2032136644Sachednl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
2033136644Sachednl    implementations (in libc or libintl) without the ngettext() function
2034136644Sachednl    will be ignored.  If NEEDSYMBOL is specified and is
2035136644Sachednl    'need-formatstring-macros', then GNU gettext implementations that don't
2036136644Sachednl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
2037136644Sachednl INTLDIR is used to find the intl libraries.  If empty,
2038136644Sachednl    the value `$(top_builddir)/intl/' is used.
2039136644Sachednl
2040136644Sachednl The result of the configuration is one of three cases:
2041136644Sachednl 1) GNU gettext, as included in the intl subdirectory, will be compiled
2042136644Sachednl    and used.
2043136644Sachednl    Catalog format: GNU --> install in $(datadir)
2044136644Sachednl    Catalog extension: .mo after installation, .gmo in source tree
2045136644Sachednl 2) GNU gettext has been found in the system's C library.
2046136644Sachednl    Catalog format: GNU --> install in $(datadir)
2047136644Sachednl    Catalog extension: .mo after installation, .gmo in source tree
2048136644Sachednl 3) No internationalization, always use English msgid.
2049136644Sachednl    Catalog format: none
2050136644Sachednl    Catalog extension: none
2051136644Sachednl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
2052136644Sachednl The use of .gmo is historical (it was needed to avoid overwriting the
2053136644Sachednl GNU format catalogs when building on a platform with an X/Open gettext),
2054136644Sachednl but we keep it in order not to force irrelevant filename changes on the
2055136644Sachednl maintainers.
2056136644Sachednl
2057136644SacheAC_DEFUN([AM_GNU_GETTEXT],
2058136644Sache[
2059136644Sache  dnl Argument checking.
2060136644Sache  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
2061136644Sache    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
2062136644Sache])])])])])
2063136644Sache  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
2064136644Sache    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
2065136644Sache])])])])
2066136644Sache  define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
2067136644Sache  define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
2068136644Sache
2069136644Sache  AC_REQUIRE([AM_PO_SUBDIRS])dnl
2070136644Sache  ifelse(gt_included_intl, yes, [
2071136644Sache    AC_REQUIRE([AM_INTL_SUBDIR])dnl
2072136644Sache  ])
2073136644Sache
2074136644Sache  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
2075136644Sache  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2076136644Sache  AC_REQUIRE([AC_LIB_RPATH])
2077136644Sache
2078136644Sache  dnl Sometimes libintl requires libiconv, so first search for libiconv.
2079136644Sache  dnl Ideally we would do this search only after the
2080136644Sache  dnl      if test "$USE_NLS" = "yes"; then
2081136644Sache  dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
2082136644Sache  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
2083136644Sache  dnl the configure script would need to contain the same shell code
2084136644Sache  dnl again, outside any 'if'. There are two solutions:
2085136644Sache  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
2086136644Sache  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
2087136644Sache  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
2088136644Sache  dnl documented, we avoid it.
2089136644Sache  ifelse(gt_included_intl, yes, , [
2090136644Sache    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
2091136644Sache  ])
2092136644Sache
2093136644Sache  dnl Set USE_NLS.
2094136644Sache  AM_NLS
2095136644Sache
2096136644Sache  ifelse(gt_included_intl, yes, [
2097136644Sache    BUILD_INCLUDED_LIBINTL=no
2098136644Sache    USE_INCLUDED_LIBINTL=no
2099136644Sache  ])
2100136644Sache  LIBINTL=
2101136644Sache  LTLIBINTL=
2102136644Sache  POSUB=
2103136644Sache
2104136644Sache  dnl If we use NLS figure out what method
2105136644Sache  if test "$USE_NLS" = "yes"; then
2106136644Sache    gt_use_preinstalled_gnugettext=no
2107136644Sache    ifelse(gt_included_intl, yes, [
2108136644Sache      AC_MSG_CHECKING([whether included gettext is requested])
2109136644Sache      AC_ARG_WITH(included-gettext,
2110136644Sache        [  --with-included-gettext use the GNU gettext library included here],
2111136644Sache        nls_cv_force_use_gnu_gettext=$withval,
2112136644Sache        nls_cv_force_use_gnu_gettext=no)
2113136644Sache      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2114136644Sache
2115136644Sache      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2116136644Sache      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2117136644Sache    ])
2118136644Sache        dnl User does not insist on using GNU NLS library.  Figure out what
2119136644Sache        dnl to use.  If GNU gettext is available we use this.  Else we have
2120136644Sache        dnl to fall back to GNU NLS library.
2121136644Sache
2122136644Sache        dnl Add a version number to the cache macros.
2123136644Sache        define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
2124136644Sache        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
2125136644Sache        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
2126136644Sache
2127136644Sache        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
2128136644Sache         [AC_TRY_LINK([#include <libintl.h>
2129136644Sache]ifelse([$2], [need-formatstring-macros],
2130136644Sache[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2131136644Sache#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2132136644Sache#endif
2133136644Sachechangequote(,)dnl
2134136644Sachetypedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2135136644Sachechangequote([,])dnl
2136136644Sache], [])[extern int _nl_msg_cat_cntr;
2137136644Sacheextern int *_nl_domain_bindings;],
2138136644Sache            [bindtextdomain ("", "");
2139136644Sachereturn (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
2140136644Sache            gt_cv_func_gnugettext_libc=yes,
2141136644Sache            gt_cv_func_gnugettext_libc=no)])
2142136644Sache
2143136644Sache        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
2144136644Sache          dnl Sometimes libintl requires libiconv, so first search for libiconv.
2145136644Sache          ifelse(gt_included_intl, yes, , [
2146136644Sache            AM_ICONV_LINK
2147136644Sache          ])
2148136644Sache          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
2149136644Sache          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
2150136644Sache          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
2151136644Sache          dnl even if libiconv doesn't exist.
2152136644Sache          AC_LIB_LINKFLAGS_BODY([intl])
2153136644Sache          AC_CACHE_CHECK([for GNU gettext in libintl],
2154136644Sache            gt_cv_func_gnugettext_libintl,
2155136644Sache           [gt_save_CPPFLAGS="$CPPFLAGS"
2156136644Sache            CPPFLAGS="$CPPFLAGS $INCINTL"
2157136644Sache            gt_save_LIBS="$LIBS"
2158136644Sache            LIBS="$LIBS $LIBINTL"
2159136644Sache            dnl Now see whether libintl exists and does not depend on libiconv.
2160136644Sache            AC_TRY_LINK([#include <libintl.h>
2161136644Sache]ifelse([$2], [need-formatstring-macros],
2162136644Sache[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2163136644Sache#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2164136644Sache#endif
2165136644Sachechangequote(,)dnl
2166136644Sachetypedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2167136644Sachechangequote([,])dnl
2168136644Sache], [])[extern int _nl_msg_cat_cntr;
2169136644Sacheextern
2170136644Sache#ifdef __cplusplus
2171136644Sache"C"
2172136644Sache#endif
2173136644Sacheconst char *_nl_expand_alias ();],
2174136644Sache              [bindtextdomain ("", "");
2175136644Sachereturn (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
2176136644Sache              gt_cv_func_gnugettext_libintl=yes,
2177136644Sache              gt_cv_func_gnugettext_libintl=no)
2178136644Sache            dnl Now see whether libintl exists and depends on libiconv.
2179136644Sache            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
2180136644Sache              LIBS="$LIBS $LIBICONV"
2181136644Sache              AC_TRY_LINK([#include <libintl.h>
2182136644Sache]ifelse([$2], [need-formatstring-macros],
2183136644Sache[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2184136644Sache#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2185136644Sache#endif
2186136644Sachechangequote(,)dnl
2187136644Sachetypedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2188136644Sachechangequote([,])dnl
2189136644Sache], [])[extern int _nl_msg_cat_cntr;
2190136644Sacheextern
2191136644Sache#ifdef __cplusplus
2192136644Sache"C"
2193136644Sache#endif
2194136644Sacheconst char *_nl_expand_alias ();],
2195136644Sache                [bindtextdomain ("", "");
2196136644Sachereturn (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
2197136644Sache               [LIBINTL="$LIBINTL $LIBICONV"
2198136644Sache                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
2199136644Sache                gt_cv_func_gnugettext_libintl=yes
2200136644Sache               ])
2201136644Sache            fi
2202136644Sache            CPPFLAGS="$gt_save_CPPFLAGS"
2203136644Sache            LIBS="$gt_save_LIBS"])
2204136644Sache        fi
2205136644Sache
2206136644Sache        dnl If an already present or preinstalled GNU gettext() is found,
2207136644Sache        dnl use it.  But if this macro is used in GNU gettext, and GNU
2208136644Sache        dnl gettext is already preinstalled in libintl, we update this
2209136644Sache        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
2210136644Sache        if test "$gt_cv_func_gnugettext_libc" = "yes" \
2211136644Sache           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
2212136644Sache                && test "$PACKAGE" != gettext-runtime \
2213136644Sache                && test "$PACKAGE" != gettext-tools; }; then
2214136644Sache          gt_use_preinstalled_gnugettext=yes
2215136644Sache        else
2216136644Sache          dnl Reset the values set by searching for libintl.
2217136644Sache          LIBINTL=
2218136644Sache          LTLIBINTL=
2219136644Sache          INCINTL=
2220136644Sache        fi
2221136644Sache
2222136644Sache    ifelse(gt_included_intl, yes, [
2223136644Sache        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
2224136644Sache          dnl GNU gettext is not found in the C library.
2225136644Sache          dnl Fall back on included GNU gettext library.
2226136644Sache          nls_cv_use_gnu_gettext=yes
2227136644Sache        fi
2228136644Sache      fi
2229136644Sache
2230136644Sache      if test "$nls_cv_use_gnu_gettext" = "yes"; then
2231136644Sache        dnl Mark actions used to generate GNU NLS library.
2232136644Sache        BUILD_INCLUDED_LIBINTL=yes
2233136644Sache        USE_INCLUDED_LIBINTL=yes
2234136644Sache        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
2235136644Sache        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
2236136644Sache        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
2237136644Sache      fi
2238136644Sache
2239136644Sache      if test "$gt_use_preinstalled_gnugettext" = "yes" \
2240136644Sache         || test "$nls_cv_use_gnu_gettext" = "yes"; then
2241136644Sache        dnl Mark actions to use GNU gettext tools.
2242136644Sache        CATOBJEXT=.gmo
2243136644Sache      fi
2244136644Sache    ])
2245136644Sache
2246136644Sache    if test "$gt_use_preinstalled_gnugettext" = "yes" \
2247136644Sache       || test "$nls_cv_use_gnu_gettext" = "yes"; then
2248136644Sache      AC_DEFINE(ENABLE_NLS, 1,
2249136644Sache        [Define to 1 if translation of program messages to the user's native language
2250136644Sache   is requested.])
2251136644Sache    else
2252136644Sache      USE_NLS=no
2253136644Sache    fi
2254136644Sache  fi
2255136644Sache
2256136644Sache  AC_MSG_CHECKING([whether to use NLS])
2257136644Sache  AC_MSG_RESULT([$USE_NLS])
2258136644Sache  if test "$USE_NLS" = "yes"; then
2259136644Sache    AC_MSG_CHECKING([where the gettext function comes from])
2260136644Sache    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
2261136644Sache      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2262136644Sache        gt_source="external libintl"
2263136644Sache      else
2264136644Sache        gt_source="libc"
2265136644Sache      fi
2266136644Sache    else
2267136644Sache      gt_source="included intl directory"
2268136644Sache    fi
2269136644Sache    AC_MSG_RESULT([$gt_source])
2270136644Sache  fi
2271136644Sache
2272136644Sache  if test "$USE_NLS" = "yes"; then
2273136644Sache
2274136644Sache    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
2275136644Sache      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2276136644Sache        AC_MSG_CHECKING([how to link with libintl])
2277136644Sache        AC_MSG_RESULT([$LIBINTL])
2278136644Sache        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
2279136644Sache      fi
2280136644Sache
2281136644Sache      dnl For backward compatibility. Some packages may be using this.
2282136644Sache      AC_DEFINE(HAVE_GETTEXT, 1,
2283136644Sache       [Define if the GNU gettext() function is already present or preinstalled.])
2284136644Sache      AC_DEFINE(HAVE_DCGETTEXT, 1,
2285136644Sache       [Define if the GNU dcgettext() function is already present or preinstalled.])
2286136644Sache    fi
2287136644Sache
2288136644Sache    dnl We need to process the po/ directory.
2289136644Sache    POSUB=po
2290136644Sache  fi
2291136644Sache
2292136644Sache  ifelse(gt_included_intl, yes, [
2293136644Sache    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
2294136644Sache    dnl to 'yes' because some of the testsuite requires it.
2295136644Sache    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
2296136644Sache      BUILD_INCLUDED_LIBINTL=yes
2297136644Sache    fi
2298136644Sache
2299136644Sache    dnl Make all variables we use known to autoconf.
2300136644Sache    AC_SUBST(BUILD_INCLUDED_LIBINTL)
2301136644Sache    AC_SUBST(USE_INCLUDED_LIBINTL)
2302136644Sache    AC_SUBST(CATOBJEXT)
2303136644Sache
2304136644Sache    dnl For backward compatibility. Some configure.ins may be using this.
2305136644Sache    nls_cv_header_intl=
2306136644Sache    nls_cv_header_libgt=
2307136644Sache
2308136644Sache    dnl For backward compatibility. Some Makefiles may be using this.
2309136644Sache    DATADIRNAME=share
2310136644Sache    AC_SUBST(DATADIRNAME)
2311136644Sache
2312136644Sache    dnl For backward compatibility. Some Makefiles may be using this.
2313136644Sache    INSTOBJEXT=.mo
2314136644Sache    AC_SUBST(INSTOBJEXT)
2315136644Sache
2316136644Sache    dnl For backward compatibility. Some Makefiles may be using this.
2317136644Sache    GENCAT=gencat
2318136644Sache    AC_SUBST(GENCAT)
2319136644Sache
2320136644Sache    dnl For backward compatibility. Some Makefiles may be using this.
2321136644Sache    if test "$USE_INCLUDED_LIBINTL" = yes; then
2322136644Sache      INTLOBJS="\$(GETTOBJS)"
2323136644Sache    fi
2324136644Sache    AC_SUBST(INTLOBJS)
2325136644Sache
2326136644Sache    dnl Enable libtool support if the surrounding package wishes it.
2327136644Sache    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
2328136644Sache    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
2329136644Sache  ])
2330136644Sache
2331136644Sache  dnl For backward compatibility. Some Makefiles may be using this.
2332136644Sache  INTLLIBS="$LIBINTL"
2333136644Sache  AC_SUBST(INTLLIBS)
2334136644Sache
2335136644Sache  dnl Make all documented variables known to autoconf.
2336136644Sache  AC_SUBST(LIBINTL)
2337136644Sache  AC_SUBST(LTLIBINTL)
2338136644Sache  AC_SUBST(POSUB)
2339136644Sache])
2340136644Sache
2341136644Sache
2342136644Sachednl Checks for all prerequisites of the intl subdirectory,
2343136644Sachednl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
2344136644Sachednl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
2345136644SacheAC_DEFUN([AM_INTL_SUBDIR],
2346136644Sache[
2347136644Sache  AC_REQUIRE([AC_PROG_INSTALL])dnl
2348136644Sache  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
2349136644Sache  AC_REQUIRE([AC_PROG_CC])dnl
2350136644Sache  AC_REQUIRE([AC_CANONICAL_HOST])dnl
2351136644Sache  AC_REQUIRE([AC_PROG_RANLIB])dnl
2352136644Sache  AC_REQUIRE([AC_ISC_POSIX])dnl
2353136644Sache  AC_REQUIRE([AC_HEADER_STDC])dnl
2354136644Sache  AC_REQUIRE([AC_C_CONST])dnl
2355136644Sache  AC_REQUIRE([AC_C_INLINE])dnl
2356136644Sache  AC_REQUIRE([AC_TYPE_OFF_T])dnl
2357136644Sache  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2358136644Sache  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2359136644Sache  AC_REQUIRE([AC_FUNC_MMAP])dnl
2360136644Sache  AC_REQUIRE([jm_GLIBC21])dnl
2361136644Sache  AC_REQUIRE([gt_INTDIV0])dnl
2362136644Sache  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
2363136644Sache  AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
2364136644Sache  AC_REQUIRE([gt_INTTYPES_PRI])dnl
2365136644Sache
2366136644Sache  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
2367136644Sachestdlib.h string.h unistd.h sys/param.h])
2368136644Sache  AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
2369136644Sachegeteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
2370136644Sachestrcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
2371136644Sache__fsetlocking])
2372136644Sache
2373136644Sache  AM_ICONV
2374136644Sache  AM_LANGINFO_CODESET
2375136644Sache  if test $ac_cv_header_locale_h = yes; then
2376136644Sache    AM_LC_MESSAGES
2377136644Sache  fi
2378136644Sache
2379136644Sache  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
2380136644Sache  dnl because plural.y uses bison specific features. It requires at least
2381136644Sache  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
2382136644Sache  dnl compile.
2383136644Sache  dnl bison is only needed for the maintainer (who touches plural.y). But in
2384136644Sache  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
2385136644Sache  dnl the rule in general Makefile. Now, some people carelessly touch the
2386136644Sache  dnl files or have a broken "make" program, hence the plural.c rule will
2387136644Sache  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
2388136644Sache  dnl present or too old.
2389136644Sache  AC_CHECK_PROGS([INTLBISON], [bison])
2390136644Sache  if test -z "$INTLBISON"; then
2391136644Sache    ac_verc_fail=yes
2392136644Sache  else
2393136644Sache    dnl Found it, now check the version.
2394136644Sache    AC_MSG_CHECKING([version of bison])
2395136644Sachechangequote(<<,>>)dnl
2396136644Sache    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
2397136644Sache    case $ac_prog_version in
2398136644Sache      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2399136644Sache      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
2400136644Sachechangequote([,])dnl
2401136644Sache         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
2402136644Sache      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
2403136644Sache    esac
2404136644Sache    AC_MSG_RESULT([$ac_prog_version])
2405136644Sache  fi
2406136644Sache  if test $ac_verc_fail = yes; then
2407136644Sache    INTLBISON=:
2408136644Sache  fi
2409136644Sache])
2410136644Sache
2411136644Sache
2412136644Sachednl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
2413136644SacheAC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
2414136644Sache# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
2415136644Sachednl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2416136644Sachednl This file is free software, distributed under the terms of the GNU
2417136644Sachednl General Public License.  As a special exception to the GNU General
2418136644Sachednl Public License, this file may be distributed as part of a program
2419136644Sachednl that contains a configuration script generated by Autoconf, under
2420136644Sachednl the same distribution terms as the rest of that program.
2421136644Sache
2422136644Sache# Test for the GNU C Library, version 2.1 or newer.
2423136644Sache# From Bruno Haible.
2424136644Sache
2425136644SacheAC_DEFUN([jm_GLIBC21],
2426136644Sache  [
2427136644Sache    AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
2428136644Sache      ac_cv_gnu_library_2_1,
2429136644Sache      [AC_EGREP_CPP([Lucky GNU user],
2430136644Sache	[
2431136644Sache#include <features.h>
2432136644Sache#ifdef __GNU_LIBRARY__
2433136644Sache #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
2434136644Sache  Lucky GNU user
2435136644Sache #endif
2436136644Sache#endif
2437136644Sache	],
2438136644Sache	ac_cv_gnu_library_2_1=yes,
2439136644Sache	ac_cv_gnu_library_2_1=no)
2440136644Sache      ]
2441136644Sache    )
2442136644Sache    AC_SUBST(GLIBC21)
2443136644Sache    GLIBC21="$ac_cv_gnu_library_2_1"
2444136644Sache  ]
2445136644Sache)
2446136644Sache# iconv.m4 serial AM4 (gettext-0.11.3)
2447136644Sachednl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2448136644Sachednl This file is free software, distributed under the terms of the GNU
2449136644Sachednl General Public License.  As a special exception to the GNU General
2450136644Sachednl Public License, this file may be distributed as part of a program
2451136644Sachednl that contains a configuration script generated by Autoconf, under
2452136644Sachednl the same distribution terms as the rest of that program.
2453136644Sache
2454136644Sachednl From Bruno Haible.
2455136644Sache
2456136644SacheAC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
2457136644Sache[
2458136644Sache  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
2459136644Sache  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2460136644Sache  AC_REQUIRE([AC_LIB_RPATH])
2461136644Sache
2462136644Sache  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2463136644Sache  dnl accordingly.
2464136644Sache  AC_LIB_LINKFLAGS_BODY([iconv])
2465136644Sache])
2466136644Sache
2467136644SacheAC_DEFUN([AM_ICONV_LINK],
2468136644Sache[
2469136644Sache  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
2470136644Sache  dnl those with the standalone portable GNU libiconv installed).
2471136644Sache
2472136644Sache  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2473136644Sache  dnl accordingly.
2474136644Sache  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
2475136644Sache
2476136644Sache  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
2477136644Sache  dnl because if the user has installed libiconv and not disabled its use
2478136644Sache  dnl via --without-libiconv-prefix, he wants to use it. The first
2479136644Sache  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
2480136644Sache  am_save_CPPFLAGS="$CPPFLAGS"
2481136644Sache  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
2482136644Sache
2483136644Sache  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
2484136644Sache    am_cv_func_iconv="no, consider installing GNU libiconv"
2485136644Sache    am_cv_lib_iconv=no
2486136644Sache    AC_TRY_LINK([#include <stdlib.h>
2487136644Sache#include <iconv.h>],
2488136644Sache      [iconv_t cd = iconv_open("","");
2489136644Sache       iconv(cd,NULL,NULL,NULL,NULL);
2490136644Sache       iconv_close(cd);],
2491136644Sache      am_cv_func_iconv=yes)
2492136644Sache    if test "$am_cv_func_iconv" != yes; then
2493136644Sache      am_save_LIBS="$LIBS"
2494136644Sache      LIBS="$LIBS $LIBICONV"
2495136644Sache      AC_TRY_LINK([#include <stdlib.h>
2496136644Sache#include <iconv.h>],
2497136644Sache        [iconv_t cd = iconv_open("","");
2498136644Sache         iconv(cd,NULL,NULL,NULL,NULL);
2499136644Sache         iconv_close(cd);],
2500136644Sache        am_cv_lib_iconv=yes
2501136644Sache        am_cv_func_iconv=yes)
2502136644Sache      LIBS="$am_save_LIBS"
2503136644Sache    fi
2504136644Sache  ])
2505136644Sache  if test "$am_cv_func_iconv" = yes; then
2506136644Sache    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2507136644Sache  fi
2508136644Sache  if test "$am_cv_lib_iconv" = yes; then
2509136644Sache    AC_MSG_CHECKING([how to link with libiconv])
2510136644Sache    AC_MSG_RESULT([$LIBICONV])
2511136644Sache  else
2512136644Sache    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
2513136644Sache    dnl either.
2514136644Sache    CPPFLAGS="$am_save_CPPFLAGS"
2515136644Sache    LIBICONV=
2516136644Sache    LTLIBICONV=
2517136644Sache  fi
2518136644Sache  AC_SUBST(LIBICONV)
2519136644Sache  AC_SUBST(LTLIBICONV)
2520136644Sache])
2521136644Sache
2522136644SacheAC_DEFUN([AM_ICONV],
2523136644Sache[
2524136644Sache  AM_ICONV_LINK
2525136644Sache  if test "$am_cv_func_iconv" = yes; then
2526136644Sache    AC_MSG_CHECKING([for iconv declaration])
2527136644Sache    AC_CACHE_VAL(am_cv_proto_iconv, [
2528136644Sache      AC_TRY_COMPILE([
2529136644Sache#include <stdlib.h>
2530136644Sache#include <iconv.h>
2531136644Sacheextern
2532136644Sache#ifdef __cplusplus
2533136644Sache"C"
2534136644Sache#endif
2535136644Sache#if defined(__STDC__) || defined(__cplusplus)
2536136644Sachesize_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
2537136644Sache#else
2538136644Sachesize_t iconv();
2539136644Sache#endif
2540136644Sache], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
2541136644Sache      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);"])
2542136644Sache    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
2543136644Sache    AC_MSG_RESULT([$]{ac_t:-
2544136644Sache         }[$]am_cv_proto_iconv)
2545136644Sache    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
2546136644Sache      [Define as const if the declaration of iconv() needs const.])
2547136644Sache  fi
2548136644Sache])
2549136644Sache# intdiv0.m4 serial 1 (gettext-0.11.3)
2550136644Sachednl Copyright (C) 2002 Free Software Foundation, Inc.
2551136644Sachednl This file is free software, distributed under the terms of the GNU
2552136644Sachednl General Public License.  As a special exception to the GNU General
2553136644Sachednl Public License, this file may be distributed as part of a program
2554136644Sachednl that contains a configuration script generated by Autoconf, under
2555136644Sachednl the same distribution terms as the rest of that program.
2556136644Sache
2557136644Sachednl From Bruno Haible.
2558136644Sache
2559136644SacheAC_DEFUN([gt_INTDIV0],
2560136644Sache[
2561136644Sache  AC_REQUIRE([AC_PROG_CC])dnl
2562136644Sache  AC_REQUIRE([AC_CANONICAL_HOST])dnl
2563136644Sache
2564136644Sache  AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
2565136644Sache    gt_cv_int_divbyzero_sigfpe,
2566136644Sache    [
2567136644Sache      AC_TRY_RUN([
2568136644Sache#include <stdlib.h>
2569136644Sache#include <signal.h>
2570136644Sache
2571136644Sachestatic void
2572136644Sache#ifdef __cplusplus
2573136644Sachesigfpe_handler (int sig)
2574136644Sache#else
2575136644Sachesigfpe_handler (sig) int sig;
2576136644Sache#endif
2577136644Sache{
2578136644Sache  /* Exit with code 0 if SIGFPE, with code 1 if any other signal.  */
2579136644Sache  exit (sig != SIGFPE);
2580136644Sache}
2581136644Sache
2582136644Sacheint x = 1;
2583136644Sacheint y = 0;
2584136644Sacheint z;
2585136644Sacheint nan;
2586136644Sache
2587136644Sacheint main ()
2588136644Sache{
2589136644Sache  signal (SIGFPE, sigfpe_handler);
2590136644Sache/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP.  */
2591136644Sache#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
2592136644Sache  signal (SIGTRAP, sigfpe_handler);
2593136644Sache#endif
2594136644Sache/* Linux/SPARC yields signal SIGILL.  */
2595136644Sache#if defined (__sparc__) && defined (__linux__)
2596136644Sache  signal (SIGILL, sigfpe_handler);
2597136644Sache#endif
2598136644Sache
2599136644Sache  z = x / y;
2600136644Sache  nan = y / y;
2601136644Sache  exit (1);
2602136644Sache}
2603136644Sache], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
2604136644Sache        [
2605136644Sache          # Guess based on the CPU.
2606136644Sache          case "$host_cpu" in
2607136644Sache            alpha* | i[34567]86 | m68k | s390*)
2608136644Sache              gt_cv_int_divbyzero_sigfpe="guessing yes";;
2609136644Sache            *)
2610136644Sache              gt_cv_int_divbyzero_sigfpe="guessing no";;
2611136644Sache          esac
2612136644Sache        ])
2613136644Sache    ])
2614136644Sache  case "$gt_cv_int_divbyzero_sigfpe" in
2615136644Sache    *yes) value=1;;
2616136644Sache    *) value=0;;
2617136644Sache  esac
2618136644Sache  AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
2619136644Sache    [Define if integer division by zero raises signal SIGFPE.])
2620136644Sache])
2621136644Sache# inttypes.m4 serial 1 (gettext-0.11.4)
2622136644Sachednl Copyright (C) 1997-2002 Free Software Foundation, Inc.
2623136644Sachednl This file is free software, distributed under the terms of the GNU
2624136644Sachednl General Public License.  As a special exception to the GNU General
2625136644Sachednl Public License, this file may be distributed as part of a program
2626136644Sachednl that contains a configuration script generated by Autoconf, under
2627136644Sachednl the same distribution terms as the rest of that program.
2628136644Sache
2629136644Sachednl From Paul Eggert.
2630136644Sache
2631136644Sache# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
2632136644Sache# <sys/types.h>.
2633136644Sache
2634136644SacheAC_DEFUN([gt_HEADER_INTTYPES_H],
2635136644Sache[
2636136644Sache  AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
2637136644Sache  [
2638136644Sache    AC_TRY_COMPILE(
2639136644Sache      [#include <sys/types.h>
2640136644Sache#include <inttypes.h>],
2641136644Sache      [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
2642136644Sache  ])
2643136644Sache  if test $gt_cv_header_inttypes_h = yes; then
2644136644Sache    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
2645136644Sache      [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
2646136644Sache  fi
2647136644Sache])
2648136644Sache# inttypes_h.m4 serial 5 (gettext-0.12)
2649136644Sachednl Copyright (C) 1997-2003 Free Software Foundation, Inc.
2650136644Sachednl This file is free software, distributed under the terms of the GNU
2651136644Sachednl General Public License.  As a special exception to the GNU General
2652136644Sachednl Public License, this file may be distributed as part of a program
2653136644Sachednl that contains a configuration script generated by Autoconf, under
2654136644Sachednl the same distribution terms as the rest of that program.
2655136644Sache
2656136644Sachednl From Paul Eggert.
2657136644Sache
2658136644Sache# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
2659136644Sache# doesn't clash with <sys/types.h>, and declares uintmax_t.
2660136644Sache
2661136644SacheAC_DEFUN([jm_AC_HEADER_INTTYPES_H],
2662136644Sache[
2663136644Sache  AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
2664136644Sache  [AC_TRY_COMPILE(
2665136644Sache    [#include <sys/types.h>
2666136644Sache#include <inttypes.h>],
2667136644Sache    [uintmax_t i = (uintmax_t) -1;],
2668136644Sache    jm_ac_cv_header_inttypes_h=yes,
2669136644Sache    jm_ac_cv_header_inttypes_h=no)])
2670136644Sache  if test $jm_ac_cv_header_inttypes_h = yes; then
2671136644Sache    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
2672136644Sache      [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
2673136644Sache       and declares uintmax_t. ])
2674136644Sache  fi
2675136644Sache])
2676136644Sache# inttypes-pri.m4 serial 1 (gettext-0.11.4)
2677136644Sachednl Copyright (C) 1997-2002 Free Software Foundation, Inc.
2678136644Sachednl This file is free software, distributed under the terms of the GNU
2679136644Sachednl General Public License.  As a special exception to the GNU General
2680136644Sachednl Public License, this file may be distributed as part of a program
2681136644Sachednl that contains a configuration script generated by Autoconf, under
2682136644Sachednl the same distribution terms as the rest of that program.
2683136644Sache
2684136644Sachednl From Bruno Haible.
2685136644Sache
2686136644Sache# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
2687136644Sache# macros to non-string values.  This is the case on AIX 4.3.3.
2688136644Sache
2689136644SacheAC_DEFUN([gt_INTTYPES_PRI],
2690136644Sache[
2691136644Sache  AC_REQUIRE([gt_HEADER_INTTYPES_H])
2692136644Sache  if test $gt_cv_header_inttypes_h = yes; then
2693136644Sache    AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
2694136644Sache      gt_cv_inttypes_pri_broken,
2695136644Sache      [
2696136644Sache        AC_TRY_COMPILE([#include <inttypes.h>
2697136644Sache#ifdef PRId32
2698136644Sachechar *p = PRId32;
2699136644Sache#endif
2700136644Sache], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
2701136644Sache      ])
2702136644Sache  fi
2703136644Sache  if test "$gt_cv_inttypes_pri_broken" = yes; then
2704136644Sache    AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
2705136644Sache      [Define if <inttypes.h> exists and defines unusable PRI* macros.])
2706136644Sache  fi
2707136644Sache])
2708136644Sache# isc-posix.m4 serial 2 (gettext-0.11.2)
2709136644Sachednl Copyright (C) 1995-2002 Free Software Foundation, Inc.
2710136644Sachednl This file is free software, distributed under the terms of the GNU
2711136644Sachednl General Public License.  As a special exception to the GNU General
2712136644Sachednl Public License, this file may be distributed as part of a program
2713136644Sachednl that contains a configuration script generated by Autoconf, under
2714136644Sachednl the same distribution terms as the rest of that program.
2715136644Sache
2716136644Sache# This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
2717136644Sache
2718136644Sache# This test replaces the one in autoconf.
2719136644Sache# Currently this macro should have the same name as the autoconf macro
2720136644Sache# because gettext's gettext.m4 (distributed in the automake package)
2721136644Sache# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
2722136644Sache# give these diagnostics:
2723136644Sache#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
2724136644Sache#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
2725136644Sache
2726136644Sacheundefine([AC_ISC_POSIX])
2727136644Sache
2728136644SacheAC_DEFUN([AC_ISC_POSIX],
2729136644Sache  [
2730136644Sache    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
2731136644Sache    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
2732136644Sache  ]
2733136644Sache)
2734136644Sache# lcmessage.m4 serial 3 (gettext-0.11.3)
2735136644Sachednl Copyright (C) 1995-2002 Free Software Foundation, Inc.
2736136644Sachednl This file is free software, distributed under the terms of the GNU
2737136644Sachednl General Public License.  As a special exception to the GNU General
2738136644Sachednl Public License, this file may be distributed as part of a program
2739136644Sachednl that contains a configuration script generated by Autoconf, under
2740136644Sachednl the same distribution terms as the rest of that program.
2741136644Sachednl
2742136644Sachednl This file can can be used in projects which are not available under
2743136644Sachednl the GNU General Public License or the GNU Library General Public
2744136644Sachednl License but which still want to provide support for the GNU gettext
2745136644Sachednl functionality.
2746136644Sachednl Please note that the actual code of the GNU gettext library is covered
2747136644Sachednl by the GNU Library General Public License, and the rest of the GNU
2748136644Sachednl gettext package package is covered by the GNU General Public License.
2749136644Sachednl They are *not* in the public domain.
2750136644Sache
2751136644Sachednl Authors:
2752136644Sachednl   Ulrich Drepper <drepper@cygnus.com>, 1995.
2753136644Sache
2754136644Sache# Check whether LC_MESSAGES is available in <locale.h>.
2755136644Sache
2756136644SacheAC_DEFUN([AM_LC_MESSAGES],
2757136644Sache[
2758136644Sache  AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2759136644Sache    [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2760136644Sache       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2761136644Sache  if test $am_cv_val_LC_MESSAGES = yes; then
2762136644Sache    AC_DEFINE(HAVE_LC_MESSAGES, 1,
2763136644Sache      [Define if your <locale.h> file defines LC_MESSAGES.])
2764136644Sache  fi
2765136644Sache])
2766136644Sache# lib-ld.m4 serial 2 (gettext-0.12)
2767136644Sachednl Copyright (C) 1996-2003 Free Software Foundation, Inc.
2768136644Sachednl This file is free software, distributed under the terms of the GNU
2769136644Sachednl General Public License.  As a special exception to the GNU General
2770136644Sachednl Public License, this file may be distributed as part of a program
2771136644Sachednl that contains a configuration script generated by Autoconf, under
2772136644Sachednl the same distribution terms as the rest of that program.
2773136644Sache
2774136644Sachednl Subroutines of libtool.m4,
2775136644Sachednl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
2776136644Sachednl with libtool.m4.
2777136644Sache
2778136644Sachednl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
2779136644SacheAC_DEFUN([AC_LIB_PROG_LD_GNU],
2780136644Sache[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
2781136644Sache[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
2782136644Sacheif $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
2783136644Sache  acl_cv_prog_gnu_ld=yes
2784136644Sacheelse
2785136644Sache  acl_cv_prog_gnu_ld=no
2786136644Sachefi])
2787136644Sachewith_gnu_ld=$acl_cv_prog_gnu_ld
2788136644Sache])
2789136644Sache
2790136644Sachednl From libtool-1.4. Sets the variable LD.
2791136644SacheAC_DEFUN([AC_LIB_PROG_LD],
2792136644Sache[AC_ARG_WITH(gnu-ld,
2793136644Sache[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
2794136644Sachetest "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
2795136644SacheAC_REQUIRE([AC_PROG_CC])dnl
2796136644SacheAC_REQUIRE([AC_CANONICAL_HOST])dnl
2797136644Sache# Prepare PATH_SEPARATOR.
2798136644Sache# The user is always right.
2799136644Sacheif test "${PATH_SEPARATOR+set}" != set; then
2800136644Sache  echo "#! /bin/sh" >conf$$.sh
2801136644Sache  echo  "exit 0"   >>conf$$.sh
2802136644Sache  chmod +x conf$$.sh
2803136644Sache  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
2804136644Sache    PATH_SEPARATOR=';'
2805136644Sache  else
2806136644Sache    PATH_SEPARATOR=:
2807136644Sache  fi
2808136644Sache  rm -f conf$$.sh
2809136644Sachefi
2810136644Sacheac_prog=ld
2811136644Sacheif test "$GCC" = yes; then
2812136644Sache  # Check if gcc -print-prog-name=ld gives a path.
2813136644Sache  AC_MSG_CHECKING([for ld used by GCC])
2814136644Sache  case $host in
2815136644Sache  *-*-mingw*)
2816136644Sache    # gcc leaves a trailing carriage return which upsets mingw
2817136644Sache    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
2818136644Sache  *)
2819136644Sache    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
2820136644Sache  esac
2821136644Sache  case $ac_prog in
2822136644Sache    # Accept absolute paths.
2823136644Sache    [[\\/]* | [A-Za-z]:[\\/]*)]
2824136644Sache      [re_direlt='/[^/][^/]*/\.\./']
2825136644Sache      # Canonicalize the path of ld
2826136644Sache      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
2827136644Sache      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
2828136644Sache	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
2829136644Sache      done
2830136644Sache      test -z "$LD" && LD="$ac_prog"
2831136644Sache      ;;
2832136644Sache  "")
2833136644Sache    # If it fails, then pretend we aren't using GCC.
2834136644Sache    ac_prog=ld
2835136644Sache    ;;
2836136644Sache  *)
2837136644Sache    # If it is relative, then search for the first ld in PATH.
2838136644Sache    with_gnu_ld=unknown
2839136644Sache    ;;
2840136644Sache  esac
2841136644Sacheelif test "$with_gnu_ld" = yes; then
2842136644Sache  AC_MSG_CHECKING([for GNU ld])
2843136644Sacheelse
2844136644Sache  AC_MSG_CHECKING([for non-GNU ld])
2845136644Sachefi
2846136644SacheAC_CACHE_VAL(acl_cv_path_LD,
2847136644Sache[if test -z "$LD"; then
2848136644Sache  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
2849136644Sache  for ac_dir in $PATH; do
2850136644Sache    test -z "$ac_dir" && ac_dir=.
2851136644Sache    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
2852136644Sache      acl_cv_path_LD="$ac_dir/$ac_prog"
2853136644Sache      # Check to see if the program is GNU ld.  I'd rather use --version,
2854136644Sache      # but apparently some GNU ld's only accept -v.
2855136644Sache      # Break only if it was the GNU/non-GNU ld that we prefer.
2856136644Sache      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
2857136644Sache	test "$with_gnu_ld" != no && break
2858136644Sache      else
2859136644Sache	test "$with_gnu_ld" != yes && break
2860136644Sache      fi
2861136644Sache    fi
2862136644Sache  done
2863136644Sache  IFS="$ac_save_ifs"
2864136644Sacheelse
2865136644Sache  acl_cv_path_LD="$LD" # Let the user override the test with a path.
2866136644Sachefi])
2867136644SacheLD="$acl_cv_path_LD"
2868136644Sacheif test -n "$LD"; then
2869136644Sache  AC_MSG_RESULT($LD)
2870136644Sacheelse
2871136644Sache  AC_MSG_RESULT(no)
2872136644Sachefi
2873136644Sachetest -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
2874136644SacheAC_LIB_PROG_LD_GNU
2875136644Sache])
2876136644Sache# lib-link.m4 serial 4 (gettext-0.12)
2877136644Sachednl Copyright (C) 2001-2003 Free Software Foundation, Inc.
2878136644Sachednl This file is free software, distributed under the terms of the GNU
2879136644Sachednl General Public License.  As a special exception to the GNU General
2880136644Sachednl Public License, this file may be distributed as part of a program
2881136644Sachednl that contains a configuration script generated by Autoconf, under
2882136644Sachednl the same distribution terms as the rest of that program.
2883136644Sache
2884136644Sachednl From Bruno Haible.
2885136644Sache
2886136644Sachednl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
2887136644Sachednl the libraries corresponding to explicit and implicit dependencies.
2888136644Sachednl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
2889136644Sachednl augments the CPPFLAGS variable.
2890136644SacheAC_DEFUN([AC_LIB_LINKFLAGS],
2891136644Sache[
2892136644Sache  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2893136644Sache  AC_REQUIRE([AC_LIB_RPATH])
2894136644Sache  define([Name],[translit([$1],[./-], [___])])
2895136644Sache  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2896136644Sache                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2897136644Sache  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
2898136644Sache    AC_LIB_LINKFLAGS_BODY([$1], [$2])
2899136644Sache    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
2900136644Sache    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
2901136644Sache    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
2902136644Sache  ])
2903136644Sache  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
2904136644Sache  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
2905136644Sache  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
2906136644Sache  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2907136644Sache  AC_SUBST([LIB]NAME)
2908136644Sache  AC_SUBST([LTLIB]NAME)
2909136644Sache  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
2910136644Sache  dnl results of this search when this library appears as a dependency.
2911136644Sache  HAVE_LIB[]NAME=yes
2912136644Sache  undefine([Name])
2913136644Sache  undefine([NAME])
2914136644Sache])
2915136644Sache
2916136644Sachednl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
2917136644Sachednl searches for libname and the libraries corresponding to explicit and
2918136644Sachednl implicit dependencies, together with the specified include files and
2919136644Sachednl the ability to compile and link the specified testcode. If found, it
2920136644Sachednl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
2921136644Sachednl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
2922136644Sachednl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
2923136644Sachednl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
2924136644SacheAC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
2925136644Sache[
2926136644Sache  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2927136644Sache  AC_REQUIRE([AC_LIB_RPATH])
2928136644Sache  define([Name],[translit([$1],[./-], [___])])
2929136644Sache  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2930136644Sache                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2931136644Sache
2932136644Sache  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
2933136644Sache  dnl accordingly.
2934136644Sache  AC_LIB_LINKFLAGS_BODY([$1], [$2])
2935136644Sache
2936136644Sache  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
2937136644Sache  dnl because if the user has installed lib[]Name and not disabled its use
2938136644Sache  dnl via --without-lib[]Name-prefix, he wants to use it.
2939136644Sache  ac_save_CPPFLAGS="$CPPFLAGS"
2940136644Sache  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2941136644Sache
2942136644Sache  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
2943136644Sache    ac_save_LIBS="$LIBS"
2944136644Sache    LIBS="$LIBS $LIB[]NAME"
2945136644Sache    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
2946136644Sache    LIBS="$ac_save_LIBS"
2947136644Sache  ])
2948136644Sache  if test "$ac_cv_lib[]Name" = yes; then
2949136644Sache    HAVE_LIB[]NAME=yes
2950136644Sache    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
2951136644Sache    AC_MSG_CHECKING([how to link with lib[]$1])
2952136644Sache    AC_MSG_RESULT([$LIB[]NAME])
2953136644Sache  else
2954136644Sache    HAVE_LIB[]NAME=no
2955136644Sache    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
2956136644Sache    dnl $INC[]NAME either.
2957136644Sache    CPPFLAGS="$ac_save_CPPFLAGS"
2958136644Sache    LIB[]NAME=
2959136644Sache    LTLIB[]NAME=
2960136644Sache  fi
2961136644Sache  AC_SUBST([HAVE_LIB]NAME)
2962136644Sache  AC_SUBST([LIB]NAME)
2963136644Sache  AC_SUBST([LTLIB]NAME)
2964136644Sache  undefine([Name])
2965136644Sache  undefine([NAME])
2966136644Sache])
2967136644Sache
2968136644Sachednl Determine the platform dependent parameters needed to use rpath:
2969136644Sachednl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
2970136644Sachednl hardcode_direct, hardcode_minus_L.
2971136644SacheAC_DEFUN([AC_LIB_RPATH],
2972136644Sache[
2973136644Sache  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
2974136644Sache  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
2975136644Sache  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
2976136644Sache  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
2977136644Sache  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
2978136644Sache    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
2979136644Sache    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
2980136644Sache    . ./conftest.sh
2981136644Sache    rm -f ./conftest.sh
2982136644Sache    acl_cv_rpath=done
2983136644Sache  ])
2984136644Sache  wl="$acl_cv_wl"
2985136644Sache  libext="$acl_cv_libext"
2986136644Sache  shlibext="$acl_cv_shlibext"
2987136644Sache  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
2988136644Sache  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
2989136644Sache  hardcode_direct="$acl_cv_hardcode_direct"
2990136644Sache  hardcode_minus_L="$acl_cv_hardcode_minus_L"
2991136644Sache  dnl Determine whether the user wants rpath handling at all.
2992136644Sache  AC_ARG_ENABLE(rpath,
2993136644Sache    [  --disable-rpath         do not hardcode runtime library paths],
2994136644Sache    :, enable_rpath=yes)
2995136644Sache])
2996136644Sache
2997136644Sachednl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
2998136644Sachednl the libraries corresponding to explicit and implicit dependencies.
2999136644Sachednl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
3000136644SacheAC_DEFUN([AC_LIB_LINKFLAGS_BODY],
3001136644Sache[
3002136644Sache  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
3003136644Sache                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
3004136644Sache  dnl By default, look in $includedir and $libdir.
3005136644Sache  use_additional=yes
3006136644Sache  AC_LIB_WITH_FINAL_PREFIX([
3007136644Sache    eval additional_includedir=\"$includedir\"
3008136644Sache    eval additional_libdir=\"$libdir\"
3009136644Sache  ])
3010136644Sache  AC_LIB_ARG_WITH([lib$1-prefix],
3011136644Sache[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
3012136644Sache  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
3013136644Sache[
3014136644Sache    if test "X$withval" = "Xno"; then
3015136644Sache      use_additional=no
3016136644Sache    else
3017136644Sache      if test "X$withval" = "X"; then
3018136644Sache        AC_LIB_WITH_FINAL_PREFIX([
3019136644Sache          eval additional_includedir=\"$includedir\"
3020136644Sache          eval additional_libdir=\"$libdir\"
3021136644Sache        ])
3022136644Sache      else
3023136644Sache        additional_includedir="$withval/include"
3024136644Sache        additional_libdir="$withval/lib"
3025136644Sache      fi
3026136644Sache    fi
3027136644Sache])
3028136644Sache  dnl Search the library and its dependencies in $additional_libdir and
3029136644Sache  dnl $LDFLAGS. Using breadth-first-seach.
3030136644Sache  LIB[]NAME=
3031136644Sache  LTLIB[]NAME=
3032136644Sache  INC[]NAME=
3033136644Sache  rpathdirs=
3034136644Sache  ltrpathdirs=
3035136644Sache  names_already_handled=
3036136644Sache  names_next_round='$1 $2'
3037136644Sache  while test -n "$names_next_round"; do
3038136644Sache    names_this_round="$names_next_round"
3039136644Sache    names_next_round=
3040136644Sache    for name in $names_this_round; do
3041136644Sache      already_handled=
3042136644Sache      for n in $names_already_handled; do
3043136644Sache        if test "$n" = "$name"; then
3044136644Sache          already_handled=yes
3045136644Sache          break
3046136644Sache        fi
3047136644Sache      done
3048136644Sache      if test -z "$already_handled"; then
3049136644Sache        names_already_handled="$names_already_handled $name"
3050136644Sache        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
3051136644Sache        dnl or AC_LIB_HAVE_LINKFLAGS call.
3052136644Sache        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
3053136644Sache        eval value=\"\$HAVE_LIB$uppername\"
3054136644Sache        if test -n "$value"; then
3055136644Sache          if test "$value" = yes; then
3056136644Sache            eval value=\"\$LIB$uppername\"
3057136644Sache            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
3058136644Sache            eval value=\"\$LTLIB$uppername\"
3059136644Sache            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
3060136644Sache          else
3061136644Sache            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
3062136644Sache            dnl that this library doesn't exist. So just drop it.
3063136644Sache            :
3064136644Sache          fi
3065136644Sache        else
3066136644Sache          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
3067136644Sache          dnl and the already constructed $LIBNAME/$LTLIBNAME.
3068136644Sache          found_dir=
3069136644Sache          found_la=
3070136644Sache          found_so=
3071136644Sache          found_a=
3072136644Sache          if test $use_additional = yes; then
3073136644Sache            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
3074136644Sache              found_dir="$additional_libdir"
3075136644Sache              found_so="$additional_libdir/lib$name.$shlibext"
3076136644Sache              if test -f "$additional_libdir/lib$name.la"; then
3077136644Sache                found_la="$additional_libdir/lib$name.la"
3078136644Sache              fi
3079136644Sache            else
3080136644Sache              if test -f "$additional_libdir/lib$name.$libext"; then
3081136644Sache                found_dir="$additional_libdir"
3082136644Sache                found_a="$additional_libdir/lib$name.$libext"
3083136644Sache                if test -f "$additional_libdir/lib$name.la"; then
3084136644Sache                  found_la="$additional_libdir/lib$name.la"
3085136644Sache                fi
3086136644Sache              fi
3087136644Sache            fi
3088136644Sache          fi
3089136644Sache          if test "X$found_dir" = "X"; then
3090136644Sache            for x in $LDFLAGS $LTLIB[]NAME; do
3091136644Sache              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3092136644Sache              case "$x" in
3093136644Sache                -L*)
3094136644Sache                  dir=`echo "X$x" | sed -e 's/^X-L//'`
3095136644Sache                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
3096136644Sache                    found_dir="$dir"
3097136644Sache                    found_so="$dir/lib$name.$shlibext"
3098136644Sache                    if test -f "$dir/lib$name.la"; then
3099136644Sache                      found_la="$dir/lib$name.la"
3100136644Sache                    fi
3101136644Sache                  else
3102136644Sache                    if test -f "$dir/lib$name.$libext"; then
3103136644Sache                      found_dir="$dir"
3104136644Sache                      found_a="$dir/lib$name.$libext"
3105136644Sache                      if test -f "$dir/lib$name.la"; then
3106136644Sache                        found_la="$dir/lib$name.la"
3107136644Sache                      fi
3108136644Sache                    fi
3109136644Sache                  fi
3110136644Sache                  ;;
3111136644Sache              esac
3112136644Sache              if test "X$found_dir" != "X"; then
3113136644Sache                break
3114136644Sache              fi
3115136644Sache            done
3116136644Sache          fi
3117136644Sache          if test "X$found_dir" != "X"; then
3118136644Sache            dnl Found the library.
3119136644Sache            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
3120136644Sache            if test "X$found_so" != "X"; then
3121136644Sache              dnl Linking with a shared library. We attempt to hardcode its
3122136644Sache              dnl directory into the executable's runpath, unless it's the
3123136644Sache              dnl standard /usr/lib.
3124136644Sache              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
3125136644Sache                dnl No hardcoding is needed.
3126136644Sache                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3127136644Sache              else
3128136644Sache                dnl Use an explicit option to hardcode DIR into the resulting
3129136644Sache                dnl binary.
3130136644Sache                dnl Potentially add DIR to ltrpathdirs.
3131136644Sache                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
3132136644Sache                haveit=
3133136644Sache                for x in $ltrpathdirs; do
3134136644Sache                  if test "X$x" = "X$found_dir"; then
3135136644Sache                    haveit=yes
3136136644Sache                    break
3137136644Sache                  fi
3138136644Sache                done
3139136644Sache                if test -z "$haveit"; then
3140136644Sache                  ltrpathdirs="$ltrpathdirs $found_dir"
3141136644Sache                fi
3142136644Sache                dnl The hardcoding into $LIBNAME is system dependent.
3143136644Sache                if test "$hardcode_direct" = yes; then
3144136644Sache                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
3145136644Sache                  dnl resulting binary.
3146136644Sache                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3147136644Sache                else
3148136644Sache                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
3149136644Sache                    dnl Use an explicit option to hardcode DIR into the resulting
3150136644Sache                    dnl binary.
3151136644Sache                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3152136644Sache                    dnl Potentially add DIR to rpathdirs.
3153136644Sache                    dnl The rpathdirs will be appended to $LIBNAME at the end.
3154136644Sache                    haveit=
3155136644Sache                    for x in $rpathdirs; do
3156136644Sache                      if test "X$x" = "X$found_dir"; then
3157136644Sache                        haveit=yes
3158136644Sache                        break
3159136644Sache                      fi
3160136644Sache                    done
3161136644Sache                    if test -z "$haveit"; then
3162136644Sache                      rpathdirs="$rpathdirs $found_dir"
3163136644Sache                    fi
3164136644Sache                  else
3165136644Sache                    dnl Rely on "-L$found_dir".
3166136644Sache                    dnl But don't add it if it's already contained in the LDFLAGS
3167136644Sache                    dnl or the already constructed $LIBNAME
3168136644Sache                    haveit=
3169136644Sache                    for x in $LDFLAGS $LIB[]NAME; do
3170136644Sache                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3171136644Sache                      if test "X$x" = "X-L$found_dir"; then
3172136644Sache                        haveit=yes
3173136644Sache                        break
3174136644Sache                      fi
3175136644Sache                    done
3176136644Sache                    if test -z "$haveit"; then
3177136644Sache                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
3178136644Sache                    fi
3179136644Sache                    if test "$hardcode_minus_L" != no; then
3180136644Sache                      dnl FIXME: Not sure whether we should use
3181136644Sache                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
3182136644Sache                      dnl here.
3183136644Sache                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3184136644Sache                    else
3185136644Sache                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
3186136644Sache                      dnl here, because this doesn't fit in flags passed to the
3187136644Sache                      dnl compiler. So give up. No hardcoding. This affects only
3188136644Sache                      dnl very old systems.
3189136644Sache                      dnl FIXME: Not sure whether we should use
3190136644Sache                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
3191136644Sache                      dnl here.
3192136644Sache                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
3193136644Sache                    fi
3194136644Sache                  fi
3195136644Sache                fi
3196136644Sache              fi
3197136644Sache            else
3198136644Sache              if test "X$found_a" != "X"; then
3199136644Sache                dnl Linking with a static library.
3200136644Sache                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
3201136644Sache              else
3202136644Sache                dnl We shouldn't come here, but anyway it's good to have a
3203136644Sache                dnl fallback.
3204136644Sache                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
3205136644Sache              fi
3206136644Sache            fi
3207136644Sache            dnl Assume the include files are nearby.
3208136644Sache            additional_includedir=
3209136644Sache            case "$found_dir" in
3210136644Sache              */lib | */lib/)
3211136644Sache                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
3212136644Sache                additional_includedir="$basedir/include"
3213136644Sache                ;;
3214136644Sache            esac
3215136644Sache            if test "X$additional_includedir" != "X"; then
3216136644Sache              dnl Potentially add $additional_includedir to $INCNAME.
3217136644Sache              dnl But don't add it
3218136644Sache              dnl   1. if it's the standard /usr/include,
3219136644Sache              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
3220136644Sache              dnl   3. if it's already present in $CPPFLAGS or the already
3221136644Sache              dnl      constructed $INCNAME,
3222136644Sache              dnl   4. if it doesn't exist as a directory.
3223136644Sache              if test "X$additional_includedir" != "X/usr/include"; then
3224136644Sache                haveit=
3225136644Sache                if test "X$additional_includedir" = "X/usr/local/include"; then
3226136644Sache                  if test -n "$GCC"; then
3227136644Sache                    case $host_os in
3228136644Sache                      linux*) haveit=yes;;
3229136644Sache                    esac
3230136644Sache                  fi
3231136644Sache                fi
3232136644Sache                if test -z "$haveit"; then
3233136644Sache                  for x in $CPPFLAGS $INC[]NAME; do
3234136644Sache                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3235136644Sache                    if test "X$x" = "X-I$additional_includedir"; then
3236136644Sache                      haveit=yes
3237136644Sache                      break
3238136644Sache                    fi
3239136644Sache                  done
3240136644Sache                  if test -z "$haveit"; then
3241136644Sache                    if test -d "$additional_includedir"; then
3242136644Sache                      dnl Really add $additional_includedir to $INCNAME.
3243136644Sache                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
3244136644Sache                    fi
3245136644Sache                  fi
3246136644Sache                fi
3247136644Sache              fi
3248136644Sache            fi
3249136644Sache            dnl Look for dependencies.
3250136644Sache            if test -n "$found_la"; then
3251136644Sache              dnl Read the .la file. It defines the variables
3252136644Sache              dnl dlname, library_names, old_library, dependency_libs, current,
3253136644Sache              dnl age, revision, installed, dlopen, dlpreopen, libdir.
3254136644Sache              save_libdir="$libdir"
3255136644Sache              case "$found_la" in
3256136644Sache                */* | *\\*) . "$found_la" ;;
3257136644Sache                *) . "./$found_la" ;;
3258136644Sache              esac
3259136644Sache              libdir="$save_libdir"
3260136644Sache              dnl We use only dependency_libs.
3261136644Sache              for dep in $dependency_libs; do
3262136644Sache                case "$dep" in
3263136644Sache                  -L*)
3264136644Sache                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
3265136644Sache                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
3266136644Sache                    dnl But don't add it
3267136644Sache                    dnl   1. if it's the standard /usr/lib,
3268136644Sache                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
3269136644Sache                    dnl   3. if it's already present in $LDFLAGS or the already
3270136644Sache                    dnl      constructed $LIBNAME,
3271136644Sache                    dnl   4. if it doesn't exist as a directory.
3272136644Sache                    if test "X$additional_libdir" != "X/usr/lib"; then
3273136644Sache                      haveit=
3274136644Sache                      if test "X$additional_libdir" = "X/usr/local/lib"; then
3275136644Sache                        if test -n "$GCC"; then
3276136644Sache                          case $host_os in
3277136644Sache                            linux*) haveit=yes;;
3278136644Sache                          esac
3279136644Sache                        fi
3280136644Sache                      fi
3281136644Sache                      if test -z "$haveit"; then
3282136644Sache                        haveit=
3283136644Sache                        for x in $LDFLAGS $LIB[]NAME; do
3284136644Sache                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3285136644Sache                          if test "X$x" = "X-L$additional_libdir"; then
3286136644Sache                            haveit=yes
3287136644Sache                            break
3288136644Sache                          fi
3289136644Sache                        done
3290136644Sache                        if test -z "$haveit"; then
3291136644Sache                          if test -d "$additional_libdir"; then
3292136644Sache                            dnl Really add $additional_libdir to $LIBNAME.
3293136644Sache                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
3294136644Sache                          fi
3295136644Sache                        fi
3296136644Sache                        haveit=
3297136644Sache                        for x in $LDFLAGS $LTLIB[]NAME; do
3298136644Sache                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3299136644Sache                          if test "X$x" = "X-L$additional_libdir"; then
3300136644Sache                            haveit=yes
3301136644Sache                            break
3302136644Sache                          fi
3303136644Sache                        done
3304136644Sache                        if test -z "$haveit"; then
3305136644Sache                          if test -d "$additional_libdir"; then
3306136644Sache                            dnl Really add $additional_libdir to $LTLIBNAME.
3307136644Sache                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
3308136644Sache                          fi
3309136644Sache                        fi
3310136644Sache                      fi
3311136644Sache                    fi
3312136644Sache                    ;;
3313136644Sache                  -R*)
3314136644Sache                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
3315136644Sache                    if test "$enable_rpath" != no; then
3316136644Sache                      dnl Potentially add DIR to rpathdirs.
3317136644Sache                      dnl The rpathdirs will be appended to $LIBNAME at the end.
3318136644Sache                      haveit=
3319136644Sache                      for x in $rpathdirs; do
3320136644Sache                        if test "X$x" = "X$dir"; then
3321136644Sache                          haveit=yes
3322136644Sache                          break
3323136644Sache                        fi
3324136644Sache                      done
3325136644Sache                      if test -z "$haveit"; then
3326136644Sache                        rpathdirs="$rpathdirs $dir"
3327136644Sache                      fi
3328136644Sache                      dnl Potentially add DIR to ltrpathdirs.
3329136644Sache                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
3330136644Sache                      haveit=
3331136644Sache                      for x in $ltrpathdirs; do
3332136644Sache                        if test "X$x" = "X$dir"; then
3333136644Sache                          haveit=yes
3334136644Sache                          break
3335136644Sache                        fi
3336136644Sache                      done
3337136644Sache                      if test -z "$haveit"; then
3338136644Sache                        ltrpathdirs="$ltrpathdirs $dir"
3339136644Sache                      fi
3340136644Sache                    fi
3341136644Sache                    ;;
3342136644Sache                  -l*)
3343136644Sache                    dnl Handle this in the next round.
3344136644Sache                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
3345136644Sache                    ;;
3346136644Sache                  *.la)
3347136644Sache                    dnl Handle this in the next round. Throw away the .la's
3348136644Sache                    dnl directory; it is already contained in a preceding -L
3349136644Sache                    dnl option.
3350136644Sache                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
3351136644Sache                    ;;
3352136644Sache                  *)
3353136644Sache                    dnl Most likely an immediate library name.
3354136644Sache                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
3355136644Sache                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
3356136644Sache                    ;;
3357136644Sache                esac
3358136644Sache              done
3359136644Sache            fi
3360136644Sache          else
3361136644Sache            dnl Didn't find the library; assume it is in the system directories
3362136644Sache            dnl known to the linker and runtime loader. (All the system
3363136644Sache            dnl directories known to the linker should also be known to the
3364136644Sache            dnl runtime loader, otherwise the system is severely misconfigured.)
3365136644Sache            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
3366136644Sache            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
3367136644Sache          fi
3368136644Sache        fi
3369136644Sache      fi
3370136644Sache    done
3371136644Sache  done
3372136644Sache  if test "X$rpathdirs" != "X"; then
3373136644Sache    if test -n "$hardcode_libdir_separator"; then
3374136644Sache      dnl Weird platform: only the last -rpath option counts, the user must
3375136644Sache      dnl pass all path elements in one option. We can arrange that for a
3376136644Sache      dnl single library, but not when more than one $LIBNAMEs are used.
3377136644Sache      alldirs=
3378136644Sache      for found_dir in $rpathdirs; do
3379136644Sache        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
3380136644Sache      done
3381136644Sache      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
3382136644Sache      acl_save_libdir="$libdir"
3383136644Sache      libdir="$alldirs"
3384136644Sache      eval flag=\"$hardcode_libdir_flag_spec\"
3385136644Sache      libdir="$acl_save_libdir"
3386136644Sache      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
3387136644Sache    else
3388136644Sache      dnl The -rpath options are cumulative.
3389136644Sache      for found_dir in $rpathdirs; do
3390136644Sache        acl_save_libdir="$libdir"
3391136644Sache        libdir="$found_dir"
3392136644Sache        eval flag=\"$hardcode_libdir_flag_spec\"
3393136644Sache        libdir="$acl_save_libdir"
3394136644Sache        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
3395136644Sache      done
3396136644Sache    fi
3397136644Sache  fi
3398136644Sache  if test "X$ltrpathdirs" != "X"; then
3399136644Sache    dnl When using libtool, the option that works for both libraries and
3400136644Sache    dnl executables is -R. The -R options are cumulative.
3401136644Sache    for found_dir in $ltrpathdirs; do
3402136644Sache      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
3403136644Sache    done
3404136644Sache  fi
3405136644Sache])
3406136644Sache
3407136644Sachednl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
3408136644Sachednl unless already present in VAR.
3409136644Sachednl Works only for CPPFLAGS, not for LIB* variables because that sometimes
3410136644Sachednl contains two or three consecutive elements that belong together.
3411136644SacheAC_DEFUN([AC_LIB_APPENDTOVAR],
3412136644Sache[
3413136644Sache  for element in [$2]; do
3414136644Sache    haveit=
3415136644Sache    for x in $[$1]; do
3416136644Sache      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3417136644Sache      if test "X$x" = "X$element"; then
3418136644Sache        haveit=yes
3419136644Sache        break
3420136644Sache      fi
3421136644Sache    done
3422136644Sache    if test -z "$haveit"; then
3423136644Sache      [$1]="${[$1]}${[$1]:+ }$element"
3424136644Sache    fi
3425136644Sache  done
3426136644Sache])
3427136644Sache# lib-prefix.m4 serial 2 (gettext-0.12)
3428136644Sachednl Copyright (C) 2001-2003 Free Software Foundation, Inc.
3429136644Sachednl This file is free software, distributed under the terms of the GNU
3430136644Sachednl General Public License.  As a special exception to the GNU General
3431136644Sachednl Public License, this file may be distributed as part of a program
3432136644Sachednl that contains a configuration script generated by Autoconf, under
3433136644Sachednl the same distribution terms as the rest of that program.
3434136644Sache
3435136644Sachednl From Bruno Haible.
3436136644Sache
3437136644Sachednl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
3438136644Sachednl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
3439136644Sachednl require excessive bracketing.
3440136644Sacheifdef([AC_HELP_STRING],
3441136644Sache[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
3442136644Sache[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
3443136644Sache
3444136644Sachednl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
3445136644Sachednl to access previously installed libraries. The basic assumption is that
3446136644Sachednl a user will want packages to use other packages he previously installed
3447136644Sachednl with the same --prefix option.
3448136644Sachednl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
3449136644Sachednl libraries, but is otherwise very convenient.
3450136644SacheAC_DEFUN([AC_LIB_PREFIX],
3451136644Sache[
3452136644Sache  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
3453136644Sache  AC_REQUIRE([AC_PROG_CC])
3454136644Sache  AC_REQUIRE([AC_CANONICAL_HOST])
3455136644Sache  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
3456136644Sache  dnl By default, look in $includedir and $libdir.
3457136644Sache  use_additional=yes
3458136644Sache  AC_LIB_WITH_FINAL_PREFIX([
3459136644Sache    eval additional_includedir=\"$includedir\"
3460136644Sache    eval additional_libdir=\"$libdir\"
3461136644Sache  ])
3462136644Sache  AC_LIB_ARG_WITH([lib-prefix],
3463136644Sache[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
3464136644Sache  --without-lib-prefix    don't search for libraries in includedir and libdir],
3465136644Sache[
3466136644Sache    if test "X$withval" = "Xno"; then
3467136644Sache      use_additional=no
3468136644Sache    else
3469136644Sache      if test "X$withval" = "X"; then
3470136644Sache        AC_LIB_WITH_FINAL_PREFIX([
3471136644Sache          eval additional_includedir=\"$includedir\"
3472136644Sache          eval additional_libdir=\"$libdir\"
3473136644Sache        ])
3474136644Sache      else
3475136644Sache        additional_includedir="$withval/include"
3476136644Sache        additional_libdir="$withval/lib"
3477136644Sache      fi
3478136644Sache    fi
3479136644Sache])
3480136644Sache  if test $use_additional = yes; then
3481136644Sache    dnl Potentially add $additional_includedir to $CPPFLAGS.
3482136644Sache    dnl But don't add it
3483136644Sache    dnl   1. if it's the standard /usr/include,
3484136644Sache    dnl   2. if it's already present in $CPPFLAGS,
3485136644Sache    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
3486136644Sache    dnl   4. if it doesn't exist as a directory.
3487136644Sache    if test "X$additional_includedir" != "X/usr/include"; then
3488136644Sache      haveit=
3489136644Sache      for x in $CPPFLAGS; do
3490136644Sache        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3491136644Sache        if test "X$x" = "X-I$additional_includedir"; then
3492136644Sache          haveit=yes
3493136644Sache          break
3494136644Sache        fi
3495136644Sache      done
3496136644Sache      if test -z "$haveit"; then
3497136644Sache        if test "X$additional_includedir" = "X/usr/local/include"; then
3498136644Sache          if test -n "$GCC"; then
3499136644Sache            case $host_os in
3500136644Sache              linux*) haveit=yes;;
3501136644Sache            esac
3502136644Sache          fi
3503136644Sache        fi
3504136644Sache        if test -z "$haveit"; then
3505136644Sache          if test -d "$additional_includedir"; then
3506136644Sache            dnl Really add $additional_includedir to $CPPFLAGS.
3507136644Sache            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
3508136644Sache          fi
3509136644Sache        fi
3510136644Sache      fi
3511136644Sache    fi
3512136644Sache    dnl Potentially add $additional_libdir to $LDFLAGS.
3513136644Sache    dnl But don't add it
3514136644Sache    dnl   1. if it's the standard /usr/lib,
3515136644Sache    dnl   2. if it's already present in $LDFLAGS,
3516136644Sache    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
3517136644Sache    dnl   4. if it doesn't exist as a directory.
3518136644Sache    if test "X$additional_libdir" != "X/usr/lib"; then
3519136644Sache      haveit=
3520136644Sache      for x in $LDFLAGS; do
3521136644Sache        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3522136644Sache        if test "X$x" = "X-L$additional_libdir"; then
3523136644Sache          haveit=yes
3524136644Sache          break
3525136644Sache        fi
3526136644Sache      done
3527136644Sache      if test -z "$haveit"; then
3528136644Sache        if test "X$additional_libdir" = "X/usr/local/lib"; then
3529136644Sache          if test -n "$GCC"; then
3530136644Sache            case $host_os in
3531136644Sache              linux*) haveit=yes;;
3532136644Sache            esac
3533136644Sache          fi
3534136644Sache        fi
3535136644Sache        if test -z "$haveit"; then
3536136644Sache          if test -d "$additional_libdir"; then
3537136644Sache            dnl Really add $additional_libdir to $LDFLAGS.
3538136644Sache            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
3539136644Sache          fi
3540136644Sache        fi
3541136644Sache      fi
3542136644Sache    fi
3543136644Sache  fi
3544136644Sache])
3545136644Sache
3546136644Sachednl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
3547136644Sachednl acl_final_exec_prefix, containing the values to which $prefix and
3548136644Sachednl $exec_prefix will expand at the end of the configure script.
3549136644SacheAC_DEFUN([AC_LIB_PREPARE_PREFIX],
3550136644Sache[
3551136644Sache  dnl Unfortunately, prefix and exec_prefix get only finally determined
3552136644Sache  dnl at the end of configure.
3553136644Sache  if test "X$prefix" = "XNONE"; then
3554136644Sache    acl_final_prefix="$ac_default_prefix"
3555136644Sache  else
3556136644Sache    acl_final_prefix="$prefix"
3557136644Sache  fi
3558136644Sache  if test "X$exec_prefix" = "XNONE"; then
3559136644Sache    acl_final_exec_prefix='${prefix}'
3560136644Sache  else
3561136644Sache    acl_final_exec_prefix="$exec_prefix"
3562136644Sache  fi
3563136644Sache  acl_save_prefix="$prefix"
3564136644Sache  prefix="$acl_final_prefix"
3565136644Sache  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
3566136644Sache  prefix="$acl_save_prefix"
3567136644Sache])
3568136644Sache
3569136644Sachednl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
3570136644Sachednl variables prefix and exec_prefix bound to the values they will have
3571136644Sachednl at the end of the configure script.
3572136644SacheAC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
3573136644Sache[
3574136644Sache  acl_save_prefix="$prefix"
3575136644Sache  prefix="$acl_final_prefix"
3576136644Sache  acl_save_exec_prefix="$exec_prefix"
3577136644Sache  exec_prefix="$acl_final_exec_prefix"
3578136644Sache  $1
3579136644Sache  exec_prefix="$acl_save_exec_prefix"
3580136644Sache  prefix="$acl_save_prefix"
3581136644Sache])
3582136644Sache# nls.m4 serial 1 (gettext-0.12)
3583136644Sachednl Copyright (C) 1995-2003 Free Software Foundation, Inc.
3584136644Sachednl This file is free software, distributed under the terms of the GNU
3585136644Sachednl General Public License.  As a special exception to the GNU General
3586136644Sachednl Public License, this file may be distributed as part of a program
3587136644Sachednl that contains a configuration script generated by Autoconf, under
3588136644Sachednl the same distribution terms as the rest of that program.
3589136644Sachednl
3590136644Sachednl This file can can be used in projects which are not available under
3591136644Sachednl the GNU General Public License or the GNU Library General Public
3592136644Sachednl License but which still want to provide support for the GNU gettext
3593136644Sachednl functionality.
3594136644Sachednl Please note that the actual code of the GNU gettext library is covered
3595136644Sachednl by the GNU Library General Public License, and the rest of the GNU
3596136644Sachednl gettext package package is covered by the GNU General Public License.
3597136644Sachednl They are *not* in the public domain.
3598136644Sache
3599136644Sachednl Authors:
3600136644Sachednl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3601136644Sachednl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3602136644Sache
3603136644SacheAC_DEFUN([AM_NLS],
3604136644Sache[
3605136644Sache  AC_MSG_CHECKING([whether NLS is requested])
3606136644Sache  dnl Default is enabled NLS
3607136644Sache  AC_ARG_ENABLE(nls,
3608136644Sache    [  --disable-nls           do not use Native Language Support],
3609136644Sache    USE_NLS=$enableval, USE_NLS=yes)
3610136644Sache  AC_MSG_RESULT($USE_NLS)
3611136644Sache  AC_SUBST(USE_NLS)
3612136644Sache])
3613136644Sache
3614136644SacheAC_DEFUN([AM_MKINSTALLDIRS],
3615136644Sache[
3616136644Sache  dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
3617136644Sache  dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
3618136644Sache  dnl Try to locate it.
3619136644Sache  MKINSTALLDIRS=
3620136644Sache  if test -n "$ac_aux_dir"; then
3621136644Sache    case "$ac_aux_dir" in
3622136644Sache      /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
3623136644Sache      *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
3624136644Sache    esac
3625136644Sache  fi
3626136644Sache  if test -z "$MKINSTALLDIRS"; then
3627136644Sache    MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
3628136644Sache  fi
3629136644Sache  AC_SUBST(MKINSTALLDIRS)
3630136644Sache])
3631136644Sache# po.m4 serial 1 (gettext-0.12)
3632136644Sachednl Copyright (C) 1995-2003 Free Software Foundation, Inc.
3633136644Sachednl This file is free software, distributed under the terms of the GNU
3634136644Sachednl General Public License.  As a special exception to the GNU General
3635136644Sachednl Public License, this file may be distributed as part of a program
3636136644Sachednl that contains a configuration script generated by Autoconf, under
3637136644Sachednl the same distribution terms as the rest of that program.
3638136644Sachednl
3639136644Sachednl This file can can be used in projects which are not available under
3640136644Sachednl the GNU General Public License or the GNU Library General Public
3641136644Sachednl License but which still want to provide support for the GNU gettext
3642136644Sachednl functionality.
3643136644Sachednl Please note that the actual code of the GNU gettext library is covered
3644136644Sachednl by the GNU Library General Public License, and the rest of the GNU
3645136644Sachednl gettext package package is covered by the GNU General Public License.
3646136644Sachednl They are *not* in the public domain.
3647136644Sache
3648136644Sachednl Authors:
3649136644Sachednl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3650136644Sachednl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3651136644Sache
3652136644Sachednl Checks for all prerequisites of the po subdirectory.
3653136644SacheAC_DEFUN([AM_PO_SUBDIRS],
3654136644Sache[
3655136644Sache  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3656136644Sache  AC_REQUIRE([AC_PROG_INSTALL])dnl
3657136644Sache  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
3658136644Sache  AC_REQUIRE([AM_NLS])dnl
3659136644Sache
3660136644Sache  dnl Perform the following tests also if --disable-nls has been given,
3661136644Sache  dnl because they are needed for "make dist" to work.
3662136644Sache
3663136644Sache  dnl Search for GNU msgfmt in the PATH.
3664136644Sache  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
3665136644Sache  dnl The second test excludes FreeBSD msgfmt.
3666136644Sache  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
3667136644Sache    [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
3668136644Sache     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
3669136644Sache    :)
3670136644Sache  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
3671136644Sache
3672136644Sache  dnl Search for GNU xgettext 0.12 or newer in the PATH.
3673136644Sache  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
3674136644Sache  dnl The second test excludes FreeBSD xgettext.
3675136644Sache  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
3676136644Sache    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
3677136644Sache     (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)],
3678136644Sache    :)
3679136644Sache  dnl Remove leftover from FreeBSD xgettext call.
3680136644Sache  rm -f messages.po
3681136644Sache
3682136644Sache  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
3683136644Sache  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
3684136644Sache    [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
3685136644Sache
3686136644Sache  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
3687136644Sache  dnl Test whether we really found GNU msgfmt.
3688136644Sache  if test "$GMSGFMT" != ":"; then
3689136644Sache    dnl If it is no GNU msgfmt we define it as : so that the
3690136644Sache    dnl Makefiles still can work.
3691136644Sache    if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
3692136644Sache       (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
3693136644Sache      : ;
3694136644Sache    else
3695136644Sache      GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
3696136644Sache      AC_MSG_RESULT(
3697136644Sache        [found $GMSGFMT program is not GNU msgfmt; ignore it])
3698136644Sache      GMSGFMT=":"
3699136644Sache    fi
3700136644Sache  fi
3701136644Sache
3702136644Sache  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
3703136644Sache  dnl Test whether we really found GNU xgettext.
3704136644Sache  if test "$XGETTEXT" != ":"; then
3705136644Sache    dnl If it is no GNU xgettext we define it as : so that the
3706136644Sache    dnl Makefiles still can work.
3707136644Sache    if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
3708136644Sache       (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
3709136644Sache      : ;
3710136644Sache    else
3711136644Sache      AC_MSG_RESULT(
3712136644Sache        [found xgettext program is not GNU xgettext; ignore it])
3713136644Sache      XGETTEXT=":"
3714136644Sache    fi
3715136644Sache    dnl Remove leftover from FreeBSD xgettext call.
3716136644Sache    rm -f messages.po
3717136644Sache  fi
3718136644Sache
3719136644Sache  AC_OUTPUT_COMMANDS([
3720136644Sache    for ac_file in $CONFIG_FILES; do
3721136644Sache      # Support "outfile[:infile[:infile...]]"
3722136644Sache      case "$ac_file" in
3723136644Sache        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
3724136644Sache      esac
3725136644Sache      # PO directories have a Makefile.in generated from Makefile.in.in.
3726136644Sache      case "$ac_file" in */Makefile.in)
3727136644Sache        # Adjust a relative srcdir.
3728136644Sache        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
3729136644Sache        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
3730136644Sache        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
3731136644Sache        # In autoconf-2.13 it is called $ac_given_srcdir.
3732136644Sache        # In autoconf-2.50 it is called $srcdir.
3733136644Sache        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
3734136644Sache        case "$ac_given_srcdir" in
3735136644Sache          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
3736136644Sache          /*) top_srcdir="$ac_given_srcdir" ;;
3737136644Sache          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
3738136644Sache        esac
3739136644Sache        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
3740136644Sache          rm -f "$ac_dir/POTFILES"
3741136644Sache          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
3742136644Sache          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
3743136644Sache          POMAKEFILEDEPS="POTFILES.in"
3744136644Sache          # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
3745136644Sache          # on $ac_dir but don't depend on user-specified configuration
3746136644Sache          # parameters.
3747136644Sache          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
3748136644Sache            # The LINGUAS file contains the set of available languages.
3749136644Sache            if test -n "$OBSOLETE_ALL_LINGUAS"; then
3750136644Sache              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
3751136644Sache            fi
3752136644Sache            ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
3753136644Sache            # Hide the ALL_LINGUAS assigment from automake.
3754136644Sache            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
3755136644Sache            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
3756136644Sache          else
3757136644Sache            # The set of available languages was given in configure.in.
3758136644Sache            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
3759136644Sache          fi
3760136644Sache          case "$ac_given_srcdir" in
3761136644Sache            .) srcdirpre= ;;
3762136644Sache            *) srcdirpre='$(srcdir)/' ;;
3763136644Sache          esac
3764136644Sache          POFILES=
3765136644Sache          GMOFILES=
3766136644Sache          UPDATEPOFILES=
3767136644Sache          DUMMYPOFILES=
3768136644Sache          for lang in $ALL_LINGUAS; do
3769136644Sache            POFILES="$POFILES $srcdirpre$lang.po"
3770136644Sache            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
3771136644Sache            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
3772136644Sache            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
3773136644Sache          done
3774136644Sache          # CATALOGS depends on both $ac_dir and the user's LINGUAS
3775136644Sache          # environment variable.
3776136644Sache          INST_LINGUAS=
3777136644Sache          if test -n "$ALL_LINGUAS"; then
3778136644Sache            for presentlang in $ALL_LINGUAS; do
3779136644Sache              useit=no
3780136644Sache              if test "%UNSET%" != "$LINGUAS"; then
3781136644Sache                desiredlanguages="$LINGUAS"
3782136644Sache              else
3783136644Sache                desiredlanguages="$ALL_LINGUAS"
3784136644Sache              fi
3785136644Sache              for desiredlang in $desiredlanguages; do
3786136644Sache                # Use the presentlang catalog if desiredlang is
3787136644Sache                #   a. equal to presentlang, or
3788136644Sache                #   b. a variant of presentlang (because in this case,
3789136644Sache                #      presentlang can be used as a fallback for messages
3790136644Sache                #      which are not translated in the desiredlang catalog).
3791136644Sache                case "$desiredlang" in
3792136644Sache                  "$presentlang"*) useit=yes;;
3793136644Sache                esac
3794136644Sache              done
3795136644Sache              if test $useit = yes; then
3796136644Sache                INST_LINGUAS="$INST_LINGUAS $presentlang"
3797136644Sache              fi
3798136644Sache            done
3799136644Sache          fi
3800136644Sache          CATALOGS=
3801136644Sache          if test -n "$INST_LINGUAS"; then
3802136644Sache            for lang in $INST_LINGUAS; do
3803136644Sache              CATALOGS="$CATALOGS $lang.gmo"
3804136644Sache            done
3805136644Sache          fi
3806136644Sache          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
3807136644Sache          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"
3808136644Sache          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
3809136644Sache            if test -f "$f"; then
3810136644Sache              case "$f" in
3811136644Sache                *.orig | *.bak | *~) ;;
3812136644Sache                *) cat "$f" >> "$ac_dir/Makefile" ;;
3813136644Sache              esac
3814136644Sache            fi
3815136644Sache          done
3816136644Sache        fi
3817136644Sache        ;;
3818136644Sache      esac
3819136644Sache    done],
3820136644Sache   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
3821136644Sache    # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
3822136644Sache    # from automake.
3823136644Sache    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
3824136644Sache    # Capture the value of LINGUAS because we need it to compute CATALOGS.
3825136644Sache    LINGUAS="${LINGUAS-%UNSET%}"
3826136644Sache   ])
3827136644Sache])
3828136644Sache# progtest.m4 serial 3 (gettext-0.12)
3829136644Sachednl Copyright (C) 1996-2003 Free Software Foundation, Inc.
3830136644Sachednl This file is free software, distributed under the terms of the GNU
3831136644Sachednl General Public License.  As a special exception to the GNU General
3832136644Sachednl Public License, this file may be distributed as part of a program
3833136644Sachednl that contains a configuration script generated by Autoconf, under
3834136644Sachednl the same distribution terms as the rest of that program.
3835136644Sachednl
3836136644Sachednl This file can can be used in projects which are not available under
3837136644Sachednl the GNU General Public License or the GNU Library General Public
3838136644Sachednl License but which still want to provide support for the GNU gettext
3839136644Sachednl functionality.
3840136644Sachednl Please note that the actual code of the GNU gettext library is covered
3841136644Sachednl by the GNU Library General Public License, and the rest of the GNU
3842136644Sachednl gettext package package is covered by the GNU General Public License.
3843136644Sachednl They are *not* in the public domain.
3844136644Sache
3845136644Sachednl Authors:
3846136644Sachednl   Ulrich Drepper <drepper@cygnus.com>, 1996.
3847136644Sache
3848136644Sache# Search path for a program which passes the given test.
3849136644Sache
3850136644Sachednl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
3851136644Sachednl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
3852136644SacheAC_DEFUN([AM_PATH_PROG_WITH_TEST],
3853136644Sache[
3854136644Sache# Prepare PATH_SEPARATOR.
3855136644Sache# The user is always right.
3856136644Sacheif test "${PATH_SEPARATOR+set}" != set; then
3857136644Sache  echo "#! /bin/sh" >conf$$.sh
3858136644Sache  echo  "exit 0"   >>conf$$.sh
3859136644Sache  chmod +x conf$$.sh
3860136644Sache  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
3861136644Sache    PATH_SEPARATOR=';'
3862136644Sache  else
3863136644Sache    PATH_SEPARATOR=:
3864136644Sache  fi
3865136644Sache  rm -f conf$$.sh
3866136644Sachefi
3867136644Sache
3868136644Sache# Find out how to test for executable files. Don't use a zero-byte file,
3869136644Sache# as systems may use methods other than mode bits to determine executability.
3870136644Sachecat >conf$$.file <<_ASEOF
3871136644Sache#! /bin/sh
3872136644Sacheexit 0
3873136644Sache_ASEOF
3874136644Sachechmod +x conf$$.file
3875136644Sacheif test -x conf$$.file >/dev/null 2>&1; then
3876136644Sache  ac_executable_p="test -x"
3877136644Sacheelse
3878136644Sache  ac_executable_p="test -f"
3879136644Sachefi
3880136644Sacherm -f conf$$.file
3881136644Sache
3882136644Sache# Extract the first word of "$2", so it can be a program name with args.
3883136644Sacheset dummy $2; ac_word=[$]2
3884136644SacheAC_MSG_CHECKING([for $ac_word])
3885136644SacheAC_CACHE_VAL(ac_cv_path_$1,
3886136644Sache[case "[$]$1" in
3887136644Sache  [[\\/]]* | ?:[[\\/]]*)
3888136644Sache    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
3889136644Sache    ;;
3890136644Sache  *)
3891136644Sache    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
3892136644Sache    for ac_dir in ifelse([$5], , $PATH, [$5]); do
3893136644Sache      IFS="$ac_save_IFS"
3894136644Sache      test -z "$ac_dir" && ac_dir=.
3895136644Sache      for ac_exec_ext in '' $ac_executable_extensions; do
3896136644Sache        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
3897136644Sache          if [$3]; then
3898136644Sache            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
3899136644Sache            break 2
3900136644Sache          fi
3901136644Sache        fi
3902136644Sache      done
3903136644Sache    done
3904136644Sache    IFS="$ac_save_IFS"
3905136644Sachednl If no 4th arg is given, leave the cache variable unset,
3906136644Sachednl so AC_PATH_PROGS will keep looking.
3907136644Sacheifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
3908136644Sache])dnl
3909136644Sache    ;;
3910136644Sacheesac])dnl
3911136644Sache$1="$ac_cv_path_$1"
3912136644Sacheif test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
3913136644Sache  AC_MSG_RESULT([$]$1)
3914136644Sacheelse
3915136644Sache  AC_MSG_RESULT(no)
3916136644Sachefi
3917136644SacheAC_SUBST($1)dnl
3918136644Sache])
3919136644Sache# stdint_h.m4 serial 3 (gettext-0.12)
3920136644Sachednl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3921136644Sachednl This file is free software, distributed under the terms of the GNU
3922136644Sachednl General Public License.  As a special exception to the GNU General
3923136644Sachednl Public License, this file may be distributed as part of a program
3924136644Sachednl that contains a configuration script generated by Autoconf, under
3925136644Sachednl the same distribution terms as the rest of that program.
3926136644Sache
3927136644Sachednl From Paul Eggert.
3928136644Sache
3929136644Sache# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
3930136644Sache# doesn't clash with <sys/types.h>, and declares uintmax_t.
3931136644Sache
3932136644SacheAC_DEFUN([jm_AC_HEADER_STDINT_H],
3933136644Sache[
3934136644Sache  AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
3935136644Sache  [AC_TRY_COMPILE(
3936136644Sache    [#include <sys/types.h>
3937136644Sache#include <stdint.h>],
3938136644Sache    [uintmax_t i = (uintmax_t) -1;],
3939136644Sache    jm_ac_cv_header_stdint_h=yes,
3940136644Sache    jm_ac_cv_header_stdint_h=no)])
3941136644Sache  if test $jm_ac_cv_header_stdint_h = yes; then
3942136644Sache    AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
3943136644Sache      [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
3944136644Sache       and declares uintmax_t. ])
3945136644Sache  fi
3946136644Sache])
3947136644Sache# uintmax_t.m4 serial 7 (gettext-0.12)
3948136644Sachednl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3949136644Sachednl This file is free software, distributed under the terms of the GNU
3950136644Sachednl General Public License.  As a special exception to the GNU General
3951136644Sachednl Public License, this file may be distributed as part of a program
3952136644Sachednl that contains a configuration script generated by Autoconf, under
3953136644Sachednl the same distribution terms as the rest of that program.
3954136644Sache
3955136644Sachednl From Paul Eggert.
3956136644Sache
3957136644SacheAC_PREREQ(2.13)
3958136644Sache
3959136644Sache# Define uintmax_t to 'unsigned long' or 'unsigned long long'
3960136644Sache# if it is not already defined in <stdint.h> or <inttypes.h>.
3961136644Sache
3962136644SacheAC_DEFUN([jm_AC_TYPE_UINTMAX_T],
3963136644Sache[
3964136644Sache  AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
3965136644Sache  AC_REQUIRE([jm_AC_HEADER_STDINT_H])
3966136644Sache  if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
3967136644Sache    AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3968136644Sache    test $ac_cv_type_unsigned_long_long = yes \
3969136644Sache      && ac_type='unsigned long long' \
3970136644Sache      || ac_type='unsigned long'
3971136644Sache    AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
3972136644Sache      [Define to unsigned long or unsigned long long
3973136644Sache       if <stdint.h> and <inttypes.h> don't define.])
3974136644Sache  else
3975136644Sache    AC_DEFINE(HAVE_UINTMAX_T, 1,
3976136644Sache      [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
3977136644Sache  fi
3978136644Sache])
3979136644Sache# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40)
3980136644Sachednl Copyright (C) 1999-2002 Free Software Foundation, Inc.
3981136644Sachednl This file is free software, distributed under the terms of the GNU
3982136644Sachednl General Public License.  As a special exception to the GNU General
3983136644Sachednl Public License, this file may be distributed as part of a program
3984136644Sachednl that contains a configuration script generated by Autoconf, under
3985136644Sachednl the same distribution terms as the rest of that program.
3986136644Sache
3987136644Sachednl From Paul Eggert.
3988136644Sache
3989136644SacheAC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
3990136644Sache[
3991136644Sache  AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
3992136644Sache  [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
3993136644Sache    [unsigned long long ullmax = (unsigned long long) -1;
3994136644Sache     return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
3995136644Sache    ac_cv_type_unsigned_long_long=yes,
3996136644Sache    ac_cv_type_unsigned_long_long=no)])
3997136644Sache  if test $ac_cv_type_unsigned_long_long = yes; then
3998136644Sache    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
3999136644Sache      [Define if you have the unsigned long long type.])
4000136644Sache  fi
4001136644Sache])
4002