summaryrefslogtreecommitdiffstats
path: root/openembedded/packages/readline/readline-4.3/acinclude.m4
diff options
context:
space:
mode:
Diffstat (limited to 'openembedded/packages/readline/readline-4.3/acinclude.m4')
-rw-r--r--openembedded/packages/readline/readline-4.3/acinclude.m41815
1 files changed, 1815 insertions, 0 deletions
diff --git a/openembedded/packages/readline/readline-4.3/acinclude.m4 b/openembedded/packages/readline/readline-4.3/acinclude.m4
new file mode 100644
index 0000000000..8a45f99084
--- /dev/null
+++ b/openembedded/packages/readline/readline-4.3/acinclude.m4
@@ -0,0 +1,1815 @@
1dnl
2dnl Bash specific tests
3dnl
4dnl Some derived from PDKSH 5.1.3 autoconf tests
5dnl
6
7AC_DEFUN([BASH_C_LONG_LONG],
8[AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
9[if test "$GCC" = yes; then
10 ac_cv_c_long_long=yes
11else
12AC_TRY_RUN([
13int
14main()
15{
16long long foo = 0;
17exit(sizeof(long long) < sizeof(long));
18}
19], ac_cv_c_long_long=yes, ac_cv_c_long_long=no)
20fi])
21if test $ac_cv_c_long_long = yes; then
22 AC_DEFINE(HAVE_LONG_LONG, 1, [Define if the `long long' type works.])
23fi
24])
25
26dnl
27dnl This is very similar to AC_C_LONG_DOUBLE, with the fix for IRIX
28dnl (< changed to <=) added.
29dnl
30AC_DEFUN([BASH_C_LONG_DOUBLE],
31[AC_CACHE_CHECK(for long double, ac_cv_c_long_double,
32[if test "$GCC" = yes; then
33 ac_cv_c_long_double=yes
34else
35AC_TRY_RUN([
36int
37main()
38{
39 /* The Stardent Vistra knows sizeof(long double), but does not
40 support it. */
41 long double foo = 0.0;
42 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
43 /* On IRIX 5.3, the compiler converts long double to double with a warning,
44 but compiles this successfully. */
45 exit(sizeof(long double) <= sizeof(double));
46}
47], ac_cv_c_long_double=yes, ac_cv_c_long_double=no)
48fi])
49if test $ac_cv_c_long_double = yes; then
50 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if the `long double' type works.])
51fi
52])
53
54dnl
55dnl Check for <inttypes.h>. This is separated out so that it can be
56dnl AC_REQUIREd.
57dnl
58dnl BASH_HEADER_INTTYPES
59AC_DEFUN([BASH_HEADER_INTTYPES],
60[
61 AC_CHECK_HEADERS(inttypes.h)
62])
63
64dnl
65dnl check for typedef'd symbols in header files, but allow the caller to
66dnl specify the include files to be checked in addition to the default
67dnl
68dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND])
69AC_DEFUN([BASH_CHECK_TYPE],
70[
71AC_REQUIRE([AC_HEADER_STDC])dnl
72AC_REQUIRE([BASH_HEADER_INTTYPES])
73AC_MSG_CHECKING(for $1)
74AC_CACHE_VAL(bash_cv_type_$1,
75[AC_EGREP_CPP($1, [#include <sys/types.h>
76#if STDC_HEADERS
77#include <stdlib.h>
78#include <stddef.h>
79#endif
80#if HAVE_INTTYPES_H
81#include <inttypes.h>
82#endif
83$2
84], bash_cv_type_$1=yes, bash_cv_type_$1=no)])
85AC_MSG_RESULT($bash_cv_type_$1)
86ifelse($#, 4, [if test $bash_cv_type_$1 = yes; then
87 AC_DEFINE($4)
88 fi])
89if test $bash_cv_type_$1 = no; then
90 AC_DEFINE_UNQUOTED($1, $3)
91fi
92])
93
94dnl
95dnl BASH_CHECK_DECL(FUNC)
96dnl
97dnl Check for a declaration of FUNC in stdlib.h and inttypes.h like
98dnl AC_CHECK_DECL
99dnl
100AC_DEFUN([BASH_CHECK_DECL],
101[
102AC_REQUIRE([AC_HEADER_STDC])
103AC_REQUIRE([BASH_HEADER_INTTYPES])
104AC_CACHE_CHECK([for declaration of $1], bash_cv_decl_$1,
105[AC_TRY_LINK(
106[
107#if STDC_HEADERS
108# include <stdlib.h>
109#endif
110#if HAVE_INTTYPES_H
111# include <inttypes.h>
112#endif
113],
114[return !$1;],
115bash_cv_decl_$1=yes, bash_cv_decl_$1=no)])
116bash_tr_func=HAVE_DECL_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
117if test $bash_cv_decl_$1 = yes; then
118 AC_DEFINE_UNQUOTED($bash_tr_func, 1)
119else
120 AC_DEFINE_UNQUOTED($bash_tr_func, 0)
121fi
122])
123
124AC_DEFUN([BASH_DECL_PRINTF],
125[AC_MSG_CHECKING(for declaration of printf in <stdio.h>)
126AC_CACHE_VAL(bash_cv_printf_declared,
127[AC_TRY_RUN([
128#include <stdio.h>
129#ifdef __STDC__
130typedef int (*_bashfunc)(const char *, ...);
131#else
132typedef int (*_bashfunc)();
133#endif
134main()
135{
136_bashfunc pf;
137pf = (_bashfunc) printf;
138exit(pf == 0);
139}
140], bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
141 [AC_MSG_WARN(cannot check printf declaration if cross compiling -- defaulting to yes)
142 bash_cv_printf_declared=yes]
143)])
144AC_MSG_RESULT($bash_cv_printf_declared)
145if test $bash_cv_printf_declared = yes; then
146AC_DEFINE(PRINTF_DECLARED)
147fi
148])
149
150AC_DEFUN([BASH_DECL_SBRK],
151[AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>)
152AC_CACHE_VAL(bash_cv_sbrk_declared,
153[AC_EGREP_HEADER(sbrk, unistd.h,
154 bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)])
155AC_MSG_RESULT($bash_cv_sbrk_declared)
156if test $bash_cv_sbrk_declared = yes; then
157AC_DEFINE(SBRK_DECLARED)
158fi
159])
160
161dnl
162dnl Check for sys_siglist[] or _sys_siglist[]
163dnl
164AC_DEFUN([BASH_DECL_UNDER_SYS_SIGLIST],
165[AC_MSG_CHECKING([for _sys_siglist in signal.h or unistd.h])
166AC_CACHE_VAL(bash_cv_decl_under_sys_siglist,
167[AC_TRY_COMPILE([
168#include <sys/types.h>
169#include <signal.h>
170#ifdef HAVE_UNISTD_H
171#include <unistd.h>
172#endif], [ char *msg = _sys_siglist[2]; ],
173 bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no,
174 [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl
175AC_MSG_RESULT($bash_cv_decl_under_sys_siglist)
176if test $bash_cv_decl_under_sys_siglist = yes; then
177AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED)
178fi
179])
180
181AC_DEFUN([BASH_UNDER_SYS_SIGLIST],
182[AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
183AC_MSG_CHECKING([for _sys_siglist in system C library])
184AC_CACHE_VAL(bash_cv_under_sys_siglist,
185[AC_TRY_RUN([
186#include <sys/types.h>
187#include <signal.h>
188#ifdef HAVE_UNISTD_H
189#include <unistd.h>
190#endif
191#ifndef UNDER_SYS_SIGLIST_DECLARED
192extern char *_sys_siglist[];
193#endif
194main()
195{
196char *msg = (char *)_sys_siglist[2];
197exit(msg == 0);
198}],
199 bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
200 [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)
201 bash_cv_under_sys_siglist=no])])
202AC_MSG_RESULT($bash_cv_under_sys_siglist)
203if test $bash_cv_under_sys_siglist = yes; then
204AC_DEFINE(HAVE_UNDER_SYS_SIGLIST)
205fi
206])
207
208AC_DEFUN([BASH_SYS_SIGLIST],
209[
210AC_CHECK_DECLS([sys_siglist])
211AC_MSG_CHECKING([for sys_siglist in system C library])
212AC_CACHE_VAL(bash_cv_sys_siglist,
213[AC_TRY_RUN([
214#include <sys/types.h>
215#include <signal.h>
216#ifdef HAVE_UNISTD_H
217#include <unistd.h>
218#endif
219#ifndef HAVE_DECL_SYS_SIGLIST
220extern char *sys_siglist[];
221#endif
222main()
223{
224char *msg = sys_siglist[2];
225exit(msg == 0);
226}],
227 bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no,
228 [AC_MSG_WARN(cannot check for sys_siglist if cross compiling -- defaulting to no)
229 bash_cv_sys_siglist=no])])
230AC_MSG_RESULT($bash_cv_sys_siglist)
231if test $bash_cv_sys_siglist = yes; then
232AC_DEFINE(HAVE_SYS_SIGLIST)
233fi
234])
235
236dnl Check for the various permutations of sys_siglist and make sure we
237dnl compile in siglist.o if they're not defined
238AC_DEFUN([BASH_CHECK_SYS_SIGLIST], [
239AC_REQUIRE([BASH_SYS_SIGLIST])
240AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
241AC_REQUIRE([BASH_FUNC_STRSIGNAL])
242if test "$bash_cv_sys_siglist" = no && test "$bash_cv_under_sys_siglist" = no && test "$bash_cv_have_strsignal" = no; then
243 SIGLIST_O=siglist.o
244else
245 SIGLIST_O=
246fi
247AC_SUBST([SIGLIST_O])
248])
249
250dnl Check for sys_errlist[] and sys_nerr, check for declaration
251AC_DEFUN([BASH_SYS_ERRLIST],
252[AC_MSG_CHECKING([for sys_errlist and sys_nerr])
253AC_CACHE_VAL(bash_cv_sys_errlist,
254[AC_TRY_LINK([#include <errno.h>],
255[extern char *sys_errlist[];
256 extern int sys_nerr;
257 char *msg = sys_errlist[sys_nerr - 1];],
258 bash_cv_sys_errlist=yes, bash_cv_sys_errlist=no)])dnl
259AC_MSG_RESULT($bash_cv_sys_errlist)
260if test $bash_cv_sys_errlist = yes; then
261AC_DEFINE(HAVE_SYS_ERRLIST)
262fi
263])
264
265dnl
266dnl Check if dup2() does not clear the close on exec flag
267dnl
268AC_DEFUN([BASH_FUNC_DUP2_CLOEXEC_CHECK],
269[AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag)
270AC_CACHE_VAL(bash_cv_dup2_broken,
271[AC_TRY_RUN([
272#include <sys/types.h>
273#include <fcntl.h>
274main()
275{
276 int fd1, fd2, fl;
277 fd1 = open("/dev/null", 2);
278 if (fcntl(fd1, 2, 1) < 0)
279 exit(1);
280 fd2 = dup2(fd1, 1);
281 if (fd2 < 0)
282 exit(2);
283 fl = fcntl(fd2, 1, 0);
284 /* fl will be 1 if dup2 did not reset the close-on-exec flag. */
285 exit(fl != 1);
286}
287], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no,
288 [AC_MSG_WARN(cannot check dup2 if cross compiling -- defaulting to no)
289 bash_cv_dup2_broken=no])
290])
291AC_MSG_RESULT($bash_cv_dup2_broken)
292if test $bash_cv_dup2_broken = yes; then
293AC_DEFINE(DUP2_BROKEN)
294fi
295])
296
297AC_DEFUN([BASH_FUNC_STRSIGNAL],
298[AC_MSG_CHECKING([for the existence of strsignal])
299AC_CACHE_VAL(bash_cv_have_strsignal,
300[AC_TRY_LINK([#include <sys/types.h>
301#include <signal.h>],
302[char *s = (char *)strsignal(2);],
303 bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)])
304AC_MSG_RESULT($bash_cv_have_strsignal)
305if test $bash_cv_have_strsignal = yes; then
306AC_DEFINE(HAVE_STRSIGNAL)
307fi
308])
309
310dnl Check to see if opendir will open non-directories (not a nice thing)
311AC_DEFUN([BASH_FUNC_OPENDIR_CHECK],
312[AC_REQUIRE([AC_HEADER_DIRENT])dnl
313AC_MSG_CHECKING(if opendir() opens non-directories)
314AC_CACHE_VAL(bash_cv_opendir_not_robust,
315[AC_TRY_RUN([
316#include <stdio.h>
317#include <sys/types.h>
318#include <fcntl.h>
319#ifdef HAVE_UNISTD_H
320# include <unistd.h>
321#endif /* HAVE_UNISTD_H */
322#if defined(HAVE_DIRENT_H)
323# include <dirent.h>
324#else
325# define dirent direct
326# ifdef HAVE_SYS_NDIR_H
327# include <sys/ndir.h>
328# endif /* SYSNDIR */
329# ifdef HAVE_SYS_DIR_H
330# include <sys/dir.h>
331# endif /* SYSDIR */
332# ifdef HAVE_NDIR_H
333# include <ndir.h>
334# endif
335#endif /* HAVE_DIRENT_H */
336main()
337{
338DIR *dir;
339int fd, err;
340err = mkdir("/tmp/bash-aclocal", 0700);
341if (err < 0) {
342 perror("mkdir");
343 exit(1);
344}
345unlink("/tmp/bash-aclocal/not_a_directory");
346fd = open("/tmp/bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666);
347write(fd, "\n", 1);
348close(fd);
349dir = opendir("/tmp/bash-aclocal/not_a_directory");
350unlink("/tmp/bash-aclocal/not_a_directory");
351rmdir("/tmp/bash-aclocal");
352exit (dir == 0);
353}], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
354 [AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
355 bash_cv_opendir_not_robust=no]
356)])
357AC_MSG_RESULT($bash_cv_opendir_not_robust)
358if test $bash_cv_opendir_not_robust = yes; then
359AC_DEFINE(OPENDIR_NOT_ROBUST)
360fi
361])
362
363dnl
364AH_TEMPLATE([VOID_SIGHANDLER], [Define if signal handlers return type void])
365AC_DEFUN([BASH_TYPE_SIGHANDLER],
366[AC_MSG_CHECKING([whether signal handlers are of type void])
367AC_CACHE_VAL(bash_cv_void_sighandler,
368[AC_TRY_COMPILE([#include <sys/types.h>
369#include <signal.h>
370#ifdef signal
371#undef signal
372#endif
373#ifdef __cplusplus
374extern "C"
375#endif
376void (*signal ()) ();],
377[int i;], bash_cv_void_sighandler=yes, bash_cv_void_sighandler=no)])dnl
378AC_MSG_RESULT($bash_cv_void_sighandler)
379if test $bash_cv_void_sighandler = yes; then
380AC_DEFINE(VOID_SIGHANDLER)
381fi
382])
383
384dnl
385dnl A signed 16-bit integer quantity
386dnl
387AC_DEFUN([BASH_TYPE_BITS16_T],
388[
389if test "$ac_cv_sizeof_short" = 2; then
390 AC_CHECK_TYPE(bits16_t, short)
391elif test "$ac_cv_sizeof_char" = 2; then
392 AC_CHECK_TYPE(bits16_t, char)
393else
394 AC_CHECK_TYPE(bits16_t, short)
395fi
396])
397
398dnl
399dnl An unsigned 16-bit integer quantity
400dnl
401AC_DEFUN([BASH_TYPE_U_BITS16_T],
402[
403if test "$ac_cv_sizeof_short" = 2; then
404 AC_CHECK_TYPE(u_bits16_t, unsigned short)
405elif test "$ac_cv_sizeof_char" = 2; then
406 AC_CHECK_TYPE(u_bits16_t, unsigned char)
407else
408 AC_CHECK_TYPE(u_bits16_t, unsigned short)
409fi
410])
411
412dnl
413dnl A signed 32-bit integer quantity
414dnl
415AC_DEFUN([BASH_TYPE_BITS32_T],
416[
417if test "$ac_cv_sizeof_int" = 4; then
418 AC_CHECK_TYPE(bits32_t, int)
419elif test "$ac_cv_sizeof_long" = 4; then
420 AC_CHECK_TYPE(bits32_t, long)
421else
422 AC_CHECK_TYPE(bits32_t, int)
423fi
424])
425
426dnl
427dnl An unsigned 32-bit integer quantity
428dnl
429AC_DEFUN([BASH_TYPE_U_BITS32_T],
430[
431if test "$ac_cv_sizeof_int" = 4; then
432 AC_CHECK_TYPE(u_bits32_t, unsigned int)
433elif test "$ac_cv_sizeof_long" = 4; then
434 AC_CHECK_TYPE(u_bits32_t, unsigned long)
435else
436 AC_CHECK_TYPE(u_bits32_t, unsigned int)
437fi
438])
439
440AC_DEFUN([BASH_TYPE_PTRDIFF_T],
441[
442if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then
443 AC_CHECK_TYPE(ptrdiff_t, int)
444elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then
445 AC_CHECK_TYPE(ptrdiff_t, long)
446elif test "$ac_cv_type_long_long" = yes && test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_char_p"; then
447 AC_CHECK_TYPE(ptrdiff_t, [long long])
448else
449 AC_CHECK_TYPE(ptrdiff_t, int)
450fi
451])
452
453dnl
454dnl A signed 64-bit quantity
455dnl
456AC_DEFUN([BASH_TYPE_BITS64_T],
457[
458if test "$ac_cv_sizeof_char_p" = 8; then
459 AC_CHECK_TYPE(bits64_t, char *)
460elif test "$ac_cv_sizeof_double" = 8; then
461 AC_CHECK_TYPE(bits64_t, double)
462elif test -n "$ac_cv_type_long_long" && test "$ac_cv_sizeof_long_long" = 8; then
463 AC_CHECK_TYPE(bits64_t, [long long])
464elif test "$ac_cv_sizeof_long" = 8; then
465 AC_CHECK_TYPE(bits64_t, long)
466else
467 AC_CHECK_TYPE(bits64_t, double)
468fi
469])
470
471AC_DEFUN([BASH_TYPE_LONG_LONG],
472[
473AC_CACHE_CHECK([for long long], bash_cv_type_long_long,
474[AC_TRY_LINK([
475long long ll = 1; int i = 63;],
476[
477long long llm = (long long) -1;
478return ll << i | ll >> i | llm / ll | llm % ll;
479], bash_cv_type_long_long='long long', bash_cv_type_long_long='long')])
480if test "$bash_cv_type_long_long" = 'long long'; then
481 AC_DEFINE(HAVE_LONG_LONG, 1)
482fi
483])
484
485AC_DEFUN([BASH_TYPE_UNSIGNED_LONG_LONG],
486[
487AC_CACHE_CHECK([for unsigned long long], bash_cv_type_unsigned_long_long,
488[AC_TRY_LINK([
489unsigned long long ull = 1; int i = 63;],
490[
491unsigned long long ullmax = (unsigned long long) -1;
492return ull << i | ull >> i | ullmax / ull | ullmax % ull;
493], bash_cv_type_unsigned_long_long='unsigned long long',
494 bash_cv_type_unsigned_long_long='unsigned long')])
495if test "$bash_cv_type_unsigned_long_long" = 'unsigned long long'; then
496 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1)
497fi
498])
499
500dnl
501dnl Type of struct rlimit fields: some systems (OSF/1, NetBSD, RISC/os 5.0)
502dnl have a rlim_t, others (4.4BSD based systems) use quad_t, others use
503dnl long and still others use int (HP-UX 9.01, SunOS 4.1.3). To simplify
504dnl matters, this just checks for rlim_t, quad_t, or long.
505dnl
506AC_DEFUN([BASH_TYPE_RLIMIT],
507[AC_MSG_CHECKING(for size and type of struct rlimit fields)
508AC_CACHE_VAL(bash_cv_type_rlimit,
509[AC_TRY_COMPILE([#include <sys/types.h>
510#include <sys/resource.h>],
511[rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[
512AC_TRY_RUN([
513#include <sys/types.h>
514#include <sys/time.h>
515#include <sys/resource.h>
516main()
517{
518#ifdef HAVE_QUAD_T
519 struct rlimit rl;
520 if (sizeof(rl.rlim_cur) == sizeof(quad_t))
521 exit(0);
522#endif
523 exit(1);
524}], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long,
525 [AC_MSG_WARN(cannot check quad_t if cross compiling -- defaulting to long)
526 bash_cv_type_rlimit=long])])
527])
528AC_MSG_RESULT($bash_cv_type_rlimit)
529if test $bash_cv_type_rlimit = quad_t; then
530AC_DEFINE(RLIMTYPE, quad_t)
531elif test $bash_cv_type_rlimit = rlim_t; then
532AC_DEFINE(RLIMTYPE, rlim_t)
533fi
534])
535
536AC_DEFUN([BASH_FUNC_LSTAT],
537[dnl Cannot use AC_CHECK_FUNCS(lstat) because Linux defines lstat() as an
538dnl inline function in <sys/stat.h>.
539AC_CACHE_CHECK([for lstat], bash_cv_func_lstat,
540[AC_TRY_LINK([
541#include <sys/types.h>
542#include <sys/stat.h>
543],[ lstat(".",(struct stat *)0); ],
544bash_cv_func_lstat=yes, bash_cv_func_lstat=no)])
545if test $bash_cv_func_lstat = yes; then
546 AC_DEFINE(HAVE_LSTAT)
547fi
548])
549
550AC_DEFUN([BASH_FUNC_INET_ATON],
551[
552AC_CACHE_CHECK([for inet_aton], bash_cv_func_inet_aton,
553[AC_TRY_LINK([
554#include <sys/types.h>
555#include <netinet/in.h>
556#include <arpa/inet.h>
557struct in_addr ap;], [ inet_aton("127.0.0.1", &ap); ],
558bash_cv_func_inet_aton=yes, bash_cv_func_inet_aton=no)])
559if test $bash_cv_func_inet_aton = yes; then
560 AC_DEFINE(HAVE_INET_ATON)
561else
562 AC_LIBOBJ(inet_aton)
563fi
564])
565
566AC_DEFUN([BASH_FUNC_GETENV],
567[AC_MSG_CHECKING(to see if getenv can be redefined)
568AC_CACHE_VAL(bash_cv_getenv_redef,
569[AC_TRY_RUN([
570#ifdef HAVE_UNISTD_H
571# include <unistd.h>
572#endif
573#ifndef __STDC__
574# ifndef const
575# define const
576# endif
577#endif
578char *
579getenv (name)
580#if defined (__linux__) || defined (__bsdi__) || defined (convex)
581 const char *name;
582#else
583 char const *name;
584#endif /* !__linux__ && !__bsdi__ && !convex */
585{
586return "42";
587}
588main()
589{
590char *s;
591/* The next allows this program to run, but does not allow bash to link
592 when it redefines getenv. I'm not really interested in figuring out
593 why not. */
594#if defined (NeXT)
595exit(1);
596#endif
597s = getenv("ABCDE");
598exit(s == 0); /* force optimizer to leave getenv in */
599}
600], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no,
601 [AC_MSG_WARN(cannot check getenv redefinition if cross compiling -- defaulting to yes)
602 bash_cv_getenv_redef=yes]
603)])
604AC_MSG_RESULT($bash_cv_getenv_redef)
605if test $bash_cv_getenv_redef = yes; then
606AC_DEFINE(CAN_REDEFINE_GETENV)
607fi
608])
609
610# We should check for putenv before calling this
611AC_DEFUN([BASH_FUNC_STD_PUTENV],
612[
613AC_REQUIRE([AC_HEADER_STDC])
614AC_REQUIRE([AC_C_PROTOTYPES])
615AC_CACHE_CHECK([for standard-conformant putenv declaration], bash_cv_std_putenv,
616[AC_TRY_LINK([
617#if STDC_HEADERS
618#include <stdlib.h>
619#include <stddef.h>
620#endif
621#ifndef __STDC__
622# ifndef const
623# define const
624# endif
625#endif
626#ifdef PROTOTYPES
627extern int putenv (char *);
628#else
629extern int putenv ();
630#endif
631],
632[return (putenv == 0);],
633bash_cv_std_putenv=yes, bash_cv_std_putenv=no
634)])
635if test $bash_cv_std_putenv = yes; then
636AC_DEFINE(HAVE_STD_PUTENV)
637fi
638])
639
640# We should check for unsetenv before calling this
641AC_DEFUN([BASH_FUNC_STD_UNSETENV],
642[
643AC_REQUIRE([AC_HEADER_STDC])
644AC_REQUIRE([AC_C_PROTOTYPES])
645AC_CACHE_CHECK([for standard-conformant unsetenv declaration], bash_cv_std_unsetenv,
646[AC_TRY_LINK([
647#if STDC_HEADERS
648#include <stdlib.h>
649#include <stddef.h>
650#endif
651#ifndef __STDC__
652# ifndef const
653# define const
654# endif
655#endif
656#ifdef PROTOTYPES
657extern int unsetenv (const char *);
658#else
659extern int unsetenv ();
660#endif
661],
662[return (unsetenv == 0);],
663bash_cv_std_unsetenv=yes, bash_cv_std_unsetenv=no
664)])
665if test $bash_cv_std_unsetenv = yes; then
666AC_DEFINE(HAVE_STD_UNSETENV)
667fi
668])
669
670AC_DEFUN([BASH_FUNC_ULIMIT_MAXFDS],
671[AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize)
672AC_CACHE_VAL(bash_cv_ulimit_maxfds,
673[AC_TRY_RUN([
674main()
675{
676long maxfds = ulimit(4, 0L);
677exit (maxfds == -1L);
678}
679], bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
680 [AC_MSG_WARN(cannot check ulimit if cross compiling -- defaulting to no)
681 bash_cv_ulimit_maxfds=no]
682)])
683AC_MSG_RESULT($bash_cv_ulimit_maxfds)
684if test $bash_cv_ulimit_maxfds = yes; then
685AC_DEFINE(ULIMIT_MAXFDS)
686fi
687])
688
689AC_DEFUN([BASH_FUNC_GETCWD],
690[AC_MSG_CHECKING([if getcwd() calls popen()])
691AC_CACHE_VAL(bash_cv_getcwd_calls_popen,
692[AC_TRY_RUN([
693#include <stdio.h>
694#ifdef HAVE_UNISTD_H
695#include <unistd.h>
696#endif
697
698#ifndef __STDC__
699#ifndef const
700#define const
701#endif
702#endif
703
704int popen_called;
705
706FILE *
707popen(command, type)
708 const char *command;
709 const char *type;
710{
711 popen_called = 1;
712 return (FILE *)NULL;
713}
714
715FILE *_popen(command, type)
716 const char *command;
717 const char *type;
718{
719 return (popen (command, type));
720}
721
722int
723pclose(stream)
724FILE *stream;
725{
726 return 0;
727}
728
729int
730_pclose(stream)
731FILE *stream;
732{
733 return 0;
734}
735
736main()
737{
738 char lbuf[32];
739 popen_called = 0;
740 getcwd(lbuf, 32);
741 exit (popen_called);
742}
743], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes,
744 [AC_MSG_WARN(cannot check whether getcwd calls popen if cross compiling -- defaulting to no)
745 bash_cv_getcwd_calls_popen=no]
746)])
747AC_MSG_RESULT($bash_cv_getcwd_calls_popen)
748if test $bash_cv_getcwd_calls_popen = yes; then
749AC_DEFINE(GETCWD_BROKEN)
750AC_LIBOBJ(getcwd)
751fi
752])
753
754dnl
755dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every
756dnl system, we can't use AC_PREREQ
757dnl
758AC_DEFUN([BASH_FUNC_GETHOSTBYNAME],
759[if test "X$bash_cv_have_gethostbyname" = "X"; then
760_bash_needmsg=yes
761else
762AC_MSG_CHECKING(for gethostbyname in socket library)
763_bash_needmsg=
764fi
765AC_CACHE_VAL(bash_cv_have_gethostbyname,
766[AC_TRY_LINK([#include <netdb.h>],
767[ struct hostent *hp;
768 hp = gethostbyname("localhost");
769], bash_cv_have_gethostbyname=yes, bash_cv_have_gethostbyname=no)]
770)
771if test "X$_bash_needmsg" = Xyes; then
772 AC_MSG_CHECKING(for gethostbyname in socket library)
773fi
774AC_MSG_RESULT($bash_cv_have_gethostbyname)
775if test "$bash_cv_have_gethostbyname" = yes; then
776AC_DEFINE(HAVE_GETHOSTBYNAME)
777fi
778])
779
780AC_DEFUN([BASH_FUNC_FNMATCH_EXTMATCH],
781[AC_MSG_CHECKING(if fnmatch does extended pattern matching with FNM_EXTMATCH)
782AC_CACHE_VAL(bash_cv_fnm_extmatch,
783[AC_TRY_RUN([
784#include <fnmatch.h>
785
786main()
787{
788#ifdef FNM_EXTMATCH
789 exit (0);
790#else
791 exit (1);
792#endif
793}
794], bash_cv_fnm_extmatch=yes, bash_cv_fnm_extmatch=no,
795 [AC_MSG_WARN(cannot check FNM_EXTMATCH if cross compiling -- defaulting to no)
796 bash_cv_fnm_extmatch=no])
797])
798AC_MSG_RESULT($bash_cv_fnm_extmatch)
799if test $bash_cv_fnm_extmatch = yes; then
800AC_DEFINE(HAVE_LIBC_FNM_EXTMATCH)
801fi
802])
803
804AH_TEMPLATE([HAVE_POSIX_SIGSETJMP], [Define if we POSIX-style sigsetjmp/siglongjmp are available])
805AC_DEFUN([BASH_FUNC_POSIX_SETJMP],
806[AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
807AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp)
808AC_CACHE_VAL(bash_cv_func_sigsetjmp,
809[AC_TRY_RUN([
810#ifdef HAVE_UNISTD_H
811#include <unistd.h>
812#endif
813#include <sys/types.h>
814#include <signal.h>
815#include <setjmp.h>
816
817main()
818{
819#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
820exit (1);
821#else
822
823int code;
824sigset_t set, oset;
825sigjmp_buf xx;
826
827/* get the mask */
828sigemptyset(&set);
829sigemptyset(&oset);
830sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set);
831sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
832
833/* save it */
834code = sigsetjmp(xx, 1);
835if (code)
836 exit(0); /* could get sigmask and compare to oset here. */
837
838/* change it */
839sigaddset(&set, SIGINT);
840sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
841
842/* and siglongjmp */
843siglongjmp(xx, 10);
844exit(1);
845#endif
846}], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
847 [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing)
848 bash_cv_func_sigsetjmp=missing]
849)])
850AC_MSG_RESULT($bash_cv_func_sigsetjmp)
851if test $bash_cv_func_sigsetjmp = present; then
852AC_DEFINE(HAVE_POSIX_SIGSETJMP)
853fi
854])
855
856AH_TEMPLATE([STRCOLL_BROKEN], [Define if strcoll is broken with respect to strcmp in the default locale.])
857AC_DEFUN([BASH_FUNC_STRCOLL],
858[
859AC_MSG_CHECKING(whether or not strcoll and strcmp differ)
860AC_CACHE_VAL(bash_cv_func_strcoll_broken,
861[AC_TRY_RUN([
862#include <stdio.h>
863#if defined (HAVE_LOCALE_H)
864#include <locale.h>
865#endif
866
867main(c, v)
868int c;
869char *v[];
870{
871 int r1, r2;
872 char *deflocale, *defcoll;
873
874#ifdef HAVE_SETLOCALE
875 deflocale = setlocale(LC_ALL, "");
876 defcoll = setlocale(LC_COLLATE, "");
877#endif
878
879#ifdef HAVE_STRCOLL
880 /* These two values are taken from tests/glob-test. */
881 r1 = strcoll("abd", "aXd");
882#else
883 r1 = 0;
884#endif
885 r2 = strcmp("abd", "aXd");
886
887 /* These two should both be greater than 0. It is permissible for
888 a system to return different values, as long as the sign is the
889 same. */
890
891 /* Exit with 1 (failure) if these two values are both > 0, since
892 this tests whether strcoll(3) is broken with respect to strcmp(3)
893 in the default locale. */
894 exit (r1 > 0 && r2 > 0);
895}
896], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
897 [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no)
898 bash_cv_func_strcoll_broken=no]
899)])
900AC_MSG_RESULT($bash_cv_func_strcoll_broken)
901if test $bash_cv_func_strcoll_broken = yes; then
902AC_DEFINE(STRCOLL_BROKEN)
903fi
904])
905
906AC_DEFUN([BASH_FUNC_PRINTF_A_FORMAT],
907[AC_MSG_CHECKING([for printf floating point output in hex notation])
908AC_CACHE_VAL(bash_cv_printf_a_format,
909[AC_TRY_RUN([
910#include <stdio.h>
911#include <string.h>
912
913int
914main()
915{
916 double y = 0.0;
917 char abuf[1024];
918
919 sprintf(abuf, "%A", y);
920 exit(strchr(abuf, 'P') == (char *)0);
921}
922], bash_cv_printf_a_format=yes, bash_cv_printf_a_format=no,
923 [AC_MSG_WARN(cannot check printf if cross compiling -- defaulting to no)
924 bash_cv_printf_a_format=no]
925)])
926AC_MSG_RESULT($bash_cv_printf_a_format)
927if test $bash_cv_printf_a_format = yes; then
928AC_DEFINE(HAVE_PRINTF_A_FORMAT)
929fi
930])
931
932AC_DEFUN([BASH_STRUCT_TERMIOS_LDISC],
933[
934AC_CHECK_MEMBER(struct termios.c_line, AC_DEFINE(TERMIOS_LDISC), ,[
935#include <sys/types.h>
936#include <termios.h>
937])
938])
939
940AC_DEFUN([BASH_STRUCT_TERMIO_LDISC],
941[
942AC_CHECK_MEMBER(struct termio.c_line, AC_DEFINE(TERMIO_LDISC), ,[
943#include <sys/types.h>
944#include <termio.h>
945])
946])
947
948dnl
949dnl Like AC_STRUCT_ST_BLOCKS, but doesn't muck with LIBOBJS
950dnl
951dnl sets bash_cv_struct_stat_st_blocks
952dnl
953dnl unused for now; we'll see how AC_CHECK_MEMBERS works
954dnl
955AC_DEFUN([BASH_STRUCT_ST_BLOCKS],
956[
957AC_MSG_CHECKING([for struct stat.st_blocks])
958AC_CACHE_VAL(bash_cv_struct_stat_st_blocks,
959[AC_TRY_COMPILE(
960[
961#include <sys/types.h>
962#include <sys/stat.h>
963],
964[
965main()
966{
967static struct stat a;
968if (a.st_blocks) return 0;
969return 0;
970}
971], bash_cv_struct_stat_st_blocks=yes, bash_cv_struct_stat_st_blocks=no)
972])
973AC_MSG_RESULT($bash_cv_struct_stat_st_blocks)
974if test "$bash_cv_struct_stat_st_blocks" = "yes"; then
975AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS)
976fi
977])
978
979AC_DEFUN([BASH_CHECK_LIB_TERMCAP],
980[
981if test "X$bash_cv_termcap_lib" = "X"; then
982_bash_needmsg=yes
983else
984AC_MSG_CHECKING(which library has the termcap functions)
985_bash_needmsg=
986fi
987AC_CACHE_VAL(bash_cv_termcap_lib,
988[AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
989 [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo,
990 [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
991 [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
992 bash_cv_termcap_lib=gnutermcap)])])])])
993if test "X$_bash_needmsg" = "Xyes"; then
994AC_MSG_CHECKING(which library has the termcap functions)
995fi
996AC_MSG_RESULT(using $bash_cv_termcap_lib)
997if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
998LDFLAGS="$LDFLAGS -L./lib/termcap"
999TERMCAP_LIB="./lib/termcap/libtermcap.a"
1000TERMCAP_DEP="./lib/termcap/libtermcap.a"
1001elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
1002TERMCAP_LIB=-ltermcap
1003TERMCAP_DEP=
1004elif test $bash_cv_termcap_lib = libtinfo; then
1005TERMCAP_LIB=-ltinfo
1006TERMCAP_DEP=
1007elif test $bash_cv_termcap_lib = libncurses; then
1008TERMCAP_LIB=-lncurses
1009TERMCAP_DEP=
1010else
1011TERMCAP_LIB=-lcurses
1012TERMCAP_DEP=
1013fi
1014])
1015
1016dnl
1017dnl Check for the presence of getpeername in libsocket.
1018dnl If libsocket is present, check for libnsl and add it to LIBS if
1019dnl it's there, since most systems with libsocket require linking
1020dnl with libnsl as well. This should only be called if getpeername
1021dnl was not found in libc.
1022dnl
1023dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT
1024dnl AS WELL
1025dnl
1026AC_DEFUN([BASH_CHECK_LIB_SOCKET],
1027[
1028if test "X$bash_cv_have_socklib" = "X"; then
1029_bash_needmsg=
1030else
1031AC_MSG_CHECKING(for socket library)
1032_bash_needmsg=yes
1033fi
1034AC_CACHE_VAL(bash_cv_have_socklib,
1035[AC_CHECK_LIB(socket, getpeername,
1036 bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)])
1037if test "X$_bash_needmsg" = Xyes; then
1038 AC_MSG_RESULT($bash_cv_have_socklib)
1039 _bash_needmsg=
1040fi
1041if test $bash_cv_have_socklib = yes; then
1042 # check for libnsl, add it to LIBS if present
1043 if test "X$bash_cv_have_libnsl" = "X"; then
1044 _bash_needmsg=
1045 else
1046 AC_MSG_CHECKING(for libnsl)
1047 _bash_needmsg=yes
1048 fi
1049 AC_CACHE_VAL(bash_cv_have_libnsl,
1050 [AC_CHECK_LIB(nsl, t_open,
1051 bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)])
1052 if test "X$_bash_needmsg" = Xyes; then
1053 AC_MSG_RESULT($bash_cv_have_libnsl)
1054 _bash_needmsg=
1055 fi
1056 if test $bash_cv_have_libnsl = yes; then
1057 LIBS="-lsocket -lnsl $LIBS"
1058 else
1059 LIBS="-lsocket $LIBS"
1060 fi
1061 AC_DEFINE(HAVE_LIBSOCKET)
1062 AC_DEFINE(HAVE_GETPEERNAME)
1063fi
1064])
1065
1066AH_TEMPLATE([STRUCT_DIRENT_HAS_D_INO], [Define if struct dirent has a d_ino member])
1067AC_DEFUN([BASH_STRUCT_DIRENT_D_INO],
1068[AC_REQUIRE([AC_HEADER_DIRENT])
1069AC_MSG_CHECKING(if struct dirent has a d_ino member)
1070AC_CACHE_VAL(bash_cv_dirent_has_dino,
1071[AC_TRY_COMPILE([
1072#include <stdio.h>
1073#include <sys/types.h>
1074#ifdef HAVE_UNISTD_H
1075# include <unistd.h>
1076#endif /* HAVE_UNISTD_H */
1077#if defined(HAVE_DIRENT_H)
1078# include <dirent.h>
1079#else
1080# define dirent direct
1081# ifdef HAVE_SYS_NDIR_H
1082# include <sys/ndir.h>
1083# endif /* SYSNDIR */
1084# ifdef HAVE_SYS_DIR_H
1085# include <sys/dir.h>
1086# endif /* SYSDIR */
1087# ifdef HAVE_NDIR_H
1088# include <ndir.h>
1089# endif
1090#endif /* HAVE_DIRENT_H */
1091],[
1092struct dirent d; int z; z = d.d_ino;
1093], bash_cv_dirent_has_dino=yes, bash_cv_dirent_has_dino=no)])
1094AC_MSG_RESULT($bash_cv_dirent_has_dino)
1095if test $bash_cv_dirent_has_dino = yes; then
1096AC_DEFINE(STRUCT_DIRENT_HAS_D_INO)
1097fi
1098])
1099
1100AH_TEMPLATE([STRUCT_DIRENT_HAS_D_FILENO], [Define if struct dirent has a d_fileno member])
1101AC_DEFUN([BASH_STRUCT_DIRENT_D_FILENO],
1102[AC_REQUIRE([AC_HEADER_DIRENT])
1103AC_MSG_CHECKING(if struct dirent has a d_fileno member)
1104AC_CACHE_VAL(bash_cv_dirent_has_d_fileno,
1105[AC_TRY_COMPILE([
1106#include <stdio.h>
1107#include <sys/types.h>
1108#ifdef HAVE_UNISTD_H
1109# include <unistd.h>
1110#endif /* HAVE_UNISTD_H */
1111#if defined(HAVE_DIRENT_H)
1112# include <dirent.h>
1113#else
1114# define dirent direct
1115# ifdef HAVE_SYS_NDIR_H
1116# include <sys/ndir.h>
1117# endif /* SYSNDIR */
1118# ifdef HAVE_SYS_DIR_H
1119# include <sys/dir.h>
1120# endif /* SYSDIR */
1121# ifdef HAVE_NDIR_H
1122# include <ndir.h>
1123# endif
1124#endif /* HAVE_DIRENT_H */
1125],[
1126struct dirent d; int z; z = d.d_fileno;
1127], bash_cv_dirent_has_d_fileno=yes, bash_cv_dirent_has_d_fileno=no)])
1128AC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
1129if test $bash_cv_dirent_has_d_fileno = yes; then
1130AC_DEFINE(STRUCT_DIRENT_HAS_D_FILENO)
1131fi
1132])
1133
1134AC_DEFUN([BASH_STRUCT_TIMEVAL],
1135[AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
1136AC_CACHE_VAL(bash_cv_struct_timeval,
1137[
1138AC_EGREP_HEADER(struct timeval, sys/time.h,
1139 bash_cv_struct_timeval=yes,
1140 AC_EGREP_HEADER(struct timeval, time.h,
1141 bash_cv_struct_timeval=yes,
1142 bash_cv_struct_timeval=no))
1143])
1144AC_MSG_RESULT($bash_cv_struct_timeval)
1145if test $bash_cv_struct_timeval = yes; then
1146 AC_DEFINE(HAVE_TIMEVAL)
1147fi
1148])
1149
1150AH_TEMPLATE([STRUCT_WINSIZE_IN_SYS_IOCTL], [Define if struct winsize is in sys/ioctl.h])
1151AH_TEMPLATE([STRUCT_WINSIZE_IN_TERMIOS], [Define if struct winsize is in termios.h])
1152AC_DEFUN([BASH_STRUCT_WINSIZE],
1153[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h)
1154AC_CACHE_VAL(bash_cv_struct_winsize_header,
1155[AC_TRY_COMPILE([#include <sys/types.h>
1156#include <sys/ioctl.h>], [struct winsize x;],
1157 bash_cv_struct_winsize_header=ioctl_h,
1158 [AC_TRY_COMPILE([#include <sys/types.h>
1159#include <termios.h>], [struct winsize x;],
1160 bash_cv_struct_winsize_header=termios_h, bash_cv_struct_winsize_header=other)
1161])])
1162if test $bash_cv_struct_winsize_header = ioctl_h; then
1163 AC_MSG_RESULT(sys/ioctl.h)
1164 AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
1165elif test $bash_cv_struct_winsize_header = termios_h; then
1166 AC_MSG_RESULT(termios.h)
1167 AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS)
1168else
1169 AC_MSG_RESULT(not found)
1170fi
1171])
1172
1173dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
1174AH_TEMPLATE([HAVE_POSIX_SIGNALS], [Define if we have the POSIX signal routines])
1175AH_TEMPLATE([HAVE_BSD_SIGNALS], [Define if we have the BSD signal routines])
1176AH_TEMPLATE([HAVE_USG_SIGHOLD], [Define if we have the USG signal routines])
1177AC_DEFUN([BASH_SYS_SIGNAL_VINTAGE],
1178[AC_REQUIRE([AC_TYPE_SIGNAL])
1179AC_MSG_CHECKING(for type of signal functions)
1180AC_CACHE_VAL(bash_cv_signal_vintage,
1181[
1182 AC_MSG_WARN([checking for posix...])
1183 AC_TRY_LINK([#include <signal.h>],[
1184 sigset_t ss;
1185 struct sigaction sa;
1186 sigemptyset(&ss); sigsuspend(&ss);
1187 sigaction(SIGINT, &sa, (struct sigaction *) 0);
1188 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
1189 ], bash_cv_signal_vintage="posix",
1190 [
1191 AC_MSG_WARN([checking for 4.2bsd...])
1192 AC_TRY_LINK([#include <signal.h>], [
1193 int mask = sigmask(SIGINT);
1194 sigsetmask(mask); sigblock(mask); sigpause(mask);
1195 ], bash_cv_signal_vintage="4.2bsd",
1196 [
1197 AC_MSG_WARN([checking for svr3...])
1198 AC_TRY_LINK([
1199 #include <signal.h>
1200 RETSIGTYPE foo() { }], [
1201 int mask = sigmask(SIGINT);
1202 sigset(SIGINT, foo); sigrelse(SIGINT);
1203 sighold(SIGINT); sigpause(SIGINT);
1204 ], bash_cv_signal_vintage="svr3", bash_cv_signal_vintage="v7"
1205 )]
1206 )]
1207)
1208])
1209AC_MSG_RESULT($bash_cv_signal_vintage)
1210if test "$bash_cv_signal_vintage" = "posix"; then
1211AC_DEFINE(HAVE_POSIX_SIGNALS)
1212elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
1213AC_DEFINE(HAVE_BSD_SIGNALS)
1214elif test "$bash_cv_signal_vintage" = "svr3"; then
1215AC_DEFINE(HAVE_USG_SIGHOLD)
1216fi
1217])
1218
1219dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process.
1220AC_DEFUN([BASH_SYS_PGRP_SYNC],
1221[AC_REQUIRE([AC_FUNC_GETPGRP])
1222AC_MSG_CHECKING(whether pgrps need synchronization)
1223AC_CACHE_VAL(bash_cv_pgrp_pipe,
1224[AC_TRY_RUN([
1225#ifdef HAVE_UNISTD_H
1226# include <unistd.h>
1227#endif
1228main()
1229{
1230# ifdef GETPGRP_VOID
1231# define getpgID() getpgrp()
1232# else
1233# define getpgID() getpgrp(0)
1234# define setpgid(x,y) setpgrp(x,y)
1235# endif
1236 int pid1, pid2, fds[2];
1237 int status;
1238 char ok;
1239
1240 switch (pid1 = fork()) {
1241 case -1:
1242 exit(1);
1243 case 0:
1244 setpgid(0, getpid());
1245 exit(0);
1246 }
1247 setpgid(pid1, pid1);
1248
1249 sleep(2); /* let first child die */
1250
1251 if (pipe(fds) < 0)
1252 exit(2);
1253
1254 switch (pid2 = fork()) {
1255 case -1:
1256 exit(3);
1257 case 0:
1258 setpgid(0, pid1);
1259 ok = getpgID() == pid1;
1260 write(fds[1], &ok, 1);
1261 exit(0);
1262 }
1263 setpgid(pid2, pid1);
1264
1265 close(fds[1]);
1266 if (read(fds[0], &ok, 1) != 1)
1267 exit(4);
1268 wait(&status);
1269 wait(&status);
1270 exit(ok ? 0 : 5);
1271}
1272], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
1273 [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
1274 bash_cv_pgrp_pipe=no])
1275])
1276AC_MSG_RESULT($bash_cv_pgrp_pipe)
1277if test $bash_cv_pgrp_pipe = yes; then
1278AC_DEFINE(PGRP_PIPE)
1279fi
1280])
1281
1282AH_TEMPLATE([MUST_REINSTALL_SIGHANDLERS], [Define if signal handlers must be reinstalled when invoked.])
1283AC_DEFUN([BASH_SYS_REINSTALL_SIGHANDLERS],
1284[AC_REQUIRE([AC_TYPE_SIGNAL])
1285AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
1286AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
1287AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
1288[AC_TRY_RUN([
1289#include <signal.h>
1290#ifdef HAVE_UNISTD_H
1291#include <unistd.h>
1292#endif
1293
1294typedef RETSIGTYPE sigfunc();
1295
1296int nsigint;
1297
1298#ifdef HAVE_POSIX_SIGNALS
1299sigfunc *
1300set_signal_handler(sig, handler)
1301 int sig;
1302 sigfunc *handler;
1303{
1304 struct sigaction act, oact;
1305 act.sa_handler = handler;
1306 act.sa_flags = 0;
1307 sigemptyset (&act.sa_mask);
1308 sigemptyset (&oact.sa_mask);
1309 sigaction (sig, &act, &oact);
1310 return (oact.sa_handler);
1311}
1312#else
1313#define set_signal_handler(s, h) signal(s, h)
1314#endif
1315
1316RETSIGTYPE
1317sigint(s)
1318int s;
1319{
1320 nsigint++;
1321}
1322
1323main()
1324{
1325 nsigint = 0;
1326 set_signal_handler(SIGINT, sigint);
1327 kill((int)getpid(), SIGINT);
1328 kill((int)getpid(), SIGINT);
1329 exit(nsigint != 2);
1330}
1331], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
1332 [AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting to no)
1333 bash_cv_must_reinstall_sighandlers=no]
1334)])
1335AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
1336if test $bash_cv_must_reinstall_sighandlers = yes; then
1337AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
1338fi
1339])
1340
1341dnl check that some necessary job control definitions are present
1342AC_DEFUN([BASH_SYS_JOB_CONTROL_MISSING],
1343[AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
1344AC_MSG_CHECKING(for presence of necessary job control definitions)
1345AC_CACHE_VAL(bash_cv_job_control_missing,
1346[AC_TRY_RUN([
1347#include <sys/types.h>
1348#ifdef HAVE_SYS_WAIT_H
1349#include <sys/wait.h>
1350#endif
1351#ifdef HAVE_UNISTD_H
1352#include <unistd.h>
1353#endif
1354#include <signal.h>
1355
1356/* Add more tests in here as appropriate. */
1357main()
1358{
1359/* signal type */
1360#if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS)
1361exit(1);
1362#endif
1363
1364/* signals and tty control. */
1365#if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT)
1366exit (1);
1367#endif
1368
1369/* process control */
1370#if !defined (WNOHANG) || !defined (WUNTRACED)
1371exit(1);
1372#endif
1373
1374/* Posix systems have tcgetpgrp and waitpid. */
1375#if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP)
1376exit(1);
1377#endif
1378
1379#if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID)
1380exit(1);
1381#endif
1382
1383/* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */
1384#if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3)
1385exit(1);
1386#endif
1387
1388exit(0);
1389}], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
1390 [AC_MSG_WARN(cannot check job control if cross-compiling -- defaulting to missing)
1391 bash_cv_job_control_missing=missing]
1392)])
1393AC_MSG_RESULT($bash_cv_job_control_missing)
1394if test $bash_cv_job_control_missing = missing; then
1395AC_DEFINE(JOB_CONTROL_MISSING)
1396fi
1397])
1398
1399dnl check whether named pipes are present
1400dnl this requires a previous check for mkfifo, but that is awkward to specify
1401AC_DEFUN([BASH_SYS_NAMED_PIPES],
1402[AC_MSG_CHECKING(for presence of named pipes)
1403AC_CACHE_VAL(bash_cv_sys_named_pipes,
1404[AC_TRY_RUN([
1405#include <sys/types.h>
1406#include <sys/stat.h>
1407#ifdef HAVE_UNISTD_H
1408#include <unistd.h>
1409#endif
1410
1411/* Add more tests in here as appropriate. */
1412main()
1413{
1414int fd, err;
1415
1416#if defined (HAVE_MKFIFO)
1417exit (0);
1418#endif
1419
1420#if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO))
1421exit (1);
1422#endif
1423
1424#if defined (NeXT)
1425exit (1);
1426#endif
1427err = mkdir("/tmp/bash-aclocal", 0700);
1428if (err < 0) {
1429 perror ("mkdir");
1430 exit(1);
1431}
1432fd = mknod ("/tmp/bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
1433if (fd == -1) {
1434 rmdir ("/tmp/bash-aclocal");
1435 exit (1);
1436}
1437close(fd);
1438unlink ("/tmp/bash-aclocal/sh-np-autoconf");
1439rmdir ("/tmp/bash-aclocal");
1440exit(0);
1441}], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
1442 [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
1443 bash_cv_sys_named_pipes=missing]
1444)])
1445AC_MSG_RESULT($bash_cv_sys_named_pipes)
1446if test $bash_cv_sys_named_pipes = missing; then
1447AC_DEFINE(NAMED_PIPES_MISSING)
1448fi
1449])
1450
1451AC_DEFUN([BASH_SYS_DEFAULT_MAIL_DIR],
1452[AC_MSG_CHECKING(for default mail directory)
1453AC_CACHE_VAL(bash_cv_mail_dir,
1454[if test -d /var/mail; then
1455 bash_cv_mail_dir=/var/mail
1456 elif test -d /var/spool/mail; then
1457 bash_cv_mail_dir=/var/spool/mail
1458 elif test -d /usr/mail; then
1459 bash_cv_mail_dir=/usr/mail
1460 elif test -d /usr/spool/mail; then
1461 bash_cv_mail_dir=/usr/spool/mail
1462 else
1463 bash_cv_mail_dir=unknown
1464 fi
1465])
1466AC_MSG_RESULT($bash_cv_mail_dir)
1467AC_DEFINE_UNQUOTED(DEFAULT_MAIL_DIRECTORY, "$bash_cv_mail_dir")
1468])
1469
1470AC_DEFUN([BASH_HAVE_TIOCGWINSZ],
1471[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
1472AC_CACHE_VAL(bash_cv_tiocgwinsz_in_ioctl,
1473[AC_TRY_COMPILE([#include <sys/types.h>
1474#include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
1475 bash_cv_tiocgwinsz_in_ioctl=yes,bash_cv_tiocgwinsz_in_ioctl=no)])
1476AC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl)
1477if test $bash_cv_tiocgwinsz_in_ioctl = yes; then
1478AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
1479fi
1480])
1481
1482AH_TEMPLATE([TIOCSTAT_IN_SYS_IOCTL], [Define if TIOCSTAT is in sys/ioctl.h])
1483AC_DEFUN([BASH_HAVE_TIOCSTAT],
1484[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
1485AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl,
1486[AC_TRY_COMPILE([#include <sys/types.h>
1487#include <sys/ioctl.h>], [int x = TIOCSTAT;],
1488 bash_cv_tiocstat_in_ioctl=yes,bash_cv_tiocstat_in_ioctl=no)])
1489AC_MSG_RESULT($bash_cv_tiocstat_in_ioctl)
1490if test $bash_cv_tiocstat_in_ioctl = yes; then
1491AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL)
1492fi
1493])
1494
1495AH_TEMPLATE([FIONREAD_IN_SYS_IOCTL], [Define if FIONREAD is in sys/ioctl.h])
1496AC_DEFUN([BASH_HAVE_FIONREAD],
1497[AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
1498AC_CACHE_VAL(bash_cv_fionread_in_ioctl,
1499[AC_TRY_COMPILE([#include <sys/types.h>
1500#include <sys/ioctl.h>], [int x = FIONREAD;],
1501 bash_cv_fionread_in_ioctl=yes,bash_cv_fionread_in_ioctl=no)])
1502AC_MSG_RESULT($bash_cv_fionread_in_ioctl)
1503if test $bash_cv_fionread_in_ioctl = yes; then
1504AC_DEFINE(FIONREAD_IN_SYS_IOCTL)
1505fi
1506])
1507
1508dnl
1509dnl See if speed_t is declared in <sys/types.h>. Some versions of linux
1510dnl require a definition of speed_t each time <termcap.h> is included,
1511dnl but you can only get speed_t if you include <termios.h> (on some
1512dnl versions) or <sys/types.h> (on others).
1513dnl
1514AH_TEMPLATE([SPEED_T_IN_SYS_TYPES], [Define if speed_t is in sys/types.h])
1515AC_DEFUN([BASH_CHECK_SPEED_T],
1516[AC_MSG_CHECKING(for speed_t in sys/types.h)
1517AC_CACHE_VAL(bash_cv_speed_t_in_sys_types,
1518[AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;],
1519 bash_cv_speed_t_in_sys_types=yes,bash_cv_speed_t_in_sys_types=no)])
1520AC_MSG_RESULT($bash_cv_speed_t_in_sys_types)
1521if test $bash_cv_speed_t_in_sys_types = yes; then
1522AC_DEFINE(SPEED_T_IN_SYS_TYPES)
1523fi
1524])
1525
1526AH_TEMPLATE([HAVE_GETPW_DECLS], [Define if getpw functions are declared in pwd.h])
1527AC_DEFUN([BASH_CHECK_GETPW_FUNCS],
1528[AC_MSG_CHECKING(whether getpw functions are declared in pwd.h)
1529AC_CACHE_VAL(bash_cv_getpw_declared,
1530[AC_EGREP_CPP(getpwuid,
1531[
1532#include <sys/types.h>
1533#ifdef HAVE_UNISTD_H
1534# include <unistd.h>
1535#endif
1536#include <pwd.h>
1537],
1538bash_cv_getpw_declared=yes,bash_cv_getpw_declared=no)])
1539AC_MSG_RESULT($bash_cv_getpw_declared)
1540if test $bash_cv_getpw_declared = yes; then
1541AC_DEFINE(HAVE_GETPW_DECLS)
1542fi
1543])
1544
1545AC_DEFUN([BASH_CHECK_DEV_FD],
1546[AC_MSG_CHECKING(whether /dev/fd is available)
1547AC_CACHE_VAL(bash_cv_dev_fd,
1548[if test -d /dev/fd && test -r /dev/fd/0; then
1549 bash_cv_dev_fd=standard
1550 elif test -d /proc/self/fd && test -r /proc/self/fd/0; then
1551 bash_cv_dev_fd=whacky
1552 else
1553 bash_cv_dev_fd=absent
1554 fi
1555])
1556AC_MSG_RESULT($bash_cv_dev_fd)
1557if test $bash_cv_dev_fd = "standard"; then
1558 AC_DEFINE(HAVE_DEV_FD)
1559 AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/")
1560elif test $bash_cv_dev_fd = "whacky"; then
1561 AC_DEFINE(HAVE_DEV_FD)
1562 AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/")
1563fi
1564])
1565
1566AC_DEFUN([BASH_CHECK_DEV_STDIN],
1567[AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
1568AC_CACHE_VAL(bash_cv_dev_stdin,
1569[if test -d /dev/fd && test -r /dev/stdin; then
1570 bash_cv_dev_stdin=present
1571 elif test -d /proc/self/fd && test -r /dev/stdin; then
1572 bash_cv_dev_stdin=present
1573 else
1574 bash_cv_dev_stdin=absent
1575 fi
1576])
1577AC_MSG_RESULT($bash_cv_dev_stdin)
1578if test $bash_cv_dev_stdin = "present"; then
1579 AC_DEFINE(HAVE_DEV_STDIN)
1580fi
1581])
1582
1583dnl
1584dnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions
1585dnl
1586AC_DEFUN([BASH_CHECK_KERNEL_RLIMIT],
1587[AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines])
1588AC_CACHE_VAL(bash_cv_kernel_rlimit,
1589[AC_TRY_COMPILE([
1590#include <sys/types.h>
1591#include <sys/resource.h>
1592],
1593[
1594 int f;
1595 f = RLIMIT_DATA;
1596], bash_cv_kernel_rlimit=no,
1597[AC_TRY_COMPILE([
1598#include <sys/types.h>
1599#define _KERNEL
1600#include <sys/resource.h>
1601#undef _KERNEL
1602],
1603[
1604 int f;
1605 f = RLIMIT_DATA;
1606], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)]
1607)])
1608AC_MSG_RESULT($bash_cv_kernel_rlimit)
1609if test $bash_cv_kernel_rlimit = yes; then
1610AC_DEFINE(RLIMIT_NEEDS_KERNEL)
1611fi
1612])
1613
1614dnl
1615dnl Check for 64-bit off_t -- used for malloc alignment
1616dnl
1617dnl C does not allow duplicate case labels, so the compile will fail if
1618dnl sizeof(off_t) is > 4.
1619dnl
1620AC_DEFUN([BASH_CHECK_OFF_T_64],
1621[AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64,
1622AC_TRY_COMPILE([
1623#ifdef HAVE_UNISTD_H
1624#include <unistd.h>
1625#endif
1626#include <sys/types.h>
1627],[
1628switch (0) case 0: case (sizeof (off_t) <= 4):;
1629], bash_cv_off_t_64=no, bash_cv_off_t_64=yes))
1630if test $bash_cv_off_t_64 = yes; then
1631 AC_DEFINE(HAVE_OFF_T_64)
1632fi])
1633
1634AC_DEFUN([BASH_CHECK_RTSIGS],
1635[AC_MSG_CHECKING(for unusable real-time signals due to large values)
1636AC_CACHE_VAL(bash_cv_unusable_rtsigs,
1637[AC_TRY_RUN([
1638#include <sys/types.h>
1639#include <signal.h>
1640
1641#ifndef NSIG
1642# define NSIG 64
1643#endif
1644
1645main ()
1646{
1647 int n_sigs = 2 * NSIG;
1648#ifdef SIGRTMIN
1649 int rtmin = SIGRTMIN;
1650#else
1651 int rtmin = 0;
1652#endif
1653
1654 exit(rtmin < n_sigs);
1655}], bash_cv_unusable_rtsigs=yes, bash_cv_unusable_rtsigs=no,
1656 [AC_MSG_WARN(cannot check real-time signals if cross compiling -- defaulting to yes)
1657 bash_cv_unusable_rtsigs=yes]
1658)])
1659AC_MSG_RESULT($bash_cv_unusable_rtsigs)
1660if test $bash_cv_unusable_rtsigs = yes; then
1661AC_DEFINE(UNUSABLE_RT_SIGNALS)
1662fi
1663])
1664
1665dnl
1666dnl check for availability of multibyte characters and functions
1667dnl
1668AH_TEMPLATE([HAVE_MBSRTOWCS], [Define if we have the mbsrtowcs function])
1669AH_TEMPLATE([HAVE_WCWIDTH], [Define if we have the wcwidth function])
1670AH_TEMPLATE([HAVE_MBSTATE_T], [Define if we have mbstate_t])
1671AH_TEMPLATE([HAVE_LANGINFO_CODESET], [Define if we have nl_langinfo and CODESET])
1672AC_DEFUN([BASH_CHECK_MULTIBYTE],
1673[
1674AC_CHECK_HEADERS(wctype.h)
1675AC_CHECK_HEADERS(wchar.h)
1676AC_CHECK_HEADERS(langinfo.h)
1677
1678AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
1679AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
1680
1681AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
1682[AC_TRY_RUN([
1683#include <wchar.h>
1684int
1685main ()
1686{
1687 mbstate_t ps;
1688 return 0;
1689}], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)])
1690if test $bash_cv_have_mbstate_t = yes; then
1691 AC_DEFINE(HAVE_MBSTATE_T)
1692fi
1693
1694AC_CACHE_CHECK([for nl_langinfo and CODESET], bash_cv_langinfo_codeset,
1695[AC_TRY_LINK(
1696[#include <langinfo.h>],
1697[char* cs = nl_langinfo(CODESET);],
1698bash_cv_langinfo_codeset=yes, bash_cv_langinfo_codeset=no)])
1699if test $bash_cv_langinfo_codeset = yes; then
1700 AC_DEFINE(HAVE_LANGINFO_CODESET)
1701fi
1702
1703])
1704
1705dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
1706dnl require:
1707dnl AC_PROG_CC
1708dnl BASH_CHECK_LIB_TERMCAP
1709
1710AC_DEFUN([RL_LIB_READLINE_VERSION],
1711[
1712AC_REQUIRE([BASH_CHECK_LIB_TERMCAP])
1713
1714AC_MSG_CHECKING([version of installed readline library])
1715
1716# What a pain in the ass this is.
1717
1718# save cpp and ld options
1719_save_CFLAGS="$CFLAGS"
1720_save_LDFLAGS="$LDFLAGS"
1721_save_LIBS="$LIBS"
1722
1723# Don't set ac_cv_rl_prefix if the caller has already assigned a value. This
1724# allows the caller to do something like $_rl_prefix=$withval if the user
1725# specifies --with-installed-readline=PREFIX as an argument to configure
1726
1727if test -z "$ac_cv_rl_prefix"; then
1728test "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix}
1729fi
1730
1731eval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include
1732eval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib
1733
1734LIBS="$LIBS -lreadline ${TERMCAP_LIB}"
1735CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}"
1736LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}"
1737
1738AC_TRY_RUN([
1739#include <stdio.h>
1740#include <readline/readline.h>
1741
1742main()
1743{
1744 FILE *fp;
1745 fp = fopen("conftest.rlv", "w");
1746 if (fp == 0) exit(1);
1747 fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0");
1748 fclose(fp);
1749 exit(0);
1750}
1751],
1752ac_cv_rl_version=`cat conftest.rlv`,
1753ac_cv_rl_version='0.0',
1754ac_cv_rl_version='4.2')
1755
1756CFLAGS="$_save_CFLAGS"
1757LDFLAGS="$_save_LDFLAGS"
1758LIBS="$_save_LIBS"
1759
1760RL_MAJOR=0
1761RL_MINOR=0
1762
1763# (
1764case "$ac_cv_rl_version" in
17652*|3*|4*|5*|6*|7*|8*|9*)
1766 RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'`
1767 RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[[a-zA-Z]]*$::'`
1768 ;;
1769esac
1770
1771# (((
1772case $RL_MAJOR in
1773[[0-9][0-9]]) _RL_MAJOR=$RL_MAJOR ;;
1774[[0-9]]) _RL_MAJOR=0$RL_MAJOR ;;
1775*) _RL_MAJOR=00 ;;
1776esac
1777
1778# (((
1779case $RL_MINOR in
1780[[0-9][0-9]]) _RL_MINOR=$RL_MINOR ;;
1781[[0-9]]) _RL_MINOR=0$RL_MINOR ;;
1782*) _RL_MINOR=00 ;;
1783esac
1784
1785RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}"
1786
1787# Readline versions greater than 4.2 have these defines in readline.h
1788
1789if test $ac_cv_rl_version = '0.0' ; then
1790 AC_MSG_WARN([Could not test version of installed readline library.])
1791elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then
1792 # set these for use by the caller
1793 RL_PREFIX=$ac_cv_rl_prefix
1794 RL_LIBDIR=$ac_cv_rl_libdir
1795 RL_INCLUDEDIR=$ac_cv_rl_includedir
1796 AC_MSG_RESULT($ac_cv_rl_version)
1797else
1798
1799AC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library])
1800AC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library])
1801AC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library])
1802
1803AC_SUBST(RL_VERSION)
1804AC_SUBST(RL_MAJOR)
1805AC_SUBST(RL_MINOR)
1806
1807# set these for use by the caller
1808RL_PREFIX=$ac_cv_rl_prefix
1809RL_LIBDIR=$ac_cv_rl_libdir
1810RL_INCLUDEDIR=$ac_cv_rl_includedir
1811
1812AC_MSG_RESULT($ac_cv_rl_version)
1813
1814fi
1815])