forked from lightsey/mod_suphp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ac
More file actions
277 lines (230 loc) · 8.51 KB
/
configure.ac
File metadata and controls
277 lines (230 loc) · 8.51 KB
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# Process this file with autoconf to produce a configure script.
# Initialize
AC_INIT([suPHP], [0.8.0-pre], [[email protected]], [suphp])
# Auxiliary tools
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
# Check for right directory
AC_CONFIG_SRCDIR([src/Application.cpp])
# Config headers for automake
AM_CONFIG_HEADER([src/config.h])
AM_INIT_AUTOMAKE([-Wall -Werror subdir-objects])
# Build time sanity check
AM_SANITY_CHECK
# Look for install program
AC_PROG_INSTALL
# Look for compiler
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11(,optional)
if test "$HAVE_CXX11" != "1"; then
# G++ 4.4 fails the full c++11 test but includes the features
# that are actually being used (auto and unique_ptr).
# The older autoconf STDCXX_0X will pass it.
AX_CXX_COMPILE_STDCXX_0X
if test "x$ax_cv_cxx_compile_cxx0x_native" != xyes; then
if test "x$ax_cv_cxx_compile_cxx0x_gxx" = xyes; then
CXX+=" -std=gnu++0x -DGTEST_LANG_CXX11=0"
CXXCPP+=" -std=gnu++0x -DGTEST_LANG_CXX11=0"
elif test "x$ax_cv_cxx_compile_cxx0x_cxx" = xyes; then
CXX+=" -std=c++0x -DGTEST_LANG_CXX11=0"
CXXCPP+=" -std=c++0x -DGTEST_LANG_CXX11=0"
else
AC_MSG_ERROR([A compiler with C++11 or C++0x support is required to build mod_suphp])
fi
fi
fi
# Libtool
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AM_PROG_LIBTOOL
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
# Find apr-config
APR_FIND_APR([], [], [1], [1])
# Determine Apache version and find apxs
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 -d.`
minor_version=`echo $APACHE_VERSION|cut -f2 -d.`
if test "$major_version" -ge "2" -a "$minor_version" -ge "2"; then
APXS_EXTRA_CFLAGS=`$APXS -q CFLAGS`
else
AC_MSG_ERROR([Apache must be version 2.2 or later])
fi
APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
APXS_LIBEXECDIR=`$APXS -q LIBEXECDIR`
AC_SUBST([APXS_INCLUDEDIR])
AC_SUBST([APXS_LIBEXECDIR])
AC_SUBST([APXS_EXTRA_CFLAGS])
AC_MSG_RESULT(found at $APXS (version $APACHE_VERSION))
else
APXS="/notfound/"
AC_SUBST(APXS)
AC_MSG_RESULT(no)
fi
dnl For Apache 2.x APR is needed
if test x"${apr_found}" = xyes ; then \
APR_INCLUDEDIR=`${apr_config} --includedir`
AC_SUBST([APR_INCLUDEDIR])
APR_CPPFLAGS=`${apr_config} --cppflags`
AC_SUBST([APR_CPPFLAGS])
else
AC_MSG_ERROR([APR is needed to build mod_suphp for Apache 2.x but was not found])
fi
# Get uid/gid mode
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 one of "owner", "config" or "paranoid"; defaults to "paranoid".]),
[
if test "$withval" = "yes"; then
SETID_MODE="paranoid"
else
SETID_MODE="$withval"
fi
])
if test -z "$SETID_MODE" ; then
SETID_MODE="paranoid"
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 (docroot) option
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
])
# Minimum UID
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])
])
# Minimum GID
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])
])
# Webserver user
AC_ARG_WITH([apache-user],
AC_HELP_STRING([--with-apache-user=USERNAME],
[Name of the user Apache is running as
(default is "www-data" on Debian, "apache" on RedHat, and "wwwrun" on other systems)]),
[
if test "$withval" -a ! "$withval" = "yes" ; then
webserver_user="$withval"
fi
])
if test -z "$webserver_user"; then
if test -e "/etc/redhat-release" ; then
webserver_user="apache"
elif test -e "/etc/debian_version" ; then
webserver_user="www-data"
else
webserver_user="wwwrun"
fi
fi
AC_DEFINE_UNQUOTED(OPT_APACHE_USER, "$webserver_user", [Defines the username of the Apache user])
# Path to logfile
AC_ARG_WITH([logfile],
AC_HELP_STRING([--with-logfile=FILE],
[Path to suPHP logfile (default is "/var/log/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/suphp.log", [Defines path to logfile])
])
# Conditionally include UserGroup support
AM_CONDITIONAL([COND_APUSERGROUP], [test \( x"$SETID_MODE" = xparanoid \) -o \( x"$SETID_MODE" = xforce \) ])
# Verify submodules are installed when building from a git checkout
AM_CONDITIONAL([SUBMODULES_INSTALLED], [test -e googletest/googletest/src/gtest-all.cc])
AM_COND_IF([SUBMODULES_INSTALLED],,[AC_MSG_WARN([The "check" target uses submodules. The unit tests will not function until you run "git submodule update".])])
AC_CONFIG_FILES([Makefile src/Makefile src/apache2/Makefile tests/Makefile])
AC_OUTPUT
if test "$APXS" = "/notfound/"; then
AC_MSG_WARN([
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!*** APXS was not found, so mod_suphp will not be built! ***!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
])
fi