bd3cea49bd33fe9b9690b514a54340537bcdacbf
[freeradius.git] / src / modules / rlm_otp / configure.ac
1 AC_PREREQ([2.53])
2 AC_INIT(rlm_otp.c)
3 AC_REVISION($Revision$)
4 AC_DEFUN(modname,[rlm_otp])
5
6 mod_cflags=
7 mod_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         mod_ldflags="-L$withval $mod_ldflags")
28         AC_ARG_WITH(rlm-otp-include-dir,
29         [  --with-rlm-otp-include-dir    directory for otp includes],
30         mod_cflags="$mod_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         mod_ldflags="-L$withval $mod_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         mod_cflags="$mod_cflags -I$withval")
41
42         dnl ############################################################
43         dnl # Check for libraries
44         dnl ############################################################
45
46         old_LDFLAGS="$LDFLAGS"
47         LDFLAGS="$mod_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 $mod_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
69 else
70         targetname=
71         echo \*\*\* module modname is disabled.
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 AC_SUBST(mod_cflags)
86 AC_SUBST(mod_ldflags)
87
88 AC_SUBST(targetname)
89 AC_OUTPUT(all.mk)