summaryrefslogtreecommitdiff
path: root/scripts/php-config.in
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2007-06-29 01:09:54 +0000
committerfoobar <sniper@php.net>2007-06-29 01:09:54 +0000
commit68724e2489d3702e74ce57c0f0df4327a60cc81c (patch)
tree7425d4e8f48ec06c612b37cdb6519565746d3d58 /scripts/php-config.in
parente9658dfc4d9e5164391e7e0984c87890ad90fabf (diff)
downloadphp-git-68724e2489d3702e74ce57c0f0df4327a60cc81c.tar.gz
- Improved php-config:
. Added --configure-options option to get configure line for current build . Added --php-sapis option which shows SAPIs available . Fixed problem with missing php binary when CLI is not build but CGI is. - Fixed broken sed issues in phpize script
Diffstat (limited to 'scripts/php-config.in')
-rw-r--r--scripts/php-config.in72
1 files changed, 58 insertions, 14 deletions
diff --git a/scripts/php-config.in b/scripts/php-config.in
index 7937779b13..f3e9453ae8 100644
--- a/scripts/php-config.in
+++ b/scripts/php-config.in
@@ -1,10 +1,11 @@
#! /bin/sh
+SED="@SED@"
prefix="@prefix@"
exec_prefix="@exec_prefix@"
version="@PHP_VERSION@"
-version_id="@PHP_VERSION_ID@"
-includedir="@includedir@/php"
+vernum="@PHP_VERSION_ID@"
+include_dir="@includedir@/php"
includes="-I$includedir -I$includedir/main -I$includedir/TSRM -I$includedir/Zend -I$includedir/ext -I$includedir/ext/date/lib"
ldflags="@PHP_LDFLAGS@"
libs="@EXTRA_LIBS@"
@@ -12,30 +13,73 @@ extension_dir='@EXTENSION_DIR@'
program_prefix="@program_prefix@"
program_suffix="@program_suffix@"
exe_extension="@EXEEXT@"
-php_binary="@bindir@/${program_prefix}php${program_suffix}${exe_extension}"
+php_cli_binary=NONE
+php_cgi_binary=NONE
+configure_options="@CONFIGURE_OPTIONS@"
+php_sapis="@PHP_INSTALLED_SAPIS@"
+
+# Set php_cli_binary and php_cgi_binary if available
+for sapi in $php_sapis; do
+ case $sapi in
+ cli)
+ php_cli_binary="@bindir@/${program_prefix}php${program_suffix}${exe_extension}"
+ ;;
+ cgi)
+ php_cgi_binary="@bindir@/${program_prefix}php-cgi${program_suffix}${exe_extension}"
+ ;;
+ esac
+done
+
+# Determine which (if any) php binary is available
+if test "$php_cli_binary" != "NONE"; then
+ php_binary="$php_cli_binary"
+else
+ php_binary="$php_cgi_binary"
+fi
+
+# Remove quotes
+configure_options="`echo $configure_options | $SED -e "s#'##g"`"
case "$1" in
--prefix)
- echo $prefix;;
+ echo $prefix;;
--includes)
- echo $includes;;
+ echo $includes;;
--ldflags)
- echo $ldflags;;
+ echo $ldflags;;
--libs)
- echo $libs;;
+ echo $libs;;
--extension-dir)
- echo $extension_dir;;
+ echo $extension_dir;;
--include-dir)
- echo $includedir;;
+ echo $include_dir;;
--php-binary)
- echo $php_binary;;
+ echo $php_binary;;
+--php-sapis)
+ echo $php_sapis;;
+--configure-options)
+ echo $configure_options;;
--version)
- echo $version;;
+ echo $version;;
--vernum)
- echo $version_id;;
+ echo $vernum;;
*)
- echo "Usage: $0 [--prefix|--includes|--ldflags|--libs|--extension-dir|--include-dir|--php-binary|--version|--vernum]"
- exit 1;;
+ cat << EOF
+Usage: $0 [OPTION]
+Options:
+ --prefix [$prefix]
+ --includes [$includes]
+ --ldflags [$ldflags]
+ --libs [$libs]
+ --extension-dir [$extension_dir]
+ --include-dir [$include_dir]
+ --php-binary [$php_binary]
+ --php-sapis [$php_sapis]
+ --configure-options [$configure_options]
+ --version [$version]
+ --vernum [$vernum]
+EOF
+ exit 1;;
esac
exit 0