diff options
author | Samuel Ortiz <sameo@openedhand.com> | 2008-10-07 22:34:01 +0000 |
---|---|---|
committer | Samuel Ortiz <sameo@openedhand.com> | 2008-10-07 22:34:01 +0000 |
commit | 95857f6cadeff0471d4f877a97612a58a95b5bf2 (patch) | |
tree | e0281a390b88f17452c8b0b39a175c23e36af4fd /meta/packages/readline/readline-5.2 | |
parent | c16dee4ff920ae0cf2004f94270b7906f180a570 (diff) | |
download | poky-95857f6cadeff0471d4f877a97612a58a95b5bf2.tar.gz |
readline: bump to the latest 5.2
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5438 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/readline/readline-5.2')
-rw-r--r-- | meta/packages/readline/readline-5.2/acinclude.m4 | 1815 |
1 files changed, 1815 insertions, 0 deletions
diff --git a/meta/packages/readline/readline-5.2/acinclude.m4 b/meta/packages/readline/readline-5.2/acinclude.m4 new file mode 100644 index 0000000000..8a45f99084 --- /dev/null +++ b/meta/packages/readline/readline-5.2/acinclude.m4 | |||
@@ -0,0 +1,1815 @@ | |||
1 | dnl | ||
2 | dnl Bash specific tests | ||
3 | dnl | ||
4 | dnl Some derived from PDKSH 5.1.3 autoconf tests | ||
5 | dnl | ||
6 | |||
7 | AC_DEFUN([BASH_C_LONG_LONG], | ||
8 | [AC_CACHE_CHECK(for long long, ac_cv_c_long_long, | ||
9 | [if test "$GCC" = yes; then | ||
10 | ac_cv_c_long_long=yes | ||
11 | else | ||
12 | AC_TRY_RUN([ | ||
13 | int | ||
14 | main() | ||
15 | { | ||
16 | long long foo = 0; | ||
17 | exit(sizeof(long long) < sizeof(long)); | ||
18 | } | ||
19 | ], ac_cv_c_long_long=yes, ac_cv_c_long_long=no) | ||
20 | fi]) | ||
21 | if test $ac_cv_c_long_long = yes; then | ||
22 | AC_DEFINE(HAVE_LONG_LONG, 1, [Define if the `long long' type works.]) | ||
23 | fi | ||
24 | ]) | ||
25 | |||
26 | dnl | ||
27 | dnl This is very similar to AC_C_LONG_DOUBLE, with the fix for IRIX | ||
28 | dnl (< changed to <=) added. | ||
29 | dnl | ||
30 | AC_DEFUN([BASH_C_LONG_DOUBLE], | ||
31 | [AC_CACHE_CHECK(for long double, ac_cv_c_long_double, | ||
32 | [if test "$GCC" = yes; then | ||
33 | ac_cv_c_long_double=yes | ||
34 | else | ||
35 | AC_TRY_RUN([ | ||
36 | int | ||
37 | main() | ||
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) | ||
48 | fi]) | ||
49 | if test $ac_cv_c_long_double = yes; then | ||
50 | AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if the `long double' type works.]) | ||
51 | fi | ||
52 | ]) | ||
53 | |||
54 | dnl | ||
55 | dnl Check for <inttypes.h>. This is separated out so that it can be | ||
56 | dnl AC_REQUIREd. | ||
57 | dnl | ||
58 | dnl BASH_HEADER_INTTYPES | ||
59 | AC_DEFUN([BASH_HEADER_INTTYPES], | ||
60 | [ | ||
61 | AC_CHECK_HEADERS(inttypes.h) | ||
62 | ]) | ||
63 | |||
64 | dnl | ||
65 | dnl check for typedef'd symbols in header files, but allow the caller to | ||
66 | dnl specify the include files to be checked in addition to the default | ||
67 | dnl | ||
68 | dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND]) | ||
69 | AC_DEFUN([BASH_CHECK_TYPE], | ||
70 | [ | ||
71 | AC_REQUIRE([AC_HEADER_STDC])dnl | ||
72 | AC_REQUIRE([BASH_HEADER_INTTYPES]) | ||
73 | AC_MSG_CHECKING(for $1) | ||
74 | AC_CACHE_VAL(bash_cv_type_$1, | ||
75 | [AC_EGREP_CPP($1, [#include <sys/types.h> | ||
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)]) | ||
85 | AC_MSG_RESULT($bash_cv_type_$1) | ||
86 | ifelse($#, 4, [if test $bash_cv_type_$1 = yes; then | ||
87 | AC_DEFINE($4) | ||
88 | fi]) | ||
89 | if test $bash_cv_type_$1 = no; then | ||
90 | AC_DEFINE_UNQUOTED($1, $3) | ||
91 | fi | ||
92 | ]) | ||
93 | |||
94 | dnl | ||
95 | dnl BASH_CHECK_DECL(FUNC) | ||
96 | dnl | ||
97 | dnl Check for a declaration of FUNC in stdlib.h and inttypes.h like | ||
98 | dnl AC_CHECK_DECL | ||
99 | dnl | ||
100 | AC_DEFUN([BASH_CHECK_DECL], | ||
101 | [ | ||
102 | AC_REQUIRE([AC_HEADER_STDC]) | ||
103 | AC_REQUIRE([BASH_HEADER_INTTYPES]) | ||
104 | AC_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;], | ||
115 | bash_cv_decl_$1=yes, bash_cv_decl_$1=no)]) | ||
116 | bash_tr_func=HAVE_DECL_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` | ||
117 | if test $bash_cv_decl_$1 = yes; then | ||
118 | AC_DEFINE_UNQUOTED($bash_tr_func, 1) | ||
119 | else | ||
120 | AC_DEFINE_UNQUOTED($bash_tr_func, 0) | ||
121 | fi | ||
122 | ]) | ||
123 | |||
124 | AC_DEFUN([BASH_DECL_PRINTF], | ||
125 | [AC_MSG_CHECKING(for declaration of printf in <stdio.h>) | ||
126 | AC_CACHE_VAL(bash_cv_printf_declared, | ||
127 | [AC_TRY_RUN([ | ||
128 | #include <stdio.h> | ||
129 | #ifdef __STDC__ | ||
130 | typedef int (*_bashfunc)(const char *, ...); | ||
131 | #else | ||
132 | typedef int (*_bashfunc)(); | ||
133 | #endif | ||
134 | main() | ||
135 | { | ||
136 | _bashfunc pf; | ||
137 | pf = (_bashfunc) printf; | ||
138 | exit(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 | )]) | ||
144 | AC_MSG_RESULT($bash_cv_printf_declared) | ||
145 | if test $bash_cv_printf_declared = yes; then | ||
146 | AC_DEFINE(PRINTF_DECLARED) | ||
147 | fi | ||
148 | ]) | ||
149 | |||
150 | AC_DEFUN([BASH_DECL_SBRK], | ||
151 | [AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>) | ||
152 | AC_CACHE_VAL(bash_cv_sbrk_declared, | ||
153 | [AC_EGREP_HEADER(sbrk, unistd.h, | ||
154 | bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)]) | ||
155 | AC_MSG_RESULT($bash_cv_sbrk_declared) | ||
156 | if test $bash_cv_sbrk_declared = yes; then | ||
157 | AC_DEFINE(SBRK_DECLARED) | ||
158 | fi | ||
159 | ]) | ||
160 | |||
161 | dnl | ||
162 | dnl Check for sys_siglist[] or _sys_siglist[] | ||
163 | dnl | ||
164 | AC_DEFUN([BASH_DECL_UNDER_SYS_SIGLIST], | ||
165 | [AC_MSG_CHECKING([for _sys_siglist in signal.h or unistd.h]) | ||
166 | AC_CACHE_VAL(bash_cv_decl_under_sys_siglist, | ||
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 | ||
175 | AC_MSG_RESULT($bash_cv_decl_under_sys_siglist) | ||
176 | if test $bash_cv_decl_under_sys_siglist = yes; then | ||
177 | AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED) | ||
178 | fi | ||
179 | ]) | ||
180 | |||
181 | AC_DEFUN([BASH_UNDER_SYS_SIGLIST], | ||
182 | [AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST]) | ||
183 | AC_MSG_CHECKING([for _sys_siglist in system C library]) | ||
184 | AC_CACHE_VAL(bash_cv_under_sys_siglist, | ||
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 | ||
192 | extern char *_sys_siglist[]; | ||
193 | #endif | ||
194 | main() | ||
195 | { | ||
196 | char *msg = (char *)_sys_siglist[2]; | ||
197 | exit(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])]) | ||
202 | AC_MSG_RESULT($bash_cv_under_sys_siglist) | ||
203 | if test $bash_cv_under_sys_siglist = yes; then | ||
204 | AC_DEFINE(HAVE_UNDER_SYS_SIGLIST) | ||
205 | fi | ||
206 | ]) | ||
207 | |||
208 | AC_DEFUN([BASH_SYS_SIGLIST], | ||
209 | [ | ||
210 | AC_CHECK_DECLS([sys_siglist]) | ||
211 | AC_MSG_CHECKING([for sys_siglist in system C library]) | ||
212 | AC_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 | ||
220 | extern char *sys_siglist[]; | ||
221 | #endif | ||
222 | main() | ||
223 | { | ||
224 | char *msg = sys_siglist[2]; | ||
225 | exit(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])]) | ||
230 | AC_MSG_RESULT($bash_cv_sys_siglist) | ||
231 | if test $bash_cv_sys_siglist = yes; then | ||
232 | AC_DEFINE(HAVE_SYS_SIGLIST) | ||
233 | fi | ||
234 | ]) | ||
235 | |||
236 | dnl Check for the various permutations of sys_siglist and make sure we | ||
237 | dnl compile in siglist.o if they're not defined | ||
238 | AC_DEFUN([BASH_CHECK_SYS_SIGLIST], [ | ||
239 | AC_REQUIRE([BASH_SYS_SIGLIST]) | ||
240 | AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST]) | ||
241 | AC_REQUIRE([BASH_FUNC_STRSIGNAL]) | ||
242 | if 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 | ||
244 | else | ||
245 | SIGLIST_O= | ||
246 | fi | ||
247 | AC_SUBST([SIGLIST_O]) | ||
248 | ]) | ||
249 | |||
250 | dnl Check for sys_errlist[] and sys_nerr, check for declaration | ||
251 | AC_DEFUN([BASH_SYS_ERRLIST], | ||
252 | [AC_MSG_CHECKING([for sys_errlist and sys_nerr]) | ||
253 | AC_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 | ||
259 | AC_MSG_RESULT($bash_cv_sys_errlist) | ||
260 | if test $bash_cv_sys_errlist = yes; then | ||
261 | AC_DEFINE(HAVE_SYS_ERRLIST) | ||
262 | fi | ||
263 | ]) | ||
264 | |||
265 | dnl | ||
266 | dnl Check if dup2() does not clear the close on exec flag | ||
267 | dnl | ||
268 | AC_DEFUN([BASH_FUNC_DUP2_CLOEXEC_CHECK], | ||
269 | [AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag) | ||
270 | AC_CACHE_VAL(bash_cv_dup2_broken, | ||
271 | [AC_TRY_RUN([ | ||
272 | #include <sys/types.h> | ||
273 | #include <fcntl.h> | ||
274 | main() | ||
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 | ]) | ||
291 | AC_MSG_RESULT($bash_cv_dup2_broken) | ||
292 | if test $bash_cv_dup2_broken = yes; then | ||
293 | AC_DEFINE(DUP2_BROKEN) | ||
294 | fi | ||
295 | ]) | ||
296 | |||
297 | AC_DEFUN([BASH_FUNC_STRSIGNAL], | ||
298 | [AC_MSG_CHECKING([for the existence of strsignal]) | ||
299 | AC_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)]) | ||
304 | AC_MSG_RESULT($bash_cv_have_strsignal) | ||
305 | if test $bash_cv_have_strsignal = yes; then | ||
306 | AC_DEFINE(HAVE_STRSIGNAL) | ||
307 | fi | ||
308 | ]) | ||
309 | |||
310 | dnl Check to see if opendir will open non-directories (not a nice thing) | ||
311 | AC_DEFUN([BASH_FUNC_OPENDIR_CHECK], | ||
312 | [AC_REQUIRE([AC_HEADER_DIRENT])dnl | ||
313 | AC_MSG_CHECKING(if opendir() opens non-directories) | ||
314 | AC_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 */ | ||
336 | main() | ||
337 | { | ||
338 | DIR *dir; | ||
339 | int fd, err; | ||
340 | err = mkdir("/tmp/bash-aclocal", 0700); | ||
341 | if (err < 0) { | ||
342 | perror("mkdir"); | ||
343 | exit(1); | ||
344 | } | ||
345 | unlink("/tmp/bash-aclocal/not_a_directory"); | ||
346 | fd = open("/tmp/bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666); | ||
347 | write(fd, "\n", 1); | ||
348 | close(fd); | ||
349 | dir = opendir("/tmp/bash-aclocal/not_a_directory"); | ||
350 | unlink("/tmp/bash-aclocal/not_a_directory"); | ||
351 | rmdir("/tmp/bash-aclocal"); | ||
352 | exit (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 | )]) | ||
357 | AC_MSG_RESULT($bash_cv_opendir_not_robust) | ||
358 | if test $bash_cv_opendir_not_robust = yes; then | ||
359 | AC_DEFINE(OPENDIR_NOT_ROBUST) | ||
360 | fi | ||
361 | ]) | ||
362 | |||
363 | dnl | ||
364 | AH_TEMPLATE([VOID_SIGHANDLER], [Define if signal handlers return type void]) | ||
365 | AC_DEFUN([BASH_TYPE_SIGHANDLER], | ||
366 | [AC_MSG_CHECKING([whether signal handlers are of type void]) | ||
367 | AC_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 | ||
374 | extern "C" | ||
375 | #endif | ||
376 | void (*signal ()) ();], | ||
377 | [int i;], bash_cv_void_sighandler=yes, bash_cv_void_sighandler=no)])dnl | ||
378 | AC_MSG_RESULT($bash_cv_void_sighandler) | ||
379 | if test $bash_cv_void_sighandler = yes; then | ||
380 | AC_DEFINE(VOID_SIGHANDLER) | ||
381 | fi | ||
382 | ]) | ||
383 | |||
384 | dnl | ||
385 | dnl A signed 16-bit integer quantity | ||
386 | dnl | ||
387 | AC_DEFUN([BASH_TYPE_BITS16_T], | ||
388 | [ | ||
389 | if test "$ac_cv_sizeof_short" = 2; then | ||
390 | AC_CHECK_TYPE(bits16_t, short) | ||
391 | elif test "$ac_cv_sizeof_char" = 2; then | ||
392 | AC_CHECK_TYPE(bits16_t, char) | ||
393 | else | ||
394 | AC_CHECK_TYPE(bits16_t, short) | ||
395 | fi | ||
396 | ]) | ||
397 | |||
398 | dnl | ||
399 | dnl An unsigned 16-bit integer quantity | ||
400 | dnl | ||
401 | AC_DEFUN([BASH_TYPE_U_BITS16_T], | ||
402 | [ | ||
403 | if test "$ac_cv_sizeof_short" = 2; then | ||
404 | AC_CHECK_TYPE(u_bits16_t, unsigned short) | ||
405 | elif test "$ac_cv_sizeof_char" = 2; then | ||
406 | AC_CHECK_TYPE(u_bits16_t, unsigned char) | ||
407 | else | ||
408 | AC_CHECK_TYPE(u_bits16_t, unsigned short) | ||
409 | fi | ||
410 | ]) | ||
411 | |||
412 | dnl | ||
413 | dnl A signed 32-bit integer quantity | ||
414 | dnl | ||
415 | AC_DEFUN([BASH_TYPE_BITS32_T], | ||
416 | [ | ||
417 | if test "$ac_cv_sizeof_int" = 4; then | ||
418 | AC_CHECK_TYPE(bits32_t, int) | ||
419 | elif test "$ac_cv_sizeof_long" = 4; then | ||
420 | AC_CHECK_TYPE(bits32_t, long) | ||
421 | else | ||
422 | AC_CHECK_TYPE(bits32_t, int) | ||
423 | fi | ||
424 | ]) | ||
425 | |||
426 | dnl | ||
427 | dnl An unsigned 32-bit integer quantity | ||
428 | dnl | ||
429 | AC_DEFUN([BASH_TYPE_U_BITS32_T], | ||
430 | [ | ||
431 | if test "$ac_cv_sizeof_int" = 4; then | ||
432 | AC_CHECK_TYPE(u_bits32_t, unsigned int) | ||
433 | elif test "$ac_cv_sizeof_long" = 4; then | ||
434 | AC_CHECK_TYPE(u_bits32_t, unsigned long) | ||
435 | else | ||
436 | AC_CHECK_TYPE(u_bits32_t, unsigned int) | ||
437 | fi | ||
438 | ]) | ||
439 | |||
440 | AC_DEFUN([BASH_TYPE_PTRDIFF_T], | ||
441 | [ | ||
442 | if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then | ||
443 | AC_CHECK_TYPE(ptrdiff_t, int) | ||
444 | elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then | ||
445 | AC_CHECK_TYPE(ptrdiff_t, long) | ||
446 | elif 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]) | ||
448 | else | ||
449 | AC_CHECK_TYPE(ptrdiff_t, int) | ||
450 | fi | ||
451 | ]) | ||
452 | |||
453 | dnl | ||
454 | dnl A signed 64-bit quantity | ||
455 | dnl | ||
456 | AC_DEFUN([BASH_TYPE_BITS64_T], | ||
457 | [ | ||
458 | if test "$ac_cv_sizeof_char_p" = 8; then | ||
459 | AC_CHECK_TYPE(bits64_t, char *) | ||
460 | elif test "$ac_cv_sizeof_double" = 8; then | ||
461 | AC_CHECK_TYPE(bits64_t, double) | ||
462 | elif test -n "$ac_cv_type_long_long" && test "$ac_cv_sizeof_long_long" = 8; then | ||
463 | AC_CHECK_TYPE(bits64_t, [long long]) | ||
464 | elif test "$ac_cv_sizeof_long" = 8; then | ||
465 | AC_CHECK_TYPE(bits64_t, long) | ||
466 | else | ||
467 | AC_CHECK_TYPE(bits64_t, double) | ||
468 | fi | ||
469 | ]) | ||
470 | |||
471 | AC_DEFUN([BASH_TYPE_LONG_LONG], | ||
472 | [ | ||
473 | AC_CACHE_CHECK([for long long], bash_cv_type_long_long, | ||
474 | [AC_TRY_LINK([ | ||
475 | long long ll = 1; int i = 63;], | ||
476 | [ | ||
477 | long long llm = (long long) -1; | ||
478 | return ll << i | ll >> i | llm / ll | llm % ll; | ||
479 | ], bash_cv_type_long_long='long long', bash_cv_type_long_long='long')]) | ||
480 | if test "$bash_cv_type_long_long" = 'long long'; then | ||
481 | AC_DEFINE(HAVE_LONG_LONG, 1) | ||
482 | fi | ||
483 | ]) | ||
484 | |||
485 | AC_DEFUN([BASH_TYPE_UNSIGNED_LONG_LONG], | ||
486 | [ | ||
487 | AC_CACHE_CHECK([for unsigned long long], bash_cv_type_unsigned_long_long, | ||
488 | [AC_TRY_LINK([ | ||
489 | unsigned long long ull = 1; int i = 63;], | ||
490 | [ | ||
491 | unsigned long long ullmax = (unsigned long long) -1; | ||
492 | return 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')]) | ||
495 | if test "$bash_cv_type_unsigned_long_long" = 'unsigned long long'; then | ||
496 | AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1) | ||
497 | fi | ||
498 | ]) | ||
499 | |||
500 | dnl | ||
501 | dnl Type of struct rlimit fields: some systems (OSF/1, NetBSD, RISC/os 5.0) | ||
502 | dnl have a rlim_t, others (4.4BSD based systems) use quad_t, others use | ||
503 | dnl long and still others use int (HP-UX 9.01, SunOS 4.1.3). To simplify | ||
504 | dnl matters, this just checks for rlim_t, quad_t, or long. | ||
505 | dnl | ||
506 | AC_DEFUN([BASH_TYPE_RLIMIT], | ||
507 | [AC_MSG_CHECKING(for size and type of struct rlimit fields) | ||
508 | AC_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,[ | ||
512 | AC_TRY_RUN([ | ||
513 | #include <sys/types.h> | ||
514 | #include <sys/time.h> | ||
515 | #include <sys/resource.h> | ||
516 | main() | ||
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 | ]) | ||
528 | AC_MSG_RESULT($bash_cv_type_rlimit) | ||
529 | if test $bash_cv_type_rlimit = quad_t; then | ||
530 | AC_DEFINE(RLIMTYPE, quad_t) | ||
531 | elif test $bash_cv_type_rlimit = rlim_t; then | ||
532 | AC_DEFINE(RLIMTYPE, rlim_t) | ||
533 | fi | ||
534 | ]) | ||
535 | |||
536 | AC_DEFUN([BASH_FUNC_LSTAT], | ||
537 | [dnl Cannot use AC_CHECK_FUNCS(lstat) because Linux defines lstat() as an | ||
538 | dnl inline function in <sys/stat.h>. | ||
539 | AC_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); ], | ||
544 | bash_cv_func_lstat=yes, bash_cv_func_lstat=no)]) | ||
545 | if test $bash_cv_func_lstat = yes; then | ||
546 | AC_DEFINE(HAVE_LSTAT) | ||
547 | fi | ||
548 | ]) | ||
549 | |||
550 | AC_DEFUN([BASH_FUNC_INET_ATON], | ||
551 | [ | ||
552 | AC_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> | ||
557 | struct in_addr ap;], [ inet_aton("127.0.0.1", &ap); ], | ||
558 | bash_cv_func_inet_aton=yes, bash_cv_func_inet_aton=no)]) | ||
559 | if test $bash_cv_func_inet_aton = yes; then | ||
560 | AC_DEFINE(HAVE_INET_ATON) | ||
561 | else | ||
562 | AC_LIBOBJ(inet_aton) | ||
563 | fi | ||
564 | ]) | ||
565 | |||
566 | AC_DEFUN([BASH_FUNC_GETENV], | ||
567 | [AC_MSG_CHECKING(to see if getenv can be redefined) | ||
568 | AC_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 | ||
578 | char * | ||
579 | getenv (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 | { | ||
586 | return "42"; | ||
587 | } | ||
588 | main() | ||
589 | { | ||
590 | char *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) | ||
595 | exit(1); | ||
596 | #endif | ||
597 | s = getenv("ABCDE"); | ||
598 | exit(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 | )]) | ||
604 | AC_MSG_RESULT($bash_cv_getenv_redef) | ||
605 | if test $bash_cv_getenv_redef = yes; then | ||
606 | AC_DEFINE(CAN_REDEFINE_GETENV) | ||
607 | fi | ||
608 | ]) | ||
609 | |||
610 | # We should check for putenv before calling this | ||
611 | AC_DEFUN([BASH_FUNC_STD_PUTENV], | ||
612 | [ | ||
613 | AC_REQUIRE([AC_HEADER_STDC]) | ||
614 | AC_REQUIRE([AC_C_PROTOTYPES]) | ||
615 | AC_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 | ||
627 | extern int putenv (char *); | ||
628 | #else | ||
629 | extern int putenv (); | ||
630 | #endif | ||
631 | ], | ||
632 | [return (putenv == 0);], | ||
633 | bash_cv_std_putenv=yes, bash_cv_std_putenv=no | ||
634 | )]) | ||
635 | if test $bash_cv_std_putenv = yes; then | ||
636 | AC_DEFINE(HAVE_STD_PUTENV) | ||
637 | fi | ||
638 | ]) | ||
639 | |||
640 | # We should check for unsetenv before calling this | ||
641 | AC_DEFUN([BASH_FUNC_STD_UNSETENV], | ||
642 | [ | ||
643 | AC_REQUIRE([AC_HEADER_STDC]) | ||
644 | AC_REQUIRE([AC_C_PROTOTYPES]) | ||
645 | AC_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 | ||
657 | extern int unsetenv (const char *); | ||
658 | #else | ||
659 | extern int unsetenv (); | ||
660 | #endif | ||
661 | ], | ||
662 | [return (unsetenv == 0);], | ||
663 | bash_cv_std_unsetenv=yes, bash_cv_std_unsetenv=no | ||
664 | )]) | ||
665 | if test $bash_cv_std_unsetenv = yes; then | ||
666 | AC_DEFINE(HAVE_STD_UNSETENV) | ||
667 | fi | ||
668 | ]) | ||
669 | |||
670 | AC_DEFUN([BASH_FUNC_ULIMIT_MAXFDS], | ||
671 | [AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize) | ||
672 | AC_CACHE_VAL(bash_cv_ulimit_maxfds, | ||
673 | [AC_TRY_RUN([ | ||
674 | main() | ||
675 | { | ||
676 | long maxfds = ulimit(4, 0L); | ||
677 | exit (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 | )]) | ||
683 | AC_MSG_RESULT($bash_cv_ulimit_maxfds) | ||
684 | if test $bash_cv_ulimit_maxfds = yes; then | ||
685 | AC_DEFINE(ULIMIT_MAXFDS) | ||
686 | fi | ||
687 | ]) | ||
688 | |||
689 | AC_DEFUN([BASH_FUNC_GETCWD], | ||
690 | [AC_MSG_CHECKING([if getcwd() calls popen()]) | ||
691 | AC_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 | |||
704 | int popen_called; | ||
705 | |||
706 | FILE * | ||
707 | popen(command, type) | ||
708 | const char *command; | ||
709 | const char *type; | ||
710 | { | ||
711 | popen_called = 1; | ||
712 | return (FILE *)NULL; | ||
713 | } | ||
714 | |||
715 | FILE *_popen(command, type) | ||
716 | const char *command; | ||
717 | const char *type; | ||
718 | { | ||
719 | return (popen (command, type)); | ||
720 | } | ||
721 | |||
722 | int | ||
723 | pclose(stream) | ||
724 | FILE *stream; | ||
725 | { | ||
726 | return 0; | ||
727 | } | ||
728 | |||
729 | int | ||
730 | _pclose(stream) | ||
731 | FILE *stream; | ||
732 | { | ||
733 | return 0; | ||
734 | } | ||
735 | |||
736 | main() | ||
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 | )]) | ||
747 | AC_MSG_RESULT($bash_cv_getcwd_calls_popen) | ||
748 | if test $bash_cv_getcwd_calls_popen = yes; then | ||
749 | AC_DEFINE(GETCWD_BROKEN) | ||
750 | AC_LIBOBJ(getcwd) | ||
751 | fi | ||
752 | ]) | ||
753 | |||
754 | dnl | ||
755 | dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every | ||
756 | dnl system, we can't use AC_PREREQ | ||
757 | dnl | ||
758 | AC_DEFUN([BASH_FUNC_GETHOSTBYNAME], | ||
759 | [if test "X$bash_cv_have_gethostbyname" = "X"; then | ||
760 | _bash_needmsg=yes | ||
761 | else | ||
762 | AC_MSG_CHECKING(for gethostbyname in socket library) | ||
763 | _bash_needmsg= | ||
764 | fi | ||
765 | AC_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 | ) | ||
771 | if test "X$_bash_needmsg" = Xyes; then | ||
772 | AC_MSG_CHECKING(for gethostbyname in socket library) | ||
773 | fi | ||
774 | AC_MSG_RESULT($bash_cv_have_gethostbyname) | ||
775 | if test "$bash_cv_have_gethostbyname" = yes; then | ||
776 | AC_DEFINE(HAVE_GETHOSTBYNAME) | ||
777 | fi | ||
778 | ]) | ||
779 | |||
780 | AC_DEFUN([BASH_FUNC_FNMATCH_EXTMATCH], | ||
781 | [AC_MSG_CHECKING(if fnmatch does extended pattern matching with FNM_EXTMATCH) | ||
782 | AC_CACHE_VAL(bash_cv_fnm_extmatch, | ||
783 | [AC_TRY_RUN([ | ||
784 | #include <fnmatch.h> | ||
785 | |||
786 | main() | ||
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 | ]) | ||
798 | AC_MSG_RESULT($bash_cv_fnm_extmatch) | ||
799 | if test $bash_cv_fnm_extmatch = yes; then | ||
800 | AC_DEFINE(HAVE_LIBC_FNM_EXTMATCH) | ||
801 | fi | ||
802 | ]) | ||
803 | |||
804 | AH_TEMPLATE([HAVE_POSIX_SIGSETJMP], [Define if we POSIX-style sigsetjmp/siglongjmp are available]) | ||
805 | AC_DEFUN([BASH_FUNC_POSIX_SETJMP], | ||
806 | [AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE]) | ||
807 | AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp) | ||
808 | AC_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 | |||
817 | main() | ||
818 | { | ||
819 | #if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS) | ||
820 | exit (1); | ||
821 | #else | ||
822 | |||
823 | int code; | ||
824 | sigset_t set, oset; | ||
825 | sigjmp_buf xx; | ||
826 | |||
827 | /* get the mask */ | ||
828 | sigemptyset(&set); | ||
829 | sigemptyset(&oset); | ||
830 | sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set); | ||
831 | sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset); | ||
832 | |||
833 | /* save it */ | ||
834 | code = sigsetjmp(xx, 1); | ||
835 | if (code) | ||
836 | exit(0); /* could get sigmask and compare to oset here. */ | ||
837 | |||
838 | /* change it */ | ||
839 | sigaddset(&set, SIGINT); | ||
840 | sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL); | ||
841 | |||
842 | /* and siglongjmp */ | ||
843 | siglongjmp(xx, 10); | ||
844 | exit(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 | )]) | ||
850 | AC_MSG_RESULT($bash_cv_func_sigsetjmp) | ||
851 | if test $bash_cv_func_sigsetjmp = present; then | ||
852 | AC_DEFINE(HAVE_POSIX_SIGSETJMP) | ||
853 | fi | ||
854 | ]) | ||
855 | |||
856 | AH_TEMPLATE([STRCOLL_BROKEN], [Define if strcoll is broken with respect to strcmp in the default locale.]) | ||
857 | AC_DEFUN([BASH_FUNC_STRCOLL], | ||
858 | [ | ||
859 | AC_MSG_CHECKING(whether or not strcoll and strcmp differ) | ||
860 | AC_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 | |||
867 | main(c, v) | ||
868 | int c; | ||
869 | char *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 | )]) | ||
900 | AC_MSG_RESULT($bash_cv_func_strcoll_broken) | ||
901 | if test $bash_cv_func_strcoll_broken = yes; then | ||
902 | AC_DEFINE(STRCOLL_BROKEN) | ||
903 | fi | ||
904 | ]) | ||
905 | |||
906 | AC_DEFUN([BASH_FUNC_PRINTF_A_FORMAT], | ||
907 | [AC_MSG_CHECKING([for printf floating point output in hex notation]) | ||
908 | AC_CACHE_VAL(bash_cv_printf_a_format, | ||
909 | [AC_TRY_RUN([ | ||
910 | #include <stdio.h> | ||
911 | #include <string.h> | ||
912 | |||
913 | int | ||
914 | main() | ||
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 | )]) | ||
926 | AC_MSG_RESULT($bash_cv_printf_a_format) | ||
927 | if test $bash_cv_printf_a_format = yes; then | ||
928 | AC_DEFINE(HAVE_PRINTF_A_FORMAT) | ||
929 | fi | ||
930 | ]) | ||
931 | |||
932 | AC_DEFUN([BASH_STRUCT_TERMIOS_LDISC], | ||
933 | [ | ||
934 | AC_CHECK_MEMBER(struct termios.c_line, AC_DEFINE(TERMIOS_LDISC), ,[ | ||
935 | #include <sys/types.h> | ||
936 | #include <termios.h> | ||
937 | ]) | ||
938 | ]) | ||
939 | |||
940 | AC_DEFUN([BASH_STRUCT_TERMIO_LDISC], | ||
941 | [ | ||
942 | AC_CHECK_MEMBER(struct termio.c_line, AC_DEFINE(TERMIO_LDISC), ,[ | ||
943 | #include <sys/types.h> | ||
944 | #include <termio.h> | ||
945 | ]) | ||
946 | ]) | ||
947 | |||
948 | dnl | ||
949 | dnl Like AC_STRUCT_ST_BLOCKS, but doesn't muck with LIBOBJS | ||
950 | dnl | ||
951 | dnl sets bash_cv_struct_stat_st_blocks | ||
952 | dnl | ||
953 | dnl unused for now; we'll see how AC_CHECK_MEMBERS works | ||
954 | dnl | ||
955 | AC_DEFUN([BASH_STRUCT_ST_BLOCKS], | ||
956 | [ | ||
957 | AC_MSG_CHECKING([for struct stat.st_blocks]) | ||
958 | AC_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 | [ | ||
965 | main() | ||
966 | { | ||
967 | static struct stat a; | ||
968 | if (a.st_blocks) return 0; | ||
969 | return 0; | ||
970 | } | ||
971 | ], bash_cv_struct_stat_st_blocks=yes, bash_cv_struct_stat_st_blocks=no) | ||
972 | ]) | ||
973 | AC_MSG_RESULT($bash_cv_struct_stat_st_blocks) | ||
974 | if test "$bash_cv_struct_stat_st_blocks" = "yes"; then | ||
975 | AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS) | ||
976 | fi | ||
977 | ]) | ||
978 | |||
979 | AC_DEFUN([BASH_CHECK_LIB_TERMCAP], | ||
980 | [ | ||
981 | if test "X$bash_cv_termcap_lib" = "X"; then | ||
982 | _bash_needmsg=yes | ||
983 | else | ||
984 | AC_MSG_CHECKING(which library has the termcap functions) | ||
985 | _bash_needmsg= | ||
986 | fi | ||
987 | AC_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)])])])]) | ||
993 | if test "X$_bash_needmsg" = "Xyes"; then | ||
994 | AC_MSG_CHECKING(which library has the termcap functions) | ||
995 | fi | ||
996 | AC_MSG_RESULT(using $bash_cv_termcap_lib) | ||
997 | if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then | ||
998 | LDFLAGS="$LDFLAGS -L./lib/termcap" | ||
999 | TERMCAP_LIB="./lib/termcap/libtermcap.a" | ||
1000 | TERMCAP_DEP="./lib/termcap/libtermcap.a" | ||
1001 | elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then | ||
1002 | TERMCAP_LIB=-ltermcap | ||
1003 | TERMCAP_DEP= | ||
1004 | elif test $bash_cv_termcap_lib = libtinfo; then | ||
1005 | TERMCAP_LIB=-ltinfo | ||
1006 | TERMCAP_DEP= | ||
1007 | elif test $bash_cv_termcap_lib = libncurses; then | ||
1008 | TERMCAP_LIB=-lncurses | ||
1009 | TERMCAP_DEP= | ||
1010 | else | ||
1011 | TERMCAP_LIB=-lcurses | ||
1012 | TERMCAP_DEP= | ||
1013 | fi | ||
1014 | ]) | ||
1015 | |||
1016 | dnl | ||
1017 | dnl Check for the presence of getpeername in libsocket. | ||
1018 | dnl If libsocket is present, check for libnsl and add it to LIBS if | ||
1019 | dnl it's there, since most systems with libsocket require linking | ||
1020 | dnl with libnsl as well. This should only be called if getpeername | ||
1021 | dnl was not found in libc. | ||
1022 | dnl | ||
1023 | dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT | ||
1024 | dnl AS WELL | ||
1025 | dnl | ||
1026 | AC_DEFUN([BASH_CHECK_LIB_SOCKET], | ||
1027 | [ | ||
1028 | if test "X$bash_cv_have_socklib" = "X"; then | ||
1029 | _bash_needmsg= | ||
1030 | else | ||
1031 | AC_MSG_CHECKING(for socket library) | ||
1032 | _bash_needmsg=yes | ||
1033 | fi | ||
1034 | AC_CACHE_VAL(bash_cv_have_socklib, | ||
1035 | [AC_CHECK_LIB(socket, getpeername, | ||
1036 | bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)]) | ||
1037 | if test "X$_bash_needmsg" = Xyes; then | ||
1038 | AC_MSG_RESULT($bash_cv_have_socklib) | ||
1039 | _bash_needmsg= | ||
1040 | fi | ||
1041 | if 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) | ||
1063 | fi | ||
1064 | ]) | ||
1065 | |||
1066 | AH_TEMPLATE([STRUCT_DIRENT_HAS_D_INO], [Define if struct dirent has a d_ino member]) | ||
1067 | AC_DEFUN([BASH_STRUCT_DIRENT_D_INO], | ||
1068 | [AC_REQUIRE([AC_HEADER_DIRENT]) | ||
1069 | AC_MSG_CHECKING(if struct dirent has a d_ino member) | ||
1070 | AC_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 | ],[ | ||
1092 | struct dirent d; int z; z = d.d_ino; | ||
1093 | ], bash_cv_dirent_has_dino=yes, bash_cv_dirent_has_dino=no)]) | ||
1094 | AC_MSG_RESULT($bash_cv_dirent_has_dino) | ||
1095 | if test $bash_cv_dirent_has_dino = yes; then | ||
1096 | AC_DEFINE(STRUCT_DIRENT_HAS_D_INO) | ||
1097 | fi | ||
1098 | ]) | ||
1099 | |||
1100 | AH_TEMPLATE([STRUCT_DIRENT_HAS_D_FILENO], [Define if struct dirent has a d_fileno member]) | ||
1101 | AC_DEFUN([BASH_STRUCT_DIRENT_D_FILENO], | ||
1102 | [AC_REQUIRE([AC_HEADER_DIRENT]) | ||
1103 | AC_MSG_CHECKING(if struct dirent has a d_fileno member) | ||
1104 | AC_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 | ],[ | ||
1126 | struct dirent d; int z; z = d.d_fileno; | ||
1127 | ], bash_cv_dirent_has_d_fileno=yes, bash_cv_dirent_has_d_fileno=no)]) | ||
1128 | AC_MSG_RESULT($bash_cv_dirent_has_d_fileno) | ||
1129 | if test $bash_cv_dirent_has_d_fileno = yes; then | ||
1130 | AC_DEFINE(STRUCT_DIRENT_HAS_D_FILENO) | ||
1131 | fi | ||
1132 | ]) | ||
1133 | |||
1134 | AC_DEFUN([BASH_STRUCT_TIMEVAL], | ||
1135 | [AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h) | ||
1136 | AC_CACHE_VAL(bash_cv_struct_timeval, | ||
1137 | [ | ||
1138 | AC_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 | ]) | ||
1144 | AC_MSG_RESULT($bash_cv_struct_timeval) | ||
1145 | if test $bash_cv_struct_timeval = yes; then | ||
1146 | AC_DEFINE(HAVE_TIMEVAL) | ||
1147 | fi | ||
1148 | ]) | ||
1149 | |||
1150 | AH_TEMPLATE([STRUCT_WINSIZE_IN_SYS_IOCTL], [Define if struct winsize is in sys/ioctl.h]) | ||
1151 | AH_TEMPLATE([STRUCT_WINSIZE_IN_TERMIOS], [Define if struct winsize is in termios.h]) | ||
1152 | AC_DEFUN([BASH_STRUCT_WINSIZE], | ||
1153 | [AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h) | ||
1154 | AC_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 | ])]) | ||
1162 | if test $bash_cv_struct_winsize_header = ioctl_h; then | ||
1163 | AC_MSG_RESULT(sys/ioctl.h) | ||
1164 | AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL) | ||
1165 | elif test $bash_cv_struct_winsize_header = termios_h; then | ||
1166 | AC_MSG_RESULT(termios.h) | ||
1167 | AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS) | ||
1168 | else | ||
1169 | AC_MSG_RESULT(not found) | ||
1170 | fi | ||
1171 | ]) | ||
1172 | |||
1173 | dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) | ||
1174 | AH_TEMPLATE([HAVE_POSIX_SIGNALS], [Define if we have the POSIX signal routines]) | ||
1175 | AH_TEMPLATE([HAVE_BSD_SIGNALS], [Define if we have the BSD signal routines]) | ||
1176 | AH_TEMPLATE([HAVE_USG_SIGHOLD], [Define if we have the USG signal routines]) | ||
1177 | AC_DEFUN([BASH_SYS_SIGNAL_VINTAGE], | ||
1178 | [AC_REQUIRE([AC_TYPE_SIGNAL]) | ||
1179 | AC_MSG_CHECKING(for type of signal functions) | ||
1180 | AC_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 | ]) | ||
1209 | AC_MSG_RESULT($bash_cv_signal_vintage) | ||
1210 | if test "$bash_cv_signal_vintage" = "posix"; then | ||
1211 | AC_DEFINE(HAVE_POSIX_SIGNALS) | ||
1212 | elif test "$bash_cv_signal_vintage" = "4.2bsd"; then | ||
1213 | AC_DEFINE(HAVE_BSD_SIGNALS) | ||
1214 | elif test "$bash_cv_signal_vintage" = "svr3"; then | ||
1215 | AC_DEFINE(HAVE_USG_SIGHOLD) | ||
1216 | fi | ||
1217 | ]) | ||
1218 | |||
1219 | dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process. | ||
1220 | AC_DEFUN([BASH_SYS_PGRP_SYNC], | ||
1221 | [AC_REQUIRE([AC_FUNC_GETPGRP]) | ||
1222 | AC_MSG_CHECKING(whether pgrps need synchronization) | ||
1223 | AC_CACHE_VAL(bash_cv_pgrp_pipe, | ||
1224 | [AC_TRY_RUN([ | ||
1225 | #ifdef HAVE_UNISTD_H | ||
1226 | # include <unistd.h> | ||
1227 | #endif | ||
1228 | main() | ||
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 | ]) | ||
1276 | AC_MSG_RESULT($bash_cv_pgrp_pipe) | ||
1277 | if test $bash_cv_pgrp_pipe = yes; then | ||
1278 | AC_DEFINE(PGRP_PIPE) | ||
1279 | fi | ||
1280 | ]) | ||
1281 | |||
1282 | AH_TEMPLATE([MUST_REINSTALL_SIGHANDLERS], [Define if signal handlers must be reinstalled when invoked.]) | ||
1283 | AC_DEFUN([BASH_SYS_REINSTALL_SIGHANDLERS], | ||
1284 | [AC_REQUIRE([AC_TYPE_SIGNAL]) | ||
1285 | AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE]) | ||
1286 | AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked]) | ||
1287 | AC_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 | |||
1294 | typedef RETSIGTYPE sigfunc(); | ||
1295 | |||
1296 | int nsigint; | ||
1297 | |||
1298 | #ifdef HAVE_POSIX_SIGNALS | ||
1299 | sigfunc * | ||
1300 | set_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 | |||
1316 | RETSIGTYPE | ||
1317 | sigint(s) | ||
1318 | int s; | ||
1319 | { | ||
1320 | nsigint++; | ||
1321 | } | ||
1322 | |||
1323 | main() | ||
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 | )]) | ||
1335 | AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers) | ||
1336 | if test $bash_cv_must_reinstall_sighandlers = yes; then | ||
1337 | AC_DEFINE(MUST_REINSTALL_SIGHANDLERS) | ||
1338 | fi | ||
1339 | ]) | ||
1340 | |||
1341 | dnl check that some necessary job control definitions are present | ||
1342 | AC_DEFUN([BASH_SYS_JOB_CONTROL_MISSING], | ||
1343 | [AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE]) | ||
1344 | AC_MSG_CHECKING(for presence of necessary job control definitions) | ||
1345 | AC_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. */ | ||
1357 | main() | ||
1358 | { | ||
1359 | /* signal type */ | ||
1360 | #if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS) | ||
1361 | exit(1); | ||
1362 | #endif | ||
1363 | |||
1364 | /* signals and tty control. */ | ||
1365 | #if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT) | ||
1366 | exit (1); | ||
1367 | #endif | ||
1368 | |||
1369 | /* process control */ | ||
1370 | #if !defined (WNOHANG) || !defined (WUNTRACED) | ||
1371 | exit(1); | ||
1372 | #endif | ||
1373 | |||
1374 | /* Posix systems have tcgetpgrp and waitpid. */ | ||
1375 | #if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP) | ||
1376 | exit(1); | ||
1377 | #endif | ||
1378 | |||
1379 | #if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID) | ||
1380 | exit(1); | ||
1381 | #endif | ||
1382 | |||
1383 | /* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */ | ||
1384 | #if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3) | ||
1385 | exit(1); | ||
1386 | #endif | ||
1387 | |||
1388 | exit(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 | )]) | ||
1393 | AC_MSG_RESULT($bash_cv_job_control_missing) | ||
1394 | if test $bash_cv_job_control_missing = missing; then | ||
1395 | AC_DEFINE(JOB_CONTROL_MISSING) | ||
1396 | fi | ||
1397 | ]) | ||
1398 | |||
1399 | dnl check whether named pipes are present | ||
1400 | dnl this requires a previous check for mkfifo, but that is awkward to specify | ||
1401 | AC_DEFUN([BASH_SYS_NAMED_PIPES], | ||
1402 | [AC_MSG_CHECKING(for presence of named pipes) | ||
1403 | AC_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. */ | ||
1412 | main() | ||
1413 | { | ||
1414 | int fd, err; | ||
1415 | |||
1416 | #if defined (HAVE_MKFIFO) | ||
1417 | exit (0); | ||
1418 | #endif | ||
1419 | |||
1420 | #if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO)) | ||
1421 | exit (1); | ||
1422 | #endif | ||
1423 | |||
1424 | #if defined (NeXT) | ||
1425 | exit (1); | ||
1426 | #endif | ||
1427 | err = mkdir("/tmp/bash-aclocal", 0700); | ||
1428 | if (err < 0) { | ||
1429 | perror ("mkdir"); | ||
1430 | exit(1); | ||
1431 | } | ||
1432 | fd = mknod ("/tmp/bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0); | ||
1433 | if (fd == -1) { | ||
1434 | rmdir ("/tmp/bash-aclocal"); | ||
1435 | exit (1); | ||
1436 | } | ||
1437 | close(fd); | ||
1438 | unlink ("/tmp/bash-aclocal/sh-np-autoconf"); | ||
1439 | rmdir ("/tmp/bash-aclocal"); | ||
1440 | exit(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 | )]) | ||
1445 | AC_MSG_RESULT($bash_cv_sys_named_pipes) | ||
1446 | if test $bash_cv_sys_named_pipes = missing; then | ||
1447 | AC_DEFINE(NAMED_PIPES_MISSING) | ||
1448 | fi | ||
1449 | ]) | ||
1450 | |||
1451 | AC_DEFUN([BASH_SYS_DEFAULT_MAIL_DIR], | ||
1452 | [AC_MSG_CHECKING(for default mail directory) | ||
1453 | AC_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 | ]) | ||
1466 | AC_MSG_RESULT($bash_cv_mail_dir) | ||
1467 | AC_DEFINE_UNQUOTED(DEFAULT_MAIL_DIRECTORY, "$bash_cv_mail_dir") | ||
1468 | ]) | ||
1469 | |||
1470 | AC_DEFUN([BASH_HAVE_TIOCGWINSZ], | ||
1471 | [AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h) | ||
1472 | AC_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)]) | ||
1476 | AC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl) | ||
1477 | if test $bash_cv_tiocgwinsz_in_ioctl = yes; then | ||
1478 | AC_DEFINE(GWINSZ_IN_SYS_IOCTL) | ||
1479 | fi | ||
1480 | ]) | ||
1481 | |||
1482 | AH_TEMPLATE([TIOCSTAT_IN_SYS_IOCTL], [Define if TIOCSTAT is in sys/ioctl.h]) | ||
1483 | AC_DEFUN([BASH_HAVE_TIOCSTAT], | ||
1484 | [AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h) | ||
1485 | AC_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)]) | ||
1489 | AC_MSG_RESULT($bash_cv_tiocstat_in_ioctl) | ||
1490 | if test $bash_cv_tiocstat_in_ioctl = yes; then | ||
1491 | AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL) | ||
1492 | fi | ||
1493 | ]) | ||
1494 | |||
1495 | AH_TEMPLATE([FIONREAD_IN_SYS_IOCTL], [Define if FIONREAD is in sys/ioctl.h]) | ||
1496 | AC_DEFUN([BASH_HAVE_FIONREAD], | ||
1497 | [AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h) | ||
1498 | AC_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)]) | ||
1502 | AC_MSG_RESULT($bash_cv_fionread_in_ioctl) | ||
1503 | if test $bash_cv_fionread_in_ioctl = yes; then | ||
1504 | AC_DEFINE(FIONREAD_IN_SYS_IOCTL) | ||
1505 | fi | ||
1506 | ]) | ||
1507 | |||
1508 | dnl | ||
1509 | dnl See if speed_t is declared in <sys/types.h>. Some versions of linux | ||
1510 | dnl require a definition of speed_t each time <termcap.h> is included, | ||
1511 | dnl but you can only get speed_t if you include <termios.h> (on some | ||
1512 | dnl versions) or <sys/types.h> (on others). | ||
1513 | dnl | ||
1514 | AH_TEMPLATE([SPEED_T_IN_SYS_TYPES], [Define if speed_t is in sys/types.h]) | ||
1515 | AC_DEFUN([BASH_CHECK_SPEED_T], | ||
1516 | [AC_MSG_CHECKING(for speed_t in sys/types.h) | ||
1517 | AC_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)]) | ||
1520 | AC_MSG_RESULT($bash_cv_speed_t_in_sys_types) | ||
1521 | if test $bash_cv_speed_t_in_sys_types = yes; then | ||
1522 | AC_DEFINE(SPEED_T_IN_SYS_TYPES) | ||
1523 | fi | ||
1524 | ]) | ||
1525 | |||
1526 | AH_TEMPLATE([HAVE_GETPW_DECLS], [Define if getpw functions are declared in pwd.h]) | ||
1527 | AC_DEFUN([BASH_CHECK_GETPW_FUNCS], | ||
1528 | [AC_MSG_CHECKING(whether getpw functions are declared in pwd.h) | ||
1529 | AC_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 | ], | ||
1538 | bash_cv_getpw_declared=yes,bash_cv_getpw_declared=no)]) | ||
1539 | AC_MSG_RESULT($bash_cv_getpw_declared) | ||
1540 | if test $bash_cv_getpw_declared = yes; then | ||
1541 | AC_DEFINE(HAVE_GETPW_DECLS) | ||
1542 | fi | ||
1543 | ]) | ||
1544 | |||
1545 | AC_DEFUN([BASH_CHECK_DEV_FD], | ||
1546 | [AC_MSG_CHECKING(whether /dev/fd is available) | ||
1547 | AC_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 | ]) | ||
1556 | AC_MSG_RESULT($bash_cv_dev_fd) | ||
1557 | if test $bash_cv_dev_fd = "standard"; then | ||
1558 | AC_DEFINE(HAVE_DEV_FD) | ||
1559 | AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/") | ||
1560 | elif test $bash_cv_dev_fd = "whacky"; then | ||
1561 | AC_DEFINE(HAVE_DEV_FD) | ||
1562 | AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/") | ||
1563 | fi | ||
1564 | ]) | ||
1565 | |||
1566 | AC_DEFUN([BASH_CHECK_DEV_STDIN], | ||
1567 | [AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available) | ||
1568 | AC_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 | ]) | ||
1577 | AC_MSG_RESULT($bash_cv_dev_stdin) | ||
1578 | if test $bash_cv_dev_stdin = "present"; then | ||
1579 | AC_DEFINE(HAVE_DEV_STDIN) | ||
1580 | fi | ||
1581 | ]) | ||
1582 | |||
1583 | dnl | ||
1584 | dnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions | ||
1585 | dnl | ||
1586 | AC_DEFUN([BASH_CHECK_KERNEL_RLIMIT], | ||
1587 | [AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines]) | ||
1588 | AC_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 | )]) | ||
1608 | AC_MSG_RESULT($bash_cv_kernel_rlimit) | ||
1609 | if test $bash_cv_kernel_rlimit = yes; then | ||
1610 | AC_DEFINE(RLIMIT_NEEDS_KERNEL) | ||
1611 | fi | ||
1612 | ]) | ||
1613 | |||
1614 | dnl | ||
1615 | dnl Check for 64-bit off_t -- used for malloc alignment | ||
1616 | dnl | ||
1617 | dnl C does not allow duplicate case labels, so the compile will fail if | ||
1618 | dnl sizeof(off_t) is > 4. | ||
1619 | dnl | ||
1620 | AC_DEFUN([BASH_CHECK_OFF_T_64], | ||
1621 | [AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64, | ||
1622 | AC_TRY_COMPILE([ | ||
1623 | #ifdef HAVE_UNISTD_H | ||
1624 | #include <unistd.h> | ||
1625 | #endif | ||
1626 | #include <sys/types.h> | ||
1627 | ],[ | ||
1628 | switch (0) case 0: case (sizeof (off_t) <= 4):; | ||
1629 | ], bash_cv_off_t_64=no, bash_cv_off_t_64=yes)) | ||
1630 | if test $bash_cv_off_t_64 = yes; then | ||
1631 | AC_DEFINE(HAVE_OFF_T_64) | ||
1632 | fi]) | ||
1633 | |||
1634 | AC_DEFUN([BASH_CHECK_RTSIGS], | ||
1635 | [AC_MSG_CHECKING(for unusable real-time signals due to large values) | ||
1636 | AC_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 | |||
1645 | main () | ||
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 | )]) | ||
1659 | AC_MSG_RESULT($bash_cv_unusable_rtsigs) | ||
1660 | if test $bash_cv_unusable_rtsigs = yes; then | ||
1661 | AC_DEFINE(UNUSABLE_RT_SIGNALS) | ||
1662 | fi | ||
1663 | ]) | ||
1664 | |||
1665 | dnl | ||
1666 | dnl check for availability of multibyte characters and functions | ||
1667 | dnl | ||
1668 | AH_TEMPLATE([HAVE_MBSRTOWCS], [Define if we have the mbsrtowcs function]) | ||
1669 | AH_TEMPLATE([HAVE_WCWIDTH], [Define if we have the wcwidth function]) | ||
1670 | AH_TEMPLATE([HAVE_MBSTATE_T], [Define if we have mbstate_t]) | ||
1671 | AH_TEMPLATE([HAVE_LANGINFO_CODESET], [Define if we have nl_langinfo and CODESET]) | ||
1672 | AC_DEFUN([BASH_CHECK_MULTIBYTE], | ||
1673 | [ | ||
1674 | AC_CHECK_HEADERS(wctype.h) | ||
1675 | AC_CHECK_HEADERS(wchar.h) | ||
1676 | AC_CHECK_HEADERS(langinfo.h) | ||
1677 | |||
1678 | AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS)) | ||
1679 | AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH)) | ||
1680 | |||
1681 | AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t, | ||
1682 | [AC_TRY_RUN([ | ||
1683 | #include <wchar.h> | ||
1684 | int | ||
1685 | main () | ||
1686 | { | ||
1687 | mbstate_t ps; | ||
1688 | return 0; | ||
1689 | }], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)]) | ||
1690 | if test $bash_cv_have_mbstate_t = yes; then | ||
1691 | AC_DEFINE(HAVE_MBSTATE_T) | ||
1692 | fi | ||
1693 | |||
1694 | AC_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);], | ||
1698 | bash_cv_langinfo_codeset=yes, bash_cv_langinfo_codeset=no)]) | ||
1699 | if test $bash_cv_langinfo_codeset = yes; then | ||
1700 | AC_DEFINE(HAVE_LANGINFO_CODESET) | ||
1701 | fi | ||
1702 | |||
1703 | ]) | ||
1704 | |||
1705 | dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB | ||
1706 | dnl require: | ||
1707 | dnl AC_PROG_CC | ||
1708 | dnl BASH_CHECK_LIB_TERMCAP | ||
1709 | |||
1710 | AC_DEFUN([RL_LIB_READLINE_VERSION], | ||
1711 | [ | ||
1712 | AC_REQUIRE([BASH_CHECK_LIB_TERMCAP]) | ||
1713 | |||
1714 | AC_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 | |||
1727 | if test -z "$ac_cv_rl_prefix"; then | ||
1728 | test "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix} | ||
1729 | fi | ||
1730 | |||
1731 | eval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include | ||
1732 | eval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib | ||
1733 | |||
1734 | LIBS="$LIBS -lreadline ${TERMCAP_LIB}" | ||
1735 | CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}" | ||
1736 | LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}" | ||
1737 | |||
1738 | AC_TRY_RUN([ | ||
1739 | #include <stdio.h> | ||
1740 | #include <readline/readline.h> | ||
1741 | |||
1742 | main() | ||
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 | ], | ||
1752 | ac_cv_rl_version=`cat conftest.rlv`, | ||
1753 | ac_cv_rl_version='0.0', | ||
1754 | ac_cv_rl_version='4.2') | ||
1755 | |||
1756 | CFLAGS="$_save_CFLAGS" | ||
1757 | LDFLAGS="$_save_LDFLAGS" | ||
1758 | LIBS="$_save_LIBS" | ||
1759 | |||
1760 | RL_MAJOR=0 | ||
1761 | RL_MINOR=0 | ||
1762 | |||
1763 | # ( | ||
1764 | case "$ac_cv_rl_version" in | ||
1765 | 2*|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 | ;; | ||
1769 | esac | ||
1770 | |||
1771 | # ((( | ||
1772 | case $RL_MAJOR in | ||
1773 | [[0-9][0-9]]) _RL_MAJOR=$RL_MAJOR ;; | ||
1774 | [[0-9]]) _RL_MAJOR=0$RL_MAJOR ;; | ||
1775 | *) _RL_MAJOR=00 ;; | ||
1776 | esac | ||
1777 | |||
1778 | # ((( | ||
1779 | case $RL_MINOR in | ||
1780 | [[0-9][0-9]]) _RL_MINOR=$RL_MINOR ;; | ||
1781 | [[0-9]]) _RL_MINOR=0$RL_MINOR ;; | ||
1782 | *) _RL_MINOR=00 ;; | ||
1783 | esac | ||
1784 | |||
1785 | RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}" | ||
1786 | |||
1787 | # Readline versions greater than 4.2 have these defines in readline.h | ||
1788 | |||
1789 | if test $ac_cv_rl_version = '0.0' ; then | ||
1790 | AC_MSG_WARN([Could not test version of installed readline library.]) | ||
1791 | elif 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) | ||
1797 | else | ||
1798 | |||
1799 | AC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library]) | ||
1800 | AC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library]) | ||
1801 | AC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library]) | ||
1802 | |||
1803 | AC_SUBST(RL_VERSION) | ||
1804 | AC_SUBST(RL_MAJOR) | ||
1805 | AC_SUBST(RL_MINOR) | ||
1806 | |||
1807 | # set these for use by the caller | ||
1808 | RL_PREFIX=$ac_cv_rl_prefix | ||
1809 | RL_LIBDIR=$ac_cv_rl_libdir | ||
1810 | RL_INCLUDEDIR=$ac_cv_rl_includedir | ||
1811 | |||
1812 | AC_MSG_RESULT($ac_cv_rl_version) | ||
1813 | |||
1814 | fi | ||
1815 | ]) | ||