summaryrefslogtreecommitdiff
blob: b2159845008f643eeb1f0c05aecc219dfe7db08c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--- ext/odbc/config.m4.old	2013-04-06 11:26:04.047017826 +0200
+++ ext/odbc/config.m4	2013-04-06 12:29:47.180617161 +0200
@@ -366,22 +366,37 @@
 
 if test -z "$ODBC_TYPE"; then
 PHP_ARG_WITH(iodbc,,
-[  --with-iodbc[=DIR]        Include iODBC support [/usr/local]])
+[  --with-iodbc[=DIR]        Include iODBC support])
 
   if test "$PHP_IODBC" != "no"; then
     AC_MSG_CHECKING(for iODBC support)
-    if test "$PHP_IODBC" = "yes"; then
-      PHP_IODBC=/usr/local
+    if test -z "$PKG_CONFIG"; then
+      AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+    fi 
+    if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libiodbc ; then
+      PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
+      ODBC_TYPE=iodbc
+      ODBC_INCLUDE=`$PKG_CONFIG --cflags-only-I libiodbc`
+      ODBC_LFLAGS=`$PKG_CONFIG --libs-only-L libiodbc`
+      ODBC_LIBS=`$PKG_CONFIG --libs-only-l libiodbc`
+      PHP_EVAL_INCLINE($ODBC_INCLUDE)
+      AC_DEFINE(HAVE_IODBC,1,[ ])
+      AC_DEFINE(HAVE_ODBC2,1,[ ])
+      AC_MSG_RESULT([$ext_output])
+    else
+      if test "$PHP_IODBC" = "yes"; then
+        PHP_IODBC=/usr/local
+      fi
+      PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
+      PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
+      ODBC_TYPE=iodbc
+      ODBC_INCLUDE=-I$PHP_IODBC/include
+      ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
+      ODBC_LIBS=-liodbc
+      AC_DEFINE(HAVE_IODBC,1,[ ])
+      AC_DEFINE(HAVE_ODBC2,1,[ ])
+      AC_MSG_RESULT([$ext_output])
     fi
-    PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
-    PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
-    ODBC_TYPE=iodbc
-    ODBC_INCLUDE=-I$PHP_IODBC/include
-    ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
-    ODBC_LIBS=-liodbc
-    AC_DEFINE(HAVE_IODBC,1,[ ])
-    AC_DEFINE(HAVE_ODBC2,1,[ ])
-    AC_MSG_RESULT([$ext_output])
   fi
 fi