2 dnl Macros to find an Apache installation
4 dnl This will find either an installed Apache, or an Apache source directory.
6 dnl Note: If we don't have an installed Apache, then we can't install the
7 dnl (dynamic) mod_dav_svn.so module. Similarly, without an Apache
8 dnl source dir, we cannot create static builds of the system.
11 AC_DEFUN(SVN_FIND_APACHE,[
12 AC_REQUIRE([AC_CANONICAL_HOST])
16 AC_MSG_CHECKING(for static Apache module support)
18 AS_HELP_STRING([--with-apache=DIR],
19 [Build static Apache modules. DIR is the path to the top-level
20 Apache source directory. IMPORTANT: Unless you are *absolutely*
21 certain that you want to build the modules *statically*, you
22 probably want --with-apxs, and not this option.]),
24 if test "$withval" = "yes"; then
25 AC_MSG_ERROR(You need to specify a directory with --with-apache)
28 if test "$withval" = "no"; then
30 elif test -r $withval/modules/dav/main/mod_dav.h; then
31 APACHE_INCLUDES="$APACHE_INCLUDES -I$withval/include -I$withval/os/unix -I$withval/modules/dav/main -I$withval/srclib/apr/include -I$withval/srclib/apr-util/include"
32 APACHE_TARGET=$withval/modules/dav/svn
33 INSTALL_APACHE_RULE=install-mods-static
36 AC_MSG_RESULT(yes - Apache 2.0.x)
38 AC_MSG_CHECKING([httpd version])
39 AC_EGREP_CPP(VERSION_OKAY,
41 #include "$withval/include/ap_mmn.h"
42 #if AP_MODULE_MAGIC_AT_LEAST($HTTPD_WANTED_MMN,0)
45 [AC_MSG_RESULT([recent enough])],
46 [AC_MSG_ERROR([apache too old: mmn must be at least $HTTPD_WANTED_MMN])])
48 if test ! -r $withval/srclib/apr/include/apr.h; then
49 AC_MSG_WARN(Apache 2.0.x is not configured)
52 dnl if they pointed us at the wrong place, then just bail
53 AC_MSG_ERROR(no - Unable to locate $withval/modules/dav/main/mod_dav.h)
60 AC_MSG_CHECKING(for Apache module support via DSO through APXS)
62 [AS_HELP_STRING([[--with-apxs[=FILE]]],
63 [Build shared Apache modules. FILE is the optional
64 pathname to the Apache apxs tool; defaults to
67 if test "$BINNAME" != ""; then
68 AC_MSG_ERROR(--with-apache and --with-apxs are mutually exclusive)
71 if test "$withval" = "yes"; then
79 if test -z "$BINNAME" && test -z "$APXS"; then
80 for i in /usr/sbin /usr/local/apache/bin /usr/local/apache2/bin /usr/bin ; do
81 if test -f "$i/apxs2"; then
85 if test -f "$i/apxs"; then
92 if test -n "$APXS" && test "$APXS" != "no"; then
93 APXS_INCLUDE="`$APXS -q INCLUDEDIR`"
94 if test -r $APXS_INCLUDE/mod_dav.h; then
95 AC_MSG_RESULT(found at $APXS)
97 AC_MSG_CHECKING([httpd version])
98 AC_EGREP_CPP(VERSION_OKAY,
100 #include "$APXS_INCLUDE/ap_mmn.h"
101 #if AP_MODULE_MAGIC_AT_LEAST($HTTPD_WANTED_MMN,0)
104 [AC_MSG_RESULT([recent enough])],
105 [AC_MSG_RESULT([apache too old: mmn must be at least $HTTPD_WANTED_MMN])
106 if test "$APXS_EXPLICIT" != ""; then
107 AC_MSG_ERROR([Apache APXS build explicitly requested, but apache version is too old])
112 elif test "$APXS_EXPLICIT" != ""; then
113 AC_MSG_ERROR(no - APXS refers to an old version of Apache
114 Unable to locate $APXS_INCLUDE/mod_dav.h)
116 AC_MSG_RESULT(no - Unable to locate $APXS_INCLUDE/mod_dav.h)
123 if test -n "$APXS" && test "$APXS" != "no"; then
124 BINNAME=mod_dav_svn.so
125 INSTALL_IT="\$(APXS) -i -a -n dav_svn $BINNAME"
127 APXS_CC="`$APXS -q CC`"
128 APACHE_INCLUDES="$APACHE_INCLUDES -I$APXS_INCLUDE"
129 APACHE_LIBEXECDIR="`$APXS -q libexecdir`"
133 APACHE_LDFLAGS="-shrext .so"
137 INSTALL_APACHE_RULE=install-mods-shared
144 # If we did not find a way to build/install mod_dav, then bail out.
145 if test "$BINNAME" = ""; then
146 echo "=================================================================="
147 echo "WARNING: skipping the build of mod_dav_svn"
148 echo " --with-apxs or --with-apache must be used"
149 echo "=================================================================="
151 BUILD_APACHE_RULE=apache-mod
153 AC_SUBST(APACHE_LDFLAGS)
154 AC_SUBST(APACHE_TARGET)
155 AC_SUBST(APACHE_INCLUDES)
156 AC_SUBST(APACHE_LIBEXECDIR)
157 AC_SUBST(BUILD_APACHE_RULE)
158 AC_SUBST(INSTALL_APACHE_RULE)
160 # there aren't any flags that interest us ...
161 #if test -n "$APXS" && test "$APXS" != "no"; then
162 # CFLAGS="$CFLAGS `$APXS -q CFLAGS CFLAGS_SHLIB`"
165 if test -n "$APXS_CC" && test "$APXS_CC" != "$CC" ; then
166 echo "=================================================================="
167 echo "WARNING: You have chosen to compile Subversion with a different"
168 echo " compiler than the one used to compile Apache."
170 echo " Current compiler: $CC"
171 echo " Apache's compiler: $APXS_CC"
173 echo "This could cause some problems."
174 echo "=================================================================="