Skip to content

Commit 47fe412

Browse files
committed
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.
1 parent aa58db7 commit 47fe412

File tree

1 file changed

+16
-26
lines changed

1 file changed

+16
-26
lines changed

ext/pdo_dblib/config.m4

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,13 @@ if test "$PHP_PDO_DBLIB" != "no"; then
1010
fi
1111

1212
if test "$PHP_PDO_DBLIB" = "yes"; then
13-
14-
for i in /usr/local /usr; do
15-
if test -f $i/include/sybdb.h; then
16-
PDO_FREETDS_INSTALLATION_DIR=$i
17-
PDO_FREETDS_INCLUDE_DIR=$i/include
18-
break
19-
elif test -f $i/include/freetds/sybdb.h; then
20-
PDO_FREETDS_INSTALLATION_DIR=$i
21-
PDO_FREETDS_INCLUDE_DIR=$i/include/freetds
22-
break;
23-
fi
24-
done
25-
26-
if test -z "$PDO_FREETDS_INSTALLATION_DIR"; then
27-
AC_MSG_ERROR(Cannot find FreeTDS in known installation directories)
28-
fi
29-
13+
dnl FreeTDS must be on the default system include/library path.
14+
dnl Only perform a sanity check that this is really the case.
15+
PHP_CHECK_LIBRARY(sybdb, dbsqlexec,
16+
[],[
17+
AC_MSG_ERROR([Cannot find FreeTDS in known installation directories])
18+
])
19+
PHP_ADD_LIBRARY(sybdb,,GMP_SHARED_LIBADD)
3020
elif test "$PHP_PDO_DBLIB" != "no"; then
3121

3222
if test -f $PHP_PDO_DBLIB/include/sybdb.h; then
@@ -38,18 +28,18 @@ if test "$PHP_PDO_DBLIB" != "no"; then
3828
else
3929
AC_MSG_ERROR(Directory $PHP_PDO_DBLIB is not a FreeTDS installation directory)
4030
fi
41-
fi
4231

43-
if test "x$PHP_LIBDIR" = "x" ; then
44-
PHP_LIBDIR=lib
45-
fi
32+
if test "x$PHP_LIBDIR" = "x" ; then
33+
PHP_LIBDIR=lib
34+
fi
4635

47-
if test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a" && test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so"; then
48-
AC_MSG_ERROR(Could not find $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so])
49-
fi
36+
if test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a" && test ! -r "$PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so"; then
37+
AC_MSG_ERROR(Could not find $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so])
38+
fi
5039

51-
PHP_ADD_INCLUDE($PDO_FREETDS_INCLUDE_DIR)
52-
PHP_ADD_LIBRARY_WITH_PATH(sybdb, $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR, PDO_DBLIB_SHARED_LIBADD)
40+
PHP_ADD_INCLUDE($PDO_FREETDS_INCLUDE_DIR)
41+
PHP_ADD_LIBRARY_WITH_PATH(sybdb, $PDO_FREETDS_INSTALLATION_DIR/$PHP_LIBDIR, PDO_DBLIB_SHARED_LIBADD)
42+
fi
5343

5444
PHP_CHECK_PDO_INCLUDES
5545

0 commit comments

Comments
 (0)