add support for user-specified include and lib paths
[freeradius.git] / src / modules / rlm_x99_token / configure.in
1 AC_INIT(x99_rlm.c)
2 AC_REVISION($Revision$)
3 AC_DEFUN(modname,[rlm_x99_token])
4
5 if test x$with_[]modname != xno; then
6
7         dnl put configuration checks here.  
8         dnl set $fail to what's missing, on fatal errors.
9         dnl use AC_MSG_WARN() on important messages.
10
11         dnl test for almost-c99 compliant compiler
12         AC_CHECK_HEADER(inttypes.h, ,
13                 [ fail="$fail inttypes.h" ]
14         )
15
16         dnl mostly for openssl
17         AC_ARG_WITH(rlm-x99-token-lib-dir,
18                     AC_HELP_STRING([--with-rlm-x99-token-lib-dir],
19                                    [directory for x99_token libs]),
20                     x99_token_ldflags="$x99_token_ldflags -L$withval")
21         AC_ARG_WITH(rlm-x99-token-include-dir,
22                     AC_HELP_STRING([--with-rlm-x99-token-include-dir],
23                                    [directory for x99_token includes]),
24                     x99_token_cflags="$x99_token_cflags -I$withval")
25
26         dnl openssl
27         x99_save_LIBS="$LIBS"
28         LIBS="$LIBS $x99_token_ldflags"
29         AC_CHECK_LIB(crypto, des_cbc_encrypt,
30                 [ x99_token_ldflags="$x99_token_ldflags -lcrypto" ],
31                 [ fail="$fail des_cbc_encrypt" ]
32         )
33         LIBS="$x99_save_LIBS"
34
35         targetname=modname     # keep this!  Don't change!
36 else
37         targetname=            # keep this!  Don't change!
38         echo \*\*\* module modname is disabled.  # keep this!  Don't change!
39 fi
40
41 dnl  Don't change this section.
42 if test x"$fail" != x""; then
43         if test x"${enable_strict_dependencies}" = x"yes"; then
44                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
45         else
46                 AC_MSG_WARN([silently not building ]modname[.])
47                 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
48                 targetname=""
49         fi
50 fi
51
52 x99_token_cflags="$x99_token_cflags -DX99_MODULE_NAME=\\\"modname\\\""
53 x99_token_cflags="$x99_token_cflags -DFREERADIUS"
54 AC_SUBST(x99_token_cflags)
55 AC_SUBST(x99_token_ldflags)
56
57 dnl AC_CONFIG_HEADER(config.h)
58
59 AC_SUBST(targetname)  # keep this!  Don't change!
60 AC_OUTPUT(Makefile)  # keep this!  Don't change!