From 47fe4125189833e80eac8c09f7d1cf83b10aeb0d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 14 Dec 2020 10:17:57 +0100 Subject: [PATCH] Allow building dblib with machine-dependent libdir Use the same approach as for GMP: If no explicit directory is given, assume it must be on the default include path and libdir. Otherwise use the provided path. It does not look like libsybdb has support for pkg-config. --- ext/pdo_dblib/config.m4 | 42 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/ext/pdo_dblib/config.m4 b/ext/pdo_dblib/config.m4 index b6cbc01a5a..4160cd9596 100644 --- a/ext/pdo_dblib/config.m4 +++ b/ext/pdo_dblib/config.m4 @@ -10,23 +10,13 @@ if test "$PHP_PDO_DBLIB" != "no"; then fi if test "$PHP_PDO_DBLIB" = "yes"; then - - for i in /usr/local /usr; do - if test -f $i/include/sybdb.h; then - PDO_FREETDS_INSTALLATION_DIR=$i - PDO_FREETDS_INCLUDE_DIR=$i/include - break - elif test -f $i/include/freetds/sybdb.h; then - PDO_FREETDS_INSTALLATION_DIR=$i - PDO_FREETDS_INCLUDE_DIR=$i/include/freetds - break; - fi - done - - if test -z "$PDO_FREETDS_INSTALLATION_DIR"; then - AC_MSG_ERROR(Cannot find FreeTDS in known installation directories) - fi - + 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_ADD_LIBRARY(sybdb,,GMP_SHARED_LIBADD) elif test "$PHP_PDO_DBLIB" != "no"; then if test -f $PHP_PDO_DBLIB/include/sybdb.h; then @@ -38,18 +28,18 @@ if test "$PHP_PDO_DBLIB" != "no"; then else AC_MSG_ERROR(Directory $PHP_PDO_DBLIB is not a FreeTDS installation directory) fi - fi - if test "x$PHP_LIBDIR" = "x" ; then - PHP_LIBDIR=lib - fi + if test "x$PHP_LIBDIR" = "x" ; then + PHP_LIBDIR=lib + fi - if test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a" && test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so"; then - AC_MSG_ERROR(Could not find $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so]) - fi + if test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a" && test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so"; then + AC_MSG_ERROR(Could not find $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so]) + fi - PHP_ADD_INCLUDE($PDO_FREETDS_INCLUDE_DIR) - PHP_ADD_LIBRARY_WITH_PATH(sybdb, $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR, PDO_DBLIB_SHARED_LIBADD) + PHP_ADD_INCLUDE($PDO_FREETDS_INCLUDE_DIR) + PHP_ADD_LIBRARY_WITH_PATH(sybdb, $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR, PDO_DBLIB_SHARED_LIBADD) + fi PHP_CHECK_PDO_INCLUDES -- 2.40.0