summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2008-09-12 15:36:53 -0700
committerRuss Allbery <rra@stanford.edu>2008-09-12 15:36:53 -0700
commit3786840efc18999b07ab7d021441c19846e89211 (patch)
tree61e0c9632217a9c228c7282f95f130925c9d3168
parentbaeec5b5bba7aab9aba5e05a3c3d5fcbf5848ed1 (diff)
Switch to configuring PHP at build time
Handling the PHP directory as an Autoconf subdirectory just doesn't work with srcdir != builddir builds. The ordering is all wrong. Switch to running configure at build time, which also has the nice advantage that we can generate config.m4 with Autoconf and substitute in the correct link paths.
-rw-r--r--.gitignore3
-rw-r--r--Makefile.am15
-rw-r--r--README4
-rw-r--r--configure.ac11
-rw-r--r--php/config.m4.in (renamed from php/config.m4)12
5 files changed, 22 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index cfc7bb2..c72af09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,6 +30,7 @@ php/acinclude.m4
php/autom4te.cache/
php/build/
php/config.guess
+php/config.m4
php/config.nice
php/config.sub
php/configure.in
@@ -38,6 +39,7 @@ php/ltmain.sh
php/missing
php/mkinstalldirs
php/modules/
+php/php_remctl.h
php/run-tests.php
python/MANIFEST
python/build
@@ -97,6 +99,7 @@ tests/util/xwrite-t
*.jar
*.la
*.lo
+*.loT
*.o
*.pyc
*.tgz
diff --git a/Makefile.am b/Makefile.am
index b97613b..f1c965b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,10 +42,10 @@ EXTRA_DIST = LICENSE Makefile.w32 autogen client/libremctl.rc client/mapfile \
java/org/eyrie/eagle/remctl/Remctl.java \
java/org/eyrie/eagle/remctl/RemctlClient.java \
java/org/eyrie/eagle/remctl/RemctlServer.java java/t5.java \
- java/t7.java php/config.m4 portable/getaddrinfo.h \
- portable/getnameinfo.h portable/getopt.h portable/gssapi.h \
- portable/macros.h portable/socket.h portable/stdbool.h \
- portable/system.h portable/uio.h portable/winsock.c remctl.spec \
+ java/t7.java portable/getaddrinfo.h portable/getnameinfo.h \
+ portable/getopt.h portable/gssapi.h portable/macros.h \
+ portable/socket.h portable/stdbool.h portable/system.h \
+ portable/uio.h portable/winsock.c remctl.spec \
$(PERL_FILES) $(PHP_FILES) $(PYTHON_FILES) $(TEST_FILES)
lib_LTLIBRARIES = client/libremctl.la
@@ -373,14 +373,17 @@ endif
# The following section sets up the PECL extension for PHP.
-php/modules/remctl.so: $(srcdir)/php/php_remctl.c $(srcdir)/php/php_remctl.h
+php/modules/remctl.so: php/config.m4 php/php_remctl.h \
+ $(srcdir)/php/php_remctl.c
set -e; if [ x"$(builddir)" != x"$(srcdir)" ] ; then \
- mkdir php 2>/dev/null || true ; \
mkdir php/tests 2>/dev/null || true ; \
for f in $(PHP_FILES) ; do \
cp "$(srcdir)/$$f" "$(builddir)/$$f" ; \
done \
fi
+ cd php && $(PHPIZE) --clean && $(PHPIZE)
+ cd php && ./configure CPPFLAGS="$(CPPFLAGS)" \
+ CFLAGS="$(CFLAGS) $(PHP_WARNINGS)" LDFLAGS="$(LDFLAGS)"
cd php && $(MAKE) CFLAGS="$(CFLAGS) $(PHP_WARNINGS)"
install-data-local-php: php/modules/remctl.so
diff --git a/README b/README
index e7e3b13..d809f66 100644
--- a/README
+++ b/README
@@ -124,7 +124,9 @@ INSTALLATION (UNIX)
local PHP module directory. The configure script will look for phpize
on your PATH by default; if it's in some other directory, set the PHPIZE
environment variable to the full path or set it on the configure command
- line.
+ line. The configure script for the PECL extension will be run during
+ the build instead of during configure. This is unfortunately apparently
+ unavoidable given how the PECL build system works.
To also build the Python bindings for the libremctl client library, pass
the --enable-python option to configure. The Python module build is
diff --git a/configure.ac b/configure.ac
index 86d9adc..cd135d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,14 +125,7 @@ AC_ARG_ENABLE([php],
[AS_IF([test x"$enableval" = xyes],
[build_php=yes
AC_ARG_VAR([PHPIZE], [Path to phpize])
- AC_PATH_PROG([PHPIZE], [phpize])
- AS_IF([test x"$srcdir" != x. && test x"$srcdir" != x],
- [mkdir php 2>/dev/null
- cp "$srcdir/php/config.m4" php/config.m4])
- AC_MSG_NOTICE([running phpize in php directory])
- AS_IF([(set -e; cd php; "$PHPIZE" --clean; "$PHPIZE")], ,
- [AC_MSG_FAILURE([phpize failed])])
- AC_CONFIG_SUBDIRS([php])])])
+ AC_PATH_PROG([PHPIZE], [phpize])])])
AM_CONDITIONAL([BUILD_PHP], [test x"$build_php" = xyes])
dnl Whether to build the Python bindings.
@@ -147,7 +140,7 @@ AC_CONFIG_FILES([tests/client/pod-t], [chmod +x tests/client/pod-t])
AS_IF([test x"$build_perl" = xyes],
[AC_CONFIG_FILES([perl/Makefile.PL perl/Remctl.pm])])
AS_IF([test x"$build_php" = xyes],
- [AC_CONFIG_FILES([php/php_remctl.h])])
+ [AC_CONFIG_FILES([php/config.m4 php/php_remctl.h])])
AS_IF([test x"$build_python" = xyes],
[AC_CONFIG_FILES([python/remctl.py python/setup.py])])
AC_CONFIG_HEADER([config.h])
diff --git a/php/config.m4 b/php/config.m4.in
index 1a50fa4..c26d82b 100644
--- a/php/config.m4
+++ b/php/config.m4.in
@@ -1,4 +1,4 @@
-dnl remctl PECL extension for PHP configuration
+dnl remctl PECL extension for PHP configuration -*- autoconf -*-
dnl
dnl Provides additional configuration hooks for the PHP module build system.
dnl This file is used by the phpize frameowrk.
@@ -12,11 +12,9 @@ dnl See LICENSE for licensing terms.
PHP_ARG_ENABLE([remctl], [whether to enable remctl PHP extension],
[AC_HELP_STRING([--enable-remctl], [Enable recmtl PHP extension])], [yes])
-dnl The escaping on PHP_ADD_INCLUDE and PHP_ADD_LIBPATH seems to work, and
-dnl seems to be the only thing that works, but it makes me nervous. Needs
-dnl more testing and maybe a better approach that will still work for builddir
-dnl != srcdir builds.
+dnl The @...@ variables are substituted by the top-level configure. Yes, this
+dnl is a little odd, but it seems to work.
AS_IF([test "$PHP_REMCTL" != no],
[PHP_NEW_EXTENSION([remctl], [php_remctl.c], [$ext_shared])
- PHP_ADD_INCLUDE([\${abs_top_srcdir}/..])
- LDFLAGS="$LDFLAGS -L\${top_builddir}/../client/.libs -lremctl"])
+ PHP_ADD_INCLUDE([@abs_top_srcdir@])
+ LDFLAGS="$LDFLAGS -L@abs_top_builddir@/client/.libs -lremctl"])