1999-04-19 02:06:54 +08:00
|
|
|
#!/bin/sh
|
2019-02-17 03:29:42 +08:00
|
|
|
#
|
|
|
|
# A wrapper around Autoconf that generates files to build PHP on *nix systems.
|
1999-04-19 02:06:54 +08:00
|
|
|
|
2019-02-17 03:29:42 +08:00
|
|
|
MAKE=${MAKE:-make}
|
2019-04-17 06:09:36 +08:00
|
|
|
PHP_AUTOCONF=${PHP_AUTOCONF:-autoconf}
|
|
|
|
PHP_AUTOHEADER=${PHP_AUTOHEADER:-autoheader}
|
2019-02-17 03:29:42 +08:00
|
|
|
force=0
|
|
|
|
debug=0
|
|
|
|
|
|
|
|
# Go to project root.
|
|
|
|
cd $(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
|
|
|
|
|
2019-03-20 06:49:26 +08:00
|
|
|
php_extra_version=$(grep '^AC_INIT(' configure.ac)
|
|
|
|
case "$php_extra_version" in
|
|
|
|
*-dev*)
|
2003-05-19 19:54:00 +08:00
|
|
|
dev=1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
dev=0
|
|
|
|
;;
|
2003-05-19 19:47:13 +08:00
|
|
|
esac
|
|
|
|
|
2003-12-02 16:00:23 +08:00
|
|
|
while test $# -gt 0; do
|
2019-02-17 03:29:42 +08:00
|
|
|
if test "$1" = "-h" || test "$1" = "--help"; then
|
|
|
|
cat << HELP
|
|
|
|
PHP buildconf
|
|
|
|
|
|
|
|
A wrapper around the autoconf and autoheader that generate files for building
|
2019-03-13 07:25:07 +08:00
|
|
|
PHP on *nix systems (configure and main/php_config.h.in). The configure script
|
|
|
|
is used to customize the PHP build based on the provided options and system. PHP
|
|
|
|
releases downloaded from PHP.net already include the configure script so
|
|
|
|
installing Autoconf and running buildconf is not needed. For the PHP sources
|
|
|
|
from the Git repository, buildconf is used for generating a new configure script
|
|
|
|
and required files.
|
2019-02-17 03:29:42 +08:00
|
|
|
|
|
|
|
SYNOPSIS:
|
|
|
|
buildconf [<options>]
|
|
|
|
|
|
|
|
OPTIONS:
|
2019-04-29 03:15:54 +08:00
|
|
|
-f, --force Clean cache and overwrite configure files.
|
2019-02-17 03:29:42 +08:00
|
|
|
--debug Display warnings emitted by Autoconf.
|
|
|
|
-h, --help Display this help.
|
|
|
|
|
|
|
|
ENVIRONMENT:
|
|
|
|
The following optional variables are supported:
|
|
|
|
|
|
|
|
MAKE Overrides the path to make tool.
|
|
|
|
MAKE=/path/to/make ./buildconf
|
|
|
|
PHP_AUTOCONF Overrides the path to autoconf tool.
|
|
|
|
PHP_AUTOCONF=/path/to/autoconf ./buildconf
|
|
|
|
PHP_AUTOHEADER Overrides the path to autoheader tool.
|
|
|
|
PHP_AUTOHEADER=/path/to/autoheader ./buildconf
|
|
|
|
HELP
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-04-29 03:15:54 +08:00
|
|
|
if test "$1" = "-f" || test "$1" = "--force"; then
|
2019-02-17 03:29:42 +08:00
|
|
|
force=1
|
2003-12-02 16:00:23 +08:00
|
|
|
fi
|
1999-07-17 20:27:54 +08:00
|
|
|
|
2005-01-20 07:03:29 +08:00
|
|
|
if test "$1" = "--debug"; then
|
2019-02-17 03:29:42 +08:00
|
|
|
debug=1
|
2005-01-20 07:03:29 +08:00
|
|
|
fi
|
|
|
|
|
2003-12-02 16:00:23 +08:00
|
|
|
shift
|
2002-06-24 11:05:00 +08:00
|
|
|
done
|
2002-06-23 23:47:40 +08:00
|
|
|
|
2019-02-17 03:29:42 +08:00
|
|
|
if test "$dev" = "0" -a "$force" = "0"; then
|
|
|
|
if test -f "configure"; then
|
|
|
|
echo "The configure script has already been built for you. All done."
|
|
|
|
echo "Run ./configure to proceed with customizing the PHP build."
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "Configure script is missing." >&2
|
|
|
|
echo "Run ./buildconf --force to create a configure script." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-04-27 23:21:56 +08:00
|
|
|
if test "$force" = "1"; then
|
|
|
|
echo "buildconf: Forcing buildconf"
|
|
|
|
echo "buildconf: Removing configure caches and files"
|
|
|
|
rm -rf autom4te.cache config.cache configure
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "buildconf: Checking installation"
|
|
|
|
|
|
|
|
# Get minimum required autoconf version from the configure.ac file.
|
|
|
|
min_version=$(sed -n 's/AC_PREREQ(\[\(.*\)\])/\1/p' configure.ac)
|
|
|
|
|
|
|
|
# Check if autoconf exists.
|
|
|
|
ac_version=$($PHP_AUTOCONF --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//')
|
|
|
|
|
|
|
|
if test -z "$ac_version"; then
|
|
|
|
echo "buildconf: autoconf not found." >&2
|
|
|
|
echo " You need autoconf version $min_version or newer installed" >&2
|
|
|
|
echo " to build PHP from Git." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check autoconf version.
|
|
|
|
set -f; IFS='.'; set -- $ac_version; set +f; IFS=' '
|
|
|
|
ac_version_num="$(expr ${1} \* 10000 + ${2} \* 100)"
|
|
|
|
set -f; IFS='.'; set -- $min_version; set +f; IFS=' '
|
|
|
|
min_version_num="$(expr ${1} \* 10000 + ${2} \* 100)"
|
|
|
|
|
|
|
|
if test "$ac_version_num" -lt "$min_version_num"; then
|
|
|
|
echo "buildconf: autoconf version $ac_version found." >&2
|
|
|
|
echo " You need autoconf version $min_version or newer installed" >&2
|
|
|
|
echo " to build PHP from Git." >&2
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "buildconf: autoconf version $ac_version (ok)"
|
|
|
|
fi
|
|
|
|
|
2019-02-17 03:29:42 +08:00
|
|
|
# Check if make exists.
|
|
|
|
if ! test -x "$(command -v $MAKE)"; then
|
|
|
|
echo "buildconf: make not found." >&2
|
|
|
|
echo " You need to have make installed to build PHP." >&2
|
2003-05-19 19:54:00 +08:00
|
|
|
exit 1
|
2003-05-19 19:47:13 +08:00
|
|
|
fi
|
2012-03-07 05:30:59 +08:00
|
|
|
|
2019-02-17 03:29:42 +08:00
|
|
|
echo "buildconf: Building configure files"
|
|
|
|
|
|
|
|
if test "$debug" = "1"; then
|
2019-04-17 06:09:36 +08:00
|
|
|
autoconf_flags="-f -Wall"
|
2005-02-04 01:42:42 +08:00
|
|
|
else
|
2019-04-17 06:09:36 +08:00
|
|
|
autoconf_flags="-f"
|
2005-02-04 01:42:42 +08:00
|
|
|
fi
|
2019-04-17 06:09:36 +08:00
|
|
|
|
|
|
|
$MAKE -s -f build/build.mk \
|
|
|
|
PHP_AUTOCONF="$PHP_AUTOCONF" \
|
|
|
|
PHP_AUTOHEADER="$PHP_AUTOHEADER" \
|
|
|
|
PHP_AUTOCONF_FLAGS="$autoconf_flags" \
|
2019-03-13 07:25:07 +08:00
|
|
|
PHP_M4_FILES="$(echo TSRM/*.m4 Zend/Zend.m4 build/*.m4 ext/*/config*.m4 sapi/*/config*.m4)"
|