Annotation of embedaddon/php/ext/pdo_pgsql/config.m4, revision 1.1

1.1     ! misho       1: dnl $Id: config.m4 311041 2011-05-15 05:49:34Z rasmus $
        !             2: dnl config.m4 for extension pdo_pgsql
        !             3: dnl vim:et:sw=2:ts=2:
        !             4: 
        !             5: PHP_ARG_WITH(pdo-pgsql,for PostgreSQL support for PDO,
        !             6: [  --with-pdo-pgsql[=DIR]    PDO: PostgreSQL support.  DIR is the PostgreSQL base
        !             7:                             install directory or the path to pg_config])
        !             8: 
        !             9: if test "$PHP_PDO_PGSQL" != "no"; then
        !            10: 
        !            11:   if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
        !            12:     AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
        !            13:   fi
        !            14: 
        !            15:   PHP_EXPAND_PATH($PGSQL_INCLUDE, PGSQL_INCLUDE)
        !            16: 
        !            17:   AC_MSG_CHECKING(for pg_config)
        !            18:   for i in $PHP_PDO_PGSQL $PHP_PDO_PGSQL/bin /usr/local/pgsql/bin /usr/local/bin /usr/bin ""; do
        !            19:     if test -x $i/pg_config; then
        !            20:       PG_CONFIG="$i/pg_config"
        !            21:       break;
        !            22:     fi
        !            23:   done
        !            24: 
        !            25:   if test -n "$PG_CONFIG"; then
        !            26:     AC_MSG_RESULT([$PG_CONFIG])
        !            27:     PGSQL_INCLUDE=`$PG_CONFIG --includedir`
        !            28:     PGSQL_LIBDIR=`$PG_CONFIG --libdir`
        !            29:     AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h])
        !            30:   else
        !            31:     AC_MSG_RESULT(not found)
        !            32:     if test "$PHP_PDO_PGSQL" = "yes"; then
        !            33:       PGSQL_SEARCH_PATHS="/usr /usr/local /usr/local/pgsql"
        !            34:     else
        !            35:       PGSQL_SEARCH_PATHS=$PHP_PDO_PGSQL
        !            36:     fi
        !            37:   
        !            38:     for i in $PGSQL_SEARCH_PATHS; do
        !            39:       for j in include include/pgsql include/postgres include/postgresql ""; do
        !            40:         if test -r "$i/$j/libpq-fe.h"; then
        !            41:           PGSQL_INC_BASE=$i
        !            42:           PGSQL_INCLUDE=$i/$j
        !            43:           if test -r "$i/$j/pg_config.h"; then
        !            44:             AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h])
        !            45:           fi
        !            46:         fi
        !            47:       done
        !            48: 
        !            49:       for j in $PHP_LIBDIR $PHP_LIBDIR/pgsql $PHP_LIBDIR/postgres $PHP_LIBDIR/postgresql ""; do
        !            50:         if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then 
        !            51:           PGSQL_LIBDIR=$i/$j
        !            52:         fi
        !            53:       done
        !            54:     done
        !            55:   fi
        !            56: 
        !            57:   if test -z "$PGSQL_INCLUDE"; then
        !            58:     AC_MSG_ERROR(Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path)
        !            59:   fi
        !            60: 
        !            61:   if test -z "$PGSQL_LIBDIR"; then
        !            62:     AC_MSG_ERROR(Cannot find libpq.so. Please specify correct PostgreSQL installation path)
        !            63:   fi
        !            64: 
        !            65:   if test -z "$PGSQL_INCLUDE" -a -z "$PGSQL_LIBDIR" ; then
        !            66:     AC_MSG_ERROR([Unable to find libpq anywhere under $PGSQL_SEARCH_PATHS])
        !            67:   fi
        !            68: 
        !            69:   AC_DEFINE(HAVE_PDO_PGSQL,1,[Whether to build PostgreSQL for PDO support or not])
        !            70: 
        !            71:   AC_MSG_CHECKING([for openssl dependencies])
        !            72:   grep openssl $PGSQL_INCLUDE/libpq-fe.h >/dev/null 2>&1
        !            73:   if test $? -eq 0 ; then
        !            74:     AC_MSG_RESULT([yes])
        !            75:     dnl First try to find pkg-config
        !            76:     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
        !            77:     if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
        !            78:       PDO_PGSQL_CFLAGS=`$PKG_CONFIG openssl --cflags`
        !            79:     fi
        !            80:   else
        !            81:     AC_MSG_RESULT([no])
        !            82:   fi
        !            83: 
        !            84:   old_LIBS=$LIBS
        !            85:   old_LDFLAGS=$LDFLAGS
        !            86:   LDFLAGS="-L$PGSQL_LIBDIR $LDFLAGS"
        !            87:   AC_CHECK_LIB(pq, PQparameterStatus,AC_DEFINE(HAVE_PQPARAMETERSTATUS,1,[PostgreSQL 7.4 or later]), [
        !            88:     echo "Unable to build the PDO PostgreSQL driver: libpq 7.4+ is required"
        !            89:     exit 1
        !            90:   ])
        !            91: 
        !            92:   AC_CHECK_LIB(pq, PQprepare,AC_DEFINE(HAVE_PQPREPARE,1,[PostgreSQL 8.0 or later]))
        !            93:   AC_CHECK_LIB(pq, PQescapeStringConn, AC_DEFINE(HAVE_PQESCAPE_CONN,1,[PostgreSQL 8.1.4 or later]))
        !            94:   AC_CHECK_LIB(pq, PQescapeByteaConn, AC_DEFINE(HAVE_PQESCAPE_BYTEA_CONN,1,[PostgreSQL 8.1.4 or later]))
        !            95: 
        !            96:   AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibyte]))
        !            97:   
        !            98: 
        !            99:   LIBS=$old_LIBS
        !           100:   LDFLAGS=$old_LDFLAGS
        !           101: 
        !           102:   PHP_ADD_LIBRARY_WITH_PATH(pq, $PGSQL_LIBDIR, PDO_PGSQL_SHARED_LIBADD)
        !           103:   PHP_SUBST(PDO_PGSQL_SHARED_LIBADD)
        !           104: 
        !           105:   PHP_ADD_INCLUDE($PGSQL_INCLUDE)
        !           106: 
        !           107:   ifdef([PHP_CHECK_PDO_INCLUDES],
        !           108:   [
        !           109:     PHP_CHECK_PDO_INCLUDES
        !           110:   ],[
        !           111:     AC_MSG_CHECKING([for PDO includes])
        !           112:     if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
        !           113:       pdo_inc_path=$abs_srcdir/ext
        !           114:     elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
        !           115:       pdo_inc_path=$abs_srcdir/ext
        !           116:     elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
        !           117:       pdo_inc_path=$prefix/include/php/ext
        !           118:     else
        !           119:       AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
        !           120:     fi
        !           121:     AC_MSG_RESULT($pdo_inc_path)
        !           122:   ])
        !           123: 
        !           124:   PHP_NEW_EXTENSION(pdo_pgsql, pdo_pgsql.c pgsql_driver.c pgsql_statement.c, $ext_shared,,-I$pdo_inc_path $PDO_PGSQL_CFLAGS)
        !           125:   ifdef([PHP_ADD_EXTENSION_DEP],
        !           126:   [
        !           127:     PHP_ADD_EXTENSION_DEP(pdo_pgsql, pdo) 
        !           128:   ])
        !           129: fi

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>