File: evo_krb5_support.m4

package info (click to toggle)
evolution-data-server 3.22.7-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 62,116 kB
  • ctags: 41,630
  • sloc: ansic: 302,318; makefile: 4,890; sh: 4,182; cpp: 472; xml: 462; perl: 368; python: 71
file content (136 lines) | stat: -rw-r--r-- 3,551 bytes parent folder | download | duplicates (6)
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
134
135
136
dnl EVO_KRB5_SUPPORT(default)
dnl Add --with-krb5, --with-krb5-libs and --with-krb5-include options.
dnl --with-krb5 defaults to the given value if not specified.
#serial 0.2
AC_DEFUN([EVO_KRB5_SUPPORT],[
	dnl ******************************
	dnl Kerberos
	dnl ******************************
	default="$1"
	AC_ARG_WITH([krb5],
		AS_HELP_STRING([--with-krb5=PATH],
		[Location of Kerberos 5 install dir]))

	AC_ARG_WITH([krb5-libs],
		AS_HELP_STRING([--with-krb5-libs=PATH],
		[Location of Kerberos 5 libraries]))

	AC_ARG_WITH([krb5-includes],
		AS_HELP_STRING([--with-krb5-includes=PATH],
		[Location of Kerberos 5 headers]))

	dnl ******************************
	dnl Kerberos 5
	dnl ******************************
	msg_krb5="no"
	AC_MSG_CHECKING([for Kerberos 5])
	with_krb5="${with_krb5:=$default}"
	case $with_krb5 in
		no|"")
			with_krb5=no
			;;
		yes)
			with_krb5=/usr
			;;
		*)
			with_krb5=$with_krb5
			;;
	esac

	if test "x${with_krb5}" != "xno"; then
		LIBS_save="$LIBS"

		case $with_krb5_libs in
			yes|no|"")
				with_krb5_libs=$with_krb5/lib
				;;
			*)
				with_krb5_libs=$with_krb5_libs
				;;
		esac

		case $with_krb5_includes in
			yes|no|"")
				with_krb5_includes=$with_krb5/include
				;;
			*)
				with_krb5_includes=$with_krb5_includes
				;;
		esac

		mitlibs="-lkrb5 -lk5crypto -lcom_err -lgssapi_krb5"
		heimlibs="-lkrb5 -lcrypto -lasn1 -lcom_err -lroken -lgssapi"
		sunlibs="-lkrb5 -lgss"
		AC_CACHE_VAL([ac_cv_lib_kerberos5],
		[
			LIBS="$LIBS -L$with_krb5_libs $mitlibs"
			AC_LINK_IFELSE([AC_LANG_CALL([], [krb5_init_context])],
			[ac_cv_lib_kerberos5="$mitlibs"],
			[
				LIBS="$LIBS_save -L$with_krb5_libs $heimlibs"
				AC_LINK_IFELSE([AC_LANG_CALL([], [krb5_init_context])],
				[ac_cv_lib_kerberos5="$heimlibs"],
				[
					LIBS="$LIBS_save -L$with_krb5_libs $sunlibs"
					AC_LINK_IFELSE([AC_LANG_CALL([], [krb5_init_context])],
					[ac_cv_lib_kerberos5="$sunlibs"], [ac_cv_lib_kerberos5="no"])
				])
			])
			LIBS="$LIBS_save"
		])
		if test "$ac_cv_lib_kerberos5" != "no"; then
			AC_DEFINE(HAVE_KRB5,1,[Define if you have Krb5])
			if test "$ac_cv_lib_kerberos5" = "$mitlibs"; then
				AC_DEFINE(HAVE_MIT_KRB5,1,[Define if you have MIT Krb5])
				if test -z "$with_krb5_includes"; then
					KRB5_CFLAGS="-I$with_krb5/include"
				else
					KRB5_CFLAGS="-I$with_krb5_includes"
				fi
				msg_krb5="yes (MIT)"
			else
				if test "$ac_cv_lib_kerberos5" = "$heimlibs"; then
					AC_DEFINE(HAVE_HEIMDAL_KRB5,1,[Define if you have Heimdal])
					if test -z "$with_krb5_includes"; then
						KRB5_CFLAGS="-I$with_krb5/include/heimdal"
					else
						KRB5_CFLAGS="-I$with_krb5_includes"
					fi
					msg_krb5="yes (Heimdal)"
				else
					AC_DEFINE(HAVE_SUN_KRB5,1,[Define if you have Sun Kerberosv5])
					if test -z "$with_krb5_includes"; then
						KRB5_CFLAGS="-I$with_krb5/include/kerberosv5"
					else
						KRB5_CFLAGS="-I$with_krb5_includes"
					fi
					msg_krb5="yes (Sun)"
				fi
			fi
			KRB5_LIBS="-L$with_krb5_libs $ac_cv_lib_kerberos5"
		else
			AC_MSG_ERROR([You specified with krb5, but it was not found.])
		fi
	else
		msg_krb5="no"
	fi
	AC_MSG_RESULT([$msg_krb5])

	AM_CONDITIONAL(ENABLE_KRB5, [test "x$with_krb5" != "xno"])

	AC_CHECK_HEADER([et/com_err.h],
		[AC_DEFINE([HAVE_ET_COM_ERR_H], 1, [Have <et/com_err.h>])],,
		[[	#if HAVE_ET_COM_ERR_H
			#include <com_err.h>
			#endif
		]])
	AC_CHECK_HEADER([com_err.h],
		[AC_DEFINE([HAVE_COM_ERR_H], 1, [Have <com_err.h>])],,
		[[	#if HAVE_COM_ERR_H
			#include <com_err.h>
			#endif
		]])

	AC_SUBST(KRB5_CFLAGS)
	AC_SUBST(KRB5_LIBS)
])