Annotation of embedaddon/php/scripts/phpize.in, revision 1.1
1.1 ! misho 1: #!/bin/sh
! 2:
! 3: # Variable declaration
! 4: prefix='@prefix@'
! 5: exec_prefix="`eval echo @exec_prefix@`"
! 6: phpdir="`eval echo @libdir@`/build"
! 7: includedir="`eval echo @includedir@`/php"
! 8: builddir="`pwd`"
! 9: SED="@SED@"
! 10:
! 11: FILES_BUILD="mkdep.awk scan_makefile_in.awk shtool libtool.m4"
! 12: FILES="acinclude.m4 Makefile.global config.sub config.guess ltmain.sh run-tests*.php"
! 13: CLEAN_FILES="$FILES *.o *.lo *.la .deps .libs/ build/ include/ modules/ install-sh \
! 14: mkinstalldirs missing config.nice config.sub config.guess configure configure.in \
! 15: aclocal.m4 config.h config.h.in conftest* ltmain.sh libtool config.cache autom4te.cache/ \
! 16: config.log config.status Makefile Makefile.fragments Makefile.objects confdefs.h \
! 17: run-tests*.php tests/*.diff tests/*.exp tests/*.log tests/*.out tests/*.php"
! 18:
! 19: # function declaration
! 20: phpize_usage()
! 21: {
! 22: echo "Usage: $0 [--clean|--help|--version|-v]"
! 23: }
! 24:
! 25: phpize_no_configm4()
! 26: {
! 27: if test $@ -eq 1; then
! 28: clean=" --clean"
! 29: fi
! 30:
! 31: echo "Cannot find config.m4. "
! 32: echo "Make sure that you run '$0$clean' in the top level source directory of the module"
! 33: echo
! 34: }
! 35:
! 36: phpize_clean()
! 37: {
! 38: echo "Cleaning.."
! 39: for i in $CLEAN_FILES; do
! 40: if test -f "$i"; then
! 41: rm -f $i
! 42: elif test -d "$i"; then
! 43: rm -rf $i
! 44: fi
! 45: done
! 46: }
! 47:
! 48: phpize_check_configm4()
! 49: {
! 50: if test ! -r config.m4; then
! 51: phpize_no_configm4 $@
! 52: exit 1
! 53: fi
! 54:
! 55: }
! 56:
! 57: phpize_get_api_numbers()
! 58: {
! 59: # extracting API NOs:
! 60: PHP_API_VERSION=`grep '#define PHP_API_VERSION' $includedir/main/php.h|$SED 's/#define PHP_API_VERSION//'`
! 61: ZEND_MODULE_API_NO=`grep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO//'`
! 62: ZEND_EXTENSION_API_NO=`grep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|$SED 's/#define ZEND_EXTENSION_API_NO//'`
! 63: }
! 64:
! 65: phpize_print_api_numbers()
! 66: {
! 67: phpize_get_api_numbers
! 68: echo "Configuring for:"
! 69: echo "PHP Api Version: "$PHP_API_VERSION
! 70: echo "Zend Module Api No: "$ZEND_MODULE_API_NO
! 71: echo "Zend Extension Api No: "$ZEND_EXTENSION_API_NO
! 72: }
! 73:
! 74: phpize_check_build_files()
! 75: {
! 76: if test ! -d "$phpdir"; then
! 77: cat <<EOF
! 78: Cannot find build files at '$phpdir'. Please check your PHP installation.
! 79:
! 80: EOF
! 81: exit 1
! 82: fi
! 83:
! 84: case "$phpdir" in
! 85: *\ * | *\ *)
! 86: cat <<EOF
! 87: Invalid source path '$phpdir'. Whitespace is not allowed in source path.
! 88:
! 89: EOF
! 90: exit 1;;
! 91: esac
! 92:
! 93: case "$builddir" in
! 94: *\ * | *\ *)
! 95: cat <<EOF
! 96: Invalid build path '$builddir'. Whitespace is not allowed in build path.
! 97:
! 98: EOF
! 99: exit 1;;
! 100: esac
! 101: }
! 102:
! 103: phpize_check_shtool()
! 104: {
! 105: test -x "$builddir/build/shtool" || chmod +x "$builddir/build/shtool"
! 106:
! 107: if test ! -x "$builddir/build/shtool"; then
! 108: cat <<EOF
! 109: shtool at '$builddir/build/shtool' does not exist or is not executable.
! 110: Make sure that the file exists and is executable and then rerun this script.
! 111:
! 112: EOF
! 113: exit 1
! 114: else
! 115: php_shtool=$builddir/build/shtool
! 116: fi
! 117: }
! 118:
! 119: phpize_check_autotools()
! 120: {
! 121: test -z "$PHP_AUTOCONF" && PHP_AUTOCONF=autoconf
! 122: test -z "$PHP_AUTOHEADER" && PHP_AUTOHEADER=autoheader
! 123:
! 124: if test ! -x "$PHP_AUTOCONF" && test ! -x "`$php_shtool path $PHP_AUTOCONF`"; then
! 125: cat <<EOF
! 126: Cannot find autoconf. Please check your autoconf installation and the
! 127: \$PHP_AUTOCONF environment variable. Then, rerun this script.
! 128:
! 129: EOF
! 130: exit 1
! 131: fi
! 132: if test ! -x "$PHP_AUTOHEADER" && test ! -x "`$php_shtool path $PHP_AUTOHEADER`"; then
! 133: cat <<EOF
! 134: Cannot find autoheader. Please check your autoconf installation and the
! 135: \$PHP_AUTOHEADER environment variable. Then, rerun this script.
! 136:
! 137: EOF
! 138: exit 1
! 139: fi
! 140: }
! 141:
! 142: phpize_copy_files()
! 143: {
! 144: test -d build || mkdir build
! 145:
! 146: (cd "$phpdir" && cp $FILES_BUILD "$builddir"/build)
! 147: (cd "$phpdir" && cp $FILES "$builddir")
! 148: (cd "$builddir" && cat acinclude.m4 ./build/libtool.m4 > aclocal.m4)
! 149: }
! 150:
! 151: phpize_replace_prefix()
! 152: {
! 153: $SED \
! 154: -e "s#@prefix@#$prefix#" \
! 155: < "$phpdir/phpize.m4" > configure.in
! 156: }
! 157:
! 158: phpize_autotools()
! 159: {
! 160: $PHP_AUTOCONF || exit 1
! 161: $PHP_AUTOHEADER || exit 1
! 162: }
! 163:
! 164: # Main script
! 165:
! 166: case "$1" in
! 167: # Cleanup
! 168: --clean)
! 169: phpize_check_configm4 1
! 170: phpize_clean
! 171: exit 0
! 172: ;;
! 173:
! 174: # Usage
! 175: --help)
! 176: phpize_usage
! 177: exit 0
! 178: ;;
! 179:
! 180: # Version
! 181: --version|-v)
! 182: phpize_print_api_numbers
! 183: exit 0
! 184: ;;
! 185:
! 186: # Default
! 187: *)
! 188: phpize_check_configm4 0
! 189:
! 190: phpize_check_build_files
! 191:
! 192: phpize_print_api_numbers
! 193:
! 194: phpize_copy_files
! 195:
! 196: phpize_replace_prefix
! 197:
! 198: touch install-sh mkinstalldirs missing
! 199:
! 200: phpize_check_shtool
! 201:
! 202: phpize_check_autotools
! 203:
! 204: phpize_autotools
! 205: ;;
! 206: esac
! 207:
! 208: exit 0
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>