comparison configure @ 31409:73b83b52b9cd

*** empty log message ***
author Gerd Moellmann <gerd@gnu.org>
date Wed, 06 Sep 2000 12:22:09 +0000
parents 298f3aff1431
children a902ad11827b
comparison
equal deleted inserted replaced
31408:8ef60c20e6ce 31409:73b83b52b9cd
8420 #define vfork fork 8420 #define vfork fork
8421 EOF 8421 EOF
8422 8422
8423 fi 8423 fi
8424 8424
8425 for ac_hdr in unistd.h
8426 do
8427 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
8428 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
8429 echo "configure:8430: checking for $ac_hdr" >&5
8430 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
8431 echo $ac_n "(cached) $ac_c" 1>&6
8432 else
8433 cat > conftest.$ac_ext <<EOF
8434 #line 8435 "configure"
8435 #include "confdefs.h"
8436 #include <$ac_hdr>
8437 EOF
8438 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
8439 { (eval echo configure:8440: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
8440 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
8441 if test -z "$ac_err"; then
8442 rm -rf conftest*
8443 eval "ac_cv_header_$ac_safe=yes"
8444 else
8445 echo "$ac_err" >&5
8446 echo "configure: failed program was:" >&5
8447 cat conftest.$ac_ext >&5
8448 rm -rf conftest*
8449 eval "ac_cv_header_$ac_safe=no"
8450 fi
8451 rm -f conftest*
8452 fi
8453 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
8454 echo "$ac_t""yes" 1>&6
8455 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
8456 cat >> confdefs.h <<EOF
8457 #define $ac_tr_hdr 1
8458 EOF
8459
8460 else
8461 echo "$ac_t""no" 1>&6
8462 fi
8463 done
8464
8465 for ac_func in getpagesize
8466 do
8467 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
8468 echo "configure:8469: checking for $ac_func" >&5
8469 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
8470 echo $ac_n "(cached) $ac_c" 1>&6
8471 else
8472 cat > conftest.$ac_ext <<EOF
8473 #line 8474 "configure"
8474 #include "confdefs.h"
8475 /* System header to define __stub macros and hopefully few prototypes,
8476 which can conflict with char $ac_func(); below. */
8477 #include <assert.h>
8478 /* Override any gcc2 internal prototype to avoid an error. */
8479 /* We use char because int might match the return type of a gcc2
8480 builtin and then its argument prototype would still apply. */
8481 char $ac_func();
8482
8483 int main() {
8484
8485 /* The GNU C library defines this for functions which it implements
8486 to always fail with ENOSYS. Some functions are actually named
8487 something starting with __ and the normal name is an alias. */
8488 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
8489 choke me
8490 #else
8491 $ac_func();
8492 #endif
8493
8494 ; return 0; }
8495 EOF
8496 if { (eval echo configure:8497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
8497 rm -rf conftest*
8498 eval "ac_cv_func_$ac_func=yes"
8499 else
8500 echo "configure: failed program was:" >&5
8501 cat conftest.$ac_ext >&5
8502 rm -rf conftest*
8503 eval "ac_cv_func_$ac_func=no"
8504 fi
8505 rm -f conftest*
8506 fi
8507
8508 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
8509 echo "$ac_t""yes" 1>&6
8510 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
8511 cat >> confdefs.h <<EOF
8512 #define $ac_tr_func 1
8513 EOF
8514
8515 else
8516 echo "$ac_t""no" 1>&6
8517 fi
8518 done
8519
8520 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
8521 echo "configure:8522: checking for working mmap" >&5
8522 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
8523 echo $ac_n "(cached) $ac_c" 1>&6
8524 else
8525 if test "$cross_compiling" = yes; then
8526 ac_cv_func_mmap_fixed_mapped=no
8527 else
8528 cat > conftest.$ac_ext <<EOF
8529 #line 8530 "configure"
8530 #include "confdefs.h"
8531
8532 /* Thanks to Mike Haertel and Jim Avera for this test.
8533 Here is a matrix of mmap possibilities:
8534 mmap private not fixed
8535 mmap private fixed at somewhere currently unmapped
8536 mmap private fixed at somewhere already mapped
8537 mmap shared not fixed
8538 mmap shared fixed at somewhere currently unmapped
8539 mmap shared fixed at somewhere already mapped
8540 For private mappings, we should verify that changes cannot be read()
8541 back from the file, nor mmap's back from the file at a different
8542 address. (There have been systems where private was not correctly
8543 implemented like the infamous i386 svr4.0, and systems where the
8544 VM page cache was not coherent with the filesystem buffer cache
8545 like early versions of FreeBSD and possibly contemporary NetBSD.)
8546 For shared mappings, we should conversely verify that changes get
8547 propogated back to all the places they're supposed to be.
8548
8549 Grep wants private fixed already mapped.
8550 The main things grep needs to know about mmap are:
8551 * does it exist and is it safe to write into the mmap'd area
8552 * how to use it (BSD variants) */
8553 #include <sys/types.h>
8554 #include <fcntl.h>
8555 #include <sys/mman.h>
8556
8557 /* This mess was copied from the GNU getpagesize.h. */
8558 #ifndef HAVE_GETPAGESIZE
8559 # ifdef HAVE_UNISTD_H
8560 # include <unistd.h>
8561 # endif
8562
8563 /* Assume that all systems that can run configure have sys/param.h. */
8564 # ifndef HAVE_SYS_PARAM_H
8565 # define HAVE_SYS_PARAM_H 1
8566 # endif
8567
8568 # ifdef _SC_PAGESIZE
8569 # define getpagesize() sysconf(_SC_PAGESIZE)
8570 # else /* no _SC_PAGESIZE */
8571 # ifdef HAVE_SYS_PARAM_H
8572 # include <sys/param.h>
8573 # ifdef EXEC_PAGESIZE
8574 # define getpagesize() EXEC_PAGESIZE
8575 # else /* no EXEC_PAGESIZE */
8576 # ifdef NBPG
8577 # define getpagesize() NBPG * CLSIZE
8578 # ifndef CLSIZE
8579 # define CLSIZE 1
8580 # endif /* no CLSIZE */
8581 # else /* no NBPG */
8582 # ifdef NBPC
8583 # define getpagesize() NBPC
8584 # else /* no NBPC */
8585 # ifdef PAGESIZE
8586 # define getpagesize() PAGESIZE
8587 # endif /* PAGESIZE */
8588 # endif /* no NBPC */
8589 # endif /* no NBPG */
8590 # endif /* no EXEC_PAGESIZE */
8591 # else /* no HAVE_SYS_PARAM_H */
8592 # define getpagesize() 8192 /* punt totally */
8593 # endif /* no HAVE_SYS_PARAM_H */
8594 # endif /* no _SC_PAGESIZE */
8595
8596 #endif /* no HAVE_GETPAGESIZE */
8597
8598 #ifdef __cplusplus
8599 extern "C" { void *malloc(unsigned); }
8600 #else
8601 char *malloc();
8602 #endif
8603
8604 int
8605 main()
8606 {
8607 char *data, *data2, *data3;
8608 int i, pagesize;
8609 int fd;
8610
8611 pagesize = getpagesize();
8612
8613 /*
8614 * First, make a file with some known garbage in it.
8615 */
8616 data = malloc(pagesize);
8617 if (!data)
8618 exit(1);
8619 for (i = 0; i < pagesize; ++i)
8620 *(data + i) = rand();
8621 umask(0);
8622 fd = creat("conftestmmap", 0600);
8623 if (fd < 0)
8624 exit(1);
8625 if (write(fd, data, pagesize) != pagesize)
8626 exit(1);
8627 close(fd);
8628
8629 /*
8630 * Next, try to mmap the file at a fixed address which
8631 * already has something else allocated at it. If we can,
8632 * also make sure that we see the same garbage.
8633 */
8634 fd = open("conftestmmap", O_RDWR);
8635 if (fd < 0)
8636 exit(1);
8637 data2 = malloc(2 * pagesize);
8638 if (!data2)
8639 exit(1);
8640 data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
8641 if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
8642 MAP_PRIVATE | MAP_FIXED, fd, 0L))
8643 exit(1);
8644 for (i = 0; i < pagesize; ++i)
8645 if (*(data + i) != *(data2 + i))
8646 exit(1);
8647
8648 /*
8649 * Finally, make sure that changes to the mapped area
8650 * do not percolate back to the file as seen by read().
8651 * (This is a bug on some variants of i386 svr4.0.)
8652 */
8653 for (i = 0; i < pagesize; ++i)
8654 *(data2 + i) = *(data2 + i) + 1;
8655 data3 = malloc(pagesize);
8656 if (!data3)
8657 exit(1);
8658 if (read(fd, data3, pagesize) != pagesize)
8659 exit(1);
8660 for (i = 0; i < pagesize; ++i)
8661 if (*(data + i) != *(data3 + i))
8662 exit(1);
8663 close(fd);
8664 unlink("conftestmmap");
8665 exit(0);
8666 }
8667
8668 EOF
8669 if { (eval echo configure:8670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
8670 then
8671 ac_cv_func_mmap_fixed_mapped=yes
8672 else
8673 echo "configure: failed program was:" >&5
8674 cat conftest.$ac_ext >&5
8675 rm -fr conftest*
8676 ac_cv_func_mmap_fixed_mapped=no
8677 fi
8678 rm -fr conftest*
8679 fi
8680
8681 fi
8682
8683 echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
8684 if test $ac_cv_func_mmap_fixed_mapped = yes; then
8685 cat >> confdefs.h <<\EOF
8686 #define HAVE_MMAP 1
8687 EOF
8688
8689 fi
8690
8425 8691
8426 # Fixme: This should be replaced when we have autoconf 2.14. 8692 # Fixme: This should be replaced when we have autoconf 2.14.
8427 echo $ac_n "checking for size_t""... $ac_c" 1>&6 8693 echo $ac_n "checking for size_t""... $ac_c" 1>&6
8428 echo "configure:8429: checking for size_t" >&5 8694 echo "configure:8695: checking for size_t" >&5
8429 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then 8695 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
8430 echo $ac_n "(cached) $ac_c" 1>&6 8696 echo $ac_n "(cached) $ac_c" 1>&6
8431 else 8697 else
8432 cat > conftest.$ac_ext <<EOF 8698 cat > conftest.$ac_ext <<EOF
8433 #line 8434 "configure" 8699 #line 8700 "configure"
8434 #include "confdefs.h" 8700 #include "confdefs.h"
8435 #include <sys/types.h> 8701 #include <sys/types.h>
8436 #if STDC_HEADERS 8702 #if STDC_HEADERS
8437 #include <stdlib.h> 8703 #include <stdlib.h>
8438 #include <stddef.h> 8704 #include <stddef.h>