Skip to content

Autotools: Quote PHP_CHECK_LIBRARY arguments #15136

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

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1868,19 +1868,17 @@ AC_DEFUN([PHP_SETUP_ICONV], [
test -f $ICONV_DIR/$PHP_LIBDIR/lib$iconv_lib_name.$SHLIB_SUFFIX_NAME ||
test -f $ICONV_DIR/$PHP_LIBDIR/lib$iconv_lib_name.tbd
then
PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [
PHP_CHECK_LIBRARY([$iconv_lib_name], [libiconv], [
found_iconv=yes
AC_DEFINE(HAVE_LIBICONV,1,[ ])
AC_DEFINE([ICONV_ALIASED_LIBICONV],1,[iconv() is aliased to libiconv() in -liconv])
], [
PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [
found_iconv=yes
], [], [
-L$ICONV_DIR/$PHP_LIBDIR
])
], [
-L$ICONV_DIR/$PHP_LIBDIR
])
AC_DEFINE([HAVE_LIBICONV], [1], [ ])
AC_DEFINE([ICONV_ALIASED_LIBICONV], [1],
[iconv() is aliased to libiconv() in -liconv])
],
[PHP_CHECK_LIBRARY([$iconv_lib_name], [iconv],
[found_iconv=yes],
[],
[-L$ICONV_DIR/$PHP_LIBDIR])],
[-L$ICONV_DIR/$PHP_LIBDIR])
fi
fi

Expand Down
13 changes: 5 additions & 8 deletions ext/bz2/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,15 @@ if test "$PHP_BZ2" != "no"; then
AC_MSG_ERROR([Please reinstall the BZip2 distribution])
fi

PHP_CHECK_LIBRARY(bz2, BZ2_bzerror,
[
PHP_CHECK_LIBRARY([bz2], [BZ2_bzerror], [
PHP_ADD_INCLUDE([$BZIP_DIR/include])
PHP_ADD_LIBRARY_WITH_PATH([bz2],
[$BZIP_DIR/$PHP_LIBDIR],
[BZ2_SHARED_LIBADD])
AC_DEFINE(HAVE_BZ2,1,[ ])
], [
AC_MSG_ERROR([bz2 module requires libbz2 >= 1.0.0])
], [
-L$BZIP_DIR/$PHP_LIBDIR
])
AC_DEFINE([HAVE_BZ2], [1], [ ])
],
[AC_MSG_ERROR([bz2 module requires libbz2 >= 1.0.0])],
[-L$BZIP_DIR/$PHP_LIBDIR])

PHP_NEW_EXTENSION(bz2, bz2.c bz2_filter.c, $ext_shared)
PHP_SUBST([BZ2_SHARED_LIBADD])
Expand Down
46 changes: 23 additions & 23 deletions ext/dba/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ if test "$PHP_QDBM" != "no"; then

if test -n "$THIS_INCLUDE"; then
for LIB in qdbm; do
PHP_CHECK_LIBRARY($LIB, dpopen, [
AC_DEFINE_UNQUOTED(QDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_QDBM, 1, [ ])
PHP_CHECK_LIBRARY([$LIB], [dpopen], [
AC_DEFINE_UNQUOTED([QDBM_INCLUDE_FILE], ["$THIS_INCLUDE"], [ ])
AC_DEFINE([DBA_QDBM], [1], [ ])
THIS_LIBS=$LIB
], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
if test -n "$THIS_LIBS"; then
Expand Down Expand Up @@ -182,9 +182,9 @@ if test "$PHP_GDBM" != "no"; then
done

if test -n "$THIS_INCLUDE"; then
PHP_CHECK_LIBRARY(gdbm, gdbm_open, [
AC_DEFINE_UNQUOTED(GDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_GDBM, 1, [ ])
PHP_CHECK_LIBRARY([gdbm], [gdbm_open], [
AC_DEFINE_UNQUOTED([GDBM_INCLUDE_FILE], ["$THIS_INCLUDE"], [ ])
AC_DEFINE([DBA_GDBM], [1], [ ])
THIS_LIBS=gdbm
], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
fi
Expand Down Expand Up @@ -212,9 +212,9 @@ if test "$PHP_NDBM" != "no"; then

if test -n "$THIS_INCLUDE"; then
for LIB in ndbm db1 c; do
PHP_CHECK_LIBRARY($LIB, dbm_open, [
AC_DEFINE_UNQUOTED(NDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_NDBM, 1, [ ])
PHP_CHECK_LIBRARY([$LIB], [dbm_open], [
AC_DEFINE_UNQUOTED([NDBM_INCLUDE_FILE], ["$THIS_INCLUDE"], [ ])
AC_DEFINE([DBA_NDBM], [1], [ ])
THIS_LIBS=$LIB
], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
if test -n "$THIS_LIBS"; then
Expand Down Expand Up @@ -243,9 +243,9 @@ if test "$PHP_TCADB" != "no"; then

if test -n "$THIS_INCLUDE"; then
for LIB in tokyocabinet; do
PHP_CHECK_LIBRARY($LIB, tcadbopen, [
AC_DEFINE_UNQUOTED(TCADB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_TCADB, 1, [ ])
PHP_CHECK_LIBRARY([$LIB], [tcadbopen], [
AC_DEFINE_UNQUOTED([TCADB_INCLUDE_FILE], ["$THIS_INCLUDE"], [ ])
AC_DEFINE([DBA_TCADB], [1], [ ])
THIS_LIBS=$LIB
], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
if test -n "$THIS_LIBS"; then
Expand Down Expand Up @@ -274,9 +274,9 @@ if test "$PHP_LMDB" != "no"; then

if test -n "$THIS_INCLUDE"; then
for LIB in lmdb; do
PHP_CHECK_LIBRARY($LIB, mdb_env_open, [
AC_DEFINE_UNQUOTED(LMDB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_LMDB, 1, [ ])
PHP_CHECK_LIBRARY([$LIB], [mdb_env_open], [
AC_DEFINE_UNQUOTED([LMDB_INCLUDE_FILE], ["$THIS_INCLUDE"], [ ])
AC_DEFINE([DBA_LMDB], [1], [ ])
THIS_LIBS=$LIB
], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
if test -n "$THIS_LIBS"; then
Expand Down Expand Up @@ -588,17 +588,17 @@ if test "$PHP_DBM" != "no"; then

if test -n "$THIS_INCLUDE"; then
for LIB in dbm c gdbm; do
PHP_CHECK_LIBRARY($LIB, dbminit, [
PHP_CHECK_LIBRARY([$LIB], [dbminit], [
AC_MSG_CHECKING([for DBM using GDBM])
AC_DEFINE_UNQUOTED(DBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE_UNQUOTED([DBM_INCLUDE_FILE], ["$THIS_INCLUDE"], [ ])
if test "$LIB" = "gdbm"; then
AC_DEFINE_UNQUOTED(DBM_VERSION, "GDBM", [ ])
AC_DEFINE_UNQUOTED([DBM_VERSION], ["GDBM"], [ ])
AC_MSG_RESULT([yes])
else
AC_DEFINE_UNQUOTED(DBM_VERSION, "DBM", [ ])
AC_DEFINE_UNQUOTED([DBM_VERSION], ["DBM"], [ ])
AC_MSG_RESULT([no])
fi
AC_DEFINE(DBA_DBM, 1, [ ])
AC_DEFINE([DBA_DBM], [1], [ ])
THIS_LIBS=$LIB
], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
if test -n "$THIS_LIBS"; then
Expand Down Expand Up @@ -657,9 +657,9 @@ elif test "$PHP_CDB" != "no"; then

if test -n "$THIS_INCLUDE"; then
for LIB in cdb c; do
PHP_CHECK_LIBRARY($LIB, cdb_read, [
AC_DEFINE_UNQUOTED(CDB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_CDB, 1, [ ])
PHP_CHECK_LIBRARY([$LIB], [cdb_read], [
AC_DEFINE_UNQUOTED([CDB_INCLUDE_FILE], ["$THIS_INCLUDE"], [ ])
AC_DEFINE([DBA_CDB], [1], [ ])
THIS_LIBS=$LIB
], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
if test -n "$THIS_LIBS"; then
Expand Down
24 changes: 11 additions & 13 deletions ext/enchant/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@ if test "$PHP_ENCHANT" != "no"; then
PHP_EVAL_INCLINE([$ENCHANT_CFLAGS])
PHP_EVAL_LIBLINE([$ENCHANT_LIBS], [ENCHANT_SHARED_LIBADD])

PHP_CHECK_LIBRARY(enchant, enchant_get_version,
[
AC_DEFINE(HAVE_ENCHANT_GET_VERSION, 1, [ enchant_get_version since 1.6.0 ])
], [ ], [
$ENCHANT_LIBS
])

PHP_CHECK_LIBRARY(enchant, enchant_broker_set_param,
[
AC_DEFINE(HAVE_ENCHANT_BROKER_SET_PARAM, 1, [ enchant_broker_set_param since 1.5.0 and removed in 2.x ])
], [ ], [
$ENCHANT_LIBS
])
PHP_CHECK_LIBRARY([enchant], [enchant_get_version],
[AC_DEFINE([HAVE_ENCHANT_GET_VERSION], [1],
[enchant_get_version since 1.6.0 ])],
[],
[$ENCHANT_LIBS])

PHP_CHECK_LIBRARY([enchant], [enchant_broker_set_param],
[AC_DEFINE([HAVE_ENCHANT_BROKER_SET_PARAM], [1],
[enchant_broker_set_param since 1.5.0 and removed in 2.x])],
[],
[$ENCHANT_LIBS])
fi

AC_DEFINE(HAVE_ENCHANT, 1, [ ])
Expand Down
22 changes: 16 additions & 6 deletions ext/gd/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,18 @@ AC_DEFUN([PHP_GD_CHECK_VERSION],[
PHP_GD_CHECK_FORMAT([Xpm], [HAVE_GD_XPM])
PHP_GD_CHECK_FORMAT([Bmp], [HAVE_GD_BMP])
PHP_GD_CHECK_FORMAT([Tga], [HAVE_GD_TGA])
PHP_CHECK_LIBRARY(gd, gdFontCacheShutdown, [AC_DEFINE(HAVE_GD_FREETYPE, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdVersionString, [AC_DEFINE(HAVE_GD_LIBVERSION, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageGetInterpolationMethod, [AC_DEFINE(HAVE_GD_GET_INTERPOLATION, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY([gd], [gdFontCacheShutdown],
[AC_DEFINE([HAVE_GD_FREETYPE], [1], [ ])],
[],
[$GD_SHARED_LIBADD])
PHP_CHECK_LIBRARY([gd], [gdVersionString],
[AC_DEFINE([HAVE_GD_LIBVERSION], [1], [ ])],
[],
[$GD_SHARED_LIBADD])
PHP_CHECK_LIBRARY([gd], [gdImageGetInterpolationMethod],
[AC_DEFINE([HAVE_GD_GET_INTERPOLATION], [1], [ ])],
[],
[$GD_SHARED_LIBADD])
])

dnl
Expand Down Expand Up @@ -279,9 +288,10 @@ dnl Various checks for GD features

PHP_NEW_EXTENSION([gd], [gd.c $extra_sources], [$ext_shared])
PHP_INSTALL_HEADERS([ext/gd], [php_gd.h])
PHP_CHECK_LIBRARY(gd, gdImageCreate, [], [
AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
], [ $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY([gd], [gdImageCreate],
[],
[AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])],
[$GD_SHARED_LIBADD])
fi

PHP_SUBST([GD_SHARED_LIBADD])
Expand Down
17 changes: 7 additions & 10 deletions ext/gmp/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@ PHP_ARG_WITH([gmp],

if test "$PHP_GMP" != "no"; then
if test "$PHP_GMP" = "yes"; then
PHP_CHECK_LIBRARY(gmp, __gmpz_rootrem,
[],[
AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])
])
PHP_CHECK_LIBRARY([gmp], [__gmpz_rootrem],
[],
[AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])])

PHP_ADD_LIBRARY([gmp],, [GMP_SHARED_LIBADD])
else
if test ! -f $PHP_GMP/include/gmp.h; then
AC_MSG_ERROR([Unable to locate gmp.h])
fi

PHP_CHECK_LIBRARY(gmp, __gmpz_rootrem,
[],[
AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])
],[
-L$PHP_GMP/$PHP_LIBDIR
])
PHP_CHECK_LIBRARY([gmp], [__gmpz_rootrem],
[],
[AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])],
[-L$PHP_GMP/$PHP_LIBDIR])

PHP_ADD_LIBRARY_WITH_PATH([gmp],
[$PHP_GMP/$PHP_LIBDIR],
Expand Down
7 changes: 3 additions & 4 deletions ext/pdo_dblib/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ if test "$PHP_PDO_DBLIB" != "no"; then
if test "$PHP_PDO_DBLIB" = "yes"; then
dnl FreeTDS must be on the default system include/library path.
dnl Only perform a sanity check that this is really the case.
PHP_CHECK_LIBRARY(sybdb, dbsqlexec,
[],[
AC_MSG_ERROR([Cannot find FreeTDS in known installation directories])
])
PHP_CHECK_LIBRARY([sybdb], [dbsqlexec],
[],
[AC_MSG_ERROR([Cannot find FreeTDS in known installation directories])])
PHP_ADD_LIBRARY([sybdb],, [PDO_DBLIB_SHARED_LIBADD])
elif test "$PHP_PDO_DBLIB" != "no"; then

Expand Down
32 changes: 10 additions & 22 deletions ext/pdo_firebird/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,16 @@ if test "$PHP_PDO_FIREBIRD" != "no"; then
FIREBIRD_LIBDIR_FLAG=-L$FIREBIRD_LIBDIR
fi

PHP_CHECK_LIBRARY(fbclient, isc_detach_database,
[
FIREBIRD_LIBNAME=fbclient
], [
PHP_CHECK_LIBRARY(gds, isc_detach_database,
[
FIREBIRD_LIBNAME=gds
], [
PHP_CHECK_LIBRARY(ib_util, isc_detach_database,
[
FIREBIRD_LIBNAME=ib_util
], [
AC_MSG_ERROR([libfbclient, libgds or libib_util not found! Check config.log for more information.])
], [
$FIREBIRD_LIBDIR_FLAG
])
], [
$FIREBIRD_LIBDIR_FLAG
])
], [
$FIREBIRD_LIBDIR_FLAG
])
PHP_CHECK_LIBRARY([fbclient], [isc_detach_database],
[FIREBIRD_LIBNAME=fbclient],
[PHP_CHECK_LIBRARY([gds], [isc_detach_database],
[FIREBIRD_LIBNAME=gds],
[PHP_CHECK_LIBRARY([ib_util], [isc_detach_database],
[FIREBIRD_LIBNAME=ib_util],
[AC_MSG_ERROR([libfbclient, libgds or libib_util not found! Check config.log for more information.])],
[$FIREBIRD_LIBDIR_FLAG])],
[$FIREBIRD_LIBDIR_FLAG])],
[$FIREBIRD_LIBDIR_FLAG])
PHP_ADD_LIBRARY_WITH_PATH([$FIREBIRD_LIBNAME],
[$FIREBIRD_LIBDIR],
[PDO_FIREBIRD_SHARED_LIBADD])
Expand Down
23 changes: 11 additions & 12 deletions ext/pdo_odbc/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,21 @@ if test "$PHP_PDO_ODBC" != "no"; then
PDO_ODBC_CFLAGS="$pdo_odbc_def_cflags -I$PDO_ODBC_INCDIR"
PDO_ODBC_LIBS="$pdo_odbc_def_ldflags -L$PDO_ODBC_LIBDIR -l$pdo_odbc_def_lib"

dnl Check first for an ODBC 1.0 function to assert that the libraries work
PHP_CHECK_LIBRARY($pdo_odbc_def_lib, SQLBindCol,
[
dnl And now check for an ODBC 3.0 function to assert that they're *good*
dnl libraries.
PHP_CHECK_LIBRARY($pdo_odbc_def_lib, SQLAllocHandle,
[], [
AC_MSG_ERROR([
dnl Check first for an ODBC 1.0 function to assert that the libraries work,
dnl and then check for an ODBC 3.0 function to assert that they are *good*
dnl libraries.
PHP_CHECK_LIBRARY([$pdo_odbc_def_lib], [SQLBindCol],
[PHP_CHECK_LIBRARY([$pdo_odbc_def_lib], [SQLAllocHandle],
[],
[AC_MSG_ERROR([
Your ODBC library does not appear to be ODBC 3 compatible.
You should consider using iODBC or unixODBC instead, and loading your
libraries as a driver in that environment; it will emulate the
functions required for PDO support.
])], $PDO_ODBC_LIBS)
],[
AC_MSG_ERROR([Your ODBC library does not exist or there was an error. Check config.log for more information])
], $PDO_ODBC_LIBS)
])],
[$PDO_ODBC_LIBS])],
[AC_MSG_ERROR([Your ODBC library does not exist or there was an error. Check config.log for more information])],
[$PDO_ODBC_LIBS])
fi

PHP_EVAL_INCLINE([$PDO_ODBC_CFLAGS])
Expand Down
23 changes: 13 additions & 10 deletions ext/pdo_sqlite/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@ if test "$PHP_PDO_SQLITE" != "no"; then

PHP_SETUP_SQLITE([PDO_SQLITE_SHARED_LIBADD])

PHP_CHECK_LIBRARY(sqlite3, sqlite3_close_v2, [
AC_DEFINE(HAVE_SQLITE3_CLOSE_V2, 1, [have sqlite3_close_v2])
], [], [$PDO_SQLITE_SHARED_LIBADD])
PHP_CHECK_LIBRARY([sqlite3], [sqlite3_close_v2],
[AC_DEFINE([HAVE_SQLITE3_CLOSE_V2], [1], [have sqlite3_close_v2])],
[],
[$PDO_SQLITE_SHARED_LIBADD])

PHP_CHECK_LIBRARY(sqlite3, sqlite3_column_table_name, [
AC_DEFINE(HAVE_SQLITE3_COLUMN_TABLE_NAME, 1, [have sqlite3_column_table_name])
], [], [$PDO_SQLITE_SHARED_LIBADD])
PHP_CHECK_LIBRARY([sqlite3], [sqlite3_column_table_name],
[AC_DEFINE([HAVE_SQLITE3_COLUMN_TABLE_NAME], [1],
[have sqlite3_column_table_name])],
[],
[$PDO_SQLITE_SHARED_LIBADD])

PHP_CHECK_LIBRARY(sqlite3, sqlite3_load_extension,
PHP_CHECK_LIBRARY([sqlite3], [sqlite3_load_extension],
[],
[AC_DEFINE(PDO_SQLITE_OMIT_LOAD_EXTENSION, 1, [have sqlite3 with extension support])],
[$PDO_SQLITE_SHARED_LIBADD]
)
[AC_DEFINE([PDO_SQLITE_OMIT_LOAD_EXTENSION], [1],
[have sqlite3 with extension support])],
[$PDO_SQLITE_SHARED_LIBADD])

PHP_SUBST([PDO_SQLITE_SHARED_LIBADD])
PHP_NEW_EXTENSION(pdo_sqlite, pdo_sqlite.c sqlite_driver.c sqlite_statement.c sqlite_sql_parser.c,
Expand Down
Loading
Loading