Add select args type & vfork tests for experimentation purposes.

This commit is contained in:
Kurt Zeilenga 1999-04-04 00:59:32 +00:00
parent f172f7ee9c
commit 82453169fc
3 changed files with 339 additions and 29 deletions

333
configure vendored
View File

@ -8652,7 +8652,7 @@ ac_cv_header_stdc=disable
if test $ol_cv_header_stdc != yes; then
echo "configure: warning: could not Standard C compliant headers" 1>&2
echo "configure: warning: could not locate Standard C compliant headers" 1>&2
fi
ac_header_dirent=no
@ -10091,13 +10091,223 @@ fi
fi
ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
echo "configure:10097: checking for vfork.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 10102 "configure"
#include "confdefs.h"
#include <vfork.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:10107: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define HAVE_VFORK_H 1
EOF
else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking for working vfork""... $ac_c" 1>&6
echo "configure:10132: checking for working vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
echo $ac_n "checking for vfork""... $ac_c" 1>&6
echo "configure:10138: checking for vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 10143 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vfork(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char vfork();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_vfork) || defined (__stub___vfork)
choke me
#else
vfork();
#endif
; return 0; }
EOF
if { (eval echo configure:10166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vfork=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_vfork=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
fi
ac_cv_func_vfork_works=$ac_cv_func_vfork
else
cat > conftest.$ac_ext <<EOF
#line 10188 "configure"
#include "confdefs.h"
/* Thanks to Paul Eggert for this test. */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_VFORK_H
#include <vfork.h>
#endif
/* On some sparc systems, changes by the child to local and incoming
argument registers are propagated back to the parent.
The compiler is told about this with #include <vfork.h>,
but some compilers (e.g. gcc -O) don't grok <vfork.h>.
Test for this by using a static variable whose address
is put into a register that is clobbered by the vfork. */
static
#ifdef __cplusplus
sparc_address_test (int arg)
#else
sparc_address_test (arg) int arg;
#endif
{
static pid_t child;
if (!child) {
child = vfork ();
if (child < 0) {
perror ("vfork");
_exit(2);
}
if (!child) {
arg = getpid();
write(-1, "", 0);
_exit (arg);
}
}
}
main() {
pid_t parent = getpid ();
pid_t child;
sparc_address_test ();
child = vfork ();
if (child == 0) {
/* Here is another test for sparc vfork register problems.
This test uses lots of local variables, at least
as many local variables as main has allocated so far
including compiler temporaries. 4 locals are enough for
gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
A buggy compiler should reuse the register of parent
for one of the local variables, since it will think that
parent can't possibly be used any more in this routine.
Assigning to the local variable will thus munge parent
in the parent process. */
pid_t
p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
/* Convince the compiler that p..p7 are live; otherwise, it might
use the same hardware register for all 8 local variables. */
if (p != p1 || p != p2 || p != p3 || p != p4
|| p != p5 || p != p6 || p != p7)
_exit(1);
/* On some systems (e.g. IRIX 3.3),
vfork doesn't separate parent from child file descriptors.
If the child closes a descriptor before it execs or exits,
this munges the parent's descriptor as well.
Test for this by closing stdout in the child. */
_exit(close(fileno(stdout)) != 0);
} else {
int status;
struct stat st;
while (wait(&status) != child)
;
exit(
/* Was there some problem with vforking? */
child < 0
/* Did the child fail? (This shouldn't happen.) */
|| status
/* Did the vfork/compiler bug occur? */
|| parent != getpid()
/* Did the file descriptor bug occur? */
|| fstat(fileno(stdout), &st) != 0
);
}
}
EOF
if { (eval echo configure:10283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_vfork_works=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
ac_cv_func_vfork_works=no
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$ac_cv_func_vfork_works" 1>&6
if test $ac_cv_func_vfork_works = no; then
cat >> confdefs.h <<\EOF
#define vfork fork
EOF
fi
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
echo "configure:10096: checking for vprintf" >&5
echo "configure:10306: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 10101 "configure"
#line 10311 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
@ -10120,7 +10330,7 @@ vprintf();
; return 0; }
EOF
if { (eval echo configure:10124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:10334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
@ -10144,12 +10354,12 @@ fi
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
echo "configure:10148: checking for _doprnt" >&5
echo "configure:10358: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 10153 "configure"
#line 10363 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
@ -10172,7 +10382,7 @@ _doprnt();
; return 0; }
EOF
if { (eval echo configure:10176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:10386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
@ -10201,12 +10411,12 @@ if test $ac_cv_func_vprintf = yes ; then
for ac_func in vsnprintf vsprintf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:10205: checking for $ac_func" >&5
echo "configure:10415: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 10210 "configure"
#line 10420 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -10229,7 +10439,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:10233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:10443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -10294,12 +10504,12 @@ for ac_func in \
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:10298: checking for $ac_func" >&5
echo "configure:10508: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 10303 "configure"
#line 10513 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -10322,7 +10532,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:10326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:10536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -10347,15 +10557,88 @@ fi
done
echo $ac_n "checking types of arguments for select()""... $ac_c" 1>&6
echo "configure:10562: checking types of arguments for select()" >&5
if eval "test \"`echo '$''{'ac_cv_func_select_arg234'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if eval "test \"`echo '$''{'ac_cv_func_select_arg1'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if eval "test \"`echo '$''{'ac_cv_func_select_arg5'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
cat > conftest.$ac_ext <<EOF
#line 10576 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);
int main() {
; return 0; }
EOF
if { (eval echo configure:10595: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_not_found=no ; break 3
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_not_found=yes
fi
rm -f conftest*
done
done
done
fi
fi
fi
if test "$ac_not_found" = yes; then
ac_cv_func_select_arg1=int
ac_cv_func_select_arg234='int *'
ac_cv_func_select_arg5='struct timeval *'
fi
echo "$ac_t""$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5" 1>&6
cat >> confdefs.h <<EOF
#define SELECT_TYPE_ARG1 $ac_cv_func_select_arg1
EOF
cat >> confdefs.h <<EOF
#define SELECT_TYPE_ARG234 ($ac_cv_func_select_arg234)
EOF
cat >> confdefs.h <<EOF
#define SELECT_TYPE_ARG5 ($ac_cv_func_select_arg5)
EOF
for ac_func in getopt tempnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:10354: checking for $ac_func" >&5
echo "configure:10637: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 10359 "configure"
#line 10642 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -10378,7 +10661,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:10382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:10665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -10408,13 +10691,13 @@ done
# Check Configuration
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
echo "configure:10412: checking declaration of sys_errlist" >&5
echo "configure:10695: checking declaration of sys_errlist" >&5
if eval "test \"`echo '$''{'ol_cv_dcl_sys_errlist'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 10418 "configure"
#line 10701 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -10424,7 +10707,7 @@ int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
if { (eval echo configure:10428: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:10711: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_dcl_sys_errlist=yes
else
@ -10444,20 +10727,20 @@ if test $ol_cv_dcl_sys_errlist = no ; then
EOF
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
echo "configure:10448: checking existence of sys_errlist" >&5
echo "configure:10731: checking existence of sys_errlist" >&5
if eval "test \"`echo '$''{'ol_cv_have_sys_errlist'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 10454 "configure"
#line 10737 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
if { (eval echo configure:10461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:10744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_have_sys_errlist=yes
else
@ -10481,13 +10764,13 @@ fi
echo $ac_n "checking strdup declaration""... $ac_c" 1>&6
echo "configure:10485: checking strdup declaration" >&5
echo "configure:10768: checking strdup declaration" >&5
if eval "test \"`echo '$''{'ol_cv_dcl_strdup'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 10491 "configure"
#line 10774 "configure"
#include "confdefs.h"
#include <string.h>
@ -10495,7 +10778,7 @@ int main() {
extern char *strdup();
; return 0; }
EOF
if { (eval echo configure:10499: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:10782: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_dcl_strdup=yes
else

View File

@ -1614,7 +1614,7 @@ dnl Checks for header files.
OL_HEADER_STDC
if test $ol_cv_header_stdc != yes; then
AC_MSG_WARN([could not Standard C compliant headers])
AC_MSG_WARN([could not locate Standard C compliant headers])
fi
AC_HEADER_DIRENT
@ -1699,6 +1699,7 @@ AC_FUNC_MEMCMP
dnl AM_FUNC_MKTIME dnl checks for sys/time.h and unistd.h
AC_FUNC_STRFTIME
dnl AM_FUNC_STRTOD
AC_FUNC_VFORK
AC_FUNC_VPRINTF
if test $ac_cv_func_vprintf = yes ; then
@ -1744,6 +1745,11 @@ AC_CHECK_FUNCS( \
wait4 \
)
dnl Select arg types
dnl (if this detection becomes permenent, it and the select() detection
dnl should be done before the yielding select test)
AC_FUNC_SELECT_ARGTYPES
dnl We actually may need to replace more than this.
AC_REPLACE_FUNCS(getopt tempnam)

View File

@ -43,6 +43,9 @@
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define if you have <vfork.h>. */
#undef HAVE_VFORK_H
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
@ -68,6 +71,15 @@
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define to the type of arg1 for select(). */
#undef SELECT_TYPE_ARG1
/* Define to the type of args 2, 3 and 4 for select(). */
#undef SELECT_TYPE_ARG234
/* Define to the type of arg5 for select(). */
#undef SELECT_TYPE_ARG5
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
@ -83,6 +95,9 @@
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define vfork as fork if vfork does not work. */
#undef vfork
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
@ -249,9 +264,6 @@
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the <grp.h> header file. */
#undef HAVE_GRP_H
/* Define if you have the lockf function. */
#undef HAVE_LOCKF
@ -276,6 +288,12 @@
/* Define if you have the pthread_yield function. */
#undef HAVE_PTHREAD_YIELD
/* Define if you have the recv function. */
#undef HAVE_RECV
/* Define if you have the recvfrom function. */
#undef HAVE_RECVFROM
/* Define if you have the res_search function. */
#undef HAVE_RES_SEARCH
@ -399,6 +417,9 @@
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define if you have the <grp.h> header file. */
#undef HAVE_GRP_H
/* Define if you have the <kerberosIV/des.h> header file. */
#undef HAVE_KERBEROSIV_DES_H