From 55f53a5a963da2788840995bc33752c10d4c166a Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 17 Feb 2005 04:23:15 +0000 Subject: [PATCH] symlinked pdo drivers under ext. Enabled PDO and PDO_SQLITE by default. Fixup PDO header detection so that it searches in the correct order, and correctly picks up the headers when building from outside of the source tree. TODO: make pdo_XXX auto-enable when XXX is enabled. Volunteers welcome. --- ext/pdo/Makefile.frag | 9 +++++---- ext/pdo/config.m4 | 4 ++-- ext/pdo_firebird/config.m4 | 17 ++++++++++------- ext/pdo_mysql/config.m4 | 18 ++++++++++-------- ext/pdo_oci/config.m4 | 15 +++++++++------ ext/pdo_odbc/config.m4 | 6 +++--- ext/pdo_pgsql/config.m4 | 17 +++++++++-------- ext/pdo_sqlite/config.m4 | 16 ++++++++-------- 8 files changed, 56 insertions(+), 46 deletions(-) diff --git a/ext/pdo/Makefile.frag b/ext/pdo/Makefile.frag index 8149a5df40..c5f1be442f 100644 --- a/ext/pdo/Makefile.frag +++ b/ext/pdo/Makefile.frag @@ -32,8 +32,9 @@ install-pdo-headers: # mini hack install: $(all_targets) $(install_targets) install-pdo-headers -$(top_srcdir)/ext/pdo/pdo_sql_parser.c: $(top_srcdir)/ext/pdo/pdo_sql_parser.re - exit 0; re2c -b $(top_srcdir)/ext/pdo/pdo_sql_parser.re > $@ +#$(top_srcdir)/ext/pdo/pdo_sql_parser.c: $(top_srcdir)/ext/pdo/pdo_sql_parser.re +# exit 0; re2c -b $(top_srcdir)/ext/pdo/pdo_sql_parser.re > $@ + +#$(srcdir)/pdo_sql_parser.c: $(srcdir)/pdo_sql_parser.re +# exit 0; re2c -b $(srcdir)/pdo_sql_parser.re > $@ -$(srcdir)/pdo_sql_parser.c: $(srcdir)/pdo_sql_parser.re - exit 0; re2c -b $(srcdir)/pdo_sql_parser.re > $@ diff --git a/ext/pdo/config.m4 b/ext/pdo/config.m4 index 357d81966c..bd2e2b94ef 100755 --- a/ext/pdo/config.m4 +++ b/ext/pdo/config.m4 @@ -51,8 +51,8 @@ in a future PHP/PEAR release. fi ]) -PHP_ARG_ENABLE(pdo, whether to disable PDO support, -[ --disable-pdo Disable PHP Data Objects support], yes) +PHP_ARG_ENABLE(pdo, whether to enable PDO support, +[ --enable-pdo=yes Enable PHP Data Objects support (recommended)], yes) if test "$PHP_PDO" != "no"; then if test "$ext_shared" = "yes" ; then diff --git a/ext/pdo_firebird/config.m4 b/ext/pdo_firebird/config.m4 index 8af5e9b6d0..92d2a5d6ef 100644 --- a/ext/pdo_firebird/config.m4 +++ b/ext/pdo_firebird/config.m4 @@ -30,20 +30,23 @@ if test "$PHP_PDO_FIREBIRD" != "no"; then ], [ -L$FIREBIRD_LIBDIR ]) - - if test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then - pdo_inc_path=$prefix/include/php/ext - elif test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then + + AC_MSG_CHECKING([for PDO includes]) + if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$abs_srcdir/ext + elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then pdo_inc_path=$abs_srcdir/ext - elif test -f ext/pdo/php_pdo_driver.h; then - pdo_inc_path=ext + elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$prefix/include/php/ext else - AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) + AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) fi + AC_MSG_RESULT($pdo_inc_path) PHP_ADD_LIBRARY_WITH_PATH($FIREBIRD_LIBNAME, $FIREBIRD_LIBDIR, PDO_FIREBIRD_SHARED_LIBADD) PHP_ADD_INCLUDE($FIREBIRD_INCDIR) AC_DEFINE(HAVE_PDO_FIREBIRD,1,[ ]) PHP_NEW_EXTENSION(pdo_firebird, pdo_firebird.c firebird_driver.c firebird_statement.c, $ext_shared,,-I$pdo_inc_path) PHP_SUBST(PDO_FIREBIRD_SHARED_LIBADD) + PHP_ADD_EXTENSION_DEP(pdo_firebird, pdo) fi diff --git a/ext/pdo_mysql/config.m4 b/ext/pdo_mysql/config.m4 index d9de612ba1..860f10db0e 100755 --- a/ext/pdo_mysql/config.m4 +++ b/ext/pdo_mysql/config.m4 @@ -59,18 +59,20 @@ Note that the MySQL client library is not bundled anymore.]) AC_CHECK_FUNCS([mysql_commit mysql_stmt_prepare]) LDFLAGS=$_SAVE_LDFLAGS - if test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then - pdo_inc_path=$prefix/include/php/ext - elif test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then - pdo_inc_path=$abs_srcdir/ext - elif test -f ext/pdo/php_pdo_driver.h; then - pdo_inc_path=ext + AC_MSG_CHECKING([for PDO includes]) + if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$abs_srcdir/ext + elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$abs_srcdir/ext + elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$prefix/include/php/ext else - AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) + AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) fi + AC_MSG_RESULT($pdo_inc_path) PHP_NEW_EXTENSION(pdo_mysql, pdo_mysql.c mysql_driver.c mysql_statement.c, $ext_shared,,-I$pdo_inc_path) -dnl PHP_ADD_EXTENSION_DEP(pdo_mysql, pdo) + PHP_ADD_EXTENSION_DEP(pdo_mysql, pdo) PDO_MYSQL_MODULE_TYPE=external PDO_MYSQL_INCLUDE=-I$PDO_MYSQL_INC_DIR diff --git a/ext/pdo_oci/config.m4 b/ext/pdo_oci/config.m4 index 043d0cccf2..a3d260e6c0 100755 --- a/ext/pdo_oci/config.m4 +++ b/ext/pdo_oci/config.m4 @@ -160,20 +160,23 @@ You need to tell me where to find your oracle SDK, or set ORACLE_HOME. -L$PDO_OCI_LIB_DIR $PDO_OCI_SHARED_LIBADD ]) - if test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then - pdo_inc_path=$prefix/include/php/ext - elif test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then + AC_MSG_CHECKING([for PDO includes]) + if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$abs_srcdir/ext + elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then pdo_inc_path=$abs_srcdir/ext - elif test -f ext/pdo/php_pdo_driver.h; then - pdo_inc_path=ext + elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$prefix/include/php/ext else - AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) + AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) fi + AC_MSG_RESULT($pdo_inc_path) PHP_NEW_EXTENSION(pdo_oci, pdo_oci.c oci_driver.c oci_statement.c, $ext_shared,,-I$pdo_inc_path) PHP_SUBST_OLD(PDO_OCI_SHARED_LIBADD) PHP_SUBST_OLD(PDO_OCI_DIR) PHP_SUBST_OLD(PDO_OCI_VERSION) + PHP_ADD_EXTENSION_DEP(pdo_oci, pdo) fi diff --git a/ext/pdo_odbc/config.m4 b/ext/pdo_odbc/config.m4 index f7113a9207..bddd7dcd6e 100755 --- a/ext/pdo_odbc/config.m4 +++ b/ext/pdo_odbc/config.m4 @@ -134,8 +134,8 @@ functions required for PDO support. AC_MSG_CHECKING([for PDO includes]) if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then pdo_inc_path=$abs_srcdir/ext - elif test -f ext/pdo/php_pdo_driver.h; then - pdo_inc_path=ext + elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$abs_srcdir/ext elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then pdo_inc_path=$prefix/include/php/ext else @@ -144,6 +144,6 @@ functions required for PDO support. AC_MSG_RESULT($pdo_inc_path) PHP_NEW_EXTENSION(pdo_odbc, pdo_odbc.c odbc_driver.c odbc_stmt.c, $ext_shared,,-I$pdo_inc_path $PDO_ODBC_INCLUDE) -dnl PHP_ADD_EXTENSION_DEP(pdo_odbc, pdo) + PHP_ADD_EXTENSION_DEP(pdo_odbc, pdo) fi diff --git a/ext/pdo_pgsql/config.m4 b/ext/pdo_pgsql/config.m4 index 5aa283c146..8ab436a62f 100644 --- a/ext/pdo_pgsql/config.m4 +++ b/ext/pdo_pgsql/config.m4 @@ -97,17 +97,18 @@ if test "$PHP_PDO_PGSQL" != "no"; then PHP_ADD_INCLUDE($PGSQL_INCLUDE) -dnl find PDO sources - if test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then - pdo_inc_path=$prefix/include/php/ext + AC_MSG_CHECKING([for PDO includes]) + if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$abs_srcdir/ext elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then - pdo_inc_path=$abs_srcdir/ext - elif test -f ext/pdo/php_pdo_driver.h; then - pdo_inc_path=ext + pdo_inc_path=$abs_srcdir/ext + elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$prefix/include/php/ext else - AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) + AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) fi + AC_MSG_RESULT($pdo_inc_path) PHP_NEW_EXTENSION(pdo_pgsql, pdo_pgsql.c pgsql_driver.c pgsql_statement.c, $ext_shared,,-I$pdo_inc_path $PDO_PGSQL_CFLAGS) -dnl PHP_ADD_EXTENSION_DEP(pdo_pgsql, pdo) + PHP_ADD_EXTENSION_DEP(pdo_pgsql, pdo) fi diff --git a/ext/pdo_sqlite/config.m4 b/ext/pdo_sqlite/config.m4 index c5cec4b46c..90e986c0a6 100644 --- a/ext/pdo_sqlite/config.m4 +++ b/ext/pdo_sqlite/config.m4 @@ -3,17 +3,17 @@ dnl config.m4 for extension pdo_sqlite dnl vim:et:sw=2:ts=2: PHP_ARG_WITH(pdo-sqlite, for sqlite 3 driver for PDO, -[ --with-pdo-sqlite Include PDO sqlite 3 support]) +[ --with-pdo-sqlite Include PDO sqlite 3 support],yes) if test "$PHP_PDO_SQLITE" != "no"; then AC_MSG_CHECKING([for PDO includes]) - if test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then - pdo_inc_path=$prefix/include/php/ext - elif test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then - pdo_inc_path=$abs_srcdir/ext - elif test -f ext/pdo/php_pdo_driver.h; then - pdo_inc_path=ext + if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$abs_srcdir/ext + elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$abs_srcdir/ext + elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then + pdo_inc_path=$prefix/include/php/ext else AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) fi @@ -110,5 +110,5 @@ EOF AC_CHECK_HEADERS(time.h) fi -dnl PHP_ADD_EXTENSION_DEP(pdo_sqlite, pdo) + PHP_ADD_EXTENSION_DEP(pdo_sqlite, pdo) fi -- 2.40.0