rse 98/09/16 12:38:28
Modified: . configure
src CHANGES Configuration.tmpl Configure
Added: src/helpers findcpp.sh checkheader.sh
Log:
Ok, here as Roy requested: We do commit then review/fixing. So, here is the
first cut for a fixed C header file check:
| Fix the recently introduced C header file checking: We now use the C
| pre-processor pass only (and no longer the complete compiler pass) to
| determine whether a C header file exists or not. Because only this way we're
| safe against inter-header dependencies (which caused horrible portability
| problems). The only drawback is that we now have a CPP configuration
variable
| which has to be determined first (we do a similar approach as GNU Autoconf
| does here). When all fails the user still has the possibility to override it
| manually via APACI or src/Configuration. As a fallback for the header check
| itself we can directly check the existance of the file under /usr/include,
| too.
Please try it out, fix it, grep out the PR-numbers, etc.
Cleanups and other stuff for src/helpers/* I'll do tomorrow.
Today I've totally tired and have to go to bed...
Revision Changes Path
1.46 +2 -2 apache-1.3/configure
Index: configure
===================================================================
RCS file: /export/home/cvs/apache-1.3/configure,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- configure 1998/08/25 10:51:51 1.45
+++ configure 1998/09/16 19:38:25 1.46
@@ -278,7 +278,7 @@
echo "## restoring your configuration. Additional parameters can be
supplied." >>$configstatus
echo "##" >>$configstatus
echo "" >>$configstatus
- for var in CC OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LD_SHLIB LDFLAGS_SHLIB \
+ for var in CC CPP OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LD_SHLIB
LDFLAGS_SHLIB \
LDFLAGS_SHLIB_EXPORT LIBS INCLUDES RANLIB; do
eval "val=\"\$$var\""
if [ ".$val" != . ]; then
@@ -954,7 +954,7 @@
# generate settings from imported environment variables
OIFS="$IFS" IFS="$DIFS"
-for var in CC OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LD_SHLIB LDFLAGS_SHLIB \
+for var in CC CPP OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LD_SHLIB LDFLAGS_SHLIB \
LDFLAGS_SHLIB_EXPORT LIBS INCLUDES RANLIB DEPS; do
eval "val=\"\$$var\"";
if [ ".$val" != . ]; then
1.1060 +12 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1059
retrieving revision 1.1060
diff -u -r1.1059 -r1.1060
--- CHANGES 1998/09/15 19:47:36 1.1059
+++ CHANGES 1998/09/16 19:38:26 1.1060
@@ -1,5 +1,17 @@
Changes with Apache 1.3.2
+ *) Fix the recently introduced C header file checking: We now use the C
+ pre-processor pass only (and no longer the complete compiler pass) to
+ determine whether a C header file exists or not. Because only this way
+ we're safe against inter-header dependencies (which caused horrible
+ portability problems). The only drawback is that we now have a CPP
+ configuration variable which has to be determined first (we do a similar
+ approach as GNU Autoconf does here). When all fails the user still has
+ the possibility to override it manually via APACI or src/Configuration.
+ As a fallback for the header check itself we can directly check the
+ existance of the file under /usr/include, too.
+ [Ralf S. Engelschall] PR????
+
*) PORT: Added RHAPSODY (Mac OS X Server) support. MAP_TMPFILE defined
as an alternate mechanism for mmap'd shared memory for RHAPSODY.
ap_private_extern defined to hide symbols that conflict with loaded
1.111 +1 -0 apache-1.3/src/Configuration.tmpl
Index: Configuration.tmpl
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/Configuration.tmpl,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- Configuration.tmpl 1998/09/12 20:16:52 1.110
+++ Configuration.tmpl 1998/09/16 19:38:26 1.111
@@ -58,6 +58,7 @@
EXTRA_DEPS=
#CC=
+#CPP=
#OPTIM=
#RANLIB=
1.289 +57 -40 apache-1.3/src/Configure
Index: Configure
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/Configure,v
retrieving revision 1.288
retrieving revision 1.289
diff -u -r1.288 -r1.289
--- Configure 1998/09/15 19:47:36 1.288
+++ Configure 1998/09/16 19:38:26 1.289
@@ -799,6 +799,63 @@
fi
####################################################################
+## Now check how we can _directly_ run the C pre-processor
+##
+TCPP=`egrep '^CPP=' Makefile.config | tail -1 | awk -F= '{print $2}'`
+if [ ".$TCPP" != . ]; then
+ CPP=`CC=$CC CPP=$TCPP ./helpers/findcpp.sh`
+else
+ CPP=`CC=$CC ./helpers/findcpp.sh`
+fi
+if [ ".$TCPP" = . ]; then
+ echo "CPP=$CPP" >> Makefile.config
+fi
+echo " + setting C pre-processor to $CPP"
+
+####################################################################
+## Now check for existance of non-standard system header files
+## and start generation of the ap_config_auto.h header
+##
+AP_CONFIG_AUTO_H="include/ap_config_auto.h"
+echo "/*" >$AP_CONFIG_AUTO_H
+echo " * ap_config_auto.h -- Automatically determined configuration stuff"
>>$AP_CONFIG_AUTO_H
+echo " * THIS FILE WAS AUTOMATICALLY GENERATED - DO NOT EDIT!"
>>$AP_CONFIG_AUTO_H
+echo " */" >>$AP_CONFIG_AUTO_H
+echo "" >>$AP_CONFIG_AUTO_H
+echo "#ifndef AP_CONFIG_AUTO_H" >>$AP_CONFIG_AUTO_H
+echo "#define AP_CONFIG_AUTO_H" >>$AP_CONFIG_AUTO_H
+
+echo " + checking for system header files"
+CHECK_FOR_HEADERS="dlfcn.h dl.h bstring.h crypt.h unistd.h sys/resource.h
sys/select.h sys/processor.h"
+for header in $CHECK_FOR_HEADERS; do
+ echo "" >>$AP_CONFIG_AUTO_H
+ echo "/* check: #include <$header> */" >>$AP_CONFIG_AUTO_H
+ name="`echo $header | sed -e 's:/:_:g' -e 's:\.:_:g' | tr '[a-z]'
'[A-Z]'`"
+ CPP=$CPP ./helpers/checkheader.sh $header
+ if [ $? -eq 0 ]; then
+ echo "#ifndef HAVE_${name}" >>$AP_CONFIG_AUTO_H
+ echo "#define HAVE_${name} 1" >>$AP_CONFIG_AUTO_H
+ echo "#endif" >>$AP_CONFIG_AUTO_H
+ else
+ echo "#ifdef HAVE_${name}" >>$AP_CONFIG_AUTO_H
+ echo "#undef HAVE_${name}" >>$AP_CONFIG_AUTO_H
+ echo "#endif" >>$AP_CONFIG_AUTO_H
+ fi
+done
+
+####################################################################
+# Special AIX 4.x support: need to check for sys/processor.h
+# to decide whether the Processor Binding can be used or not
+case "$PLAT" in
+ *-ibm-aix*)
+ CPP=$CPP ./helpers/checkheader.sh sys/processor.h
+ if [ $? -eq 0 ]; then
+ CFLAGS="$CFLAGS -DAIX_BIND_PROCESSOR"
+ fi
+ ;;
+esac
+
+####################################################################
## Look for OPTIM and save for later
##
TOPTIM=`egrep '^OPTIM=' Makefile.config | tail -1 | awk -F= '{print $2}'`
@@ -1239,17 +1296,6 @@
esac
fi
-# AIX 4.x support: Special Case: need to check for sys/processor.h
-# before we usually would.
-# Processor Binding
-case "$PLAT" in
- *-ibm-aix*)
- if ./helpers/TestCompile header sys/processor.h ; then
- CFLAGS="$CFLAGS -DAIX_BIND_PROCESSOR"
- fi
- ;;
-esac
-
####################################################################
## Find out what modules we want and try and configure things for them
## Module lines can look like this:
@@ -1700,35 +1746,6 @@
fi
####################################################################
-## Now check for existance of non-standard system header files
-## and start generation of the ap_config_auto.h header
-##
-AP_CONFIG_AUTO_H="include/ap_config_auto.h"
-echo "/*" >$AP_CONFIG_AUTO_H
-echo " * ap_config_auto.h -- Automatically determined configuration stuff"
>>$AP_CONFIG_AUTO_H
-echo " * THIS FILE WAS AUTOMATICALLY GENERATED - DO NOT EDIT!"
>>$AP_CONFIG_AUTO_H
-echo " */" >>$AP_CONFIG_AUTO_H
-echo "" >>$AP_CONFIG_AUTO_H
-echo "#ifndef AP_CONFIG_AUTO_H" >>$AP_CONFIG_AUTO_H
-echo "#define AP_CONFIG_AUTO_H" >>$AP_CONFIG_AUTO_H
-
-echo " + checking for system header files"
-CHECK_FOR_HEADERS="dlfcn.h dl.h bstring.h crypt.h unistd.h sys/resource.h
sys/select.h sys/processor.h"
-for header in $CHECK_FOR_HEADERS; do
- echo "" >>$AP_CONFIG_AUTO_H
- echo "/* check: #include <$header> */" >>$AP_CONFIG_AUTO_H
- name="`echo $header | sed -e 's:/:_:g' -e 's:\.:_:g' | tr '[a-z]'
'[A-Z]'`"
- if ./helpers/TestCompile header $header; then
- echo "#ifndef HAVE_${name}" >>$AP_CONFIG_AUTO_H
- echo "#define HAVE_${name} 1" >>$AP_CONFIG_AUTO_H
- echo "#endif" >>$AP_CONFIG_AUTO_H
- else
- echo "#ifdef HAVE_${name}" >>$AP_CONFIG_AUTO_H
- echo "#undef HAVE_${name}" >>$AP_CONFIG_AUTO_H
- echo "#endif" >>$AP_CONFIG_AUTO_H
- fi
-done
-
## Finish building ap_config_auto.h
##
## We pick out all -D's from CFLAGS and insert them as defines into
1.1 apache-1.3/src/helpers/findcpp.sh
Index: findcpp.sh
===================================================================
#!/bin/sh
##
## findcpp.sh -- Find out how to _directly_ run the C Pre-Processor (CPP)
## Written by Ralf S. Engelschall for the Apache configuration mechanism
##
# create a test C source:
# - has to use extension ".c" because some CPP only accept this one
# - uses assert.h because this is a standard header and harmless to include
# - contains a Syntax Error to make sure it passes only the preprocessor
# but not the real compiler pass
cat >conftest.c <<EOF
#include <assert.h>
Syntax Error
EOF
# default in case of problems
if [ ".$AP_PRINTPATH" = . ]; then
AP_PRINTPATH='PrintPath'
fi
# some braindead systems have a CPP define for a directory :-(
if [ ".$CPP" != . ]; then
if [ -d "$CPP" ]; then
CPP=''
fi
fi
if [ ".$CPP" != . ]; then
# case 1: user provided a default CPP variable (we only check)
(eval "$CPP conftest.c >/dev/null") 2>conftest.out
my_error=`grep -v '^ *+' conftest.out`
if [ ".$my_error" != . ]; then
CPP=''
fi
else
# case 2: no default CPP variable (we have to find one)
# 1. try the standard -E option
CPP="${CC-cc} -E"
(eval "$CPP conftest.c >/dev/null") 2>conftest.out
my_error=`grep -v '^ *+' conftest.out`
if [ ".$my_error" != . ]; then
# 2. try the -E option and GCC's -traditional-ccp option
CPP="${CC-cc} -E -traditional-cpp"
(eval "$CPP conftest.c >/dev/null") 2>conftest.out
my_error=`grep -v '^ *+' conftest.out`
if [ ".$my_error" != . ]; then
# 3. try a standalone cpp command in $PATH and lib dirs
CPP="`./helpers/$AP_PRINTPATH cpp`"
if [ ".$CPP" = . ]; then
CPP="`./helpers/$AP_PRINTPATH -p/lib:/usr/lib:/usr/local/lib
cpp`"
fi
if [ ".$CPP" != . ]; then
(eval "$CPP conftest.c >/dev/null") 2>conftest.out
my_error=`grep -v '^ *+' conftest.out`
if [ ".$my_error" != . ]; then
# ok, we gave up...
CPP=''
fi
fi
fi
fi
fi
# cleanup after work
rm -f conftest.*
# Ok, empty CPP variable now means it's not available
if [ ".$CPP" = . ]; then
CPP='NOT-AVAILABLE'
fi
echo $CPP
1.1 apache-1.3/src/helpers/checkheader.sh
Index: checkheader.sh
===================================================================
#!/bin/sh
##
## checkheader.sh -- Check whether a C header file exists
## Written by Ralf S. Engelschall for the Apache configuration mechanism
##
header=$1
rc=1
if [ ".$CPP" = . ]; then
CPP='NOT-AVAILABLE'
fi
if [ ".$CPP" != ".NOT-AVAILABLE" ]; then
# create a test C source
cat >conftest.c <<EOF
#include <$header>
Syntax Error
EOF
(eval "$CPP conftest.c >/dev/null") 2>conftest.out
my_error=`grep -v '^ *+' conftest.out`
if [ ".$my_error" = . ]; then
rc=0
fi
else
if [ -f "/usr/include/$header" ]; then
rc=0
fi
fi
rm -f conftest.*
exit $rc