1 # Process this file with autoconf to produce a configure script.
4 AC_INIT([suPHP], [0.6.0], [sebastian.marsching@suphp.org], [suphp])
7 AC_CONFIG_AUX_DIR([config])
9 AM_INIT_AUTOMAKE([suPHP], [0.6.0-pre1])
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])
30 # Determine Apache version and find apxs
32 AC_MSG_CHECKING([for dynamic Apache module support (via APXS)])
34 AC_HELP_STRING([--with-apxs=FILE],
35 [Build shared Apache module. FILE is the optional pathname to the Apache apxs tool; defaults to "apxs".]),
37 if test "$withval" = "yes"; then
44 if test -z "$APXS"; then
48 if test "$BINNAME" = "" -a "$APXS" = "" -a "$FAIL_STATIC" = ""; then
49 for i in /usr/sbin /usr/local/apache/bin ; do
50 if test -f "$i/apxs"; then
56 if test -n "$APXS"; then
59 APACHE_VERSION=`\`$APXS -q SBINDIR\`/\`$APXS -q TARGET\` -v \
60 | grep "Server version" \
64 major_version=`echo $APACHE_VERSION|cut -f1,2 -d.`
65 if test "$major_version" = "2.0"; then
67 APACHE_VERSION_1_3=false
69 APACHE_VERSION_2=false
70 APACHE_VERSION_1_3=true
72 AC_SUBST(APACHE_VERSION_1_3)
73 AC_SUBST(APACHE_VERSION_2)
75 APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
76 APXS_LIBEXECDIR=`$APXS -q LIBEXECDIR`
77 if test x"{$APACHE_VERSION_2}" = xtrue ; then \
78 APXS_EXTRA_CFLAGS=`$APXS -q EXTRA_CFLAGS`
80 if test x"${APACHE_VERSION_1_3}" = xtrue; then \
81 APXS_EXTRA_CFLAGS=`$APXS -q CFLAGS`
83 AC_SUBST([APXS_INCLUDEDIR])
84 AC_SUBST([APXS_LIBEXECDIR])
85 AC_SUBST([APXS_EXTRA_CFLAGS])
87 AC_MSG_RESULT(found at $APXS (version $APACHE_VERSION))
98 AC_MSG_CHECKING([for set-UID/set-GID mode])
99 AC_ARG_WITH(setid-mode,
100 AC_HELP_STRING([--with-setid-mode=MODE],
101 [Mode to use for setting UID/GID. MODE can be on of "owner", "config" or "paranoid"; defaults to "paranoid".]),
103 if test "$withval" = "yes"; then
104 SETID_MODE="paranoid"
106 SETID_MODE="$withval"
110 if test -z "$SETID_MODE" ; then
111 SETID_MODE="paranoid"
114 if test -n "$SETID_MODE"; then
115 case "$SETID_MODE" in
117 OPT_APACHEMOD_USERGROUP_DEF=""
118 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
119 AC_DEFINE(OPT_USERGROUP_OWNER, 1,
120 [Define if you want to set UID/GID to the owner of the script])
123 OPT_APACHEMOD_USERGROUP_DEF=-DSUPHP_USE_USERGROUP
124 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
125 AC_DEFINE(OPT_USERGROUP_FORCE, 1,
126 [Define if you want to set UID/GID to the user/group specified in the Apache configuration])
129 OPT_APACHEMOD_USERGROUP_DEF=-DSUPHP_USE_USERGROUP
130 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
131 AC_DEFINE(OPT_USERGROUP_PARANOID, 1,
132 [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])
135 AC_MSG_ERROR([--with-setid-mode has to be set to one of "owner", "force" or "paranoid"])
138 AC_MSG_RESULT([ok - using $SETID_MODE])
142 # Checkpath (docroot) option
145 AC_ARG_ENABLE([checkpath],
146 AC_HELP_STRING([--enable-checkpath],
147 [Check if script resides in DOCUMENT_ROOT (default is ENABLED)]),
149 if test "$enableval" = "no"; then
151 AC_DEFINE(OPT_DISABLE_CHECKPATH, 1, [Define if you want to disable the check, wether script resides in DOCUMENT_ROOT])
158 AC_ARG_WITH([min-uid],
159 AC_HELP_STRING([--with-min-uid=UID],
160 [Minimum UID, which is allowed to run scripts
163 if test "$withval" -a ! "$withval" = "yes" ; then
164 AC_DEFINE_UNQUOTED(OPT_MIN_UID, $withval, [Defines the min UID
165 allowed to run scripts])
169 AC_DEFINE(OPT_MIN_UID, 100, [Defines the min UID
170 allowed to run scripts])
175 AC_ARG_WITH([min-gid],
176 AC_HELP_STRING([--with-min-gid=GID],
177 [Minimum GID, which is allowed to run scripts
180 if test "$withval" -a ! "$withval" = "yes" ; then
181 AC_DEFINE_UNQUOTED(OPT_MIN_GID, $withval, [Defines the min GID
182 allowed to run scripts])
186 AC_DEFINE(OPT_MIN_GID, 100, [Defines the min GID
187 allowed to run scripts])
193 AC_ARG_WITH([apache-user],
194 AC_HELP_STRING([--with-apache-user=USERNAME],
195 [Name of the user Apache is running as
196 (default is "wwwrun"]),
198 if test "$withval" -a ! "$withval" = "yes" ; then
199 AC_DEFINE_UNQUOTED(OPT_APACHE_USER, "$withval", [Defines the username of the Apache user])
203 AC_DEFINE_UNQUOTED(OPT_APACHE_USER, "wwwrun", [Defines the username of the Apache user])
208 AC_ARG_WITH([logfile],
209 AC_HELP_STRING([--with-logfile=FILE],
210 [Path to suPHP logfile (default is "/var/log/httpd/suphp_log"]),
212 if test "$withval" -a ! "$withval" = "yes" ; then
213 AC_DEFINE_UNQUOTED(OPT_LOGFILE, "$withval", [Defines
218 AC_DEFINE_UNQUOTED(OPT_LOGFILE, "/var/log/httpd/suphp_log", [Defines path to logfile])
222 # Conditional building of Apache module
223 AM_CONDITIONAL([COND_AP13], [test x"$APACHE_VERSION_1_3" = xtrue])
224 AM_CONDITIONAL([COND_AP20], [test x"$APACHE_VERSION_2" = xtrue])
226 # Conditionally include UserGroup support
227 AM_CONDITIONAL([COND_APUSERGROUP], [test \( x"$SETID_MODE" = xparanoid \) -o \( x"$SETID_MODE" = xforce \) ])
229 AC_CONFIG_FILES([Makefile src/Makefile src/apache/Makefile src/apache2/Makefile])
232 if test "$APXS" = "/notfound/"; then
234 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
235 !!*** APXS was not found, so mod_suphp will not be built! ***!!
236 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!