#
# Autoconf input file.
#
# Version:	$Id$
#

AC_PREREQ([2.53])
AC_INIT(rlm_eap_ttls.c)
AC_REVISION($Revision$)
AC_DEFUN(modname,[rlm_eap_ttls])

fail=
eap_ttls_ldflags=
eap_ttls_cflags=

if test x$with_[]modname != xno; then

	dnl ############################################################
	dnl # Check for command line options
	dnl ############################################################

	AC_ARG_WITH(rlm-eap-ttls-lib-dir,
	[  --with-rlm-eap-ttls-lib-dir      directory for eap-ttls libs],
	eap_ttls_ldflags="-L$withval")

	AC_ARG_WITH(rlm-eap-ttls-include-dir,
	[  --with-rlm-eap-ttls-include-dir  directory for eap-ttls includes],
	eap_ttls_cflags="-I$withval")

	dnl ############################################################
	dnl # Check for OpenSSL support
	dnl ############################################################

	AC_MSG_CHECKING(for OpenSSL support)
	if test "x$OPENSSL_LIBS" != "x"; then
		AC_MSG_RESULT(yes)
	else
		AC_MSG_RESULT(no)
		fail="OpenSSL"
	fi

	targetname=modname
else
	targetname=
	echo \*\*\* module modname is disabled.
fi

if test x"$fail" != x""; then
	if test x"${enable_strict_dependencies}" = x"yes"; then
		AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
	else
		AC_MSG_WARN([silently not building ]modname[.])
		AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.])
		if test x"$headersuggestion" != x; then
			AC_MSG_WARN([$headersuggestion])
		fi
		if test x"$libsuggestion" != x; then
			AC_MSG_WARN([$libsuggestion])
		fi
		targetname=""
	fi
fi

AC_SUBST(eap_ttls_ldflags)
AC_SUBST(eap_ttls_cflags)
AC_SUBST(targetname)
AC_CONFIG_HEADER([config.h])
AC_OUTPUT(Makefile)
