9b04f3a2e743e408c73826477d7885f504fea707
[freeradius.git] / src / modules / rlm_sql / drivers / rlm_sql_freetds / configure.ac
1 AC_PREREQ([2.59])
2 AC_INIT(rlm_sql_freetds.c)
3 AC_REVISION($Revision$)
4 AC_DEFUN(modname,[rlm_sql_freetds])
5
6 fail=
7 SMART_LIBS=
8 SMART_CLFAGS=
9 if test x$with_[]modname != xno; then
10
11     dnl ############################################################
12     dnl # Check for command line options
13     dnl ############################################################
14
15     dnl extra argument: --with-freetds-include-dir=DIR
16     freetds_include_dir=
17     AC_ARG_WITH(freetds-include-dir,
18         [AS_HELP_STRING([--with-freetds-include-dir=DIR],
19                 [Directory where the freetds includes may be found])],
20         [case "$withval" in
21             no)
22                 AC_MSG_ERROR(Need freetds-include-dir)
23                 ;;
24             yes)
25                 ;;
26             *)
27                 freetds_include_dir="$withval"
28                 ;;
29         esac])
30
31     dnl extra argument: --with-freetds-lib-dir=DIR
32     freetds_lib_dir=
33     AC_ARG_WITH(freetds-lib-dir,
34         [AS_HELP_STRING([--with-freetds-lib-dir=DIR],
35                 [Directory where the freetds libraries may be found])],
36         [case "$withval" in
37             no)
38                 AC_MSG_ERROR(Need freetds-lib-dir)
39                 ;;
40             yes)
41                 ;;
42             *)
43                 freetds_lib_dir="$withval"
44                 ;;
45         esac])
46
47     dnl extra argument: --with-freetds-dir=DIR
48     AC_ARG_WITH(freetds-dir,
49         [AS_HELP_STRING([--with-freetds-dir=DIR],
50                 [Base directory where freetds is installed])],
51         [case "$withval" in
52             no)
53                 AC_MSG_ERROR(Need freetds-dir)
54                 ;;
55             yes)
56                 ;;
57             *)
58                 freetds_lib_dir="$withval/lib"
59                 freetds_include_dir="$withval/include"
60                 ;;
61         esac])
62
63     dnl ############################################################
64     dnl # Check for header files
65     dnl ############################################################
66
67     smart_try_dir="$freetds_include_dir"
68     FR_SMART_CHECK_INCLUDE(ctpublic.h)
69     if test "x$ac_cv_header_ctpublic_h" != "xyes"; then
70       AC_MSG_WARN([freetds headers not found. Use --with-freetds-include-dir=<path>.])
71       fail="$fail ctpublic.h"
72     fi
73
74     dnl ############################################################
75     dnl # Check for libraries
76     dnl ############################################################
77
78     dnl try to link to freetds
79     smart_try_dir="$freetds_lib_dir"
80     FR_SMART_CHECK_LIB(ct, ct_command)
81     if test "x$ac_cv_lib_ct_ct_command" != "xyes"
82     then
83       AC_MSG_WARN([freetds libraries not found. Use --with-freetds-lib-dir=<path>.])
84       fail="$fail libct"
85     fi
86
87     targetname=modname
88 else
89     targetname=
90     echo \*\*\* module modname is disabled.
91 fi
92
93 dnl Don't change this section.
94 if test "x$fail" != x; then
95         if test "x${enable_strict_dependencies}" = xyes; then
96                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
97         else
98                 AC_MSG_WARN([silently not building ]modname[.])
99                 AC_MSG_WARN([FAILURE: ]modname[ requires:$fail.]);
100                 targetname=
101         fi
102 fi
103
104 mod_ldflags="$SMART_LIBS"
105 mod_cflags="$SMART_CFLAGS"
106 AC_SUBST(mod_ldflags)
107 AC_SUBST(mod_cflags)
108 AC_SUBST(targetname)
109 AC_OUTPUT(all.mk)