forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup
370 lines (338 loc) · 13.7 KB
/
setup
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
#!/bin/sh
#
# +----------------------------------------------------------------------+
# | PHP HTML Embedded Scripting Language Version 3.0 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
# +----------------------------------------------------------------------+
# | This program is free software; you can redistribute it and/or modify |
# | it under the terms of one of the following licenses: |
# | |
# | A) the GNU General Public License as published by the Free Software |
# | Foundation; either version 2 of the License, or (at your option) |
# | any later version. |
# | |
# | B) the PHP License as published by the PHP Development Team and |
# | included in the distribution in the file: LICENSE |
# | |
# | This program is distributed in the hope that it will be useful, |
# | but WITHOUT ANY WARRANTY; without even the implied warranty of |
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# | GNU General Public License for more details. |
# | |
# | You should have received a copy of both licenses referred to here. |
# | If you did not, or have any questions about PHP licensing, please |
# | contact [email protected]. |
# +----------------------------------------------------------------------+
# | Authors: Stig Sæther Bakken <[email protected]> |
# | Updated By: Jim Winstead <[email protected]> |
# | Ariel Shkedi <[email protected]> or <[email protected]> |
# +----------------------------------------------------------------------+
#
# $Id$
if [ "$1" = "-q" ]; then
quiet_mode=on
shift
fi
if [ `echo -e "\n" | wc -l` = 2 ]; then
# bash supports echo -e for handling escape sequences
ECHO_CMD="echo -e"
elif test -f /bin/echo; then
ECHO_CMD="/bin/echo"
elif test -f /usr/bin/echo; then
ECHO_CMD="/usr/bin/echo"
else
# fall back to the default echo - \n would most probably be displayed as-is
ECHO_CMD="echo"
fi
if echo '\c' | grep -s c >/dev/null 2>&1
then
ECHO_N="echo -n"
ECHO_C=""
else
ECHO_N="echo"
ECHO_C='\c'
fi
echo '
***************************************************************************
* *
* Welcome to the PHP 3.0 setup script. Use this script if you do not *
* want or know how to use the configure program. See the INSTALL file *
* for further installation instructions. *
* *
* You will now be asked a series of questions for your installation. *
* For each question, your options will be shown in parantheses, and *
* for some a default value is listed shown in brackets. *
* *
***************************************************************************
'
display_prompt()
{
prm=$1
shift
typ=$1
shift
def=$1
shift
$ECHO_N "$prm $ECHO_C"
case $typ in
yesno) $ECHO_N "(yes/no) $ECHO_C";;
yesnodir) $ECHO_N "(\`yes', \`no' or dir) $ECHO_C";;
dir) $ECHO_N "(dir) $ECHO_C";;
esac
if test "$typ" = "yesnodir"; then
set $def
def=$1
fi
$ECHO_N "[$def] : $ECHO_C"
}
define_option()
{
if test "$#" != "5"; then
echo "wrong number of arguments to define_option" >&2
return
fi
name=$1
shift
prompt=$1
shift
type=$1
shift
default=$1
shift
docstring=$1
optname=`echo $name | sed -e 's/[^a-zA-Z0-9_]/_/g'`
options="$options $optname"
eval "option_name_$optname='$name'"
eval "option_prompt_$optname='$prompt'"
eval "option_type_$optname='$type'"
eval "option_default_$optname='$default'"
eval "option_docstring_$optname='$docstring'"
answer=""
if [ "$quiet_mode" != "on" ]; then
show_help "$optname" "$type" "$default"
fi
while test "$answer" = ""; do
display_prompt "$prompt" "$type" "$default"
read answer
test -t || echo $answer # Echo the answer if it did not come
# from a terminal.
if test "$type" = "yesnodir"; then
set $default
if test "$1" = "yes"; then
if test "$answer" = ""; then
answer=yes
fi
fi
case "$answer" in
*/*) ;;
[Yy]*) dir=$2
shift
shift
$ECHO_N "Enter $@ directory [$dir] : $ECHO_C"
read answer
test -t || echo $answer
if test "$answer" = ""; then
answer=$dir
fi
;;
esac
fi
if test "$answer" = ""; then
if test "$type" = "yesnodir"; then
set $default
answer=$1
else
answer=$default
fi
elif test "$answer" = "?"; then
show_help "$optname" "$type" "$default"
answer=""
fi
done
if test "$type" = "yesnodir"; then
set $default
if test $1 = "yes"; then
case "$answer" in
"$2") answer=yes;;
[Yy]*) answer=yes;;
[Nn]*) answer=no;;
esac
else
case "$answer" in
[Yy]*) answer=$2;;
[Nn]*) answer=no;;
esac
fi
elif test "$type" = "yesno"; then
case "$answer" in
[Yy]*) answer=yes;;
[Nn]*) answer=no;;
esac
fi
eval "option_value_$optname='$answer'"
}
show_help()
{
echo ''
( eval "$ECHO_CMD \$option_docstring_$1" ;
if test "$2" = "yesnodir"; then
set $3
echo "If you answer \`yes', the default directory is \`$2'."
fi )
echo ''
}
generate_config_command()
{
configure_options=""
for optname in $options; do
eval "name=\$option_name_$optname"
eval "value=\$option_value_$optname"
eval "default=\$option_default_$optname"
set $default
if test "$value" != "$1"; then
if test "$value" != "$2"; then
configure_options="$configure_options --$name=$value"
else
configure_options="$configure_options --$name"
fi
fi
done
echo "./configure$configure_options"
}
# now define all the options
define_option with-apache 'Build as an Apache module?' yesnodir \
'no /usr/local/etc/httpd Apache base install' \
' Whether to build PHP as an Apache module. If you are running\n
Apache, building PHP as a module will give better performance and\n
security. If you answer no PHP will be built as a CGI program.\n
The CGI version also enables Apache users to run different PHP3-enabled\n
pages under different user-ids.'
if test "$option_value_with_apache" != "no"; then
define_option with-mod_charset 'Enable transfer tables used by mod_charset?' yesno no \
' Whether to respect transfer tables used by mod_charset when PHP compiled\n
as Apache module. It is required to allow mod_charset (aka Russian Apache)\n
to work properly.'
fi
if test "$option_value_with_apache" = "no"; then
define_option with-fhttpd 'Build as an fhttpd module?' yesnodir \
'no /usr/local/src/fhttpd fhttpd sources' \
' Whether to build PHP as fhttpd module. If you are running\n
fhttpd, building PHP as a module will give better performance,\n
more control and remote execution capability. More info about fhttpd \n
can be found at http://phobos.illtel.denver.co.us/pub/fhttpd/.'
fi
for stub in ext/*/setup.stub; do
test -f $stub && . $stub
done
define_option with-config-file-path 'Default config directory?' yesnodir \
'no /usr/local/lib Configuration file' \
' Directory where the PHP3 configuration file (php3.ini) is\n
located.'
# systems should be system's
define_option with-system-regex 'Use the system regex library?' yesno no \
" Whether to use the systems regular expression library rather than\n
the bundled one. If you are building PHP3 as a server module, you must\n
use the same library when building PHP3 as when linking the server.\n
Enable this if the systems library provides special features you need.\n
It is recommended that you use the bundled library if possible."
define_option enable-debug 'Compile with debug information?' yesno yes \
' Whether to enable debug information. Answering "no" here will make\n
PHP run faster, but it will be harder to trace bugs. You are \n
encouraged to leave debugging on while PHP 3.0 is in alpha and \n
beta state.'
define_option enable-safe-mode 'Enable safe mode by default?' yesno no \
" Whether to enable PHP safe mode. This imposes several\n
restrictions on what PHP can do, such as opening only files within\n
the document root. Read the Security chapter of the documentation\n
for more information. CGI users should always enable secure mode.\n
This only sets the default, it may be enabled or disabled in the\n
configuration file later. "
# broken configure.in doesn't check apache (bug?)
#if test "$option_value_with_apache" != "no"; then
# defexecdir="$option_value_with_apache/php-bin"
#else
defexecdir=/usr/local/bin
#fi
define_option with-exec-dir 'Default safe mode exec dir?' dir "$defexecdir" \
" The directory where executables that may be run from safe mode\n
are located."
define_option enable-track-vars 'Enable variable tracking by default?' yesno \
no \
' Enable the HTTP_GET_VARS, HTTP_POST_VARS and HTTP_COOKIE_VARS arrays by\n
default (can be turned on or off in the configuration file).'
define_option enable-magic-quotes 'Enable magic quotes by default?' yesno no \
' Whether to magic quotes by default. This can be changed in the\n
configuration file.'
define_option enable-debugger 'Enable PHP remote debugger?' yesno no \
" Whether to enable PHP remote debugging support. This feature\n
is still under development."
# configure.in only checks these if it's a cgi so setup does the same
if test "$option_value_with_apache" = "no"; then
# outputing the bank line isn't really possible, but it would be nice
define_option enable-force-cgi-redirect 'Enable redirect checking?' yesno no \
' When using PHP as a CGI binary, this will make PHP always first check\n
that it is used by redirection (for example under Apache, by using\n
Action directives). This makes sure that the PHP binary cannot be used\n
to bypass standard web server authentication procedures by calling it\n
directly, like http://my.host/cgi-bin/php/secret/doc.html. This\n
example accesses http://my.host/secret/doc.html but does not honour\n
any security settings enforced by httpd for directory /secret.\n
\n
Not enabling this option disables the check and enables bypassing\n
httpd security and authentication settings. Do this only if your server\n
software is unable to indicate that a safe redirection was done and\n
all your files under your document root and user directories may be\n
accessed by anyone. (See the doc_root and user_dir options in the\n
configuartion file).'
define_option enable-discard-path 'Enable discard path?' yesno no \
' If this is enabled, the PHP CGI binary can safely be placed outside\n
of the web tree and people will not be able to circumvent .htaccess\n
security.'
fi
define_option enable-memory-limit 'Enable memory limit?' yesno no \
' Compile with memory limit support.'
define_option enable-short-tags 'Allow short tag by default?' yesno yes \
" Whether to enable the short form of the PHP HTML embed tags.\n
The short form is \"<? code; ?>\", while the long form is\n
\"<?php code; ?>\". If you plan on using XML on your site, you\n
should disable the short form. This is the default and can be overridden\n
in the configuration file."
define_option enable-url-fopen-wrapper 'Enable URL fopen wrappers?' yesno yes \
" Enable the URL-aware fopen wrapper that allows accessing files via http\n
or ftp."
# only the cgi version of PHP is installed to bindir
if test "$option_value_with_apache" = "no"; then
define_option bindir 'Install php in:' dir "/usr/local/bin" \
" Directory where PHP should be installed."
fi
echo '
***************************************************************************
* *
* Running configure... *
* *
***************************************************************************
'
if test ! -f configure; then
autoconf
fi
command=`generate_config_command`
mv do-conf do-conf.bak > /dev/null 2>&1
echo $command > do-conf
chmod +x do-conf
echo $command
eval $command
echo '
***************************************************************************
* *
* Configuration options were saved in do-conf, if desired you can *
* edit this file and then run it. Run ./configure --help for a list *
* of options. *
* *
* Read the INSTALL file for more information and for help in *
* configuring apache. See the web site at: http://www.php.net/ for *
* documentation and more. If desired copy the php3.ini-dist file to *
* your config directory/php3.ini and edit it. *
* *
***************************************************************************
'