mirror of
https://github.com/php/php-src.git
synced 2026-04-29 19:23:22 +02:00
f4ce50ddfb
The pkg-config (libpq.pc file) was added in PostgreSQL 9.3. This adds a
common setup M4 macro PHP_SETUP_PGSQL to find client PostgreSQL library
libpq on the system with pkg-config. If not found, check falls back to
pg_config to find the libpq and its headers in common locations as
before.
The PGSQL_CFLAGS and PGSQL_LIBS environment variables can override the
libpq installation paths:
./configure --with-pgsql --with-pdo-pgsql \
PGSQL_CFLAGS=-I/path/to/libpq \
PGSQL_LIBS="-L/path/to/libpq -lpq"
Passing manual, non-standard PostgreSQL installation path can be done
with configure option arguments:
./configure \
--with-pgsql=/any/path/to/postgresql \
--with-pdo-postgresql=/any/path/to/postgresql
If this DIR argument (PostgreSQL installation directory or path to the
pg_config) is passed, it takes precedence over the pkg-config, when
installed on the system.
This also removes the unused HAVE_LIBPQ symbol and passing the
PGSQL_INCLUDE and PGSQL_LIBDIR environment variable to configure in
favor of PGSQL_CFLAGS and PGSQL_LIBS.
Instead of the obsolete backticks the recommended $(...) is used when
invoking the pg_config.
Follow-up of GH-4235 (Use PKG_CHECK_MODULES to detect the pq library)
29 lines
1.1 KiB
Plaintext
29 lines
1.1 KiB
Plaintext
PHP_ARG_WITH([pdo-pgsql],
|
|
[for PostgreSQL support for PDO],
|
|
[AS_HELP_STRING([[--with-pdo-pgsql[=DIR]]],
|
|
[PDO: PostgreSQL support. Optional DIR is the PostgreSQL base install
|
|
directory or the path to pg_config. Also, the PGSQL_CFLAGS and PGSQL_LIBS
|
|
environment variables can be used instead of the DIR argument to customize
|
|
the libpq paths.])])
|
|
|
|
if test "$PHP_PDO_PGSQL" != "no"; then
|
|
if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
|
|
AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
|
|
fi
|
|
|
|
PHP_SETUP_PGSQL([PDO_PGSQL_SHARED_LIBADD],,, [$PHP_PDO_PGSQL])
|
|
PHP_SUBST([PDO_PGSQL_SHARED_LIBADD])
|
|
|
|
AC_DEFINE(HAVE_PDO_PGSQL,1,[Whether to build PostgreSQL for PDO support or not])
|
|
|
|
PHP_CHECK_LIBRARY([pq], [PQresultMemorySize],
|
|
[AC_DEFINE([HAVE_PG_RESULT_MEMORY_SIZE], [1], [PostgreSQL 12 or later])],,
|
|
[$PGSQL_LIBS])
|
|
|
|
PHP_CHECK_PDO_INCLUDES
|
|
|
|
PHP_NEW_EXTENSION(pdo_pgsql, pdo_pgsql.c pgsql_driver.c pgsql_statement.c pgsql_sql_parser.c, $ext_shared)
|
|
PHP_ADD_EXTENSION_DEP(pdo_pgsql, pdo)
|
|
PHP_ADD_MAKEFILE_FRAGMENT
|
|
fi
|