-
Notifications
You must be signed in to change notification settings - Fork 27
Cleanup autotools scripts #29
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,125 +1,82 @@ | ||
dnl $Id$ | ||
dnl config.m4 for extension ibm_db2 | ||
|
||
dnl Comments in this file start with the string 'dnl'. | ||
dnl Remove where necessary. This file will not work | ||
dnl without editing. | ||
|
||
dnl If your extension references something external, use with: | ||
|
||
PHP_ARG_WITH(IBM_DB2, for IBM_DB2 support, | ||
[ --with-IBM_DB2=[DIR] Include IBM DB2 Universal Database and Cloudscape support. | ||
DIR is the location of the DB2 application development | ||
headers and libraries. Set the PHP_IBM_DB2_LIB | ||
environment variable to set the specific location of | ||
the DB2 libraries]) | ||
|
||
dnl PHP_ARG_ENABLE(IBM_DB2, whether to enable IBM_DB2 support, | ||
dnl Make sure that the comment is aligned: | ||
dnl [ --enable-IBM_DB2 Enable IBM_DB2 support]) | ||
if test "$PHP_IBM_DB2" != "no"; then | ||
dnl # checking php 32/64 bit php | ||
AC_MSG_CHECKING(PHP) | ||
if test `php -r 'echo PHP_INT_SIZE;'` = 8; then | ||
machine_bits=64 | ||
libDir=lib64 | ||
AC_MSG_RESULT(Detected 64-bit PHP) | ||
else | ||
machine_bits=32 | ||
libDir=lib32 | ||
AC_MSG_RESULT(Detected 32-bit PHP) | ||
fi | ||
AC_MSG_CHECKING(IBM_DB_HOME location) | ||
if test $IBM_DB_HOME ; then | ||
SEARCH_PATH=$IBM_DB_HOME | ||
AC_MSG_RESULT($IBM_DB_HOME) | ||
else | ||
AC_MSG_RESULT(not found) | ||
fi | ||
dnl # --with-IBM_DB2 -> check with-path | ||
SEARCH_PATH="$PHP_IBM_DB2_LIB $SEARCH_PATH $PHP_IBM_DB2 $DB2PATH $DB2DIR" | ||
SEARCH_PATH="$PHP_IBM_DB2_LIB $SEARCH_PATH $PHP_IBM_DB2 $IBM_DB_HOME $DB2PATH $DB2DIR" | ||
|
||
AC_MSG_CHECKING(Looking for DB2 CLI libraries) | ||
dnl Scan the library path for LUW, clidriver, and libdb400 in the usual | ||
dnl places, also assuming include/ is in the directory too. | ||
for i in $SEARCH_PATH ; do | ||
AC_MSG_CHECKING([ in $i]) | ||
if test -r $i/libdb2.so || test -r $i/libdb2.a || test -r $i/libdb400.a || test -r $i/libdb2.dylib ; then | ||
LIB_DIR="$i/" | ||
AC_MSG_RESULT(found) | ||
dnl XXX: The messages kinda suck and don't indicate which path | ||
dnl (combined with AC_MSG_* spew from AC_CHECK_LIB) | ||
dnl XXX: Macros for this? Can these be merged? | ||
|
||
dnl LUW ships its client libraries in lib64/32 (at least on amd64 linux) | ||
AC_CHECK_SIZEOF([long]) | ||
AC_MSG_CHECKING([if we're on a 64-bit platform]) | ||
AS_IF([test "$ac_cv_sizeof_long" -eq 4],[ | ||
AC_MSG_RESULT([no]) | ||
PHP_CHECK_LIBRARY(db2, SQLDriverConnect, [ | ||
PHP_ADD_LIBPATH($i/lib32, IBM_DB2_SHARED_LIBADD) | ||
PHP_ADD_LIBRARY(db2, 1, IBM_DB2_SHARED_LIBADD) | ||
PHP_ADD_INCLUDE($i/include) | ||
break | ||
], [], "-L$i/lib32" ) | ||
],[ | ||
AC_MSG_RESULT([yes]) | ||
PHP_CHECK_LIBRARY(db2, SQLDriverConnect, [ | ||
PHP_ADD_LIBPATH($i/lib64, IBM_DB2_SHARED_LIBADD) | ||
PHP_ADD_LIBRARY(db2, 1, IBM_DB2_SHARED_LIBADD) | ||
PHP_ADD_INCLUDE($i/include) | ||
break | ||
], [], "-L$i/lib64" ) | ||
]) | ||
dnl The standalone clidriver package uses lib/ | ||
PHP_CHECK_LIBRARY(db2, SQLDriverConnect, [ | ||
PHP_ADD_LIBPATH($i/lib, IBM_DB2_SHARED_LIBADD) | ||
PHP_ADD_LIBRARY(db2, 1, IBM_DB2_SHARED_LIBADD) | ||
PHP_ADD_INCLUDE($i/include) | ||
break | ||
else | ||
AC_MSG_RESULT() | ||
fi | ||
AC_MSG_CHECKING([ in $i/$libDir]) | ||
if test -r $i/$libDir/libdb2.so || test -r $i/$libDir/libdb2.a || test -r $i/$libDir/libdb400.a || test -r $i/$libDir/libdb2.dylib ; then | ||
LIB_DIR="$i/$libDir/" | ||
AC_MSG_RESULT(found) | ||
], [ | ||
], "-L$i/lib" ) | ||
dnl Special cases for PASE | ||
dnl SG ships a custom libdb400 (with renamed funcs to co-exist w/ ODBC) | ||
dnl it requires some special handling for headers too | ||
PHP_CHECK_LIBRARY(db400sg, LDBDriverConnect, [ | ||
IBM_DB2_PASE=yes | ||
dnl from RPMs libdb400sg-devel and sqlcli-devel | ||
dnl as IBM i doesn't ship SQL/CLI headers w/ PASE (and RPM's in subdir) | ||
PHP_ADD_LIBPATH($i/lib, IBM_DB2_SHARED_LIBADD) | ||
PHP_ADD_LIBRARY(db400sg, 1, IBM_DB2_SHARED_LIBADD) | ||
PHP_ADD_INCLUDE(/QOpenSys/pkgs/include/cli-sg) | ||
PHP_ADD_INCLUDE(/QOpenSys/pkgs/include/cli) | ||
break | ||
else | ||
AC_MSG_RESULT() | ||
fi | ||
AC_MSG_CHECKING([ in $i/lib]) | ||
if test -r $i/lib/libdb2.so || test -r $i/lib/libdb2.a || test -r $i/lib/libdb400.a || test -r $i/lib/libdb2.dylib ; then | ||
LIB_DIR="$i/lib/" | ||
AC_MSG_RESULT(found) | ||
], [ | ||
], "-L$i/lib" ) | ||
dnl Probably vanilla libdb400 | ||
dnl XXX: For PASE, libdb400 is likely on the default path | ||
PHP_CHECK_LIBRARY(db400, SQLDriverConnect, [ | ||
IBM_DB2_PASE=yes | ||
dnl from RPM sqlcli-devel | ||
PHP_ADD_LIBPATH($i/lib, IBM_DB2_SHARED_LIBADD) | ||
PHP_ADD_LIBRARY(db400, 1, IBM_DB2_SHARED_LIBADD) | ||
PHP_ADD_INCLUDE(/QOpenSys/pkgs/include/cli) | ||
break | ||
else | ||
AC_MSG_RESULT() | ||
fi | ||
], [ | ||
], "-L$i/lib" ) | ||
done | ||
|
||
if test -z "$LIB_DIR"; then | ||
AC_MSG_RESULT([not found]) | ||
if test $IBM_DB_HOME ; then | ||
AC_MSG_ERROR([Cannot find DB2 CLI libraries. Check if you have set the IBM_DB_HOME environment variable's value correctly]) | ||
else | ||
AC_MSG_ERROR([Environment variable IBM_DB_HOME is not set. Set it to your DB2/IBM_Data_Server_Driver installation directory and retry ibm_db2 module install]) | ||
fi | ||
fi | ||
|
||
if test -r $LIB_DIR/libdb400.a ; then | ||
dnl PASE doesn't need that, we'll use the sqlcli-devel package. | ||
PHP_ADD_INCLUDE(/QOpenSys/pkgs/include/cli) | ||
else | ||
dnl but LUW/Connect will | ||
AC_MSG_CHECKING([for DB2 CLI include files in default path]) | ||
for i in $SEARCH_PATH ; do | ||
AC_MSG_CHECKING([in $i]) | ||
dnl this is for V8.1 and previous | ||
if test -r "$i/include/sqlcli1.h" ; then | ||
IBM_DB2_DIR=$i | ||
AC_MSG_RESULT(found in $i) | ||
break | ||
fi | ||
done | ||
|
||
if test -z "$IBM_DB2_DIR"; then | ||
AC_MSG_RESULT([not found]) | ||
AC_MSG_ERROR([Please reinstall the DB2 CLI distribution]) | ||
fi | ||
|
||
dnl # --with-IBM_DB2 -> add include path | ||
PHP_ADD_INCLUDE($IBM_DB2_DIR/include) | ||
fi | ||
|
||
dnl # --with-IBM_DB2 -> check for lib and symbol presence | ||
if test -r $LIB_DIR/libdb400.a ; then | ||
LIBNAME=db400 | ||
dnl XXX: Should convert defines from PASE to __PASE__, in line with IBM GCC | ||
if test "$IBM_DB2_PASE" = "yes" ; then | ||
PHP_NEW_EXTENSION(ibm_db2, ibm_db2.c, $ext_shared,,-DPASE) | ||
else | ||
LIBNAME=db2 | ||
PHP_NEW_EXTENSION(ibm_db2, ibm_db2.c, $ext_shared) | ||
fi | ||
LIBSYMBOL=SQLConnect | ||
|
||
dnl # PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, | ||
dnl # [ | ||
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $LIB_DIR , IBM_DB2_SHARED_LIBADD) | ||
AC_DEFINE(HAVE_DB2CLILIB,1,[ ]) | ||
dnl # ],[ | ||
dnl # AC_MSG_ERROR([wrong DB2 CLI lib version or lib not found]) | ||
dnl # ],[ | ||
dnl # -L$IBM_DB2_DIR/lib -lm -ldl | ||
dnl # ]) | ||
|
||
PHP_SUBST(IBM_DB2_SHARED_LIBADD) | ||
fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.