9356c8987aea28ab60418c1fe04972bb067467d5
[freeradius.git] / src / modules / rlm_sql / drivers / rlm_sql_unixodbc / configure.ac
1 AC_PREREQ([2.59])
2 AC_INIT(rlm_sql_unixodbc.c)
3 AC_REVISION($Revision$)
4 AC_DEFUN(modname,[rlm_sql_unixodbc])
5
6 fail=
7 SMART_LIBS=
8 SMART_CLFAGS=
9 if test x$with_[]modname != xno; then
10
11         dnl extra argument: --with-unixodbc-include-dir
12         unixodbc_include_dir=
13         AC_ARG_WITH(unixodbc-include-dir,
14                 [AS_HELP_STRING([--with-unixodbc-include-dir=DIR],
15                         [Directory where the unixODBC includes may be found])],
16                 [case "$withval" in
17                     no)
18                         AC_MSG_ERROR(Need unixodbc-include-dir)
19                         ;;
20                     yes)
21                         ;;
22                     *)
23                         unixodbc_include_dir="$withval"
24                         ;;
25                 esac])
26
27         dnl extra argument: --with-unixodbc-lib-dir
28         unixodbc_lib_dir=
29         AC_ARG_WITH(unixodbc-lib-dir,
30                 [AS_HELP_STRING([--with-unixodbc-lib-dir=DIR],
31                         [Directory where the unixODBC libraries may be found])],
32                 [case "$withval" in
33                     no)
34                         AC_MSG_ERROR(Need unixodbc-lib-dir)
35                         ;;
36                     yes)
37                         ;;
38                     *)
39                         unixodbc_lib_dir="$withval"
40                         ;;
41                 esac])
42
43         dnl extra argument: --with-unixodbc-dir
44         AC_ARG_WITH(unixodbc-dir,
45                 [AS_HELP_STRING([--with-unixodbc-dir=DIR],
46                         [Base directory where unixODBC is installed])],
47                 [case "$withval" in
48                     no)
49                         AC_MSG_ERROR(Need unixodbc-dir)
50                         ;;
51                     yes)
52                         ;;
53                     *)
54                         unixodbc_lib_dir="$withval/lib"
55                         unixodbc_include_dir="$withval/include"
56                         ;;
57                 esac])
58
59         dnl Check for SQLConnect in -lodbc
60         smart_try_dir="$unixodbc_lib_dir"
61         FR_SMART_CHECK_LIB(odbc, SQLConnect)
62         if test "x$ac_cv_lib_odbc_SQLConnect" != xyes; then
63                 fail="$fail libodbc"
64         fi
65
66         dnl Check for sql.h
67         smart_try_dir="$unixodbc_include_dir"
68         FR_SMART_CHECK_INCLUDE(sql.h)
69         if test "x$ac_cv_header_sql_h" != xyes; then
70                 fail="$fail sql.h"
71         fi
72
73         targetname=modname
74 else
75         targetname=
76         echo \*\*\* module modname is disabled.
77 fi
78
79 dnl Don't change this section.
80 if test "x$fail" != x; then
81         if test "x${enable_strict_dependencies}" = xyes; then
82                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
83         else
84                 AC_MSG_WARN([silently not building ]modname[.])
85                 AC_MSG_WARN([FAILURE: ]modname[ requires:$fail.]);
86                 targetname=
87         fi
88 fi
89
90 mod_ldflags="$SMART_LIBS"
91 mod_cflags="$SMART_CFLAGS"
92 AC_SUBST(mod_ldflags)
93 AC_SUBST(mod_cflags)
94 AC_SUBST(targetname)
95 AC_OUTPUT(all.mk)