import cyrus-sasl-2.1.23
[cyrus-sasl.git] / saslauthd / aclocal.m4
1 # generated automatically by aclocal 1.7.9 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 # AM_CONDITIONAL                                              -*- Autoconf -*-
15
16 # Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
17
18 # This program is free software; you can redistribute it and/or modify
19 # it under the terms of the GNU General Public License as published by
20 # the Free Software Foundation; either version 2, or (at your option)
21 # any later version.
22
23 # This program is distributed in the hope that it will be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 # GNU General Public License for more details.
27
28 # You should have received a copy of the GNU General Public License
29 # along with this program; if not, write to the Free Software
30 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
31 # 02111-1307, USA.
32
33 # serial 5
34
35 AC_PREREQ(2.52)
36
37 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
38 # -------------------------------------
39 # Define a conditional.
40 AC_DEFUN([AM_CONDITIONAL],
41 [ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
42         [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
43 AC_SUBST([$1_TRUE])
44 AC_SUBST([$1_FALSE])
45 if $2; then
46   $1_TRUE=
47   $1_FALSE='#'
48 else
49   $1_TRUE='#'
50   $1_FALSE=
51 fi
52 AC_CONFIG_COMMANDS_PRE(
53 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
54   AC_MSG_ERROR([conditional "$1" was never defined.
55 Usually this means the macro was only invoked conditionally.])
56 fi])])
57
58 # Do all the work for Automake.                            -*- Autoconf -*-
59
60 # This macro actually does too much some checks are only needed if
61 # your package does certain things.  But this isn't really a big deal.
62
63 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
64 # Free Software Foundation, Inc.
65
66 # This program is free software; you can redistribute it and/or modify
67 # it under the terms of the GNU General Public License as published by
68 # the Free Software Foundation; either version 2, or (at your option)
69 # any later version.
70
71 # This program is distributed in the hope that it will be useful,
72 # but WITHOUT ANY WARRANTY; without even the implied warranty of
73 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
74 # GNU General Public License for more details.
75
76 # You should have received a copy of the GNU General Public License
77 # along with this program; if not, write to the Free Software
78 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
79 # 02111-1307, USA.
80
81 # serial 10
82
83 AC_PREREQ([2.54])
84
85 # Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
86 # the ones we care about.
87 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
88
89 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
90 # AM_INIT_AUTOMAKE([OPTIONS])
91 # -----------------------------------------------
92 # The call with PACKAGE and VERSION arguments is the old style
93 # call (pre autoconf-2.50), which is being phased out.  PACKAGE
94 # and VERSION should now be passed to AC_INIT and removed from
95 # the call to AM_INIT_AUTOMAKE.
96 # We support both call styles for the transition.  After
97 # the next Automake release, Autoconf can make the AC_INIT
98 # arguments mandatory, and then we can depend on a new Autoconf
99 # release and drop the old call support.
100 AC_DEFUN([AM_INIT_AUTOMAKE],
101 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
102  AC_REQUIRE([AC_PROG_INSTALL])dnl
103 # test to see if srcdir already configured
104 if test "`cd $srcdir && pwd`" != "`pwd`" &&
105    test -f $srcdir/config.status; then
106   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
107 fi
108
109 # test whether we have cygpath
110 if test -z "$CYGPATH_W"; then
111   if (cygpath --version) >/dev/null 2>/dev/null; then
112     CYGPATH_W='cygpath -w'
113   else
114     CYGPATH_W=echo
115   fi
116 fi
117 AC_SUBST([CYGPATH_W])
118
119 # Define the identity of the package.
120 dnl Distinguish between old-style and new-style calls.
121 m4_ifval([$2],
122 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
123  AC_SUBST([PACKAGE], [$1])dnl
124  AC_SUBST([VERSION], [$2])],
125 [_AM_SET_OPTIONS([$1])dnl
126  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
127  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
128
129 _AM_IF_OPTION([no-define],,
130 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
131  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
132
133 # Some tools Automake needs.
134 AC_REQUIRE([AM_SANITY_CHECK])dnl
135 AC_REQUIRE([AC_ARG_PROGRAM])dnl
136 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
137 AM_MISSING_PROG(AUTOCONF, autoconf)
138 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
139 AM_MISSING_PROG(AUTOHEADER, autoheader)
140 AM_MISSING_PROG(MAKEINFO, makeinfo)
141 AM_MISSING_PROG(AMTAR, tar)
142 AM_PROG_INSTALL_SH
143 AM_PROG_INSTALL_STRIP
144 # We need awk for the "check" target.  The system "awk" is bad on
145 # some platforms.
146 AC_REQUIRE([AC_PROG_AWK])dnl
147 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
148 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
149
150 _AM_IF_OPTION([no-dependencies],,
151 [AC_PROVIDE_IFELSE([AC_PROG_CC],
152                   [_AM_DEPENDENCIES(CC)],
153                   [define([AC_PROG_CC],
154                           defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
155 AC_PROVIDE_IFELSE([AC_PROG_CXX],
156                   [_AM_DEPENDENCIES(CXX)],
157                   [define([AC_PROG_CXX],
158                           defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
159 ])
160 ])
161
162
163 # When config.status generates a header, we must update the stamp-h file.
164 # This file resides in the same directory as the config header
165 # that is generated.  The stamp files are numbered to have different names.
166
167 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
168 # loop where config.status creates the headers, so we can generate
169 # our stamp files there.
170 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
171 [# Compute $1's index in $config_headers.
172 _am_stamp_count=1
173 for _am_header in $config_headers :; do
174   case $_am_header in
175     $1 | $1:* )
176       break ;;
177     * )
178       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
179   esac
180 done
181 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
182
183 # Copyright 2002  Free Software Foundation, Inc.
184
185 # This program is free software; you can redistribute it and/or modify
186 # it under the terms of the GNU General Public License as published by
187 # the Free Software Foundation; either version 2, or (at your option)
188 # any later version.
189
190 # This program is distributed in the hope that it will be useful,
191 # but WITHOUT ANY WARRANTY; without even the implied warranty of
192 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
193 # GNU General Public License for more details.
194
195 # You should have received a copy of the GNU General Public License
196 # along with this program; if not, write to the Free Software
197 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
198
199 # AM_AUTOMAKE_VERSION(VERSION)
200 # ----------------------------
201 # Automake X.Y traces this macro to ensure aclocal.m4 has been
202 # generated from the m4 files accompanying Automake X.Y.
203 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
204
205 # AM_SET_CURRENT_AUTOMAKE_VERSION
206 # -------------------------------
207 # Call AM_AUTOMAKE_VERSION so it can be traced.
208 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
209 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
210          [AM_AUTOMAKE_VERSION([1.7.9])])
211
212 # Helper functions for option handling.                    -*- Autoconf -*-
213
214 # Copyright 2001, 2002  Free Software Foundation, Inc.
215
216 # This program is free software; you can redistribute it and/or modify
217 # it under the terms of the GNU General Public License as published by
218 # the Free Software Foundation; either version 2, or (at your option)
219 # any later version.
220
221 # This program is distributed in the hope that it will be useful,
222 # but WITHOUT ANY WARRANTY; without even the implied warranty of
223 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
224 # GNU General Public License for more details.
225
226 # You should have received a copy of the GNU General Public License
227 # along with this program; if not, write to the Free Software
228 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
229 # 02111-1307, USA.
230
231 # serial 2
232
233 # _AM_MANGLE_OPTION(NAME)
234 # -----------------------
235 AC_DEFUN([_AM_MANGLE_OPTION],
236 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
237
238 # _AM_SET_OPTION(NAME)
239 # ------------------------------
240 # Set option NAME.  Presently that only means defining a flag for this option.
241 AC_DEFUN([_AM_SET_OPTION],
242 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
243
244 # _AM_SET_OPTIONS(OPTIONS)
245 # ----------------------------------
246 # OPTIONS is a space-separated list of Automake options.
247 AC_DEFUN([_AM_SET_OPTIONS],
248 [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
249
250 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
251 # -------------------------------------------
252 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
253 AC_DEFUN([_AM_IF_OPTION],
254 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
255
256 #
257 # Check to make sure that the build environment is sane.
258 #
259
260 # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
261
262 # This program is free software; you can redistribute it and/or modify
263 # it under the terms of the GNU General Public License as published by
264 # the Free Software Foundation; either version 2, or (at your option)
265 # any later version.
266
267 # This program is distributed in the hope that it will be useful,
268 # but WITHOUT ANY WARRANTY; without even the implied warranty of
269 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
270 # GNU General Public License for more details.
271
272 # You should have received a copy of the GNU General Public License
273 # along with this program; if not, write to the Free Software
274 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
275 # 02111-1307, USA.
276
277 # serial 3
278
279 # AM_SANITY_CHECK
280 # ---------------
281 AC_DEFUN([AM_SANITY_CHECK],
282 [AC_MSG_CHECKING([whether build environment is sane])
283 # Just in case
284 sleep 1
285 echo timestamp > conftest.file
286 # Do `set' in a subshell so we don't clobber the current shell's
287 # arguments.  Must try -L first in case configure is actually a
288 # symlink; some systems play weird games with the mod time of symlinks
289 # (eg FreeBSD returns the mod time of the symlink's containing
290 # directory).
291 if (
292    set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
293    if test "$[*]" = "X"; then
294       # -L didn't work.
295       set X `ls -t $srcdir/configure conftest.file`
296    fi
297    rm -f conftest.file
298    if test "$[*]" != "X $srcdir/configure conftest.file" \
299       && test "$[*]" != "X conftest.file $srcdir/configure"; then
300
301       # If neither matched, then we have a broken ls.  This can happen
302       # if, for instance, CONFIG_SHELL is bash and it inherits a
303       # broken ls alias from the environment.  This has actually
304       # happened.  Such a system could not be considered "sane".
305       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
306 alias in your environment])
307    fi
308
309    test "$[2]" = conftest.file
310    )
311 then
312    # Ok.
313    :
314 else
315    AC_MSG_ERROR([newly created file is older than distributed files!
316 Check your system clock])
317 fi
318 AC_MSG_RESULT(yes)])
319
320 #  -*- Autoconf -*-
321
322
323 # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
324
325 # This program is free software; you can redistribute it and/or modify
326 # it under the terms of the GNU General Public License as published by
327 # the Free Software Foundation; either version 2, or (at your option)
328 # any later version.
329
330 # This program is distributed in the hope that it will be useful,
331 # but WITHOUT ANY WARRANTY; without even the implied warranty of
332 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
333 # GNU General Public License for more details.
334
335 # You should have received a copy of the GNU General Public License
336 # along with this program; if not, write to the Free Software
337 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
338 # 02111-1307, USA.
339
340 # serial 3
341
342 # AM_MISSING_PROG(NAME, PROGRAM)
343 # ------------------------------
344 AC_DEFUN([AM_MISSING_PROG],
345 [AC_REQUIRE([AM_MISSING_HAS_RUN])
346 $1=${$1-"${am_missing_run}$2"}
347 AC_SUBST($1)])
348
349
350 # AM_MISSING_HAS_RUN
351 # ------------------
352 # Define MISSING if not defined so far and test if it supports --run.
353 # If it does, set am_missing_run to use it, otherwise, to nothing.
354 AC_DEFUN([AM_MISSING_HAS_RUN],
355 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
356 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
357 # Use eval to expand $SHELL
358 if eval "$MISSING --run true"; then
359   am_missing_run="$MISSING --run "
360 else
361   am_missing_run=
362   AC_MSG_WARN([`missing' script is too old or missing])
363 fi
364 ])
365
366 # AM_AUX_DIR_EXPAND
367
368 # Copyright 2001 Free Software Foundation, Inc.
369
370 # This program is free software; you can redistribute it and/or modify
371 # it under the terms of the GNU General Public License as published by
372 # the Free Software Foundation; either version 2, or (at your option)
373 # any later version.
374
375 # This program is distributed in the hope that it will be useful,
376 # but WITHOUT ANY WARRANTY; without even the implied warranty of
377 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
378 # GNU General Public License for more details.
379
380 # You should have received a copy of the GNU General Public License
381 # along with this program; if not, write to the Free Software
382 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
383 # 02111-1307, USA.
384
385 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
386 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
387 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
388 #
389 # Of course, Automake must honor this variable whenever it calls a
390 # tool from the auxiliary directory.  The problem is that $srcdir (and
391 # therefore $ac_aux_dir as well) can be either absolute or relative,
392 # depending on how configure is run.  This is pretty annoying, since
393 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
394 # source directory, any form will work fine, but in subdirectories a
395 # relative path needs to be adjusted first.
396 #
397 # $ac_aux_dir/missing
398 #    fails when called from a subdirectory if $ac_aux_dir is relative
399 # $top_srcdir/$ac_aux_dir/missing
400 #    fails if $ac_aux_dir is absolute,
401 #    fails when called from a subdirectory in a VPATH build with
402 #          a relative $ac_aux_dir
403 #
404 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
405 # are both prefixed by $srcdir.  In an in-source build this is usually
406 # harmless because $srcdir is `.', but things will broke when you
407 # start a VPATH build or use an absolute $srcdir.
408 #
409 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
410 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
411 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
412 # and then we would define $MISSING as
413 #   MISSING="\${SHELL} $am_aux_dir/missing"
414 # This will work as long as MISSING is not called from configure, because
415 # unfortunately $(top_srcdir) has no meaning in configure.
416 # However there are other variables, like CC, which are often used in
417 # configure, and could therefore not use this "fixed" $ac_aux_dir.
418 #
419 # Another solution, used here, is to always expand $ac_aux_dir to an
420 # absolute PATH.  The drawback is that using absolute paths prevent a
421 # configured tree to be moved without reconfiguration.
422
423 # Rely on autoconf to set up CDPATH properly.
424 AC_PREREQ([2.50])
425
426 AC_DEFUN([AM_AUX_DIR_EXPAND], [
427 # expand $ac_aux_dir to an absolute path
428 am_aux_dir=`cd $ac_aux_dir && pwd`
429 ])
430
431 # AM_PROG_INSTALL_SH
432 # ------------------
433 # Define $install_sh.
434
435 # Copyright 2001 Free Software Foundation, Inc.
436
437 # This program is free software; you can redistribute it and/or modify
438 # it under the terms of the GNU General Public License as published by
439 # the Free Software Foundation; either version 2, or (at your option)
440 # any later version.
441
442 # This program is distributed in the hope that it will be useful,
443 # but WITHOUT ANY WARRANTY; without even the implied warranty of
444 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
445 # GNU General Public License for more details.
446
447 # You should have received a copy of the GNU General Public License
448 # along with this program; if not, write to the Free Software
449 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
450 # 02111-1307, USA.
451
452 AC_DEFUN([AM_PROG_INSTALL_SH],
453 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
454 install_sh=${install_sh-"$am_aux_dir/install-sh"}
455 AC_SUBST(install_sh)])
456
457 # AM_PROG_INSTALL_STRIP
458
459 # Copyright 2001 Free Software Foundation, Inc.
460
461 # This program is free software; you can redistribute it and/or modify
462 # it under the terms of the GNU General Public License as published by
463 # the Free Software Foundation; either version 2, or (at your option)
464 # any later version.
465
466 # This program is distributed in the hope that it will be useful,
467 # but WITHOUT ANY WARRANTY; without even the implied warranty of
468 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
469 # GNU General Public License for more details.
470
471 # You should have received a copy of the GNU General Public License
472 # along with this program; if not, write to the Free Software
473 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
474 # 02111-1307, USA.
475
476 # One issue with vendor `install' (even GNU) is that you can't
477 # specify the program used to strip binaries.  This is especially
478 # annoying in cross-compiling environments, where the build's strip
479 # is unlikely to handle the host's binaries.
480 # Fortunately install-sh will honor a STRIPPROG variable, so we
481 # always use install-sh in `make install-strip', and initialize
482 # STRIPPROG with the value of the STRIP variable (set by the user).
483 AC_DEFUN([AM_PROG_INSTALL_STRIP],
484 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
485 # Installed binaries are usually stripped using `strip' when the user
486 # run `make install-strip'.  However `strip' might not be the right
487 # tool to use in cross-compilation environments, therefore Automake
488 # will honor the `STRIP' environment variable to overrule this program.
489 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
490 if test "$cross_compiling" != no; then
491   AC_CHECK_TOOL([STRIP], [strip], :)
492 fi
493 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
494 AC_SUBST([INSTALL_STRIP_PROGRAM])])
495
496 #                                                          -*- Autoconf -*-
497 # Copyright (C) 2003  Free Software Foundation, Inc.
498
499 # This program is free software; you can redistribute it and/or modify
500 # it under the terms of the GNU General Public License as published by
501 # the Free Software Foundation; either version 2, or (at your option)
502 # any later version.
503
504 # This program is distributed in the hope that it will be useful,
505 # but WITHOUT ANY WARRANTY; without even the implied warranty of
506 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
507 # GNU General Public License for more details.
508
509 # You should have received a copy of the GNU General Public License
510 # along with this program; if not, write to the Free Software
511 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
512 # 02111-1307, USA.
513
514 # serial 1
515
516 # Check whether the underlying file-system supports filenames
517 # with a leading dot.  For instance MS-DOS doesn't.
518 AC_DEFUN([AM_SET_LEADING_DOT],
519 [rm -rf .tst 2>/dev/null
520 mkdir .tst 2>/dev/null
521 if test -d .tst; then
522   am__leading_dot=.
523 else
524   am__leading_dot=_
525 fi
526 rmdir .tst 2>/dev/null
527 AC_SUBST([am__leading_dot])])
528
529 # serial 5                                              -*- Autoconf -*-
530
531 # Copyright (C) 1999, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.
532
533 # This program is free software; you can redistribute it and/or modify
534 # it under the terms of the GNU General Public License as published by
535 # the Free Software Foundation; either version 2, or (at your option)
536 # any later version.
537
538 # This program is distributed in the hope that it will be useful,
539 # but WITHOUT ANY WARRANTY; without even the implied warranty of
540 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
541 # GNU General Public License for more details.
542
543 # You should have received a copy of the GNU General Public License
544 # along with this program; if not, write to the Free Software
545 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
546 # 02111-1307, USA.
547
548
549 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
550 # written in clear, in which case automake, when reading aclocal.m4,
551 # will think it sees a *use*, and therefore will trigger all it's
552 # C support machinery.  Also note that it means that autoscan, seeing
553 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
554
555
556
557 # _AM_DEPENDENCIES(NAME)
558 # ----------------------
559 # See how the compiler implements dependency checking.
560 # NAME is "CC", "CXX", "GCJ", or "OBJC".
561 # We try a few techniques and use that to set a single cache variable.
562 #
563 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
564 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
565 # dependency, and given that the user is not expected to run this macro,
566 # just rely on AC_PROG_CC.
567 AC_DEFUN([_AM_DEPENDENCIES],
568 [AC_REQUIRE([AM_SET_DEPDIR])dnl
569 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
570 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
571 AC_REQUIRE([AM_DEP_TRACK])dnl
572
573 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
574        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
575        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
576        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
577                    [depcc="$$1"   am_compiler_list=])
578
579 AC_CACHE_CHECK([dependency style of $depcc],
580                [am_cv_$1_dependencies_compiler_type],
581 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
582   # We make a subdir and do the tests there.  Otherwise we can end up
583   # making bogus files that we don't know about and never remove.  For
584   # instance it was reported that on HP-UX the gcc test will end up
585   # making a dummy file named `D' -- because `-MD' means `put the output
586   # in D'.
587   mkdir conftest.dir
588   # Copy depcomp to subdir because otherwise we won't find it if we're
589   # using a relative directory.
590   cp "$am_depcomp" conftest.dir
591   cd conftest.dir
592   # We will build objects and dependencies in a subdirectory because
593   # it helps to detect inapplicable dependency modes.  For instance
594   # both Tru64's cc and ICC support -MD to output dependencies as a
595   # side effect of compilation, but ICC will put the dependencies in
596   # the current directory while Tru64 will put them in the object
597   # directory.
598   mkdir sub
599
600   am_cv_$1_dependencies_compiler_type=none
601   if test "$am_compiler_list" = ""; then
602      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
603   fi
604   for depmode in $am_compiler_list; do
605     # Setup a source with many dependencies, because some compilers
606     # like to wrap large dependency lists on column 80 (with \), and
607     # we should not choose a depcomp mode which is confused by this.
608     #
609     # We need to recreate these files for each test, as the compiler may
610     # overwrite some of them when testing with obscure command lines.
611     # This happens at least with the AIX C compiler.
612     : > sub/conftest.c
613     for i in 1 2 3 4 5 6; do
614       echo '#include "conftst'$i'.h"' >> sub/conftest.c
615       : > sub/conftst$i.h
616     done
617     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
618
619     case $depmode in
620     nosideeffect)
621       # after this tag, mechanisms are not by side-effect, so they'll
622       # only be used when explicitly requested
623       if test "x$enable_dependency_tracking" = xyes; then
624         continue
625       else
626         break
627       fi
628       ;;
629     none) break ;;
630     esac
631     # We check with `-c' and `-o' for the sake of the "dashmstdout"
632     # mode.  It turns out that the SunPro C++ compiler does not properly
633     # handle `-M -o', and we need to detect this.
634     if depmode=$depmode \
635        source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
636        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
637        $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
638          >/dev/null 2>conftest.err &&
639        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
640        grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
641        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
642       # icc doesn't choke on unknown options, it will just issue warnings
643       # (even with -Werror).  So we grep stderr for any message
644       # that says an option was ignored.
645       if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
646         am_cv_$1_dependencies_compiler_type=$depmode
647         break
648       fi
649     fi
650   done
651
652   cd ..
653   rm -rf conftest.dir
654 else
655   am_cv_$1_dependencies_compiler_type=none
656 fi
657 ])
658 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
659 AM_CONDITIONAL([am__fastdep$1], [
660   test "x$enable_dependency_tracking" != xno \
661   && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
662 ])
663
664
665 # AM_SET_DEPDIR
666 # -------------
667 # Choose a directory name for dependency files.
668 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
669 AC_DEFUN([AM_SET_DEPDIR],
670 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
671 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
672 ])
673
674
675 # AM_DEP_TRACK
676 # ------------
677 AC_DEFUN([AM_DEP_TRACK],
678 [AC_ARG_ENABLE(dependency-tracking,
679 [  --disable-dependency-tracking Speeds up one-time builds
680   --enable-dependency-tracking  Do not reject slow dependency extractors])
681 if test "x$enable_dependency_tracking" != xno; then
682   am_depcomp="$ac_aux_dir/depcomp"
683   AMDEPBACKSLASH='\'
684 fi
685 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
686 AC_SUBST([AMDEPBACKSLASH])
687 ])
688
689 # Generate code to set up dependency tracking.   -*- Autoconf -*-
690
691 # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
692
693 # This program is free software; you can redistribute it and/or modify
694 # it under the terms of the GNU General Public License as published by
695 # the Free Software Foundation; either version 2, or (at your option)
696 # any later version.
697
698 # This program is distributed in the hope that it will be useful,
699 # but WITHOUT ANY WARRANTY; without even the implied warranty of
700 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
701 # GNU General Public License for more details.
702
703 # You should have received a copy of the GNU General Public License
704 # along with this program; if not, write to the Free Software
705 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
706 # 02111-1307, USA.
707
708 #serial 2
709
710 # _AM_OUTPUT_DEPENDENCY_COMMANDS
711 # ------------------------------
712 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
713 [for mf in $CONFIG_FILES; do
714   # Strip MF so we end up with the name of the file.
715   mf=`echo "$mf" | sed -e 's/:.*$//'`
716   # Check whether this is an Automake generated Makefile or not.
717   # We used to match only the files named `Makefile.in', but
718   # some people rename them; so instead we look at the file content.
719   # Grep'ing the first line is not enough: some people post-process
720   # each Makefile.in and add a new line on top of each file to say so.
721   # So let's grep whole file.
722   if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
723     dirpart=`AS_DIRNAME("$mf")`
724   else
725     continue
726   fi
727   grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
728   # Extract the definition of DEP_FILES from the Makefile without
729   # running `make'.
730   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
731   test -z "$DEPDIR" && continue
732   # When using ansi2knr, U may be empty or an underscore; expand it
733   U=`sed -n -e '/^U = / s///p' < "$mf"`
734   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
735   # We invoke sed twice because it is the simplest approach to
736   # changing $(DEPDIR) to its actual value in the expansion.
737   for file in `sed -n -e '
738     /^DEP_FILES = .*\\\\$/ {
739       s/^DEP_FILES = //
740       :loop
741         s/\\\\$//
742         p
743         n
744         /\\\\$/ b loop
745       p
746     }
747     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
748        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
749     # Make sure the directory exists.
750     test -f "$dirpart/$file" && continue
751     fdir=`AS_DIRNAME(["$file"])`
752     AS_MKDIR_P([$dirpart/$fdir])
753     # echo "creating $dirpart/$file"
754     echo '# dummy' > "$dirpart/$file"
755   done
756 done
757 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
758
759
760 # AM_OUTPUT_DEPENDENCY_COMMANDS
761 # -----------------------------
762 # This macro should only be invoked once -- use via AC_REQUIRE.
763 #
764 # This code is only required when automatic dependency tracking
765 # is enabled.  FIXME.  This creates each `.P' file that we will
766 # need in order to bootstrap the dependency handling code.
767 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
768 [AC_CONFIG_COMMANDS([depfiles],
769      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
770      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
771 ])
772
773 # Check to see how 'make' treats includes.      -*- Autoconf -*-
774
775 # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
776
777 # This program is free software; you can redistribute it and/or modify
778 # it under the terms of the GNU General Public License as published by
779 # the Free Software Foundation; either version 2, or (at your option)
780 # any later version.
781
782 # This program is distributed in the hope that it will be useful,
783 # but WITHOUT ANY WARRANTY; without even the implied warranty of
784 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
785 # GNU General Public License for more details.
786
787 # You should have received a copy of the GNU General Public License
788 # along with this program; if not, write to the Free Software
789 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
790 # 02111-1307, USA.
791
792 # serial 2
793
794 # AM_MAKE_INCLUDE()
795 # -----------------
796 # Check to see how make treats includes.
797 AC_DEFUN([AM_MAKE_INCLUDE],
798 [am_make=${MAKE-make}
799 cat > confinc << 'END'
800 am__doit:
801         @echo done
802 .PHONY: am__doit
803 END
804 # If we don't find an include directive, just comment out the code.
805 AC_MSG_CHECKING([for style of include used by $am_make])
806 am__include="#"
807 am__quote=
808 _am_result=none
809 # First try GNU make style include.
810 echo "include confinc" > confmf
811 # We grep out `Entering directory' and `Leaving directory'
812 # messages which can occur if `w' ends up in MAKEFLAGS.
813 # In particular we don't look at `^make:' because GNU make might
814 # be invoked under some other name (usually "gmake"), in which
815 # case it prints its new name instead of `make'.
816 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
817    am__include=include
818    am__quote=
819    _am_result=GNU
820 fi
821 # Now try BSD make style include.
822 if test "$am__include" = "#"; then
823    echo '.include "confinc"' > confmf
824    if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
825       am__include=.include
826       am__quote="\""
827       _am_result=BSD
828    fi
829 fi
830 AC_SUBST([am__include])
831 AC_SUBST([am__quote])
832 AC_MSG_RESULT([$_am_result])
833 rm -f confinc confmf
834 ])
835
836 dnl init_automake.m4--cmulocal automake setup macro
837 dnl Rob Earhart
838 dnl $Id: init_automake.m4,v 1.4 2003/10/08 20:35:24 rjs3 Exp $
839
840 AC_DEFUN([CMU_INIT_AUTOMAKE], [
841         AC_REQUIRE([AM_INIT_AUTOMAKE])
842         ACLOCAL="$ACLOCAL -I \$(top_srcdir)/cmulocal"
843         ])
844
845 dnl
846 dnl $Id: c-attribute.m4,v 1.3 2003/10/08 20:35:24 rjs3 Exp $
847 dnl
848
849 dnl
850 dnl Test for __attribute__
851 dnl
852
853 AC_DEFUN([CMU_C___ATTRIBUTE__], [
854 AC_MSG_CHECKING(for __attribute__)
855 AC_CACHE_VAL(ac_cv___attribute__, [
856 AC_TRY_COMPILE([
857 #include <stdlib.h>
858 ],
859 [
860 static void foo(void) __attribute__ ((noreturn));
861
862 static void
863 foo(void)
864 {
865   exit(1);
866 }
867 ],
868 ac_cv___attribute__=yes,
869 ac_cv___attribute__=no)])
870 if test "$ac_cv___attribute__" = "yes"; then
871   AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
872 fi
873 AC_MSG_RESULT($ac_cv___attribute__)
874 ])
875
876
877 dnl
878 dnl Additional macros for configure.in packaged up for easier theft.
879 dnl $Id: cyrus.m4,v 1.4 2003/10/08 20:35:24 rjs3 Exp $
880 dnl tjs@andrew.cmu.edu 6-may-1998
881 dnl
882
883 dnl It would be good if ANDREW_ADD_LIBPATH could detect if something was
884 dnl already there and not redundantly add it if it is.
885
886 dnl add -L(arg), and possibly (runpath switch)(arg), to LDFLAGS
887 dnl (so the runpath for shared libraries is set).
888 AC_DEFUN([CMU_ADD_LIBPATH], [
889   # this is CMU ADD LIBPATH
890   if test "$andrew_runpath_switch" = "none" ; then
891         LDFLAGS="-L$1 ${LDFLAGS}"
892   else
893         LDFLAGS="-L$1 $andrew_runpath_switch$1 ${LDFLAGS}"
894   fi
895 ])
896
897 dnl add -L(1st arg), and possibly (runpath switch)(1st arg), to (2nd arg)
898 dnl (so the runpath for shared libraries is set).
899 AC_DEFUN([CMU_ADD_LIBPATH_TO], [
900   # this is CMU ADD LIBPATH TO
901   if test "$andrew_runpath_switch" = "none" ; then
902         $2="-L$1 ${$2}"
903   else
904         $2="-L$1 ${$2} $andrew_runpath_switch$1"
905   fi
906 ])
907
908 dnl runpath initialization
909 AC_DEFUN([CMU_GUESS_RUNPATH_SWITCH], [
910    # CMU GUESS RUNPATH SWITCH
911   AC_CACHE_CHECK(for runpath switch, andrew_runpath_switch, [
912     # first, try -R
913     SAVE_LDFLAGS="${LDFLAGS}"
914     LDFLAGS="-R /usr/lib"
915     AC_TRY_LINK([],[],[andrew_runpath_switch="-R"], [
916         LDFLAGS="-Wl,-rpath,/usr/lib"
917     AC_TRY_LINK([],[],[andrew_runpath_switch="-Wl,-rpath,"],
918     [andrew_runpath_switch="none"])
919     ])
920   LDFLAGS="${SAVE_LDFLAGS}"
921   ])])
922
923 dnl bsd_sockets.m4--which socket libraries do we need? 
924 dnl Derrick Brashear
925 dnl from Zephyr
926 dnl $Id: bsd_sockets.m4,v 1.10 2005/04/26 19:14:07 shadow Exp $
927
928 dnl Hacked on by Rob Earhart to not just toss stuff in LIBS
929 dnl It now puts everything required for sockets into LIB_SOCKET
930
931 AC_DEFUN([CMU_SOCKETS], [
932         save_LIBS="$LIBS"
933         LIB_SOCKET=""
934         AC_CHECK_FUNC(connect, :,
935                 AC_CHECK_LIB(nsl, gethostbyname,
936                              LIB_SOCKET="-lnsl $LIB_SOCKET")
937                 AC_CHECK_LIB(socket, connect,
938                              LIB_SOCKET="-lsocket $LIB_SOCKET")
939         )
940         LIBS="$LIB_SOCKET $save_LIBS"
941         AC_CHECK_FUNC(res_search, :,
942                 LIBS="-lresolv $LIB_SOCKET $save_LIBS"
943                 AC_TRY_LINK([[
944 #include <sys/types.h>
945 #include <netinet/in.h>
946 #include <arpa/nameser.h>
947 #ifdef HAVE_ARPA_NAMESER_COMPAT_H
948 #include <arpa/nameser_compat.h>
949 #endif
950 #include <resolv.h>]],[[
951 const char host[12]="openafs.org";
952 u_char ans[1024];
953 res_search( host, C_IN, T_MX, (u_char *)&ans, sizeof(ans));
954 return 0;
955 ]], LIB_SOCKET="-lresolv $LIB_SOCKET")
956         )
957         LIBS="$LIB_SOCKET $save_LIBS"
958         AC_CHECK_FUNCS(dn_expand dns_lookup)
959         LIBS="$save_LIBS"
960         AC_SUBST(LIB_SOCKET)
961         ])
962
963 dnl
964 dnl macros for configure.in to detect openssl
965 dnl $Id: openssl.m4,v 1.11 2006/05/17 18:30:19 murch Exp $
966 dnl
967
968 AC_DEFUN([CMU_HAVE_OPENSSL], [
969 AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
970 AC_ARG_WITH(openssl,[  --with-openssl=PATH     use OpenSSL from PATH],
971         with_openssl=$withval, with_openssl="yes")
972
973         save_CPPFLAGS=$CPPFLAGS
974         save_LDFLAGS=$LDFLAGS
975
976         if test -d $with_openssl; then
977           CPPFLAGS="${CPPFLAGS} -I${with_openssl}/include"
978           CMU_ADD_LIBPATH(${with_openssl}/$CMU_LIB_SUBDIR)
979         fi
980
981 case "$with_openssl" in
982         no)
983           with_openssl="no";;
984         *) 
985           dnl if openssl has been compiled with the rsaref2 libraries,
986           dnl we need to include the rsaref libraries in the crypto check
987                 LIB_RSAREF=""
988                 AC_CHECK_LIB(rsaref, RSAPublicEncrypt,
989                         cmu_have_rsaref=yes;
990                         [AC_CHECK_LIB(RSAglue, RSAPublicEncrypt,
991                                 LIB_RSAREF="-lRSAglue -lrsaref",
992                                 LIB_RSAREF="-lrsaref")],
993                         cmu_have_rsaref=no)
994
995                 AC_CHECK_HEADER(openssl/evp.h, [
996                         AC_CHECK_LIB(crypto, EVP_DigestInit,
997                                         with_openssl="yes",
998                                         with_openssl="no", $LIB_RSAREF)],
999                         with_openssl=no)
1000                 ;;
1001 esac
1002
1003         if test "$with_openssl" != "no"; then
1004                 AC_DEFINE(HAVE_OPENSSL,[],[Do we have OpenSSL?])
1005         else
1006                 CPPFLAGS=$save_CPPFLAGS
1007                 LDFLAGS=$save_LDFLAGS
1008         fi
1009 ])
1010
1011 dnl $Id: common.m4,v 1.13 2006/02/25 18:29:46 cg2v Exp $
1012
1013 AC_DEFUN([CMU_TEST_LIBPATH], [
1014 changequote(<<, >>)
1015 define(<<CMU_AC_CV_FOUND>>, translit(ac_cv_found_$2_lib, <<- *>>, <<__p>>))
1016 changequote([, ])
1017 if test "$CMU_AC_CV_FOUND" = "yes"; then
1018   if test \! -r "$1/lib$2.a" -a \! -r "$1/lib$2.so" -a \! -r "$1/lib$2.sl" -a \! -r "$1/lib$2.dylib"; then
1019     CMU_AC_CV_FOUND=no
1020   fi
1021 fi
1022 ])
1023
1024 AC_DEFUN([CMU_TEST_INCPATH], [
1025 changequote(<<, >>)
1026 define(<<CMU_AC_CV_FOUND>>, translit(ac_cv_found_$2_inc, [ *], [_p]))
1027 changequote([, ])
1028 if test "$CMU_AC_CV_FOUND" = "yes"; then
1029   if test \! -r "$1/$2.h"; then
1030     CMU_AC_CV_FOUND=no
1031   fi
1032 fi
1033 ])
1034
1035 dnl CMU_CHECK_HEADER_NOCACHE(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1036 AC_DEFUN([CMU_CHECK_HEADER_NOCACHE],
1037 [dnl Do the transliteration at runtime so arg 1 can be a shell variable.
1038 ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
1039 AC_MSG_CHECKING([for $1])
1040 AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes",
1041   eval "ac_cv_header_$ac_safe=no")
1042 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1043   AC_MSG_RESULT(yes)
1044   ifelse([$2], , :, [$2])
1045 else
1046   AC_MSG_RESULT(no)
1047 ifelse([$3], , , [$3
1048 ])dnl
1049 fi
1050 ])
1051
1052 AC_DEFUN([CMU_FIND_LIB_SUBDIR],
1053 [dnl
1054 AC_ARG_WITH([lib-subdir], AC_HELP_STRING([--with-lib-subdir=DIR],[Find libraries in DIR instead of lib]))
1055 AC_CHECK_SIZEOF(long)
1056 AC_CACHE_CHECK([what directory libraries are found in], [ac_cv_cmu_lib_subdir],
1057 [test "X$with_lib_subdir" = "Xyes" && with_lib_subdir=
1058 test "X$with_lib_subdir" = "Xno" && with_lib_subdir=
1059 if test "X$with_lib_subdir" = "X" ; then
1060   ac_cv_cmu_lib_subdir=lib
1061   if test $ac_cv_sizeof_long -eq 4 ; then
1062     test -d /usr/lib32 && ac_cv_cmu_lib_subdir=lib32
1063   fi
1064   if test $ac_cv_sizeof_long -eq 8 ; then
1065     test -d /usr/lib64 && ac_cv_cmu_lib_subdir=lib64
1066   fi
1067 else
1068   ac_cv_cmu_lib_subdir=$with_lib_subdir
1069 fi])
1070 AC_SUBST(CMU_LIB_SUBDIR, $ac_cv_cmu_lib_subdir)
1071 ])
1072
1073 dnl checking for kerberos 4 libraries (and DES)
1074
1075 AC_DEFUN([SASL_DES_CHK], [
1076 AC_ARG_WITH(des, [  --with-des=DIR          with DES (look in DIR) [yes] ],
1077         with_des=$withval,
1078         with_des=yes)
1079
1080 LIB_DES=""
1081 if test "$with_des" != no; then
1082   if test -d $with_des; then
1083     CPPFLAGS="$CPPFLAGS -I${with_des}/include"
1084     LDFLAGS="$LDFLAGS -L${with_des}/lib"
1085   fi
1086
1087   if test "$with_openssl" != no; then
1088     dnl check for openssl installing -lcrypto, then make vanilla check
1089     AC_CHECK_LIB(crypto, des_cbc_encrypt, [
1090         AC_CHECK_HEADER(openssl/des.h, [AC_DEFINE(WITH_SSL_DES,[],[Use OpenSSL DES Implementation])
1091                                        LIB_DES="-lcrypto";
1092                                        with_des=yes],
1093                        with_des=no)],
1094         with_des=no, $LIB_RSAREF)
1095
1096     dnl same test again, different symbol name
1097     if test "$with_des" = no; then
1098       AC_CHECK_LIB(crypto, DES_cbc_encrypt, [
1099         AC_CHECK_HEADER(openssl/des.h, [AC_DEFINE(WITH_SSL_DES,[],[Use OpenSSL DES Implementation])
1100                                        LIB_DES="-lcrypto";
1101                                        with_des=yes],
1102                        with_des=no)],
1103         with_des=no, $LIB_RSAREF)
1104     fi
1105   fi
1106
1107   if test "$with_des" = no; then
1108     AC_CHECK_LIB(des, des_cbc_encrypt, [LIB_DES="-ldes";
1109                                         with_des=yes], with_des=no)
1110   fi
1111
1112   if test "$with_des" = no; then
1113      AC_CHECK_LIB(des425, des_cbc_encrypt, [LIB_DES="-ldes425";
1114                                        with_des=yes], with_des=no)
1115   fi
1116
1117   if test "$with_des" = no; then
1118      AC_CHECK_LIB(des524, des_cbc_encrypt, [LIB_DES="-ldes524";
1119                                        with_des=yes], with_des=no)
1120   fi
1121
1122   if test "$with_des" = no; then
1123     dnl if openssl is around, we might be able to use that for des
1124
1125     dnl if openssl has been compiled with the rsaref2 libraries,
1126     dnl we need to include the rsaref libraries in the crypto check
1127     LIB_RSAREF=""
1128     AC_CHECK_LIB(rsaref, RSAPublicEncrypt,
1129                  LIB_RSAREF="-lRSAglue -lrsaref"; cmu_have_rsaref=yes,
1130                  cmu_have_rsaref=no)
1131
1132     AC_CHECK_LIB(crypto, des_cbc_encrypt, [
1133         AC_CHECK_HEADER(openssl/des.h, [AC_DEFINE(WITH_SSL_DES,[],[Use OpenSSL DES Implementation])
1134                                         LIB_DES="-lcrypto";
1135                                         with_des=yes],
1136                         with_des=no)], 
1137         with_des=no, $LIB_RSAREF)
1138   fi
1139 fi
1140
1141 if test "$with_des" != no; then
1142   AC_DEFINE(WITH_DES,[],[Use DES])
1143 fi
1144
1145 AC_SUBST(LIB_DES)
1146 ])
1147
1148 AC_DEFUN([SASL_KERBEROS_V4_CHK], [
1149   AC_REQUIRE([SASL_DES_CHK])
1150
1151   AC_ARG_ENABLE(krb4, [  --enable-krb4           enable KERBEROS_V4 authentication [[no]] ],
1152     krb4=$enableval,
1153     krb4=no)
1154
1155   if test "$krb4" != no; then
1156     dnl In order to compile kerberos4, we need libkrb and libdes.
1157     dnl (We've already gotten libdes from SASL_DES_CHK)
1158     dnl we might need -lresolv for kerberos
1159     AC_CHECK_LIB(resolv,res_search)
1160
1161     dnl if we were ambitious, we would look more aggressively for the
1162     dnl krb4 install
1163     if test -d ${krb4}; then
1164        AC_CACHE_CHECK(for Kerberos includes, cyrus_krbinclude, [
1165          for krbhloc in include/kerberosIV include/kerberos include
1166          do
1167            if test -f ${krb4}/${krbhloc}/krb.h ; then
1168              cyrus_krbinclude=${krb4}/${krbhloc}
1169              break
1170            fi
1171          done
1172          ])
1173
1174        if test -n "${cyrus_krbinclude}"; then
1175          CPPFLAGS="$CPPFLAGS -I${cyrus_krbinclude}"
1176        fi
1177        LDFLAGS="$LDFLAGS -L$krb4/lib"
1178     fi
1179
1180     if test "$with_des" != no; then
1181       AC_CHECK_HEADER(krb.h, [
1182         AC_CHECK_LIB(com_err, com_err, [
1183           AC_CHECK_LIB(krb, krb_mk_priv,
1184                      [COM_ERR="-lcom_err"; SASL_KRB_LIB="-lkrb"; krb4lib="yes"],
1185                      krb4lib=no, $LIB_DES -lcom_err)], [
1186           AC_CHECK_LIB(krb, krb_mk_priv,
1187                      [COM_ERR=""; SASL_KRB_LIB="-lkrb"; krb4lib="yes"],
1188                      krb4lib=no, $LIB_DES)])], krb4="no")
1189
1190       if test "$krb4" != "no" -a "$krb4lib" = "no"; then
1191         AC_CHECK_LIB(krb4, krb_mk_priv,
1192                      [COM_ERR=""; SASL_KRB_LIB="-lkrb4"; krb4=yes],
1193                      krb4=no, $LIB_DES)
1194       fi
1195       if test "$krb4" = no; then
1196           AC_WARN(No Kerberos V4 found)
1197       fi
1198     else
1199       AC_WARN(No DES library found for Kerberos V4 support)
1200       krb4=no
1201     fi
1202   fi
1203
1204   if test "$krb4" != no; then
1205     cmu_save_LIBS="$LIBS"
1206     LIBS="$LIBS $SASL_KRB_LIB"
1207     AC_CHECK_FUNCS(krb_get_err_text)
1208     LIBS="$cmu_save_LIBS"
1209   fi
1210
1211   AC_MSG_CHECKING(KERBEROS_V4)
1212   if test "$krb4" != no; then
1213     AC_MSG_RESULT(enabled)
1214     SASL_MECHS="$SASL_MECHS libkerberos4.la"
1215     SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/kerberos4.c"
1216     SASL_STATIC_OBJS="$SASL_STATIC_OBJS kerberos4.o"
1217     AC_DEFINE(STATIC_KERBEROS4,[],[User KERBEROS_V4 Staticly])
1218     AC_DEFINE(HAVE_KRB,[],[Do we have Kerberos 4 Support?])
1219     SASL_KRB_LIB="$SASL_KRB_LIB $LIB_DES $COM_ERR"
1220   else
1221     AC_MSG_RESULT(disabled)
1222   fi
1223   AC_SUBST(SASL_KRB_LIB)
1224 ])
1225
1226
1227 # sasl2.m4--sasl2 libraries and includes
1228 # Rob Siemborski
1229 # $Id: sasl2.m4,v 1.52 2006/05/18 19:25:00 murch Exp $
1230
1231 # SASL2_CRYPT_CHK
1232 # ---------------
1233 AC_DEFUN([SASL_GSSAPI_CHK],
1234 [AC_REQUIRE([SASL2_CRYPT_CHK])
1235 AC_REQUIRE([CMU_SOCKETS])
1236 AC_ARG_ENABLE([gssapi],
1237               [AC_HELP_STRING([--enable-gssapi=<DIR>],
1238                               [enable GSSAPI authentication [yes]])],
1239               [gssapi=$enableval],
1240               [gssapi=yes])
1241 AC_ARG_WITH([gss_impl],
1242             [AC_HELP_STRING([--with-gss_impl={heimdal|mit|cybersafe|seam|auto}],
1243                             [choose specific GSSAPI implementation [[auto]]])],
1244             [gss_impl=$withval],
1245             [gss_impl=auto])
1246
1247 if test "$gssapi" != no; then
1248   platform=
1249   case "${host}" in
1250     *-*-linux*)
1251       platform=__linux
1252       ;;
1253     *-*-hpux*)
1254       platform=__hpux
1255       ;;
1256     *-*-irix*)
1257       platform=__irix
1258       ;;
1259     *-*-solaris2*)
1260 # When should we use __sunos?
1261       platform=__solaris
1262       ;;
1263     *-*-aix*)
1264       platform=__aix
1265       ;;
1266     *)
1267       AC_WARN([The system type is not recognized. If you believe that CyberSafe GSSAPI works on this platform, please update the configure script])
1268       if test "$gss_impl" = "cybersafe"; then
1269         AC_ERROR([CyberSafe was forced, cannot continue as platform is not supported])
1270       fi
1271       ;;
1272   esac
1273
1274   cmu_saved_CPPFLAGS=$CPPFLAGS
1275
1276   if test -d ${gssapi}; then
1277     CPPFLAGS="$CPPFLAGS -I$gssapi/include"
1278 # We want to keep -I in our CPPFLAGS, but only if we succeed
1279     cmu_saved_CPPFLAGS=$CPPFLAGS
1280     LDFLAGS="$LDFLAGS -L$gssapi/lib"
1281
1282     if test -n "$platform"; then
1283       if test "$gss_impl" = "auto" -o "$gss_impl" = "cybersafe"; then
1284         CPPFLAGS="$CPPFLAGS -D$platform"
1285         if test -d "${gssapi}/appsec-sdk/include"; then
1286           CPPFLAGS="$CPPFLAGS -I${gssapi}/appsec-sdk/include"
1287         fi
1288       fi
1289     fi
1290   fi
1291   AC_CHECK_HEADER([gssapi.h],
1292                   [AC_DEFINE(HAVE_GSSAPI_H,,
1293                              [Define if you have the gssapi.h header file])],
1294                   [AC_CHECK_HEADER([gssapi/gssapi.h],,
1295                                    [AC_WARN([Disabling GSSAPI - no include files found]); gssapi=no])])
1296
1297   CPPFLAGS=$cmu_saved_CPPFLAGS
1298
1299 fi
1300
1301 if test "$gssapi" != no; then
1302   # We need to find out which gssapi implementation we are
1303   # using. Supported alternatives are: MIT Kerberos 5,
1304   # Heimdal Kerberos 5 (http://www.pdc.kth.se/heimdal),
1305   # CyberSafe Kerberos 5 (http://www.cybersafe.com/)
1306   # and Sun SEAM (http://wwws.sun.com/software/security/kerberos/)
1307   #
1308   # The choice is reflected in GSSAPIBASE_LIBS
1309
1310   AC_CHECK_LIB(resolv,res_search)
1311   if test -d ${gssapi}; then
1312      gssapi_dir="${gssapi}/lib"
1313      GSSAPIBASE_LIBS="-L$gssapi_dir"
1314      GSSAPIBASE_STATIC_LIBS="-L$gssapi_dir"
1315   else
1316      # FIXME: This is only used for building cyrus, and then only as
1317      # a real hack.  it needs to be fixed.
1318      gssapi_dir="/usr/local/lib"
1319   fi
1320
1321   # Check a full link against the Heimdal libraries.
1322   # If this fails, check a full link against the MIT libraries.
1323   # If this fails, check a full link against the CyberSafe libraries.
1324   # If this fails, check a full link against the Solaris 8 and up libgss.
1325
1326   if test "$gss_impl" = "auto" -o "$gss_impl" = "heimdal"; then
1327     gss_failed=0
1328     AC_CHECK_LIB(gssapi,gss_unwrap,gss_impl="heimdal",gss_failed=1,
1329                  ${GSSAPIBASE_LIBS} -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err ${LIB_SOCKET})
1330     if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
1331       gss_impl="failed"
1332     fi
1333   fi
1334
1335   if test "$gss_impl" = "auto" -o "$gss_impl" = "mit"; then
1336     # check for libkrb5support first
1337     AC_CHECK_LIB(krb5support,krb5int_getspecific,K5SUP=-lkrb5support K5SUPSTATIC=$gssapi_dir/libkrb5support.a,,${LIB_SOCKET})
1338
1339     gss_failed=0
1340     AC_CHECK_LIB(gssapi_krb5,gss_unwrap,gss_impl="mit",gss_failed=1,
1341                  ${GSSAPIBASE_LIBS} -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err ${K5SUP} ${LIB_SOCKET})
1342     if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
1343       gss_impl="failed"
1344     fi
1345   fi
1346
1347   # For Cybersafe one has to set a platform define in order to make compilation work
1348   if test "$gss_impl" = "auto" -o "$gss_impl" = "cybersafe"; then
1349
1350     cmu_saved_CPPFLAGS=$CPPFLAGS
1351     cmu_saved_GSSAPIBASE_LIBS=$GSSAPIBASE_LIBS
1352 # FIXME - Note that the libraries are in .../lib64 for 64bit kernels
1353     if test -d "${gssapi}/appsec-rt/lib"; then
1354       GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -L${gssapi}/appsec-rt/lib"
1355     fi
1356     CPPFLAGS="$CPPFLAGS -D$platform"
1357     if test -d "${gssapi}/appsec-sdk/include"; then
1358       CPPFLAGS="$CPPFLAGS -I${gssapi}/appsec-sdk/include"
1359     fi
1360
1361     gss_failed=0
1362
1363 # Check for CyberSafe with two libraries first, than fall back to a single 
1364 # library (older CyberSafe)
1365
1366     unset ac_cv_lib_gss_csf_gss_acq_user
1367     AC_CHECK_LIB(gss,csf_gss_acq_user,gss_impl="cybersafe03",
1368                  [unset ac_cv_lib_gss_csf_gss_acq_user;
1369                   AC_CHECK_LIB(gss,csf_gss_acq_user,gss_impl="cybersafe",
1370                                gss_failed=1,$GSSAPIBASE_LIBS -lgss)],
1371                  [${GSSAPIBASE_LIBS} -lgss -lcstbk5])
1372
1373     if test "$gss_failed" = "1"; then
1374 # Restore variables
1375       GSSAPIBASE_LIBS=$cmu_saved_GSSAPIBASE_LIBS
1376       CPPFLAGS=$cmu_saved_CPPFLAGS
1377
1378       if test "$gss_impl" != "auto"; then
1379         gss_impl="failed"
1380       fi
1381     fi
1382   fi
1383
1384   if test "$gss_impl" = "auto" -o "$gss_impl" = "seam"; then
1385     gss_failed=0
1386     AC_CHECK_LIB(gss,gss_unwrap,gss_impl="seam",gss_failed=1,-lgss)
1387     if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
1388       gss_impl="failed"
1389     fi
1390   fi
1391
1392   if test "$gss_impl" = "mit"; then
1393     GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err ${K5SUP}"
1394     GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_LIBS $gssapi_dir/libgssapi_krb5.a $gssapi_dir/libkrb5.a $gssapi_dir/libk5crypto.a $gssapi_dir/libcom_err.a ${K5SUPSTATIC}"
1395   elif test "$gss_impl" = "heimdal"; then
1396     CPPFLAGS="$CPPFLAGS -DKRB5_HEIMDAL"
1397     GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err"
1398     GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_STATIC_LIBS $gssapi_dir/libgssapi.a $gssapi_dir/libkrb5.a $gssapi_dir/libasn1.a $gssapi_dir/libroken.a $gssapi_dir/libcom_err.a ${LIB_CRYPT}"
1399   elif test "$gss_impl" = "cybersafe03"; then
1400 # Version of CyberSafe with two libraries
1401     CPPFLAGS="$CPPFLAGS -D$platform -I${gssapi}/appsec-sdk/include"
1402     GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgss -lcstbk5"
1403     # there is no static libgss for CyberSafe
1404     GSSAPIBASE_STATIC_LIBS=none
1405   elif test "$gss_impl" = "cybersafe"; then
1406     CPPFLAGS="$CPPFLAGS -D$platform -I${gssapi}/appsec-sdk/include"
1407     GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgss"
1408     # there is no static libgss for CyberSafe
1409     GSSAPIBASE_STATIC_LIBS=none
1410   elif test "$gss_impl" = "seam"; then
1411     GSSAPIBASE_LIBS=-lgss
1412     # there is no static libgss on Solaris 8 and up
1413     GSSAPIBASE_STATIC_LIBS=none
1414   elif test "$gss_impl" = "failed"; then
1415     gssapi="no"
1416     GSSAPIBASE_LIBS=
1417     GSSAPIBASE_STATIC_LIBS=
1418     AC_WARN([Disabling GSSAPI - specified library not found])
1419   else
1420     gssapi="no"
1421     GSSAPIBASE_LIBS=
1422     GSSAPIBASE_STATIC_LIBS=
1423     AC_WARN([Disabling GSSAPI - no library])
1424   fi
1425 fi
1426
1427 #
1428 # Cybersafe defines both GSS_C_NT_HOSTBASED_SERVICE and GSS_C_NT_USER_NAME
1429 # in gssapi\rfckrb5.h
1430 #
1431 if test "$gssapi" != "no"; then
1432   if test "$gss_impl" = "cybersafe" -o "$gss_impl" = "cybersafe03"; then
1433     AC_EGREP_CPP(hostbased_service_gss_nt_yes,
1434                  [#include <gssapi/gssapi.h>
1435                   #ifdef GSS_C_NT_HOSTBASED_SERVICE
1436                     hostbased_service_gss_nt_yes
1437                   #endif],
1438                  [AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,
1439                             [Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE])],
1440                  [AC_WARN([Cybersafe define not found])])
1441
1442   elif test "$ac_cv_header_gssapi_h" = "yes"; then
1443     AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h,
1444                     [AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,
1445                                [Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE])])
1446   elif test "$ac_cv_header_gssapi_gssapi_h"; then
1447     AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h,
1448                     [AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,
1449                                [Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE])])
1450   fi
1451
1452   if test "$gss_impl" = "cybersafe" -o "$gss_impl" = "cybersafe03"; then
1453     AC_EGREP_CPP(user_name_yes_gss_nt,
1454                  [#include <gssapi/gssapi.h>
1455                   #ifdef GSS_C_NT_USER_NAME
1456                    user_name_yes_gss_nt
1457                   #endif],
1458                  [AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,
1459                             [Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME])],
1460                  [AC_WARN([Cybersafe define not found])])
1461   elif test "$ac_cv_header_gssapi_h" = "yes"; then
1462     AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi.h,
1463                     [AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,
1464                                [Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME])])
1465   elif test "$ac_cv_header_gssapi_gssapi_h"; then
1466     AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi/gssapi.h,
1467                     [AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,
1468                                [Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME])])
1469   fi
1470 fi
1471
1472 GSSAPI_LIBS=""
1473 AC_MSG_CHECKING([GSSAPI])
1474 if test "$gssapi" != no; then
1475   AC_MSG_RESULT([with implementation ${gss_impl}])
1476   AC_CHECK_LIB(resolv,res_search,GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lresolv")
1477   SASL_MECHS="$SASL_MECHS libgssapiv2.la"
1478   SASL_STATIC_OBJS="$SASL_STATIC_OBJS gssapi.o"
1479   SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/gssapi.c"
1480
1481   cmu_save_LIBS="$LIBS"
1482   LIBS="$LIBS $GSSAPIBASE_LIBS"
1483   AC_CHECK_FUNCS(gsskrb5_register_acceptor_identity)
1484   LIBS="$cmu_save_LIBS"
1485 else
1486   AC_MSG_RESULT([disabled])
1487 fi
1488 AC_SUBST(GSSAPI_LIBS)
1489 AC_SUBST(GSSAPIBASE_LIBS)
1490 ])# SASL_GSSAPI_CHK
1491
1492
1493 # SASL_SET_GSSAPI_LIBS
1494 # --------------------
1495 AC_DEFUN([SASL_SET_GSSAPI_LIBS],
1496 [SASL_GSSAPI_LIBS_SET="yes"
1497 ])
1498
1499
1500 # CMU_SASL2
1501 # ---------
1502 # What we want to do here is setup LIB_SASL with what one would
1503 # generally want to have (e.g. if static is requested, make it that,
1504 # otherwise make it dynamic.
1505 #
1506 # We also want to create LIB_DYN_SASL and DYNSASLFLAGS.
1507 #
1508 # Also sets using_static_sasl to "no" "static" or "staticonly"
1509 #
1510 AC_DEFUN([CMU_SASL2],
1511 [AC_REQUIRE([SASL_GSSAPI_CHK])
1512
1513 AC_ARG_WITH(sasl,
1514             [AC_HELP_STRING([--with-sasl=DIR],[Compile with libsasl2 in <DIR>])],
1515             with_sasl="$withval",
1516             with_sasl="yes")
1517
1518 AC_ARG_WITH(staticsasl,
1519             [AC_HELP_STRING([--with-staticsasl=DIR],
1520                             [Compile with staticly linked libsasl2 in <DIR>])],
1521             [with_staticsasl="$withval";
1522              if test $with_staticsasl != "no"; then
1523                using_static_sasl="static"
1524              fi],
1525             [with_staticsasl="no"; using_static_sasl="no"])
1526
1527 SASLFLAGS=""
1528 LIB_SASL=""
1529
1530 cmu_saved_CPPFLAGS=$CPPFLAGS
1531 cmu_saved_LDFLAGS=$LDFLAGS
1532 cmu_saved_LIBS=$LIBS
1533
1534 if test ${with_staticsasl} != "no"; then
1535   if test -d ${with_staticsasl}; then
1536     if test -d ${with_staticsasl}/lib64 ; then
1537       ac_cv_sasl_where_lib=${with_staticsasl}/lib64
1538     else
1539       ac_cv_sasl_where_lib=${with_staticsasl}/lib
1540     fi
1541     ac_cv_sasl_where_lib=${with_staticsasl}/lib
1542     ac_cv_sasl_where_inc=${with_staticsasl}/include
1543
1544     SASLFLAGS="-I$ac_cv_sasl_where_inc"
1545     LIB_SASL="-L$ac_cv_sasl_where_lib"
1546     CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}"
1547     LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}"
1548   else
1549     with_staticsasl="/usr"
1550   fi
1551
1552   AC_CHECK_HEADER(sasl/sasl.h,
1553                   [AC_CHECK_HEADER(sasl/saslutil.h,
1554                                    [for i42 in lib64 lib; do
1555                                       if test -r ${with_staticsasl}/$i42/libsasl2.a; then
1556                                         ac_cv_found_sasl=yes
1557                                         AC_MSG_CHECKING([for static libsasl])
1558                                         LIB_SASL="$LIB_SASL ${with_staticsasl}/$i42/libsasl2.a"
1559                                       fi
1560                                     done
1561                                     if test ! "$ac_cv_found_sasl" = "yes"; then
1562                                       AC_MSG_CHECKING([for static libsasl])
1563                                       AC_ERROR([Could not find ${with_staticsasl}/lib*/libsasl2.a])
1564                                     fi])])
1565
1566   AC_MSG_RESULT([found])
1567
1568   if test "x$SASL_GSSAPI_LIBS_SET" = "x"; then
1569     LIB_SASL="$LIB_SASL $GSSAPIBASE_STATIC_LIBS"
1570   else
1571     SASL_GSSAPI_LIBS_SET=""
1572     cmu_saved_LIBS="$GSSAPIBASE_STATIC_LIBS $cmu_saved_LIBS" 
1573   fi
1574 fi
1575
1576 if test -d ${with_sasl}; then
1577   ac_cv_sasl_where_lib=${with_sasl}/lib
1578   ac_cv_sasl_where_inc=${with_sasl}/include
1579
1580   DYNSASLFLAGS="-I$ac_cv_sasl_where_inc"
1581   if test "$ac_cv_sasl_where_lib" != ""; then
1582     CMU_ADD_LIBPATH_TO($ac_cv_sasl_where_lib, LIB_DYN_SASL)
1583   fi
1584   LIB_DYN_SASL="$LIB_DYN_SASL -lsasl2"
1585   CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}"
1586   LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}"
1587 fi
1588
1589 # be sure to check for a SASLv2 specific function
1590 AC_CHECK_HEADER(sasl/sasl.h,
1591                 [AC_CHECK_HEADER(sasl/saslutil.h,
1592                                  [AC_CHECK_LIB(sasl2, prop_get, 
1593                                                ac_cv_found_sasl=yes,
1594                                                ac_cv_found_sasl=no)],
1595                                  ac_cv_found_sasl=no)],
1596                 ac_cv_found_sasl=no)
1597
1598 if test "$ac_cv_found_sasl" = "yes"; then
1599   if test "$ac_cv_sasl_where_lib" != ""; then
1600     CMU_ADD_LIBPATH_TO($ac_cv_sasl_where_lib, DYNLIB_SASL)
1601   fi
1602   DYNLIB_SASL="$DYNLIB_SASL -lsasl2"
1603   if test "$using_static_sasl" != "static"; then
1604     LIB_SASL=$DYNLIB_SASL
1605     SASLFLAGS=$DYNSASLFLAGS
1606   fi
1607 else
1608   DYNLIB_SASL=""
1609   DYNSASLFLAGS=""
1610   using_static_sasl="staticonly"
1611 fi
1612
1613 if test "x$SASL_GSSAPI_LIBS_SET" != "x"; then
1614   SASL_GSSAPI_LIBS_SET=""
1615   cmu_saved_LIBS="$GSSAPIBASE_LIBS $cmu_saved_LIBS" 
1616 fi
1617
1618 LIBS="$cmu_saved_LIBS"
1619 LDFLAGS="$cmu_saved_LDFLAGS"
1620 CPPFLAGS="$cmu_saved_CPPFLAGS"
1621
1622 AC_SUBST(LIB_DYN_SASL)
1623 AC_SUBST(DYNSASLFLAGS)
1624 AC_SUBST(LIB_SASL)
1625 AC_SUBST(SASLFLAGS)
1626 ])# CMU_SASL2
1627
1628
1629 # CMU_SASL2_REQUIRED
1630 # ------------------
1631 AC_DEFUN([CMU_SASL2_REQUIRED],
1632 [AC_REQUIRE([CMU_SASL2])
1633 if test "$ac_cv_found_sasl" != "yes"; then
1634   AC_ERROR([Cannot continue without libsasl2.
1635 Get it from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/.])
1636 fi])
1637
1638
1639 # CMU_SASL2_REQUIRE_VER
1640 # ---------------------
1641 AC_DEFUN([CMU_SASL2_REQUIRE_VER],
1642 [AC_REQUIRE([CMU_SASL2_REQUIRED])
1643
1644 cmu_saved_CPPFLAGS=$CPPFLAGS
1645 CPPFLAGS="$CPPFLAGS $SASLFLAGS"
1646
1647 AC_TRY_CPP([
1648 #include <sasl/sasl.h>
1649
1650 #ifndef SASL_VERSION_MAJOR
1651 #error SASL_VERSION_MAJOR not defined
1652 #endif
1653 #ifndef SASL_VERSION_MINOR
1654 #error SASL_VERSION_MINOR not defined
1655 #endif
1656 #ifndef SASL_VERSION_STEP
1657 #error SASL_VERSION_STEP not defined
1658 #endif
1659
1660 #if SASL_VERSION_MAJOR < $1 || SASL_VERSION_MINOR < $2 || SASL_VERSION_STEP < $3
1661 #error SASL version is less than $1.$2.$3
1662 #endif
1663 ],,
1664            [AC_ERROR([Incorrect SASL headers found.  This package requires SASL $1.$2.$3 or newer.])])
1665
1666 CPPFLAGS=$cmu_saved_CPPFLAGS
1667 ])# CMU_SASL2_REQUIRE_VER
1668
1669
1670 # CMU_SASL2_CHECKAPOP_REQUIRED
1671 # ----------------------------
1672 AC_DEFUN([CMU_SASL2_CHECKAPOP_REQUIRED],
1673 [AC_REQUIRE([CMU_SASL2_REQUIRED])
1674
1675 cmu_saved_LDFLAGS=$LDFLAGS
1676
1677 LDFLAGS="$LDFLAGS $LIB_SASL"
1678
1679 AC_CHECK_LIB(sasl2, sasl_checkapop,
1680              [AC_DEFINE(HAVE_APOP,[],[Does SASL support APOP?])],
1681              [AC_MSG_ERROR([libsasl2 without working sasl_checkapop.  Cannot continue.])])
1682
1683 LDFLAGS=$cmu_saved_LDFLAGS
1684 ])# CMU_SASL2_CHECKAPOP_REQUIRED
1685
1686
1687 # SASL2_CRYPT_CHK
1688 # ---------------
1689 AC_DEFUN([SASL2_CRYPT_CHK],
1690 [AC_CHECK_FUNC(crypt, cmu_have_crypt=yes,
1691                [AC_CHECK_LIB(crypt, crypt,
1692                              LIB_CRYPT="-lcrypt"; cmu_have_crypt=yes,
1693                              cmu_have_crypt=no)])
1694 AC_SUBST(LIB_CRYPT)
1695 ])# SASL2_CRYPT_CHK
1696
1697 dnl Functions to check what database to use for libsasldb
1698
1699 dnl Berkeley DB specific checks first..
1700
1701 dnl Figure out what database type we're using
1702 AC_DEFUN([SASL_DB_CHECK], [
1703 cmu_save_LIBS="$LIBS"
1704 AC_ARG_WITH(dblib, [  --with-dblib=DBLIB      set the DB library to use [berkeley] ],
1705   dblib=$withval,
1706   dblib=auto_detect)
1707
1708 CYRUS_BERKELEY_DB_OPTS()
1709
1710 SASL_DB_LIB=""
1711
1712 case "$dblib" in
1713 dnl this is unbelievably painful due to confusion over what db-3 should be
1714 dnl named.  arg.
1715   berkeley)
1716         CYRUS_BERKELEY_DB_CHK()
1717         CPPFLAGS="${CPPFLAGS} ${BDB_INCADD}"
1718         SASL_DB_INC=$BDB_INCADD
1719         SASL_DB_LIB="${BDB_LIBADD}"
1720         ;;
1721   gdbm)
1722         AC_ARG_WITH(gdbm,[  --with-gdbm=PATH        use gdbm from PATH],
1723                     with_gdbm="${withval}")
1724
1725         case "$with_gdbm" in
1726            ""|yes)
1727                AC_CHECK_HEADER(gdbm.h, [
1728                         AC_CHECK_LIB(gdbm, gdbm_open, SASL_DB_LIB="-lgdbm",
1729                                            dblib="no")],
1730                         dblib="no")
1731                ;;
1732            *)
1733                if test -d $with_gdbm; then
1734                  CPPFLAGS="${CPPFLAGS} -I${with_gdbm}/include"
1735                  LDFLAGS="${LDFLAGS} -L${with_gdbm}/lib"
1736                  SASL_DB_LIB="-lgdbm" 
1737                else
1738                  with_gdbm="no"
1739                fi
1740        esac
1741         ;;
1742   ndbm)
1743         dnl We want to attempt to use -lndbm if we can, just in case
1744         dnl there's some version of it installed and overriding libc
1745         AC_CHECK_HEADER(ndbm.h, [
1746                         AC_CHECK_LIB(ndbm, dbm_open, SASL_DB_LIB="-lndbm", [
1747                                 AC_CHECK_FUNC(dbm_open,,dblib="no")])],
1748                                 dblib="no")
1749         ;;
1750   auto_detect)
1751         dnl How about berkeley db?
1752         CYRUS_BERKELEY_DB_CHK()
1753         if test "$dblib" = no; then
1754           dnl How about ndbm?
1755           AC_CHECK_HEADER(ndbm.h, [
1756                 AC_CHECK_LIB(ndbm, dbm_open,
1757                              dblib="ndbm"; SASL_DB_LIB="-lndbm",
1758                              dblib="weird")],
1759                    dblib="no")
1760           if test "$dblib" = "weird"; then
1761             dnl Is ndbm in the standard library?
1762             AC_CHECK_FUNC(dbm_open, dblib="ndbm", dblib="no")
1763           fi
1764
1765           if test "$dblib" = no; then
1766             dnl Can we use gdbm?
1767             AC_CHECK_HEADER(gdbm.h, [
1768                 AC_CHECK_LIB(gdbm, gdbm_open, dblib="gdbm";
1769                                              SASL_DB_LIB="-lgdbm", dblib="no")],
1770                              dblib="no")
1771           fi
1772         else
1773           dnl we took Berkeley
1774           CPPFLAGS="${CPPFLAGS} ${BDB_INCADD}"
1775           SASL_DB_INC=$BDB_INCADD
1776           SASL_DB_LIB="${BDB_LIBADD}"
1777         fi
1778         ;;
1779   none)
1780         ;;
1781   no)
1782         ;;
1783   *)
1784         AC_MSG_WARN([Bad DB library implementation specified;])
1785         AC_ERROR([Use either \"berkeley\", \"gdbm\", \"ndbm\" or \"none\"])
1786         dblib=no
1787         ;;
1788 esac
1789 LIBS="$cmu_save_LIBS"
1790
1791 AC_MSG_CHECKING(DB library to use)
1792 AC_MSG_RESULT($dblib)
1793
1794 SASL_DB_BACKEND="db_${dblib}.lo"
1795 SASL_DB_BACKEND_STATIC="db_${dblib}.o allockey.o"
1796 SASL_DB_BACKEND_STATIC_SRCS="../sasldb/db_${dblib}.c ../sasldb/allockey.c"
1797 SASL_DB_UTILS="saslpasswd2 sasldblistusers2"
1798 SASL_DB_MANS="saslpasswd2.8 sasldblistusers2.8"
1799
1800 case "$dblib" in
1801   gdbm) 
1802     SASL_MECHS="$SASL_MECHS libsasldb.la"
1803     AC_DEFINE(SASL_GDBM,[],[Use GDBM for SASLdb])
1804     ;;
1805   ndbm)
1806     SASL_MECHS="$SASL_MECHS libsasldb.la"
1807     AC_DEFINE(SASL_NDBM,[],[Use NDBM for SASLdb])
1808     ;;
1809   berkeley)
1810     SASL_MECHS="$SASL_MECHS libsasldb.la"
1811     AC_DEFINE(SASL_BERKELEYDB,[],[Use BerkeleyDB for SASLdb])
1812     ;;
1813   *)
1814     AC_MSG_WARN([Disabling SASL authentication database support])
1815     dnl note that we do not add libsasldb.la to SASL_MECHS, since it
1816     dnl will just fail to load anyway.
1817     SASL_DB_BACKEND="db_none.lo"
1818     SASL_DB_BACKEND_STATIC="db_none.o"
1819     SASL_DB_BACKEND_STATIC_SRCS="../sasldb/db_none.c"
1820     SASL_DB_UTILS=""
1821     SASL_DB_MANS=""
1822     SASL_DB_LIB=""
1823     ;;
1824 esac
1825
1826 if test "$enable_static" = yes; then
1827     if test "$dblib" != "none"; then
1828       SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/sasldb.c $SASL_DB_BACKEND_STATIC_SRCS"
1829       SASL_STATIC_OBJS="$SASL_STATIC_OBJS sasldb.o $SASL_DB_BACKEND_STATIC"
1830       AC_DEFINE(STATIC_SASLDB,[],[Link SASLdb Staticly])
1831     else
1832       SASL_STATIC_OBJS="$SASL_STATIC_OBJS $SASL_DB_BACKEND_STATIC"
1833       SASL_STATIC_SRCS="$SASL_STATIC_SRCS $SASL_DB_BACKEND_STATIC_SRCS"
1834     fi
1835 fi
1836
1837 AC_SUBST(SASL_DB_UTILS)
1838 AC_SUBST(SASL_DB_MANS)
1839 AC_SUBST(SASL_DB_BACKEND)
1840 AC_SUBST(SASL_DB_BACKEND_STATIC)
1841 AC_SUBST(SASL_DB_INC)
1842 AC_SUBST(SASL_DB_LIB)
1843 ])
1844
1845 dnl Figure out what database path we're using
1846 AC_DEFUN([SASL_DB_PATH_CHECK], [
1847 AC_ARG_WITH(dbpath, [  --with-dbpath=PATH      set the DB path to use [/etc/sasldb2] ],
1848   dbpath=$withval,
1849   dbpath=/etc/sasldb2)
1850 AC_MSG_CHECKING(DB path to use)
1851 AC_MSG_RESULT($dbpath)
1852 AC_DEFINE_UNQUOTED(SASL_DB_PATH, "$dbpath", [Path to default SASLdb database])])
1853
1854 dnl $Id: berkdb.m4,v 1.20 2005/04/26 19:14:07 shadow Exp $
1855
1856 AC_DEFUN([CMU_DB_INC_WHERE1], [
1857 saved_CPPFLAGS=$CPPFLAGS
1858 CPPFLAGS="$saved_CPPFLAGS -I$1"
1859 AC_TRY_COMPILE([#include <db.h>],
1860 [DB *db;
1861 db_create(&db, NULL, 0);
1862 db->open(db, "foo.db", NULL, DB_UNKNOWN, DB_RDONLY, 0644);],
1863 ac_cv_found_db_inc=yes,
1864 ac_cv_found_db_inc=no)
1865 CPPFLAGS=$saved_CPPFLAGS
1866 ])
1867
1868 AC_DEFUN([CMU_DB_INC_WHERE], [
1869    for i in $1; do
1870       AC_MSG_CHECKING(for db headers in $i)
1871       CMU_DB_INC_WHERE1($i)
1872       CMU_TEST_INCPATH($i, db)
1873       if test "$ac_cv_found_db_inc" = "yes"; then
1874         ac_cv_db_where_inc=$i
1875         AC_MSG_RESULT(found)
1876         break
1877       else
1878         AC_MSG_RESULT(not found)
1879       fi
1880     done
1881 ])
1882
1883 #
1884 # Test for lib files
1885 #
1886
1887 AC_DEFUN([CMU_DB3_LIB_WHERE1], [
1888 AC_REQUIRE([CMU_AFS])
1889 AC_REQUIRE([CMU_KRB4])
1890 saved_LIBS=$LIBS
1891   LIBS="$saved_LIBS -L$1 -ldb-3"
1892 AC_TRY_LINK([#include <db.h>],
1893 [db_env_create(NULL, 0);],
1894 [ac_cv_found_db_3_lib=yes],
1895 ac_cv_found_db_3_lib=no)
1896 LIBS=$saved_LIBS
1897 ])
1898 AC_DEFUN([CMU_DB4_LIB_WHERE1], [
1899 AC_REQUIRE([CMU_AFS])
1900 AC_REQUIRE([CMU_KRB4])
1901 saved_LIBS=$LIBS
1902 LIBS="$saved_LIBS -L$1 -ldb-4"
1903 AC_TRY_LINK([#include <db.h>],
1904 [db_env_create(NULL, 0);],
1905 [ac_cv_found_db_4_lib=yes],
1906 ac_cv_found_db_4_lib=no)
1907 LIBS=$saved_LIBS
1908 ])
1909
1910 AC_DEFUN([CMU_DB_LIB_WHERE], [
1911    for i in $1; do
1912       AC_MSG_CHECKING(for db libraries in $i)
1913 if test "$enable_db4" = "yes"; then
1914       CMU_DB4_LIB_WHERE1($i)
1915       CMU_TEST_LIBPATH($i, [db-4])
1916       ac_cv_found_db_lib=$ac_cv_found_db_4_lib
1917 else
1918       CMU_DB3_LIB_WHERE1($i)
1919       CMU_TEST_LIBPATH($i, [db-3])
1920       ac_cv_found_db_lib=$ac_cv_found_db_3_lib
1921 fi
1922       if test "$ac_cv_found_db_lib" = "yes" ; then
1923         ac_cv_db_where_lib=$i
1924         AC_MSG_RESULT(found)
1925         break
1926       else
1927         AC_MSG_RESULT(not found)
1928       fi
1929     done
1930 ])
1931
1932 AC_DEFUN([CMU_USE_DB], [
1933 AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
1934 AC_ARG_WITH(db,
1935         [  --with-db=PREFIX      Compile with db support],
1936         [if test "X$with_db" = "X"; then
1937                 with_db=yes
1938         fi])
1939 AC_ARG_WITH(db-lib,
1940         [  --with-db-lib=dir     use db libraries in dir],
1941         [if test "$withval" = "yes" -o "$withval" = "no"; then
1942                 AC_MSG_ERROR([No argument for --with-db-lib])
1943         fi])
1944 AC_ARG_WITH(db-include,
1945         [  --with-db-include=dir use db headers in dir],
1946         [if test "$withval" = "yes" -o "$withval" = "no"; then
1947                 AC_MSG_ERROR([No argument for --with-db-include])
1948         fi])
1949 AC_ARG_ENABLE(db4,
1950         [  --enable-db4          use db 4.x libraries])
1951         
1952         if test "X$with_db" != "X"; then
1953           if test "$with_db" != "yes"; then
1954             ac_cv_db_where_lib=$with_db/$CMU_LIB_SUBDIR
1955             ac_cv_db_where_inc=$with_db/include
1956           fi
1957         fi
1958
1959         if test "X$with_db_lib" != "X"; then
1960           ac_cv_db_where_lib=$with_db_lib
1961         fi
1962         if test "X$ac_cv_db_where_lib" = "X"; then
1963           CMU_DB_LIB_WHERE(/usr/athena/$CMU_LIB_SUBDIR /usr/$CMU_LIB_SUBDIR /usr/local/$CMU_LIB_SUBDIR)
1964         fi
1965
1966         if test "X$with_db_include" != "X"; then
1967           ac_cv_db_where_inc=$with_db_include
1968         fi
1969         if test "X$ac_cv_db_where_inc" = "X"; then
1970           CMU_DB_INC_WHERE(/usr/athena/include /usr/local/include)
1971         fi
1972
1973         AC_MSG_CHECKING(whether to include db)
1974         if test "X$ac_cv_db_where_lib" = "X" -o "X$ac_cv_db_where_inc" = "X"; then
1975           ac_cv_found_db=no
1976           AC_MSG_RESULT(no)
1977         else
1978           ac_cv_found_db=yes
1979           AC_MSG_RESULT(yes)
1980           DB_INC_DIR=$ac_cv_db_where_inc
1981           DB_LIB_DIR=$ac_cv_db_where_lib
1982           DB_INC_FLAGS="-I${DB_INC_DIR}"
1983           if test "$enable_db4" = "yes"; then
1984              DB_LIB_FLAGS="-L${DB_LIB_DIR} -ldb-4"
1985           else
1986              DB_LIB_FLAGS="-L${DB_LIB_DIR} -ldb-3"
1987           fi
1988           dnl Do not force configure.in to put these in CFLAGS and LIBS unconditionally
1989           dnl Allow makefile substitutions....
1990           AC_SUBST(DB_INC_FLAGS)
1991           AC_SUBST(DB_LIB_FLAGS)
1992           if test "X$RPATH" = "X"; then
1993                 RPATH=""
1994           fi
1995           case "${host}" in
1996             *-*-linux*)
1997               if test "X$RPATH" = "X"; then
1998                 RPATH="-Wl,-rpath,${DB_LIB_DIR}"
1999               else 
2000                 RPATH="${RPATH}:${DB_LIB_DIR}"
2001               fi
2002               ;;
2003             *-*-hpux*)
2004               if test "X$RPATH" = "X"; then
2005                 RPATH="-Wl,+b${DB_LIB_DIR}"
2006               else 
2007                 RPATH="${RPATH}:${DB_LIB_DIR}"
2008               fi
2009               ;;
2010             *-*-irix*)
2011               if test "X$RPATH" = "X"; then
2012                 RPATH="-Wl,-rpath,${DB_LIB_DIR}"
2013               else 
2014                 RPATH="${RPATH}:${DB_LIB_DIR}"
2015               fi
2016               ;;
2017             *-*-solaris2*)
2018               if test "$ac_cv_prog_gcc" = yes; then
2019                 if test "X$RPATH" = "X"; then
2020                   RPATH="-Wl,-R${DB_LIB_DIR}"
2021                 else 
2022                   RPATH="${RPATH}:${DB_LIB_DIR}"
2023                 fi
2024               else
2025                 RPATH="${RPATH} -R${DB_LIB_DIR}"
2026               fi
2027               ;;
2028           esac
2029           AC_SUBST(RPATH)
2030         fi
2031         ])
2032
2033
2034
2035 dnl ---- CUT HERE ---
2036
2037 dnl These are the Cyrus Berkeley DB macros.  In an ideal world these would be
2038 dnl identical to the above.
2039
2040 dnl They are here so that they can be shared between Cyrus IMAPd
2041 dnl and Cyrus SASL with relative ease.
2042
2043 dnl The big difference between this and the ones above is that we don't assume
2044 dnl that we know the name of the library, and we try a lot of permutations
2045 dnl instead.  We also assume that DB4 is acceptable.
2046
2047 dnl When we're done, there will be a BDB_LIBADD and a BDB_INCADD which should
2048 dnl be used when necessary.  We should probably be smarter about our RPATH
2049 dnl handling.
2050
2051 dnl Call these with BERKELEY_DB_CHK.
2052
2053 dnl We will also set $dblib to "berkeley" if we are successful, "no" otherwise.
2054
2055 dnl this is unbelievably painful due to confusion over what db-3 should be
2056 dnl named and where the db-3 header file is located.  arg.
2057 AC_DEFUN([CYRUS_BERKELEY_DB_CHK_LIB],
2058 [
2059         BDB_SAVE_LDFLAGS=$LDFLAGS
2060
2061         if test -d $with_bdb_lib; then
2062             CMU_ADD_LIBPATH_TO($with_bdb_lib, LDFLAGS)
2063             CMU_ADD_LIBPATH_TO($with_bdb_lib, BDB_LIBADD)
2064         else
2065             BDB_LIBADD=""
2066         fi
2067
2068         saved_LIBS=$LIBS
2069         for dbname in db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db
2070           do
2071             LIBS="$saved_LIBS -l$dbname"
2072             AC_TRY_LINK([#include <db.h>],
2073             [db_create(NULL, NULL, 0);],
2074             BDB_LIBADD="$BDB_LIBADD -l$dbname"; dblib="berkeley"; dbname=db,
2075             dblib="no")
2076             if test "$dblib" = "berkeley"; then break; fi
2077           done
2078         if test "$dblib" = "no"; then
2079             LIBS="$saved_LIBS -ldb"
2080             AC_TRY_LINK([#include <db.h>],
2081             [db_open(NULL, 0, 0, 0, NULL, NULL, NULL);],
2082             BDB_LIBADD="$BDB_LIBADD -ldb"; dblib="berkeley"; dbname=db,
2083             dblib="no")
2084         fi
2085         LIBS=$saved_LIBS
2086
2087         LDFLAGS=$BDB_SAVE_LDFLAGS
2088 ])
2089
2090 AC_DEFUN([CYRUS_BERKELEY_DB_OPTS],
2091 [
2092 AC_ARG_WITH(bdb-libdir,
2093         [  --with-bdb-libdir=DIR   Berkeley DB lib files are in DIR],
2094         with_bdb_lib=$withval,
2095         [ test "${with_bdb_lib+set}" = set || with_bdb_lib=none])
2096 AC_ARG_WITH(bdb-incdir,
2097         [  --with-bdb-incdir=DIR   Berkeley DB include files are in DIR],
2098         with_bdb_inc=$withval,
2099         [ test "${with_bdb_inc+set}" = set || with_bdb_inc=none ])
2100 ])
2101
2102 AC_DEFUN([CYRUS_BERKELEY_DB_CHK],
2103 [
2104         AC_REQUIRE([CYRUS_BERKELEY_DB_OPTS])
2105
2106         cmu_save_CPPFLAGS=$CPPFLAGS
2107
2108         if test -d $with_bdb_inc; then
2109             CPPFLAGS="$CPPFLAGS -I$with_bdb_inc"
2110             BDB_INCADD="-I$with_bdb_inc"
2111         else
2112             BDB_INCADD=""
2113         fi
2114
2115         dnl Note that FreeBSD puts it in a wierd place
2116         dnl (but they should use with-bdb-incdir)
2117         AC_CHECK_HEADER(db.h,
2118                         [CYRUS_BERKELEY_DB_CHK_LIB()],
2119                         dblib="no")
2120
2121         CPPFLAGS=$cmu_save_CPPFLAGS
2122 ])
2123
2124 dnl afs.m4--AFS libraries, includes, and dependencies
2125 dnl $Id: afs.m4,v 1.29 2005/04/26 19:14:07 shadow Exp $
2126 dnl Chaskiel Grundman
2127 dnl based on kerberos_v4.m4
2128 dnl Derrick Brashear
2129 dnl from KTH krb and Arla
2130
2131 AC_DEFUN([CMU_AFS_INC_WHERE1], [
2132 cmu_save_CPPFLAGS=$CPPFLAGS
2133 CPPFLAGS="$cmu_save_CPPFLAGS -I$1"
2134 AC_TRY_COMPILE([#include <afs/param.h>],
2135 [#ifndef SYS_NAME
2136 choke me
2137 #endif
2138 int foo;],
2139 ac_cv_found_afs_inc=yes,
2140 ac_cv_found_afs_inc=no)
2141 CPPFLAGS=$cmu_save_CPPFLAGS
2142 ])
2143
2144 AC_DEFUN([CMU_AFS_LIB_WHERE1], [
2145 save_LIBS="$LIBS"
2146 save_LDFLAGS="$LDFLAGS"
2147
2148 LIBS="-lauth $1/afs/util.a $LIB_SOCKET $LIBS"
2149 LDFLAGS="-L$1 -L$1/afs $LDFLAGS"
2150 dnl suppress caching
2151 AC_TRY_LINK([],[afsconf_Open();], ac_cv_found_afs_lib=yes, ac_cv_found_afs_lib=no)
2152 LIBS="$save_LIBS"
2153 LDFLAGS="$save_LDFLAGS"
2154 ])
2155
2156 AC_DEFUN([CMU_AFS_WHERE], [
2157 AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
2158    for i in $1; do
2159       AC_MSG_CHECKING(for AFS in $i)
2160       CMU_AFS_INC_WHERE1("$i/include")
2161       ac_cv_found_lwp_inc=$ac_cv_found_afs_inc
2162       CMU_TEST_INCPATH($i/include, lwp) 
2163       ac_cv_found_afs_inc=$ac_cv_found_lwp_inc
2164       if test "$ac_cv_found_afs_inc" = "yes"; then
2165         CMU_AFS_LIB_WHERE1("$i/$CMU_LIB_SUBDIR")
2166         if test "$ac_cv_found_afs_lib" = "yes"; then
2167           ac_cv_afs_where=$i
2168           AC_MSG_RESULT(found)
2169           break
2170         else
2171           AC_MSG_RESULT(not found)
2172         fi
2173       else
2174         AC_MSG_RESULT(not found)
2175       fi
2176     done
2177 ])
2178
2179 AC_DEFUN([CMU_AFS], [
2180 AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
2181 AC_REQUIRE([CMU_SOCKETS])
2182 AC_REQUIRE([CMU_LIBSSL])
2183 AC_ARG_WITH(AFS,
2184         [  --with-afs=PREFIX      Compile with AFS support],
2185         [if test "X$with_AFS" = "X"; then
2186                 with_AFS=yes
2187         fi])
2188
2189         if test "X$with_AFS" != "X"; then
2190           ac_cv_afs_where=$with_AFS
2191         fi
2192         if test "X$ac_cv_afs_where" = "X"; then
2193           CMU_AFS_WHERE(/usr/afsws /usr/local /usr/athena /Library/OpenAFS/Tools)
2194         fi
2195
2196         AC_MSG_CHECKING(whether to include AFS)
2197         if test "X$ac_cv_afs_where" = "Xno" -o "X$ac_cv_afs_where" = "X"; then
2198           ac_cv_found_afs=no
2199           AC_MSG_RESULT(no)
2200         else
2201           ac_cv_found_afs=yes
2202           AC_MSG_RESULT(yes)
2203           AFS_INC_DIR="$ac_cv_afs_where/include"
2204           AFS_LIB_DIR="$ac_cv_afs_where/$CMU_LIB_SUBDIR"
2205           AFS_TOP_DIR="$ac_cv_afs_where"
2206           AFS_INC_FLAGS="-I${AFS_INC_DIR}"
2207           AFS_LIB_FLAGS="-L${AFS_LIB_DIR} -L${AFS_LIB_DIR}/afs"
2208           cmu_save_LIBS="$LIBS"
2209           cmu_save_CPPFLAGS="$CPPFLAGS"
2210           CPPFLAGS="$CPPFLAGS ${AFS_INC_FLAGS}"
2211           cmu_save_LDFLAGS="$LDFLAGS"
2212           LDFLAGS="$cmu_save_LDFLAGS ${AFS_LIB_FLAGS}"
2213                         
2214           AC_CHECK_HEADERS(afs/stds.h)
2215
2216           AC_MSG_CHECKING([if libdes is needed])
2217           AC_TRY_LINK([],[des_quad_cksum();],AFS_DES_LIB="",AFS_DES_LIB="maybe")
2218           if test "X$AFS_DES_LIB" != "X"; then
2219               LIBS="$cmu_save_LIBS -ldes"
2220               AC_TRY_LINK([], [des_quad_cksum();],AFS_DES_LIB="yes")
2221               if test "X$AFS_DES_LIB" = "Xyes"; then
2222                   AC_MSG_RESULT([yes])
2223                   AFS_LIBDES="-ldes"
2224                   AFS_LIBDESA="${AFS_LIB_DIR}/libdes.a"
2225               else
2226                   LIBS="$cmu_save_LIBS $LIBSSL_LIB_FLAGS"
2227                   AC_TRY_LINK([],
2228                   [des_quad_cksum();],AFS_DES_LIB="libcrypto")
2229                   if test "X$AFS_DES_LIB" = "Xlibcrypto"; then
2230                       AC_MSG_RESULT([libcrypto])
2231                       AFS_LIBDES="$LIBSSL_LIB_FLAGS"
2232                       AFS_LIBDESA="$LIBSSL_LIB_FLAGS"
2233                   else
2234                       LIBS="$cmu_save_LIBS -L$LIBSSL_LIB_DIR -ldescompat $LIBSSL_LIB_FLAGS"
2235                       AC_TRY_LINK([],
2236                       [des_quad_cksum();],AFS_DES_LIB="libcrypto+descompat")
2237                       if test "X$AFS_DES_LIB" = "Xlibcrypto+descompat"; then
2238                           AC_MSG_RESULT([libcrypto+descompat])
2239                           AFS_LIBDES="-L$LIBSSL_LIB_DIR -ldescompat $LIBSSL_LIB_FLAGS"
2240                           AFS_LIBDESA="-L$LIBSSL_LIB_DIR -ldescompat $LIBSSL_LIB_FLAGS"
2241                       else
2242                           AC_MSG_RESULT([unknown])
2243                           AC_MSG_ERROR([Could not use -ldes])
2244                       fi 
2245                   fi 
2246               fi 
2247           else
2248              AC_MSG_RESULT([no])
2249           fi
2250
2251
2252           AFS_CLIENT_LIBS_STATIC="${AFS_LIB_DIR}/afs/libvolser.a ${AFS_LIB_DIR}/afs/libvldb.a ${AFS_LIB_DIR}/afs/libkauth.a ${AFS_LIB_DIR}/afs/libprot.a ${AFS_LIB_DIR}/libubik.a ${AFS_LIB_DIR}/afs/libauth.a ${AFS_LIB_DIR}/librxkad.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/afs/libsys.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/liblwp.a ${AFS_LIBDESA} ${AFS_LIB_DIR}/afs/libcmd.a ${AFS_LIB_DIR}/afs/libcom_err.a ${AFS_LIB_DIR}/afs/util.a"
2253           AFS_KTC_LIBS_STATIC="${AFS_LIB_DIR}/afs/libauth.a ${AFS_LIB_DIR}/afs/libsys.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/liblwp.a ${AFS_LIBDESA} ${AFS_LIB_DIR}/afs/libcom_err.a ${AFS_LIB_DIR}/afs/util.a"
2254           AFS_CLIENT_LIBS="-lvolser -lvldb -lkauth -lprot -lubik -lauth -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a"
2255           AFS_RX_LIBS="-lauth -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a"
2256           AFS_KTC_LIBS="-lauth ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcom_err ${AFS_LIB_DIR}/afs/util.a"
2257
2258           LIBS="$cmu_save_LIBS $AFS_CLIENT_LIBS ${LIB_SOCKET}"
2259           AC_CHECK_FUNC(des_pcbc_init)
2260           if test "X$ac_cv_func_des_pcbc_init" != "Xyes"; then
2261            AC_CHECK_LIB(descompat, des_pcbc_init, AFS_DESCOMPAT_LIB="-ldescompat")
2262            if test "X$AFS_DESCOMPAT_LIB" != "X" ; then
2263                 AFS_CLIENT_LIBS_STATIC="$AFS_CLIENT_LIBS_STATIC $AFS_DESCOMPAT_LIB"
2264                 AFS_KTC_LIBS_STATIC="$AFS_KTC_LIBS_STATIC $AFS_DESCOMPAT_LIB"
2265                 AFS_CLIENT_LIBS="$AFS_CLIENT_LIBS $AFS_DESCOMPAT_LIB"
2266                 AFS_KTC_LIBS="$AFS_KTC_LIBS $AFS_DESCOMPAT_LIB"
2267            else
2268
2269            AC_MSG_CHECKING([if rxkad needs des_pcbc_init])
2270            AC_TRY_LINK(,[tkt_DecodeTicket();],RXKAD_PROBLEM=no,RXKAD_PROBLEM=maybe)
2271             if test "$RXKAD_PROBLEM" = "maybe"; then
2272               AC_TRY_LINK([int des_pcbc_init() { return 0;}],
2273               [tkt_DecodeTicket();],RXKAD_PROBLEM=yes,RXKAD_PROBLEM=error)
2274               if test "$RXKAD_PROBLEM" = "yes"; then
2275                     AC_MSG_RESULT([yes])
2276                     AC_MSG_ERROR([cannot use rxkad])
2277               else
2278                     AC_MSG_RESULT([unknown])        
2279                     AC_MSG_ERROR([Unknown error testing rxkad])
2280               fi
2281             else
2282               AC_MSG_RESULT([no])
2283             fi
2284            fi
2285           fi
2286
2287           LIBS="$cmu_save_LIBS"
2288           AC_CHECK_FUNC(flock)
2289           LIBS="$cmu_save_LIBS ${AFS_CLIENT_LIBS} ${LIB_SOCKET}"
2290           if test "X$ac_cv_func_flock" != "Xyes"; then
2291              AC_MSG_CHECKING([if AFS needs flock])
2292              AC_TRY_LINK([#include <afs/param.h>
2293 #ifdef HAVE_AFS_STDS_H
2294 #include <afs/stds.h>
2295 #endif
2296 #include <ubik.h>
2297 #include <afs/cellconfig.h>
2298 #include <afs/auth.h>
2299 #include <afs/volser.h>
2300 struct ubik_client * cstruct;
2301 int sigvec() {return 0;}
2302 extern int UV_SetSecurity();],
2303              [vsu_ClientInit(1,"","",0,
2304                              &cstruct,UV_SetSecurity)],
2305              AFS_FLOCK=no,AFS_FLOCK=yes)
2306              if test $AFS_FLOCK = "no"; then
2307                 AC_MSG_RESULT([no])
2308              else
2309                AC_MSG_RESULT([yes])
2310                LDFLAGS="$LDFLAGS -L/usr/ucblib"
2311                AC_CHECK_LIB(ucb, flock,:, [AC_CHECK_LIB(BSD, flock)])
2312              fi
2313           fi
2314           LIBS="$cmu_save_LIBS"
2315           AC_CHECK_FUNC(sigvec)
2316           LIBS="$cmu_save_LIBS ${AFS_CLIENT_LIBS} ${LIB_SOCKET}"
2317           if test "X$ac_cv_func_sigvec" != "Xyes"; then
2318              AC_MSG_CHECKING([if AFS needs sigvec])
2319              AC_TRY_LINK([#include <afs/param.h>
2320 #ifdef HAVE_AFS_STDS_H
2321 #include <afs/stds.h>
2322 #endif
2323 #include <ubik.h>
2324 #include <afs/cellconfig.h>
2325 #include <afs/auth.h>
2326 #include <afs/volser.h>
2327 struct ubik_client * cstruct;
2328 int flock() {return 0;}
2329 extern int UV_SetSecurity();],
2330              [vsu_ClientInit(1,"","",0,
2331                              &cstruct,UV_SetSecurity)],
2332              AFS_SIGVEC=no,AFS_SIGVEC=yes)
2333              if test $AFS_SIGVEC = "no"; then
2334                 AC_MSG_RESULT([no])
2335              else
2336                AC_MSG_RESULT([yes])
2337                LDFLAGS="$LDFLAGS -L/usr/ucblib"
2338                AC_CHECK_LIB(ucb, sigvec,:,[AC_CHECK_LIB(BSD, sigvec)])
2339              fi
2340           fi
2341           if test "$ac_cv_lib_ucb_flock" = "yes" -o "$ac_cv_lib_ucb_sigvec" = "yes"; then
2342              AFS_LIB_FLAGS="${AFS_LIB_FLAGS} -L/usr/ucblib -R/usr/ucblib"
2343           fi
2344           if test "$ac_cv_lib_ucb_flock" = "yes" -o "$ac_cv_lib_ucb_sigvec" = "yes"; then
2345              AFS_BSD_LIB="-lucb"
2346           elif test "$ac_cv_lib_BSD_flock" = "yes" -o "$ac_cv_lib_BSD_sigvec" = "yes"; then
2347              AFS_BSD_LIB="-lBSD"
2348           fi
2349           if test "X$AFS_BSD_LIB" != "X" ; then
2350                 AFS_CLIENT_LIBS_STATIC="$AFS_CLIENT_LIBS_STATIC $AFS_BSD_LIB"
2351                 AFS_KTC_LIBS_STATIC="$AFS_KTC_LIBS_STATIC $AFS_BSD_LIB"
2352                 AFS_CLIENT_LIBS="$AFS_CLIENT_LIBS $AFS_BSD_LIB"
2353                 AFS_RX_LIBS="$AFS_CLIENT_LIBS $AFS_BSD_LIB"
2354                 AFS_KTC_LIBS="$AFS_KTC_LIBS $AFS_BSD_LIB"
2355           fi
2356
2357           AC_MSG_CHECKING([if libaudit is needed])
2358           AFS_LIBAUDIT=""
2359           LIBS="$cmu_save_LIBS $AFS_CLIENT_LIBS ${LIB_SOCKET}"
2360           AC_TRY_LINK([#include <afs/param.h>
2361 #ifdef HAVE_AFS_STDS_H
2362 #include <afs/stds.h>
2363 #endif
2364 #include <afs/cellconfig.h>
2365 #include <afs/auth.h>],
2366           [afsconf_SuperUser();],AFS_AUDIT_LIB="",AFS_AUDIT_LIB="maybe")
2367           if test "X$AFS_AUDIT_LIB" != "X"; then
2368           LIBS="$cmu_save_LIBS -lvolser -lvldb -lkauth -lprot -lubik -lauth -laudit -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a $AFS_BSD_LIB $AFS_DESCOMPAT_LIB $LIB_SOCKET"
2369              AC_TRY_LINK([#include <afs/param.h>
2370 #ifdef HAVE_AFS_STDS_H
2371 #include <afs/stds.h>
2372 #endif
2373 #include <afs/cellconfig.h>
2374 #include <afs/auth.h>],
2375              [afsconf_SuperUser();],AFS_AUDIT_LIB="yes")
2376              if test "X$AFS_AUDIT_LIB" = "Xyes"; then
2377                  AC_MSG_RESULT([yes])
2378                  AFS_LIBAUDIT="-laudit"
2379                  AFS_CLIENT_LIBS_STATIC="${AFS_LIB_DIR}/afs/libvolser.a ${AFS_LIB_DIR}/afs/libvldb.a ${AFS_LIB_DIR}/afs/libkauth.a ${AFS_LIB_DIR}/afs/libprot.a ${AFS_LIB_DIR}/libubik.a ${AFS_LIB_DIR}/afs/libauth.a ${AFS_LIB_DIR}/afs/libaudit.a ${AFS_LIB_DIR}/librxkad.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/afs/libsys.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/liblwp.a ${AFS_LIBDESA} ${AFS_LIB_DIR}/afs/libcmd.a ${AFS_LIB_DIR}/afs/libcom_err.a ${AFS_LIB_DIR}/afs/util.a"
2380                  AFS_CLIENT_LIBS="-lvolser -lvldb -lkauth -lprot -lubik -lauth -laudit -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a $AFS_BSD_LIB $AFS_DESCOMPAT_LIB"
2381                  AFS_RX_LIBS="-lauth -laudit -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a $AFS_BSD_LIB $AFS_DESCOMPAT_LIB"
2382              else
2383                  AC_MSG_RESULT([unknown])
2384                  AC_MSG_ERROR([Could not use -lauth while testing for -laudit])
2385              fi 
2386           else
2387              AC_MSG_RESULT([no])
2388           fi
2389
2390           AC_CHECK_FUNCS(VL_ProbeServer)
2391           AC_MSG_CHECKING([if new-style afs_ integer types are defined])
2392           AC_CACHE_VAL(ac_cv_afs_int32,
2393 dnl The next few lines contain a quoted argument to egrep
2394 dnl It is critical that there be no leading or trailing whitespace
2395 dnl or newlines
2396 [AC_EGREP_CPP(dnl
2397 changequote(<<,>>)dnl
2398 <<(^|[^a-zA-Z_0-9])afs_int32[^a-zA-Z_0-9]>>dnl
2399 changequote([,]), [#include <afs/param.h>
2400 #ifdef HAVE_AFS_STDS_H
2401 #include <afs/stds.h>
2402 #endif],
2403 ac_cv_afs_int32=yes, ac_cv_afs_int32=no)])
2404           AC_MSG_RESULT($ac_cv_afs_int32)
2405           if test $ac_cv_afs_int32 = yes ; then
2406             AC_DEFINE(HAVE_AFS_INT32,, [AFS provides new "unambiguous" type names])
2407           else
2408             AC_DEFINE(afs_int16, int16, [it's a type definition])
2409             AC_DEFINE(afs_int32, int32, [it's a type definition])
2410             AC_DEFINE(afs_uint16, u_int16, [it's a type definition])
2411             AC_DEFINE(afs_uint32, u_int32, [it's a type definition])
2412           fi
2413
2414           CPPFLAGS="${cmu_save_CPPFLAGS}"
2415           LDFLAGS="${cmu_save_LDFLAGS}"
2416           LIBS="${cmu_save_LIBS}"
2417           AC_DEFINE(AFS_ENV,, [Use AFS. (find what needs this and nuke it)])
2418           AC_DEFINE(AFS,, [Use AFS. (find what needs this and nuke it)])
2419           AC_SUBST(AFS_CLIENT_LIBS_STATIC)
2420           AC_SUBST(AFS_KTC_LIBS_STATIC)
2421           AC_SUBST(AFS_CLIENT_LIBS)
2422           AC_SUBST(AFS_RX_LIBS)
2423           AC_SUBST(AFS_KTC_LIBS)
2424           AC_SUBST(AFS_INC_FLAGS)
2425           AC_SUBST(AFS_LIB_FLAGS)
2426           AC_SUBST(AFS_TOP_DIR)
2427           AC_SUBST(AFS_LIBAUDIT)
2428           AC_SUBST(AFS_LIBDES)
2429           AC_SUBST(AFS_LIBDESA)
2430         fi
2431         ])
2432
2433 AC_DEFUN([CMU_NEEDS_AFS],
2434 [AC_REQUIRE([CMU_AFS])
2435 if test "$ac_cv_found_afs" != "yes"; then
2436         AC_ERROR([Cannot continue without AFS])
2437 fi])
2438
2439 dnl libssl.m4--Ssl libraries and includes
2440 dnl Derrick Brashear
2441 dnl from KTH kafs and Arla
2442 dnl $Id: libssl.m4,v 1.10 2005/04/26 19:14:08 shadow Exp $
2443
2444 AC_DEFUN([CMU_LIBSSL_INC_WHERE1], [
2445 saved_CPPFLAGS=$CPPFLAGS
2446 CPPFLAGS="$saved_CPPFLAGS -I$1"
2447 CMU_CHECK_HEADER_NOCACHE(openssl/ssl.h,
2448 ac_cv_found_libssl_inc=yes,
2449 ac_cv_found_libssl_inc=no)
2450 CPPFLAGS=$saved_CPPFLAGS
2451 ])
2452
2453 AC_DEFUN([CMU_LIBSSL_INC_WHERE], [
2454    for i in $1; do
2455       AC_MSG_CHECKING(for libssl headers in $i)
2456       CMU_LIBSSL_INC_WHERE1($i)
2457       CMU_TEST_INCPATH($i, ssl)
2458       if test "$ac_cv_found_libssl_inc" = "yes"; then
2459         ac_cv_libssl_where_inc=$i
2460         AC_MSG_RESULT(found)
2461         break
2462       else
2463         AC_MSG_RESULT(not found)
2464       fi
2465     done
2466 ])
2467
2468 AC_DEFUN([CMU_LIBSSL_LIB_WHERE1], [
2469 saved_LIBS=$LIBS
2470 LIBS="$saved_LIBS -L$1 -lssl -lcrypto $LIB_SOCKET"
2471 AC_TRY_LINK(,
2472 [SSL_write();],
2473 [ac_cv_found_ssl_lib=yes],
2474 ac_cv_found_ssl_lib=no)
2475 LIBS=$saved_LIBS
2476 ])
2477
2478 AC_DEFUN([CMU_LIBSSL_LIB_WHERE], [
2479    for i in $1; do
2480       AC_MSG_CHECKING(for libssl libraries in $i)
2481       CMU_LIBSSL_LIB_WHERE1($i)
2482       dnl deal with false positives from implicit link paths
2483       CMU_TEST_LIBPATH($i, ssl)
2484       if test "$ac_cv_found_ssl_lib" = "yes" ; then
2485         ac_cv_libssl_where_lib=$i
2486         AC_MSG_RESULT(found)
2487         break
2488       else
2489         AC_MSG_RESULT(not found)
2490       fi
2491     done
2492 ])
2493
2494 AC_DEFUN([CMU_LIBSSL], [
2495 AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
2496 AC_REQUIRE([CMU_SOCKETS])
2497 AC_ARG_WITH(libssl,
2498         [  --with-libssl=PREFIX      Compile with Libssl support],
2499         [if test "X$with_libssl" = "X"; then
2500                 with_libssl=yes
2501         fi])
2502 AC_ARG_WITH(libssl-lib,
2503         [  --with-libssl-lib=dir     use libssl libraries in dir],
2504         [if test "$withval" = "yes" -o "$withval" = "no"; then
2505                 AC_MSG_ERROR([No argument for --with-libssl-lib])
2506         fi])
2507 AC_ARG_WITH(libssl-include,
2508         [  --with-libssl-include=dir use libssl headers in dir],
2509         [if test "$withval" = "yes" -o "$withval" = "no"; then
2510                 AC_MSG_ERROR([No argument for --with-libssl-include])
2511         fi])
2512
2513         if test "X$with_libssl" != "X"; then
2514           if test "$with_libssl" != "yes" -a "$with_libssl" != no; then
2515             ac_cv_libssl_where_lib=$with_libssl/$CMU_LIB_SUBDIR
2516             ac_cv_libssl_where_inc=$with_libssl/include
2517           fi
2518         fi
2519
2520         if test "$with_libssl" != "no"; then 
2521           if test "X$with_libssl_lib" != "X"; then
2522             ac_cv_libssl_where_lib=$with_libssl_lib
2523           fi
2524           if test "X$ac_cv_libssl_where_lib" = "X"; then
2525             CMU_LIBSSL_LIB_WHERE(/usr/local/$CMU_LIB_SUBDIR/openssl /usr/$CMU_LIB_SUBDIR/openssl /usr/local/$CMU_LIB_SUBDIR /usr/$CMU_LIB_SUBDIR)
2526           fi
2527
2528           if test "X$with_libssl_include" != "X"; then
2529             ac_cv_libssl_where_inc=$with_libssl_include
2530           fi
2531           if test "X$ac_cv_libssl_where_inc" = "X"; then
2532             CMU_LIBSSL_INC_WHERE(/usr/local/include /usr/include)
2533           fi
2534         fi
2535
2536         AC_MSG_CHECKING(whether to include libssl)
2537         if test "X$ac_cv_libssl_where_lib" = "X" -a "X$ac_cv_libssl_where_inc" = "X"; then
2538           ac_cv_found_libssl=no
2539           AC_MSG_RESULT(no)
2540         else
2541           ac_cv_found_libssl=yes
2542           AC_MSG_RESULT(yes)
2543           LIBSSL_INC_DIR=$ac_cv_libssl_where_inc
2544           LIBSSL_LIB_DIR=$ac_cv_libssl_where_lib
2545           LIBSSL_INC_FLAGS="-I${LIBSSL_INC_DIR}"
2546           LIBSSL_LIB_FLAGS="-L${LIBSSL_LIB_DIR} -lssl -lcrypto"
2547           if test "X$RPATH" = "X"; then
2548                 RPATH=""
2549           fi
2550           case "${host}" in
2551             *-*-linux*)
2552               if test "X$RPATH" = "X"; then
2553                 RPATH="-Wl,-rpath,${LIBSSL_LIB_DIR}"
2554               else 
2555                 RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
2556               fi
2557               ;;
2558             *-*-hpux*)
2559               if test "X$RPATH" = "X"; then
2560                 RPATH="-Wl,+b${LIBSSL_LIB_DIR}"
2561               else 
2562                 RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
2563               fi
2564               ;;
2565             *-*-irix*)
2566               if test "X$RPATH" = "X"; then
2567                 RPATH="-Wl,-rpath,${LIBSSL_LIB_DIR}"
2568               else 
2569                 RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
2570               fi
2571               ;;
2572             *-*-solaris2*)
2573               if test "$ac_cv_prog_gcc" = yes; then
2574                 if test "X$RPATH" = "X"; then
2575                   RPATH="-Wl,-R${LIBSSL_LIB_DIR}"
2576                 else 
2577                   RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
2578                 fi
2579               else
2580                 RPATH="${RPATH} -R${LIBSSL_LIB_DIR}"
2581               fi
2582               ;;
2583           esac
2584           AC_SUBST(RPATH)
2585         fi
2586         AC_SUBST(LIBSSL_INC_DIR)
2587         AC_SUBST(LIBSSL_LIB_DIR)
2588         AC_SUBST(LIBSSL_INC_FLAGS)
2589         AC_SUBST(LIBSSL_LIB_FLAGS)
2590         ])
2591
2592
2593 dnl kerberos_v4.m4--Kerberos 4 libraries and includes
2594 dnl Derrick Brashear
2595 dnl from KTH krb and Arla
2596 dnl $Id: kerberos_v4.m4,v 1.28 2005/04/26 19:14:08 shadow Exp $
2597
2598 AC_DEFUN([CMU_KRB_SENDAUTH_PROTO], [
2599 AC_MSG_CHECKING(for krb_sendauth prototype)
2600 AC_TRY_COMPILE(
2601 [#include <krb.h>
2602 int krb_sendauth (long options, int fd, KTEXT ktext, char *service,
2603                   char *inst, char *realm, u_long checksum,
2604                   MSG_DAT *msg_data, CREDENTIALS *cred,
2605                   Key_schedule schedule, struct sockaddr_in *laddr,
2606                   struct sockaddr_in *faddr, char *version);],
2607 [int foo = krb_sendauth(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); ],
2608 ac_cv_krb_sendauth_proto=no,
2609 ac_cv_krb_sendauth_proto=yes)
2610 AC_MSG_RESULT($ac_cv_krb_sendauth_proto)
2611 if test "$ac_cv_krb_sendauth_proto" = yes; then
2612         AC_DEFINE(HAVE_KRB_SENDAUTH_PROTO)dnl
2613 fi
2614 AC_MSG_RESULT($ac_cv_krb_sendauth_proto)
2615 ])
2616
2617 AC_DEFUN([CMU_KRB_SET_KEY_PROTO], [
2618 AC_MSG_CHECKING(for krb_set_key prototype)
2619 AC_CACHE_VAL(ac_cv_krb_set_key_proto, [
2620 cmu_save_CPPFLAGS="$CPPFLAGS"
2621 CPPFLAGS="${CPPFLAGS} ${KRB_INC_FLAGS}"
2622 AC_TRY_COMPILE(
2623 [#include <krb.h>
2624 int krb_set_key(char *key, int cvt);],
2625 [int foo = krb_set_key(0, 0);],
2626 ac_cv_krb_set_key_proto=no,
2627 ac_cv_krb_set_key_proto=yes)
2628 ])
2629 CPPFLAGS="${cmu_save_CPPFLAGS}"
2630 if test "$ac_cv_krb_set_key_proto" = yes; then
2631         AC_DEFINE(HAVE_KRB_SET_KEY_PROTO)dnl
2632 fi
2633 AC_MSG_RESULT($ac_cv_krb_set_key_proto)
2634 ])
2635
2636 AC_DEFUN([CMU_KRB4_32_DEFN], [
2637 AC_MSG_CHECKING(for KRB4_32 definition)
2638 AC_CACHE_VAL(ac_cv_krb4_32_defn, [
2639 cmu_save_CPPFLAGS="$CPPFLAGS"
2640 CPPFLAGS="${CPPFLAGS} ${KRB_INC_FLAGS}"
2641 AC_TRY_COMPILE(
2642 [#include <krb.h>
2643 ],
2644 [KRB4_32 foo = 1;],
2645 ac_cv_krb4_32_defn=yes,
2646 ac_cv_krb4_32_defn=no)
2647 ])
2648 CPPFLAGS="${cmu_save_CPPFLAGS}"
2649 if test "$ac_cv_krb4_32_defn" = yes; then
2650         AC_DEFINE(HAVE_KRB4_32_DEFINE)dnl
2651 fi
2652 AC_MSG_RESULT($ac_cv_krb4_32_defn)
2653 ])
2654
2655 AC_DEFUN([CMU_KRB_RD_REQ_PROTO], [
2656 AC_MSG_CHECKING(for krb_rd_req prototype)
2657 AC_CACHE_VAL(ac_cv_krb_rd_req_proto, [
2658 cmu_save_CPPFLAGS="$CPPFLAGS"
2659 CPPFLAGS="${CPPFLAGS} ${KRB_INC_FLAGS}"
2660 AC_TRY_COMPILE(
2661 [#include <krb.h>
2662 int krb_rd_req(KTEXT authent, char *service, char *instance,
2663 unsigned KRB_INT32 from_addr, AUTH_DAT *ad, char *fn);],
2664 [int foo = krb_rd_req(0,0,0,0,0,0);],
2665 ac_cv_krb_rd_req_proto=no,
2666 ac_cv_krb_rd_req_proto=yes)
2667 ])
2668 CPPFLAGS="${cmu_save_CPPFLAGS}"
2669 if test "$ac_cv_krb_rd_req_proto" = yes; then
2670         AC_DEFINE(HAVE_KRB_RD_REQ_PROTO)dnl
2671 fi
2672 AC_MSG_RESULT($ac_cv_krb_rd_req_proto)
2673 ])
2674
2675 AC_DEFUN([CMU_KRB_INC_WHERE1], [
2676 saved_CPPFLAGS=$CPPFLAGS
2677 CPPFLAGS="$saved_CPPFLAGS -I$1"
2678 AC_TRY_COMPILE([#include <krb.h>],
2679 [struct ktext foo;],
2680 ac_cv_found_krb_inc=yes,
2681 ac_cv_found_krb_inc=no)
2682 if test "$ac_cv_found_krb_inc" = "no"; then
2683   CPPFLAGS="$saved_CPPFLAGS -I$1 -I$1/kerberosIV"
2684   AC_TRY_COMPILE([#include <krb.h>],
2685   [struct ktext foo;],
2686   [ac_cv_found_krb_inc=yes],
2687   ac_cv_found_krb_inc=no)
2688 fi
2689 CPPFLAGS=$saved_CPPFLAGS
2690 ])
2691
2692 AC_DEFUN([CMU_KRB_INC_WHERE], [
2693    for i in $1; do
2694       AC_MSG_CHECKING(for kerberos headers in $i)
2695       CMU_KRB_INC_WHERE1($i)
2696       CMU_TEST_INCPATH($i, krb)
2697       if test "$ac_cv_found_krb_inc" = "yes"; then
2698         ac_cv_krb_where_inc=$i
2699         AC_MSG_RESULT(found)
2700         break
2701       else
2702         AC_MSG_RESULT(not found)
2703       fi
2704     done
2705 ])
2706
2707 #
2708 # Test for kerberos lib files
2709 #
2710
2711 AC_DEFUN([CMU_KRB_LIB_WHERE1], [
2712 saved_LIBS=$LIBS
2713 LIBS="$saved_LIBS -L$1 -lkrb ${KRB_LIBDES}"
2714 AC_TRY_LINK(,
2715 [dest_tkt();],
2716 [ac_cv_found_krb_lib=yes],
2717 ac_cv_found_krb_lib=no)
2718 LIBS=$saved_LIBS
2719 ])
2720
2721 AC_DEFUN([CMU_KRB_LIB_WHERE], [
2722    for i in $1; do
2723       AC_MSG_CHECKING(for kerberos libraries in $i)
2724       CMU_KRB_LIB_WHERE1($i)
2725       dnl deal with false positives from implicit link paths
2726       CMU_TEST_LIBPATH($i, krb)
2727       if test "$ac_cv_found_krb_lib" = "yes" ; then
2728         ac_cv_krb_where_lib=$i
2729         AC_MSG_RESULT(found)
2730         break
2731       else
2732         AC_MSG_RESULT(not found)
2733       fi
2734     done
2735 ])
2736
2737 AC_DEFUN([CMU_KRB4], [
2738 AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
2739 AC_REQUIRE([CMU_SOCKETS])
2740 AC_REQUIRE([CMU_LIBSSL])
2741 AC_ARG_WITH(krb4,
2742         [  --with-krb4=PREFIX      Compile with Kerberos 4 support],
2743         [if test "X$with_krb4" = "X"; then
2744                 with_krb4=yes
2745         fi])
2746 AC_ARG_WITH(krb4-lib,
2747         [  --with-krb4-lib=dir     use kerberos 4 libraries in dir],
2748         [if test "$withval" = "yes" -o "$withval" = "no"; then
2749                 AC_MSG_ERROR([No argument for --with-krb4-lib])
2750         fi])
2751 AC_ARG_WITH(krb4-include,
2752         [  --with-krb4-include=dir use kerberos 4 headers in dir],
2753         [if test "$withval" = "yes" -o "$withval" = "no"; then
2754                 AC_MSG_ERROR([No argument for --with-krb4-include])
2755         fi])
2756
2757         if test "X$with_krb4" != "X"; then
2758           if test "$with_krb4" != "yes" -a "$with_krb4" != "no"; then
2759             ac_cv_krb_where_lib=$with_krb4/$CMU_LIB_SUBDIR
2760             ac_cv_krb_where_inc=$with_krb4/include
2761           fi
2762         fi
2763        
2764         if test "$with_krb4" != "no"; then
2765           if test "X$with_krb4_lib" != "X"; then
2766             ac_cv_krb_where_lib=$with_krb4_lib
2767           fi
2768           if test "X$with_krb4_include" != "X"; then
2769             ac_cv_krb_where_inc=$with_krb4_include
2770           fi
2771           if test "X$ac_cv_krb_where_inc" = "X"; then
2772             CMU_KRB_INC_WHERE(/usr/athena/include /usr/include/kerberosIV /usr/local/include /usr/include/kerberos)
2773           fi
2774
2775           AC_MSG_CHECKING([if libdes is needed])
2776           AC_TRY_LINK([],[des_quad_cksum();],KRB_DES_LIB="",KRB_DES_LIB="maybe")
2777           if test "X$KRB_DES_LIB" != "X"; then
2778               LIBS="$cmu_save_LIBS -ldes"
2779               AC_TRY_LINK([], [des_quad_cksum();],KRB_DES_LIB="yes")
2780               if test "X$KRB_DES_LIB" = "Xyes"; then
2781                   AC_MSG_RESULT([yes])
2782                   KRB_LIBDES="-ldes"
2783                   KRB_LIBDESA='$(KRB_LIB_DIR)/libdes.a'
2784               else
2785                   LIBS="$cmu_save_LIBS $LIBSSL_LIB_FLAGS"
2786                   AC_TRY_LINK([],
2787                   [des_quad_cksum();],KRB_DES_LIB="libcrypto")
2788                   if test "X$KRB_DES_LIB" = "Xlibcrypto"; then
2789                       AC_MSG_RESULT([libcrypto])
2790                       KRB_LIBDES="$LIBSSL_LIB_FLAGS"
2791                       KRB_LIBDESA="$LIBSSL_LIB_FLAGS"
2792                   else
2793                       LIBS="$cmu_save_LIBS -L$LIBSSL_LIB_DIR -ldescompat $LIBSSL_LIB_FLAGS"
2794                       AC_TRY_LINK([],
2795                       [des_quad_cksum();],KRB_DES_LIB="libcrypto+descompat")
2796                       if test "X$KRB_DES_LIB" = "Xlibcrypto+descompat"; then
2797                           AC_MSG_RESULT([libcrypto+descompat])
2798                           KRB_LIBDES="-L$LIBSSL_LIB_DIR -ldescompat $LIBSSL_LIB_FLAGS"
2799                           KRB_LIBDESA="-L$LIBSSL_LIB_DIR -ldescompat $LIBSSL_LIB_FLAGS"
2800                       else
2801                           AC_MSG_RESULT([unknown])
2802                           AC_MSG_ERROR([Could not use -ldes])
2803                       fi 
2804                   fi 
2805               fi 
2806           else
2807              AC_MSG_RESULT([no])
2808           fi
2809           if test "X$ac_cv_krb_where_lib" = "X"; then
2810             CMU_KRB_LIB_WHERE(/usr/athena/$CMU_LIB_SUBDIR /usr/local/$CMU_LIB_SUBDIR /usr/$CMU_LIB_SUBDIR)
2811           fi
2812         fi
2813           LIBS="${cmu_save_LIBS}"
2814
2815
2816         AC_MSG_CHECKING([whether to include kerberos 4])
2817         if test "X$ac_cv_krb_where_lib" = "X" -o "X$ac_cv_krb_where_inc" = "X"; then
2818           ac_cv_found_krb=no
2819           AC_MSG_RESULT(no)
2820         else
2821           ac_cv_found_krb=yes
2822           AC_MSG_RESULT(yes)
2823           KRB_INC_DIR=$ac_cv_krb_where_inc
2824           KRB_LIB_DIR=$ac_cv_krb_where_lib
2825           KRB_INC_FLAGS="-I${KRB_INC_DIR}"
2826           KRB_LIB_FLAGS="-L${KRB_LIB_DIR} -lkrb ${KRB_LIBDES}"
2827           LIBS="${cmu_save_LIBS} ${KRB_LIB_FLAGS}"
2828           AC_CHECK_LIB(resolv, dns_lookup, KRB_LIB_FLAGS="${KRB_LIB_FLAGS} -lresolv",,"${KRB_LIB_FLAGS}")
2829           AC_CHECK_LIB(crypt, crypt, KRB_LIB_FLAGS="${KRB_LIB_FLAGS} -lcrypt",,"${KRB_LIB_FLAGS}")
2830           LIBS="${LIBS} ${KRB_LIB_FLAGS}"
2831           AC_CHECK_FUNCS(krb_get_int krb_life_to_time)
2832           AC_SUBST(KRB_INC_FLAGS)
2833           AC_SUBST(KRB_LIB_FLAGS)
2834           LIBS="${cmu_save_LIBS}"
2835           AC_DEFINE(HAVE_KRB4,,[Kerberos V4 is present])dnl zephyr uses this
2836           AC_DEFINE(KERBEROS,,[Use kerberos 4. find out what needs this symbol])
2837           if test "X$RPATH" = "X"; then
2838                 RPATH=""
2839           fi
2840           case "${host}" in
2841             *-*-linux*)
2842               if test "X$RPATH" = "X"; then
2843                 RPATH="-Wl,-rpath,${KRB_LIB_DIR}"
2844               else 
2845                 RPATH="${RPATH}:${KRB_LIB_DIR}"
2846               fi
2847               ;;
2848             *-*-hpux*)
2849               if test "X$RPATH" = "X"; then
2850                 RPATH="-Wl,+b${KRB_LIB_DIR}"
2851               else 
2852                 RPATH="${RPATH}:${KRB_LIB_DIR}"
2853               fi
2854               ;;
2855             *-*-irix*)
2856               if test "X$RPATH" = "X"; then
2857                 RPATH="-Wl,-rpath,${KRB_LIB_DIR}"
2858               else 
2859                 RPATH="${RPATH}:${KRB_LIB_DIR}"
2860               fi
2861               ;;
2862             *-*-solaris2*)
2863               if test "$ac_cv_prog_gcc" = yes; then
2864                 if test "X$RPATH" = "X"; then
2865                   RPATH="-Wl,-R${KRB_LIB_DIR}"
2866                 else 
2867                   RPATH="${RPATH}:${KRB_LIB_DIR}"
2868                 fi
2869               else
2870                 RPATH="${RPATH} -R${KRB_LIB_DIR}"
2871               fi
2872               ;;
2873           esac
2874           AC_SUBST(RPATH)
2875         fi
2876         ])
2877
2878
2879 dnl See whether we can use IPv6 related functions
2880 dnl contributed by Hajimu UMEMOTO
2881
2882 AC_DEFUN([IPv6_CHECK_FUNC], [
2883 AC_CHECK_FUNC($1, [dnl
2884   ac_cv_lib_socket_$1=no
2885   ac_cv_lib_inet6_$1=no
2886 ], [dnl
2887   AC_CHECK_LIB(socket, $1, [dnl
2888     LIBS="$LIBS -lsocket"
2889     ac_cv_lib_inet6_$1=no
2890   ], [dnl
2891     AC_MSG_CHECKING([whether your system has IPv6 directory])
2892     AC_CACHE_VAL(ipv6_cv_dir, [dnl
2893       for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
2894         if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
2895           break
2896         fi
2897       done])dnl
2898     AC_MSG_RESULT($ipv6_cv_dir)
2899     if test $ipv6_cv_dir = no; then
2900       ac_cv_lib_inet6_$1=no
2901     else
2902       if test x$ipv6_libinet6 = x; then
2903         ipv6_libinet6=no
2904         SAVELDFLAGS="$LDFLAGS"
2905         LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
2906       fi
2907       AC_CHECK_LIB(inet6, $1, [dnl
2908         if test $ipv6_libinet6 = no; then
2909           ipv6_libinet6=yes
2910           LIBS="$LIBS -linet6"
2911         fi],)dnl
2912       if test $ipv6_libinet6 = no; then
2913         LDFLAGS="$SAVELDFLAGS"
2914       fi
2915     fi])dnl
2916 ])dnl
2917 ipv6_cv_$1=no
2918 if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \
2919      -o $ac_cv_lib_inet6_$1 = yes
2920 then
2921   ipv6_cv_$1=yes
2922 fi
2923 if test $ipv6_cv_$1 = no; then
2924   if test $1 = getaddrinfo; then
2925     for ipv6_cv_pfx in o n; do
2926       AC_EGREP_HEADER(${ipv6_cv_pfx}$1, netdb.h,
2927                       [AC_CHECK_FUNC(${ipv6_cv_pfx}$1)])
2928       if eval test X\$ac_cv_func_${ipv6_cv_pfx}$1 = Xyes; then
2929         AC_DEFINE(HAVE_GETADDRINFO,[],[Do we have a getaddrinfo?])
2930         ipv6_cv_$1=yes
2931         break
2932       fi
2933     done
2934   fi
2935 fi
2936 if test $ipv6_cv_$1 = yes; then
2937   ifelse([$2], , :, [$2])
2938 else
2939   ifelse([$3], , :, [$3])
2940 fi])
2941
2942
2943 dnl See whether we have ss_family in sockaddr_storage
2944 AC_DEFUN([IPv6_CHECK_SS_FAMILY], [
2945 AC_MSG_CHECKING([whether you have ss_family in struct sockaddr_storage])
2946 AC_CACHE_VAL(ipv6_cv_ss_family, [dnl
2947 AC_TRY_COMPILE([#include <sys/types.h>
2948 #include <sys/socket.h>],
2949         [struct sockaddr_storage ss; int i = ss.ss_family;],
2950         [ipv6_cv_ss_family=yes], [ipv6_cv_ss_family=no])])dnl
2951 if test $ipv6_cv_ss_family = yes; then
2952   ifelse([$1], , AC_DEFINE(HAVE_SS_FAMILY,[],[Is there an ss_family in sockaddr_storage?]), [$1])
2953 else
2954   ifelse([$2], , :, [$2])
2955 fi
2956 AC_MSG_RESULT($ipv6_cv_ss_family)])
2957
2958
2959 dnl whether you have sa_len in struct sockaddr
2960 AC_DEFUN([IPv6_CHECK_SA_LEN], [
2961 AC_MSG_CHECKING([whether you have sa_len in struct sockaddr])
2962 AC_CACHE_VAL(ipv6_cv_sa_len, [dnl
2963 AC_TRY_COMPILE([#include <sys/types.h>
2964 #include <sys/socket.h>],
2965                [struct sockaddr sa; int i = sa.sa_len;],
2966                [ipv6_cv_sa_len=yes], [ipv6_cv_sa_len=no])])dnl
2967 if test $ipv6_cv_sa_len = yes; then
2968   ifelse([$1], , AC_DEFINE(HAVE_SOCKADDR_SA_LEN,[],[Does sockaddr have an sa_len?]), [$1])
2969 else
2970   ifelse([$2], , :, [$2])
2971 fi
2972 AC_MSG_RESULT($ipv6_cv_sa_len)])
2973
2974
2975 dnl See whether sys/socket.h has socklen_t
2976 AC_DEFUN([IPv6_CHECK_SOCKLEN_T], [
2977 AC_MSG_CHECKING(for socklen_t)
2978 AC_CACHE_VAL(ipv6_cv_socklen_t, [dnl
2979 AC_TRY_LINK([#include <sys/types.h>
2980 #include <sys/socket.h>],
2981             [socklen_t len = 0;],
2982             [ipv6_cv_socklen_t=yes], [ipv6_cv_socklen_t=no])])dnl
2983 if test $ipv6_cv_socklen_t = yes; then
2984   ifelse([$1], , AC_DEFINE(HAVE_SOCKLEN_T,[],[Do we have a socklen_t?]), [$1])
2985 else
2986   ifelse([$2], , :, [$2])
2987 fi
2988 AC_MSG_RESULT($ipv6_cv_socklen_t)])
2989
2990