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