Skip to content

ext/pgsql: Use PKG_CHECK_MODULES to detect the pq library #4235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

hughmcmaster
Copy link
Contributor

ext/pdo_pgsql can be updatd in the same way.

@krakjoe
Copy link
Member

krakjoe commented Jun 7, 2019

Looks okay to me, as a formality, let's see if tests pass ... build is unaffected whatever ...

@krakjoe
Copy link
Member

krakjoe commented Jun 11, 2019

Merged as 1e26517

Thanks

@krakjoe krakjoe closed this Jun 11, 2019
@remicollet
Copy link
Member

remicollet commented Jun 12, 2019

Sorry bug this one break RHEL / CentOS build which don't have libpq.pc

and the pg_config way is fine and reliable (as, IIUC, the big clean is mostly to avoid tricky directory / file tests)

@krakjoe
Copy link
Member

krakjoe commented Jun 12, 2019

Reverted, thanks @remicollet

@remicollet
Copy link
Member

thanks @krakjoe

@hughmcmaster
Copy link
Contributor Author

@krakjoe, @remicollet, That doesn't sound right at all. libpq.pc appeared in PostgreSQL 9.3.0, which was released in September 2013. How old is your package version on CentOS?

@remicollet
Copy link
Member

@hughmcmaster
Copy link
Contributor Author

hughmcmaster commented Jun 12, 2019

@remicollet, thanks for sharing that link. Given the age of packages on CentOS 7, reverting is fair, although we could easily add pg-config support without most of the other directory search tricks. If we trust the output of pkg-config to be correct, we should trust the output from pg-config as well.

@remicollet
Copy link
Member

IMHO, pg_config should stay the preferred way, as still list first in upstream documentation; btw I agree on cleaning the file search hack.

petk added a commit to petk/php-src that referenced this pull request Jun 11, 2024
The pkg-config (libpq.pc file) was added in PostgreSQL 9.3. This adds a
common setup M4 macro PHP_SETUP_PGSQL to find libpq on the system with
pkg-config. If not found, it falls back to pg_config to find the libpq
library and its headers in common locations as before.

When using pkg-config, the PGSQL_CFLAGS and PGSQL_LIBS environment
variables can override the paths to libpq installation:

    ./configure --with-pgsql --with-pdo-pgsql \
        PGSQL_CFLAGS=-I/path/to/libpq \
        PGSQL_LIBS="-L/path/to/libpq -lpq"

Follow-up of phpGH-4235 (Use PKG_CHECK_MODULES to detect the pq library)
petk added a commit to petk/php-src that referenced this pull request Jun 13, 2024
The pkg-config (libpq.pc file) was added in PostgreSQL 9.3. This adds a
common setup M4 macro PHP_SETUP_PGSQL to find libpq on the system with
pkg-config. If not found, it falls back to pg_config to find the libpq
library and its headers in common locations as before.

When using pkg-config, the PGSQL_CFLAGS and PGSQL_LIBS environment
variables can override the paths to libpq installation:

    ./configure --with-pgsql --with-pdo-pgsql \
        PGSQL_CFLAGS=-I/path/to/libpq \
        PGSQL_LIBS="-L/path/to/libpq -lpq"

Passing manual, non-standard installation paths can be done with option
arguments:

./configure \
  --with-pgsql=/any/path/to/postgresql \
  --with-pdo-postgresql=/any/path/to/postgresql

Follow-up of phpGH-4235 (Use PKG_CHECK_MODULES to detect the pq library)

This also removes the unused HAVE_LIBPQ symbol
petk added a commit to petk/php-src that referenced this pull request Jun 15, 2024
The pkg-config (libpq.pc file) was added in PostgreSQL 9.3. This adds a
common setup M4 macro PHP_SETUP_PGSQL to find libpq on the system with
pkg-config. If not found, it falls back to pg_config to find the libpq
library and its headers in common locations as before.

When using pkg-config, the PGSQL_CFLAGS and PGSQL_LIBS environment
variables can override the paths to libpq installation:

    ./configure --with-pgsql --with-pdo-pgsql \
        PGSQL_CFLAGS=-I/path/to/libpq \
        PGSQL_LIBS="-L/path/to/libpq -lpq"

Passing manual, non-standard installation paths can be done with option
arguments:

./configure \
  --with-pgsql=/any/path/to/postgresql \
  --with-pdo-postgresql=/any/path/to/postgresql

This also removes the unused HAVE_LIBPQ symbol and passing the
PGSQL_INCLUDE environment variable to configure in favor of PGSQL_CFLAGS
and PGSQL_LIBS.

Follow-up of phpGH-4235 (Use PKG_CHECK_MODULES to detect the pq library)
petk added a commit to petk/php-src that referenced this pull request Jun 16, 2024
The pkg-config (libpq.pc file) was added in PostgreSQL 9.3. This adds a
common setup M4 macro PHP_SETUP_PGSQL to find libpq on the system with
pkg-config. If not found, it falls back to pg_config to find the libpq
library and its headers in common locations as before.

When using pkg-config, the PGSQL_CFLAGS and PGSQL_LIBS environment
variables can override the paths to libpq installation:

    ./configure --with-pgsql --with-pdo-pgsql \
        PGSQL_CFLAGS=-I/path/to/libpq \
        PGSQL_LIBS="-L/path/to/libpq -lpq"

Passing manual, non-standard installation paths can be done with option
arguments:

./configure \
  --with-pgsql=/any/path/to/postgresql \
  --with-pdo-postgresql=/any/path/to/postgresql

This also removes the unused HAVE_LIBPQ symbol and passing the
PGSQL_INCLUDE environment variable to configure in favor of PGSQL_CFLAGS
and PGSQL_LIBS.

Follow-up of phpGH-4235 (Use PKG_CHECK_MODULES to detect the pq library)
petk added a commit to petk/php-src that referenced this pull request Jun 17, 2024
The pkg-config (libpq.pc file) was added in PostgreSQL 9.3. This adds a
common setup M4 macro PHP_SETUP_PGSQL to find libpq on the system with
pkg-config. If not found, it falls back to pg_config to find the libpq
library and its headers in common locations as before.

When using pkg-config, the PGSQL_CFLAGS and PGSQL_LIBS environment
variables can override the paths to libpq installation:

    ./configure --with-pgsql --with-pdo-pgsql \
        PGSQL_CFLAGS=-I/path/to/libpq \
        PGSQL_LIBS="-L/path/to/libpq -lpq"

Passing manual, non-standard installation paths can be done with option
arguments:

./configure \
  --with-pgsql=/any/path/to/postgresql \
  --with-pdo-postgresql=/any/path/to/postgresql

This also removes the unused HAVE_LIBPQ symbol and passing the
PGSQL_INCLUDE environment variable to configure in favor of PGSQL_CFLAGS
and PGSQL_LIBS.

Follow-up of phpGH-4235 (Use PKG_CHECK_MODULES to detect the pq library)
petk added a commit to petk/php-src that referenced this pull request Jun 20, 2024
The pkg-config (libpq.pc file) was added in PostgreSQL 9.3. This adds a
common setup M4 macro PHP_SETUP_PGSQL to find libpq on the system with
pkg-config. If not found, it falls back to pg_config to find the libpq
library and its headers in common locations as before.

When using pkg-config, the PGSQL_CFLAGS and PGSQL_LIBS environment
variables can override the paths to libpq installation:

    ./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 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 phpGH-4235 (Use PKG_CHECK_MODULES to detect the pq library)
petk added a commit to petk/php-src that referenced this pull request Jun 20, 2024
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 phpGH-4235 (Use PKG_CHECK_MODULES to detect the pq library)
petk added a commit to petk/php-src that referenced this pull request Jun 21, 2024
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 phpGH-4235 (Use PKG_CHECK_MODULES to detect the pq library)
petk added a commit that referenced this pull request Jun 21, 2024
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants