summaryrefslogtreecommitdiffstats
path: root/src/modules/rlm_mschap/configure.ac
blob: 953336f475d674ce569d1a873424a117a8176a35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
AC_PREREQ([2.69])
AC_INIT
AC_CONFIG_SRCDIR([rlm_mschap.c])
AC_REVISION($Revision$)
FR_INIT_MODULE([rlm_mschap], [MS-CHAP and MS-CHAPv2 authentication])

FR_MODULE_START_TESTS

AC_PROG_CC
AC_PROG_CPP

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

dnl extra argument: --with-winbind-include-dir=DIR
winbind_include_dir=
AC_ARG_WITH(winbind-include-dir,
	[AS_HELP_STRING([--with-winbind-include-dir=DIR],
		[Directory where the winbind includes may be found])],
	[case "$withval" in
	no)
		AC_MSG_ERROR(Need winbind-include-dir)
		;;
	yes)
		;;
	*)
		winbind_include_dir="$withval"
		;;
	esac])

dnl extra argument: --with-winbind-lib-dir=DIR
winbind_lib_dir=
AC_ARG_WITH(winbind-lib-dir,
	[AS_HELP_STRING([--with-winbind-lib-dir=DIR],
		[Directory where the winbind libraries may be found])],
	[case "$withval" in
	no)
		AC_MSG_ERROR(Need winbind-lib-dir)
		;;
	yes)
		;;
	*)
		winbind_lib_dir="$withval"
		;;
	esac])

dnl extra argument: --with-winbind-dir=DIR
AC_ARG_WITH(winbind-dir,
	[AS_HELP_STRING([--with-winbind-dir=DIR],
		[Base directory where winbind is installed])],
	[case "$withval" in
	no)
		AC_MSG_ERROR(Need winbind-dir)
		;;
	yes)
		;;
	*)
		winbind_lib_dir="$withval/lib"
		winbind_include_dir="$withval/include"
		;;
	esac])


dnl ############################################################
dnl # Check for header files
dnl ############################################################

mschap_sources=
FR_SMART_CHECK_INCLUDE(membership.h)
if test "x$ac_cv_header_membership_h" = "xyes"; then
	AC_DEFINE([HAVE_MEMBERSHIP_H],[1],[Build with Apple Open Directory support])
	mschap_sources="$mschap_sources opendir.c"
	mod_ldflags="-F /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks -framework DirectoryService"
        FR_MODULE_FEATURE([opendirectory], [with opendirectory support])
else
        FR_MODULE_FEATURE([opendirectory], [without opendirectory support])
fi

smart_try_dir="$winbind_include_dir /usr/include/samba-4.0"
FR_SMART_CHECK_INCLUDE(wbclient.h, [#include <stdint.h>
				#include <stdbool.h>])
if test "x$ac_cv_header_wbclient_h" != "xyes"; then
	AC_MSG_WARN([wbclient.h not found. Use --with-winbind-include-dir=<path>.])
	AC_MSG_WARN([silently building without support for direct authentication via winbind. requires: libwbclient])
        FR_MODULE_FEATURE([wbclient], [without direct winbind support])
fi

FR_SMART_CHECK_INCLUDE(core/ntstatus.h, [#include <stdint.h>
				     #include <stdbool.h>])
if test "x$ac_cv_header_core_ntstatus_h" != "xyes"; then
	AC_MSG_WARN([core/ntstatus.h not found. Use --with-winbind-include-dir=<path>.])
	AC_MSG_WARN([silently building without support for direct authentication via winbind. requires: libwbclient])
        FR_MODULE_FEATURE([wbclient], [without direct winbind support])
fi

dnl ############################################################
dnl # Check for libraries
dnl ############################################################

if test "x$ac_cv_header_wbclient_h" = "xyes" && \
	test "x$ac_cv_header_core_ntstatus_h" = "xyes"; then

	smart_try_dir="$winbind_lib_dir"
	FR_SMART_CHECK_LIB(wbclient, wbcCtxAuthenticateUserEx)
	if test "x$ac_cv_lib_wbclient_wbcCtxAuthenticateUserEx" != "xyes"; then
		AC_MSG_WARN([winbind libraries not found. Use --with-winbind-lib-dir=<path>.])
		AC_MSG_WARN([Samba must be version 4.2.1 or higher to use this feature.])
                FR_MODULE_FEATURE([wbclient], [without direct winbind support])
	else
		mschap_sources="$mschap_sources auth_wbclient.c"
		AC_DEFINE([WITH_AUTH_WINBIND],[1],[Build with direct winbind auth support])
                FR_MODULE_FEATURE([wbclient], [with direct winbind support])
	fi
fi

FR_MODULE_END_TESTS

mod_ldflags="$mod_ldflags $SMART_LIBS"
mod_cflags="$SMART_CPPFLAGS"

AC_SUBST(mschap_sources)
AC_SUBST(mod_ldflags)
AC_SUBST(mod_cflags)

AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([rlm_mschap.mk])
AC_OUTPUT