Skip to content

Commit c823689

Browse files
committed
Correctly check for pkg-config
It is a tool, and needs the correct prefix for cross-compiling. Also, if $PKG_CONFIG is set, either by the user or AC_PATh_TOOL, we can consider it will be executable. A bare "test -x" is not enough for package managers which set $PKG_CONFIG to <prefix>-pkg-config (not absolute). Signed-off-by: Quentin Glidic <[email protected]>
1 parent ded69ee commit c823689

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

acinclude.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,11 +2329,11 @@ AC_DEFUN([PHP_SETUP_OPENSSL],[
23292329
23302330
dnl First try to find pkg-config
23312331
if test -z "$PKG_CONFIG"; then
2332-
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2332+
AC_PATH_TOOL(PKG_CONFIG, pkg-config)
23332333
fi
23342334
23352335
dnl If pkg-config is found try using it
2336-
if test "$PHP_OPENSSL_DIR" = "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
2336+
if test "$PHP_OPENSSL_DIR" = "yes" && test -n "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
23372337
if $PKG_CONFIG --atleast-version=0.9.8 openssl; then
23382338
found_openssl=yes
23392339
OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`

ext/odbc/config.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,9 @@ PHP_ARG_WITH(iodbc,,
393393
AC_MSG_CHECKING(for iODBC support)
394394
if test "$PHP_IODBC" != "no"; then
395395
if test -z "$PKG_CONFIG"; then
396-
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
396+
AC_PATH_TOOL(PKG_CONFIG, pkg-config)
397397
fi
398-
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libiodbc ; then
398+
if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists libiodbc ; then
399399
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
400400
ODBC_TYPE=iodbc
401401
ODBC_INCLUDE=`$PKG_CONFIG --cflags-only-I libiodbc`

ext/pdo_pgsql/config.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ if test "$PHP_PDO_PGSQL" != "no"; then
7373
if test $? -eq 0 ; then
7474
AC_MSG_RESULT([yes])
7575
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
76+
AC_PATH_TOOL(PKG_CONFIG, pkg-config)
77+
if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
7878
PDO_PGSQL_CFLAGS=`$PKG_CONFIG openssl --cflags`
7979
fi
8080
else

ext/zip/config.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if test "$PHP_ZIP" != "no"; then
5353

5454
if test "$PHP_LIBZIP" != "no"; then
5555

56-
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
56+
AC_PATH_TOOL(PKG_CONFIG, pkg-config)
5757

5858
dnl system libzip, depends on libzip
5959
AC_MSG_CHECKING(for libzip)
@@ -62,7 +62,7 @@ if test "$PHP_ZIP" != "no"; then
6262
LIBZIP_LIBDIR="$PHP_LIBZIP/$PHP_LIBDIR"
6363
AC_MSG_RESULT(from option: found in $PHP_LIBZIP)
6464

65-
elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libzip; then
65+
elif test -n "$PKG_CONFIG" && $PKG_CONFIG --exists libzip; then
6666
if $PKG_CONFIG libzip --atleast-version 0.11; then
6767
LIBZIP_CFLAGS=`$PKG_CONFIG libzip --cflags`
6868
LIBZIP_LIBDIR=`$PKG_CONFIG libzip --variable=libdir`

sapi/fpm/config.m4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,20 +588,20 @@ if test "$PHP_FPM" != "no"; then
588588

589589
if test "$PHP_FPM_SYSTEMD" != "no" ; then
590590
if test -z "$PKG_CONFIG"; then
591-
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
591+
AC_PATH_TOOL(PKG_CONFIG, pkg-config)
592592
fi
593593
unset SYSTEMD_LIBS
594594
unset SYSTEMD_INCS
595595

596-
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd; then
596+
if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd; then
597597
dnl systemd version >= 209 provides libsystemd
598598
AC_MSG_CHECKING([for libsystemd])
599599
SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd`
600600
SYSTEMD_INCS=`$PKG_CONFIG --cflags-only-I libsystemd`
601601
SYSTEMD_VERS=`$PKG_CONFIG --modversion libsystemd`
602602
AC_MSG_RESULT([version $SYSTEMD_VERS])
603603

604-
elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd-daemon; then
604+
elif test -n "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd-daemon; then
605605
dnl systemd version < 209 provides libsystemd-daemon
606606
AC_MSG_CHECKING([for libsystemd-daemon])
607607
SYSTEMD_LIBS=`$PKG_CONFIG --libs libsystemd-daemon`

0 commit comments

Comments
 (0)