aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rwxr-xr-xconfigure250
2 files changed, 251 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b8b88d078c..1d1d06a133f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12000-02-12 Dave Love <fx@gnu.org>
2
3 * configure.in: Use AC_FUNC_VFORK.
4
12000-02-01 Gerd Moellmann <gerd@gnu.org> 52000-02-01 Gerd Moellmann <gerd@gnu.org>
2 6
3 * make-dist: Various fixes for new development tree. 7 * make-dist: Various fixes for new development tree.
diff --git a/configure b/configure
index 216cf5ad1c3..aaf28ea5b95 100755
--- a/configure
+++ b/configure
@@ -1392,7 +1392,7 @@ case "${canonical}" in
1392 # so that, for instance, grepping for `free' in stdlib.h fails and 1392 # so that, for instance, grepping for `free' in stdlib.h fails and
1393 # AC_HEADER_STD_C fails. (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m). 1393 # AC_HEADER_STD_C fails. (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m).
1394 NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C" 1394 NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
1395 NON_GCC_TEST_OPTIONS="-n32 -G0 -D_LANGUAGE_C" 1395 NON_GCC_TEST_OPTIONS="-n32 -D_LANGUAGE_C"
1396 ;; 1396 ;;
1397 mips-sgi-irix6* ) 1397 mips-sgi-irix6* )
1398 machine=iris4d opsys=irix6-0 1398 machine=iris4d opsys=irix6-0
@@ -2733,7 +2733,7 @@ else
2733int main() { 2733int main() {
2734 2734
2735/* Ultrix mips cc rejects this. */ 2735/* Ultrix mips cc rejects this. */
2736typedef int charset[2]; const charset x; 2736typedef int charset[2]; const charset x = {0,0};
2737/* SunOS 4.1.1 cc rejects this. */ 2737/* SunOS 4.1.1 cc rejects this. */
2738char const *const *ccp; 2738char const *const *ccp;
2739char **p; 2739char **p;
@@ -4676,7 +4676,7 @@ else
4676#include "confdefs.h" 4676#include "confdefs.h"
4677#include <alloca.h> 4677#include <alloca.h>
4678int main() { 4678int main() {
4679char *p = alloca(2 * sizeof(int)); 4679void *p = alloca(2 * sizeof(int));
4680; return 0; } 4680; return 0; }
4681EOF 4681EOF
4682if { (eval echo configure:4683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then 4682if { (eval echo configure:4683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
@@ -6321,6 +6321,250 @@ else
6321 echo "$ac_t""no" 1>&6 6321 echo "$ac_t""no" 1>&6
6322fi 6322fi
6323 6323
6324echo $ac_n "checking for pid_t""... $ac_c" 1>&6
6325echo "configure:6326: checking for pid_t" >&5
6326if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
6327 echo $ac_n "(cached) $ac_c" 1>&6
6328else
6329 cat > conftest.$ac_ext <<EOF
6330#line 6331 "configure"
6331#include "confdefs.h"
6332#include <sys/types.h>
6333#if STDC_HEADERS
6334#include <stdlib.h>
6335#include <stddef.h>
6336#endif
6337EOF
6338if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
6339 egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
6340 rm -rf conftest*
6341 ac_cv_type_pid_t=yes
6342else
6343 rm -rf conftest*
6344 ac_cv_type_pid_t=no
6345fi
6346rm -f conftest*
6347
6348fi
6349echo "$ac_t""$ac_cv_type_pid_t" 1>&6
6350if test $ac_cv_type_pid_t = no; then
6351 cat >> confdefs.h <<\EOF
6352#define pid_t int
6353EOF
6354
6355fi
6356
6357ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
6358echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
6359echo "configure:6360: checking for vfork.h" >&5
6360if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
6361 echo $ac_n "(cached) $ac_c" 1>&6
6362else
6363 cat > conftest.$ac_ext <<EOF
6364#line 6365 "configure"
6365#include "confdefs.h"
6366#include <vfork.h>
6367EOF
6368ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
6369{ (eval echo configure:6370: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
6370ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
6371if test -z "$ac_err"; then
6372 rm -rf conftest*
6373 eval "ac_cv_header_$ac_safe=yes"
6374else
6375 echo "$ac_err" >&5
6376 echo "configure: failed program was:" >&5
6377 cat conftest.$ac_ext >&5
6378 rm -rf conftest*
6379 eval "ac_cv_header_$ac_safe=no"
6380fi
6381rm -f conftest*
6382fi
6383if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
6384 echo "$ac_t""yes" 1>&6
6385 cat >> confdefs.h <<\EOF
6386#define HAVE_VFORK_H 1
6387EOF
6388
6389else
6390 echo "$ac_t""no" 1>&6
6391fi
6392
6393echo $ac_n "checking for working vfork""... $ac_c" 1>&6
6394echo "configure:6395: checking for working vfork" >&5
6395if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
6396 echo $ac_n "(cached) $ac_c" 1>&6
6397else
6398 if test "$cross_compiling" = yes; then
6399 echo $ac_n "checking for vfork""... $ac_c" 1>&6
6400echo "configure:6401: checking for vfork" >&5
6401if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
6402 echo $ac_n "(cached) $ac_c" 1>&6
6403else
6404 cat > conftest.$ac_ext <<EOF
6405#line 6406 "configure"
6406#include "confdefs.h"
6407/* System header to define __stub macros and hopefully few prototypes,
6408 which can conflict with char vfork(); below. */
6409#include <assert.h>
6410/* Override any gcc2 internal prototype to avoid an error. */
6411/* We use char because int might match the return type of a gcc2
6412 builtin and then its argument prototype would still apply. */
6413char vfork();
6414
6415int main() {
6416
6417/* The GNU C library defines this for functions which it implements
6418 to always fail with ENOSYS. Some functions are actually named
6419 something starting with __ and the normal name is an alias. */
6420#if defined (__stub_vfork) || defined (__stub___vfork)
6421choke me
6422#else
6423vfork();
6424#endif
6425
6426; return 0; }
6427EOF
6428if { (eval echo configure:6429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
6429 rm -rf conftest*
6430 eval "ac_cv_func_vfork=yes"
6431else
6432 echo "configure: failed program was:" >&5
6433 cat conftest.$ac_ext >&5
6434 rm -rf conftest*
6435 eval "ac_cv_func_vfork=no"
6436fi
6437rm -f conftest*
6438fi
6439
6440if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then
6441 echo "$ac_t""yes" 1>&6
6442 :
6443else
6444 echo "$ac_t""no" 1>&6
6445fi
6446
6447ac_cv_func_vfork_works=$ac_cv_func_vfork
6448else
6449 cat > conftest.$ac_ext <<EOF
6450#line 6451 "configure"
6451#include "confdefs.h"
6452/* Thanks to Paul Eggert for this test. */
6453#include <stdio.h>
6454#include <sys/types.h>
6455#include <sys/stat.h>
6456#ifdef HAVE_UNISTD_H
6457#include <unistd.h>
6458#endif
6459#ifdef HAVE_VFORK_H
6460#include <vfork.h>
6461#endif
6462/* On some sparc systems, changes by the child to local and incoming
6463 argument registers are propagated back to the parent.
6464 The compiler is told about this with #include <vfork.h>,
6465 but some compilers (e.g. gcc -O) don't grok <vfork.h>.
6466 Test for this by using a static variable whose address
6467 is put into a register that is clobbered by the vfork. */
6468static
6469#ifdef __cplusplus
6470sparc_address_test (int arg)
6471#else
6472sparc_address_test (arg) int arg;
6473#endif
6474{
6475 static pid_t child;
6476 if (!child) {
6477 child = vfork ();
6478 if (child < 0) {
6479 perror ("vfork");
6480 _exit(2);
6481 }
6482 if (!child) {
6483 arg = getpid();
6484 write(-1, "", 0);
6485 _exit (arg);
6486 }
6487 }
6488}
6489main() {
6490 pid_t parent = getpid ();
6491 pid_t child;
6492
6493 sparc_address_test ();
6494
6495 child = vfork ();
6496
6497 if (child == 0) {
6498 /* Here is another test for sparc vfork register problems.
6499 This test uses lots of local variables, at least
6500 as many local variables as main has allocated so far
6501 including compiler temporaries. 4 locals are enough for
6502 gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
6503 A buggy compiler should reuse the register of parent
6504 for one of the local variables, since it will think that
6505 parent can't possibly be used any more in this routine.
6506 Assigning to the local variable will thus munge parent
6507 in the parent process. */
6508 pid_t
6509 p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
6510 p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
6511 /* Convince the compiler that p..p7 are live; otherwise, it might
6512 use the same hardware register for all 8 local variables. */
6513 if (p != p1 || p != p2 || p != p3 || p != p4
6514 || p != p5 || p != p6 || p != p7)
6515 _exit(1);
6516
6517 /* On some systems (e.g. IRIX 3.3),
6518 vfork doesn't separate parent from child file descriptors.
6519 If the child closes a descriptor before it execs or exits,
6520 this munges the parent's descriptor as well.
6521 Test for this by closing stdout in the child. */
6522 _exit(close(fileno(stdout)) != 0);
6523 } else {
6524 int status;
6525 struct stat st;
6526
6527 while (wait(&status) != child)
6528 ;
6529 exit(
6530 /* Was there some problem with vforking? */
6531 child < 0
6532
6533 /* Did the child fail? (This shouldn't happen.) */
6534 || status
6535
6536 /* Did the vfork/compiler bug occur? */
6537 || parent != getpid()
6538
6539 /* Did the file descriptor bug occur? */
6540 || fstat(fileno(stdout), &st) != 0
6541 );
6542 }
6543}
6544EOF
6545if { (eval echo configure:6546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
6546then
6547 ac_cv_func_vfork_works=yes
6548else
6549 echo "configure: failed program was:" >&5
6550 cat conftest.$ac_ext >&5
6551 rm -fr conftest*
6552 ac_cv_func_vfork_works=no
6553fi
6554rm -fr conftest*
6555fi
6556
6557fi
6558
6559echo "$ac_t""$ac_cv_func_vfork_works" 1>&6
6560if test $ac_cv_func_vfork_works = no; then
6561 cat >> confdefs.h <<\EOF
6562#define vfork fork
6563EOF
6564
6565fi
6566
6567
6324# Set up the CFLAGS for real compilation, so we can substitute it. 6568# Set up the CFLAGS for real compilation, so we can substitute it.
6325CFLAGS="$REAL_CFLAGS" 6569CFLAGS="$REAL_CFLAGS"
6326 6570