Make ODBC DBD driver compile on Unix.
[apr-util.git] / build / dso.m4
blob8f389150248c13c03af7134767374a2a2fcfd2d1
1 dnl -------------------------------------------------------- -*- autoconf -*-
2 dnl Licensed to the Apache Software Foundation (ASF) under one or more
3 dnl contributor license agreements.  See the NOTICE file distributed with
4 dnl this work for additional information regarding copyright ownership.
5 dnl The ASF licenses this file to You under the Apache License, Version 2.0
6 dnl (the "License"); you may not use this file except in compliance with
7 dnl the License.  You may obtain a copy of the License at
8 dnl
9 dnl     http://www.apache.org/licenses/LICENSE-2.0
10 dnl
11 dnl Unless required by applicable law or agreed to in writing, software
12 dnl distributed under the License is distributed on an "AS IS" BASIS,
13 dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 dnl See the License for the specific language governing permissions and
15 dnl limitations under the License.
17 dnl
18 dnl DSO module
19 dnl
21 AC_DEFUN([APU_CHECK_UTIL_DSO], [
23   AC_ARG_ENABLE([util-dso], 
24      APR_HELP_STRING([--disable-util-dso],
25        [disable DSO build of modular components (dbd, ldap)]))
27   if test "$enable_util_dso" = "no"; then
28      # Statically link the DBD drivers:
30      objs=
31      test $apu_have_oracle = 1 && objs="$objs dbd/apr_dbd_oracle.lo"
32      test $apu_have_pgsql = 1 && objs="$objs dbd/apr_dbd_pgsql.lo"
33      test $apu_have_mysql = 1 && objs="$objs dbd/apr_dbd_mysql.lo"
34      test $apu_have_sqlite2 = 1 && objs="$objs dbd/apr_dbd_sqlite2.lo"
35      test $apu_have_sqlite3 = 1 && objs="$objs dbd/apr_dbd_sqlite3.lo"
36      test $apu_have_freetds = 1 && objs="$objs dbd/apr_dbd_freetds.lo"
37      test $apu_have_odbc = 1 && objs="$objs dbd/apr_dbd_odbc.lo"
38      test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_init.lo"
39      test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_option.lo"
40      test $apu_has_ldap = 1 && objs="$objs ldap/apr_ldap_rebind.lo"
41      EXTRA_OBJECTS="$EXTRA_OBJECTS $objs"
43      # Use libtool *.la for mysql if available
44      if test $apu_have_mysql = 1; then
45        for flag in $LDADD_dbd_mysql
46        do
47          dir=`echo $flag | grep "^-L" | sed s:-L::`
48          if test "x$dir" != 'x'; then
49            if test -f "$dir/libmysqlclient_r.la"; then
50              LDADD_dbd_mysql=$dir/libmysqlclient_r.la
51              break
52            fi
53          fi
54        done
55      fi
57      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"
58      APRUTIL_LIBS="$APRUTIL_LIBS $LDADD_ldap"
59      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"
60      APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_ldap"
61   else
62      AC_DEFINE([APU_DSO_BUILD], 1, [Define if modular components are built as DSOs])
63      
64      dsos=
65      test $apu_have_oracle = 1 && dsos="$dsos dbd/apr_dbd_oracle.la"
66      test $apu_have_pgsql = 1 && dsos="$dsos dbd/apr_dbd_pgsql.la"
67      test $apu_have_mysql = 1 && dsos="$dsos dbd/apr_dbd_mysql.la"
68      test $apu_have_sqlite2 = 1 && dsos="$dsos dbd/apr_dbd_sqlite2.la"
69      test $apu_have_sqlite3 = 1 && dsos="$dsos dbd/apr_dbd_sqlite3.la"
70      test $apu_have_freetds = 1 && dsos="$dsos dbd/apr_dbd_freetds.la"
71      test $apu_have_odbc = 1 && dsos="$dsos dbd/apr_dbd_odbc.la"
72      test $apu_has_ldap = 1 && dsos="$dsos ldap/apr_ldap.la"
74      if test -n "$dsos"; then
75         APU_MODULES="$APU_MODULES $dsos"
76      fi
77   fi