You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 1996/09/09 22:59:39 UTC
New Configuration Setup
This, and the next 2 Emails, is my take on the new-improved Configuration
setup. This one uses the GNU autoconf system to return the OS/Platform
that we are compiling one. The 'autoconf/configure' script is an official
autoconf script.
This is the Configure script itself (./src/Configure):
#!/bin/sh
# $Id: Configure,v 1.16 1996/09/08 17:18:45 jim Exp $
trap 'rm $tmpfile; exit' 0 1 2 3 15
# Apache configuration script, first cut --- rst.
# Dont like it? Inspired to do something better? Go for it.
# second cut --- jmj
# At this point we change what Configuration contains. It maintain
# contains comments, specific compiler flags, a list of included
# modules and "rules". These rules are used to allow Configure to
# be totally configured from Configuration
file=Configuration
tmpfile=htconf.$$
if [ "x$1" = "x-file" ] ; then
echo "Using alternate config file $2"
file=$2
else
echo "Using '$file' as config file"
fi
# First, strip comments and blank lines and then change Rules to comments
sed 's/#.*//' $file | sed '/^[ ]*$/d' | sed 's/[ ]*$//' | \
sed 's/^Rule[ ]*/##Rule:/' > $tmpfile
# Check for syntax errors...
if egrep -v '^Module[ ]+[A-Za-z0-9_]+[ ]+[^ ]+$' $tmpfile | \
grep -v = > /dev/null
then
echo "Syntax error --- The configuration file is used only to"
echo "define the list of included modules or to set Makefile"
echo "options or Configure rules, and I don't see that at all:"
egrep -v '^Module[ ]+[A-Za-z0-9_]+[ ]+[^ ]+$' $tmpfile | \
grep -v =
exit 1
fi
# File is OK --- make backup copies of things and then get the new ones:
if [ -f Makefile ] ; then mv Makefile Makefile.bak; fi
if [ -f modules.c ] ; then mv modules.c modules.c.bak; fi
awk >modules.c <$tmpfile '\
BEGIN { modules[n++] = "core_module" } \
/^Module/ { modules[n++] = $2 } \
END { print "/* modules.c --- automatically generated by Apache"; \
print " * configuration script. DO NOT HAND EDIT!!!!!"; \
print " */"; \
print ""; \
print "#include \"httpd.h\""; \
print "#include \"http_config.h\""; \
print ""; \
for (i = 0; i < n; ++i) { \
printf ("extern module %s;\n", modules[i]); \
} \
print ""; \
print "module *prelinked_modules[] = {"; \
for (i = 0; i < n; ++i) { \
printf " &%s,\n", modules[i]; \
} \
print " NULL"; \
print "};"; \
print "char *module_names[] = {"; \
for (i = n-1; i > -1; --i) { \
printf " \"%s\",\n", modules[i]; \
} \
print " NULL"; \
print "};"; \
}'
#
# Add module set only
#
awk >Makefile <$tmpfile '\
BEGIN { print "# Makefile automatically generated from Makefile.tmpl"; \
print "# and configuration file by Apache config script. "; \
print "# Hand-edited changes will be lost if the config script"; \
print "# is re-run."; \
} \
/^Module/ { modules[n++] = $3 } \
END { print "MODULES=\\"; \
for (i = 0; i < n; ++i) { \
if (i < n-1) printf (" %s \\\n", modules[i]); \
else printf (" %s\n", modules[i]); \
} \
print "" \
}'
#
# Now add Makefile additions and Rules
#
awk >>Makefile <$tmpfile '\
BEGIN { print "# Makefile options inherited from Configure"; \
print "###############"; \
} \
/\=/ { print } \
END { print "###############"; }'
#
# Now we determine the OS/Platform automagically, thanks to
# FSF autoconf.
# We adjust CFLAGS, LIBS, LFLAGS and INCLUDES (and other Makefile
# options) as required. Setting CC and OPTIM here has no effect
# if they were set in Configure.
#
# Also, we set DEF_WANTHSREGEX and DEF_BADMMAP to the appropriate
# value for each platform.
#
# As more PLATFORMs are added to Configuration.tmpl, be sure to
# add the required lines below.
#
PLAT=`./autoconf/configure`
case "$PLAT" in
*-apple-aux3*)
OS='A/UX 3.1.x'
CFLAGS="$CFLAGS -DAUX -D_POSIX_SOURCE"
LIBS="$LIBS -lposix -lbsd"
LFLAGS="$LFLAGS -s"
DEF_WANTHSREGEX=no
DEF_BADMMAP=no
;;
*-ibm-aix*)
OS='IBM AIX'
CFLAGS="$CFLAGS -DAIX -U__STR__"
;;
*-apollo-*)
OS='Apollo Domain'
CFLAGS="$CFLAGS -DAPOLLO"
;;
*-dg-dgux-*)
OS='DG/UX 5.4'
CFLAGS="$CFLAGS -DDGUX"
;;
OS/2)
OS='EMX OS/2'
CFLAGS="$CFLAGS -Zbsd-signals -Zbin-files -DNO_KILLPG -DNEED_STRCASECMP -DNO_SETSID -g"
LIBS="$LIBS -lsocket -llibufc -lgdbm -lbsd"
;;
*-hp-hpux10.*)
OS='HP-UX 10'
CFLAGS="$CFLAGS -DHPUX10"
;;
*-hp-hpux*)
OS='HP-UX'
CFLAGS="$CFLAGS -DHPUX"
;;
*-sgi-irix*)
OS='SGI IRIX'
CFLAGS="$CFLAGS -DIRIX"
;;
IRIXNIS)
OS='SGI IRIX w/NIS'
CFLAGS="$CFLAGS -DIRIX"
LIBS="$LIBS -lsun"
;;
*-linux-*)
OS='Linux'
CFLAGS="$CFLAGS -DLINUX"
;;
*-lynx-lynxos*)
OS='LynxOS'
CFLAGS="$CFLAGS -DLYNXOS"
LIBS="$LIBS -lbsd -ldes -lc_p"
;;
*486-*-bsdi*)
OS='BSDI w/486'
CFLAGS="$CFLAGS -m486"
;;
*-bsdi*)
OS='BSDI'
;;
*486-*-freebsd*|*486-*-netbsd*)
OS='FreeBSD/NETBSD on 486'
LIBS="$LIBS -lcrypt"
;;
*-freebsd*|*-netbsd*)
OS='FreeBSD/NetBSD'
LIBS="$LIBS -lcrypt"
;;
*-next-nextstep*)
OS='NeXT'
CFLAGS="$CFLAGS -DNEXT"
;;
*-dec-osf*)
OS='DEC OSF/1'
CFLAGS="$CFLAGS -DOSF1"
;;
QNX)
OS='QNX'
CFLAGS="$CFLAGS -DQNX"
LIBS="$LIBS -N128k -lsocket"
;;
*-sco3*)
OS='SCO 3'
CFLAGS="$CFLAGS -DSCO -Oacgiltz"
LIBS="$LIBS -lPW -lsocket -lmalloc -lcrypt_i"
;;
*-sco5*)
OS='SCO 5'
CFLAGS="$CFLAGS -DSCO5"
LIBS="$LIBS -lsocket -lmalloc -lprot"
OSBPRINTF="-K noinline"
DEF_WANTHSREGEX=no
DEF_BADMMAP=no
;;
*-solaris2*)
OS='Solaris 2'
CFLAGS="$CFLAGS -DSOLARIS2"
LIBS="$LIBS -lsocket -lnsl"
;;
*-sunos4*)
OS='SunOS 4'
CFLAGS="$CFLAGS -DSUNOS4"
;;
UNIXWARE)
OS='Unixware'
CFLAGS="$CFLAGS -DSVR4"
LIBS="$LIBS -lsocket -lnsl -lcrypt"
;;
*-sysv4*)
OS='SVR4'
CFLAGS="$CFLAGS -DSVR4"
LIBS="$LIBS -lsocket -lnsl -lc"
;;
UTS)
OS='Amdahl UTS'
CFLAGS="$CFLAGS -Xa -eft -DUTS21"
LIBS="$LIBS -lsocket -lbsd -la"
;;
UXPDS)
OS='UXP/DS'
CFLAGS="$CFLAGS -DUXPDS"
LIBS="$LIBS -lsocket -lnsl"
;;
*) # default: Catch systems we don't know about
echo Sorry, but we cannot grok \"$PLAT\"
echo Please Email this output to apache-bugs@apache.org
echo Thank you
exit 1
;;
esac
# Extract the rules
RULE_WANTHSREGEX=`./CutRule WANTHSREGEX`
RULE_STATUS=`./CutRule STATUS`
RULE_SOCKS=`./CutRule SOCKS`
RULE_BADMMAP=`./CutRule BADMMAP`
if [ "$RULE_WANTHSREGEX" = "default" ]; then
if [ "x$DEF_WANTHSREGEX" = "x" ]; then
RULE_WANTHSREGEX=no
else
RULE_WANTHSREGEX=$DEF_WANTHSREGEX
fi
fi
if [ "$RULE_BADMMAP" = "default" ]; then
if [ "x$DEF_BADMMAP" = "x" ]; then
RULE_BADMMAP=no
else
RULE_BADMMAP=$DEF_BADMMAP
fi
fi
# Show the final values of the rules
echo "# Platform: $OS" >> Makefile
echo "# Final Rules:" >> Makefile
echo "# Rule WANTHSREGEX=$RULE_WANTHSREGEX" >> Makefile
echo "# Rule BADMMAP=$RULE_BADMMAP" >> Makefile
echo "###############" >> Makefile
#
# Now that _that's_ done, get on with it
#
echo "Configured for $OS platform"
echo
#
# Handle the setting of CC and OPTIM. The values in Configure
# have priority. If not set there, then we check if they were
# set above. If so, then we honor that; if not, then we set some
# defaults (gcc and -O2)
#
if grep "CC=" Makefile > /dev/null; then
CC="" # clear it just in case
else
if [ "x$CC" = "x" ]; then CC="gcc"; fi
fi
#
# Ditto for optimization
#
if grep "OPTIM=" Makefile > /dev/null; then
OPTIM="" # ditto
else
if [ "x$OPTIM" = "x" ]; then OPTIM="-O2"; fi
fi
#
# Are they using the status monitor module? If so, check
# for STATUS rule...
#
STAT_MOD="mod_status"
if grep "$STAT_MOD" Makefile > /dev/null; then
if [ "$RULE_STATUS" = "yes" ]; then
CFLAGS="$CFLAGS -DSTATUS"
fi
fi
#
# Now HS's POSIX regex implementation if needed/wanted
#
if [ "$RULE_WANTHSREGEX" = "yes" ]; then
REGLIB="regex/libregex.a"
INCLUDES="$INCLUDES -Iregex"
fi
#
# Broken mmap?
#
if [ "$RULE_BADMMAP" = "yes" ]; then
CFLAGS="$CFLAGS -DNO_MMAP"
fi
#
# Now SOCKS.
# NOTE: We assume that if they are using SOCKS, then they've
# adjusted EXTRA_LIBS and/or EXTRA_LFLAGS as required,
# otherwise we assume "-L/usr/local/lib -lsocks"
#
if [ "$RULE_SOCKS" = "yes" ]; then
# Set flag and check Makefile for -lsocks line
CFLAGS="$CFLAGS -Dconnect=Rconnect -Dselect=Rselect"
CFLAGS="$CFLAGS -Dgethostbyname=Rgethostbyname"
if grep "EXTRA_" Makefile | grep "\-lsocks" > /dev/null; then
:
else
LIBS="$LIBS -L/usr/local/lib -lsocks"
fi
fi
#
# Good enough
#
echo >> Makefile
if [ "x$CC" != "x" ]; then
echo "CC=$CC" >> Makefile
fi
if [ "x$OPTIM" != "x" ]; then
echo "OPTIM=$OPTIM" >> Makefile
fi
echo "CFLAGS1=$CFLAGS">> Makefile
echo "INCLUDES1=$INCLUDES">> Makefile
echo "LIBS1=$LIBS">> Makefile
echo "LFLAGS1=$LFLAGS">> Makefile
echo "BROKEN_BPRINTF_FLAGS=$OSBPRINTF">> Makefile
echo "REGLIB=$REGLIB">> Makefile
echo >> Makefile
echo "#### End of Configure created section ####">> Makefile
echo >> Makefile
cat Makefile.tmpl >> Makefile