From badb2791f14fc2425979f5b4043b5f7b387ba71d Mon Sep 17 00:00:00 2001 From: brectanus Date: Wed, 2 Jan 2008 21:32:10 +0000 Subject: [PATCH] Initial 'configure' based compilation (buildconf generates configure script). --- CHANGES | 5 + apache2/Makefile | 67 --------- apache2/Makefile.in | 61 ++++++++ apache2/build/PrintPath | 130 +++++++++++++++++ apache2/build/buildcheck.sh | 54 +++++++ apache2/build/find_apr.m4 | 57 ++++++++ apache2/build/find_apu.m4 | 57 ++++++++ apache2/build/find_lua.m4 | 58 ++++++++ apache2/build/find_pcre.m4 | 57 ++++++++ apache2/build/find_xml.m4 | 57 ++++++++ apache2/build/install.sh | 224 ++++++++++++++++++++++++++++++ apache2/buildconf | 83 +++++++++++ apache2/configure.in | 82 +++++++++++ apache2/mod_security2_config.h.in | 16 +++ 14 files changed, 941 insertions(+), 67 deletions(-) delete mode 100644 apache2/Makefile create mode 100644 apache2/Makefile.in create mode 100755 apache2/build/PrintPath create mode 100755 apache2/build/buildcheck.sh create mode 100644 apache2/build/find_apr.m4 create mode 100644 apache2/build/find_apu.m4 create mode 100644 apache2/build/find_lua.m4 create mode 100644 apache2/build/find_pcre.m4 create mode 100644 apache2/build/find_xml.m4 create mode 100755 apache2/build/install.sh create mode 100755 apache2/buildconf create mode 100644 apache2/configure.in create mode 100644 apache2/mod_security2_config.h.in diff --git a/CHANGES b/CHANGES index 4d9147a0..4b23ac27 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +02 Jan 2008 - 2.5.0-rc2 +----------------------- + + * Build is now 'configure' based (autotools). + 21 Dec 2007 - 2.5.0-rc1 ----------------------- diff --git a/apache2/Makefile b/apache2/Makefile deleted file mode 100644 index dd9832c2..00000000 --- a/apache2/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -builddir = . - -# To successfully build ModSecurity for Apache you will -# need to configure the "top_dir" variable properly. The -# correct value will differ from system to system. -# -# If you've installed Apache manually simply point to the -# installation directory. Most pre-packaged installations -# consist of two parts. One contains the binaries, and the -# other contains the "development" files. You will typically -# need both. -# -# The list below may help: -# -# Fedora Core - /usr/lib/httpd (the httpd-devel package must be installed) -# -# Debian - /usr/share/apache2 (apache2-prefork-dev or apache2-threaded-dev -# needed, depending on your installation type) -# -# NOTE: On Solaris the top_builddir is /var/apache2. This version of Apache -# httpd uses the buildin PCRE, but you must still install the PCRE headers -# to compile ModSecurity as they are not installed with Apache httpd. Because -# of this, it is recommended to install your own version of Apache httpd. -# -# Additionally, if you do not have PCRE installed, you can use the -# headers included with Apache httpd. To do this, add the PCRE -# include directory to the INCLUDES variable below -# Something like: -I /path/to/httpd-x.y/srclib/pcre -# -top_dir = /usr/local/apache2 - -top_srcdir = ${top_dir} -top_builddir = ${top_dir} - -include ${top_builddir}/build/special.mk - -APXS = apxs -APACHECTL = apachectl - -INCLUDES = -I /usr/include/libxml2 -I /usr/include/lua5.1 -# INCLUDES = -I /usr/include/libxml2 -I /path/to/httpd-x.y/srclib/pcre -# DEFS = -DPERFORMANCE_MEASUREMENT -# DEFS = -DNO_MODSEC_API -# DEFS = -DDEBUG_CONF -# DEFS = -DCACHE_DEBUG -# LIBS = -Lmy/lib/dir -lmylib - -CFLAGS = -O2 -g -Wuninitialized -Wall -Wmissing-prototypes -Wshadow -Wunused-variable -Wunused-value -Wchar-subscripts -Wsign-compare - -all: local-shared-build - -### Experimental Test Framework (UNIX only right now) -TESTOBJS = re.o re_operators.o re_actions.o re_tfns.o re_variables.o \ - msc_logging.o msc_xml.o msc_multipart.o modsecurity.o \ - msc_parsers.o msc_util.o msc_pcre.o persist_dbm.o \ - msc_reqbody.o msc_geo.o acmp.o msc_lua.o - -msc_test: msc_test.c ${TESTOBJS} - @${CC} ${CFLAGS} -I `${top_dir}/bin/${APXS} -q INCLUDEDIR` ${INCLUDES} ${DEFS} -L ${top_dir}/lib -o msc_test ${TESTOBJS} msc_test.c -lapr-1 -laprutil-1 -lpcre -lxml2 -llua5.1 - -test: msc_test - t/run-tests.pl - -clean: - -rm -f *.o *.lo *.slo *.la *~ .libs msc_test - -.PHONY: all clean test diff --git a/apache2/Makefile.in b/apache2/Makefile.in new file mode 100644 index 00000000..37d82213 --- /dev/null +++ b/apache2/Makefile.in @@ -0,0 +1,61 @@ +# Makefile for ModSecurity + +APXS=@APXS@ + +MOD_SECURITY2 = mod_security2 apache2_config apache2_io apache2_util \ + re re_operators re_actions re_tfns re_variables \ + msc_logging msc_xml msc_multipart modsecurity msc_parsers msc_util msc_pcre \ + persist_dbm msc_reqbody pdf_protect msc_geo acmp msc_lua + +MOD_SECURITY2_H = re.h modsecurity.h msc_logging.h msc_multipart.h msc_parsers.h \ + msc_pcre.h msc_util.h msc_xml.h persist_dbm.h apache2.h pdf_protect.h \ + msc_geo.h acmp.h utf8tables.h msc_lua.h + +EXTRA_CFLAGS = -Wc,-O2 -Wc,-g -Wc,-Wall -Wc,-Werror +#EXTRA_CFLAGS = -Wc,-O2 -Wc,-g -Wc,-Wuninitialized -Wc,-Wall -Wc,-Werror -Wc,-Wmissing-prototypes -Wc,-Wshadow -Wc,-Wunused-variable -Wc,-Wunused-value -Wc,-Wchar-subscripts -Wc,-Wsign-compare + +PCRE_CFLAGS = @PCRE_CFLAGS@ +PCRE_LIBS = @PCRE_LIBS@ + +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ + +LIBXML_CFLAGS = @LIBXML_CFLAGS@ +LIBXML_LIBS = @LIBXML_LIBS@ + +CPPFLAGS=$(PCRE_CFLAGS) $(LIBXML_CFLAGS) $(LUA_CFLAGS) $(EXTRA_CFLAGS) +LIBS=$(PCRE_LIBS) $(LIBXML_LIBS) $(LUA_LIBS) +LDFLAGS= + +COMPILE_APACHE_MOD = $(APXS) -c $(CPPFLAGS) $(LDFLAGS) $(LIBS) + +INSTALL_MOD_SHARED = $(APXS) -i + +all: mod_security2.la + +install: install-mods + +clean: + @rm -rf *.la *.lo *.o *.slo .libs + +maintainer-clean: clean + @rm -rf Makefile config config.log config.status configure mod_security2_config.h + +dist-clean: maintainer-clean + +install-mods: mod_security2.la + $(INSTALL_MOD_SHARED) mod_security2.la + +${MOD_SECURITY2:=.slo}: ${MOD_SECURITY2_H} + +${MOD_SECURITY2:=.lo}: ${MOD_SECURITY2_H} + +${MOD_SECURITY2:=.o}: ${MOD_SECURITY2_H} + +mod_security2.la: ${MOD_SECURITY2:=.slo} + @src=""; \ + for f in $(MOD_SECURITY2); do \ + src="$$src $$f.c"; \ + done; \ + $(COMPILE_APACHE_MOD) $$src + diff --git a/apache2/build/PrintPath b/apache2/build/PrintPath new file mode 100755 index 00000000..2a2b48b6 --- /dev/null +++ b/apache2/build/PrintPath @@ -0,0 +1,130 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# Look for program[s] somewhere in $PATH. +# +# Options: +# -s +# Do not print out full pathname. (silent) +# -pPATHNAME +# Look in PATHNAME instead of $PATH +# +# Usage: +# PrintPath [-s] [-pPATHNAME] program [program ...] +# +# Initially written by Jim Jagielski for the Apache configuration mechanism +# (with kudos to Kernighan/Pike) + +## +# Some "constants" +## +pathname=$PATH +echo="yes" + +## +# Find out what OS we are running for later on +## +os=`(uname) 2>/dev/null` + +## +# Parse command line +## +for args in $* +do + case $args in + -s ) echo="no" ;; + -p* ) pathname="`echo $args | sed 's/^..//'`" ;; + * ) programs="$programs $args" ;; + esac +done + +## +# Now we make the adjustments required for OS/2 and everyone +# else :) +# +# First of all, all OS/2 programs have the '.exe' extension. +# Next, we adjust PATH (or what was given to us as PATH) to +# be whitespace separated directories. +# Finally, we try to determine the best flag to use for +# test/[] to look for an executable file. OS/2 just has '-r' +# but with other OSs, we do some funny stuff to check to see +# if test/[] knows about -x, which is the prefered flag. +## + +if [ "x$os" = "xOS/2" ] +then + ext=".exe" + pathname=`echo -E $pathname | + sed 's/^;/.;/ + s/;;/;.;/g + s/;$/;./ + s/;/ /g + s/\\\\/\\//g' ` + test_exec_flag="-r" +else + ext="" # No default extensions + pathname=`echo $pathname | + sed 's/^:/.:/ + s/::/:.:/g + s/:$/:./ + s/:/ /g' ` + # Here is how we test to see if test/[] can handle -x + testfile="pp.t.$$" + + cat > $testfile </dev/null`; then + test_exec_flag="-x" + else + test_exec_flag="-r" + fi + rm -f $testfile +fi + +for program in $programs +do + for path in $pathname + do + if [ $test_exec_flag $path/${program}${ext} ] && \ + [ ! -d $path/${program}${ext} ]; then + if [ "x$echo" = "xyes" ]; then + echo $path/${program}${ext} + fi + exit 0 + fi + +# Next try without extension (if one was used above) + if [ "x$ext" != "x" ]; then + if [ $test_exec_flag $path/${program} ] && \ + [ ! -d $path/${program} ]; then + if [ "x$echo" = "xyes" ]; then + echo $path/${program} + fi + exit 0 + fi + fi + done +done +exit 1 + diff --git a/apache2/build/buildcheck.sh b/apache2/build/buildcheck.sh new file mode 100755 index 00000000..3097b0a4 --- /dev/null +++ b/apache2/build/buildcheck.sh @@ -0,0 +1,54 @@ +#! /bin/sh + +echo "buildconf: checking installation..." + +# autoconf 2.50 or newer +ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a-z]* *$//;q'` +if test -z "$ac_version"; then +echo "buildconf: autoconf not found." +echo " You need autoconf version 2.50 or newer installed" +echo " to build APR from SVN." +exit 1 +fi +IFS=.; set $ac_version; IFS=' ' +if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then +echo "buildconf: autoconf version $ac_version found." +echo " You need autoconf version 2.50 or newer installed" +echo " to build APR from SVN." +exit 1 +else +echo "buildconf: autoconf version $ac_version (ok)" +fi + +# Sample libtool --version outputs: +# ltmain.sh (GNU libtool) 1.3.3 (1.385.2.181 1999/07/02 15:49:11) +# ltmain.sh (GNU libtool 1.1361 2004/01/02 23:10:52) 1.5a +# output is multiline from 1.5 onwards + +# Require libtool 1.4 or newer +libtool=`build/PrintPath glibtool libtool libtool15 libtool14` +lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'` +if test -z "$lt_pversion"; then +echo "buildconf: libtool not found." +echo " You need libtool version 1.4 or newer installed" +echo " to build APR from SVN." +exit 1 +fi +lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'` +IFS=.; set $lt_version; IFS=' ' +lt_status="good" +if test "$1" = "1"; then + if test "$2" -lt "4"; then + lt_status="bad" + fi +fi +if test $lt_status = "good"; then + echo "buildconf: libtool version $lt_pversion (ok)" + exit 0 +fi + +echo "buildconf: libtool version $lt_pversion found." +echo " You need libtool version 1.4 or newer installed" +echo " to build APR from SVN." + +exit 1 diff --git a/apache2/build/find_apr.m4 b/apache2/build/find_apr.m4 new file mode 100644 index 00000000..59a9a3c5 --- /dev/null +++ b/apache2/build/find_apr.m4 @@ -0,0 +1,57 @@ +dnl Check for APR Libraries +dnl CHECK_APR(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) +dnl Sets: +dnl APR_CFLAGS +dnl APR_LIBS + +APR_CONFIG="apr-config" +APR_CFLAGS="" +APR_LIBS="" + +AC_DEFUN([CHECK_APR], +[dnl + +AC_ARG_WITH( + apr, + [AC_HELP_STRING([--with-apr=PATH],[Path to the apr prefix])], + apr_path="$withval", + :) + +dnl # Determine apr lib directory +if test -z "${apr_path}"; then + test_paths="/usr/local /usr" +else + test_paths="${apr_path}" +fi + +AC_MSG_CHECKING([for ${APR_CONFIG}]) +for x in ${test_paths}; do + if test -e "${x}/bin/${APR_CONFIG}"; then + with_apr="${x}" + break + else + with_apr="" + fi +done +if test -n "${with_apr}"; then + APR_CONFIG="${with_apr}/bin/${APR_CONFIG}" + AC_MSG_RESULT([${APR_CONFIG}]) + APR_CFLAGS="`${APR_CONFIG} --cflags`" + APR_LIBS="`${APR_CONFIG} --libs`" + CFLAGS=$save_CFLAGS + LDFLAGS=$save_LDFLAGS +else + AC_MSG_RESULT([no]) +fi + +AC_SUBST(APR_LIBS) +AC_SUBST(APR_CFLAGS) + +if test -z "${APR_LIBS}"; then + AC_MSG_NOTICE([*** apr library not found.]) + ifelse([$2], , AC_MSG_ERROR([apr library is required]), $2) +else + AC_MSG_NOTICE([using '${APR_LIBS}' for apr Library]) + ifelse([$1], , , $1) +fi +]) diff --git a/apache2/build/find_apu.m4 b/apache2/build/find_apu.m4 new file mode 100644 index 00000000..ed1f6aaa --- /dev/null +++ b/apache2/build/find_apu.m4 @@ -0,0 +1,57 @@ +dnl Check for APU Libraries +dnl CHECK_APU(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) +dnl Sets: +dnl APU_CFLAGS +dnl APU_LIBS + +APU_CONFIG="apu-1-config" +APU_CFLAGS="" +APU_LIBS="" + +AC_DEFUN([CHECK_APU], +[dnl + +AC_ARG_WITH( + apu, + [AC_HELP_STRING([--with-apu=PATH],[Path to the apu prefix])], + apu_path="$withval", + :) + +dnl # Determine apu lib directory +if test -z "${apu_path}"; then + test_paths="/usr/local /usr" +else + test_paths="${apu_path}" +fi + +AC_MSG_CHECKING([for ${APU_CONFIG}]) +for x in ${test_paths}; do + if test -e "${x}/bin/${APU_CONFIG}"; then + with_apu="${x}" + break + else + with_apu="" + fi +done +if test -n "${with_apu}"; then + APU_CONFIG="${with_apu}/bin/${APU_CONFIG}" + AC_MSG_RESULT([${APU_CONFIG}]) + APU_CFLAGS="`${APU_CONFIG} --cflags`" + APU_LIBS="`${APU_CONFIG} --libs`" + CFLAGS=$save_CFLAGS + LDFLAGS=$save_LDFLAGS +else + AC_MSG_RESULT([no]) +fi + +AC_SUBST(APU_LIBS) +AC_SUBST(APU_CFLAGS) + +if test -z "${APU_LIBS}"; then + AC_MSG_NOTICE([*** apu library not found.]) + ifelse([$2], , AC_MSG_ERROR([apu library is required]), $2) +else + AC_MSG_NOTICE([using '${APU_LIBS}' for apu Library]) + ifelse([$1], , , $1) +fi +]) diff --git a/apache2/build/find_lua.m4 b/apache2/build/find_lua.m4 new file mode 100644 index 00000000..b9503f2c --- /dev/null +++ b/apache2/build/find_lua.m4 @@ -0,0 +1,58 @@ +dnl Check for LUA Libraries +dnl CHECK_LUA(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) +dnl Sets: +dnl LUA_CFLAGS +dnl LUA_LIBS + +LUA_CONFIG="pkg-config" +LUA_PKGNAME="lua5.1" +LUA_CFLAGS="" +LUA_LIBS="" + +AC_DEFUN([CHECK_LUA], +[dnl + +AC_ARG_WITH( + lua, + [AC_HELP_STRING([--with-lua=PATH],[Path to the lua prefix])], + lua_path="$withval", + :) + +dnl # Determine lua lib directory +if test -z "${lua_path}"; then + test_paths="/usr/local /usr" +else + test_paths="${lua_path}" +fi + +AC_MSG_CHECKING([for ${LUA_CONFIG} for Lua]) +for x in ${test_paths}; do + if test -e "${x}/bin/${LUA_CONFIG}"; then + with_lua="${x}" + break + else + with_lua="" + fi +done +if test -n "${with_lua}"; then + LUA_CONFIG="${with_lua}/bin/${LUA_CONFIG}" + AC_MSG_RESULT([${LUA_CONFIG} ${LUA_PKGNAME}]) + LUA_CFLAGS="`${LUA_CONFIG} ${LUA_PKGNAME} --cflags`" + LUA_LIBS="`${LUA_CONFIG} ${LUA_PKGNAME} --libs`" + CFLAGS=$save_CFLAGS + LDFLAGS=$save_LDFLAGS +else + AC_MSG_RESULT([no]) +fi + +AC_SUBST(LUA_LIBS) +AC_SUBST(LUA_CFLAGS) + +if test -z "${LUA_LIBS}"; then + AC_MSG_NOTICE([*** lua library not found.]) + ifelse([$2], , AC_MSG_ERROR([lua library is required]), $2) +else + AC_MSG_NOTICE([using '${LUA_LIBS}' for lua Library]) + ifelse([$1], , , $1) +fi +]) diff --git a/apache2/build/find_pcre.m4 b/apache2/build/find_pcre.m4 new file mode 100644 index 00000000..3ca110ec --- /dev/null +++ b/apache2/build/find_pcre.m4 @@ -0,0 +1,57 @@ +dnl Check for PCRE Libraries +dnl CHECK_PCRE(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) +dnl Sets: +dnl PCRE_CFLAGS +dnl PCRE_LIBS + +PCRE_CONFIG="pcre-config" +PCRE_CFLAGS="" +PCRE_LIBS="" + +AC_DEFUN([CHECK_PCRE], +[dnl + +AC_ARG_WITH( + pcre, + [AC_HELP_STRING([--with-pcre=PATH],[Path to the pcre prefix])], + pcre_path="$withval", + :) + +dnl # Determine pcre lib directory +if test -z "${pcre_path}"; then + test_paths="/usr/local /usr" +else + test_paths="${pcre_path}" +fi + +AC_MSG_CHECKING([for ${PCRE_CONFIG}]) +for x in ${test_paths}; do + if test -e "${x}/bin/${PCRE_CONFIG}"; then + with_pcre="${x}" + break + else + with_pcre="" + fi +done +if test -n "${with_pcre}"; then + PCRE_CONFIG="${with_pcre}/bin/${PCRE_CONFIG}" + AC_MSG_RESULT([${PCRE_CONFIG}]) + PCRE_CFLAGS="`${PCRE_CONFIG} --cflags`" + PCRE_LIBS="`${PCRE_CONFIG} --libs`" + CFLAGS=$save_CFLAGS + LDFLAGS=$save_LDFLAGS +else + AC_MSG_RESULT([no]) +fi + +AC_SUBST(PCRE_LIBS) +AC_SUBST(PCRE_CFLAGS) + +if test -z "${PCRE_LIBS}"; then + AC_MSG_NOTICE([*** pcre library not found.]) + ifelse([$2], , AC_MSG_ERROR([pcre library is required]), $2) +else + AC_MSG_NOTICE([using '${PCRE_LIBS}' for pcre Library]) + ifelse([$1], , , $1) +fi +]) diff --git a/apache2/build/find_xml.m4 b/apache2/build/find_xml.m4 new file mode 100644 index 00000000..1690c972 --- /dev/null +++ b/apache2/build/find_xml.m4 @@ -0,0 +1,57 @@ +dnl Check for XML Libraries +dnl CHECK_LIBXML(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) +dnl Sets: +dnl LIBXML_CFLAGS +dnl LIBXML_LIBS + +LIBXML_CONFIG="xml2-config" +LIBXML_CFLAGS="" +LIBXML_LIBS="" + +AC_DEFUN([CHECK_LIBXML], +[dnl + +AC_ARG_WITH( + libxml, + [AC_HELP_STRING([--with-libxml=PATH],[Path to the libxml2 prefix])], + libxml_path="$withval", + :) + +dnl # Determine xml lib directory +if test -z "${libxml_path}"; then + test_paths="/usr/local /usr" +else + test_paths="${libxml_path}" +fi + +AC_MSG_CHECKING([for ${LIBXML_CONFIG}]) +for x in ${test_paths}; do + if test -e "${x}/bin/${LIBXML_CONFIG}"; then + with_libxml="${x}" + break + else + with_libxml="" + fi +done +if test -n "${with_libxml}"; then + LIBXML_CONFIG="${with_libxml}/bin/${LIBXML_CONFIG}" + AC_MSG_RESULT([${LIBXML_CONFIG}]) + LIBXML_CFLAGS="`${LIBXML_CONFIG} --cflags`" + LIBXML_LIBS="`${LIBXML_CONFIG} --libs`" + CFLAGS=$save_CFLAGS + LDFLAGS=$save_LDFLAGS +else + AC_MSG_RESULT([no]) +fi + +AC_SUBST(LIBXML_LIBS) +AC_SUBST(LIBXML_CFLAGS) + +if test -z "${LIBXML_LIBS}"; then + AC_MSG_NOTICE([*** libxml2 library not found.]) + ifelse([$2], , AC_MSG_ERROR([libxml2 library is required]), $2) +else + AC_MSG_NOTICE([using '${LIBXML_LIBS}' for libxml Library]) + ifelse([$1], , , $1) +fi +]) diff --git a/apache2/build/install.sh b/apache2/build/install.sh new file mode 100755 index 00000000..b6376ec2 --- /dev/null +++ b/apache2/build/install.sh @@ -0,0 +1,224 @@ +#!/bin/sh +## +## install.sh -- install a program, script or datafile +## +## Based on `install-sh' from the X Consortium's X11R5 distribution +## as of 89/12/18 which is freely available. +## Cleaned up for Apache's Autoconf-style Interface (APACI) +## by Ralf S. Engelschall +## +# +# This script falls under the Apache License. +# See http://www.apache.org/docs/LICENSE + + +# +# put in absolute paths if you don't have them in your path; +# or use env. vars. +# +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" + +# +# parse argument line +# +instcmd="$mvprog" +chmodcmd="" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +ext="" +src="" +dst="" +while [ "x$1" != "x" ]; do + case $1 in + -c) instcmd="$cpprog" + shift; continue + ;; + -m) chmodcmd="$chmodprog $2" + shift; shift; continue + ;; + -o) chowncmd="$chownprog $2" + shift; shift; continue + ;; + -g) chgrpcmd="$chgrpprog $2" + shift; shift; continue + ;; + -s) stripcmd="$stripprog" + shift; continue + ;; + -S) stripcmd="$stripprog $2" + shift; shift; continue + ;; + -e) ext="$2" + shift; shift; continue + ;; + *) if [ "x$src" = "x" ]; then + src=$1 + else + dst=$1 + fi + shift; continue + ;; + esac +done +if [ "x$src" = "x" ]; then + echo "install.sh: no input file specified" + exit 1 +fi +if [ "x$dst" = "x" ]; then + echo "install.sh: no destination specified" + exit 1 +fi + +# +# If destination is a directory, append the input filename; if +# your system does not like double slashes in filenames, you may +# need to add some logic +# +if [ -d $dst ]; then + dst="$dst/`basename $src`" +fi + +# Add a possible extension (such as ".exe") to src and dst +src="$src$ext" +dst="$dst$ext" + +# Make a temp file name in the proper directory. +dstdir=`dirname $dst` +dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name +$instcmd $src $dsttmp + +# And set any options; do chmod last to preserve setuid bits +if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi +if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi +if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi +if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi + +# Now rename the file to the real destination. +$rmcmd $dst +$mvcmd $dsttmp $dst + +exit 0 + +#!/bin/sh +## +## install.sh -- install a program, script or datafile +## +## Based on `install-sh' from the X Consortium's X11R5 distribution +## as of 89/12/18 which is freely available. +## Cleaned up for Apache's Autoconf-style Interface (APACI) +## by Ralf S. Engelschall +## +# +# This script falls under the Apache License. +# See http://www.apache.org/docs/LICENSE + + +# +# put in absolute paths if you don't have them in your path; +# or use env. vars. +# +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" + +# +# parse argument line +# +instcmd="$mvprog" +chmodcmd="" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +ext="" +src="" +dst="" +while [ "x$1" != "x" ]; do + case $1 in + -c) instcmd="$cpprog" + shift; continue + ;; + -m) chmodcmd="$chmodprog $2" + shift; shift; continue + ;; + -o) chowncmd="$chownprog $2" + shift; shift; continue + ;; + -g) chgrpcmd="$chgrpprog $2" + shift; shift; continue + ;; + -s) stripcmd="$stripprog" + shift; continue + ;; + -S) stripcmd="$stripprog $2" + shift; shift; continue + ;; + -e) ext="$2" + shift; shift; continue + ;; + *) if [ "x$src" = "x" ]; then + src=$1 + else + dst=$1 + fi + shift; continue + ;; + esac +done +if [ "x$src" = "x" ]; then + echo "install.sh: no input file specified" + exit 1 +fi +if [ "x$dst" = "x" ]; then + echo "install.sh: no destination specified" + exit 1 +fi + +# +# If destination is a directory, append the input filename; if +# your system does not like double slashes in filenames, you may +# need to add some logic +# +if [ -d $dst ]; then + dst="$dst/`basename $src`" +fi + +# Add a possible extension (such as ".exe") to src and dst +src="$src$ext" +dst="$dst$ext" + +# Make a temp file name in the proper directory. +dstdir=`dirname $dst` +dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name +$instcmd $src $dsttmp + +# And set any options; do chmod last to preserve setuid bits +if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi +if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi +if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi +if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi + +# Now rename the file to the real destination. +$rmcmd $dst +$mvcmd $dsttmp $dst + +exit 0 + diff --git a/apache2/buildconf b/apache2/buildconf new file mode 100755 index 00000000..ebaca5a8 --- /dev/null +++ b/apache2/buildconf @@ -0,0 +1,83 @@ +#!/bin/sh +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# + +# buildconf: Build the support scripts needed to compile from a +# checked-out version of the source code. + +# Verify that the builder has the right config tools installed +# +build/buildcheck.sh || exit 1 + +libtoolize=`build/PrintPath glibtoolize libtoolize15 libtoolize14 libtoolize` +if [ "x$libtoolize" = "x" ]; then + echo "libtoolize not found in path" + exit 1 +fi + +# Create the libtool helper files +# +# Note: we copy (rather than link) them to simplify distribution. +# Note: APR supplies its own config.guess and config.sub -- we do not +# rely on libtool's versions +# +echo "Copying libtool helper files ..." + +# Remove any libtool files so one can switch between libtool 1.3 +# and libtool 1.4 by simply rerunning the buildconf script. +(cd build ; rm -f ltconfig ltmain.sh libtool.m4) + +$libtoolize --copy --automake + +if [ -f libtool.m4 ]; then + ltfile=`pwd`/libtool.m4 +else + ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \ + < $libtoolize`" + ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`} + # Expecting the code above to be very portable, but just in case... + if [ -z "$ltfile" -o ! -f "$ltfile" ]; then + ltpath=`dirname $libtoolize` + ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4 + fi +fi + +if [ ! -f $ltfile ]; then + echo "$ltfile not found" + exit 1 +fi + +echo "buildconf: Using libtool.m4 at ${ltfile}." + +cat $ltfile | sed -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' > build/libtool.m4 + +# libtool.m4 from 1.6 requires ltsugar.m4 +if [ -f ltsugar.m4 ]; then + rm -f build/ltsugar.m4 + mv ltsugar.m4 build/ltsugar.m4 +fi + +# Clean up any leftovers +rm -f aclocal.m4 libtool.m4 + +echo "Creating configure ..." +${AUTOCONF:-autoconf} + +# Remove autoconf 2.5x's cache directory +rm -rf autom4te*.cache + +exit 0 diff --git a/apache2/configure.in b/apache2/configure.in new file mode 100644 index 00000000..9bf3558e --- /dev/null +++ b/apache2/configure.in @@ -0,0 +1,82 @@ +dnl +dnl Autoconf configuration for ModSecurity +dnl +dnl Use ./buildconf to produce a configure script +dnl + +AC_PREREQ(2.50) + +AC_INIT +AC_CONFIG_HEADER(mod_security2_config.h) +AC_CONFIG_AUX_DIR(build) + +# Include M4 macros +sinclude(build/find_pcre.m4) +sinclude(build/find_lua.m4) +sinclude(build/find_xml.m4) +sinclude(build/find_apr.m4) +sinclude(build/find_apu.m4) + +AC_MSG_NOTICE(looking for Apache module support via DSO through APXS) +AC_ARG_WITH(apxs, + [AS_HELP_STRING([[--with-apxs=[=FILE]]], + [FILE is the path to apxs; defaults to "apxs".])], +[ + if test "$withval" = "yes"; then + APXS=apxs + else + APXS="$withval" + fi +]) + +if test -z "$APXS"; then + for i in /usr/sbin \ + /usr/local/apache/bin \ + /usr/local/apache2/bin \ + /usr/local/sbin ; do + if test -f "$i/apxs2"; then + APXS="$i/apxs2" + break + elif test -f "$i/apxs"; then + APXS="$i/apxs" + break + fi + done +fi + +# arbitrarily picking the same version subversion looks for, don't know how +# accurate this really is, but at least it'll force us to have apache2... +HTTPD_WANTED_MMN=20020903 + +if test -n "$APXS" -a "$APXS" != "no" -a -x "$APXS" ; then + APXS_INCLUDE="`$APXS -q INCLUDEDIR`" + if test -r $APXS_INCLUDE/httpd.h; then + AC_MSG_NOTICE(found apxs at $APXS) + AC_MSG_NOTICE(checking httpd version) + AC_EGREP_CPP(VERSION_OK, + [ +#include "$APXS_INCLUDE/ap_mmn.h" +#if AP_MODULE_MAGIC_AT_LEAST($HTTPD_WANTED_MMN,0) +VERSION_OK +#endif], + [AC_MSG_NOTICE(httpd is recent enough)], + [AC_MSG_ERROR(apache is too old, mmn must be at least $HTTPD_WANTED_MMN)]) + fi +else + AC_MSG_ERROR(couldn't find APXS) +fi + +CHECK_PCRE() +CHECK_LUA() +CHECK_LIBXML() + +save_CPPFLAGS=$CPPFLAGS +APXS_INCLUDES="`$APXS -q EXTRA_INCLUDES`" +CPPFLAGS="$APXS_INCLUDES $CPPFLAGS" +CPPFLAGS=$save_CPPFLAGS + +AC_SUBST(APXS) + +AC_CONFIG_FILES([Makefile]) + +AC_OUTPUT diff --git a/apache2/mod_security2_config.h.in b/apache2/mod_security2_config.h.in new file mode 100644 index 00000000..2d7d56d7 --- /dev/null +++ b/apache2/mod_security2_config.h.in @@ -0,0 +1,16 @@ +/* mod_security2_config.h.in. Generated from configure.in by autoheader. */ + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION