From 719d37dbf88c55a19fc2837463baf6eb01a6d388 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 21 Mar 2014 16:01:35 -0500 Subject: [PATCH] first 1/2 of automake for esl phpmod --- configure.ac | 30 ++++++++++++++++++++++++++ libs/esl/php/{Makefile => Makefile.am} | 17 ++------------- 2 files changed, 32 insertions(+), 15 deletions(-) rename libs/esl/php/{Makefile => Makefile.am} (52%) diff --git a/configure.ac b/configure.ac index f0b13ac778..6b7386f276 100644 --- a/configure.ac +++ b/configure.ac @@ -1116,6 +1116,10 @@ AM_CONDITIONAL([HAVE_ODBC],[test "x$enable_core_odbc_support" != "xno"]) AM_CONDITIONAL([HAVE_LIBEDIT],[test "x$enable_core_libedit_support" != "xno"]) AM_CONDITIONAL([HAVE_MYSQL],[test "$found_mysql" = "yes"]) +# +# perl checks +# + AC_CHECK_PROG(PERL,perl,[ac_cv_have_perl=yes],[ac_cv_have_perl=no]) AM_CONDITIONAL([HAVE_PERL],[test "x$ac_cv_have_perl" != "xno"]) @@ -1134,6 +1138,31 @@ if test "x$ac_cv_have_perl" != "xno" ; then AC_SUBST(PERL_INC) fi +# +# php checks +# + +AC_CHECK_PROG(PHP,php,[ac_cv_have_php=yes],[ac_cv_have_php=no]) +AC_CHECK_PROG(PHP_CONFIG,php-config,[ac_cv_have_php_config=yes],[ac_cv_have_php_config=no]) +AM_CONDITIONAL([HAVE_PHP],[test "x$ac_cv_have_php" != "xno" -a "x$ac_cv_have_php_config" != "xno"]) + +if test "x$ac_cv_have_php" != "xno" -a "x$ac_cv_have_php_config" != "xno"; then + PHP=php + PHP_CONFIG=php-config + PHP_LDFLAGS="`$PHP_CONFIG --ldflags`" + PHP_LIBS="`$PHP_CONFIG --libs | sed -r 's/ ?-l(bz2|pcre|xml2|gssapi_krb5|krb5|k5crypto|com_err|history|z|readline|gmp|ssl|crypto)//g'`" + PHP_EXT_DIR="`$PHP_CONFIG --extension-dir`" + PHP_INC_DIR="`$PHP -r 'echo ini_get("include_path");' | cut -d: -f2`" + PHP_INI_DIR="`$PHP_CONFIG --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=`" + PHP_CFLAGS="`$PHP_CONFIG --includes`" + AC_SUBST(PHP_LDFLAGS) + AC_SUBST(PHP_LIBS) + AC_SUBST(PHP_EXT_DIR) + AC_SUBST(PHP_INC_DIR) + AC_SUBST(PHP_INI_DIR) + AC_SUBST(PHP_CFLAGS) +fi + # # Python checks for mod_python # @@ -1425,6 +1454,7 @@ AC_CONFIG_FILES([Makefile build/modmake.rules libs/esl/Makefile libs/esl/perl/Makefile + libs/esl/php/Makefile libs/xmlrpc-c/include/xmlrpc-c/config.h libs/xmlrpc-c/xmlrpc_config.h libs/xmlrpc-c/config.mk diff --git a/libs/esl/php/Makefile b/libs/esl/php/Makefile.am similarity index 52% rename from libs/esl/php/Makefile rename to libs/esl/php/Makefile.am index 7cc42d2725..d2c04c55c0 100644 --- a/libs/esl/php/Makefile +++ b/libs/esl/php/Makefile.am @@ -1,16 +1,3 @@ -PHP=php -PHP_CONFIG=php-config - -PHP_LDFLAGS=$(shell $(PHP_CONFIG) --ldflags) -PHP_LIBS=$(shell $(PHP_CONFIG) --libs | sed -r 's/ ?-l(bz2|pcre|xml2|gssapi_krb5|krb5|k5crypto|com_err|history|z|readline|gmp|ssl|crypto)//g') -PHP_EXT_DIR=$(shell $(PHP_CONFIG) --extension-dir) -PHP_INC_DIR=$(shell $(PHP) -r 'echo ini_get("include_path");' | cut -d: -f2) -PHP_INI_DIR=$(shell $(PHP_CONFIG) --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=) - -LOCAL_CFLAGS=$(shell php-config --includes) -LOCAL_LDFLAGS=$(PHP_LDFLAGS) $(PHP_LIBS) -LOCAL_LDFLAGS+=-lpthread - WRAP_GCC_WARNING_SILENCE=-Wno-unused-label -Wno-unused-function all: ESL.so @@ -20,10 +7,10 @@ esl_wrap.cpp: sed -e 's/ char \*type_name;/ const char \*type_name;/' -i esl_wrap.cpp esl_wrap.o: esl_wrap.cpp - $(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) $(WRAP_GCC_WARNING_SILENCE) -c esl_wrap.cpp -o esl_wrap.o + $(CXX) -I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS) $(CXXFLAGS) $(PHP_CFLAGS) $(WRAP_GCC_WARNING_SILENCE) -c esl_wrap.cpp -o esl_wrap.o ESL.so: esl_wrap.o - $(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(LOCAL_LDFLAGS) -o ESL.so -L. $(LIBS) + $(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(PHP_LDFLAGS) $(PHP_LIBS) -lpthread -o ESL.so -L. $(LIBS) clean: rm -f *.o *.so *~