@@ -9,105 +9,81 @@ PHP_ARG_WITH(pdo-ibm, for DB2 driver for PDO,
9
9
if test "$PHP_PDO_IBM" != "no"; then
10
10
SEARCH_PATH="$PHP_PDO_IBM_LIB $PHP_PDO_IBM $DB2PATH $DB2DIR"
11
11
12
- AC_MSG_CHECKING ( Looking for DB2 CLI libraries )
12
+ dnl Scan the library path for LUW, clidriver, and libdb400 in the usual
13
+ dnl places, also assuming include/ is in the directory too.
13
14
for i in $SEARCH_PATH ; do
14
- AC_MSG_CHECKING ( [ in $i] )
15
- if test -r $i/libdb2.so || test -r $i/libdb2.a || test -r $i/libdb400.a || test -r $i/libdb2.dylib; then
16
- LIB_DIR="$i/"
17
- AC_MSG_RESULT ( found )
18
- break
19
- else
20
- AC_MSG_RESULT ( )
21
- fi
22
- AC_MSG_CHECKING ( [ in $i/lib64] )
23
- if test -r $i/lib64/libdb2.so || test -r $i/lib64/libdb2.a || test -r $i/lib64/libdb400.a || test -r $i/lib64/libdb2.dylib ; then
24
- LIB_DIR="$i/lib64/"
25
- AC_MSG_RESULT ( found )
15
+ dnl XXX: The messages kinda suck and don't indicate which path
16
+ dnl (combined with AC_MSG_* spew from AC_CHECK_LIB)
17
+ dnl XXX: Macros for this? Can these be merged?
18
+
19
+ dnl LUW ships its client libraries in lib64/32 (at least on amd64 linux)
20
+ AC_CHECK_SIZEOF ( [ long] )
21
+ AC_MSG_CHECKING ( [ if we're on a 64-bit platform] )
22
+ AS_IF ( [ test "$ac_cv_sizeof_long" -eq 4] ,[
23
+ AC_MSG_RESULT ( [ no] )
24
+ PHP_CHECK_LIBRARY(db2, SQLDriverConnect, [
25
+ PHP_ADD_LIBPATH($i/lib32, PDO_IBM_SHARED_LIBADD)
26
+ PHP_ADD_LIBRARY(db2, 1, PDO_IBM_SHARED_LIBADD)
27
+ PHP_ADD_INCLUDE($i/include)
28
+ break
29
+ ] , [ ] , "-L$i/lib32" )
30
+ ] ,[
31
+ AC_MSG_RESULT ( [ yes] )
32
+ PHP_CHECK_LIBRARY(db2, SQLDriverConnect, [
33
+ PHP_ADD_LIBPATH($i/lib64, PDO_IBM_SHARED_LIBADD)
34
+ PHP_ADD_LIBRARY(db2, 1, PDO_IBM_SHARED_LIBADD)
35
+ PHP_ADD_INCLUDE($i/include)
36
+ break
37
+ ] , [ ] , "-L$i/lib64" )
38
+ ] )
39
+ dnl The standalone clidriver package uses lib/
40
+ PHP_CHECK_LIBRARY(db2, SQLDriverConnect, [
41
+ PHP_ADD_LIBPATH($i/lib, PDO_IBM_SHARED_LIBADD)
42
+ PHP_ADD_LIBRARY(db2, 1, PDO_IBM_SHARED_LIBADD)
43
+ PHP_ADD_INCLUDE($i/include)
26
44
break
27
- else
28
- AC_MSG_RESULT ( )
29
- fi
30
- AC_MSG_CHECKING ( [ in $i/lib32] )
31
- if test -r $i/lib32/libdb2.so || test -r $i/lib32/libdb2.a || test -r $i/lib32/libdb400.a || test -r $i/lib32/libdb2.dylib ; then
32
- LIB_DIR="$i/lib32/"
33
- AC_MSG_RESULT ( found )
45
+ ] , [
46
+ ] , "-L$i/lib" )
47
+ dnl Special cases for PASE
48
+ dnl SG ships a custom libdb400 (with renamed funcs to co-exist w/ ODBC)
49
+ dnl it requires some special handling for headers too
50
+ PHP_CHECK_LIBRARY(db400sg, LDBDriverConnect, [
51
+ PDO_IBM_PASE=yes
52
+ dnl from RPMs libdb400sg-devel and sqlcli-devel
53
+ dnl as IBM i doesn't ship SQL/CLI headers w/ PASE (and RPM's in subdir)
54
+ PHP_ADD_LIBPATH($i/lib, PDO_IBM_SHARED_LIBADD)
55
+ PHP_ADD_LIBRARY(db400sg, 1, PDO_IBM_SHARED_LIBADD)
56
+ PHP_ADD_INCLUDE(/QOpenSys/pkgs/include/cli-sg)
57
+ PHP_ADD_INCLUDE(/QOpenSys/pkgs/include/cli)
34
58
break
35
- else
36
- AC_MSG_RESULT ( )
37
- fi
38
- AC_MSG_CHECKING ( [ in $i/lib] )
39
- 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
40
- LIB_DIR="$i/lib/"
41
- AC_MSG_RESULT ( found )
59
+ ] , [
60
+ ] , "-L$i/lib" )
61
+ dnl Probably vanilla libdb400
62
+ dnl XXX: For PASE, libdb400 is likely on the default path
63
+ PHP_CHECK_LIBRARY(db400, SQLDriverConnect, [
64
+ PDO_IBM_PASE=yes
65
+ dnl from RPM sqlcli-devel
66
+ PHP_ADD_LIBPATH($i/lib, PDO_IBM_SHARED_LIBADD)
67
+ PHP_ADD_LIBRARY(db400, 1, PDO_IBM_SHARED_LIBADD)
68
+ PHP_ADD_INCLUDE(/QOpenSys/pkgs/include/cli)
42
69
break
43
- else
44
- AC_MSG_RESULT ( )
45
- fi
70
+ ] , [
71
+ ] , "-L$i/lib" )
46
72
done
47
73
48
- AC_MSG_CHECKING ( [ for DB2 CLI include files in default path] )
49
- if test -r $LIB_DIR/libdb400.a ; then
50
- dnl PASE doesn't need that, we'll use the sqlcli-devel package.
51
- PHP_ADD_INCLUDE(/QOpenSys/pkgs/include/cli)
52
- AC_MSG_RESULT ( [ found PASE headers] )
53
- else
54
- dnl but LUW/Connect will
55
- for i in $SEARCH_PATH ; do
56
- AC_MSG_CHECKING ( [ in $i] )
57
- if test -r "$i/include/sqlcli1.h" ; then
58
- PDO_IBM_DIR=$i
59
- AC_MSG_RESULT ( found in $i )
60
- break
61
- fi
62
- done
63
- fi
64
-
65
- ifdef ( [ PHP_CHECK_PDO_INCLUDES] ,
66
- [
67
- PHP_CHECK_PDO_INCLUDES
68
- ] ,[
69
- AC_MSG_CHECKING ( [ for PDO includes] )
70
- if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
71
- pdo_cv_inc_path=$abs_srcdir/ext
72
- elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
73
- pdo_cv_inc_path=$abs_srcdir/ext
74
- elif test -f $phpincludedir/ext/pdo/php_pdo_driver.h; then
75
- pdo_cv_inc_path=$phpincludedir/ext
76
- else
77
- AC_MSG_ERROR ( [ Cannot find php_pdo_driver.h.] )
78
- fi
79
- AC_MSG_RESULT ( $pdo_cv_inc_path )
80
- ] )
74
+ PHP_CHECK_PDO_INCLUDES
81
75
82
76
dnl Don't forget to add additional source files here
83
77
php_pdo_ibm_sources_core="pdo_ibm.c ibm_driver.c ibm_statement.c"
84
78
85
- PHP_ADD_INCLUDE($PDO_IBM_DIR/include)
86
- PHP_ADD_LIBPATH($LIB_DIR, PDO_IBM_SHARED_LIBADD)
87
- AC_MSG_CHECKING ( [ "$LIB_DIR/libdb400.a"] )
88
- if test -r "$LIB_DIR/libdb400.a" ; then
89
- PHP_ADD_LIBRARY(db400, 1, PDO_IBM_SHARED_LIBADD)
90
- AC_MSG_RESULT ( found )
91
- else
92
- PHP_ADD_LIBRARY(db2, 1, PDO_IBM_SHARED_LIBADD)
93
- AC_MSG_RESULT ( )
94
- fi
95
-
96
- case "$host_alias" in
97
- *aix*)
98
- CPPFLAGS="$CPPFLAGS -D__H_LOCALEDEF";;
99
- esac
100
-
101
- if test -r $LIB_DIR/libdb400.a ; then
79
+ dnl Convert the includes to __PASE__ (for IBM-shipped GCC) or use AC_DEFINE
80
+ if test "$PDO_IBM_PASE" = "yes" ; then
102
81
PHP_NEW_EXTENSION(pdo_ibm, $php_pdo_ibm_sources_core, $ext_shared,,-I$pdo_cv_inc_path -DPASE)
103
82
else
104
83
PHP_NEW_EXTENSION(pdo_ibm, $php_pdo_ibm_sources_core, $ext_shared,,-I$pdo_cv_inc_path)
105
84
fi
106
85
107
- ifdef ( [ PHP_ADD_EXTENSION_DEP] ,
108
- [
109
- PHP_ADD_EXTENSION_DEP(pdo_ibm, pdo)
110
- ] )
86
+ PHP_ADD_EXTENSION_DEP(pdo_ibm, pdo)
111
87
112
88
PHP_SUBST(PDO_IBM_SHARED_LIBADD)
113
89
0 commit comments