OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [oc/] [gdb-5.0/] [readline/] [aclocal.m4] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
dnl
2
dnl Bash specific tests
3
dnl
4
dnl Some derived from PDKSH 5.1.3 autoconf tests
5
dnl
6
dnl
7
dnl Check if dup2() does not clear the close on exec flag
8
dnl
9
AC_DEFUN(BASH_DUP2_CLOEXEC_CHECK,
10
[AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag)
11
AC_CACHE_VAL(bash_cv_dup2_broken,
12
[AC_TRY_RUN([
13
#include <sys/types.h>
14
#include <fcntl.h>
15
main()
16
{
17
  int fd1, fd2, fl;
18
  fd1 = open("/dev/null", 2);
19
  if (fcntl(fd1, 2, 1) < 0)
20
    exit(1);
21
  fd2 = dup2(fd1, 1);
22
  if (fd2 < 0)
23
    exit(2);
24
  fl = fcntl(fd2, 1, 0);
25
  /* fl will be 1 if dup2 did not reset the close-on-exec flag. */
26
  exit(fl != 1);
27
}
28
], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no,
29
    [AC_MSG_WARN(cannot check dup2 if cross compiling -- defaulting to no)
30
     bash_cv_dup2_broken=no])
31
])
32
AC_MSG_RESULT($bash_cv_dup2_broken)
33
if test $bash_cv_dup2_broken = yes; then
34
AC_DEFINE(DUP2_BROKEN)
35
fi
36
])
37
 
38
dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
39
AC_DEFUN(BASH_SIGNAL_CHECK,
40
[AC_REQUIRE([AC_TYPE_SIGNAL])
41
AC_MSG_CHECKING(for type of signal functions)
42
AC_CACHE_VAL(bash_cv_signal_vintage,
43
[
44
  AC_TRY_LINK([#include <signal.h>],[
45
    sigset_t ss;
46
    struct sigaction sa;
47
    sigemptyset(&ss); sigsuspend(&ss);
48
    sigaction(SIGINT, &sa, (struct sigaction *) 0);
49
    sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
50
  ], bash_cv_signal_vintage=posix,
51
  [
52
    AC_TRY_LINK([#include <signal.h>], [
53
        int mask = sigmask(SIGINT);
54
        sigsetmask(mask); sigblock(mask); sigpause(mask);
55
    ], bash_cv_signal_vintage=4.2bsd,
56
    [
57
      AC_TRY_LINK([
58
        #include <signal.h>
59
        RETSIGTYPE foo() { }], [
60
                int mask = sigmask(SIGINT);
61
                sigset(SIGINT, foo); sigrelse(SIGINT);
62
                sighold(SIGINT); sigpause(SIGINT);
63
        ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7
64
    )]
65
  )]
66
)
67
])
68
AC_MSG_RESULT($bash_cv_signal_vintage)
69
if test "$bash_cv_signal_vintage" = posix; then
70
AC_DEFINE(HAVE_POSIX_SIGNALS)
71
elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
72
AC_DEFINE(HAVE_BSD_SIGNALS)
73
elif test "$bash_cv_signal_vintage" = svr3; then
74
AC_DEFINE(HAVE_USG_SIGHOLD)
75
fi
76
])
77
 
78
dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process.
79
AC_DEFUN(BASH_PGRP_SYNC,
80
[AC_REQUIRE([AC_FUNC_GETPGRP])
81
AC_MSG_CHECKING(whether pgrps need synchronization)
82
AC_CACHE_VAL(bash_cv_pgrp_pipe,
83
[AC_TRY_RUN([
84
#ifdef HAVE_UNISTD_H
85
#  include <unistd.h>
86
#endif
87
main()
88
{
89
# ifdef GETPGRP_VOID
90
#  define getpgID()     getpgrp()
91
# else
92
#  define getpgID()     getpgrp(0)
93
#  define setpgid(x,y)  setpgrp(x,y)
94
# endif
95
        int pid1, pid2, fds[2];
96
        int status;
97
        char ok;
98
 
99
        switch (pid1 = fork()) {
100
          case -1:
101
            exit(1);
102
          case 0:
103
            setpgid(0, getpid());
104
            exit(0);
105
        }
106
        setpgid(pid1, pid1);
107
 
108
        sleep(2);       /* let first child die */
109
 
110
        if (pipe(fds) < 0)
111
          exit(2);
112
 
113
        switch (pid2 = fork()) {
114
          case -1:
115
            exit(3);
116
          case 0:
117
            setpgid(0, pid1);
118
            ok = getpgID() == pid1;
119
            write(fds[1], &ok, 1);
120
            exit(0);
121
        }
122
        setpgid(pid2, pid1);
123
 
124
        close(fds[1]);
125
        if (read(fds[0], &ok, 1) != 1)
126
          exit(4);
127
        wait(&status);
128
        wait(&status);
129
        exit(ok ? 0 : 5);
130
}
131
], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
132
   [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
133
    bash_cv_pgrp_pipe=no])
134
])
135
AC_MSG_RESULT($bash_cv_pgrp_pipe)
136
if test $bash_cv_pgrp_pipe = yes; then
137
AC_DEFINE(PGRP_PIPE)
138
fi
139
])
140
 
141
dnl
142
dnl check for typedef'd symbols in header files, but allow the caller to
143
dnl specify the include files to be checked in addition to the default
144
dnl
145
dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND])
146
AC_DEFUN(BASH_CHECK_TYPE,
147
[AC_REQUIRE([AC_HEADER_STDC])dnl
148
AC_MSG_CHECKING(for $1)
149
AC_CACHE_VAL(bash_cv_type_$1,
150
[AC_EGREP_CPP($1, [#include <sys/types.h>
151
#if STDC_HEADERS
152
#include <stdlib.h>
153
#endif
154
$2
155
], bash_cv_type_$1=yes, bash_cv_type_$1=no)])
156
AC_MSG_RESULT($bash_cv_type_$1)
157
ifelse($#, 4, [if test $bash_cv_type_$1 = yes; then
158
        AC_DEFINE($4)
159
        fi])
160
if test $bash_cv_type_$1 = no; then
161
  AC_DEFINE($1, $3)
162
fi
163
])
164
 
165
dnl
166
dnl Type of struct rlimit fields: some systems (OSF/1, NetBSD, RISC/os 5.0)
167
dnl have a rlim_t, others (4.4BSD based systems) use quad_t, others use
168
dnl long and still others use int (HP-UX 9.01, SunOS 4.1.3).  To simplify
169
dnl matters, this just checks for rlim_t, quad_t, or long.
170
dnl
171
AC_DEFUN(BASH_RLIMIT_TYPE,
172
[AC_MSG_CHECKING(for size and type of struct rlimit fields)
173
AC_CACHE_VAL(bash_cv_type_rlimit,
174
[AC_TRY_COMPILE([#include <sys/types.h>
175
#include <sys/resource.h>],
176
[rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[
177
AC_TRY_RUN([
178
#include <sys/types.h>
179
#include <sys/time.h>
180
#include <sys/resource.h>
181
main()
182
{
183
#ifdef HAVE_QUAD_T
184
  struct rlimit rl;
185
  if (sizeof(rl.rlim_cur) == sizeof(quad_t))
186
    exit(0);
187
#endif
188
  exit(1);
189
}], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long,
190
        [AC_MSG_WARN(cannot check quad_t if cross compiling -- defaulting to long)
191
         bash_cv_type_rlimit=long])])
192
])
193
AC_MSG_RESULT($bash_cv_type_rlimit)
194
if test $bash_cv_type_rlimit = quad_t; then
195
AC_DEFINE(RLIMTYPE, quad_t)
196
elif test $bash_cv_type_rlimit = rlim_t; then
197
AC_DEFINE(RLIMTYPE, rlim_t)
198
fi
199
])
200
 
201
dnl
202
dnl Check for sys_siglist[] or _sys_siglist[]
203
dnl
204
AC_DEFUN(BASH_DECL_UNDER_SYS_SIGLIST,
205
[AC_MSG_CHECKING([for _sys_siglist in signal.h or unistd.h])
206
AC_CACHE_VAL(bash_cv_decl_under_sys_siglist,
207
[AC_TRY_COMPILE([
208
#include <sys/types.h>
209
#include <signal.h>
210
#ifdef HAVE_UNISTD_H
211
#include <unistd.h>
212
#endif], [ char *msg = _sys_siglist[2]; ],
213
  bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no,
214
  [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl
215
AC_MSG_RESULT($bash_cv_decl_under_sys_siglist)
216
if test $bash_cv_decl_under_sys_siglist = yes; then
217
AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED)
218
fi
219
])
220
 
221
AC_DEFUN(BASH_UNDER_SYS_SIGLIST,
222
[AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
223
AC_MSG_CHECKING([for _sys_siglist in system C library])
224
AC_CACHE_VAL(bash_cv_under_sys_siglist,
225
[AC_TRY_RUN([
226
#include <sys/types.h>
227
#include <signal.h>
228
#ifdef HAVE_UNISTD_H
229
#include <unistd.h>
230
#endif
231
#ifndef UNDER_SYS_SIGLIST_DECLARED
232
extern char *_sys_siglist[];
233
#endif
234
main()
235
{
236
char *msg = (char *)_sys_siglist[2];
237
exit(msg == 0);
238
}],
239
        bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
240
        [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)
241
         bash_cv_under_sys_siglist=no])])
242
AC_MSG_RESULT($bash_cv_under_sys_siglist)
243
if test $bash_cv_under_sys_siglist = yes; then
244
AC_DEFINE(HAVE_UNDER_SYS_SIGLIST)
245
fi
246
])
247
 
248
AC_DEFUN(BASH_SYS_SIGLIST,
249
[AC_REQUIRE([AC_DECL_SYS_SIGLIST])
250
AC_MSG_CHECKING([for sys_siglist in system C library])
251
AC_CACHE_VAL(bash_cv_sys_siglist,
252
[AC_TRY_RUN([
253
#include <sys/types.h>
254
#include <signal.h>
255
#ifdef HAVE_UNISTD_H
256
#include <unistd.h>
257
#endif
258
#ifndef SYS_SIGLIST_DECLARED
259
extern char *sys_siglist[];
260
#endif
261
main()
262
{
263
char *msg = sys_siglist[2];
264
exit(msg == 0);
265
}],
266
        bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no,
267
        [AC_MSG_WARN(cannot check for sys_siglist if cross compiling -- defaulting to no)
268
         bash_cv_sys_siglist=no])])
269
AC_MSG_RESULT($bash_cv_sys_siglist)
270
if test $bash_cv_sys_siglist = yes; then
271
AC_DEFINE(HAVE_SYS_SIGLIST)
272
fi
273
])
274
 
275
dnl Check for sys_errlist[] and sys_nerr, check for declaration
276
AC_DEFUN(BASH_SYS_ERRLIST,
277
[AC_MSG_CHECKING([for sys_errlist and sys_nerr])
278
AC_CACHE_VAL(bash_cv_sys_errlist,
279
[AC_TRY_LINK([#include <errno.h>],
280
[extern char *sys_errlist[];
281
 extern int sys_nerr;
282
 char *msg = sys_errlist[sys_nerr - 1];],
283
    bash_cv_sys_errlist=yes, bash_cv_sys_errlist=no)])dnl
284
AC_MSG_RESULT($bash_cv_sys_errlist)
285
if test $bash_cv_sys_errlist = yes; then
286
AC_DEFINE(HAVE_SYS_ERRLIST)
287
fi
288
])
289
 
290
dnl Check to see if opendir will open non-directories (not a nice thing)
291
AC_DEFUN(BASH_FUNC_OPENDIR_CHECK,
292
[AC_REQUIRE([AC_HEADER_DIRENT])dnl
293
AC_MSG_CHECKING(if opendir() opens non-directories)
294
AC_CACHE_VAL(bash_cv_opendir_not_robust,
295
[AC_TRY_RUN([
296
#include <stdio.h>
297
#include <sys/types.h>
298
#include <fcntl.h>
299
#ifdef HAVE_UNISTD_H
300
# include <unistd.h>
301
#endif /* HAVE_UNISTD_H */
302
#if defined(HAVE_DIRENT_H)
303
# include <dirent.h>
304
#else
305
# define dirent direct
306
# ifdef HAVE_SYS_NDIR_H
307
#  include <sys/ndir.h>
308
# endif /* SYSNDIR */
309
# ifdef HAVE_SYS_DIR_H
310
#  include <sys/dir.h>
311
# endif /* SYSDIR */
312
# ifdef HAVE_NDIR_H
313
#  include <ndir.h>
314
# endif
315
#endif /* HAVE_DIRENT_H */
316
main()
317
{
318
DIR *dir;
319
int fd;
320
unlink("/tmp/not_a_directory");
321
fd = open("/tmp/not_a_directory", O_WRONLY|O_CREAT, 0666);
322
write(fd, "\n", 1);
323
close(fd);
324
dir = opendir("/tmp/not_a_directory");
325
unlink("/tmp/not_a_directory");
326
exit (dir == 0);
327
}], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
328
    [AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
329
     bash_cv_opendir_not_robust=no]
330
)])
331
AC_MSG_RESULT($bash_cv_opendir_not_robust)
332
if test $bash_cv_opendir_not_robust = yes; then
333
AC_DEFINE(OPENDIR_NOT_ROBUST)
334
fi
335
])
336
 
337
dnl
338
AC_DEFUN(BASH_TYPE_SIGHANDLER,
339
[AC_MSG_CHECKING([whether signal handlers are of type void])
340
AC_CACHE_VAL(bash_cv_void_sighandler,
341
[AC_TRY_COMPILE([#include <sys/types.h>
342
#include <signal.h>
343
#ifdef signal
344
#undef signal
345
#endif
346
#ifdef __cplusplus
347
extern "C"
348
#endif
349
void (*signal ()) ();],
350
[int i;], bash_cv_void_sighandler=yes, bash_cv_void_sighandler=no)])dnl
351
AC_MSG_RESULT($bash_cv_void_sighandler)
352
if test $bash_cv_void_sighandler = yes; then
353
AC_DEFINE(VOID_SIGHANDLER)
354
fi
355
])
356
 
357
AC_DEFUN(BASH_TYPE_INT32_T,
358
[
359
if test "$ac_cv_sizeof_int" = 4; then
360
  AC_CHECK_TYPE(int32_t, int)
361
elif test "$ac_cv_sizeof_long" = 4; then
362
  AC_CHECK_TYPE(int32_t, long)
363
else
364
  AC_CHECK_TYPE(int32_t, int)
365
fi
366
])
367
 
368
AC_DEFUN(BASH_TYPE_U_INT32_T,
369
[
370
if test "$ac_cv_sizeof_int" = 4; then
371
  AC_CHECK_TYPE(u_int32_t, unsigned int)
372
elif test "$ac_cv_sizeof_long" = 4; then
373
  AC_CHECK_TYPE(u_int32_t, unsigned long)
374
else
375
  AC_CHECK_TYPE(u_int32_t, unsigned int)
376
fi
377
])
378
 
379
AC_DEFUN(BASH_TYPE_PTRDIFF_T,
380
[
381
if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then
382
  AC_CHECK_TYPE(ptrdiff_t, int)
383
elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then
384
  AC_CHECK_TYPE(ptrdiff_t, long)
385
else
386
  AC_CHECK_TYPE(ptrdiff_t, int)
387
fi
388
])
389
 
390
AC_DEFUN(BASH_TYPE_BITS64_T,
391
[
392
if test "$ac_sv_sizeof_char_p" = 8; then
393
  AC_CHECK_TYPE(bits64_t, char *)
394
elif test "$ac_cv_sizeof_double" = 8; then
395
  AC_CHECK_TYPE(bits64_t, double)
396
elif test "$ac_cv_sizeof_long" = 8; then
397
  AC_CHECK_TYPE(bits64_t, long)
398
else
399
  AC_CHECK_TYPE(bits64_t, double)
400
fi
401
])
402
 
403
AC_DEFUN(BASH_FUNC_STRSIGNAL,
404
[AC_MSG_CHECKING([for the existence of strsignal])
405
AC_CACHE_VAL(bash_cv_have_strsignal,
406
[AC_TRY_LINK([#include <sys/types.h>
407
#include <signal.h>],
408
[char *s = (char *)strsignal(2);],
409
 bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)])
410
AC_MSG_RESULT($bash_cv_have_strsignal)
411
if test $bash_cv_have_strsignal = yes; then
412
AC_DEFINE(HAVE_STRSIGNAL)
413
fi
414
])
415
 
416
AC_DEFUN(BASH_FUNC_LSTAT,
417
[dnl Cannot use AC_CHECK_FUNCS(lstat) because Linux defines lstat() as an
418
dnl inline function in <sys/stat.h>.
419
AC_CACHE_CHECK([for lstat], bash_cv_func_lstat,
420
[AC_TRY_LINK([
421
#include <sys/types.h>
422
#include <sys/stat.h>
423
],[ lstat(".",(struct stat *)0); ],
424
bash_cv_func_lstat=yes, bash_cv_func_lstat=no)])
425
if test $bash_cv_func_lstat = yes; then
426
  AC_DEFINE(HAVE_LSTAT)
427
fi
428
])
429
 
430
AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC,
431
[AC_MSG_CHECKING([for a c_line member of struct termios])
432
AC_CACHE_VAL(bash_cv_termios_ldisc,
433
[AC_TRY_COMPILE([#include <sys/types.h>
434
#include <termios.h>],[struct termios t; int i; i = t.c_line;],
435
  bash_cv_termios_ldisc=yes, bash_cv_termios_ldisc=no)])dnl
436
AC_MSG_RESULT($bash_cv_termios_ldisc)
437
if test $bash_cv_termios_ldisc = yes; then
438
AC_DEFINE(TERMIOS_LDISC)
439
fi
440
])
441
 
442
AC_DEFUN(BASH_STRUCT_TERMIO_LDISC,
443
[AC_MSG_CHECKING([for a c_line member of struct termio])
444
AC_CACHE_VAL(bash_cv_termio_ldisc,
445
[AC_TRY_COMPILE([#include <sys/types.h>
446
#include <termio.h>],[struct termio t; int i; i = t.c_line;],
447
  bash_cv_termio_ldisc=yes, bash_cv_termio_ldisc=no)])dnl
448
AC_MSG_RESULT($bash_cv_termio_ldisc)
449
if test $bash_cv_termio_ldisc = yes; then
450
AC_DEFINE(TERMIO_LDISC)
451
fi
452
])
453
 
454
AC_DEFUN(BASH_FUNC_GETENV,
455
[AC_MSG_CHECKING(to see if getenv can be redefined)
456
AC_CACHE_VAL(bash_cv_getenv_redef,
457
[AC_TRY_RUN([
458
#ifdef HAVE_UNISTD_H
459
#  include <unistd.h>
460
#endif
461
#ifndef __STDC__
462
#  ifndef const
463
#    define const
464
#  endif
465
#endif
466
char *
467
getenv (name)
468
#if defined (__linux__) || defined (__bsdi__) || defined (convex)
469
     const char *name;
470
#else
471
     char const *name;
472
#endif /* !__linux__ && !__bsdi__ && !convex */
473
{
474
return "42";
475
}
476
main()
477
{
478
char *s;
479
/* The next allows this program to run, but does not allow bash to link
480
   when it redefines getenv.  I'm not really interested in figuring out
481
   why not. */
482
#if defined (NeXT)
483
exit(1);
484
#endif
485
s = getenv("ABCDE");
486
exit(s == 0);   /* force optimizer to leave getenv in */
487
}
488
], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no,
489
   [AC_MSG_WARN(cannot check getenv redefinition if cross compiling -- defaulting to yes)
490
    bash_cv_getenv_redef=yes]
491
)])
492
AC_MSG_RESULT($bash_cv_getenv_redef)
493
if test $bash_cv_getenv_redef = yes; then
494
AC_DEFINE(CAN_REDEFINE_GETENV)
495
fi
496
])
497
 
498
AC_DEFUN(BASH_FUNC_PRINTF,
499
[AC_MSG_CHECKING(for declaration of printf in <stdio.h>)
500
AC_CACHE_VAL(bash_cv_printf_declared,
501
[AC_TRY_RUN([
502
#include <stdio.h>
503
#ifdef __STDC__
504
typedef int (*_bashfunc)(const char *, ...);
505
#else
506
typedef int (*_bashfunc)();
507
#endif
508
main()
509
{
510
_bashfunc pf;
511
pf = (_bashfunc) printf;
512
exit(pf == 0);
513
}
514
], bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
515
   [AC_MSG_WARN(cannot check printf declaration if cross compiling -- defaulting to yes)
516
    bash_cv_printf_declared=yes]
517
)])
518
AC_MSG_RESULT($bash_cv_printf_declared)
519
if test $bash_cv_printf_declared = yes; then
520
AC_DEFINE(PRINTF_DECLARED)
521
fi
522
])
523
 
524
AC_DEFUN(BASH_FUNC_ULIMIT_MAXFDS,
525
[AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize)
526
AC_CACHE_VAL(bash_cv_ulimit_maxfds,
527
[AC_TRY_RUN([
528
main()
529
{
530
long maxfds = ulimit(4, 0L);
531
exit (maxfds == -1L);
532
}
533
], bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
534
   [AC_MSG_WARN(cannot check ulimit if cross compiling -- defaulting to no)
535
    bash_cv_ulimit_maxfds=no]
536
)])
537
AC_MSG_RESULT($bash_cv_ulimit_maxfds)
538
if test $bash_cv_ulimit_maxfds = yes; then
539
AC_DEFINE(ULIMIT_MAXFDS)
540
fi
541
])
542
 
543
AC_DEFUN(BASH_CHECK_LIB_TERMCAP,
544
[
545
if test "X$bash_cv_termcap_lib" = "X"; then
546
_bash_needmsg=yes
547
else
548
AC_MSG_CHECKING(which library has the termcap functions)
549
_bash_needmsg=
550
fi
551
AC_CACHE_VAL(bash_cv_termcap_lib,
552
[AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
553
    [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
554
        [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
555
            bash_cv_termcap_lib=gnutermcap)])])])
556
if test "X$_bash_needmsg" = "Xyes"; then
557
AC_MSG_CHECKING(which library has the termcap functions)
558
fi
559
AC_MSG_RESULT(using $bash_cv_termcap_lib)
560
if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
561
LDFLAGS="$LDFLAGS -L./lib/termcap"
562
TERMCAP_LIB="./lib/termcap/libtermcap.a"
563
TERMCAP_DEP="./lib/termcap/libtermcap.a"
564
elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
565
TERMCAP_LIB=-ltermcap
566
TERMCAP_DEP=
567
elif test $bash_cv_termcap_lib = libncurses; then
568
TERMCAP_LIB=-lncurses
569
TERMCAP_DEP=
570
else
571
TERMCAP_LIB=-lcurses
572
TERMCAP_DEP=
573
fi
574
])
575
 
576
AC_DEFUN(BASH_FUNC_GETCWD,
577
[AC_MSG_CHECKING([if getcwd() calls popen()])
578
AC_CACHE_VAL(bash_cv_getcwd_calls_popen,
579
[AC_TRY_RUN([
580
#include <stdio.h>
581
#ifdef HAVE_UNISTD_H
582
#include <unistd.h>
583
#endif
584
 
585
#ifndef __STDC__
586
#ifndef const
587
#define const
588
#endif
589
#endif
590
 
591
int popen_called;
592
 
593
FILE *
594
popen(command, type)
595
     const char *command;
596
     const char *type;
597
{
598
        popen_called = 1;
599
        return (FILE *)NULL;
600
}
601
 
602
FILE *_popen(command, type)
603
     const char *command;
604
     const char *type;
605
{
606
  return (popen (command, type));
607
}
608
 
609
int
610
pclose(stream)
611
FILE *stream;
612
{
613
        return 0;
614
}
615
 
616
int
617
_pclose(stream)
618
FILE *stream;
619
{
620
        return 0;
621
}
622
 
623
main()
624
{
625
        char    lbuf[32];
626
        popen_called = 0;
627
        getcwd(lbuf, 32);
628
        exit (popen_called);
629
}
630
], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes,
631
   [AC_MSG_WARN(cannot check whether getcwd calls popen if cross compiling -- defaulting to no)
632
    bash_cv_getcwd_calls_popen=no]
633
)])
634
AC_MSG_RESULT($bash_cv_getcwd_calls_popen)
635
if test $bash_cv_getcwd_calls_popen = yes; then
636
AC_DEFINE(GETCWD_BROKEN)
637
fi
638
])
639
 
640
AC_DEFUN(BASH_STRUCT_DIRENT_D_INO,
641
[AC_REQUIRE([AC_HEADER_DIRENT])
642
AC_MSG_CHECKING(if struct dirent has a d_ino member)
643
AC_CACHE_VAL(bash_cv_dirent_has_dino,
644
[AC_TRY_COMPILE([
645
#include <stdio.h>
646
#include <sys/types.h>
647
#ifdef HAVE_UNISTD_H
648
# include <unistd.h>
649
#endif /* HAVE_UNISTD_H */
650
#if defined(HAVE_DIRENT_H)
651
# include <dirent.h>
652
#else
653
# define dirent direct
654
# ifdef HAVE_SYS_NDIR_H
655
#  include <sys/ndir.h>
656
# endif /* SYSNDIR */
657
# ifdef HAVE_SYS_DIR_H
658
#  include <sys/dir.h>
659
# endif /* SYSDIR */
660
# ifdef HAVE_NDIR_H
661
#  include <ndir.h>
662
# endif
663
#endif /* HAVE_DIRENT_H */
664
],[
665
struct dirent d; int z; z = d.d_ino;
666
], bash_cv_dirent_has_dino=yes, bash_cv_dirent_has_dino=no)])
667
AC_MSG_RESULT($bash_cv_dirent_has_dino)
668
if test $bash_cv_dirent_has_dino = yes; then
669
AC_DEFINE(STRUCT_DIRENT_HAS_D_INO)
670
fi
671
])
672
 
673
AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO,
674
[AC_REQUIRE([AC_HEADER_DIRENT])
675
AC_MSG_CHECKING(if struct dirent has a d_fileno member)
676
AC_CACHE_VAL(bash_cv_dirent_has_d_fileno,
677
[AC_TRY_COMPILE([
678
#include <stdio.h>
679
#include <sys/types.h>
680
#ifdef HAVE_UNISTD_H
681
# include <unistd.h>
682
#endif /* HAVE_UNISTD_H */
683
#if defined(HAVE_DIRENT_H)
684
# include <dirent.h>
685
#else
686
# define dirent direct
687
# ifdef HAVE_SYS_NDIR_H
688
#  include <sys/ndir.h>
689
# endif /* SYSNDIR */
690
# ifdef HAVE_SYS_DIR_H
691
#  include <sys/dir.h>
692
# endif /* SYSDIR */
693
# ifdef HAVE_NDIR_H
694
#  include <ndir.h>
695
# endif
696
#endif /* HAVE_DIRENT_H */
697
],[
698
struct dirent d; int z; z = d.d_fileno;
699
], bash_cv_dirent_has_d_fileno=yes, bash_cv_dirent_has_d_fileno=no)])
700
AC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
701
if test $bash_cv_dirent_has_d_fileno = yes; then
702
AC_DEFINE(STRUCT_DIRENT_HAS_D_FILENO)
703
fi
704
])
705
 
706
AC_DEFUN(BASH_REINSTALL_SIGHANDLERS,
707
[AC_REQUIRE([AC_TYPE_SIGNAL])
708
AC_REQUIRE([BASH_SIGNAL_CHECK])
709
AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
710
AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
711
[AC_TRY_RUN([
712
#include <signal.h>
713
#ifdef HAVE_UNISTD_H
714
#include <unistd.h>
715
#endif
716
 
717
typedef RETSIGTYPE sigfunc();
718
 
719
int nsigint;
720
 
721
#ifdef HAVE_POSIX_SIGNALS
722
sigfunc *
723
set_signal_handler(sig, handler)
724
     int sig;
725
     sigfunc *handler;
726
{
727
  struct sigaction act, oact;
728
  act.sa_handler = handler;
729
  act.sa_flags = 0;
730
  sigemptyset (&act.sa_mask);
731
  sigemptyset (&oact.sa_mask);
732
  sigaction (sig, &act, &oact);
733
  return (oact.sa_handler);
734
}
735
#else
736
#define set_signal_handler(s, h) signal(s, h)
737
#endif
738
 
739
RETSIGTYPE
740
sigint(s)
741
int s;
742
{
743
  nsigint++;
744
}
745
 
746
main()
747
{
748
        nsigint = 0;
749
        set_signal_handler(SIGINT, sigint);
750
        kill((int)getpid(), SIGINT);
751
        kill((int)getpid(), SIGINT);
752
        exit(nsigint != 2);
753
}
754
], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
755
   [AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting to no)
756
    bash_cv_must_reinstall_sighandlers=no]
757
)])
758
AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
759
if test $bash_cv_must_reinstall_sighandlers = yes; then
760
AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
761
fi
762
])
763
 
764
AC_DEFUN(BASH_FUNC_SBRK_DECLARED,
765
[AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>)
766
AC_CACHE_VAL(bash_cv_sbrk_declared,
767
[AC_EGREP_HEADER(sbrk, unistd.h,
768
 bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)])
769
AC_MSG_RESULT($bash_cv_sbrk_declared)
770
if test $bash_cv_sbrk_declared = yes; then
771
AC_DEFINE(SBRK_DECLARED)
772
fi
773
])
774
 
775
dnl check that some necessary job control definitions are present
776
AC_DEFUN(BASH_JOB_CONTROL_MISSING,
777
[AC_REQUIRE([BASH_SIGNAL_CHECK])
778
AC_MSG_CHECKING(for presence of necessary job control definitions)
779
AC_CACHE_VAL(bash_cv_job_control_missing,
780
[AC_TRY_RUN([
781
#include <sys/types.h>
782
#ifdef HAVE_SYS_WAIT_H
783
#include <sys/wait.h>
784
#endif
785
#ifdef HAVE_UNISTD_H
786
#include <unistd.h>
787
#endif
788
#include <signal.h>
789
 
790
/* Add more tests in here as appropriate. */
791
main()
792
{
793
/* signal type */
794
#if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS)
795
exit(1);
796
#endif
797
 
798
/* signals and tty control. */
799
#if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT)
800
exit (1);
801
#endif
802
 
803
/* process control */
804
#if !defined (WNOHANG) || !defined (WUNTRACED)
805
exit(1);
806
#endif
807
 
808
/* Posix systems have tcgetpgrp and waitpid. */
809
#if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP)
810
exit(1);
811
#endif
812
 
813
#if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID)
814
exit(1);
815
#endif
816
 
817
/* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */
818
#if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3)
819
exit(1);
820
#endif
821
 
822
exit(0);
823
}], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
824
    [AC_MSG_WARN(cannot check job control if cross-compiling -- defaulting to missing)
825
     bash_cv_job_control_missing=missing]
826
)])
827
AC_MSG_RESULT($bash_cv_job_control_missing)
828
if test $bash_cv_job_control_missing = missing; then
829
AC_DEFINE(JOB_CONTROL_MISSING)
830
fi
831
])
832
 
833
dnl check whether named pipes are present
834
dnl this requires a previous check for mkfifo, but that is awkward to specify
835
AC_DEFUN(BASH_SYS_NAMED_PIPES,
836
[AC_MSG_CHECKING(for presence of named pipes)
837
AC_CACHE_VAL(bash_cv_sys_named_pipes,
838
[AC_TRY_RUN([
839
#include <sys/types.h>
840
#include <sys/stat.h>
841
#ifdef HAVE_UNISTD_H
842
#include <unistd.h>
843
#endif
844
 
845
/* Add more tests in here as appropriate. */
846
main()
847
{
848
int fd;
849
 
850
#if defined (HAVE_MKFIFO)
851
exit (0);
852
#endif
853
 
854
#if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO))
855
exit (1);
856
#endif
857
 
858
#if defined (NeXT)
859
exit (1);
860
#endif
861
 
862
fd = mknod ("/tmp/sh-np-autoconf", 0666 | S_IFIFO, 0);
863
if (fd == -1)
864
  exit (1);
865
close(fd);
866
unlink ("/tmp/sh-np-autoconf");
867
exit(0);
868
}], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
869
    [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
870
     bash_cv_sys_named_pipes=missing]
871
)])
872
AC_MSG_RESULT($bash_cv_sys_named_pipes)
873
if test $bash_cv_sys_named_pipes = missing; then
874
AC_DEFINE(NAMED_PIPES_MISSING)
875
fi
876
])
877
 
878
AC_DEFUN(BASH_FUNC_POSIX_SETJMP,
879
[AC_REQUIRE([BASH_SIGNAL_CHECK])
880
AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp)
881
AC_CACHE_VAL(bash_cv_func_sigsetjmp,
882
[AC_TRY_RUN([
883
#ifdef HAVE_UNISTD_H
884
#include <unistd.h>
885
#endif
886
#include <sys/types.h>
887
#include <signal.h>
888
#include <setjmp.h>
889
 
890
main()
891
{
892
#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
893
exit (1);
894
#else
895
 
896
int code;
897
sigset_t set, oset;
898
sigjmp_buf xx;
899
 
900
/* get the mask */
901
sigemptyset(&set);
902
sigemptyset(&oset);
903
sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set);
904
sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
905
 
906
/* save it */
907
code = sigsetjmp(xx, 1);
908
if (code)
909
  exit(0);      /* could get sigmask and compare to oset here. */
910
 
911
/* change it */
912
sigaddset(&set, SIGINT);
913
sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
914
 
915
/* and siglongjmp */
916
siglongjmp(xx, 10);
917
exit(1);
918
#endif
919
}], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
920
    [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing)
921
     bash_cv_func_sigsetjmp=missing]
922
)])
923
AC_MSG_RESULT($bash_cv_func_sigsetjmp)
924
if test $bash_cv_func_sigsetjmp = present; then
925
AC_DEFINE(HAVE_POSIX_SIGSETJMP)
926
fi
927
])
928
 
929
AC_DEFUN(BASH_HAVE_TIOCGWINSZ,
930
[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
931
AC_CACHE_VAL(bash_cv_tiocgwinsz_in_ioctl,
932
[AC_TRY_COMPILE([#include <sys/types.h>
933
#include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
934
  bash_cv_tiocgwinsz_in_ioctl=yes,bash_cv_tiocgwinsz_in_ioctl=no)])
935
AC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl)
936
if test $bash_cv_tiocgwinsz_in_ioctl = yes; then
937
AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
938
fi
939
])
940
 
941
AC_DEFUN(BASH_STRUCT_WINSIZE,
942
[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h)
943
AC_CACHE_VAL(bash_cv_struct_winsize_header,
944
[AC_TRY_COMPILE([#include <sys/types.h>
945
#include <sys/ioctl.h>], [struct winsize x;],
946
  bash_cv_struct_winsize_header=ioctl_h,
947
  [AC_TRY_COMPILE([#include <sys/types.h>
948
#include <termios.h>], [struct winsize x;],
949
  bash_cv_struct_winsize_header=termios_h, bash_cv_struct_winsize_header=other)
950
])])
951
if test $bash_cv_struct_winsize_header = ioctl_h; then
952
  AC_MSG_RESULT(sys/ioctl.h)
953
  AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
954
elif test $bash_cv_struct_winsize_header = termios_h; then
955
  AC_MSG_RESULT(termios.h)
956
  AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS)
957
else
958
  AC_MSG_RESULT(not found)
959
fi
960
])
961
 
962
AC_DEFUN(BASH_HAVE_TIOCSTAT,
963
[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
964
AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl,
965
[AC_TRY_COMPILE([#include <sys/types.h>
966
#include <sys/ioctl.h>], [int x = TIOCSTAT;],
967
  bash_cv_tiocstat_in_ioctl=yes,bash_cv_tiocstat_in_ioctl=no)])
968
AC_MSG_RESULT($bash_cv_tiocstat_in_ioctl)
969
if test $bash_cv_tiocstat_in_ioctl = yes; then
970
AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL)
971
fi
972
])
973
 
974
AC_DEFUN(BASH_HAVE_FIONREAD,
975
[AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
976
AC_CACHE_VAL(bash_cv_fionread_in_ioctl,
977
[AC_TRY_COMPILE([#include <sys/types.h>
978
#include <sys/ioctl.h>], [int x = FIONREAD;],
979
  bash_cv_fionread_in_ioctl=yes,bash_cv_fionread_in_ioctl=no)])
980
AC_MSG_RESULT($bash_cv_fionread_in_ioctl)
981
if test $bash_cv_fionread_in_ioctl = yes; then
982
AC_DEFINE(FIONREAD_IN_SYS_IOCTL)
983
fi
984
])
985
 
986
dnl
987
dnl See if speed_t is declared in <sys/types.h>.  Some versions of linux
988
dnl require a definition of speed_t each time <termcap.h> is included,
989
dnl but you can only get speed_t if you include <termios.h> (on some
990
dnl versions) or <sys/types.h> (on others).
991
dnl
992
AC_DEFUN(BASH_MISC_SPEED_T,
993
[AC_MSG_CHECKING(for speed_t in sys/types.h)
994
AC_CACHE_VAL(bash_cv_speed_t_in_sys_types,
995
[AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;],
996
  bash_cv_speed_t_in_sys_types=yes,bash_cv_speed_t_in_sys_types=no)])
997
AC_MSG_RESULT($bash_cv_speed_t_in_sys_types)
998
if test $bash_cv_speed_t_in_sys_types = yes; then
999
AC_DEFINE(SPEED_T_IN_SYS_TYPES)
1000
fi
1001
])
1002
 
1003
AC_DEFUN(BASH_CHECK_GETPW_FUNCS,
1004
[AC_MSG_CHECKING(whether programs are able to redeclare getpw functions)
1005
AC_CACHE_VAL(bash_cv_can_redecl_getpw,
1006
[AC_TRY_COMPILE([#include <sys/types.h>
1007
#include <pwd.h>
1008
extern struct passwd *getpwent();
1009
extern struct passwd *getpwuid();
1010
extern struct passwd *getpwnam();],
1011
[struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root");],
1012
  bash_cv_can_redecl_getpw=yes,bash_cv_can_redecl_getpw=no)])
1013
AC_MSG_RESULT($bash_cv_can_redecl_getpw)
1014
if test $bash_cv_can_redecl_getpw = no; then
1015
AC_DEFINE(HAVE_GETPW_DECLS)
1016
fi
1017
])
1018
 
1019
AC_DEFUN(BASH_CHECK_DEV_FD,
1020
[AC_MSG_CHECKING(whether /dev/fd is available)
1021
AC_CACHE_VAL(bash_cv_dev_fd,
1022
[if test -d /dev/fd  && test -r /dev/fd/0; then
1023
   bash_cv_dev_fd=standard
1024
 elif test -d /proc/self/fd && test -r /proc/self/fd/0; then
1025
   bash_cv_dev_fd=whacky
1026
 else
1027
   bash_cv_dev_fd=absent
1028
 fi
1029
])
1030
AC_MSG_RESULT($bash_cv_dev_fd)
1031
if test $bash_cv_dev_fd = "standard"; then
1032
  AC_DEFINE(HAVE_DEV_FD)
1033
  AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/")
1034
elif test $bash_cv_dev_fd = "whacky"; then
1035
  AC_DEFINE(HAVE_DEV_FD)
1036
  AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/")
1037
fi
1038
])
1039
 
1040
dnl
1041
dnl Check for the presence of getpeername (the only networking function
1042
dnl bash currently requires) in libsocket.  If libsocket is present,
1043
dnl check for libnsl and add it to LIBS if it's there, since most
1044
dnl systems with libsocket require linking with libnsl as well.
1045
dnl This should only be called if getpeername was not found in libc.
1046
dnl
1047
AC_DEFUN(BASH_CHECK_SOCKLIB,
1048
[
1049
if test "X$bash_cv_have_socklib" = "X"; then
1050
_bash_needmsg=
1051
else
1052
AC_MSG_CHECKING(for socket library)
1053
_bash_needmsg=yes
1054
fi
1055
AC_CACHE_VAL(bash_cv_have_socklib,
1056
[AC_CHECK_LIB(socket, getpeername,
1057
        bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)])
1058
if test "X$_bash_needmsg" = Xyes; then
1059
  AC_MSG_RESULT($bash_cv_have_socklib)
1060
  _bash_needmsg=
1061
fi
1062
if test $bash_cv_have_socklib = yes; then
1063
  # check for libnsl, add it to LIBS if present
1064
  if test "X$bash_cv_have_libnsl" = "X"; then
1065
    _bash_needmsg=
1066
  else
1067
    AC_MSG_CHECKING(for libnsl)
1068
    _bash_needmsg=yes
1069
  fi
1070
  AC_CACHE_VAL(bash_cv_have_libnsl,
1071
           [AC_CHECK_LIB(nsl, t_open,
1072
                 bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)])
1073
  if test "X$_bash_needmsg" = Xyes; then
1074
    AC_MSG_RESULT($bash_cv_have_libnsl)
1075
    _bash_needmsg=
1076
  fi
1077
  if test $bash_cv_have_libnsl = yes; then
1078
    LIBS="-lsocket -lnsl $LIBS"
1079
  else
1080
    LIBS="-lsocket $LIBS"
1081
  fi
1082
  AC_DEFINE(HAVE_LIBSOCKET)
1083
  AC_DEFINE(HAVE_GETPEERNAME)
1084
fi
1085
])
1086
 
1087
AC_DEFUN(BASH_DEFAULT_MAIL_DIR,
1088
[AC_MSG_CHECKING(for default mail directory)
1089
AC_CACHE_VAL(bash_cv_mail_dir,
1090
[if test -d /var/mail; then
1091
   bash_cv_mail_dir=/var/mail
1092
 elif test -d /usr/mail; then
1093
   bash_cv_mail_dir=/usr/mail
1094
 elif test -d /var/spool/mail; then
1095
   bash_cv_mail_dir=/var/spool/mail
1096
 elif test -d /usr/spool/mail; then
1097
   bash_cv_mail_dir=/usr/spool/mail
1098
 else
1099
   bash_cv_mail_dir=unknown
1100
 fi
1101
])
1102
AC_MSG_RESULT($bash_cv_mail_dir)
1103
if test $bash_cv_mail_dir = "/var/mail"; then
1104
   AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/var/mail")
1105
elif test $bash_cv_mail_dir = "/usr/mail"; then
1106
   AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/usr/mail")
1107
elif test $bash_cv_mail_dir = "/var/spool/mail"; then
1108
   AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/var/spool/mail")
1109
elif test $bash_cv_mail_dir = "/usr/spool/mail"; then
1110
   AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/usr/spool/mail")
1111
else
1112
   AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "unknown")
1113
fi
1114
])
1115
 
1116
dnl
1117
dnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions
1118
dnl
1119
AC_DEFUN(BASH_KERNEL_RLIMIT_CHECK,
1120
[AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines])
1121
AC_CACHE_VAL(bash_cv_kernel_rlimit,
1122
[AC_TRY_COMPILE([
1123
#include <sys/types.h>
1124
#include <sys/resource.h>
1125
],
1126
[
1127
  int f;
1128
  f = RLIMIT_DATA;
1129
], bash_cv_kernel_rlimit=no,
1130
[AC_TRY_COMPILE([
1131
#include <sys/types.h>
1132
#define _KERNEL
1133
#include <sys/resource.h>
1134
#undef _KERNEL
1135
],
1136
[
1137
        int f;
1138
        f = RLIMIT_DATA;
1139
], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)]
1140
)])
1141
AC_MSG_RESULT($bash_cv_kernel_rlimit)
1142
if test $bash_cv_kernel_rlimit = yes; then
1143
AC_DEFINE(RLIMIT_NEEDS_KERNEL)
1144
fi
1145
])
1146
 
1147
AC_DEFUN(BASH_FUNC_STRCOLL,
1148
[
1149
AC_MSG_CHECKING(whether or not strcoll and strcmp differ)
1150
AC_CACHE_VAL(bash_cv_func_strcoll_broken,
1151
[AC_TRY_RUN([
1152
#include <stdio.h>
1153
#if defined (HAVE_LOCALE_H)
1154
#include <locale.h>
1155
#endif
1156
 
1157
main(c, v)
1158
int     c;
1159
char    *v[];
1160
{
1161
        int     r1, r2;
1162
        char    *deflocale, *defcoll;
1163
 
1164
#ifdef HAVE_SETLOCALE
1165
        deflocale = setlocale(LC_ALL, "");
1166
        defcoll = setlocale(LC_COLLATE, "");
1167
#endif
1168
 
1169
#ifdef HAVE_STRCOLL
1170
        /* These two values are taken from tests/glob-test. */
1171
        r1 = strcoll("abd", "aXd");
1172
#else
1173
        r1 = 0;
1174
#endif
1175
        r2 = strcmp("abd", "aXd");
1176
 
1177
        /* These two should both be greater than 0.  It is permissible for
1178
           a system to return different values, as long as the sign is the
1179
           same. */
1180
 
1181
        /* Exit with 1 (failure) if these two values are both > 0, since
1182
           this tests whether strcoll(3) is broken with respect to strcmp(3)
1183
           in the default locale. */
1184
        exit (r1 > 0 && r2 > 0);
1185
}
1186
], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
1187
   [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no)
1188
    bash_cv_func_strcoll_broken=no]
1189
)])
1190
AC_MSG_RESULT($bash_cv_func_strcoll_broken)
1191
if test $bash_cv_func_strcoll_broken = yes; then
1192
AC_DEFINE(STRCOLL_BROKEN)
1193
fi
1194
])
1195
 
1196
dnl
1197
dnl If available, use support for large files unless the user specified
1198
dnl one of the CPPFLAGS, LDFLAGS, or LIBS variables (<eggert@twinsun.com>
1199
dnl via GNU patch 2.5)
1200
dnl
1201
AC_DEFUN(BASH_LARGE_FILE_SUPPORT,
1202
[AC_MSG_CHECKING(whether large file support needs explicit enabling)
1203
ac_getconfs=''
1204
ac_result=yes
1205
ac_set=''
1206
ac_shellvars='CPPFLAGS LDFLAGS LIBS'
1207
for ac_shellvar in $ac_shellvars; do
1208
  case $ac_shellvar in
1209
  CPPFLAGS) ac_lfsvar=LFS_CFLAGS ac_lfs64var=LFS64_CFLAGS ;;
1210
  *) ac_lfsvar=LFS_$ac_shellvar ac_lfs64var=LFS64_$ac_shellvar ;;
1211
  esac
1212
  eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
1213
  (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
1214
  ac_getconf=`getconf $ac_lfsvar`
1215
  ac_getconf64=`getconf $ac_lfs64var`
1216
  ac_getconfs=$ac_getconfs$ac_getconf\ $ac_getconf64
1217
  eval ac_test_$ac_shellvar="\$ac_getconf\ \$ac_getconf64"
1218
done
1219
case "$ac_result$ac_getconfs" in
1220
yes) ac_result=no ;;
1221
esac
1222
case "$ac_result$ac_set" in
1223
yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
1224
esac
1225
AC_MSG_RESULT($ac_result)
1226
case $ac_result in
1227
yes)
1228
  for ac_shellvar in $ac_shellvars; do
1229
    eval $ac_shellvar=\$ac_test_$ac_shellvar
1230
  done ;;
1231
esac
1232
])
1233
 
1234
dnl
1235
dnl AC_SYS_RESTARTABLE_SYSCALLS tests only for restarted system calls
1236
dnl after a signal handler has been installed with signal().  Since
1237
dnl Bash uses sigaction() if it is available, we need to check whether
1238
dnl or not a signal handler installed with sigaction and SA_RESTART
1239
dnl causes system calls to be restarted after the signal is caught
1240
dnl
1241
AC_DEFUN(BASH_SYS_RESTARTABLE_SYSCALLS,
1242
[AC_REQUIRE([BASH_SIGNAL_CHECK])
1243
AC_CACHE_CHECK(for restartable system calls with posix sigaction,
1244
bash_cv_sys_restartable_syscalls,
1245
[AC_TRY_RUN(
1246
[/* Exit 0 (true) if wait returns something other than -1,
1247
   i.e. the pid of the child, which means that wait was restarted
1248
   after getting the signal.  */
1249
#include <sys/types.h>
1250
#include <signal.h>
1251
static int caught = 0;
1252
void ucatch (isig) int isig; { caught = 1; }
1253
main ()
1254
{
1255
#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
1256
  exit (1);
1257
#else
1258
  struct sigaction act, oact;
1259
  int i, status;
1260
 
1261
  act.sa_handler = ucatch;
1262
  /* Might want to add SA_RESTART here, but bash's set_signal_handler
1263
     does not. */
1264
  act.sa_flags = 0;
1265
  sigemptyset(&act.sa_mask);
1266
  sigemptyset(&oact.sa_mask);
1267
  i = fork ();
1268
  /* A possible race condition here, but in practice it never happens. */
1269
  if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); }
1270
  sigaction(SIGINT, &act, &oact);
1271
  status = wait(&i);
1272
  if (status == -1) wait(&i);
1273
  exit (status == -1);
1274
#endif
1275
}
1276
], bash_cv_sys_restartable_syscalls=yes, bash_cv_sys_restartable_syscalls=no,
1277
   AC_MSG_WARN(cannot check restartable syscalls if cross compiling))
1278
])
1279
if test $bash_cv_sys_restartable_syscalls = yes; then
1280
  AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS)
1281
fi
1282
])
1283
dnl
1284
dnl Check for 64-bit off_t -- used for malloc alignment
1285
dnl
1286
dnl C does not allow duplicate case labels, so the compile will fail if
1287
dnl sizeof(off_t) is > 4.
1288
dnl
1289
AC_DEFUN(BASH_CHECK_OFF_T_64,
1290
[AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64,
1291
AC_TRY_COMPILE([
1292
#ifdef HAVE_UNISTD_H
1293
#include <unistd.h>
1294
#endif
1295
#include <sys/types.h>
1296
],[
1297
switch (0) case 0: case (sizeof (off_t) <= 4):;
1298
], bash_cv_off_t_64=no, bash_cv_off_t_64=yes))
1299
if test $bash_cv_off_t_64 = yes; then
1300
        AC_DEFINE(HAVE_OFF_T_64)
1301
fi])

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.