httpd-dev mailing list archives

On Thu, 16 Jul 1998 15:14:54 +0200, Ralf S. Engelschall wrote:
>> The header autodetection in Configure is broken for me under OS/2 because
>> Configure calls TestCompile to test for the header before it has finished
>> writing makefile.config (which TestCompile uses).
>
>We have a similar problem for the other TestCompile usage points where libs
>are tested. But you're right, we have a problem. But it is bigger than just
>the header checks. OTOH we can at least fix the problem for the header checks
>when we permutate some stuff in Configure. I'll look at this.
>
>> In particular it needs the LDFLAGS specified in the OS/2 section to be used
>> so that an EXE is generated (which can then be found by PrintPathOS2).
>
>> There's also another problem. sys/select.h requires sys/types.h to be
>> included before it so testing for sys/select.h will fail even though it
>> exists.
>
>Both problems have to be addressed differently, IMHO. We need a target in
>TestCompile for only running CPP. Please try out the appended patch, it
>introduces a testpp target which does it via $(CC) -E although we really had
>to test for "cpp", then "$(CC) -E" etc. Or is CC -E really portable?
The patch doesn't work for me because "chmod a+rx" doesn't have the desired
effect in OS/2. For PrintPathOS2 to find it it has to have a .exe extension.
Shouldn't it be possible to check the return value of the $(CC) -E ?
Or simply test for the existence of the output file which doesn't exist if
there's an error and you use -o rather that redirection.
I think this should probably go in a separate helper script. The following
works for me but is only as portable as $(CC) -E and I can only guess at that.
----- TestHeader CUT HERE -----
#!/bin/sh
exstat=1
trap 'rm -f Makefile testpp.c testpp; exit $exstat' 0 1 2 3 15
#
# Yet another Apache Configure helper script.
# This script tests for the existence of a header file
#
# ./helpers/TestHeader <headername>
# Which checks to see if <headername> exists on this system
#
# It does these by creating a small mini-makefile, based on
# ../Makefile.config which trys to run the C preprocessor on
# a generated source file. If the preprocessor succeeds, we assume the
# header exists.
#
# This must be run as './helpers/TestHeader' from
# the ./src directory (same directory that Configure is
# located) if you want to test it out. Configure must
# also call it as './helpers/TestHeader'
#
cd ./helpers
#
# Handle "verbose" and "silent" flags
#
case "$1" in
"-v")
VERBOSE="yes"
shift
;;
"-s")
VERBOSE="no"
shift
;;
esac
#
# Generate the test source file
#
if [ "x$1" = "x" ]; then
exit
fi
if [ "$VERBOSE" = "yes" ]; then
ERRDIR=""
else
ERRDIR='2>/dev/null'
fi
TARGET='testpp'
cat <<EOF >testpp.c
#include <$1>
EOF
#
# Get makefile settings and build a basic Makefile
#
cat ../Makefile.config > Makefile
cat <<EOF >> Makefile
CFLAGS=\$(OPTIM) \$(CFLAGS1) \$(EXTRA_CFLAGS)
INCLUDES=\$(INCLUDES1) \$(EXTRA_INCLUDES)
testpp:
cd ..; rm -f helpers/testpp && \$(CC) \$(INCLUDES) -E helpers/testpp.c -o helpers/testpp
EOF
# Now run that Makefile
eval "make $TARGET >/dev/null $ERRDIR"
# And see if testpp exists, if so, then we
# assume the condition we are testing for is good
if [ -e testpp ]; then
exstat=0
if [ "$VERBOSE" = "yes" ]; then
echo "Header $1 found"
fi
fi
----- CUT HERE -----
--
______________________________________________________________________________
| Brian Havard | "He is not the messiah! |
| brianh@kheldar.apana.org.au | He's a very naughty boy!" - Life of Brian |
------------------------------------------------------------------------------