update otp_hotp() to support 6,7,8,9 digit otp's
[freeradius.git] / src / modules / rlm_ldap / configure.in
1 AC_PREREQ([2.53])
2 AC_INIT(rlm_ldap.c)
3 AC_REVISION($Revision$)
4 AC_DEFUN(modname,[rlm_ldap])
5
6 fail=
7 SMART_LIBS=
8 SMART_CLFAGS=
9 if test x$with_[]modname != xno; then
10
11         dnl ############################################################
12         dnl # Check for compiler
13         dnl ############################################################
14         AC_PROG_CC
15
16         dnl ############################################################
17         dnl # Check for command line options
18         dnl ############################################################
19
20         dnl extra argument: --with-rlm-ldap-lib-dir
21         rlm_ldap_lib_dir=
22         AC_ARG_WITH(rlm-ldap-lib-dir,
23         [  --with-rlm-ldap-lib-dir=DIR       directory for LDAP library files []],
24         [ case "$withval" in
25             no)
26                 AC_MSG_ERROR(Need rlm-ldap-lib-dir)
27                 ;;
28             yes)
29                 ;;
30             *)
31                 rlm_ldap_lib_dir="$withval"
32                 ;;
33           esac ]
34         )
35
36         dnl extra argument: --with-rlm-ldap-include-dir
37         rlm_ldap_include_dir=
38         AC_ARG_WITH(rlm-ldap-include-dir,
39         [  --with-rlm-ldap-include-dir=DIR   directory for LDAP include files []],
40         [ case "$withval" in
41             no)
42                 AC_MSG_ERROR(Need rlm-ldap-include-dir)
43                 ;;
44             yes)
45                 ;;
46             *)
47                 rlm_ldap_include_dir="$withval"
48                 ;;
49           esac ]
50         )
51
52         dnl extra argument: --enable-shared --disable-shared
53         AC_ENABLE_SHARED
54
55         dnl OpenLDAP doesn't provide an autoconf test for their libldap,
56         dnl and we can't reasonably check for all the dependancies for
57         dnl every version and every set of options.
58         if test "x$enable_shared" = "xno"; then
59                 AC_MSG_WARN(Static linking with libldap will probably result in unresolved symbols.)
60         fi
61
62         dnl extra argument: --with-threads
63         rlm_ldap_with_threads=yes
64         AC_ARG_WITH(threads,
65         [  --with-threads          use threads, if available. (default=yes) ],
66         [ case "$withval" in
67             no)
68                 rlm_ldap_with_threads=no
69                 ;;
70             *)
71                 ;;
72             esac ])
73
74         dnl ############################################################
75         dnl # Check for libraries
76         dnl ############################################################
77
78         dnl pthread stuff is usually in -lpthread
79         dnl or in -lc_r, on *BSD
80         if test "x$rlm_ldap_with_threads" = "xyes"; then
81             AC_CHECK_LIB(pthread, pthread_create,
82                          [ LIBS="-lpthread $LIBS" ],
83                          AC_CHECK_LIB(c_r, pthread_create,
84                                       [ LIBS="-lc_r $LIBS" ],
85                                       [ rlm_ldap_with_threads="no" ]
86                                       )
87                          )
88         fi
89
90         dnl Try only "-lldap_r" or "-lldap"
91         dnl Static linking will probably not work, but nobody ever
92         dnl complained about it.
93         smart_try_dir=$rlm_ldap_lib_dir
94         if test "x$rlm_ldap_with_threads" = "xyes"; then
95             FR_SMART_CHECK_LIB(ldap_r, ldap_init)
96             if test "x$ac_cv_lib_ldap_r_ldap_init" != "xyes"; then
97                 fail="$fail libldap_r"
98             fi
99         else
100             FR_SMART_CHECK_LIB(ldap, ldap_init)
101             if test "x$ac_cv_lib_ldap_ldap_init" != "xyes"; then
102                 fail="$fail libldap"
103             fi
104         fi
105
106         dnl ############################################################
107         dnl # Check for header files
108         dnl ############################################################
109
110         smart_try_dir=$rlm_ldap_include_dir
111         FR_SMART_CHECK_INCLUDE(ldap.h)
112         if test "$ac_cv_header_ldap_h" != "yes"; then
113           fail="$fail ldap.h"
114         fi
115
116         dnl ############################################################
117         dnl # Check for library functions
118         dnl ############################################################
119
120         if test "x$fail" = "x"; then
121             AC_CHECK_FUNC(ldap_start_tls_s,
122                 [ SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_START_TLS" ])
123             AC_CHECK_FUNC(ldap_initialize,
124                 [ SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_INITIALIZE" ])
125             AC_CHECK_FUNC(ldap_int_tls_config,
126                 [ SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_INT_TLS_CONFIG" ])
127         fi
128
129         targetname=modname
130 else
131         targetname=
132         echo \*\*\* module modname is disabled.
133 fi
134
135 if test x"$fail" != x""; then
136         if test x"${enable_strict_dependencies}" = x"yes"; then
137                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
138         else
139                 AC_MSG_WARN([silently not building ]modname[.])
140                 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.])
141                 if test x"$headersuggestion" != x; then
142                         AC_MSG_WARN([$headersuggestion])
143                 fi
144                 if test x"$libsuggestion" != x; then
145                         AC_MSG_WARN([$libsuggestion])
146                 fi
147                 targetname=""
148         fi
149 fi
150
151 dnl extra argument: --with-edir
152 dnl If using Novell eDirectory, enable UP and Novell specific code
153 WITH_EDIRECTORY=no
154 AC_ARG_WITH(edir,
155 [  --with-edir             enable Novell eDirectory integration.  (default=no) ],
156 [ case "$withval" in
157     yes)
158         SMART_CFLAGS="$SMART_CFLAGS -DNOVELL_UNIVERSAL_PASSWORD -DNOVELL"
159         edir="edir_ldapext.c"
160         ;;
161     *)
162         ;;
163   esac ]
164 )
165
166 ldap_ldflags=$SMART_LIBS
167 ldap_cflags=$SMART_CFLAGS
168 AC_SUBST(edir)
169 AC_SUBST(ldap_ldflags)
170 AC_SUBST(ldap_cflags)
171 AC_SUBST(targetname)
172 AC_OUTPUT(Makefile)