Take advantage of Configure
[freeradius.git] / src / modules / rlm_eap / types / rlm_eap_tls / configure.in
1 AC_INIT(rlm_eap_tls.c)
2 AC_REVISION($Revision$)
3 AC_DEFUN(modname,[rlm_eap_tls])
4
5 fail=
6 SMART_LIBS=
7 SMART_CLFAGS=
8 if test x$with_[]modname != xno; then
9
10         dnl extra argument: --with-rlm-eap-tls-lib-dir
11         rlm_eap_tls_lib_dir=
12         AC_ARG_WITH(rlm-eap-tls-lib-dir,
13         [  --with-rlm-eap-tls-lib-dir=DIR   Directory for EAPTLS library files []],
14         [ case "$withval" in
15             no)
16                 AC_MSG_ERROR(Need rlm-eap-tls-lib-dir)
17                 ;;
18             yes)
19                 ;;
20             *)
21                 rlm_eap_tls_lib_dir="$withval"
22                 ;;
23           esac ]
24         )
25
26         dnl extra argument: --with-rlm-eap-tls-include-dir
27         rlm_eap_tls_inc_dir=
28         AC_ARG_WITH(rlm-eap-tls-include-dir,
29         [ --with-rlm-eap-tls-include-dir=DIR Directory for EAPTLS include files []],
30         [ case "$withval" in
31             no)
32                 AC_MSG_ERROR(Need rlm-eap-tls-include-dir)
33                 ;;
34             yes)
35                 ;;
36             *)
37                 rlm_eap_tls_inc_dir="$withval"
38                 ;;
39           esac ]
40         )
41
42         smart_try_dir=$rlm_eap_tls_inc_dir
43         AC_SMART_CHECK_INCLUDE(openssl/ssl.h)
44         if test "x$ac_cv_header_openssl_ssl_h" != "xyes"; then
45                 fail="$fail (openssl/ssl.h)"
46         fi
47
48         smart_try_dir=$rlm_eap_tls_lib_dir
49         AC_SMART_CHECK_LIB(crypto, DH_new)
50     if test "x$ac_cv_lib_crypto_DH_new" != "xyes"; then
51             fail="$fail libcrypto"
52     fi
53
54         AC_SMART_CHECK_LIB(ssl, SSL_new)
55     if test "x$ac_cv_lib_ssl_SSL_new" != "xyes"; then
56             fail="$fail libssl"
57     fi
58
59         targetname=modname
60 else
61         targetname=
62         echo \*\*\* module modname is disabled.
63 fi
64
65 if test x"$fail" != x""; then
66         if test x"${enable_strict_dependencies}" = x"yes"; then
67                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
68         else
69                 AC_MSG_WARN([silently not building ]modname[.])
70                 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.])
71                 if test x"$headersuggestion" != x; then
72                         AC_MSG_WARN([$headersuggestion]) 
73                 fi
74                 if test x"$libsuggestion" != x; then
75                         AC_MSG_WARN([$libsuggestion]) 
76                 fi
77                 targetname=""
78         fi
79 fi
80
81 eap_tls_ldflags=$SMART_LIBS
82 eap_tls_cflags=$SMART_CFLAGS
83 AC_SUBST(eap_tls_ldflags)
84 AC_SUBST(eap_tls_cflags)
85 AC_SUBST(targetname)
86 AC_OUTPUT(Makefile)