1 # Process this file with autoconf to produce a configure script.
4 AC_INIT([suPHP], [0.7.1], [sebastian.marsching@suphp.org], [suphp])
7 AC_CONFIG_AUX_DIR([config])
9 AM_INIT_AUTOMAKE([suPHP], [0.7.1])
10 # Check for right directory
11 AC_CONFIG_SRCDIR([src/Application.cpp])
12 # Config headers for automake
13 AM_CONFIG_HEADER([src/config.h])
15 # Build time sanity check
18 # Look for install program
26 # Checks for header files.
28 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
32 APR_FIND_APR([], [], [1])
34 # Determine Apache version and find apxs
36 AC_MSG_CHECKING([for dynamic Apache module support (via APXS)])
38 AC_HELP_STRING([--with-apxs=FILE],
39 [Build shared Apache module. FILE is the optional pathname to the Apache apxs tool; defaults to "apxs".]),
41 if test "$withval" = "yes"; then
48 if test -z "$APXS"; then
52 if test "$BINNAME" = "" -a "$APXS" = "" -a "$FAIL_STATIC" = ""; then
53 for i in /usr/sbin /usr/local/apache/bin ; do
54 if test -f "$i/apxs"; then
60 if test -n "$APXS"; then
63 APACHE_VERSION=`\`$APXS -q SBINDIR\`/\`$APXS -q TARGET\` -v \
64 | grep "Server version" \
68 major_version=`echo $APACHE_VERSION|cut -f1,2 -d.`
69 if test "$major_version" = "2.0" -o "$major_version" = "2.2"; then
71 APACHE_VERSION_1_3=false
73 APACHE_VERSION_2=false
74 APACHE_VERSION_1_3=true
76 AC_SUBST(APACHE_VERSION_1_3)
77 AC_SUBST(APACHE_VERSION_2)
79 APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
80 APXS_LIBEXECDIR=`$APXS -q LIBEXECDIR`
81 if test x"${APACHE_VERSION_2}" = xtrue ; then \
82 APXS_EXTRA_CFLAGS=`$APXS -q EXTRA_CFLAGS`
84 if test x"${APACHE_VERSION_1_3}" = xtrue; then \
85 APXS_EXTRA_CFLAGS=`$APXS -q CFLAGS`
87 AC_SUBST([APXS_INCLUDEDIR])
88 AC_SUBST([APXS_LIBEXECDIR])
89 AC_SUBST([APXS_EXTRA_CFLAGS])
91 AC_MSG_RESULT(found at $APXS (version $APACHE_VERSION))
99 if test x"${APACHE_VERSION_2}" = xtrue ; then \
100 dnl For Apache 2.x APR is needed
101 if test x"${apr_found}" = xyes ; then \
102 APR_INCLUDEDIR=`${apr_config} --includedir`
103 AC_SUBST([APR_INCLUDEDIR])
104 APR_CPPFLAGS=`${apr_config} --cppflags`
105 AC_SUBST([APR_CPPFLAGS])
107 AC_MSG_ERROR([APR is needed to build mod_suphp for Apache 2.x but was not found])
113 AC_MSG_CHECKING([for set-UID/set-GID mode])
114 AC_ARG_WITH(setid-mode,
115 AC_HELP_STRING([--with-setid-mode=MODE],
116 [Mode to use for setting UID/GID. MODE can be on of "owner", "config" or "paranoid"; defaults to "paranoid".]),
118 if test "$withval" = "yes"; then
119 SETID_MODE="paranoid"
121 SETID_MODE="$withval"
125 if test -z "$SETID_MODE" ; then
126 SETID_MODE="paranoid"
129 if test -n "$SETID_MODE"; then
130 case "$SETID_MODE" in
132 OPT_APACHEMOD_USERGROUP_DEF=""
133 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
134 AC_DEFINE(OPT_USERGROUP_OWNER, 1,
135 [Define if you want to set UID/GID to the owner of the script])
138 OPT_APACHEMOD_USERGROUP_DEF=-DSUPHP_USE_USERGROUP
139 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
140 AC_DEFINE(OPT_USERGROUP_FORCE, 1,
141 [Define if you want to set UID/GID to the user/group specified in the Apache configuration])
144 OPT_APACHEMOD_USERGROUP_DEF=-DSUPHP_USE_USERGROUP
145 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
146 AC_DEFINE(OPT_USERGROUP_PARANOID, 1,
147 [Define if you want to set UID/GID to the user/group specified in the Apache configuration AND check if these settings match the UID/GID of the script])
150 AC_MSG_ERROR([--with-setid-mode has to be set to one of "owner", "force" or "paranoid"])
153 AC_MSG_RESULT([ok - using $SETID_MODE])
157 # Checkpath (docroot) option
160 AC_ARG_ENABLE([checkpath],
161 AC_HELP_STRING([--enable-checkpath],
162 [Check if script resides in DOCUMENT_ROOT (default is ENABLED)]),
164 if test "$enableval" = "no"; then
166 AC_DEFINE(OPT_DISABLE_CHECKPATH, 1, [Define if you want to disable the check, wether script resides in DOCUMENT_ROOT])
173 AC_ARG_WITH([min-uid],
174 AC_HELP_STRING([--with-min-uid=UID],
175 [Minimum UID, which is allowed to run scripts
178 if test "$withval" -a ! "$withval" = "yes" ; then
179 AC_DEFINE_UNQUOTED(OPT_MIN_UID, $withval, [Defines the min UID
180 allowed to run scripts])
184 AC_DEFINE(OPT_MIN_UID, 100, [Defines the min UID
185 allowed to run scripts])
190 AC_ARG_WITH([min-gid],
191 AC_HELP_STRING([--with-min-gid=GID],
192 [Minimum GID, which is allowed to run scripts
195 if test "$withval" -a ! "$withval" = "yes" ; then
196 AC_DEFINE_UNQUOTED(OPT_MIN_GID, $withval, [Defines the min GID
197 allowed to run scripts])
201 AC_DEFINE(OPT_MIN_GID, 100, [Defines the min GID
202 allowed to run scripts])
208 AC_ARG_WITH([apache-user],
209 AC_HELP_STRING([--with-apache-user=USERNAME],
210 [Name of the user Apache is running as
211 (default is "wwwrun"]),
213 if test "$withval" -a ! "$withval" = "yes" ; then
214 AC_DEFINE_UNQUOTED(OPT_APACHE_USER, "$withval", [Defines the username of the Apache user])
218 AC_DEFINE_UNQUOTED(OPT_APACHE_USER, "wwwrun", [Defines the username of the Apache user])
223 AC_ARG_WITH([logfile],
224 AC_HELP_STRING([--with-logfile=FILE],
225 [Path to suPHP logfile (default is "/var/log/httpd/suphp_log"]),
227 if test "$withval" -a ! "$withval" = "yes" ; then
228 AC_DEFINE_UNQUOTED(OPT_LOGFILE, "$withval", [Defines
233 AC_DEFINE_UNQUOTED(OPT_LOGFILE, "/var/log/httpd/suphp_log", [Defines path to logfile])
237 # Conditional building of Apache module
238 AM_CONDITIONAL([COND_AP13], [test x"$APACHE_VERSION_1_3" = xtrue])
239 AM_CONDITIONAL([COND_AP20], [test x"$APACHE_VERSION_2" = xtrue])
241 # Conditionally include UserGroup support
242 AM_CONDITIONAL([COND_APUSERGROUP], [test \( x"$SETID_MODE" = xparanoid \) -o \( x"$SETID_MODE" = xforce \) ])
244 AC_CONFIG_FILES([Makefile src/Makefile src/apache/Makefile src/apache2/Makefile])
247 if test "$APXS" = "/notfound/"; then
249 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
250 !!*** APXS was not found, so mod_suphp will not be built! ***!!
251 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!