AUTO_HAS_VFORK

This commit is contained in:
Olivier Sirol 2002-01-24 15:45:29 +00:00
parent 8a1fdaabd7
commit 0f72dd1b03
2 changed files with 285 additions and 21 deletions

View File

@ -1,6 +1,6 @@
#! /bin/sh
# From configure.in Revision: 1.24
# From configure.in Revision: 1.25
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
@ -3838,10 +3838,264 @@ fi
################################################################### OS specific...
echo $ac_n "checking SA_RESTART""... $ac_c" 1>&6
echo "configure:3843: checking SA_RESTART" >&5
vfork=vfork
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
echo "configure:3844: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3845 "configure"
#line 3849 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
rm -rf conftest*
ac_cv_type_pid_t=yes
else
rm -rf conftest*
ac_cv_type_pid_t=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_type_pid_t" 1>&6
if test $ac_cv_type_pid_t = no; then
cat >> confdefs.h <<\EOF
#define pid_t int
EOF
fi
ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
echo "configure:3878: 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 3883 "configure"
#include "confdefs.h"
#include <vfork.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3888: \"$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:3913: 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:3919: 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 3924 "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:3947: \"$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 3969 "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:4064: \"$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 AUTO_HAS_VFORK""... $ac_c" 1>&6
echo "configure:4087: checking AUTO_HAS_VFORK" >&5
if test $vfork = fork; then
echo "$ac_t""no" 1>&6
else
echo "$ac_t""yes" 1>&6
AUTO_HAS="$AUTO_HAS -DAUTO_HAS_VFORK"
fi
echo $ac_n "checking AUTO_HAS_SA_RESTART""... $ac_c" 1>&6
echo "configure:4097: checking AUTO_HAS_SA_RESTART" >&5
cat > conftest.$ac_ext <<EOF
#line 4099 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <stdlib.h>
@ -3852,7 +4106,7 @@ sgct.sa_flags = SA_RESTART;
sigaction( SIGCHLD, &sgct , NULL );
; return 0; }
EOF
if { (eval echo configure:3856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; AUTO_HAS="$AUTO_HAS -DAUTO_HAS_SA_RESTART"
else
@ -3863,10 +4117,10 @@ else
fi
rm -f conftest*
echo $ac_n "checking DRAND48""... $ac_c" 1>&6
echo "configure:3868: checking DRAND48" >&5
echo $ac_n "checking AUTO_HAS_DRAND48""... $ac_c" 1>&6
echo "configure:4122: checking AUTO_HAS_DRAND48" >&5
cat > conftest.$ac_ext <<EOF
#line 3870 "configure"
#line 4124 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <stdlib.h>
@ -3875,7 +4129,7 @@ int main() {
Proba = drand48();
; return 0; }
EOF
if { (eval echo configure:3879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; AUTO_HAS="$AUTO_HAS -DAUTO_HAS_DRAND48"
else
@ -3886,10 +4140,10 @@ else
fi
rm -f conftest*
echo $ac_n "checking VALUES_H""... $ac_c" 1>&6
echo "configure:3891: checking VALUES_H" >&5
echo $ac_n "checking AUTO_HAS_VALUES_H""... $ac_c" 1>&6
echo "configure:4145: checking AUTO_HAS_VALUES_H" >&5
cat > conftest.$ac_ext <<EOF
#line 3893 "configure"
#line 4147 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <stdlib.h>
@ -3899,7 +4153,7 @@ int main() {
Proba = MAXFLOAT;
; return 0; }
EOF
if { (eval echo configure:3903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; AUTO_HAS="$AUTO_HAS -DAUTO_HAS_VALUES_H"
else
@ -3916,7 +4170,7 @@ rm -f conftest*
################################################################### Alliance ALLIANCE_TOP
echo $ac_n "checking where the Alliance package was installed""... $ac_c" 1>&6
echo "configure:3920: checking where the Alliance package was installed" >&5
echo "configure:4174: checking where the Alliance package was installed" >&5
# Avoid problems with soft links and builtin pwd...
ALLIANCE_TOP=`$PWDBIN | sed 's§share/etc$§archi§'`
ALLIANCE_TOP=`echo $ALLIANCE_TOP | sed 's§archi/Cygwin/etc$§archi§'`

View File

@ -6,14 +6,14 @@
# Copyright (C) 1997, 2000 Czo <Olivier.Sirol@lip6.fr>
# License: GPL (http://www.gnu.org/copyleft/gpl.html)
# Started: Feb 1997
# Last Change: Thursday 25 October 2001, 11:23
# Edit Time: 5:06:06
# Last Change: Thursday 24 January 2002, 16:43
# Edit Time: 5:33:45
# Description: Alliance CAD system configure.in
#
# $Id: configure.in,v 1.25 2001/10/25 09:28:34 czo Exp $
# $Id: configure.in,v 1.26 2002/01/24 15:45:29 czo Exp $
#
AC_REVISION($Revision: 1.25 $)dnl
AC_REVISION($Revision: 1.26 $)dnl
AC_INIT(configure.in)
@ -501,7 +501,17 @@ AC_STDC_HEADERS
################################################################### OS specific...
AC_MSG_CHECKING(SA_RESTART)
vfork=vfork
AC_FUNC_VFORK
AC_MSG_CHECKING(AUTO_HAS_VFORK)
if test $vfork = fork; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AUTO_HAS="$AUTO_HAS -DAUTO_HAS_VFORK"
fi
AC_MSG_CHECKING(AUTO_HAS_SA_RESTART)
AC_TRY_LINK([#include <stdio.h>
#include <stdlib.h>
#include <signal.h>],
@ -511,7 +521,7 @@ sigaction( SIGCHLD, &sgct , NULL );],
AC_MSG_RESULT(yes); AUTO_HAS="$AUTO_HAS -DAUTO_HAS_SA_RESTART",
AC_MSG_RESULT(no))
AC_MSG_CHECKING(DRAND48)
AC_MSG_CHECKING(AUTO_HAS_DRAND48)
AC_TRY_LINK([#include <stdio.h>
#include <stdlib.h>],
[ double Proba;
@ -519,7 +529,7 @@ AC_TRY_LINK([#include <stdio.h>
AC_MSG_RESULT(yes); AUTO_HAS="$AUTO_HAS -DAUTO_HAS_DRAND48",
AC_MSG_RESULT(no))
AC_MSG_CHECKING(VALUES_H)
AC_MSG_CHECKING(AUTO_HAS_VALUES_H)
AC_TRY_LINK([#include <stdio.h>
#include <stdlib.h>
#include <values.h>],