update otp_hotp() to support 6,7,8,9 digit otp's
[freeradius.git] / src / modules / rlm_otp / configure.in
1 AC_PREREQ([2.53])
2 AC_INIT(otp_rlm.c)
3 AC_REVISION($Revision$)
4 AC_DEFUN(modname,[rlm_otp])
5
6 otp_cflags=
7 otp_ldflags=
8
9 if test x$with_[]modname != xno; then
10
11         dnl put configuration checks here.
12         dnl set $fail to what's missing, on fatal errors.
13         dnl use AC_MSG_WARN() on important messages.
14
15         dnl test for almost-c99 compliant compiler
16         AC_CHECK_HEADER(inttypes.h, ,
17                 [ fail="$fail inttypes.h" ]
18         )
19
20         dnl ############################################################
21         dnl # Check for command line options
22         dnl ############################################################
23
24         dnl mostly for openssl
25         AC_ARG_WITH(rlm-otp-lib-dir,
26         [  --with-rlm-otp-lib-dir        directory for otp libs],
27         otp_ldflags="-L$withval $otp_ldflags")
28         AC_ARG_WITH(rlm-otp-include-dir,
29         [  --with-rlm-otp-include-dir    directory for otp includes],
30         otp_cflags="$otp_cflags -I$withval")
31
32         dnl extra argument: --openssl-libraries=dir
33         AC_ARG_WITH(openssl-libraries,
34         [  --with-openssl-libraries=DIR  directory to look for OpenSSL library files],
35         otp_ldflags="-L$withval $otp_ldflags")
36
37         dnl extra argument: --openssl-includes=dir
38         AC_ARG_WITH(openssl-includes,
39         [  --with-openssl-includes=DIR   directory to look for OpenSSL include files],
40         otp_cflags="$otp_cflags -I$withval")
41
42         dnl ############################################################
43         dnl # Check for libraries
44         dnl ############################################################
45
46         old_LDFLAGS="$LDFLAGS"
47         LDFLAGS="$otp_ldflags $LDFLAGS"
48         AC_CHECK_LIB(ssl, SSL_new, [], [ fail="$fail openssl-libs" ])
49         LDFLAGS="$old_LDFLAGS"
50
51         dnl ############################################################
52         dnl # Check for header files
53         dnl ############################################################
54
55         old_CFLAGS="$CFLAGS"
56         CFLAGS="$CFLAGS $otp_cflags"
57         AC_CHECK_HEADERS( \
58                 openssl/des.h \
59                 openssl/hmac.h \
60                 openssl/md4.h \
61                 openssl/md5.h \
62                 openssl/sha.h,
63                 [],
64                 [ fail="$fail openssl-includes" ]
65         )
66         CFLAGS="$old_CFLAGS"
67
68         targetname=modname     # keep this!  Don't change!
69 else
70         targetname=            # keep this!  Don't change!
71         echo \*\*\* module modname is disabled.  # keep this!  Don't change!
72 fi
73
74 dnl  Don't change this section.
75 if test x"$fail" != x""; then
76         if test x"${enable_strict_dependencies}" = x"yes"; then
77                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
78         else
79                 AC_MSG_WARN([silently not building ]modname[.])
80                 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.])
81                 targetname=""
82         fi
83 fi
84
85 otp_cflags="$otp_cflags -DOTP_MODULE_NAME=\\\"modname\\\" -DFREERADIUS"
86 AC_SUBST(otp_cflags)
87 AC_SUBST(otp_ldflags)
88
89 AC_SUBST(targetname)  # keep this!  Don't change!
90 AC_OUTPUT(Makefile)  # keep this!  Don't change!