2 AC_REVISION($Revision$)
3 AC_DEFUN(modname,[rlm_sql_db2])
8 AC_ARG_WITH(ibmdb2-include-dir,
9 [ --with-ibmdb2-include-dir=DIR Directory where the IBM-DB2 includes may be found ],
10 [ ibmdb2_include_dir="$withval" ]
13 AC_ARG_WITH(ibmdb2-lib-dir,
14 [ --with-ibmdb2-lib-dir=DIR Directory where the IBM-DB2 libraries may be found ],
15 [ ibmdb2_lib_dir="$withval" ]
18 AC_ARG_WITH(ibmdb2-dir,
19 [ --with-ibmdb2-dir=DIR Base directory where IBM-DB2 is installed ],
20 [ ibmdb2_lib_dir="$withval/lib"
21 ibmdb2_include_dir="$withval/include"
25 if test x$with_[]modname != xno; then
27 targetname=modname # we might change this later.
29 AC_MSG_CHECKING([for sqlcli.h])
31 AC_TRY_COMPILE([#include <sqlcli.h>], [int a = 1;],
36 if test "x$IBMDB2_INCLUDE" = "x"; then
39 for try in /usr/IBMdb2/V7.1/include $ibmdb2_include_dir; do
40 CFLAGS="$old_CFLAGS -I$try"
41 AC_TRY_COMPILE([#include <sqlcli.h>], [int a = 1;],
42 IBMDB2_INCLUDE="-I$try",
45 if test "x$IBMDB2_INCLUDE" != "x"; then
52 if test "x$IBMDB2_INCLUDE" = "x"; then
54 AC_MSG_WARN([ibm db2 headers not found. Use --with-ibmdb2-include-dir=<path>.])
55 targetname= # disabled module
57 sql_ibmdb2_cflags="${sql_ibmdb2_cflags} ${IBMDB2_INCLUDE}"
60 AC_MSG_CHECKING([for SQLConnect in -ldb2])
64 for try in /usr/IBMdb2/V7.1/lib $ibmdb2_lib_dir; do
65 LIBS="$old_LIBS -L$try -ldb2"
66 AC_TRY_LINK([extern char SQLConnect();], [SQLConnect()],
67 IBMDB2_LIBS="-L$try -ldb2",
70 if test "x$IBMDB2_LIBS" != "x"; then
76 dnl # If one or the other isn't found, disable them both..
77 dnl # If both are found, enable them both.
78 if test "x$IBMDB2_LIBS" = "x"; then
81 AC_MSG_WARN([ibmdb2 libraries not found. Use --with-ibmdb2-lib-dir=<path>.])
82 targetname= # disabled module
85 sql_ibmdb2_ldflags="$sql_ibmdb2_ldflags $IBMDB2_LIBS"
89 sql_ibmdb2_ldflags="$sql_ibmdb2_ldflags $LIBS"
91 if test "x$targetname" = "x"; then
92 AC_MSG_WARN([sql submodule 'db2' disabled])
97 echo \*\*\* module modname is disabled.
100 AC_SUBST(sql_ibmdb2_ldflags)
101 AC_SUBST(sql_ibmdb2_cflags)