apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject svn commit: r667299 - in /apr/apr-util/trunk: build.conf build/dbd.m4 build/dso.m4 configure.in dbd/apr_dbd_odbc.c
Date Fri, 13 Jun 2008 00:09:09 GMT
Author: bojan
Date: Thu Jun 12 17:09:08 2008
New Revision: 667299

URL: http://svn.apache.org/viewvc?rev=667299&view=rev
Log:
Make ODBC DBD driver compile on Unix.

Modified:
    apr/apr-util/trunk/build.conf
    apr/apr-util/trunk/build/dbd.m4
    apr/apr-util/trunk/build/dso.m4
    apr/apr-util/trunk/configure.in
    apr/apr-util/trunk/dbd/apr_dbd_odbc.c

Modified: apr/apr-util/trunk/build.conf
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/build.conf?rev=667299&r1=667298&r2=667299&view=diff
==============================================================================
--- apr/apr-util/trunk/build.conf (original)
+++ apr/apr-util/trunk/build.conf Thu Jun 12 17:09:08 2008
@@ -28,7 +28,7 @@
 # the public headers
 headers = include/*.h include/private/*.h
 
-modules = ldap dbd_pgsql dbd_sqlite2 dbd_sqlite3 dbd_oracle dbd_mysql dbd_freetds
+modules = ldap dbd_pgsql dbd_sqlite2 dbd_sqlite3 dbd_oracle dbd_mysql dbd_freetds dbd_odbc
 
 # gen_uri_delim.c
 
@@ -59,6 +59,10 @@
 paths = dbd/apr_dbd_freetds.c
 target = dbd/apr_dbd_freetds.la
 
+[dbd_odbc]
+paths = dbd/apr_dbd_odbc.c
+target = dbd/apr_dbd_odbc.la
+
 [ldap]
 paths = ldap/apr_ldap_init.c \
         ldap/apr_ldap_option.c \

Modified: apr/apr-util/trunk/build/dbd.m4
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/build/dbd.m4?rev=667299&r1=667298&r2=667299&view=diff
==============================================================================
--- apr/apr-util/trunk/build/dbd.m4 (original)
+++ apr/apr-util/trunk/build/dbd.m4 Thu Jun 12 17:09:08 2008
@@ -387,3 +387,89 @@
 ])
 dnl
 
+AC_DEFUN([APU_CHECK_DBD_ODBC], [
+  apu_have_odbc=0
+
+  old_libs="$LIBS"
+  old_cppflags="$CPPFLAGS"
+  old_ldflags="$LDFLAGS"
+
+  AC_ARG_WITH([odbc], APR_HELP_STRING([--with-odbc=DIR], [specify ODBC location]),
+  [
+    if test "$withval" = "yes"; then
+      AC_PATH_PROG([ODBC_CONFIG],[odbc_config])
+      if test "x$ODBC_CONFIG" != 'x'; then
+        odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
+        odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
+        odbc_LIBS="`$ODBC_CONFIG --libs`"
+
+        APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
+        APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
+        APR_ADDTO(LIBS, [$odbc_LIBS])
+      fi
+
+      AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+      if test "$apu_have_odbc" = "0"; then
+        AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+      fi
+      if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
+        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
+      fi
+    elif test "$withval" = "no"; then
+      :
+    else
+      AC_PATH_PROG([ODBC_CONFIG],[odbc_config],,[$withval/bin])
+      if test "x$ODBC_CONFIG" != 'x'; then
+        odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
+        odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
+        odbc_LIBS="`$ODBC_CONFIG --libs`"
+      else
+        odbc_CPPFLAGS="-I$withval/include"
+        odbc_LDFLAGS="-L$withval/lib "
+      fi
+
+      APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
+      APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
+      APR_ADDTO(LIBS, [$odbc_LIBS])
+
+      AC_MSG_NOTICE(checking for odbc in $withval)
+      AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+      if test "$apu_have_odbc" = "0"; then
+        AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+      fi
+      if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
+        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
+      fi
+    fi
+  ], [
+    AC_PATH_PROG([ODBC_CONFIG],[odbc_config])
+    if test "x$ODBC_CONFIG" != 'x'; then
+      odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
+      odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
+      odbc_LIBS="`$ODBC_CONFIG --libs`"
+
+      APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
+      APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
+      APR_ADDTO(LIBS, [$odbc_LIBS])
+    fi
+
+    AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+    if test "$apu_have_odbc" = "0"; then
+      AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
+    fi
+    if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
+      APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
+    fi
+  ])
+  AC_SUBST(apu_have_odbc)
+  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
+  dnl we know the library is there.
+  if test "$apu_have_odbc" = "1"; then
+    LDADD_dbd_odbc="$odbc_LDFLAGS -lpq $odbc_LIBS"
+  fi
+  AC_SUBST(LDADD_dbd_odbc)
+
+  LIBS="$old_libs"
+  CPPFLAGS="$old_cppflags"
+  LDFLAGS="$old_ldflags"
+])

Modified: apr/apr-util/trunk/build/dso.m4
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/build/dso.m4?rev=667299&r1=667298&r2=667299&view=diff
==============================================================================
--- apr/apr-util/trunk/build/dso.m4 (original)
+++ apr/apr-util/trunk/build/dso.m4 Thu Jun 12 17:09:08 2008
@@ -34,6 +34,7 @@
      test $apu_have_sqlite2 = 1 && objs="$objs dbd/apr_dbd_sqlite2.lo"
      test $apu_have_sqlite3 = 1 && objs="$objs dbd/apr_dbd_sqlite3.lo"
      test $apu_have_freetds = 1 && objs="$objs dbd/apr_dbd_freetds.lo"
+     test $apu_have_odbc = 1 && objs="$objs dbd/apr_dbd_odbc.lo"
      test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_init.lo"
      test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_option.lo"
      test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_rebind.lo"
@@ -53,9 +54,9 @@
        done
      fi
 
-     APRUTIL_LIBS="$APRUTIL_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle
$LDADD_dbd_mysql $LDADD_dbd_freetds"
+     APRUTIL_LIBS="$APRUTIL_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle
$LDADD_dbd_mysql $LDADD_dbd_freetds $LDADD_dbd_odbc"
      APRUTIL_LIBS="$APRUTIL_LIBS $LDADD_ldap"
-     APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3
$LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_freetds"
+     APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3
$LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_freetds $LDADD_dbd_odbc"
      APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_ldap"
   else
      AC_DEFINE([APU_DSO_BUILD], 1, [Define if modular components are built as DSOs])
@@ -67,6 +68,7 @@
      test $apu_have_sqlite2 = 1 && dsos="$dsos dbd/apr_dbd_sqlite2.la"
      test $apu_have_sqlite3 = 1 && dsos="$dsos dbd/apr_dbd_sqlite3.la"
      test $apu_have_freetds = 1 && dsos="$dsos dbd/apr_dbd_freetds.la"
+     test $apu_have_odbc = 1 && dsos="$dsos dbd/apr_dbd_odbc.la"
      test $apu_has_ldap = 1 && dsos="$dsos ldap/apr_ldap.la"
 
      if test -n "$dsos"; then

Modified: apr/apr-util/trunk/configure.in
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/configure.in?rev=667299&r1=667298&r2=667299&view=diff
==============================================================================
--- apr/apr-util/trunk/configure.in (original)
+++ apr/apr-util/trunk/configure.in Thu Jun 12 17:09:08 2008
@@ -157,6 +157,7 @@
 APU_CHECK_DBD_SQLITE2
 APU_CHECK_DBD_ORACLE
 APU_CHECK_DBD_FREETDS
+APU_CHECK_DBD_ODBC
 APU_FIND_EXPAT
 APU_FIND_ICONV
 

Modified: apr/apr-util/trunk/dbd/apr_dbd_odbc.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd_odbc.c?rev=667299&r1=667298&r2=667299&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_odbc.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_odbc.c Thu Jun 12 17:09:08 2008
@@ -36,8 +36,13 @@
 #endif
 
 /* standard ODBC include files */
+#ifdef HAVE_SQL_H
 #include <sql.h>
 #include <sqlext.h>
+#elif defined(HAVE_ODBC_SQL_H)
+#include <odbc/sql.h>
+#include <odbc/sqlext.h>
+#endif
 
  /* Driver name is "odbc" and the entry point is 'apr_dbd_odbc_driver' 
  * unless ODBC_DRIVER_NAME is defined and it is linked with another db library which
@@ -212,11 +217,11 @@
     SQL_C_DOUBLE,                   /* APR_DBD_TYPE_DOUBLE,     \%lf  */
     SQL_C_CHAR,                     /* APR_DBD_TYPE_STRING,     \%s   */
     SQL_C_CHAR,                     /* APR_DBD_TYPE_TEXT,       \%pDt */
-    SQL_C_CHAR, /*SQL_C_TYPE_TIME,      /* APR_DBD_TYPE_TIME,       \%pDi */
-    SQL_C_CHAR, /*SQL_C_TYPE_DATE,      /* APR_DBD_TYPE_DATE,       \%pDd */
-    SQL_C_CHAR, /*SQL_C_TYPE_TIMESTAMP, /* APR_DBD_TYPE_DATETIME,   \%pDa */
-    SQL_C_CHAR, /*SQL_C_TYPE_TIMESTAMP, /* APR_DBD_TYPE_TIMESTAMP,  \%pDs */
-    SQL_C_CHAR, /*SQL_C_TYPE_TIMESTAMP, /* APR_DBD_TYPE_ZTIMESTAMP, \%pDz */
+    SQL_C_CHAR, /*SQL_C_TYPE_TIME,      APR_DBD_TYPE_TIME,       \%pDi */
+    SQL_C_CHAR, /*SQL_C_TYPE_DATE,      APR_DBD_TYPE_DATE,       \%pDd */
+    SQL_C_CHAR, /*SQL_C_TYPE_TIMESTAMP, APR_DBD_TYPE_DATETIME,   \%pDa */
+    SQL_C_CHAR, /*SQL_C_TYPE_TIMESTAMP, APR_DBD_TYPE_TIMESTAMP,  \%pDs */
+    SQL_C_CHAR, /*SQL_C_TYPE_TIMESTAMP, APR_DBD_TYPE_ZTIMESTAMP, \%pDz */
     SQL_LONGVARBINARY,              /* APR_DBD_TYPE_BLOB,       \%pDb */
     SQL_LONGVARCHAR,                /* APR_DBD_TYPE_CLOB,       \%pDc */
     SQL_TYPE_NULL                   /* APR_DBD_TYPE_NULL        \%pDn */
@@ -239,11 +244,11 @@
     SQL_DOUBLE,                 /* APR_DBD_TYPE_DOUBLE,     \%lf  */
     SQL_CHAR,                   /* APR_DBD_TYPE_STRING,     \%s   */
     SQL_CHAR,                   /* APR_DBD_TYPE_TEXT,       \%pDt */
-    SQL_CHAR, /*SQL_TIME,       /* APR_DBD_TYPE_TIME,       \%pDi */
-    SQL_CHAR, /*SQL_DATE,       /* APR_DBD_TYPE_DATE,       \%pDd */
-    SQL_CHAR, /*SQL_TIMESTAMP,  /* APR_DBD_TYPE_DATETIME,   \%pDa */
-    SQL_CHAR, /*SQL_TIMESTAMP,  /* APR_DBD_TYPE_TIMESTAMP,  \%pDs */
-    SQL_CHAR, /*SQL_TIMESTAMP,  /* APR_DBD_TYPE_ZTIMESTAMP, \%pDz */
+    SQL_CHAR, /*SQL_TIME,          APR_DBD_TYPE_TIME,       \%pDi */
+    SQL_CHAR, /*SQL_DATE,          APR_DBD_TYPE_DATE,       \%pDd */
+    SQL_CHAR, /*SQL_TIMESTAMP,     APR_DBD_TYPE_DATETIME,   \%pDa */
+    SQL_CHAR, /*SQL_TIMESTAMP,     APR_DBD_TYPE_TIMESTAMP,  \%pDs */
+    SQL_CHAR, /*SQL_TIMESTAMP,     APR_DBD_TYPE_ZTIMESTAMP, \%pDz */
     SQL_LONGVARBINARY,          /* APR_DBD_TYPE_BLOB,       \%pDb */
     SQL_LONGVARCHAR,            /* APR_DBD_TYPE_CLOB,       \%pDc */
     SQL_TYPE_NULL               /* APR_DBD_TYPE_NULL        \%pDn */



Mime
View raw message