1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
|
# Process this file with autoconf to produce a configure script.
AC_INIT([suphp], [0.5.2], [sebastian.marsching@suphp.org])
AC_CONFIG_SRCDIR([src/suphp.c])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_HEADER([src/config.h])
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_MSG_CHECKING([for dynamic Apache module support (via APXS)])
AC_ARG_WITH(apxs,
AC_HELP_STRING([--with-apxs=FILE],
[Build shared Apache module. FILE is the optional pathname to the Apache apxs tool; defaults to "apxs".]),
[
if test "$withval" = "yes"; then
APXS=apxs
else
APXS="$withval"
fi
])
if test -z "$APXS"; then
APXS=`which apxs`
fi
if test "$BINNAME" = "" -a "$APXS" = "" -a "$FAIL_STATIC" = ""; then
for i in /usr/sbin /usr/local/apache/bin ; do
if test -f "$i/apxs"; then
APXS="$i/apxs"
fi
done
fi
if test -n "$APXS"; then
AC_SUBST(APXS)
APACHE_VERSION=`\`$APXS -q SBINDIR\`/\`$APXS -q TARGET\` -v \
| grep "Server version" \
| cut -f2 -d":" \
| cut -f2 -d"/" \
| cut -f1 -d" "`
major_version=`echo $APACHE_VERSION|cut -f1,2 -d.`
if test "$major_version" = "2.0"; then
APACHE_VERSION_2=true
APACHE_VERSION_1_3=false
else
APACHE_VERSION_2=false
APACHE_VERSION_1_3=true
fi
AC_SUBST(APACHE_VERSION_1_3)
AC_SUBST(APACHE_VERSION_2)
AC_MSG_RESULT(found at $APXS (version $APACHE_VERSION))
else
APXS="/notfound/"
AC_SUBST(APXS)
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([for set-UID/set-GID mode])
AC_ARG_WITH(setid-mode,
AC_HELP_STRING([--with-setid-mode=MODE],
[Mode to use for setting UID/GID. MODE can be on of "owner", "config" or "paranoid"; defaults to "owner".]),
[
if test "$withval" = "yes"; then
SETID_MODE="owner"
else
SETID_MODE="$withval"
fi
])
if test -z "$SETID_MODE" ; then
SETID_MODE="owner"
fi
if test -n "$SETID_MODE"; then
case "$SETID_MODE" in
owner)
OPT_APACHEMOD_USERGROUP_DEF=""
AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
AC_DEFINE(OPT_USERGROUP_OWNER, 1,
[Define if you want to set UID/GID to the owner of the script])
;;
force)
OPT_APACHEMOD_USERGROUP_DEF=-DSUPHP_USE_USERGROUP
AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
AC_DEFINE(OPT_USERGROUP_FORCE, 1,
[Define if you want to set UID/GID to the user/group specified in the Apache configuration])
;;
paranoid)
OPT_APACHEMOD_USERGROUP_DEF=-DSUPHP_USE_USERGROUP
AC_SUBST(OPT_APACHEMOD_USERGROUP_DEF)
AC_DEFINE(OPT_USERGROUP_PARANOID, 1,
[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])
;;
*)
AC_MSG_ERROR([--with-setid-mode has to be set to one of "owner", "force" or "paranoid"])
;;
esac
AC_MSG_RESULT([ok - using $SETID_MODE])
fi
checkpath=yes
AC_ARG_ENABLE([checkpath],
AC_HELP_STRING([--enable-checkpath],
[Check if script resides in DOCUMENT_ROOT (default is ENABLED)]),
[
if test "$enableval" = "no"; then
checkpath=no
AC_DEFINE(OPT_DISABLE_CHECKPATH, 1, [Define if you want to disable the check, wether script resides in DOCUMENT_ROOT])
fi
])
checkuid=yes
AC_ARG_ENABLE([checkuid],
AC_HELP_STRING([--enable-checkuid],
[Do not accept UIDs that are not listed in /etc/passwd (default is ENABLED)]),
[
if test "$enableval" = "no"; then
checkuid=no
AC_DEFINE(OPT_NO_PASSWD, 1,
[Define if you want to proceed even if UID of the script is not listed in /etc/passwd])
fi
])
checkgid=yes
AC_ARG_ENABLE([checkgid],
AC_HELP_STRING([--enable-checkgid],
[Do not accept GIDs that are not listed in /etc/group (default is ENABLED)]),
[
if test "$enableval" = "no"; then
checkgid=no
AC_DEFINE(OPT_NO_GROUP, 1,
[Define if you want to proceed even if GID of the script is not listed in /etc/group])
fi
])
AC_ARG_WITH([min-uid],
AC_HELP_STRING([--with-min-uid=UID],
[Minimum UID, which is allowed to run scripts
(default=100)]),
[
if test "$withval" -a ! "$withval" = "yes" ; then
AC_DEFINE_UNQUOTED(OPT_MIN_UID, $withval, [Defines the min UID
allowed to run scripts])
fi
],
[
AC_DEFINE(OPT_MIN_UID, 100, [Defines the min UID
allowed to run scripts])
])
AC_ARG_WITH([min-gid],
AC_HELP_STRING([--with-min-gid=GID],
[Minimum GID, which is allowed to run scripts
(default=100)]),
[
if test "$withval" -a ! "$withval" = "yes" ; then
AC_DEFINE_UNQUOTED(OPT_MIN_GID, $withval, [Defines the min GID
allowed to run scripts])
fi
],
[
AC_DEFINE(OPT_MIN_GID, 100, [Defines the min GID
allowed to run scripts])
])
AC_ARG_WITH([apache-user],
AC_HELP_STRING([--with-apache-user=USERNAME],
[Name of the user Apache is running as
(default is "wwwrun"]),
[
if test "$withval" -a ! "$withval" = "yes" ; then
AC_DEFINE_UNQUOTED(OPT_APACHE_USER, "$withval", [Defines the username of the Apache user])
fi
],
[
AC_DEFINE_UNQUOTED(OPT_APACHE_USER, "wwwrun", [Defines the username of the Apache user])
])
AC_ARG_WITH([php],
AC_HELP_STRING([--with-php=FILE],
[Path to PHP interpreter (default is "/usr/bin/php"]),
[
if test "$withval" -a ! "$withval" = "yes" ; then
AC_DEFINE_UNQUOTED(OPT_PATH_TO_PHP, "$withval", [Defines path to PHP interpreter])
fi
],
[
AC_DEFINE_UNQUOTED(OPT_PATH_TO_PHP, "/usr/bin/php", [Defines path to PHP interpreter])
])
AC_ARG_WITH([logfile],
AC_HELP_STRING([--with-logfile=FILE],
[Path to suPHP logfile (default is "/var/log/httpd/suphp_log"]),
[
if test "$withval" -a ! "$withval" = "yes" ; then
AC_DEFINE_UNQUOTED(OPT_LOGFILE, "$withval", [Defines
path to logfile])
fi
],
[
AC_DEFINE_UNQUOTED(OPT_LOGFILE, "/var/log/httpd/suphp_log", [Defines path to logfile])
])
# Checks for libraries.
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_LSTAT
AC_FUNC_MALLOC
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([setenv strcasecmp strdup strrchr])
AC_CONFIG_FILES([Makefile src/Makefile src/apache/Makefile src/apache2/Makefile])
AC_OUTPUT
if test -n "$OPT_APACHEMOD_USERGROUP_DEF" -a "$APACHE_VERSION_1_3" = "true"; then
AC_MSG_WARN([
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!*** The suPHP module for Apache 1.3 only works with ***!!
!!*** set-ID mode "owner", other modes are only supported ***!!
!!*** by the Apache 2.x module ***!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
])
fi
if test "$APXS" = "/notfound/"; then
AC_MSG_WARN([
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!*** APXS was not found, so mod_suphp will not be built! ***!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
])
fi
|