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@'
|
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`"
|
2003-01-28 18:59:12 +08:00
|
|
|
|
2005-01-20 09:41:20 +08:00
|
|
|
FILES_BUILD="mkdep.awk scan_makefile_in.awk shtool libtool.m4"
|
2005-08-09 00:06:49 +08:00
|
|
|
FILES="acinclude.m4 Makefile.global config.sub config.guess ltmain.sh run-tests*.php"
|
2005-01-20 09:41:20 +08:00
|
|
|
CLEAN_FILES="$FILES *.o *.lo *.la .deps .libs/ build/ include/ modules/ install-sh \
|
2003-01-28 18:59:12 +08:00
|
|
|
mkinstalldirs missing config.nice config.sub config.guess configure configure.in \
|
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 \
|
|
|
|
run-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:
|
2005-06-16 01:13:39 +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
|
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
|
|
|
|
|
2005-04-08 06:03:02 +08:00
|
|
|
if ! test -x "`$php_shtool path $PHP_AUTOCONF`"; then
|
|
|
|
cat <<EOF
|
2005-04-07 14:25:28 +08:00
|
|
|
Cannot find autoconf. Please check your autoconf installation and the \$PHP_AUTOCONF
|
|
|
|
environment variable is set correctly and then rerun this script.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
2005-04-08 06:03:02 +08:00
|
|
|
if ! test -x "`$php_shtool path $PHP_AUTOHEADER`"; then
|
|
|
|
cat <<EOF
|
2005-04-07 14:25:28 +08:00
|
|
|
Cannot find autoheader. Please check your autoconf installation and the \$PHP_AUTOHEADER
|
|
|
|
environment variable is set correctly and then rerun this script.
|
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
sed \
|
|
|
|
-e "s#@prefix@#$prefix#" \
|
2004-06-20 03:39:56 +08:00
|
|
|
< "$phpdir/phpize.m4" > configure.in
|
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
|