1
1
#! /bin/sh
2
+ #
3
+ # A wrapper around Autoconf that generates files to build PHP on *nix systems.
2
4
3
- eval ` grep ' ^PHP_EXTRA_VERSION=' configure.ac`
5
+ MAKE=${MAKE:- make}
6
+ force=0
7
+ debug=0
8
+
9
+ # Go to project root.
10
+ cd $( CDPATH= cd -- " $( dirname -- " $0 " ) " && pwd -P)
11
+
12
+ eval $( grep ' ^PHP_EXTRA_VERSION=' configure.ac)
4
13
case " $PHP_EXTRA_VERSION " in
5
14
* -dev)
6
15
dev=1
@@ -10,37 +19,82 @@ case "$PHP_EXTRA_VERSION" in
10
19
;;
11
20
esac
12
21
13
- devok=0
14
- debug=no
15
-
16
22
while test $# -gt 0; do
23
+ if test " $1 " = " -h" || test " $1 " = " --help" ; then
24
+ cat << HELP
25
+ PHP buildconf
26
+
27
+ A wrapper around the autoconf and autoheader that generate files for building
28
+ PHP on *nix systems (configure, main/php_config.h.in, aclocal.m4...). The
29
+ configure script is used to customize the PHP build based on the provided
30
+ options and system. PHP releases downloaded from PHP.net already include the
31
+ configure script so installing Autoconf and running buildconf is not needed. For
32
+ the PHP sources from the Git repository, buildconf is used for generating a new
33
+ configure script and required files.
34
+
35
+ SYNOPSIS:
36
+ buildconf [<options>]
37
+
38
+ OPTIONS:
39
+ --force Clean cache and overwrite configure files.
40
+ --debug Display warnings emitted by Autoconf.
41
+ -h, --help Display this help.
42
+
43
+ ENVIRONMENT:
44
+ The following optional variables are supported:
45
+
46
+ MAKE Overrides the path to make tool.
47
+ MAKE=/path/to/make ./buildconf
48
+ PHP_AUTOCONF Overrides the path to autoconf tool.
49
+ PHP_AUTOCONF=/path/to/autoconf ./buildconf
50
+ PHP_AUTOHEADER Overrides the path to autoheader tool.
51
+ PHP_AUTOHEADER=/path/to/autoheader ./buildconf
52
+ HELP
53
+ exit 0
54
+ fi
55
+
17
56
if test " $1 " = " --force" ; then
18
- devok=1
19
- echo " Forcing buildconf"
57
+ force=1
20
58
fi
21
59
22
60
if test " $1 " = " --debug" ; then
23
- debug=yes
61
+ debug=1
24
62
fi
25
63
26
64
shift
27
65
done
28
66
29
- if test " $dev " = " 0" -a " $devok " = " 0" ; then
30
- echo " You should not run buildconf in a release package." >&2
31
- echo " use buildconf --force to override this check." >&2
67
+ if test " $dev " = " 0" -a " $force " = " 0" ; then
68
+ if test -f " configure" ; then
69
+ echo " The configure script has already been built for you. All done."
70
+ echo " Run ./configure to proceed with customizing the PHP build."
71
+ exit 0
72
+ else
73
+ echo " Configure script is missing." >&2
74
+ echo " Run ./buildconf --force to create a configure script." >&2
75
+ exit 1
76
+ fi
77
+ fi
78
+
79
+ # Check if make exists.
80
+ if ! test -x " $( command -v $MAKE ) " ; then
81
+ echo " buildconf: make not found." >&2
82
+ echo " You need to have make installed to build PHP." >&2
32
83
exit 1
33
84
fi
34
85
35
- if test " $devok " = " 1" ; then
36
- echo " Removing configure caches"
86
+ if test " $force " = " 1" ; then
87
+ echo " buildconf: Forcing buildconf"
88
+ echo " buildconf: Removing configure caches"
37
89
rm -rf autom4te.cache config.cache
38
90
fi
39
91
92
+ echo " buildconf: Building configure files"
93
+
40
94
rm -f generated_lists
41
95
42
- if test " $debug " = " yes " ; then
43
- ${ MAKE:- make} -s -f build/build.mk SUPPRESS_WARNINGS=" "
96
+ if test " $debug " = " 1 " ; then
97
+ $MAKE -s -f build/build.mk SUPPRESS_WARNINGS=" "
44
98
else
45
- ${ MAKE:- make} -s -f build/build.mk
99
+ $MAKE -s -f build/build.mk
46
100
fi
0 commit comments