1 # Process this file with autoconf to produce a configure script.
2 AC_INIT([suphp], [0.5.2], [sebastian.marsching@suphp.org])
3 AC_CONFIG_SRCDIR([src/suphp.c])
4 AC_CONFIG_AUX_DIR([config])
5 AC_CONFIG_HEADER([src/config.h])
11 AC_MSG_CHECKING([for dynamic Apache module support (via APXS)])
13 AC_HELP_STRING([--with-apxs=FILE],
14 [Build shared Apache module. FILE is the optional pathname to the Apache apxs tool; defaults to "apxs".]),
16 if test "$withval" = "yes"; then
23 if test -z "$APXS"; then
27 if test "$BINNAME" = "" -a "$APXS" = "" -a "$FAIL_STATIC" = ""; then
28 for i in /usr/sbin /usr/local/apache/bin ; do
29 if test -f "$i/apxs"; then
35 if test -n "$APXS"; then
38 APACHE_VERSION=`\`$APXS -q SBINDIR\`/\`$APXS -q TARGET\` -v \
39 | grep "Server version" \
43 major_version=`echo $APACHE_VERSION|cut -f1,2 -d.`
44 if test "$major_version" = "2.0"; then
46 APACHE_VERSION_1_3=false
48 APACHE_VERSION_2=false
49 APACHE_VERSION_1_3=true
51 AC_SUBST(APACHE_VERSION_1_3)
52 AC_SUBST(APACHE_VERSION_2)
54 AC_MSG_RESULT(found at $APXS (version $APACHE_VERSION))
62 AC_MSG_CHECKING([for set-UID/set-GID mode])
63 AC_ARG_WITH(setid-mode,
64 AC_HELP_STRING([--with-setid-mode=MODE],
65 [Mode to use for setting UID/GID. MODE can be on of "owner", "config" or "paranoid"; defaults to "owner".]),
67 if test "$withval" = "yes"; then
74 if test -z "$SETID_MODE" ; then
78 if test -n "$SETID_MODE"; then
81 OPT_APACHEMOD_USERGROUP_DEF=""
82 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
83 AC_DEFINE(OPT_USERGROUP_OWNER, 1,
84 [Define if you want to set UID/GID to the owner of the script])
87 OPT_APACHEMOD_USERGROUP_DEF=-DSUPHP_USE_USERGROUP
88 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
89 AC_DEFINE(OPT_USERGROUP_FORCE, 1,
90 [Define if you want to set UID/GID to the user/group specified in the Apache configuration])
93 OPT_APACHEMOD_USERGROUP_DEF=-DSUPHP_USE_USERGROUP
94 AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
95 AC_DEFINE(OPT_USERGROUP_PARANOID, 1,
96 [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])
99 AC_MSG_ERROR([--with-setid-mode has to be set to one of "owner", "force" or "paranoid"])
102 AC_MSG_RESULT([ok - using $SETID_MODE])
106 AC_ARG_ENABLE([checkpath],
107 AC_HELP_STRING([--enable-checkpath],
108 [Check if script resides in DOCUMENT_ROOT (default is ENABLED)]),
110 if test "$enableval" = "no"; then
112 AC_DEFINE(OPT_DISABLE_CHECKPATH, 1, [Define if you want to disable the check, wether script resides in DOCUMENT_ROOT])
117 AC_ARG_ENABLE([checkuid],
118 AC_HELP_STRING([--enable-checkuid],
119 [Do not accept UIDs that are not listed in /etc/passwd (default is ENABLED)]),
121 if test "$enableval" = "no"; then
123 AC_DEFINE(OPT_NO_PASSWD, 1,
124 [Define if you want to proceed even if UID of the script is not listed in /etc/passwd])
129 AC_ARG_ENABLE([checkgid],
130 AC_HELP_STRING([--enable-checkgid],
131 [Do not accept GIDs that are not listed in /etc/group (default is ENABLED)]),
133 if test "$enableval" = "no"; then
135 AC_DEFINE(OPT_NO_GROUP, 1,
136 [Define if you want to proceed even if GID of the script is not listed in /etc/group])
140 AC_ARG_WITH([min-uid],
141 AC_HELP_STRING([--with-min-uid=UID],
142 [Minimum UID, which is allowed to run scripts
145 if test "$withval" -a ! "$withval" = "yes" ; then
146 AC_DEFINE_UNQUOTED(OPT_MIN_UID, $withval, [Defines the min UID
147 allowed to run scripts])
151 AC_DEFINE(OPT_MIN_UID, 100, [Defines the min UID
152 allowed to run scripts])
155 AC_ARG_WITH([min-gid],
156 AC_HELP_STRING([--with-min-gid=GID],
157 [Minimum GID, which is allowed to run scripts
160 if test "$withval" -a ! "$withval" = "yes" ; then
161 AC_DEFINE_UNQUOTED(OPT_MIN_GID, $withval, [Defines the min GID
162 allowed to run scripts])
166 AC_DEFINE(OPT_MIN_GID, 100, [Defines the min GID
167 allowed to run scripts])
170 AC_ARG_WITH([apache-user],
171 AC_HELP_STRING([--with-apache-user=USERNAME],
172 [Name of the user Apache is running as
173 (default is "wwwrun"]),
175 if test "$withval" -a ! "$withval" = "yes" ; then
176 AC_DEFINE_UNQUOTED(OPT_APACHE_USER, "$withval", [Defines the username of the Apache user])
180 AC_DEFINE_UNQUOTED(OPT_APACHE_USER, "wwwrun", [Defines the username of the Apache user])
184 AC_HELP_STRING([--with-php=FILE],
185 [Path to PHP interpreter (default is "/usr/bin/php"]),
187 if test "$withval" -a ! "$withval" = "yes" ; then
188 AC_DEFINE_UNQUOTED(OPT_PATH_TO_PHP, "$withval", [Defines path to PHP interpreter])
192 AC_DEFINE_UNQUOTED(OPT_PATH_TO_PHP, "/usr/bin/php", [Defines path to PHP interpreter])
195 AC_ARG_WITH([logfile],
196 AC_HELP_STRING([--with-logfile=FILE],
197 [Path to suPHP logfile (default is "/var/log/httpd/suphp_log"]),
199 if test "$withval" -a ! "$withval" = "yes" ; then
200 AC_DEFINE_UNQUOTED(OPT_LOGFILE, "$withval", [Defines
205 AC_DEFINE_UNQUOTED(OPT_LOGFILE, "/var/log/httpd/suphp_log", [Defines path to logfile])
209 # Checks for libraries.
211 # Checks for header files.
213 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
215 # Checks for typedefs, structures, and compiler characteristics.
220 # Checks for library functions.
225 AC_CHECK_FUNCS([setenv strcasecmp strdup strrchr])
227 AC_CONFIG_FILES([Makefile src/Makefile src/apache/Makefile src/apache2/Makefile])
230 if test -n "$OPT_APACHEMOD_USERGROUP_DEF" -a "$APACHE_VERSION_1_3" = "true"; then
232 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
233 !!*** The suPHP module for Apache 1.3 only works with ***!!
234 !!*** set-ID mode "owner", other modes are only supported ***!!
235 !!*** by the Apache 2.x module ***!!
236 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
240 if test "$APXS" = "/notfound/"; then
242 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
243 !!*** APXS was not found, so mod_suphp will not be built! ***!!
244 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!