1 # Process this file with autoconf to produce a configure script.
4 AC_INIT([suPHP], [0.6.1], [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])
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"; 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])
105 AC_MSG_ERROR([APR is needed to build mod_suphp for Apache 2.x but was not found])
111 AC_MSG_CHECKING([for set-UID/set-GID mode])
112 AC_ARG_WITH(setid-mode,
113 AC_HELP_STRING([--with-setid-mode=MODE],
114 [Mode to use for setting UID/GID. MODE can be on of "owner", "config" or "paranoid"; defaults to "paranoid".]),
116 if test "$withval" = "yes"; then
117 SETID_MODE="paranoid"
119 SETID_MODE="$withval"
123 if test -z "$SETID_MODE" ; then
124 SETID_MODE="paranoid"
127 if test -n "$SETID_MODE"; then
128 case "$SETID_MODE" in
130 OPT_APACHEMOD_USERGROUP_DEF=""
131 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
132 AC_DEFINE(OPT_USERGROUP_OWNER, 1,
133 [Define if you want to set UID/GID to the owner of the script])
136 OPT_APACHEMOD_USERGROUP_DEF=-DSUPHP_USE_USERGROUP
137 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
138 AC_DEFINE(OPT_USERGROUP_FORCE, 1,
139 [Define if you want to set UID/GID to the user/group specified in the Apache configuration])
142 OPT_APACHEMOD_USERGROUP_DEF=-DSUPHP_USE_USERGROUP
143 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
144 AC_DEFINE(OPT_USERGROUP_PARANOID, 1,
145 [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])
148 AC_MSG_ERROR([--with-setid-mode has to be set to one of "owner", "force" or "paranoid"])
151 AC_MSG_RESULT([ok - using $SETID_MODE])
155 # Checkpath (docroot) option
158 AC_ARG_ENABLE([checkpath],
159 AC_HELP_STRING([--enable-checkpath],
160 [Check if script resides in DOCUMENT_ROOT (default is ENABLED)]),
162 if test "$enableval" = "no"; then
164 AC_DEFINE(OPT_DISABLE_CHECKPATH, 1, [Define if you want to disable the check, wether script resides in DOCUMENT_ROOT])
171 AC_ARG_WITH([min-uid],
172 AC_HELP_STRING([--with-min-uid=UID],
173 [Minimum UID, which is allowed to run scripts
176 if test "$withval" -a ! "$withval" = "yes" ; then
177 AC_DEFINE_UNQUOTED(OPT_MIN_UID, $withval, [Defines the min UID
178 allowed to run scripts])
182 AC_DEFINE(OPT_MIN_UID, 100, [Defines the min UID
183 allowed to run scripts])
188 AC_ARG_WITH([min-gid],
189 AC_HELP_STRING([--with-min-gid=GID],
190 [Minimum GID, which is allowed to run scripts
193 if test "$withval" -a ! "$withval" = "yes" ; then
194 AC_DEFINE_UNQUOTED(OPT_MIN_GID, $withval, [Defines the min GID
195 allowed to run scripts])
199 AC_DEFINE(OPT_MIN_GID, 100, [Defines the min GID
200 allowed to run scripts])
206 AC_ARG_WITH([apache-user],
207 AC_HELP_STRING([--with-apache-user=USERNAME],
208 [Name of the user Apache is running as
209 (default is "wwwrun"]),
211 if test "$withval" -a ! "$withval" = "yes" ; then
212 AC_DEFINE_UNQUOTED(OPT_APACHE_USER, "$withval", [Defines the username of the Apache user])
216 AC_DEFINE_UNQUOTED(OPT_APACHE_USER, "wwwrun", [Defines the username of the Apache user])
221 AC_ARG_WITH([logfile],
222 AC_HELP_STRING([--with-logfile=FILE],
223 [Path to suPHP logfile (default is "/var/log/httpd/suphp_log"]),
225 if test "$withval" -a ! "$withval" = "yes" ; then
226 AC_DEFINE_UNQUOTED(OPT_LOGFILE, "$withval", [Defines
231 AC_DEFINE_UNQUOTED(OPT_LOGFILE, "/var/log/httpd/suphp_log", [Defines path to logfile])
235 # Conditional building of Apache module
236 AM_CONDITIONAL([COND_AP13], [test x"$APACHE_VERSION_1_3" = xtrue])
237 AM_CONDITIONAL([COND_AP20], [test x"$APACHE_VERSION_2" = xtrue])
239 # Conditionally include UserGroup support
240 AM_CONDITIONAL([COND_APUSERGROUP], [test \( x"$SETID_MODE" = xparanoid \) -o \( x"$SETID_MODE" = xforce \) ])
242 AC_CONFIG_FILES([Makefile src/Makefile src/apache/Makefile src/apache2/Makefile])
245 if test "$APXS" = "/notfound/"; then
247 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
248 !!*** APXS was not found, so mod_suphp will not be built! ***!!
249 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!