File: configure.in

package info (click to toggle)
msktutil 0.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 752 kB
  • ctags: 279
  • sloc: cpp: 2,607; perl: 254; xml: 231; ansic: 85; makefile: 49; sh: 44
file content (231 lines) | stat: -rw-r--r-- 6,799 bytes parent folder | download
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.53)
AC_INIT(msktutil, 0.5.1)
AC_CONFIG_HEADER([config.h])

PACKAGE_DATE="October 11, 2013"
PACKAGE_AUTHOR="Ken Dreyer, Mark Pröhl, Olaf Flebbe"
AC_SUBST(PACKAGE_DATE)
AC_SUBST(PACKAGE_AUTHOR)


# Checks for programs.
AC_PROG_CXX
AC_LANG(C++)
AC_PATH_PROGS(INSTALL, install)
AC_PATH_PROGS(CAT, cat)
AC_PATH_PROGS(RM, rm)
AC_PATH_PROGS(CP, cp)
AC_PATH_PROGS(ECHO, echo)
AC_PATH_PROGS(SED, sed)
AC_PATH_PROGS(MKDIR, mkdir)

AC_ARG_WITH(mandir,
[  --with-mandir=DIR       Where to put man pages ($mandir)],
[ mandir="$withval" ])

AC_ARG_WITH(krb5dir,
[  --with-krb5dir=DIR      Where to find the Kerberos 5 includes and libraries],
[ krb5dir="$withval" ])

AC_ARG_WITH(krb5-config,
[  --with-krb5-config=DIR  Where to find the Kerberos 5 configuration script],
[ krb5config="$withval" ])

AC_ARG_WITH(ldapdir,
[  --with-ldapdir=DIR      Where to find the LDAP includes and libraries],
[ ldapdir="$withval" ])

AC_ARG_WITH(sasldir,
[  --with-sasldir=DIR      Where to find the SASL includes and libraries],
[ sasldir="$withval" ])

AC_ARG_WITH(tmpdir,
[  --with-tmpdir=DIR       What temporary directory to use],
[ tmpdir="$withval" ])


# If krb5-config was not specified, try to find it ourselves.
AS_IF([test -z "$krb5config"],
	[AC_PATH_PROG([PATH_KRB5_CONFIG], [krb5-config] [],
		[${PATH}:/usr/kerberos/bin])
	[ krb5config="$PATH_KRB5_CONFIG"]
])

if test -x "$krb5config"; then
  KRB5_CPPFLAGS=`$krb5config --cflags 2>/dev/null`
  KRB5_LIBS=`$krb5config --libs 2>/dev/null`
  CPPFLAGS="$CPPFLAGS $KRB5_CPPFLAGS"
  # We check for -lkrb5 later with AC_CHECK_LIB, so remove that one here.
  KRB5_LIBS=`echo "$KRB5_LIBS" | sed 's%-lkrb5 %%'`
  LIBS="$LIBS $KRB5_LIBS"
else
  AC_MSG_WARN([Could not find a krb5-config program.])
fi

if test "$krb5dir" != ""; then
  if test -d "$krb5dir/include"; then
     CPPFLAGS="$CPPFLAGS -I$krb5dir/include"
  fi  
  if test -d "$krb5dir/lib"; then
     LDFLAGS="$LIBDIRS -L$krb5dir/lib"
  fi
fi
if test "$ldapdir" != ""; then
  if test "$ldapdir" != "$krb5dir"; then
    CPPFLAGS="-I$ldapdir/include $CPPFLAGS"
    LDFLAGS="-L$ldapdir/lib $LDFLAGS"
  fi
fi
if test "$sasldir" != ""; then
  if test "$sasldir" != "$krb5dir"; then
    if test "$sasldir" != "$ldapdir"; then
      CPPFLAGS="-I$sasldir/include $CPPFLAGS"
      LDFLAGS="-L$sasldir/lib $LDFLAGS"
    fi
  fi
fi
if test "$tmpdir" != ""; then
  CPPFLAGS="$CPPFLAGS -DTMP_DIR=\\\"$tmpdir\\\""
fi

AC_CHECK_HEADERS([krb5.h com_err.h heim_err.h])
if test "$ac_cv_header_krb5_h" = "no"; then
  AC_MSG_ERROR([This program cannot be built without krb5.h])
fi

# Fedora, RHEL, Centos has com_err.h in /usr/include/et
AC_CHECK_HEADERS([et/com_err.h])
if test "$ac_cv_header_et_com_err_h" = "yes"; then
   CPPFLAGS="-I/usr/include/et $CPPFLAGS"
   AC_DEFINE(HAVE_COM_ERR_H, 1)
fi

if test "$ac_cv_header_heim_err_h" = "no"; then
  AC_CHECK_HEADERS([heimdal/heim_err.h])
  if test "$ac_cv_header_heimdal_heim_err_h" = "yes"; then
    AC_DEFINE(HEIMDAL, 1, [defined if the kerberos is heimdal])    
  fi
else
  AC_DEFINE(HEIMDAL, 1, [defined if the kerberos is heimdal])
fi

AC_CHECK_HEADERS([sasl.h])
if test "$ac_cv_header_sasl_h" = "no"; then
  AC_CHECK_HEADERS([sasl/sasl.h])
  if test "$ac_cv_header_sasl_sasl_h" = "no"; then
    AC_MSG_ERROR([This program cannot be built without sasl.h])
  fi
fi

# look for resolver functions
# see if ns_initparse is simply in libc or libresolv
AC_SEARCH_LIBS([ns_initparse], [resolv], AC_DEFINE(HAVE_NS_INITPARSE,1) , [
	# On Linux it actually is in libresolv but prefixed with __ when
	# linking dynamically. This is taken care of by actually including the
	# right headers and trying again.
	AC_MSG_CHECKING([for ns_initparse])
	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
		]],[[
	ns_initparse(0, 0, 0);
		]])],
		AC_MSG_RESULT([yes]), [
		# now try libresolv again
		AC_MSG_RESULT([no])
		saved_LIBS="$LIBS"
		LIBS="$LIBS -lresolv"
		AC_MSG_CHECKING([for ns_initparse in -lresolv])
		AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
			]],[[
	ns_initparse(0, 0, 0);
			]])],
			[ AC_DEFINE(HAVE_NS_INITPARSE,1)
			AC_MSG_RESULT([yes])], [
			# glibc versions prior to 2.9 include ns_initparse in
			# libresolve but do not export it. Try to circumvent
			# this restriction by linking the missing bits statically.
			AC_MSG_RESULT([no])
			LIBS="$saved_LIBS -lresolv -Wl,-Bstatic -lresolv -Wl,-Bdynamic"
			AC_MSG_CHECKING([for ns_initparse in statically linked -lresolv])
			AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
				]],[[
	ns_initparse(0, 0, 0);
				]])],
				[AC_DEFINE(HAVE_NS_INITPARSE,1)
				AC_MSG_RESULT([yes])],
				[LIBS="$saved_LIBS"
				AC_MSG_RESULT([no])])])])])

# finally check if res_search is present as well just as a sanity check
AC_MSG_CHECKING([for res_search])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
	]],[[
	res_search(0, 0, 0, 0, 0);
	]])],
	[
	AC_DEFINE(HAVE_RES_SEARCH, 1)
	AC_MSG_RESULT([yes])],
	AC_MSG_RESULT([no]))

# Checks for libraries.
AC_CHECK_LIB([krb5], [krb5_init_context], , [AC_MSG_ERROR([libkrb5 not found])])
AC_CHECK_LIB([ldap], [ldap_initialize], , [AC_MSG_ERROR([libldap not found])])
#
# OpenLDAP's LDAP_OPT_ON macro uses ber_pvt_opt_on. In newer OpenLDAP
# versions, we have to explicitly link with lber.
# AC_CHECK_LIB for ber_pvt_opt_on does not work for HPUX and AIX, since it is data not code
# So link lber unconditionally, if found
# Since OpenLDAP libldap depends on it anyway, no additional dependency added.
#
AC_CHECK_LIB([lber], [ber_alloc], , [AC_MSG_WARN([liblber not found])])
AC_CHECK_LIB([com_err], [error_message], , [AC_MSG_ERROR([libcom_err not found])])

if test "$ac_cv_header_com_err_h"; then
AC_MSG_CHECKING([whether com_err.h needs extern "C"]);

AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h>
#include <com_err.h>

int main(void) {
    error_message(0);
}
])], [AC_MSG_RESULT(no); com_err_needs_extern_c=no], [

AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h>
extern "C" {
#include <com_err.h>
}

int main(void) {
    error_message(0);
}
])], [AC_MSG_RESULT(yes); com_err_needs_extern_c=yes], [AC_MSG_ERROR([Couldn't get error_message to work.])])])

if test "$com_err_needs_extern_c=yes"; then
  AC_DEFINE(COM_ERR_NEEDS_EXTERN_C, 1, [Does com_err.h need extern "C" around it?])
fi
fi

# Check for functions
AC_CHECK_FUNCS(vasprintf vsnprintf setenv strtoll)

# Check that the AES enctypes are found
AC_CHECK_DECLS([ENCTYPE_AES256_CTS_HMAC_SHA1_96, ENCTYPE_AES128_CTS_HMAC_SHA1_96], [], [], [[#include <krb5.h>]])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT