summaryrefslogtreecommitdiffstats
path: root/src/modules/rlm_mschap/configure.ac
blob: 2c0cfb516e20c9d6200eff7484936f4f99de90ca (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
129
130
131
132
133
AC_INIT(rlm_mschap.c)
AC_REVISION($Revision$)
FR_INIT_MODULE([rlm_mschap], [MS-CHAP support])

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

    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"
    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])
    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])
    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.])
      else
        mschap_sources="$mschap_sources auth_wbclient.c"
        AC_DEFINE([WITH_AUTH_WINBIND],[1],[Build with direct winbind auth support])
      fi
    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.]);
		targetname=""
	fi
fi

mod_ldflags="$mod_ldflags $SMART_LIBS"
mod_cflags="$SMART_CPPFLAGS"
AC_SUBST(mschap_sources)
AC_SUBST(mod_ldflags)
AC_SUBST(mod_cflags)
AC_SUBST(targetname)

AC_CONFIG_HEADER(config.h)
AC_OUTPUT(rlm_mschap.mk)