- struct sigaction act, oact;
- act.sa_flags = 0;
- oact.sa_handler = 0;
- /* so that act and oact are used */
- exit(act.sa_flags == 0 && oact.sa_handler == 0);
-}
-EOP
- set try
- if eval $compile_ok; then
- val="$define"
- else
- echo "But you don't seem to have a useable struct sigaction." >&4
- val="$undef"
- fi
-else
- echo 'sigaction NOT found.' >&4
- val="$undef"
-fi
-set d_sigaction; eval $setvar
-$rm -f try try$_o try.c
-
-: see if sigprocmask exists
-set sigprocmask d_sigprocmask
-eval $inlibc
-
-: see if sigsetjmp exists
-echo " "
-case "$d_sigsetjmp" in
-'')
- $cat >try.c <<EOP
-#include <setjmp.h>
-#$i_stdlib I_STDLIB
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-sigjmp_buf env;
-int set = 1;
-int main()
-{
- if (sigsetjmp(env,1))
- exit(set);
- set = 0;
- siglongjmp(env, 1);
- exit(1);
-}
-EOP
- set try
- if eval $compile; then
- if $run ./try >/dev/null 2>&1; then
- echo "POSIX sigsetjmp found." >&4
- val="$define"
- else
- $cat >&4 <<EOM
-Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
-I'll ignore them.
-EOM
- val="$undef"
- fi
- else
- echo "sigsetjmp not found." >&4
- val="$undef"
- fi
- ;;
-*) val="$d_sigsetjmp"
- case "$d_sigsetjmp" in
- $define) echo "POSIX sigsetjmp found." >&4;;
- $undef) echo "sigsetjmp not found." >&4;;
- esac
- ;;
-esac
-set d_sigsetjmp
-eval $setvar
-$rm -f try.c try
-
-: see if sockatmark exists
-set sockatmark d_sockatmark
-eval $inlibc
-
-: see if prototype for sockatmark is available
-echo " "
-set d_sockatmarkproto sockatmark $d_socket sys/socket.h
-eval $hasproto
-
-: see if socks5_init exists
-set socks5_init d_socks5_init
-eval $inlibc
-
-: see if srand48_r exists
-set srand48_r d_srand48_r
-eval $inlibc
-case "$d_srand48_r" in
-"$define")
- hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
- case "$d_srand48_r_proto:$usethreads" in
- ":define") d_srand48_r_proto=define
- set d_srand48_r_proto srand48_r $hdrs
- eval $hasproto ;;
- *) ;;
- esac
- case "$d_srand48_r_proto" in
- define)
- case "$srand48_r_proto" in
- ''|0) try='int srand48_r(long, struct drand48_data*);'
- ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
- esac
- case "$srand48_r_proto" in
- ''|0) d_srand48_r=undef
- srand48_r_proto=0
- echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
- * ) case "$srand48_r_proto" in
- REENTRANT_PROTO*) ;;
- *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
- esac
- echo "Prototype: $try" ;;
- esac
- ;;
- *) case "$usethreads" in
- define) echo "srand48_r has no prototype, not using it." >&4 ;;
- esac
- d_srand48_r=undef
- srand48_r_proto=0
- ;;
- esac
- ;;
-*) srand48_r_proto=0
- ;;
-esac
-
-: see if srandom_r exists
-set srandom_r d_srandom_r
-eval $inlibc
-case "$d_srandom_r" in
-"$define")
- hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
- case "$d_srandom_r_proto:$usethreads" in
- ":define") d_srandom_r_proto=define
- set d_srandom_r_proto srandom_r $hdrs
- eval $hasproto ;;
- *) ;;
- esac
- case "$d_srandom_r_proto" in
- define)
- case "$srandom_r_proto" in
- ''|0) try='int srandom_r(unsigned int, struct random_data*);'
- ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
- esac
- case "$srandom_r_proto" in
- ''|0) d_srandom_r=undef
- srandom_r_proto=0
- echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
- * ) case "$srandom_r_proto" in
- REENTRANT_PROTO*) ;;
- *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
- esac
- echo "Prototype: $try" ;;
- esac
- ;;
- *) case "$usethreads" in
- define) echo "srandom_r has no prototype, not using it." >&4 ;;
- esac
- d_srandom_r=undef
- srandom_r_proto=0
- ;;
- esac
- ;;
-*) srandom_r_proto=0
- ;;
-esac
-
-: see if prototype for setresgid is available
-echo " "
-set d_sresgproto setresgid $i_unistd unistd.h
-eval $hasproto
-
-: see if prototype for setresuid is available
-echo " "
-set d_sresuproto setresuid $i_unistd unistd.h
-eval $hasproto
-
-: see if sys/stat.h is available
-set sys/stat.h i_sysstat
-eval $inhdr
-
-
-: see if stat knows about block sizes
-echo " "
-echo "Checking to see if your struct stat has st_blocks field..." >&4
-set d_statblks stat st_blocks $i_sysstat sys/stat.h
-eval $hasfield
-
-
-: see if this is a sys/vfs.h system
-set sys/vfs.h i_sysvfs
-eval $inhdr
-
-
-: see if this is a sys/statfs.h system
-set sys/statfs.h i_sysstatfs
-eval $inhdr
-
-
-echo " "
-echo "Checking to see if your system supports struct statfs..." >&4
-set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
-eval $hasstruct
-case "$d_statfs_s" in
-"$define") echo "Yes, it does." ;;
-*) echo "No, it doesn't." ;;
-esac
-
-
-
-: see if struct statfs knows about f_flags
-case "$d_statfs_s" in
-define)
- echo " "
- echo "Checking to see if your struct statfs has f_flags field..." >&4
- set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
- eval $hasfield
- ;;
-*) val="$undef"
- set d_statfs_f_flags
- eval $setvar
- ;;
-esac
-case "$d_statfs_f_flags" in
-"$define") echo "Yes, it does." ;;
-*) echo "No, it doesn't." ;;
-esac
-
-: see if _ptr and _cnt from stdio act std
-echo " "
-
-if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
- echo "(Looks like you have stdio.h from BSD.)"
- case "$stdio_ptr" in
- '') stdio_ptr='((fp)->_p)'
- ptr_lval=$define
- ;;
- *) ptr_lval=$d_stdio_ptr_lval;;
- esac
- case "$stdio_cnt" in
- '') stdio_cnt='((fp)->_r)'
- cnt_lval=$define
- ;;
- *) cnt_lval=$d_stdio_cnt_lval;;
- esac
- case "$stdio_base" in
- '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
- esac
- case "$stdio_bufsiz" in
- '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
- esac
-elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
- echo "(Looks like you have stdio.h from Linux.)"
- case "$stdio_ptr" in
- '') stdio_ptr='((fp)->_IO_read_ptr)'
- ptr_lval=$define
- ;;
- *) ptr_lval=$d_stdio_ptr_lval;;
- esac
- case "$stdio_cnt" in
- '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
- cnt_lval=$undef
- ;;
- *) cnt_lval=$d_stdio_cnt_lval;;
- esac
- case "$stdio_base" in
- '') stdio_base='((fp)->_IO_read_base)';;
- esac
- case "$stdio_bufsiz" in
- '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
- esac
-else
- case "$stdio_ptr" in
- '') stdio_ptr='((fp)->_ptr)'
- ptr_lval=$define
- ;;
- *) ptr_lval=$d_stdio_ptr_lval;;
- esac
- case "$stdio_cnt" in
- '') stdio_cnt='((fp)->_cnt)'
- cnt_lval=$define
- ;;
- *) cnt_lval=$d_stdio_cnt_lval;;
- esac
- case "$stdio_base" in
- '') stdio_base='((fp)->_base)';;
- esac
- case "$stdio_bufsiz" in
- '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
- esac
-fi
-
-: test whether _ptr and _cnt really work
-echo "Checking how std your stdio is..." >&4
-$cat >try.c <<EOP
-#include <stdio.h>
-#$i_stdlib I_STDLIB
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-#define FILE_ptr(fp) $stdio_ptr
-#define FILE_cnt(fp) $stdio_cnt
-int main() {
- FILE *fp = fopen("try.c", "r");
- char c = getc(fp);
- if (
- 18 <= FILE_cnt(fp) &&
- strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
- )
- exit(0);
- exit(1);
-}
-EOP
-val="$undef"
-set try
-if eval $compile && $to try.c; then
- if $run ./try; then
- echo "Your stdio acts pretty std."
- val="$define"
- else
- echo "Your stdio isn't very std."
- fi
-else
- echo "Your stdio doesn't appear very std."
-fi
-$rm -f try.c try
-
-# glibc 2.2.90 and above apparently change stdio streams so Perl's
-# direct buffer manipulation no longer works. The Configure tests
-# should be changed to correctly detect this, but until then,
-# the following check should at least let perl compile and run.
-# (This quick fix should be updated before 5.8.1.)
-# To be defensive, reject all unknown versions, and all versions > 2.2.9.
-# A. Dougherty, June 3, 2002.
-case "$d_gnulibc" in
-$define)
- case "$gnulibc_version" in
- 2.[01]*) ;;
- 2.2) ;;
- 2.2.[0-9]) ;;
- *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
- val="$undef"
- ;;
- esac
- ;;
-esac
-set d_stdstdio
-eval $setvar
-
-: Can _ptr be used as an lvalue?
-case "$d_stdstdio$ptr_lval" in
-$define$define) val=$define ;;
-*) val=$undef ;;
-esac
-set d_stdio_ptr_lval
-eval $setvar
-
-: Can _cnt be used as an lvalue?
-case "$d_stdstdio$cnt_lval" in
-$define$define) val=$define ;;
-*) val=$undef ;;
-esac
-set d_stdio_cnt_lval
-eval $setvar
-
-
-: test whether setting _ptr sets _cnt as a side effect
-d_stdio_ptr_lval_sets_cnt="$undef"
-d_stdio_ptr_lval_nochange_cnt="$undef"
-case "$d_stdio_ptr_lval$d_stdstdio" in
-$define$define)
- echo "Checking to see what happens if we set the stdio ptr..." >&4
-$cat >try.c <<EOP
-#include <stdio.h>
-/* Can we scream? */
-/* Eat dust sed :-) */
-/* In the buffer space, no one can hear you scream. */
-#$i_stdlib I_STDLIB
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-#define FILE_ptr(fp) $stdio_ptr
-#define FILE_cnt(fp) $stdio_cnt
-#include <sys/types.h>
-int main() {
- FILE *fp = fopen("try.c", "r");
- int c;
- char *ptr;
- size_t cnt;
- if (!fp) {
- puts("Fail even to read");
- exit(1);
- }
- c = getc(fp); /* Read away the first # */
- if (c == EOF) {
- puts("Fail even to read");
- exit(1);
- }
- if (!(
- 18 <= FILE_cnt(fp) &&
- strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
- )) {
- puts("Fail even to read");
- exit (1);
- }
- ptr = (char*) FILE_ptr(fp);
- cnt = (size_t)FILE_cnt(fp);
-
- FILE_ptr(fp) += 42;
-
- if ((char*)FILE_ptr(fp) != (ptr + 42)) {
- printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
- exit (1);
- }
- if (FILE_cnt(fp) <= 20) {
- printf ("Fail (<20 chars to test)");
- exit (1);
- }
- if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
- puts("Fail compare");
- exit (1);
- }
- if (cnt == FILE_cnt(fp)) {
- puts("Pass_unchanged");
- exit (0);
- }
- if (FILE_cnt(fp) == (cnt - 42)) {
- puts("Pass_changed");
- exit (0);
- }
- printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
- return 1;
-
-}
-EOP
- set try
- if eval $compile && $to try.c; then
- case `$run ./try` in
- Pass_changed)
- echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
- d_stdio_ptr_lval_sets_cnt="$define" ;;
- Pass_unchanged)
- echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
- d_stdio_ptr_lval_nochange_cnt="$define" ;;
- Fail*)
- echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
- *)
- echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
- esac