2003-12-19 22:01:24 +08:00
|
|
|
#!/bin/sh
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2003-12-19 22:01:24 +08:00
|
|
|
# Variable declaration
|
2000-07-25 07:55:34 +08:00
|
|
|
prefix='@prefix@'
|
2011-05-15 14:09:21 +08:00
|
|
|
datarootdir='@datarootdir@'
|
2005-06-10 20:33:59 +08:00
|
|
|
exec_prefix="`eval echo @exec_prefix@`"
|
|
|
|
phpdir="`eval echo @libdir@`/build"
|
|
|
|
includedir="`eval echo @includedir@`/php"
|
2000-05-03 04:10:46 +08:00
|
|
|
builddir="`pwd`"
|
2007-06-29 09:09:54 +08:00
|
|
|
SED="@SED@"
|
2003-01-28 18:59:12 +08:00
|
|
|
|
2018-01-17 15:09:04 +08:00
|
|
|
FILES_BUILD="mkdep.awk scan_makefile_in.awk shtool libtool.m4 ax_check_compile_flag.m4 ax_gcc_func_attribute.m4"
|
2005-08-09 00:06:49 +08:00
|
|
|
FILES="acinclude.m4 Makefile.global config.sub config.guess ltmain.sh run-tests*.php"
|
2013-08-12 13:55:23 +08:00
|
|
|
CLEAN_FILES="$FILES *.o *.lo *.la .deps .libs/ build/ modules/ install-sh \
|
2015-11-12 04:08:15 +08:00
|
|
|
mkinstalldirs missing config.nice config.sub config.guess configure configure.ac \
|
2005-01-23 04:30:05 +08:00
|
|
|
aclocal.m4 config.h config.h.in conftest* ltmain.sh libtool config.cache autom4te.cache/ \
|
2005-08-09 00:06:49 +08:00
|
|
|
config.log config.status Makefile Makefile.fragments Makefile.objects confdefs.h \
|
2005-12-12 19:51:18 +08:00
|
|
|
run-tests*.php tests/*.diff tests/*.exp tests/*.log tests/*.out tests/*.php"
|
2000-05-03 04:10:46 +08:00
|
|
|
|
2003-12-19 22:01:24 +08:00
|
|
|
# function declaration
|
|
|
|
phpize_usage()
|
|
|
|
{
|
|
|
|
echo "Usage: $0 [--clean|--help|--version|-v]"
|
|
|
|
}
|
|
|
|
|
|
|
|
phpize_no_configm4()
|
|
|
|
{
|
|
|
|
if test $@ -eq 1; then
|
|
|
|
clean=" --clean"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Cannot find config.m4. "
|
|
|
|
echo "Make sure that you run '$0$clean' in the top level source directory of the module"
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
phpize_clean()
|
|
|
|
{
|
|
|
|
echo "Cleaning.."
|
|
|
|
for i in $CLEAN_FILES; do
|
2005-08-09 00:58:12 +08:00
|
|
|
if test -f "$i"; then
|
|
|
|
rm -f $i
|
|
|
|
elif test -d "$i"; then
|
|
|
|
rm -rf $i
|
|
|
|
fi
|
2003-12-19 22:01:24 +08:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
phpize_check_configm4()
|
|
|
|
{
|
|
|
|
if test ! -r config.m4; then
|
|
|
|
phpize_no_configm4 $@
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
phpize_get_api_numbers()
|
|
|
|
{
|
|
|
|
# extracting API NOs:
|
2007-06-29 09:09:54 +08:00
|
|
|
PHP_API_VERSION=`grep '#define PHP_API_VERSION' $includedir/main/php.h|$SED 's/#define PHP_API_VERSION//'`
|
|
|
|
ZEND_MODULE_API_NO=`grep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO//'`
|
|
|
|
ZEND_EXTENSION_API_NO=`grep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|$SED 's/#define ZEND_EXTENSION_API_NO//'`
|
2003-12-19 22:01:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
phpize_print_api_numbers()
|
|
|
|
{
|
|
|
|
phpize_get_api_numbers
|
|
|
|
echo "Configuring for:"
|
|
|
|
echo "PHP Api Version: "$PHP_API_VERSION
|
|
|
|
echo "Zend Module Api No: "$ZEND_MODULE_API_NO
|
|
|
|
echo "Zend Extension Api No: "$ZEND_EXTENSION_API_NO
|
|
|
|
}
|
|
|
|
|
2005-06-10 20:33:59 +08:00
|
|
|
phpize_check_build_files()
|
2003-12-19 22:01:24 +08:00
|
|
|
{
|
2005-06-10 20:33:59 +08:00
|
|
|
if test ! -d "$phpdir"; then
|
|
|
|
cat <<EOF
|
|
|
|
Cannot find build files at '$phpdir'. Please check your PHP installation.
|
2003-12-19 22:01:24 +08:00
|
|
|
|
|
|
|
EOF
|
2005-06-10 20:33:59 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
2009-04-20 23:02:49 +08:00
|
|
|
|
|
|
|
case "$phpdir" in
|
|
|
|
*\ * | *\ *)
|
|
|
|
cat <<EOF
|
|
|
|
Invalid source path '$phpdir'. Whitespace is not allowed in source path.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "$builddir" in
|
|
|
|
*\ * | *\ *)
|
|
|
|
cat <<EOF
|
|
|
|
Invalid build path '$builddir'. Whitespace is not allowed in build path.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
exit 1;;
|
|
|
|
esac
|
2003-12-19 22:01:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
phpize_check_shtool()
|
|
|
|
{
|
2004-06-20 03:39:56 +08:00
|
|
|
test -x "$builddir/build/shtool" || chmod +x "$builddir/build/shtool"
|
2003-12-19 22:01:24 +08:00
|
|
|
|
2004-06-20 03:39:56 +08:00
|
|
|
if test ! -x "$builddir/build/shtool"; then
|
2005-06-10 20:33:59 +08:00
|
|
|
cat <<EOF
|
|
|
|
shtool at '$builddir/build/shtool' does not exist or is not executable.
|
|
|
|
Make sure that the file exists and is executable and then rerun this script.
|
|
|
|
|
|
|
|
EOF
|
2003-12-19 22:01:24 +08:00
|
|
|
exit 1
|
2005-04-07 14:25:28 +08:00
|
|
|
else
|
|
|
|
php_shtool=$builddir/build/shtool
|
2003-12-19 22:01:24 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2005-04-07 14:25:28 +08:00
|
|
|
phpize_check_autotools()
|
|
|
|
{
|
|
|
|
test -z "$PHP_AUTOCONF" && PHP_AUTOCONF=autoconf
|
|
|
|
test -z "$PHP_AUTOHEADER" && PHP_AUTOHEADER=autoheader
|
|
|
|
|
2009-06-24 15:42:14 +08:00
|
|
|
if test ! -x "$PHP_AUTOCONF" && test ! -x "`$php_shtool path $PHP_AUTOCONF`"; then
|
2005-04-08 06:03:02 +08:00
|
|
|
cat <<EOF
|
2006-07-17 08:46:00 +08:00
|
|
|
Cannot find autoconf. Please check your autoconf installation and the
|
2006-07-17 09:17:00 +08:00
|
|
|
\$PHP_AUTOCONF environment variable. Then, rerun this script.
|
2005-04-07 14:25:28 +08:00
|
|
|
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
2009-06-24 15:42:14 +08:00
|
|
|
if test ! -x "$PHP_AUTOHEADER" && test ! -x "`$php_shtool path $PHP_AUTOHEADER`"; then
|
2005-04-08 06:03:02 +08:00
|
|
|
cat <<EOF
|
2006-07-17 08:46:00 +08:00
|
|
|
Cannot find autoheader. Please check your autoconf installation and the
|
2006-07-17 09:17:00 +08:00
|
|
|
\$PHP_AUTOHEADER environment variable. Then, rerun this script.
|
2005-04-07 14:25:28 +08:00
|
|
|
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
2003-12-19 22:01:24 +08:00
|
|
|
|
|
|
|
phpize_copy_files()
|
|
|
|
{
|
|
|
|
test -d build || mkdir build
|
|
|
|
|
2004-06-20 04:32:07 +08:00
|
|
|
(cd "$phpdir" && cp $FILES_BUILD "$builddir"/build)
|
2004-06-20 03:39:56 +08:00
|
|
|
(cd "$phpdir" && cp $FILES "$builddir")
|
2005-06-05 20:58:59 +08:00
|
|
|
(cd "$builddir" && cat acinclude.m4 ./build/libtool.m4 > aclocal.m4)
|
2003-12-19 22:01:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
phpize_replace_prefix()
|
|
|
|
{
|
2007-06-29 09:09:54 +08:00
|
|
|
$SED \
|
2003-12-19 22:01:24 +08:00
|
|
|
-e "s#@prefix@#$prefix#" \
|
2015-11-12 04:08:15 +08:00
|
|
|
< "$phpdir/phpize.m4" > configure.ac
|
2003-12-19 22:01:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
phpize_autotools()
|
|
|
|
{
|
2005-04-07 14:25:28 +08:00
|
|
|
$PHP_AUTOCONF || exit 1
|
|
|
|
$PHP_AUTOHEADER || exit 1
|
2003-12-19 22:01:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Main script
|
|
|
|
|
2003-07-02 00:20:32 +08:00
|
|
|
case "$1" in
|
|
|
|
# Cleanup
|
2003-07-01 23:55:09 +08:00
|
|
|
--clean)
|
2003-12-19 22:01:24 +08:00
|
|
|
phpize_check_configm4 1
|
|
|
|
phpize_clean
|
|
|
|
exit 0
|
2003-07-01 23:55:09 +08:00
|
|
|
;;
|
2003-12-19 22:01:24 +08:00
|
|
|
|
2003-07-02 00:20:32 +08:00
|
|
|
# Usage
|
2003-07-01 23:55:09 +08:00
|
|
|
--help)
|
2003-12-19 22:01:24 +08:00
|
|
|
phpize_usage
|
|
|
|
exit 0
|
2003-07-01 23:55:09 +08:00
|
|
|
;;
|
2003-12-19 22:01:24 +08:00
|
|
|
|
|
|
|
# Version
|
|
|
|
--version|-v)
|
|
|
|
phpize_print_api_numbers
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
# Default
|
2003-07-02 00:20:32 +08:00
|
|
|
*)
|
2003-12-19 22:01:24 +08:00
|
|
|
phpize_check_configm4 0
|
2003-01-28 18:59:12 +08:00
|
|
|
|
2005-06-10 20:33:59 +08:00
|
|
|
phpize_check_build_files
|
|
|
|
|
2004-01-03 21:45:12 +08:00
|
|
|
phpize_print_api_numbers
|
|
|
|
|
2003-12-19 22:01:24 +08:00
|
|
|
phpize_copy_files
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2003-12-19 22:01:24 +08:00
|
|
|
phpize_replace_prefix
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2003-12-19 22:01:24 +08:00
|
|
|
touch install-sh mkinstalldirs missing
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2003-12-19 22:01:24 +08:00
|
|
|
phpize_check_shtool
|
|
|
|
|
2005-04-07 14:25:28 +08:00
|
|
|
phpize_check_autotools
|
|
|
|
|
|
|
|
phpize_autotools
|
2003-12-19 22:01:24 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2004-01-03 21:45:12 +08:00
|
|
|
exit 0
|