backport from HEAD
[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 SMART_CFLAGS=
7 if test x$with_[]modname != xno; then
8
9         dnl put configuration checks here.  
10         dnl set $fail to what's missing, on fatal errors.
11         dnl use AC_MSG_WARN() on important messages.
12
13         dnl test for almost-c99 compliant compiler
14         AC_CHECK_HEADER(inttypes.h, ,
15                 [ fail="$fail inttypes.h" ]
16         )
17
18         dnl mostly for openssl
19         AC_ARG_WITH(rlm-otp-lib-dir,
20                     [  --with-rlm-otp-lib-dir directory for otp libs],
21                     otp_ldflags="$otp_ldflags -L$withval")
22         AC_ARG_WITH(rlm-otp-include-dir,
23                     [  --with-rlm-otp-include-dir directory for otp includes],
24                     otp_cflags="$otp_cflags -I$withval")
25
26         dnl #
27         dnl # extra argument: --openssl-includes=dir
28         dnl #
29         AC_ARG_WITH(openssl-includes,
30         [  --with-openssl-includes=DIR       Directory to look for OpenSSL include files],
31         [ case "$withval" in
32             *)
33                 SMART_CFLAGS="$SMART_CFLAGS -I$withval"
34                 ;;
35           esac ]
36         )
37
38         targetname=modname     # keep this!  Don't change!
39 else
40         targetname=            # keep this!  Don't change!
41         echo \*\*\* module modname is disabled.  # keep this!  Don't change!
42 fi
43
44 dnl  Don't change this section.
45 if test x"$fail" != x""; then
46         if test x"${enable_strict_dependencies}" = x"yes"; then
47                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
48         else
49                 AC_MSG_WARN([silently not building ]modname[.])
50                 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
51                 targetname=""
52         fi
53 fi
54
55 otp_cflags="$otp_cflags -DOTP_MODULE_NAME=\\\"modname\\\" $SMART_CFLAGS"
56 otp_cflags="$otp_cflags -DFREERADIUS"
57 AC_SUBST(otp_cflags)
58 AC_SUBST(otp_ldflags)
59
60 AC_SUBST(targetname)  # keep this!  Don't change!
61 AC_OUTPUT(Makefile)  # keep this!  Don't change!