2 AC_REVISION($Revision$)
3 AC_DEFUN(modname,[rlm_sql_iodbc])
8 AC_ARG_WITH(iodbc-include-dir,
9 [ --with-iodbc-include-dir=DIR Directory where the Iodbc includes may be found ],
10 [ iodbc_include_dir="$withval" ]
13 AC_ARG_WITH(iodbc-lib-dir,
14 [ --with-iodbc-lib-dir=DIR Directory where the Iodbc libraries may be found ],
15 [ iodbc_lib_dir="$withval" ]
18 AC_ARG_WITH(iodbc-dir,
19 [ --with-iodbc-dir=DIR Base directory where Iodbc is installed ],
20 [ iodbc_lib_dir="$withval/lib/iodbc"
21 iodbc_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 isql.h])
31 AC_TRY_COMPILE([#include <isql.h>], [int a = 1;],
36 if test "x$IODBC_INCLUDE" = "x"; then
39 dnl AC_LOCATE_DIR(iodbc_include_dir,[isql.h])
41 for try in /usr/local/include /usr/local/iodbc/include $iodbc_include_dir; do
42 CFLAGS="$old_CFLAGS -I$try"
43 AC_TRY_COMPILE([#include <isql.h>], [int a = 1;],
44 IODBC_INCLUDE="-I$try",
47 if test "x$IODBC_INCLUDE" != "x"; then
54 if test "x$IODBC_INCLUDE" = "x"; then
56 AC_MSG_WARN([iodbc headers not found. Use --with-iodbc-include-dir=<path>.])
57 targetname= # disabled module
59 sql_iodbc_cflags="${sql_iodbc_cflags} ${IODBC_INCLUDE}"
61 AC_DEFINE(HAVE_IODBC_H)
64 AC_MSG_CHECKING([for SQLConnect in -lodbc])
68 dnl AC_LOCATE_DIR(iodbc_lib_dir,[libodbc${libltdl_cv_shlibext}])
69 dnl AC_LOCATE_DIR(iodbc_lib_dir,[libodbc.a])
71 for try in /usr/lib /usr/lib/iodbc /usr/local/lib/iodbc /usr/local/iodbc/lib/iodbc $iodbc_lib_dir; do
72 LIBS="$old_LIBS -L$try -lodbc"
73 AC_TRY_LINK([extern char SQLConnect();], [SQLConnect()],
74 IODBC_LIBS="-L$try -lodbc",
77 if test "x$IODBC_LIBS" != "x"; then
83 dnl # If one or the other isn't found, disable them both..
84 dnl # If both are found, enable them both.
85 if test "x$IODBC_LIBS" = "x"; then
88 AC_MSG_WARN([iodbc libraries not found. Use --with-iodbc-lib-dir=<path>.])
89 targetname= # disabled module
92 sql_iodbc_ldflags="$sql_iodbc_ldflags $IODBC_LIBS"
96 sql_iodbc_ldflags="$sql_iodbc_ldflags $LIBS"
98 if test "x$targetname" = "x"; then
99 AC_MSG_WARN([sql submodule 'iodbc' disabled])
104 echo \*\*\* module modname is disabled.
107 AC_SUBST(sql_iodbc_ldflags)
108 AC_SUBST(sql_iodbc_cflags)