summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJan Lehnardt <jan@php.net>2003-12-19 14:01:24 +0000
committerJan Lehnardt <jan@php.net>2003-12-19 14:01:24 +0000
commit1e1e3436f3f1c7965573d39c38e212c3e37d2ec3 (patch)
treeac5031e467f2dd01cec7402939742d36651b72fb /scripts
parent5f16e61f0575870a86878769b316b4f8315bcd3f (diff)
downloadphp-git-1e1e3436f3f1c7965573d39c38e212c3e37d2ec3.tar.gz
- restructured phpize
- added -v and --version to print out API numbers - discussed with Jani and Andi
Diffstat (limited to 'scripts')
-rw-r--r--scripts/phpize.in184
1 files changed, 130 insertions, 54 deletions
diff --git a/scripts/phpize.in b/scripts/phpize.in
index 0fae6151b9..02c3c93df2 100644
--- a/scripts/phpize.in
+++ b/scripts/phpize.in
@@ -1,5 +1,6 @@
-#! /bin/sh
+#!/bin/sh
+# Variable declaration
prefix='@prefix@'
phpdir="$prefix/lib/php/build"
includedir="$prefix/include/php"
@@ -12,69 +13,144 @@ CLEAN_FILES="$FILES *.lo *.la *.o .deps .libs/ build/ include/ modules/ install-
aclocal.m4 config.h config.h.in conftest* ltmain.sh libtool config.cache \
config.log config.status Makefile Makefile.fragments Makefile.objects confdefs.h"
+# 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
+ test -e $i && rm -rf $i
+ done
+}
+
+phpize_check_configm4()
+{
+ if test ! -r config.m4; then
+ phpize_no_configm4 $@
+ exit 1
+ fi
+
+}
+
+phpize_get_api_numbers()
+{
+ # extracting API NOs:
+ PHP_API_VERSION=`egrep '#define PHP_API_VERSION' $includedir/main/php.h|sed 's/#define PHP_API_VERSION//'`
+ ZEND_MODULE_API_NO=`egrep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO//'`
+ ZEND_EXTENSION_API_NO=`egrep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|sed 's/#define ZEND_EXTENSION_API_NO//'`
+}
+
+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
+}
+
+phpize_no_shtool()
+{
+ echo <<EOF
+shtool at '$builddir/build/shtool' not executable.
+Make sure that the file exists and is executable and then rerun this script.
+
+EOF
+}
+
+phpize_check_shtool()
+{
+ test -x $builddir/build/shtool || chmod +x $builddir/build/shtool
+
+ if test ! -x $builddir/build/shtool; then
+ phpize_no_shtool
+ exit 1
+ fi
+}
+
+
+phpize_copy_files()
+{
+ test -d build || mkdir build
+
+ (cd $phpdir && cp $FILES_BUILD "$builddir"/build)
+ (cd $phpdir && cp $FILES "$builddir")
+}
+
+phpize_replace_prefix()
+{
+ sed \
+ -e "s#@prefix@#$prefix#" \
+ < $phpdir/phpize.m4 > configure.in
+}
+
+phpize_autotools()
+{
+ aclocal || exit 1
+ autoconf || exit 1
+ autoheader || exit 1
+}
+
+phpize_libtoolize()
+{
+ libtoolize=`$builddir/build/shtool path glibtoolize libtoolize`
+ $libtoolize -f -c || exit 1
+}
+
+# Main script
+
case "$1" in
# Cleanup
--clean)
- if test -r config.m4; then
- echo "Cleaning.."
- for i in $CLEAN_FILES; do
- test -e $i && rm -rf $i
- done
- exit 0
- else
- echo "Cannot find config.m4. "
- echo "Make sure that you run '$0 --clean' in the top level source directory of the module"
- echo
- exit 1
- fi
+ phpize_check_configm4 1
+ phpize_clean
+ exit 0
;;
+
# Usage
--help)
- echo "Usage: $0 [--clean|--help]"
- exit 1
+ phpize_usage
+ exit 0
;;
+
+ # Version
+ --version|-v)
+ phpize_get_api_numbers
+ phpize_print_api_numbers
+ exit 0
+ ;;
+
+ # Default
*)
- if test ! -r config.m4; then
- echo "Cannot find config.m4. "
- echo "Make sure that you run '$0' in the top level source directory of the module"
- echo
- exit 1
- fi
- ;;
-esac
+ phpize_check_configm4 0
-test -d build || mkdir build
+ phpize_copy_files
-(cd $phpdir && cp $FILES_BUILD "$builddir"/build)
-(cd $phpdir && cp $FILES "$builddir")
+ phpize_replace_prefix
-sed \
--e "s#@prefix@#$prefix#" \
-< $phpdir/phpize.m4 > configure.in
+ touch install-sh mkinstalldirs missing
-touch install-sh mkinstalldirs missing
+ phpize_autotools
-aclocal || exit 1
-autoconf || exit 1
-autoheader || exit 1
-test -x $builddir/build/shtool || chmod +x $builddir/build/shtool
-if test ! -x $builddir/build/shtool; then
- echo "shtool at '$builddir/build/shtool' not executable. "
- echo "Make sure that the file exists and is executable and then rerun this script. "
- echo
- exit 1
-fi
-libtoolize=`$builddir/build/shtool path glibtoolize libtoolize`
-$libtoolize -f -c || exit 1
-
-# dumping API NOs:
-PHP_API_VERSION=`egrep '#define PHP_API_VERSION' $includedir/main/php.h|sed 's/#define PHP_API_VERSION//'`
-ZEND_MODULE_API_NO=`egrep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO//'`
-ZEND_EXTENSION_API_NO=`egrep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|sed 's/#define ZEND_EXTENSION_API_NO//'`
-
-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
-
-exit 0
+ phpize_check_shtool
+
+ phpize_libtoolize
+ ;;
+esac
+
+exit 0 \ No newline at end of file