]> granicus.if.org Git - apache/commitdiff
The second part of the big autoconf patch, which actually adds autoconf
authorManoj Kasichainula <manoj@apache.org>
Mon, 29 Nov 1999 23:47:33 +0000 (23:47 +0000)
committerManoj Kasichainula <manoj@apache.org>
Mon, 29 Nov 1999 23:47:33 +0000 (23:47 +0000)
building to the tree.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84187 13f79535-47bb-0310-9956-ffa450edef68

12 files changed:
acinclude.m4 [new file with mode: 0644]
build/config-stubs [new file with mode: 0755]
buildconf [new file with mode: 0755]
configure.in [new file with mode: 0644]
modules/aaa/config.m4 [new file with mode: 0644]
os/config.m4 [new file with mode: 0644]
os/unix/config.m4 [new file with mode: 0644]
server/config.m4 [new file with mode: 0644]
server/mpm/config.m4 [new file with mode: 0644]
server/mpm/dexter/config.m4 [new file with mode: 0644]
server/mpm/mpmt_pthread/config.m4 [new file with mode: 0644]
server/mpm/prefork/config.m4 [new file with mode: 0644]

diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644 (file)
index 0000000..aa97f72
--- /dev/null
@@ -0,0 +1,59 @@
+dnl
+dnl APACHE_MODULE(modname [, shared])
+dnl
+dnl Includes an extension in the build.
+dnl
+dnl "modname" is the name of the modules/ subdir where the extension resides
+dnl "shared" can be set to "shared" or "yes" to build the extension as
+dnl a dynamically loadable library.
+dnl
+AC_DEFUN(APACHE_MODULE,[
+  if test -d "$cwd/$srcdir/modules/$1" ; then
+    MOD_SUBDIRS="$MOD_SUBDIRS $1"
+    if test "$2" != "shared" -a "$2" != "yes"; then
+      libname=$(basename $1)
+      _extlib="lib${libname}.a"
+      MOD_LTLIBS="$MOD_LTLIBS modules/$1/lib${libname}.la"
+      MOD_LIBS="$MOD_LIBS $1/$_extlib"
+      MOD_STATIC="$MOD_STATIC $1"
+    else
+      MOD_SHARED="$MOD_SHARED $1"
+    fi
+    APACHE_OUTPUT(modules/$1/Makefile)
+  fi
+])
+
+AC_SUBST(MOD_LTLIBS)
+
+dnl ## APACHE_OUTPUT(file)
+dnl ## adds "file" to the list of files generated by AC_OUTPUT
+dnl ## This macro can be used several times.
+AC_DEFUN(APACHE_OUTPUT, [
+  APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
+])
+
+dnl
+dnl AC_ADD_LIBRARY(library)
+dnl
+dnl add a library to the link line
+dnl
+AC_DEFUN(AC_ADD_LIBRARY,[
+  APACHE_ONCE(LIBRARY, $1, [
+    EXTRA_LIBS="$EXTRA_LIBS -l$1"
+  ])
+])
+
+dnl
+dnl APACHE_ONCE(namespace, variable, code)
+dnl
+dnl execute code, if variable is not set in namespace
+dnl
+AC_DEFUN(APACHE_ONCE,[
+  unique=`echo $ac_n "$2$ac_c" | tr -c -d a-zA-Z0-9`
+  cmd="echo $ac_n \"\$$1$unique$ac_c\""
+  if test -n "$unique" && test "`eval $cmd`" = "" ; then
+    eval "$1$unique=set"
+    $3
+  fi
+])
+
diff --git a/build/config-stubs b/build/config-stubs
new file mode 100755 (executable)
index 0000000..aff00a5
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+dir=$1
+for stubdir in `find $dir -type d`; do
+    if [ -r $stubdir/config.m4 ]; then
+        echo "sinclude($stubdir/config.m4)"
+    fi
+done
diff --git a/buildconf b/buildconf
new file mode 100755 (executable)
index 0000000..123c717
--- /dev/null
+++ b/buildconf
@@ -0,0 +1,107 @@
+#!/bin/sh
+
+# TODO - Steal the new PHP buildconf and build.mk.
+# This will do for now, though
+
+supplied_flag=$1
+
+# do some version checking for the tools we use
+if test "$1" = "--force"; then
+    shift
+# this is a posix correct "test -nt"
+elif test "`ls -t buildconf buildconf.stamp 2>/dev/null |head -1`" != "buildconf"; then
+    :
+else
+    echo "buildconf: checking installation..."
+
+    # autoconf will check for the version itself
+    # automake 1.4 or newer
+    am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
+    if test "$am_version" = ""; then
+       echo "buildconf: automake not found."
+       echo "           You need automake version 1.4 or newer installed"
+       echo "           to build APACHE from CVS."
+       exit 1
+    fi
+    IFS=.; set $am_version; IFS=' '
+    if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then
+       echo "buildconf: automake version $am_version found."
+       echo "           You need automake version 1.4 or newer installed"
+       echo "           to build APACHE from CVS."
+       exit 1
+    else
+       echo "buildconf: automake version $am_version (ok)"
+    fi
+
+    # libtool 1.3.3 or newer
+    lt_pversion=`libtool --version 2>/dev/null|sed -e 's/^[^0-9]*//' -e 's/[- ].*//'`
+    if test "$lt_pversion" = ""; then
+       echo "buildconf: libtool not found."
+       echo "           You need libtool version 1.3 or newer installed"
+       echo "           to build APACHE from CVS."
+       exit 1
+    fi
+    lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
+    IFS=.; set $lt_version; IFS=' '
+    if test "$1" -gt "1" || test "$2" -gt "3" || test "$2" = "3" -a "$3" -ge "3"
+    then
+       echo "buildconf: libtool version $lt_pversion (ok)"
+    else
+       echo "buildconf: libtool version $lt_pversion found."
+       echo "           You need libtool version 1.3.3 or newer installed"
+       echo "           to build APACHE from CVS."
+       exit 1
+    fi
+    touch buildconf.stamp
+fi
+
+am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'`
+lt_prefix=`which libtool | sed -e 's#/[^/]*/[^/]*$##'`
+if test "$am_prefix" != "$lt_prefix"; then
+    echo "buildconf: WARNING: automake and libtool are installed in different"
+    echo "           directories.  This may cause aclocal to fail."
+    echo "buildconf: continuing anyway"
+fi
+
+if test "$supplied_flag" = "--copy"; then
+    automake_flags=--copy
+fi
+
+./helpers/build-acconfig-header
+
+mv aclocal.m4 aclocal.m4.old 2>/dev/null
+aclocal
+if test "$?" != "0" -a "$am_prefix" != "$lt_prefix"; then
+    echo "buildconf: ERROR: aclocal failed, probably because automake and"
+    echo "           libtool are installed with different prefixes;"
+    echo "           automake is installed in $am_prefix, but libtool in $lt_prefix."
+    echo "           Please re-install automake and/or libtool with a common prefix"
+    echo "           and try again."
+    exit 1
+fi
+
+if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
+    echo "buildconf: keeping aclocal.m4"
+    mv aclocal.m4.old aclocal.m4
+else
+    echo "buildconf: created or modified aclocal.m4"
+fi
+
+autoheader
+
+# find all Makefile.ams
+files="Makefile `find ap lib main modules regex os -name Makefile.am | sed 's#\.am##' | tr '\n' ' '`"
+
+# suppress stupid automake warning
+automake --add-missing --include-deps $automake_flags $files 2>&1 | grep -v \$APACHE_OUTPUT_FILES >&2
+
+
+mv configure configure.old 2>/dev/null
+autoconf
+if cmp configure.old configure > /dev/null 2>&1; then
+    echo "buildconf: keeping configure"
+    mv configure.old configure
+else
+    echo "buildconf: created or modified configure"
+fi
+
diff --git a/configure.in b/configure.in
new file mode 100644 (file)
index 0000000..952328a
--- /dev/null
@@ -0,0 +1,92 @@
+dnl ## Process this file with autoconf to produce a configure script
+
+AC_PREREQ(2.13)
+AC_INIT(main/http_main.c)
+AM_INIT_AUTOMAKE(apache, 2.0-dev)
+
+dnl This would be in src/include, but I think I've found an autoheader bug
+AM_CONFIG_HEADER(ap_config_auto.h)
+
+dnl ## This is the central place where Apache's version should be kept.
+
+APACHE_VERSION=$VERSION
+AC_SUBST(APACHE_VERSION)
+
+dnl XXX - doesn't actually work, because of the APACHE_OUTPUT_FILES error
+AM_MAINTAINER_MODE
+
+dnl We want this one before the checks, so the checks can modify CFLAGS
+test -z "$CFLAGS" && auto_cflags=1
+
+dnl Needed for APACHE_MODULE() to work
+cwd=`pwd`
+
+dnl ## Check for programs
+
+dnl AC_PROG_AWK
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+dnl AC_PROG_RANLIB
+dnl AC_PATH_PROG(PERL_PATH, perl)
+
+dnl info autoconf says AIX needs this. Okay.
+AC_AIX
+
+dnl ## Check for libraries
+
+dnl ## Check for header files
+
+dnl I think these are just used all over the place, so just check for
+dnl them at the base of the tree. If some are specific to a single
+dnl directory, they should be moved (Comment #Spoon)
+
+AC_CHECK_HEADERS( \
+unistd.h \
+sys/times.h \
+sys/time.h \
+)
+
+dnl ## Check for typedefs, structures, and compiler characteristics.
+
+AC_C_INLINE
+
+dnl ## Check for library functions
+
+dnl See Comment #Spoon
+
+AC_CHECK_FUNCS( \
+strdup \
+strcasecmp \
+strncasecmp \
+strstr \
+strerror \
+initgroups \
+waitpid \
+difftime \
+gettimeofday \
+memmove \
+)
+
+AM_PROG_LIBTOOL
+
+dnl ## Checking command-line options
+test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \
+    CFLAGS="$CFLAGS -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
+
+INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/lib/apr/include"
+AC_SUBST(INCLUDES)
+
+dnl reading config stubs
+esyscmd(./helpers/config-stubs .)
+
+INCLUDES="$INCLUDES -I\$(top_srcdir)/\$(OS_DIR)"
+AC_SUBST(EXTRA_LIBS)
+AC_SUBST(REGEX_DIR)
+AC_SUBST(REGEX_LIB)
+AC_SUBST(MPM_LIB)
+AC_SUBST(OS)
+AC_SUBST(OS_DIR)
+
+AC_OUTPUT([Makefile ap/Makefile main/Makefile lib/apr/Makefile os/Makefile
+          $APACHE_OUTPUT_FILES])
diff --git a/modules/aaa/config.m4 b/modules/aaa/config.m4
new file mode 100644 (file)
index 0000000..9d069b5
--- /dev/null
@@ -0,0 +1 @@
+APACHE_MODULE(standard)
diff --git a/os/config.m4 b/os/config.m4
new file mode 100644 (file)
index 0000000..750f9b0
--- /dev/null
@@ -0,0 +1,8 @@
+AC_MSG_CHECKING(which OS this is)
+
+dnl ## XXX - I'm not sure, but this might not handle the non-Unix case yet
+OS=unix
+OS_DIR=os/$OS
+
+AC_MSG_RESULT([$OS])
+APACHE_OUTPUT(os/$OS/Makefile)
diff --git a/os/unix/config.m4 b/os/unix/config.m4
new file mode 100644 (file)
index 0000000..8646913
--- /dev/null
@@ -0,0 +1,7 @@
+AC_CHECK_FUNCS( \
+setsid \
+killpg \
+)
+
+dnl XXX - This doesn't deal with _sys_siglist. Probably have to roll our own
+AC_DECL_SYS_SIGLIST
diff --git a/server/config.m4 b/server/config.m4
new file mode 100644 (file)
index 0000000..e37203d
--- /dev/null
@@ -0,0 +1,53 @@
+dnl ## Check for libraries
+
+AC_CHECK_LIB(nsl, gethostname, [
+ AC_ADD_LIBRARY(nsl) ], [])
+
+AC_CHECK_LIB(socket, socket, [
+ AC_ADD_LIBRARY(socket) ], [])
+
+AC_CHECK_LIB(nsl, gethostbyaddr, [
+ AC_ADD_LIBRARY(nsl) ], [])
+
+AC_CHECK_LIB(crypt, crypt, [
+ AC_ADD_LIBRARY(crypt) 
+ AC_DEFINE(HAVE_CRYPT)], [])
+
+AC_CHECK_LIB(c, crypt, [
+ AC_DEFINE(HAVE_CRYPT)], [])
+
+dnl ## Check for header files
+
+AC_HEADER_STDC
+AC_CHECK_HEADERS(
+bstring.h \
+crypt.h \
+unistd.h \
+sys/resource.h \
+sys/select.h \
+sys/processor.h \
+)
+
+dnl ## Check for typedefs, structures, and compiler characteristics.
+
+AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
+  ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
+
+if test "$ac_cv_struct_tm_gmtoff" = "yes"; then
+    AC_DEFINE(HAVE_GMTOFF)
+fi
+
+dnl ## Check for library functions
+
+AC_CHECK_FUNCS(
+difftime \
+syslog \
+)
+AC_FUNC_MMAP
+
+dnl XXX - is autoconf's detection routine good enough?
+if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then
+    AC_DEFINE(USE_MMAP_FILES)
+fi
diff --git a/server/mpm/config.m4 b/server/mpm/config.m4
new file mode 100644 (file)
index 0000000..3c30fd0
--- /dev/null
@@ -0,0 +1,56 @@
+AC_MSG_CHECKING(which MPM to use)
+AC_ARG_WITH(mpm,
+[  --with-mpm=MPM          Choose the process model, etc. for Apache to use.],
+[
+  if test "$withval" != "no" ; then
+    apache_cv_mpm=$withval
+    AC_MSG_RESULT($apache_cv_mpm)
+  else
+    AC_MSG_ERROR(An MPM must be specified)
+  fi
+],[
+  AC_MSG_ERROR(An MPM must be specified)
+])
+
+APACHE_OUTPUT(modules/mpm/Makefile)
+MPM_NAME=$apache_cv_mpm
+MPM_DIR=modules/mpm/$MPM_NAME
+MPM_LIB=$MPM_DIR/lib${MPM_NAME}.la
+
+AC_SUBST(MPM_NAME)
+
+dnl All the unix MPMs use shared memory; save a little duplication
+AC_DEFUN(APACHE_MPM_CHECK_SHMEM, [
+    AC_CHECK_FUNCS(shmget)
+    AC_FUNC_MMAP
+    
+    AC_MSG_CHECKING(which shared memory mechanism to use)
+    if test "$ac_cv_func_shmget" = "yes" ; then
+        AC_DEFINE(USE_SHMGET_SCOREBOARD)
+        AC_MSG_RESULT(shmget)
+    elif test "$ac_cv_func_mmap" = "yes" ; then
+        AC_DEFINE(USE_MMAP_SCOREBOARD)
+        AC_MSG_RESULT(mmap)
+    else
+        AC_MSG_ERROR(No known shared memory system)
+    fi
+])
+
+dnl Check for pthreads and attempt to support it
+AC_DEFUN(APACHE_MPM_PTHREAD, [
+
+dnl XXX - We should be checking for the proper flags to use on a particular 
+dnl platform. This will cover a couple of them, anyway
+    CFLAGS="-pthread $CFLAGS"
+    CXXFLAGS="-pthread $CXXFLAGS"
+
+    AC_CHECK_HEADER(pthread.h, [ ],[
+        AC_MSG_ERROR(This MPM requires pthreads. Try --with-mpm=prefork.)
+    ])
+    AC_CHECK_FUNC(pthread_create, [ ],[
+        AC_MSG_ERROR(Can't compile pthread code.)
+    ])
+
+    dnl User threads libraries need pthread.h included everywhere
+    AC_DEFINE(PTHREAD_EVERYWHERE)
+])
diff --git a/server/mpm/dexter/config.m4 b/server/mpm/dexter/config.m4
new file mode 100644 (file)
index 0000000..2106ca9
--- /dev/null
@@ -0,0 +1,7 @@
+dnl ## XXX - Need a more thorough check of the proper flags to use
+
+if test "$MPM_NAME" = "dexter" ; then
+    APACHE_OUTPUT(modules/mpm/$MPM_NAME/Makefile)
+    APACHE_MPM_PTHREAD
+    APACHE_MPM_CHECK_SHMEM
+fi
diff --git a/server/mpm/mpmt_pthread/config.m4 b/server/mpm/mpmt_pthread/config.m4
new file mode 100644 (file)
index 0000000..a60c6a5
--- /dev/null
@@ -0,0 +1,7 @@
+dnl ## XXX - Need a more thorough check of the proper flags to use
+
+if test "$MPM_NAME" = "mpmt_pthread" ; then
+    APACHE_OUTPUT(modules/mpm/$MPM_NAME/Makefile)
+    APACHE_MPM_PTHREAD
+    APACHE_MPM_CHECK_SHMEM
+fi
diff --git a/server/mpm/prefork/config.m4 b/server/mpm/prefork/config.m4
new file mode 100644 (file)
index 0000000..b4cfe38
--- /dev/null
@@ -0,0 +1,5 @@
+if test "$MPM_NAME" = "prefork" ; then
+    APACHE_OUTPUT(modules/mpm/$MPM_NAME/Makefile)
+
+    APACHE_MPM_CHECK_SHMEM
+fi