backport from HEAD
[freeradius.git] / src / modules / rlm_krb5 / configure.in
1 AC_INIT(rlm_krb5.c)
2 AC_REVISION($Revision$)
3 AC_DEFUN(modname,[rlm_krb5])
4
5 if test x$with_[]modname != xno; then
6
7         AC_PROG_CC
8         AC_PROG_CPP
9
10         dnl extra argument: --with-rlm-krb5-lib-dir
11         rlm_krb5_lib_dir=
12         AC_ARG_WITH(rlm-krb5-lib-dir,
13         [  --with-rlm-krb5-lib-dir=DIR       Directory for krb5 library files []],
14         [ case "$withval" in
15             no)
16                 AC_MSG_ERROR(Need rlm-krb5-lib-dir)
17                 ;;
18             yes)
19                 ;;
20             *)
21                 rlm_krb5_lib_dir="$withval"
22                 ;;
23           esac ]
24         )
25
26         dnl extra argument: --with-rlm-krb5-include-dir
27         rlm_krb5_inc_dir=
28         AC_ARG_WITH(rlm-krb5-include-dir,
29         [  --with-rlm-krb5-include-dir=DIR   Directory for krb5 include files []],
30         [ case "$withval" in
31             no)
32                 AC_MSG_ERROR(Need rlm-krb5-include-dir)
33                 ;;
34             yes)
35                 ;;
36             *)
37                 rlm_krb5_include_dir="$withval"
38                 ;;
39           esac ]
40         )
41
42        dnl extra argument: --enable-heimdal-krb5
43        AC_ARG_ENABLE(heimdal-krb5,
44        [  --enable-heimdal-krb5             Enable if you have heimdal krb5],
45        [ case "$enableval" in
46                yes)
47                        krb5_h_cflags="-DHEIMDAL_KRB5"
48                        ;;
49          esac ]
50        )
51
52         smart_try_dir=$rlm_krb5_include_dir
53         AC_SMART_CHECK_INCLUDE(krb5.h)
54
55         smart_try_dir=$rlm_krb5_lib_dir
56
57         AC_SMART_CHECK_LIB(k5crypto, krb5_encrypt_data)
58         if test "x$ac_cv_lib_k5crypto_krb5_encrypt_data" = "xyes"; then
59                 krb5libcrypto="-lk5crypto"
60         fi
61
62         AC_SMART_CHECK_LIB(crypto, DH_new)
63         if test "x$ac_cv_lib_crypto_DH_new" = "xyes"; then
64                 krb5libcrypto="-lcrypto"
65         fi
66
67         if test x$krb5libcrypto = x; then
68                 AC_MSG_WARN([neither krb5 'k5crypto' nor 'crypto' libraries are found!])
69         fi
70
71         AC_SMART_CHECK_LIB(com_err, set_com_err_hook)
72         if test "x$ac_cv_lib_com_err_set_com_err_hook" != "xyes"; then
73                 AC_MSG_WARN([the comm_err library isn't found!]) 
74         fi
75
76         AC_SMART_CHECK_LIB(krb5, krb5_init_context)
77         if test "x$ac_cv_lib_krb5_krb5_init_context" != "xyes"; then
78                 fail="$fail krb5"
79         fi
80
81         targetname=modname
82 else
83         targetname=
84         echo \*\*\* module modname is disabled.
85 fi
86
87 if test x"$fail" != x""; then
88         if test x"${enable_strict_dependencies}" = x"yes"; then
89                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
90         else
91                 AC_MSG_WARN([silently not building ]modname[.])
92                 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
93                 targetname=""
94         fi
95 fi
96
97 krb5_ldflags=$SMART_LIBS
98 krb5_cflags="${krb5_h_cflags} $SMART_CFLAGS"
99
100 AC_SUBST(krb5_cflags)
101 AC_SUBST(krb5_ldflags)
102 AC_SUBST(targetname)
103 AC_OUTPUT(Makefile)