php extensions can usually be configured to use a specific php-config
using --with-php-config to explicitly specify a path to php-config.
Moved phpize-detection after php-config and use php-config's prefix path
to look for phpize first.
---
configure.ac | 18 ++++++++++++++----
src/Makefile.am | 6 +++---
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6abf568..8149349 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,16 +109,26 @@ AC_ARG_WITH([html-subdir],
[AC_HELP_STRING([--with-html-subdir=path],
[HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
AC_SUBST([HTML_DIR])
-AC_PATH_PROG([PHPIZE], [phpize], [no])
-if test "x$PHPIZE" = "xno"; then
- AC_MSG_ERROR([phpize not found; please install the PHP SDK])
+AC_ARG_WITH([php-config], [AC_HELP_STRING([--with-php-config=path],
+ [path to php-config, default search all paths])])
+
+if test "x$with_php_config" != "x" ; then
+ AC_MSG_CHECKING(for php-config)
+ PHPCONFIG=$with_php_config
+ AC_MSG_RESULT($with_php_config)
+else
+ AC_PATH_PROG([PHPCONFIG], [php-config], [no])
fi
-AC_PATH_PROG([PHPCONFIG], [php-config], [no])
if test "x$PHPCONFIG" = "xno"; then
AC_MSG_ERROR([php-config not found; please install the PHP SDK])
fi
+AC_PATH_PROG([PHPIZE], [phpize], [no], [`php-config --prefix`/bin$PATH_SEPARATOR$PATH])
+if test "x$PHPIZE" = "xno"; then
+ AC_MSG_ERROR([phpize not found; please install the PHP SDK])
+fi
+
AC_SUBST([PHPIZE])
AC_SUBST([PHPCONFIG])
AC_CONFIG_HEADERS([config.h])
diff --git a/src/Makefile.am b/src/Makefile.am
index 9c7101d..9bc62dd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
-PHPINC=$(shell php-config --includes)
-PHPEDIR=$(shell php-config --extension-dir)
-PHPCDIR=$(shell php-config --configure-options | sed -n
's|.*--with-config-file-scan-dir=\([^ ]*\).*|\1|p')
+PHPINC=$(shell $(PHPCONFIG) --includes)
+PHPEDIR=$(shell $(PHPCONFIG) --extension-dir)
+PHPCDIR=$(shell $(PHPCONFIG) --configure-options | sed -n
's|.*--with-config-file-scan-dir=\([^ ]*\).*|\1|p')
DEFINES=-DHAVE_CONFIG_H
EXTRA_DIST = libvirt.c libvirt_php.h
--
1.7.4.1