1
dnl This program is free software; you can redistribute it and/or modify
2
dnl it under the terms of the GNU General Public License as published by
3
dnl the Free Software Foundation; either version 2 of the License, or
4
dnl (at your option) any later version.
6
dnl This program is distributed in the hope that it will be useful,
7
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
8
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
dnl GNU General Public License for more details.
11
dnl You should have received a copy of the GNU General Public License
12
dnl along with this program; if not, write to the Free Software
13
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
15
dnl Process this file with autoconf to produce a configure script.
18
AC_INIT([squid_kerb_auth],[1.0.5],[markus_moeller@compuserve.com])
19
AM_INIT_AUTOMAKE(squid_kerb_auth,1.0.5)
20
AC_CONFIG_SRCDIR([squid_kerb_auth.c])
25
AC_TRY_COMPILE([int main()
34
Linux) w_flag="-Wl,-R"
37
AIX) w_flag="-Wl,-blibpath:"
38
w_flag_2=":/usr/lib:/lib"
44
5.10|5.11) AC_DEFINE(HAVE_NEW_SEAM_KERBEROS,1,[Define to 1 if you have New Solaris 10/OpenSolaris Kerberos])
49
FreeBSD) w_flag="-Wl,-R"
52
*) w_flag="-Wl,-rpath"
60
if test "x$ac_krb5_config" = "xyes" ; then
61
ac_heimdal=`krb5-config --version 2>/dev/null | grep heimdal`
62
if test "x$ac_heimdal" != "x" ; then
67
AC_DEFINE(HAVE_MIT_KERBEROS,1,[Define to 1 if you have MIT Kerberos])
68
ac_gss_libs="resolv com_err des425 k5crypto krb5 gssapi_krb5"
72
Linux) if test "x$enableval" != "xyes" -a "x$enableval" != "x" -a "x$enableval" != "xno" ; then
73
ac_libdir=$enableval/lib
74
ac_includedir=$enableval/include
76
ac_libdir=`rpm -q -l krb5 2>/dev/null | grep "/libgssapi_krb5" | sed -e 's/\/libgssapi_krb5.*//' | head -1`
77
ac_includedir=`rpm -q -l krb5-devel 2>/dev/null | grep /krb5.h$ | sed -e 's/\/krb5.h//' | head -1`
79
if test "x$ac_includedir" != "x" ; then
80
CPPFLAGS="$CPPFLAGS -I$ac_includedir"
82
ac_gssapi_cflags=`krb5-config --cflags gssapi 2>/dev/null`
83
if test "x$ac_gssapi_cflags" != "x" ; then
84
CPPFLAGS="$CPPFLAGS $ac_gssapi_cflags"
87
AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h gssapi/gssapi_generic.h)
88
if test "x$ac_libdir" != "x" ; then
89
LDFLAGS="$LDFLAGS -L$ac_libdir $w_flag$ac_libdir$w_flag_2"
90
for lib in $ac_gss_libs; do
91
AC_CHECK_LIB($lib,main)
94
ac_gssapi_libs=`krb5-config --libs gssapi 2>/dev/null`
95
if test "x$ac_gssapi_libs" != "x" ; then
96
LDFLAGS="$LDFLAGS $ac_gssapi_libs"
98
for lib in $ac_gss_libs; do
99
AC_CHECK_LIB($lib,main)
104
*) if test "x$enableval" != "xyes" -a "x$enableval" != "x" -a "x$enableval" != "xno" ; then
105
ac_libdir=$enableval/lib
106
ac_includedir=$enableval/include
107
CPPFLAGS="$CPPFLAGS -I$ac_includedir"
108
AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h gssapi/gssapi_generic.h)
109
LDFLAGS="$LDFLAGS -L$ac_libdir $w_flag$ac_libdir$w_flag_2"
110
for lib in $ac_gss_libs; do
111
AC_CHECK_LIB($lib,main)
114
ac_gssapi_cflags=`krb5-config --cflags gssapi 2>/dev/null`
115
if test "x$ac_gssapi_cflags" != "x" ; then
116
CPPFLAGS="$CPPFLAGS $ac_gssapi_cflags"
118
ac_gssapi_libs=`krb5-config --libs gssapi 2>/dev/null`
119
if test "x$ac_gssapi_libs" != "x" ; then
120
LDFLAGS="$LDFLAGS $ac_gssapi_libs"
122
for lib in $ac_gss_libs; do
123
AC_CHECK_LIB($lib,main)
126
AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h gssapi/gssapi_generic.h)
133
if test "x$ac_krb5_config" = "xyes" ; then
134
ac_heimdal=`krb5-config --version 2>/dev/null | grep heimdal`
135
if test "x$ac_heimdal" = "x" ; then
140
AC_DEFINE(HAVE_HEIMDAL_KERBEROS,1,[Define to 1 if you have Heimdal Kerberos])
141
ac_gss_libs="resolv crypto des crypt roken com_err asn1 krb5 gssapi"
145
Linux) if test "x$enableval" != "xyes" -a "x$enableval" != "x" -a "x$enableval" != "xno" ; then
146
ac_libdir=$enableval/lib
147
ac_includedir=$enableval/include
149
ac_libdir=`rpm -q -l heimdal-devel 2>/dev/null | grep "/libroken" | sed -e 's/\/libroken.*//' | head -1`
150
ac_includedir=`rpm -q -l heimdal-devel 2>/dev/null | grep /krb5.h$ | sed -e 's/\/krb5.h//' | head -1`
152
if test "x$ac_includedir" != "x" ; then
153
CPPFLAGS="$CPPFLAGS -I$ac_includedir"
155
ac_gssapi_cflags=`krb5-config --cflags gssapi 2>/dev/null`
156
if test "x$ac_gssapi_cflags" != "x" ; then
157
CPPFLAGS="$CPPFLAGS $ac_gssapi_cflags"
160
AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
161
if test "x$ac_libdir" != "x" ; then
162
LDFLAGS="$LDFLAGS -L$ac_libdir $w_flag$ac_libdir$w_flag_2"
163
for lib in $ac_gss_libs; do
164
AC_CHECK_LIB($lib,main)
167
ac_gssapi_libs=`krb5-config --libs gssapi 2>/dev/null`
168
if test "x$ac_gssapi_libs" != "x" ; then
169
ac_libdir=`echo $ac_gssapi_libs | grep "\-L"`
170
if test "x$ac_libdir" != "x" ; then
171
ac_libdir=`echo $ac_gssapi_libs | sed -e 's/.*-L//' | sed -e 's/ .*//'`
172
LDFLAGS="$LDFLAGS $w_flag$ac_libdir$w_flag_2"
174
LDFLAGS="$LDFLAGS $ac_gssapi_libs"
176
for lib in $ac_gss_libs; do
177
AC_CHECK_LIB($lib,main)
182
*) if test "x$enableval" != "xyes" -a "x$enableval" != "x" -a "x$enableval" != "xno" ; then
183
ac_libdir=$enableval/lib
184
ac_includedir=$enableval/include
185
CPPFLAGS="$CPPFLAGS -I$ac_includedir"
186
AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
187
LDFLAGS="$LDFLAGS -L$ac_libdir $w_flag$ac_libdir$w_flag_2"
188
for lib in $ac_gss_libs; do
189
AC_CHECK_LIB($lib,main)
192
ac_gssapi_cflags=`krb5-config --cflags gssapi 2>/dev/null`
193
if test "x$ac_gssapi_cflags" != "x" ; then
194
CPPFLAGS="$CPPFLAGS $ac_gssapi_cflags"
196
ac_gssapi_libs=`krb5-config --libs gssapi 2>/dev/null`
197
if test "x$ac_gssapi_libs" != "x" ; then
198
ac_libdir=`echo $ac_gssapi_libs | grep "\-L"`
199
if test "x$ac_libdir" != "x" ; then
200
ac_libdir=`echo $ac_gssapi_libs | sed -e 's/.*-L//' | sed -e 's/ .*//'`
201
LDFLAGS="$LDFLAGS $w_flag$ac_libdir$w_flag_2"
203
LDFLAGS="$LDFLAGS $ac_gssapi_libs"
205
for lib in $ac_gss_libs; do
206
AC_CHECK_LIB($lib,main)
209
AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
216
AC_DEFINE(HAVE_NAS_KERBEROS,1,[Define to 1 if you have NAS Kerberos])
217
AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h gssapi/gssapi_generic.h)
218
LDFLAGS="$LDFLAGS -L/usr/lib"
219
ac_gss_libs="krb5 gssapi_krb5 ksvc";
220
for lib in $ac_gss_libs; do
221
AC_CHECK_LIB($lib,main)
233
AC_DEFINE(HAVE_SEAM_KERBEROS,1,[Define to 1 if you have SEAM Kerberos])
234
AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_ext.h)
235
ac_sol_libs="nsl socket resolv gss"
236
for lib in $ac_sol_libs; do
237
AC_CHECK_LIB($lib,main)
242
dnl Define MIT libraries
244
[ --enable-mit[=DIR] enable use of MIT package (default=yes) ],
246
if test "x$enableval" != "xno" ; then
250
dnl Define Heimdal libraries
251
AC_ARG_ENABLE(heimdal,
252
[ --enable-heimdal[=DIR] enable use of Heimdal package (default=no) ],
254
if test "x$enableval" != "xno" ; then
258
dnl Define NAS libraries
260
[ --enable-nas enable use of NAS(AIX) package (default=no) ],
262
if test "x$enableval" != "xno" ; then
266
dnl Define SEAM libraries
268
[ --enable-seam[=SRC] enable use of SEAM(Solaris) package (default=no) ],
270
if test "x$enableval" != "xno" ; then
274
dnl Define SEAM libraries
275
AC_ARG_ENABLE(seam-64,
276
[ --enable-seam-64[=SRC] enable use of 64bit SEAM(Solaris) package (default=no) ],
278
if test "x$enableval" != "xno" ; then
282
dnl Define system default
283
if test "$enable_arg" = "no"; then
284
dnl Autodetect system
285
dnl Check krb5-config first
286
AC_CHECK_PROG(ac_krb5_config,krb5-config,yes,no)
288
Linux) rpm -q heimdal-lib >/dev/null 2>&1
289
if test $? = 0 ; then
295
AIX) lslpp -L krb5.client.rte >/dev/null 2>&1
296
if test $? = 0 ; then
302
SunOS) pkginfo SUNWgss >/dev/null 2>&1
303
if test $? = 0 ; then
309
FreeBSD) check_heimdal
329
AC_CONFIG_HEADER(ska_config.h)
332
* -----------------------------------------------------------------------------
334
* Author: Markus Moeller (|MAIL|)
336
* Copyright (C) 2007 Markus Moeller. All rights reserved.
338
* This program is free software; you can redistribute it and/or modify
339
* it under the terms of the GNU General Public License as published by
340
* the Free Software Foundation; either version 2 of the License, or
341
* (at your option) any later version.
343
* This program is distributed in the hope that it will be useful,
344
* but WITHOUT ANY WARRANTY; without even the implied warranty of
345
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
346
* GNU General Public License for more details.
348
* You should have received a copy of the GNU General Public License
349
* along with this program; if not, write to the Free Software
350
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
352
* As a special exemption, M Moeller gives permission to link this program
353
* with MIT, Heimdal or other GSS/Kerberos libraries, and distribute
354
* the resulting executable, without including the source code for
355
* the Libraries in the source distribution.
357
* -----------------------------------------------------------------------------
363
AC_HELP_STRING([--with-squid=PATH],
364
[Special option for building bundled inside Squid. Do not define manually.]),
365
[ squid_dir=$withval ]
368
CPPFLAGS="$CPPFLAGS -I../../../ -I../../../include/ -I$squid_dir/include -I$squid_dir/src -I$squid_dir"
369
AC_CACHE_CHECK([for SQUID at '$squid_dir' ],ac_cv_have_squid,[
372
int main(int argc, char *argv[]) {
373
#ifdef SQUID_CONFIG_H
379
ac_cv_have_squid=yes,
382
LDFLAGS="$LDFLAGS -L../../../lib"
383
if test "x$ac_cv_have_squid" = "xyes"; then
384
AC_DEFINE(HAVE_SQUID,1, [Define to 1 if you have SQUID])
385
AC_CHECK_HEADERS(getaddrinfo.h getnameinfo.h util.h)
386
AC_CHECK_DECLS([xgetaddrinfo], [], [], [[#include <getaddrinfo.h>]])
387
AC_CHECK_DECLS([xfreeaddrinfo], [], [], [[#include <getaddrinfo.h>]])
388
AC_CHECK_DECLS([xgai_strerror], [], [], [[#include <getaddrinfo.h>]])
389
AC_CHECK_DECLS([xgetnameinfo], [], [], [[#include <getnameinfo.h>]])
390
AC_CHECK_DECLS([xstrdup], [], [], [[#include <util.h>]])
391
AC_CHECK_DECLS([xmalloc], [], [], [[#include <util.h>]])
392
AC_CHECK_DECLS([xfree], [], [], [[#include <util.h>]])
394
AC_CHECK_LIB(mw,main)
395
LIBS="-lmiscutil $LIBS"
396
AH_TOP([ /* This is building inside Squid. We need their config as well. */
397
/* bit of autoconf magic hack */
401
#include "squid_compat.h"
402
#endif /* HAVE_SQUID */
405
/* Squid provides a few compat libraries */
407
#ifdef HAVE_GETADDRINFO_H
408
#include "getaddrinfo.h"
410
#ifdef HAVE_GETNAMEINFO_H
411
#include "getnameinfo.h"
416
#endif /* HAVE_SQUID */
423
#ifdef HAVE_HEIMDAL_KERBEROS
424
#ifdef HAVE_GSSAPI_GSSAPI_H
425
#include <gssapi/gssapi.h>
426
#elif defined(HAVE_GSSAPI_H)
429
#error "GSSAPI header required"
431
#define gss_nt_service_name GSS_C_NT_HOSTBASED_SERVICE
433
#ifdef HAVE_SEAM_KERBEROS
434
#ifdef HAVE_GSSAPI_GSSAPI_H
435
#include <gssapi/gssapi.h>
436
#elif defined(HAVE_GSSAPI_H)
439
#error "GSSAPI header required"
441
#ifdef HAVE_GSSAPI_GSSAPI_EXT_H
442
#include <gssapi/gssapi_ext.h>
444
#define gss_nt_service_name GSS_C_NT_HOSTBASED_SERVICE
446
#ifdef HAVE_GSSAPI_GSSAPI_H
447
#include <gssapi/gssapi.h>
448
#elif defined(HAVE_GSSAPI_H)
451
#error "GSSAPI header required"
453
#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
454
#include <gssapi/gssapi_krb5.h>
456
#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
457
#include <gssapi/gssapi_generic.h>
464
echo "configure: ## -----------------------------##"
466
echo "configure: ## $enable_arg has been selected"
468
echo "configure: ## -----------------------------##"
470
MY_CFLAGS="-Wall -Wextra -Werror -Wcomment -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement -Wshadow"
471
for ac_cv_my_cflag in $MY_CFLAGS; do
476
${CC} $ac_cv_my_cflag -c conftest.c 2>/dev/null
479
if test "$res" = "0"; then
480
CFLAGS="$CFLAGS $ac_cv_my_cflag"
486
echo "configure: updating ska_config.h"
487
sed -e "s/|MAIL|/"$PACKAGE_BUGREPORT"/" ska_config.h > .ska_config.h.tmp
488
mv .ska_config.h.tmp ska_config.h