#!/bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] # [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE[=VALUE]] # Ignores all args except --srcdir, --prefix, --exec-prefix, and # --with-PACKAGE[=VALUE] unless this script has special code to handle it. for arg do # Handle --exec-prefix with a space before the argument. if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix= # Handle --host with a space before the argument. elif test x$next_host = xyes; then next_host= # Handle --prefix with a space before the argument. elif test x$next_prefix = xyes; then prefix=$arg; next_prefix= # Handle --srcdir with a space before the argument. elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir= else case $arg in # For backward compatibility, recognize -exec-prefix and --exec_prefix. -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*) exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e) next_exec_prefix=yes ;; -gas | --gas | --ga | --g) ;; -host=* | --host=* | --hos=* | --ho=* | --h=*) ;; -host | --host | --hos | --ho | --h) next_host=yes ;; -nfp | --nfp | --nf) ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) next_prefix=yes ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*) srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s) next_srcdir=yes ;; -with-* | --with-*) package=`echo $arg|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that aren't valid shell variable names. if test -n "`echo $package| sed 's/[-a-zA-Z0-9_]//g'`"; then echo "configure: $package: invalid package name" >&2; exit 1 fi package=`echo $package| sed 's/-/_/g'` case "$arg" in *=*) val="`echo $arg|sed 's/[^=]*=//'`" ;; *) val=1 ;; esac eval "with_$package='$val'" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v) verbose=yes ;; *) ;; esac fi done trap 'rm -fr conftest* confdefs* core; exit 1' 1 3 15 trap 'rm -f confdefs*' 0 # NLS nuisances. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi if test "${LANG+set}" = 'set' ; then LANG=C; export LANG; fi rm -f conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1' # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. unique_file=prolang.y # Find the source files, if location was not specified. if test -z "$srcdir"; then srcdirdefaulted=yes # Try the directory containing this script, then `..'. prog=$0 confdir=`echo $prog|sed 's%/[^/][^/]*$%%'` test "X$confdir" = "X$prog" && confdir=. srcdir=$confdir if test ! -r $srcdir/$unique_file; then srcdir=.. fi fi if test ! -r $srcdir/$unique_file; then if test x$srcdirdefaulted = xyes; then echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2 else echo "configure: Can not find sources in \`${srcdir}'." 1>&2 fi exit 1 fi # Preserve a srcdir of `.' to avoid automounter screwups with pwd. # But we can't avoid them for `..', to make subdirectories work. case $srcdir in .|/*|~*) ;; *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute. esac # Save the original args to write them into config.status later. configure_args="$*" if test -z "$CC"; then # Extract the first word of `gcc', so it can be a program name with args. set dummy gcc; word=$2 echo checking for $word IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/$word; then CC="gcc" break fi done IFS="$saveifs" fi test -z "$CC" && CC="cc" test -n "$CC" && test -n "$verbose" && echo " setting CC to $CC" # Find out if we are using GNU C, under whatever name. cat > conftest.c <<EOF #ifdef __GNUC__ yes #endif EOF ${CC-cc} -E conftest.c > conftest.out 2>&1 if egrep yes conftest.out >/dev/null 2>&1; then GCC=1 # For later tests. fi rm -f conftest* echo checking for "gcc/assembler float incompatibility, e.g. on AIX" cat > conftest.c <<EOF #include "confdefs.h" double d = 4.5; int main() { exit(0); } int t() { double e = 1.3; e/= 0.2; } EOF if eval $compile; then : else rm -rf conftest* echo "falling back to cc" CC="cc" fi rm -f conftest* # Make sure to not get the incompatible SysV /etc/install and # /usr/sbin/install, which might be in PATH before a BSD-like install, # or the SunOS /usr/etc/install directory, or the AIX /bin/install, # or the AFS install, which mishandles nonexistent args, or # /usr/ucb/install on SVR4, which tries to use the nonexistent group # `staff'. On most BSDish systems install is in /usr/bin, not /usr/ucb # anyway. Sigh. if test "z${INSTALL}" = "z" ; then echo checking for install IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" for dir in $PATH; do test -z "$dir" && dir=. case $dir in /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;; *) if test -f $dir/installbsd; then INSTALL="$dir/installbsd -c" # OSF1 INSTALL_PROGRAM='$(INSTALL)' INSTALL_DATA='$(INSTALL) -m 644' break fi if test -f $dir/install; then if grep dspmsg $dir/install >/dev/null 2>&1; then : # AIX else INSTALL="$dir/install -c" INSTALL_PROGRAM='$(INSTALL)' INSTALL_DATA='$(INSTALL) -m 644' break fi fi ;; esac done IFS="$saveifs" fi INSTALL=${INSTALL-cp} test -n "$verbose" && echo " setting INSTALL to $INSTALL" INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'} test -n "$verbose" && echo " setting INSTALL_PROGRAM to $INSTALL_PROGRAM" INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'} test -n "$verbose" && echo " setting INSTALL_DATA to $INSTALL_DATA" for p in byacc do if test -z "$YACC"; then # Extract the first word of `$p', so it can be a program name with args. set dummy $p; word=$2 echo checking for $word IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/$word; then YACC="$p" break fi done IFS="$saveifs" fi test -n "$YACC" && test -n "$verbose" && echo " setting YACC to $YACC" test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" for hdr in sys/rusage.h sys/time.h unistd.h stdlib.h libc.h memory.h do trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'` echo checking for ${hdr} echo checking how to run the C preprocessor if test -z "$CPP"; then # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and ``${CC-cc}'' will simply confuse # make. It must be expanded now. CPP="${CC-cc} -E" cat > conftest.c <<EOF #include "confdefs.h" #include <stdio.h> Syntax Error EOF err=`eval "($CPP conftest.c >/dev/null) 2>&1"` if test -z "$err"; then : else rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi test ".${verbose}" != "." && echo " setting CPP to $CPP" cat > conftest.c <<EOF #include "confdefs.h" #include <${hdr}> EOF err=`eval "($CPP conftest.c >/dev/null) 2>&1"` if test -z "$err"; then rm -rf conftest* { test -n "$verbose" && \ echo " defining ${trhdr}" echo "#define" ${trhdr} 1 >> confdefs.h DEFS="$DEFS -D${trhdr}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD} \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD} \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD} " } fi rm -f conftest* done for hdr in values.h string.h bstring.h do trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'` echo checking for ${hdr} cat > conftest.c <<EOF #include "confdefs.h" #include <${hdr}> EOF err=`eval "($CPP conftest.c >/dev/null) 2>&1"` if test -z "$err"; then rm -rf conftest* { test -n "$verbose" && \ echo " defining ${trhdr}" echo "#define" ${trhdr} 1 >> confdefs.h DEFS="$DEFS -D${trhdr}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD} \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD} \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD} " } fi rm -f conftest* done echo checking for ANSI C header files cat > conftest.c <<EOF #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <float.h> EOF err=`eval "($CPP conftest.c >/dev/null) 2>&1"` if test -z "$err"; then rm -rf conftest* # SunOS 4.x string.h does not declare mem*, contrary to ANSI. echo '#include "confdefs.h" #include <string.h>' > conftest.c eval "$CPP conftest.c > conftest.out 2>&1" if egrep "memchr" conftest.out >/dev/null 2>&1; then rm -rf conftest* # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. cat > conftest.c <<EOF #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e,f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then { test -n "$verbose" && \ echo " defining STDC_HEADERS" echo "#define" STDC_HEADERS 1 >> confdefs.h DEFS="$DEFS -DSTDC_HEADERS=1" SEDDEFS="${SEDDEFS}\${SEDdA}STDC_HEADERS\${SEDdB}STDC_HEADERS\${SEDdC}1\${SEDdD} \${SEDuA}STDC_HEADERS\${SEDuB}STDC_HEADERS\${SEDuC}1\${SEDuD} \${SEDeA}STDC_HEADERS\${SEDeB}STDC_HEADERS\${SEDeC}1\${SEDeD} " } fi rm -fr conftest* fi rm -f conftest* fi rm -f conftest* echo checking for directory library header dirheader= if test -z "$dirheader"; then echo checking for dirent.h cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> #include <dirent.h> int main() { exit(0); } int t() { DIR *dirp = 0; } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining DIRENT" echo "#define" DIRENT 1 >> confdefs.h DEFS="$DEFS -DDIRENT=1" SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD} \${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD} \${SEDeA}DIRENT\${SEDeB}DIRENT\${SEDeC}1\${SEDeD} " } dirheader=dirent.h fi rm -f conftest* fi if test -z "$dirheader"; then echo checking for sys/ndir.h cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> #include <sys/ndir.h> int main() { exit(0); } int t() { DIR *dirp = 0; } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining SYSNDIR" echo "#define" SYSNDIR 1 >> confdefs.h DEFS="$DEFS -DSYSNDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD} \${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD} \${SEDeA}SYSNDIR\${SEDeB}SYSNDIR\${SEDeC}1\${SEDeD} " } dirheader=sys/ndir.h fi rm -f conftest* fi if test -z "$dirheader"; then echo checking for sys/dir.h cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> #include <sys/dir.h> int main() { exit(0); } int t() { DIR *dirp = 0; } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining SYSDIR" echo "#define" SYSDIR 1 >> confdefs.h DEFS="$DEFS -DSYSDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD} \${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD} \${SEDeA}SYSDIR\${SEDeB}SYSDIR\${SEDeC}1\${SEDeD} " } dirheader=sys/dir.h fi rm -f conftest* fi if test -z "$dirheader"; then echo checking for ndir.h cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> #include <ndir.h> int main() { exit(0); } int t() { DIR *dirp = 0; } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining NDIR" echo "#define" NDIR 1 >> confdefs.h DEFS="$DEFS -DNDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD} \${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD} \${SEDeA}NDIR\${SEDeB}NDIR\${SEDeC}1\${SEDeD} " } dirheader=ndir.h fi rm -f conftest* fi echo checking for closedir return value cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> #include <$dirheader> int closedir(); main() { exit(closedir(opendir(".")) != 0); } EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then : else { test -n "$verbose" && \ echo " defining VOID_CLOSEDIR" echo "#define" VOID_CLOSEDIR 1 >> confdefs.h DEFS="$DEFS -DVOID_CLOSEDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD} \${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD} \${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD} " } fi rm -fr conftest* echo checking for "sizeof(char *) == 4" cat > conftest.c <<EOF #include "confdefs.h" int i = 8/(sizeof(char *) - 4); int main() { exit(0); } int t() { } EOF if eval $compile; then rm -rf conftest* echo checking for "sizeof(char *) == 8" cat > conftest.c <<EOF #include "confdefs.h" int i = 8/(sizeof(char *) - 8); int main() { exit(0); } int t() { } EOF if eval $compile; then : else rm -rf conftest* { test -n "$verbose" && \ echo " defining" SIZEOF_P_INT to be 8 echo "#define" SIZEOF_P_INT 8 >> confdefs.h DEFS="$DEFS -DSIZEOF_P_INT=8" SEDDEFS="${SEDDEFS}\${SEDdA}SIZEOF_P_INT\${SEDdB}SIZEOF_P_INT\${SEDdC}8\${SEDdD} \${SEDuA}SIZEOF_P_INT\${SEDuB}SIZEOF_P_INT\${SEDuC}8\${SEDuD} \${SEDeA}SIZEOF_P_INT\${SEDeB}SIZEOF_P_INT\${SEDeC}8\${SEDeD} " } fi rm -f conftest* else rm -rf conftest* { test -n "$verbose" && \ echo " defining" SIZEOF_P_INT to be 4 echo "#define" SIZEOF_P_INT 4 >> confdefs.h DEFS="$DEFS -DSIZEOF_P_INT=4" SEDDEFS="${SEDDEFS}\${SEDdA}SIZEOF_P_INT\${SEDdB}SIZEOF_P_INT\${SEDdC}4\${SEDdD} \${SEDuA}SIZEOF_P_INT\${SEDuB}SIZEOF_P_INT\${SEDuC}4\${SEDuD} \${SEDeA}SIZEOF_P_INT\${SEDeB}SIZEOF_P_INT\${SEDeC}4\${SEDeD} " } fi rm -f conftest* echo checking for "sizeof(int) == 2" cat > conftest.c <<EOF #include "confdefs.h" int i = 8/(sizeof(int) - 2); int main() { exit(0); } int t() { } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining" SIZEOF_INT to be 4 echo "#define" SIZEOF_INT 4 >> confdefs.h DEFS="$DEFS -DSIZEOF_INT=4" SEDDEFS="${SEDDEFS}\${SEDdA}SIZEOF_INT\${SEDdB}SIZEOF_INT\${SEDdC}4\${SEDdD} \${SEDuA}SIZEOF_INT\${SEDuB}SIZEOF_INT\${SEDuC}4\${SEDuD} \${SEDeA}SIZEOF_INT\${SEDeB}SIZEOF_INT\${SEDeC}4\${SEDeD} " } else rm -rf conftest* { test -n "$verbose" && \ echo " defining" SIZEOF_INT to be 2 echo "#define" SIZEOF_INT 2 >> confdefs.h DEFS="$DEFS -DSIZEOF_INT=2" SEDDEFS="${SEDDEFS}\${SEDdA}SIZEOF_INT\${SEDdB}SIZEOF_INT\${SEDdC}2\${SEDdD} \${SEDuA}SIZEOF_INT\${SEDuB}SIZEOF_INT\${SEDuC}2\${SEDuD} \${SEDeA}SIZEOF_INT\${SEDeB}SIZEOF_INT\${SEDeC}2\${SEDeD} " } fi rm -f conftest* echo checking for "sizeof(long) == 8" cat > conftest.c <<EOF #include "confdefs.h" int i = 8/(sizeof(long) - 8); int main() { exit(0); } int t() { } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining" SIZEOF_LONG to be 4 echo "#define" SIZEOF_LONG 4 >> confdefs.h DEFS="$DEFS -DSIZEOF_LONG=4" SEDDEFS="${SEDDEFS}\${SEDdA}SIZEOF_LONG\${SEDdB}SIZEOF_LONG\${SEDdC}4\${SEDdD} \${SEDuA}SIZEOF_LONG\${SEDuB}SIZEOF_LONG\${SEDuC}4\${SEDuD} \${SEDeA}SIZEOF_LONG\${SEDeB}SIZEOF_LONG\${SEDeC}4\${SEDeD} " } else rm -rf conftest* { test -n "$verbose" && \ echo " defining" SIZEOF_LONG to be 8 echo "#define" SIZEOF_LONG 8 >> confdefs.h DEFS="$DEFS -DSIZEOF_LONG=8" SEDDEFS="${SEDDEFS}\${SEDdA}SIZEOF_LONG\${SEDdB}SIZEOF_LONG\${SEDdC}8\${SEDdD} \${SEDuA}SIZEOF_LONG\${SEDuB}SIZEOF_LONG\${SEDuC}8\${SEDuD} \${SEDeA}SIZEOF_LONG\${SEDeB}SIZEOF_LONG\${SEDeC}8\${SEDeD} " } fi rm -f conftest* echo checking for "needed malloc() alignment" cat > conftest.c <<EOF #include "confdefs.h" int i = 96/(sizeof(struct {double d; char *p; double e;}) - 20); int main() { exit(0); } int t() { } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining" MALLOC_ALIGN to be 8 echo "#define" MALLOC_ALIGN 8 >> confdefs.h DEFS="$DEFS -DMALLOC_ALIGN=8" SEDDEFS="${SEDDEFS}\${SEDdA}MALLOC_ALIGN\${SEDdB}MALLOC_ALIGN\${SEDdC}8\${SEDdD} \${SEDuA}MALLOC_ALIGN\${SEDuB}MALLOC_ALIGN\${SEDuC}8\${SEDuD} \${SEDeA}MALLOC_ALIGN\${SEDeB}MALLOC_ALIGN\${SEDeC}8\${SEDeD} " } else rm -rf conftest* { test -n "$verbose" && \ echo " defining" MALLOC_ALIGN to be 4 echo "#define" MALLOC_ALIGN 4 >> confdefs.h DEFS="$DEFS -DMALLOC_ALIGN=4" SEDDEFS="${SEDDEFS}\${SEDdA}MALLOC_ALIGN\${SEDdB}MALLOC_ALIGN\${SEDdC}4\${SEDdD} \${SEDuA}MALLOC_ALIGN\${SEDuB}MALLOC_ALIGN\${SEDuC}4\${SEDuD} \${SEDeA}MALLOC_ALIGN\${SEDeB}MALLOC_ALIGN\${SEDeC}4\${SEDeD} " } fi rm -f conftest* if test -n "$GCC"; then echo checking for inline cat > conftest.c <<EOF #include "confdefs.h" int main() { exit(0); } int t() { } inline foo() { } EOF if eval $compile; then : else rm -rf conftest* { test -n "$verbose" && \ echo " defining" inline to be __inline echo "#define" inline __inline >> confdefs.h DEFS="$DEFS -Dinline=__inline" SEDDEFS="${SEDDEFS}\${SEDdA}inline\${SEDdB}inline\${SEDdC}__inline\${SEDdD} \${SEDuA}inline\${SEDuB}inline\${SEDuC}__inline\${SEDuD} \${SEDeA}inline\${SEDeB}inline\${SEDeC}__inline\${SEDeD} " } fi rm -f conftest* fi echo checking for size_t in sys/types.h echo '#include "confdefs.h" #include <sys/types.h>' > conftest.c eval "$CPP conftest.c > conftest.out 2>&1" if egrep "size_t" conftest.out >/dev/null 2>&1; then : else rm -rf conftest* { test -n "$verbose" && \ echo " defining" size_t to be unsigned echo "#define" size_t unsigned >> confdefs.h DEFS="$DEFS -Dsize_t=unsigned" SEDDEFS="${SEDDEFS}\${SEDdA}size_t\${SEDdB}size_t\${SEDdC}unsigned\${SEDdD} \${SEDuA}size_t\${SEDuB}size_t\${SEDuC}unsigned\${SEDuD} \${SEDeA}size_t\${SEDeB}size_t\${SEDeC}unsigned\${SEDeD} " } fi rm -f conftest* echo checking for pid_t in sys/types.h echo '#include "confdefs.h" #include <sys/types.h>' > conftest.c eval "$CPP conftest.c > conftest.out 2>&1" if egrep "pid_t" conftest.out >/dev/null 2>&1; then : else rm -rf conftest* { test -n "$verbose" && \ echo " defining" pid_t to be int echo "#define" pid_t int >> confdefs.h DEFS="$DEFS -Dpid_t=int" SEDDEFS="${SEDDEFS}\${SEDdA}pid_t\${SEDdB}pid_t\${SEDdC}int\${SEDdD} \${SEDuA}pid_t\${SEDuB}pid_t\${SEDuC}int\${SEDuD} \${SEDeA}pid_t\${SEDeB}pid_t\${SEDeC}int\${SEDeD} " } fi rm -f conftest* echo checking for return type of signal handlers cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> #include <signal.h> #ifdef signal #undef signal #endif extern void (*signal ()) (); int main() { exit(0); } int t() { int i; } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining" RETSIGTYPE to be void echo "#define" RETSIGTYPE void >> confdefs.h DEFS="$DEFS -DRETSIGTYPE=void" SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}void\${SEDdD} \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}void\${SEDuD} \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}void\${SEDeD} " } else rm -rf conftest* { test -n "$verbose" && \ echo " defining" RETSIGTYPE to be int echo "#define" RETSIGTYPE int >> confdefs.h DEFS="$DEFS -DRETSIGTYPE=int" SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}int\${SEDdD} \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}int\${SEDuD} \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}int\${SEDeD} " } fi rm -f conftest* LIBS_save="${LIBS}" LIBS="${LIBS} -lm" have_lib="" echo checking for -lm cat > conftest.c <<EOF #include "confdefs.h" int main() { exit(0); } int t() { main(); } EOF if eval $compile; then rm -rf conftest* have_lib="1" fi rm -f conftest* LIBS="${LIBS_save}" if test -n "${have_lib}"; then { test -n "$verbose" && \ echo " defining HAVE_LIBM" echo "#define" HAVE_LIBM 1 >> confdefs.h DEFS="$DEFS -DHAVE_LIBM=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LIBM\${SEDdB}HAVE_LIBM\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_LIBM\${SEDuB}HAVE_LIBM\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_LIBM\${SEDeB}HAVE_LIBM\${SEDeC}1\${SEDeD} " } LIBS="${LIBS} -lm" fi LIBS_save="${LIBS}" LIBS="${LIBS} -lsocket" have_lib="" echo checking for -lsocket cat > conftest.c <<EOF #include "confdefs.h" int main() { exit(0); } int t() { main(); } EOF if eval $compile; then rm -rf conftest* have_lib="1" fi rm -f conftest* LIBS="${LIBS_save}" if test -n "${have_lib}"; then { test -n "$verbose" && \ echo " defining HAVE_LIBSOCKET" echo "#define" HAVE_LIBSOCKET 1 >> confdefs.h DEFS="$DEFS -DHAVE_LIBSOCKET=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LIBSOCKET\${SEDdB}HAVE_LIBSOCKET\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_LIBSOCKET\${SEDuB}HAVE_LIBSOCKET\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_LIBSOCKET\${SEDeB}HAVE_LIBSOCKET\${SEDeC}1\${SEDeD} " } LIBS="${LIBS} -lsocket" fi LIBS_save="${LIBS}" LIBS="${LIBS} -lucb" have_lib="" echo checking for -lucb cat > conftest.c <<EOF #include "confdefs.h" int main() { exit(0); } int t() { main(); } EOF if eval $compile; then rm -rf conftest* have_lib="1" fi rm -f conftest* LIBS="${LIBS_save}" if test -n "${have_lib}"; then :; LIBS="$LIBS -lc -lucb" else :; fi case "$DEFS" in *HAVE_LIBSOCKET* | *HAVE_LIBUCB*) LIBS_save="${LIBS}" LIBS="${LIBS} -lnsl" have_lib="" echo checking for -lnsl cat > conftest.c <<EOF #include "confdefs.h" int main() { exit(0); } int t() { main(); } EOF if eval $compile; then rm -rf conftest* have_lib="1" fi rm -f conftest* LIBS="${LIBS_save}" if test -n "${have_lib}"; then { test -n "$verbose" && \ echo " defining HAVE_LIBNSL" echo "#define" HAVE_LIBNSL 1 >> confdefs.h DEFS="$DEFS -DHAVE_LIBNSL=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LIBNSL\${SEDdB}HAVE_LIBNSL\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_LIBNSL\${SEDuB}HAVE_LIBNSL\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_LIBNSL\${SEDeB}HAVE_LIBNSL\${SEDeC}1\${SEDeD} " } LIBS="${LIBS} -lnsl" fi ;; esac # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo checking for working alloca.h cat > conftest.c <<EOF #include "confdefs.h" #include <alloca.h> int main() { exit(0); } int t() { char *p = alloca(2 * sizeof(int)); } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining HAVE_ALLOCA_H" echo "#define" HAVE_ALLOCA_H 1 >> confdefs.h DEFS="$DEFS -DHAVE_ALLOCA_H=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_ALLOCA_H\${SEDdB}HAVE_ALLOCA_H\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_ALLOCA_H\${SEDuB}HAVE_ALLOCA_H\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_ALLOCA_H\${SEDeB}HAVE_ALLOCA_H\${SEDeC}1\${SEDeD} " } fi rm -f conftest* decl="#ifdef __GNUC__ #define alloca __builtin_alloca #else #if HAVE_ALLOCA_H #include <alloca.h> #else #ifdef _AIX #pragma alloca #else char *alloca (); #endif #endif #endif " echo checking for alloca cat > conftest.c <<EOF #include "confdefs.h" $decl int main() { exit(0); } int t() { char *p = (char *) alloca(1); } EOF if eval $compile; then : else rm -rf conftest* alloca_missing=1 cat > conftest.c <<EOF #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) winnitude #else lossage #endif EOF eval "$CPP conftest.c > conftest.out 2>&1" if egrep "winnitude" conftest.out >/dev/null 2>&1; then rm -rf conftest* echo checking for _getb67 cat > conftest.c <<EOF #include "confdefs.h" #include <ctype.h> int main() { exit(0); } int t() { /* 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__getb67) || defined (__stub____getb67) choke me #else /* Override any gcc2 internal prototype to avoid an error. */ extern char _getb67(); _getb67(); #endif } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining" CRAY_STACKSEG_END to be _getb67 echo "#define" CRAY_STACKSEG_END _getb67 >> confdefs.h DEFS="$DEFS -DCRAY_STACKSEG_END=_getb67" SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}_getb67\${SEDdD} \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}_getb67\${SEDuD} \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}_getb67\${SEDeD} " } else rm -rf conftest* echo checking for GETB67 cat > conftest.c <<EOF #include "confdefs.h" #include <ctype.h> int main() { exit(0); } int t() { /* 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_GETB67) || defined (__stub___GETB67) choke me #else /* Override any gcc2 internal prototype to avoid an error. */ extern char GETB67(); GETB67(); #endif } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining" CRAY_STACKSEG_END to be GETB67 echo "#define" CRAY_STACKSEG_END GETB67 >> confdefs.h DEFS="$DEFS -DCRAY_STACKSEG_END=GETB67" SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}GETB67\${SEDdD} \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}GETB67\${SEDuD} \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}GETB67\${SEDeD} " } else rm -rf conftest* echo checking for getb67 cat > conftest.c <<EOF #include "confdefs.h" #include <ctype.h> int main() { exit(0); } int t() { /* 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_getb67) || defined (__stub___getb67) choke me #else /* Override any gcc2 internal prototype to avoid an error. */ extern char getb67(); getb67(); #endif } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining" CRAY_STACKSEG_END to be getb67 echo "#define" CRAY_STACKSEG_END getb67 >> confdefs.h DEFS="$DEFS -DCRAY_STACKSEG_END=getb67" SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}getb67\${SEDdD} \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}getb67\${SEDuD} \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}getb67\${SEDeD} " } fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* if test -n "$alloca_missing"; then # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=alloca.o { test -n "$verbose" && \ echo " defining C_ALLOCA" echo "#define" C_ALLOCA 1 >> confdefs.h DEFS="$DEFS -DC_ALLOCA=1" SEDDEFS="${SEDDEFS}\${SEDdA}C_ALLOCA\${SEDdB}C_ALLOCA\${SEDdC}1\${SEDdD} \${SEDuA}C_ALLOCA\${SEDuB}C_ALLOCA\${SEDuC}1\${SEDuD} \${SEDeA}C_ALLOCA\${SEDeB}C_ALLOCA\${SEDeC}1\${SEDeD} " } echo 'checking stack direction for C alloca' echo checking whether cross-compiling # If we cannot run a trivial program, we must be cross compiling. cat > conftest.c <<EOF #include "confdefs.h" main(){exit(0);} EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then : else cross_compiling=1 fi rm -fr conftest* if test -n "$cross_compiling" then { test -n "$verbose" && \ echo " defining" STACK_DIRECTION to be 0 echo "#define" STACK_DIRECTION 0 >> confdefs.h DEFS="$DEFS -DSTACK_DIRECTION=0" SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}0\${SEDdD} \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}0\${SEDuD} \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}0\${SEDeD} " } else cat > conftest.c <<EOF #include "confdefs.h" find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } main () { exit (find_stack_direction() < 0); } EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then { test -n "$verbose" && \ echo " defining" STACK_DIRECTION to be 1 echo "#define" STACK_DIRECTION 1 >> confdefs.h DEFS="$DEFS -DSTACK_DIRECTION=1" SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}1\${SEDdD} \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}1\${SEDuD} \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}1\${SEDeD} " } else { test -n "$verbose" && \ echo " defining" STACK_DIRECTION to be -1 echo "#define" STACK_DIRECTION -1 >> confdefs.h DEFS="$DEFS -DSTACK_DIRECTION=-1" SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}-1\${SEDdD} \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}-1\${SEDuD} \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}-1\${SEDeD} " } fi fi rm -fr conftest* fi for func in fchmod getrusage bzero memset memcpy memmem strcspn crypt _crypt do trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'` echo checking for ${func} cat > conftest.c <<EOF #include "confdefs.h" #include <ctype.h> int main() { exit(0); } int t() { /* 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_${func}) || defined (__stub___${func}) choke me #else /* Override any gcc2 internal prototype to avoid an error. */ extern char ${func}(); ${func}(); #endif } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining ${trfunc}" echo "#define" ${trfunc} 1 >> confdefs.h DEFS="$DEFS -D${trfunc}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD} \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD} \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD} " } fi rm -f conftest* done for func in strchr strrchr getcwd do trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'` echo checking for ${func} cat > conftest.c <<EOF #include "confdefs.h" #include <ctype.h> int main() { exit(0); } int t() { /* 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_${func}) || defined (__stub___${func}) choke me #else /* Override any gcc2 internal prototype to avoid an error. */ extern char ${func}(); ${func}(); #endif } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining ${trfunc}" echo "#define" ${trfunc} 1 >> confdefs.h DEFS="$DEFS -D${trfunc}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD} \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD} \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD} " } fi rm -f conftest* done echo checking for "inet_ntoa declaration compatibility with ntohl" cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> /* needed for netinet/in.h */ #include <netinet/in.h> #include <arpa/inet.h> int main() { exit(0); } int t() { char *ipname; struct sockaddr_in addr; ipname = inet_ntoa(ntohl(addr.sin_addr)); } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining NTOHL_MATCHES_INET_NTOA" echo "#define" NTOHL_MATCHES_INET_NTOA 1 >> confdefs.h DEFS="$DEFS -DNTOHL_MATCHES_INET_NTOA=1" SEDDEFS="${SEDDEFS}\${SEDdA}NTOHL_MATCHES_INET_NTOA\${SEDdB}NTOHL_MATCHES_INET_NTOA\${SEDdC}1\${SEDdD} \${SEDuA}NTOHL_MATCHES_INET_NTOA\${SEDuB}NTOHL_MATCHES_INET_NTOA\${SEDuC}1\${SEDuD} \${SEDeA}NTOHL_MATCHES_INET_NTOA\${SEDeB}NTOHL_MATCHES_INET_NTOA\${SEDeC}1\${SEDeD} " } fi rm -f conftest* if test -n "$cross_compiling" then echo checking for "inet_ntoa()" cat > conftest.c <<EOF #include "confdefs.h" #if defined(sun) && !defined(__svr4__) #include <sys/types.h> /* needed for netinet/in.h */ #include <netinet/in.h> #include <arpa/inet.h> char *inet_ntoa(ad) struct in_addr ad; { static char addr20; return addr; } #else use inet_ntoa() from the library. #endif int main() { exit(0); } int t() { } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining INET_NTOA_OK" echo "#define" INET_NTOA_OK 1 >> confdefs.h DEFS="$DEFS -DINET_NTOA_OK=1" SEDDEFS="${SEDDEFS}\${SEDdA}INET_NTOA_OK\${SEDdB}INET_NTOA_OK\${SEDdC}1\${SEDdD} \${SEDuA}INET_NTOA_OK\${SEDuB}INET_NTOA_OK\${SEDuC}1\${SEDuD} \${SEDeA}INET_NTOA_OK\${SEDeB}INET_NTOA_OK\${SEDeC}1\${SEDeD} " } fi rm -f conftest* else cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> /* needed for netinet/in.h */ #include <netinet/in.h> #include <arpa/inet.h> main() { char addr1[] = "176.88.1.16"; char addr2[] = "88.176.128.2"; struct in_addr tmp; #ifdef SIZEOF_INT == 4 #define ADDR_TYPE unsigned int #else #define ADDR_TYPE unsigned long #endif *((ADDR_TYPE *)&tmp) = inet_addr(addr1); if (strcmp(addr1, inet_ntoa(tmp))) exit(1); *((ADDR_TYPE *)&tmp) = inet_addr(addr2); if (strcmp(addr2, inet_ntoa(tmp))) exit(1); exit(0); } EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then { test -n "$verbose" && \ echo " defining INET_NTOA_OK" echo "#define" INET_NTOA_OK 1 >> confdefs.h DEFS="$DEFS -DINET_NTOA_OK=1" SEDDEFS="${SEDDEFS}\${SEDdA}INET_NTOA_OK\${SEDdB}INET_NTOA_OK\${SEDdC}1\${SEDdD} \${SEDuA}INET_NTOA_OK\${SEDuB}INET_NTOA_OK\${SEDuC}1\${SEDuD} \${SEDeA}INET_NTOA_OK\${SEDeB}INET_NTOA_OK\${SEDeC}1\${SEDeD} " } fi fi rm -fr conftest* if test -n "$cross_compiling" then { test -n "$verbose" && \ echo " defining RENAME_HANDLES_DIRECTORIES" echo "#define" RENAME_HANDLES_DIRECTORIES 1 >> confdefs.h DEFS="$DEFS -DRENAME_HANDLES_DIRECTORIES=1" SEDDEFS="${SEDDEFS}\${SEDdA}RENAME_HANDLES_DIRECTORIES\${SEDdB}RENAME_HANDLES_DIRECTORIES\${SEDdC}1\${SEDdD} \${SEDuA}RENAME_HANDLES_DIRECTORIES\${SEDuB}RENAME_HANDLES_DIRECTORIES\${SEDuC}1\${SEDuD} \${SEDeA}RENAME_HANDLES_DIRECTORIES\${SEDeB}RENAME_HANDLES_DIRECTORIES\${SEDeC}1\${SEDeD} " } else cat > conftest.c <<EOF #include "confdefs.h" main() { mkdir("conftestdirfrom", 0770); exit(rename("conftestdirfrom", "conftestdirto")); } EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then { test -n "$verbose" && \ echo " defining RENAME_HANDLES_DIRECTORIES" echo "#define" RENAME_HANDLES_DIRECTORIES 1 >> confdefs.h DEFS="$DEFS -DRENAME_HANDLES_DIRECTORIES=1" SEDDEFS="${SEDDEFS}\${SEDdA}RENAME_HANDLES_DIRECTORIES\${SEDdB}RENAME_HANDLES_DIRECTORIES\${SEDdC}1\${SEDdD} \${SEDuA}RENAME_HANDLES_DIRECTORIES\${SEDuB}RENAME_HANDLES_DIRECTORIES\${SEDuC}1\${SEDuD} \${SEDeA}RENAME_HANDLES_DIRECTORIES\${SEDeB}RENAME_HANDLES_DIRECTORIES\${SEDeC}1\${SEDeD} " } (echo "rename ok") fi fi rm -fr conftest* case "$DEFS" in *HAVE_GETRUSAGE*) echo checking for "full availability of struct rusage members" cat > conftest.c <<EOF #include "confdefs.h" #include <sys/time.h> #ifdef HAVE_SYS_RUSAGE_H #include <sys/rusage.h> #endif #include <sys/resource.h> #ifndef RUSAGE_SELF #define RUSAGE_SELF 0 #endif int main() { exit(0); } int t() { struct rusage rus; long *v = (long *)main; getrusage(RUSAGE_SELF, &rus); *v++ = rus.ru_maxrss; *v++ = rus.ru_ixrss; *v++ = rus.ru_idrss; *v++ = rus.ru_isrss; *v++ = rus.ru_minflt; *v++ = rus.ru_majflt; *v++ = rus.ru_nswap; *v++ = rus.ru_inblock; *v++ = rus.ru_oublock; *v++ = rus.ru_msgsnd; *v++ = rus.ru_msgrcv; *v++ = rus.ru_nsignals; *v++ = rus.ru_nvcsw; *v++ = rus.ru_nivcsw; } EOF if eval $compile; then : else rm -rf conftest* { test -n "$verbose" && \ echo " defining GETRUSAGE_RESTRICTED" echo "#define" GETRUSAGE_RESTRICTED 1 >> confdefs.h DEFS="$DEFS -DGETRUSAGE_RESTRICTED=1" SEDDEFS="${SEDDEFS}\${SEDdA}GETRUSAGE_RESTRICTED\${SEDdB}GETRUSAGE_RESTRICTED\${SEDdC}1\${SEDdD} \${SEDuA}GETRUSAGE_RESTRICTED\${SEDuB}GETRUSAGE_RESTRICTED\${SEDuC}1\${SEDuD} \${SEDeA}GETRUSAGE_RESTRICTED\${SEDeB}GETRUSAGE_RESTRICTED\${SEDeC}1\${SEDeD} " } fi rm -f conftest* ;; *) echo checking for "getrusage() via syscall()" cat > conftest.c <<EOF #include "confdefs.h" #include <sys/syscall.h> #include <sys/resource.h> #ifndef RUSAGE_SELF #define RUSAGE_SELF 0 #endif int main() { exit(0); } int t() { struct rusage rus; syscall(SYS_GETRUSAGE, RUSAGE_SELF, rus); } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining GETRUSAGE_VIA_SYSCALL" echo "#define" GETRUSAGE_VIA_SYSCALL 1 >> confdefs.h DEFS="$DEFS -DGETRUSAGE_VIA_SYSCALL=1" SEDDEFS="${SEDDEFS}\${SEDdA}GETRUSAGE_VIA_SYSCALL\${SEDdB}GETRUSAGE_VIA_SYSCALL\${SEDdC}1\${SEDdD} \${SEDuA}GETRUSAGE_VIA_SYSCALL\${SEDuB}GETRUSAGE_VIA_SYSCALL\${SEDuC}1\${SEDuD} \${SEDeA}GETRUSAGE_VIA_SYSCALL\${SEDeB}GETRUSAGE_VIA_SYSCALL\${SEDeC}1\${SEDeD} " } { test -n "$verbose" && \ echo " defining HAVE_GETRUSAGE" echo "#define" HAVE_GETRUSAGE 1 >> confdefs.h DEFS="$DEFS -DHAVE_GETRUSAGE=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETRUSAGE\${SEDdB}HAVE_GETRUSAGE\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_GETRUSAGE\${SEDuB}HAVE_GETRUSAGE\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_GETRUSAGE\${SEDeB}HAVE_GETRUSAGE\${SEDeC}1\${SEDeD} " } fi rm -f conftest* ;; esac echo checking for "return type of free" cat > conftest.c <<EOF #include "confdefs.h" #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #include <memory.h> #endif void free(); int main() { exit(0); } int t() { } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining FREE_RETURNS_VOID" echo "#define" FREE_RETURNS_VOID 1 >> confdefs.h DEFS="$DEFS -DFREE_RETURNS_VOID=1" SEDDEFS="${SEDDEFS}\${SEDdA}FREE_RETURNS_VOID\${SEDdB}FREE_RETURNS_VOID\${SEDdC}1\${SEDdD} \${SEDuA}FREE_RETURNS_VOID\${SEDuB}FREE_RETURNS_VOID\${SEDuC}1\${SEDuD} \${SEDeA}FREE_RETURNS_VOID\${SEDeB}FREE_RETURNS_VOID\${SEDeC}1\${SEDeD} " } fi rm -f conftest* echo checking for void* or char* from malloc cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #include <memory.h> #endif #ifdef __STDC__ #define PROT(x) x #else #define PROT(x) () #endif #define POINTER void * POINTER malloc(size_t); #ifdef FREE_RETURNS_VOID void free PROT((POINTER)); #else int free PROT((POINTER)); #endif int main() { exit(0); } int t() { } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining" POINTER to be void\ * echo "#define" POINTER void\ * >> confdefs.h DEFS="$DEFS -DPOINTER=void\ *" SEDDEFS="${SEDDEFS}\${SEDdA}POINTER\${SEDdB}POINTER\${SEDdC}void *\${SEDdD} \${SEDuA}POINTER\${SEDuB}POINTER\${SEDuC}void *\${SEDuD} \${SEDeA}POINTER\${SEDeB}POINTER\${SEDeC}void *\${SEDeD} " } else rm -rf conftest* { test -n "$verbose" && \ echo " defining" POINTER to be char\ * echo "#define" POINTER char\ * >> confdefs.h DEFS="$DEFS -DPOINTER=char\ *" SEDDEFS="${SEDDEFS}\${SEDdA}POINTER\${SEDdB}POINTER\${SEDdC}char *\${SEDdD} \${SEDuA}POINTER\${SEDuB}POINTER\${SEDuC}char *\${SEDuD} \${SEDeA}POINTER\${SEDeB}POINTER\${SEDeC}char *\${SEDeD} " } fi rm -f conftest* cat > conftest.c <<EOF #include "confdefs.h" #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif int main() { if (strtol("0x1:", (char **)0, 10) > 1) exit(1); exit(0); } EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then : else { test -n "$verbose" && \ echo " defining STRTOL_BROKEN" echo "#define" STRTOL_BROKEN 1 >> confdefs.h DEFS="$DEFS -DSTRTOL_BROKEN=1" SEDDEFS="${SEDDEFS}\${SEDdA}STRTOL_BROKEN\${SEDdB}STRTOL_BROKEN\${SEDdC}1\${SEDdD} \${SEDuA}STRTOL_BROKEN\${SEDuB}STRTOL_BROKEN\${SEDuC}1\${SEDuD} \${SEDeA}STRTOL_BROKEN\${SEDeB}STRTOL_BROKEN\${SEDeC}1\${SEDeD} " } fi rm -fr conftest* if test -n "$cross_compiling" then echo "You have to supply the correct way to set sockets non-blocking by hand." else cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> /* needed for netinet/in.h */ #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <errno.h> #include <sys/ioctl.h> main() { int port, tmp, s; struct sockaddr_in my_sin; struct hostent *hp; char *host_name; host_name = malloc(100); if (gethostname(host_name, 100) == -1) exit(1); hp = gethostbyname(host_name); if (hp == 0) exit(1); memset((char *)&my_sin, '\0', sizeof my_sin); memcpy((char *)&my_sin.sin_addr, hp->h_addr, hp->h_length); my_sin.sin_family = hp->h_addrtype; my_sin.sin_addr.s_addr = INADDR_ANY; alarm(10); for (port = 2000; port < 10000; port++) { my_sin.sin_port = htons((u_short)port); s = socket(hp->h_addrtype, SOCK_STREAM, 0); if (s == -1) exit(1); tmp = 1; if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp)) < 0) exit (1); if (bind(s, (struct sockaddr *)&my_sin, sizeof my_sin) == -1) { if (errno == EADDRINUSE) { close(s); continue; } exit(1); } if (listen(s, 5) == -1) exit(1); tmp = 1; if (ioctl(s, FIONBIO, &tmp) == -1) exit(1); tmp = sizeof my_sin; s = accept(s, (struct sockaddr *)&my_sin, &tmp); if (s == -1) { if (errno == EWOULDBLOCK) exit(0); if (errno == EAGAIN) exit(0); if (errno == EINTR) { close(s); continue; } } break; } exit(1); } EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then { test -n "$verbose" && \ echo " defining USE_IOCTL_FIONBIO" echo "#define" USE_IOCTL_FIONBIO 1 >> confdefs.h DEFS="$DEFS -DUSE_IOCTL_FIONBIO=1" SEDDEFS="${SEDDEFS}\${SEDdA}USE_IOCTL_FIONBIO\${SEDdB}USE_IOCTL_FIONBIO\${SEDdC}1\${SEDdD} \${SEDuA}USE_IOCTL_FIONBIO\${SEDuB}USE_IOCTL_FIONBIO\${SEDuC}1\${SEDuD} \${SEDeA}USE_IOCTL_FIONBIO\${SEDeB}USE_IOCTL_FIONBIO\${SEDeC}1\${SEDeD} " } fi fi rm -fr conftest* cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> /* needed for netinet/in.h */ #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <errno.h> #include <fcntl.h> main() { int port, tmp, s; struct sockaddr_in my_sin; struct hostent *hp; char *host_name; host_name = malloc(100); if (gethostname(host_name, 100) == -1) exit(1); hp = gethostbyname(host_name); if (hp == 0) exit(1); memset((char *)&my_sin, '\0', sizeof my_sin); memcpy((char *)&my_sin.sin_addr, hp->h_addr, hp->h_length); my_sin.sin_family = hp->h_addrtype; my_sin.sin_addr.s_addr = INADDR_ANY; for (port = 2000; port < 10000; port++) { my_sin.sin_port = htons((u_short)port); s = socket(hp->h_addrtype, SOCK_STREAM, 0); if (s == -1) exit(1); tmp = 1; if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp)) < 0) exit (1); if (bind(s, (struct sockaddr *)&my_sin, sizeof my_sin) == -1) { if (errno == EADDRINUSE) { close(s); continue; } exit(1); } if (listen(s, 5) == -1) exit(1); if (fcntl(s, F_SETFL, O_NDELAY) == -1) exit(1); tmp = sizeof my_sin; s = accept(s, (struct sockaddr *)&my_sin, &tmp); if (s == -1) { if (errno == EWOULDBLOCK) exit(0); if (errno == EAGAIN) exit(0); if (errno == EINTR) { close(s); continue; } } break; } exit(1); } EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then { test -n "$verbose" && \ echo " defining USE_FCNTL_O_NDELAY" echo "#define" USE_FCNTL_O_NDELAY 1 >> confdefs.h DEFS="$DEFS -DUSE_FCNTL_O_NDELAY=1" SEDDEFS="${SEDDEFS}\${SEDdA}USE_FCNTL_O_NDELAY\${SEDdB}USE_FCNTL_O_NDELAY\${SEDdC}1\${SEDdD} \${SEDuA}USE_FCNTL_O_NDELAY\${SEDuB}USE_FCNTL_O_NDELAY\${SEDuC}1\${SEDuD} \${SEDeA}USE_FCNTL_O_NDELAY\${SEDeB}USE_FCNTL_O_NDELAY\${SEDeC}1\${SEDeD} " } fi rm -fr conftest* cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> /* needed for netinet/in.h */ #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <errno.h> #include <fcntl.h> main() { int port, tmp, s; struct sockaddr_in my_sin; struct hostent *hp; char *host_name; host_name = malloc(100); if (gethostname(host_name, 100) == -1) exit(1); hp = gethostbyname(host_name); if (hp == 0) exit(1); memset((char *)&my_sin, '\0', sizeof my_sin); memcpy((char *)&my_sin.sin_addr, hp->h_addr, hp->h_length); my_sin.sin_family = hp->h_addrtype; my_sin.sin_addr.s_addr = INADDR_ANY; for (port = 2000; port < 10000; port++) { my_sin.sin_port = htons((u_short)port); s = socket(hp->h_addrtype, SOCK_STREAM, 0); if (s == -1) exit(1); tmp = 1; if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp)) < 0) exit (1); if (bind(s, (struct sockaddr *)&my_sin, sizeof my_sin) == -1) { if (errno == EADDRINUSE) { close(s); continue; } exit(1); } if (listen(s, 5) == -1) exit(1); if (fcntl(s, F_SETFL, FNDELAY) == -1) exit(1); tmp = sizeof my_sin; s = accept(s, (struct sockaddr *)&my_sin, &tmp); if (s == -1) { if (errno == EWOULDBLOCK) exit(0); if (errno == EAGAIN) exit(0); if (errno == EINTR) { close(s); continue; } } break; } exit(1); } EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then { test -n "$verbose" && \ echo " defining USE_FCNTL_FNDELAY" echo "#define" USE_FCNTL_FNDELAY 1 >> confdefs.h DEFS="$DEFS -DUSE_FCNTL_FNDELAY=1" SEDDEFS="${SEDDEFS}\${SEDdA}USE_FCNTL_FNDELAY\${SEDdB}USE_FCNTL_FNDELAY\${SEDdC}1\${SEDdD} \${SEDuA}USE_FCNTL_FNDELAY\${SEDuB}USE_FCNTL_FNDELAY\${SEDuC}1\${SEDuD} \${SEDeA}USE_FCNTL_FNDELAY\${SEDeB}USE_FCNTL_FNDELAY\${SEDeC}1\${SEDeD} " } fi rm -fr conftest* echo checking for random cat > conftest.c <<EOF #include "confdefs.h" long random(); int main() { exit(0); } int t() { return random() % 7; } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining" RAND to be RANDOM echo "#define" RAND RANDOM >> confdefs.h DEFS="$DEFS -DRAND=RANDOM" SEDDEFS="${SEDDEFS}\${SEDdA}RAND\${SEDdB}RAND\${SEDdC}RANDOM\${SEDdD} \${SEDuA}RAND\${SEDuB}RAND\${SEDuC}RANDOM\${SEDuD} \${SEDeA}RAND\${SEDeB}RAND\${SEDeC}RANDOM\${SEDeD} " } else rm -rf conftest* echo checking for rand cat > conftest.c <<EOF #include "confdefs.h" int main() { exit(0); } int t() { return rand() % 7; } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining" RAND to be RAND echo "#define" RAND RAND >> confdefs.h DEFS="$DEFS -DRAND=RAND" SEDDEFS="${SEDDEFS}\${SEDdA}RAND\${SEDdB}RAND\${SEDdC}RAND\${SEDdD} \${SEDuA}RAND\${SEDuB}RAND\${SEDuC}RAND\${SEDuD} \${SEDeA}RAND\${SEDeB}RAND\${SEDeC}RAND\${SEDeD} " } else rm -rf conftest* echo checking for drand48 cat > conftest.c <<EOF #include "confdefs.h" double drand48(); int main() { exit(0); } int t() { return (int)(drand48() * 7); } EOF if eval $compile; then rm -rf conftest* { test -n "$verbose" && \ echo " defining" RAND to be DRAND48 echo "#define" RAND DRAND48 >> confdefs.h DEFS="$DEFS -DRAND=DRAND48" SEDDEFS="${SEDDEFS}\${SEDdA}RAND\${SEDdB}RAND\${SEDdC}DRAND48\${SEDdD} \${SEDuA}RAND\${SEDuB}RAND\${SEDuC}DRAND48\${SEDuD} \${SEDeA}RAND\${SEDeB}RAND\${SEDeC}DRAND48\${SEDeD} " } fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* tcomp='${CC-cc} ${CFLAGS} ${TESTFLAG} -c conftest.c >/dev/null 2>&1' cat > conftest.c <<EOF #include <stdio.h> double d = 4.5; main() { printf("hello world\n"); } EOF for TESTFLAG in -O4 -xO2 -O2 -O; do if eval $tcomp; then CFLAGS=$TESTFLAG break fi done for TESTFLAG in -g -fstrength-reduce; do if eval $tcomp; then CFLAGS="$CFLAGS $TESTFLAG" fi done MCFLAGS=$CFLAGS TESTFLAG="-fomit-frame-pointer" if eval $tcomp; then CFLAGS="$CFLAGS $TESTFLAG" fi OCFLAGS=$CFLAGS if ${CC-cc} -g -c conftest.c ; then DCFLAGS='-g' else DCFLAGS='' fi OPTIMIZE_LINKING='' if ${CC-cc} $OFLAGS -o conftest conftest.c ; then OPTIMIZE_LINKING='$(OPTIMIZE)' fi rm -f conftest.c case "$DEFS" in *HAVE_LIBSOCKET*) cat > conftest.c <<EOF #include "confdefs.h" #if defined(sun) yes #endif EOF eval "$CPP conftest.c > conftest.out 2>&1" if egrep "yes" conftest.out >/dev/null 2>&1; then rm -rf conftest* EXTRA_CFLAGS='-Dsolaris' fi rm -f conftest* ;; esac # check whether --with-target was given withval="$with_target" if test -n "$withval"; then EXTRA_CFLAGS="-D${withval}" fi echo "checking if ${YACC} includes bogus malloc prototypes" cat > conftest.y <<EOF %{ #include "confdefs.h" #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #include <memory.h> #endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif %} %% all: 'a'; %% int main(){ return 0; } void yyerror(){} int yylex(){ return 0; } EOF ${YACC} conftest.y mv y.tab.c conftest.c if eval $compile; then MOVE_YACC_TAB='$(MV) $(YACCTAB)c' CLEAN_YACC_TAB='' else MOVE_YACC_TAB='tail +2 $(YACCTAB)c >>' CLEAN_YACC_TAB='$(RM) $(YACCTAB)c' fi rm -f conftest* SAVE_LIBS="${LIBS}" SAVE_CFLAGS="${CFLAGS}" CFLAGS='' for TESTFLAG in '' -static -Bstatic -n; do echo "checking malloc redefinition with linking flag ${TESTFLAG}" LIBS="${SAVE_LIBS} ${TESTFLAG}" cat > conftest.c <<EOF #include "confdefs.h" #include <sys/types.h> #include <stdio.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_STRING_H #include <string.h> #else #include <strings.h> #endif #if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #include <memory.h> #endif #undef malloc #undef calloc int my_malloc_used; int main() { int i; FILE *f; alarm(10); /* a crash can be an infinite loop... */ for (i = 0; i < 100; i++) { my_malloc_used = 0; /* strdup seems to be partially unavailable */ f = fopen("confdefs.h", "r"); fclose(f); if (!my_malloc_used) exit(1); } /* linking in printf called with variable format makes shared libs * worthwhile. Moreover, calling it is a good test */ printf(f?"Redefinition of malloc() %f%% successful\n":(char*)f, 100.); exit(0); } POINTER malloc(size) size_t size; { char *q; my_malloc_used = 1; q = sbrk(sizeof size + size+7 & ~7); *(size_t *)q = size; return q + sizeof size; } POINTER calloc(size, num) size_t size, num; { char *q; q = malloc(size*num); memset(q, 0, size); } POINTER realloc(p, size) POINTER p; size_t size; { char *q; if (*(size_t *)p >= size) return p; q = malloc(size); #ifdef HAVE_MEMCPY memcpy(q, p, size); #else bcopy(p, q, size); #endif *(size_t *)q = size; return q + sizeof size; } #ifdef FREE_RETURNS_VOID void free(p) POINTER p; {} #else int free(p) POINTER p; { return 1; } #endif EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then SBRK_OK=1 fi rm -fr conftest* if test -n "${SBRK_OK}"; then if test -z "${TESTFLAG}" ; then { test -n "$verbose" && \ echo " defining SBRK_OK" echo "#define" SBRK_OK 1 >> confdefs.h DEFS="$DEFS -DSBRK_OK=1" SEDDEFS="${SEDDEFS}\${SEDdA}SBRK_OK\${SEDdB}SBRK_OK\${SEDdC}1\${SEDdD} \${SEDuA}SBRK_OK\${SEDuB}SBRK_OK\${SEDuC}1\${SEDuD} \${SEDeA}SBRK_OK\${SEDeB}SBRK_OK\${SEDeC}1\${SEDeD} " } else LDFLAGS="${LDFLAGS} ${TESTFLAG}" EXTRA_CFLAGS="${EXTRA_CFLAGS} -DSBRK_OK" fi break fi done LIBS="${SAVE_LIBS}" CFLAGS="${SAVE_CFLAGS}" case "$EXTRA_CFLAGS" in *-Dsolaris*) case "$DEFS" in *HAVE_LIBUCB*) LIBS="${LDFLAGS} -lm -lgcc -lc -lnsl -lgcc -lc -ldl_stubs\ -lnswnis -lnswnisplus -lnswfiles -lnswcompat -lstraddr -lswitch\ -ltcpip -lsocket -lnsl -lgcc -lc /usr/ucblib/libucb.a" LDFLAGS= "-u dgettext -lintl" ;; esac esac echo "checking malloc overhead" cat > conftest.c <<EOF #include "confdefs.h" #include "util/overhead.c" EOF ${CC-cc} -o conftest conftest.c { test -n "$verbose" && \ echo " defining" EXTERN_MALLOC_OVERHEAD to be `./conftest --terse` echo "#define" EXTERN_MALLOC_OVERHEAD `./conftest --terse` >> confdefs.h DEFS="$DEFS -DEXTERN_MALLOC_OVERHEAD=`./conftest --terse`" SEDDEFS="${SEDDEFS}\${SEDdA}EXTERN_MALLOC_OVERHEAD\${SEDdB}EXTERN_MALLOC_OVERHEAD\${SEDdC}`./conftest --terse`\${SEDdD} \${SEDuA}EXTERN_MALLOC_OVERHEAD\${SEDuB}EXTERN_MALLOC_OVERHEAD\${SEDuC}`./conftest --terse`\${SEDuD} \${SEDeA}EXTERN_MALLOC_OVERHEAD\${SEDeB}EXTERN_MALLOC_OVERHEAD\${SEDeC}`./conftest --terse`\${SEDeD} " } rm -f conftest* # Set default prefixes. if test -n "$prefix"; then test -z "$exec_prefix" && exec_prefix='${prefix}' prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%" fi if test -n "$exec_prefix"; then prsub="$prsub s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%" fi # Quote sed substitution magic chars in DEFS. cat >conftest.def <<EOF $DEFS EOF escape_ampersand_and_backslash='s%[&\\]%\\&%g' DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def` rm -f conftest.def rm -f conftest a.out # Substitute for predefined variables. trap 'rm -f config.status; exit 1' 1 3 15 echo creating config.status rm -f config.status cat > config.status <<EOF #!/bin/sh # Generated automatically by configure. # Run this file to recreate the current configuration. # This directory was configured as follows, # on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # # $0 $configure_args for arg do case "\$arg" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args ;; *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;; esac done trap 'rm -fr Makefile machine.h conftest*; exit 1' 1 3 15 CC='$CC' INSTALL='$INSTALL' INSTALL_PROGRAM='$INSTALL_PROGRAM' INSTALL_DATA='$INSTALL_DATA' YACC='$YACC' CPP='$CPP' ALLOCA='$ALLOCA' OCFLAGS='$OCFLAGS' MCFLAGS='$MCFLAGS' DCFLAGS='$DCFLAGS' LDFLAGS='$LDFLAGS' EXTRA_CFLAGS='$EXTRA_CFLAGS' OPTIMIZE_LINKING='$OPTIMIZE_LINKING' MOVE_YACC_TAB='$MOVE_YACC_TAB' CLEAN_YACC_TAB='$CLEAN_YACC_TAB' LIBS='$LIBS' srcdir='$srcdir' prefix='$prefix' exec_prefix='$exec_prefix' prsub='$prsub' extrasub='$extrasub' EOF cat >> config.status <<\EOF top_srcdir=$srcdir CONFIG_FILES=${CONFIG_FILES-"Makefile"} for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then srcdir=$top_srcdir # Remove last slash and all that follows it. Not all systems have dirname. dir=`echo $file|sed 's%/[^/][^/]*$%%'` if test "$dir" != "$file"; then test "$top_srcdir" != . && srcdir=$top_srcdir/$dir test ! -d "$dir" && mkdir $dir fi echo creating $file rm -f $file echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file sed -e " $prsub $extrasub s%@CC@%$CC%g s%@INSTALL@%$INSTALL%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@YACC@%$YACC%g s%@CPP@%$CPP%g s%@ALLOCA@%$ALLOCA%g s%@OCFLAGS@%$OCFLAGS%g s%@MCFLAGS@%$MCFLAGS%g s%@DCFLAGS@%$DCFLAGS%g s%@LDFLAGS@%$LDFLAGS%g s%@EXTRA_CFLAGS@%$EXTRA_CFLAGS%g s%@OPTIMIZE_LINKING@%$OPTIMIZE_LINKING%g s%@MOVE_YACC_TAB@%$MOVE_YACC_TAB%g s%@CLEAN_YACC_TAB@%$CLEAN_YACC_TAB%g s%@LIBS@%$LIBS%g s%@srcdir@%$srcdir%g s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file fi; done CONFIG_HEADERS=${CONFIG_HEADERS-"machine.h"} for file in .. ${CONFIG_HEADERS}; do if test "x$file" != x..; then echo creating $file # These sed commands are put into SEDDEFS when defining a macro. # They are broken into pieces to make the sed script easier to manage. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME # is the cpp macro being defined and VALUE is the value it is being given. # Each defining turns into a single global substitution command. # # SEDd sets the value in "#define NAME VALUE" lines. SEDdA='s@^\([ ]*\)#\([ ]*define[ ][ ]*\)' SEDdB='\([ ][ ]*\)[^ ]*@\1#\2' SEDdC='\3' SEDdD='@g' # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE". SEDuA='s@^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' SEDuB='\([ ]\)@\1#\2define\3' SEDuC=' ' SEDuD='\4@g' # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE". SEDeA='s@^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' SEDeB='$@\1#\2define\3' SEDeC=' ' SEDeD='@g' rm -f conftest.sed EOF # Turn off quoting long enough to insert the sed commands. rm -f conftest.sh cat > conftest.sh <<EOF $SEDDEFS EOF # Break up $SEDDEFS (now in conftest.sh) because some shells have a limit # on the size of here documents. # Maximum number of lines to put in a single here document. maxshlines=9 while : do # wc gives bogus results for an empty file on some systems. lines=`grep -c . conftest.sh` if test -z "$lines" || test "$lines" -eq 0; then break; fi rm -f conftest.s1 conftest.s2 sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20. sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21. # Write a limited-size here document to append to conftest.sed. echo 'cat >> conftest.sed <<CONFEOF' >> config.status cat conftest.s1 >> config.status echo 'CONFEOF' >> config.status rm -f conftest.s1 conftest.sh mv conftest.s2 conftest.sh done rm -f conftest.sh # Now back to your regularly scheduled config.status. cat >> config.status <<\EOF # This sed command replaces #undef's with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it in # machine.h. cat >> conftest.sed <<\CONFEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, CONFEOF rm -f conftest.h # Break up the sed commands because old seds have small limits. maxsedlines=20 cp $top_srcdir/$file.in conftest.h1 while : do lines=`grep -c . conftest.sed` if test -z "$lines" || test "$lines" -eq 0; then break; fi rm -f conftest.s1 conftest.s2 conftest.h2 sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20. sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21. sed -f conftest.s1 < conftest.h1 > conftest.h2 rm -f conftest.s1 conftest.h1 conftest.sed mv conftest.h2 conftest.h1 mv conftest.s2 conftest.sed done rm -f conftest.sed conftest.h echo "/* $file. Generated automatically by configure. */" > conftest.h cat conftest.h1 >> conftest.h rm -f conftest.h1 if cmp -s $file conftest.h 2>/dev/null; then # The file exists and we would not be changing it. echo "$file is unchanged" rm -f conftest.h else rm -f $file mv conftest.h $file fi fi; done exit 0 EOF chmod +x config.status ${CONFIG_SHELL-/bin/sh} config.status