]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - crypto/heimdal/aclocal.m4
unfinished sblive driver, playback/mixer only for now - not enabled in
[FreeBSD/FreeBSD.git] / crypto / heimdal / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl $Id: acinclude.m4,v 1.15 1998/05/23 14:54:53 joda Exp $
14 dnl
15 dnl Only put things that for some reason can't live in the `cf'
16 dnl directory in this file.
17 dnl
18
19 dnl $xId: misc.m4,v 1.1 1997/12/14 15:59:04 joda Exp $
20 dnl
21 define(upcase,`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
22
23 # Like AC_CONFIG_HEADER, but automatically create stamp file.
24
25 AC_DEFUN(AM_CONFIG_HEADER,
26 [AC_PREREQ([2.12])
27 AC_CONFIG_HEADER([$1])
28 dnl When config.status generates a header, we must update the stamp-h file.
29 dnl This file resides in the same directory as the config header
30 dnl that is generated.  We must strip everything past the first ":",
31 dnl and everything past the last "/".
32 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
33 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
34 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
35 <<am_indx=1
36 for am_file in <<$1>>; do
37   case " <<$>>CONFIG_HEADERS " in
38   *" <<$>>am_file "*<<)>>
39     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
40     ;;
41   esac
42   am_indx=`expr "<<$>>am_indx" + 1`
43 done<<>>dnl>>)
44 changequote([,]))])
45
46 # Do all the work for Automake.  This macro actually does too much --
47 # some checks are only needed if your package does certain things.
48 # But this isn't really a big deal.
49
50 # serial 1
51
52 dnl Usage:
53 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
54
55 AC_DEFUN(AM_INIT_AUTOMAKE,
56 [AC_REQUIRE([AC_PROG_INSTALL])
57 PACKAGE=[$1]
58 AC_SUBST(PACKAGE)
59 VERSION=[$2]
60 AC_SUBST(VERSION)
61 dnl test to see if srcdir already configured
62 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
63   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
64 fi
65 ifelse([$3],,
66 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
67 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
68 AC_REQUIRE([AM_SANITY_CHECK])
69 AC_REQUIRE([AC_ARG_PROGRAM])
70 dnl FIXME This is truly gross.
71 missing_dir=`cd $ac_aux_dir && pwd`
72 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
73 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
74 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
75 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
76 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
77 AC_REQUIRE([AC_PROG_MAKE_SET])])
78
79 #
80 # Check to make sure that the build environment is sane.
81 #
82
83 AC_DEFUN(AM_SANITY_CHECK,
84 [AC_MSG_CHECKING([whether build environment is sane])
85 # Just in case
86 sleep 1
87 echo timestamp > conftestfile
88 # Do `set' in a subshell so we don't clobber the current shell's
89 # arguments.  Must try -L first in case configure is actually a
90 # symlink; some systems play weird games with the mod time of symlinks
91 # (eg FreeBSD returns the mod time of the symlink's containing
92 # directory).
93 if (
94    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
95    if test "[$]*" = "X"; then
96       # -L didn't work.
97       set X `ls -t $srcdir/configure conftestfile`
98    fi
99    if test "[$]*" != "X $srcdir/configure conftestfile" \
100       && test "[$]*" != "X conftestfile $srcdir/configure"; then
101
102       # If neither matched, then we have a broken ls.  This can happen
103       # if, for instance, CONFIG_SHELL is bash and it inherits a
104       # broken ls alias from the environment.  This has actually
105       # happened.  Such a system could not be considered "sane".
106       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
107 alias in your environment])
108    fi
109
110    test "[$]2" = conftestfile
111    )
112 then
113    # Ok.
114    :
115 else
116    AC_MSG_ERROR([newly created file is older than distributed files!
117 Check your system clock])
118 fi
119 rm -f conftest*
120 AC_MSG_RESULT(yes)])
121
122 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
123 dnl The program must properly implement --version.
124 AC_DEFUN(AM_MISSING_PROG,
125 [AC_MSG_CHECKING(for working $2)
126 # Run test in a subshell; some versions of sh will print an error if
127 # an executable is not found, even if stderr is redirected.
128 # Redirect stdin to placate older versions of autoconf.  Sigh.
129 if ($2 --version) < /dev/null > /dev/null 2>&1; then
130    $1=$2
131    AC_MSG_RESULT(found)
132 else
133    $1="$3/missing $2"
134    AC_MSG_RESULT(missing)
135 fi
136 AC_SUBST($1)])
137
138
139 dnl AM_PROG_LEX
140 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
141 AC_DEFUN(AM_PROG_LEX,
142 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
143 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
144 AC_PROG_LEX
145 AC_DECL_YYTEXT])
146
147 dnl $Id: krb-prog-ln-s.m4,v 1.1 1997/12/14 15:59:01 joda Exp $
148 dnl
149 dnl
150 dnl Better test for ln -s, ln or cp
151 dnl
152
153 AC_DEFUN(AC_KRB_PROG_LN_S,
154 [AC_MSG_CHECKING(for ln -s or something else)
155 AC_CACHE_VAL(ac_cv_prog_LN_S,
156 [rm -f conftestdata
157 if ln -s X conftestdata 2>/dev/null
158 then
159   rm -f conftestdata
160   ac_cv_prog_LN_S="ln -s"
161 else
162   touch conftestdata1
163   if ln conftestdata1 conftestdata2; then
164     rm -f conftestdata*
165     ac_cv_prog_LN_S=ln
166   else
167     ac_cv_prog_LN_S=cp
168   fi
169 fi])dnl
170 LN_S="$ac_cv_prog_LN_S"
171 AC_MSG_RESULT($ac_cv_prog_LN_S)
172 AC_SUBST(LN_S)dnl
173 ])
174
175
176 dnl $Id: mips-abi.m4,v 1.4 1998/05/16 20:44:15 joda Exp $
177 dnl
178 dnl
179 dnl Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext to some
180 dnl value.
181
182 AC_DEFUN(AC_MIPS_ABI, [
183 AC_ARG_WITH(mips_abi,
184 [  --with-mips-abi=abi     ABI to use for IRIX (32, n32, or 64)])
185
186 case "$host_os" in
187 irix*)
188 with_mips_abi="${with_mips_abi:-yes}"
189 if test -n "$GCC"; then
190
191 # GCC < 2.8 only supports the O32 ABI. GCC >= 2.8 has a flag to select
192 # which ABI to use, but only supports (as of 2.8.1) the N32 and 64 ABIs.
193 #
194 # Default to N32, but if GCC doesn't grok -mabi=n32, we assume an old
195 # GCC and revert back to O32. The same goes if O32 is asked for - old
196 # GCCs doesn't like the -mabi option, and new GCCs can't output O32.
197 #
198 # Don't you just love *all* the different SGI ABIs?
199
200 case "${with_mips_abi}" in 
201         32|o32) abi='-mabi=32';  abilibdirext=''     ;;
202        n32|yes) abi='-mabi=n32'; abilibdirext='32'  ;;
203         64) abi='-mabi=64';  abilibdirext='64'   ;;
204         no) abi=''; abilibdirext='';;
205          *) AC_ERROR("Invalid ABI specified") ;;
206 esac
207 if test -n "$abi" ; then
208 ac_foo=krb_cv_gcc_`echo $abi | tr =- __`
209 dnl
210 dnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to
211 dnl AC_MSG_RESULT
212 dnl
213 AC_MSG_CHECKING([if $CC supports the $abi option])
214 AC_CACHE_VAL($ac_foo, [
215 save_CFLAGS="$CFLAGS"
216 CFLAGS="$CFLAGS $abi"
217 AC_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no)
218 CFLAGS="$save_CFLAGS"
219 ])
220 ac_res=`eval echo \\\$$ac_foo`
221 AC_MSG_RESULT($ac_res)
222 if test $ac_res = no; then
223 # Try to figure out why that failed...
224 case $abi in
225         -mabi=32) 
226         save_CFLAGS="$CFLAGS"
227         CFLAGS="$CFLAGS -mabi=n32"
228         AC_TRY_COMPILE(,int x;, ac_res=yes, ac_res=no)
229         CLAGS="$save_CFLAGS"
230         if test $ac_res = yes; then
231                 # New GCC
232                 AC_ERROR([$CC does not support the $with_mips_abi ABI])
233         fi
234         # Old GCC
235         abi=''
236         abilibdirext=''
237         ;;
238         -mabi=n32|-mabi=64)
239                 if test $with_mips_abi = yes; then
240                         # Old GCC, default to O32
241                         abi=''
242                         abilibdirext=''
243                 else
244                         # Some broken GCC
245                         AC_ERROR([$CC does not support the $with_mips_abi ABI])
246                 fi
247         ;;
248 esac
249 fi #if test $ac_res = no; then
250 fi #if test -n "$abi" ; then
251 else
252 case "${with_mips_abi}" in
253         32|o32) abi='-32'; abilibdirext=''     ;;
254        n32|yes) abi='-n32'; abilibdirext='32'  ;;
255         64) abi='-64'; abilibdirext='64'   ;;
256         no) abi=''; abilibdirext='';;
257          *) AC_ERROR("Invalid ABI specified") ;;
258 esac
259 fi #if test -n "$GCC"; then
260 ;;
261 esac
262 ])
263
264 dnl
265 dnl $Id: c-attribute.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
266 dnl
267
268 dnl
269 dnl Test for __attribute__
270 dnl
271
272 AC_DEFUN(AC_C___ATTRIBUTE__, [
273 AC_MSG_CHECKING(for __attribute__)
274 AC_CACHE_VAL(ac_cv___attribute__, [
275 AC_TRY_COMPILE([
276 #include <stdlib.h>
277 ],
278 [
279 static void foo(void) __attribute__ ((noreturn));
280
281 static void
282 foo(void)
283 {
284   exit(1);
285 }
286 ],
287 ac_cv___attribute__=yes,
288 ac_cv___attribute__=no)])
289 if test "$ac_cv___attribute__" = "yes"; then
290   AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
291 fi
292 AC_MSG_RESULT($ac_cv___attribute__)
293 ])
294
295
296
297 # serial 25 AM_PROG_LIBTOOL
298 AC_DEFUN(AM_PROG_LIBTOOL,
299 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
300 AC_REQUIRE([AM_ENABLE_STATIC])dnl
301 AC_REQUIRE([AC_CANONICAL_HOST])dnl
302 AC_REQUIRE([AC_PROG_RANLIB])dnl
303 AC_REQUIRE([AC_PROG_CC])dnl
304 AC_REQUIRE([AM_PROG_LD])dnl
305 AC_REQUIRE([AM_PROG_NM])dnl
306 AC_REQUIRE([AC_PROG_LN_S])dnl
307 dnl
308 # Always use our own libtool.
309 LIBTOOL='$(top_builddir)/libtool'
310 AC_SUBST(LIBTOOL)dnl
311
312 # Check for any special flags to pass to ltconfig.
313 libtool_flags=
314 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
315 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
316 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
317 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
318 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
319
320 # Some flags need to be propagated to the compiler or linker for good
321 # libtool support.
322 case "$host" in
323 *-*-irix6*)
324   # Find out which ABI we are using.
325   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
326   if AC_TRY_EVAL(ac_compile); then
327     case "`/usr/bin/file conftest.o`" in
328     *32-bit*)
329       LD="${LD-ld} -32"
330       ;;
331     *N32*)
332       LD="${LD-ld} -n32"
333       ;;
334     *64-bit*)
335       LD="${LD-ld} -64"
336       ;;
337     esac
338   fi
339   rm -rf conftest*
340   ;;
341
342 *-*-sco3.2v5*)
343   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
344   CFLAGS="$CFLAGS -belf"
345   ;;
346 esac
347
348 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
349 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
350 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
351 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
352 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
353 || AC_MSG_ERROR([libtool configure failed])
354
355 # Redirect the config.log output again, so that the ltconfig log is not
356 # clobbered by the next message.
357 exec 5>>./config.log
358 ])
359
360 # AM_ENABLE_SHARED - implement the --enable-shared flag
361 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
362 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
363 #   `yes'.
364 AC_DEFUN(AM_ENABLE_SHARED,
365 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
366 AC_ARG_ENABLE(shared,
367 changequote(<<, >>)dnl
368 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
369 changequote([, ])dnl
370 [p=${PACKAGE-default}
371 case "$enableval" in
372 yes) enable_shared=yes ;;
373 no) enable_shared=no ;;
374 *)
375   enable_shared=no
376   # Look at the argument we got.  We use all the common list separators.
377   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
378   for pkg in $enableval; do
379     if test "X$pkg" = "X$p"; then
380       enable_shared=yes
381     fi
382   done
383   IFS="$ac_save_ifs"
384   ;;
385 esac],
386 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
387 ])
388
389 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
390 AC_DEFUN(AM_DISABLE_SHARED,
391 [AM_ENABLE_SHARED(no)])
392
393 # AM_DISABLE_STATIC - set the default static flag to --disable-static
394 AC_DEFUN(AM_DISABLE_STATIC,
395 [AM_ENABLE_STATIC(no)])
396
397 # AM_ENABLE_STATIC - implement the --enable-static flag
398 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
399 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
400 #   `yes'.
401 AC_DEFUN(AM_ENABLE_STATIC,
402 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
403 AC_ARG_ENABLE(static,
404 changequote(<<, >>)dnl
405 <<  --enable-static[=PKGS]  build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
406 changequote([, ])dnl
407 [p=${PACKAGE-default}
408 case "$enableval" in
409 yes) enable_static=yes ;;
410 no) enable_static=no ;;
411 *)
412   enable_static=no
413   # Look at the argument we got.  We use all the common list separators.
414   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
415   for pkg in $enableval; do
416     if test "X$pkg" = "X$p"; then
417       enable_static=yes
418     fi
419   done
420   IFS="$ac_save_ifs"
421   ;;
422 esac],
423 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
424 ])
425
426
427 # AM_PROG_LD - find the path to the GNU or non-GNU linker
428 AC_DEFUN(AM_PROG_LD,
429 [AC_ARG_WITH(gnu-ld,
430 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
431 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
432 AC_REQUIRE([AC_PROG_CC])
433 ac_prog=ld
434 if test "$ac_cv_prog_gcc" = yes; then
435   # Check if gcc -print-prog-name=ld gives a path.
436   AC_MSG_CHECKING([for ld used by GCC])
437   ac_prog=`($CC -print-prog-name=ld) 2>&5`
438   case "$ac_prog" in
439   # Accept absolute paths.
440 changequote(,)dnl
441   /* | [A-Za-z]:\\*)
442 changequote([,])dnl
443     test -z "$LD" && LD="$ac_prog"
444     ;;
445   "")
446     # If it fails, then pretend we aren't using GCC.
447     ac_prog=ld
448     ;;
449   *)
450     # If it is relative, then search for the first ld in PATH.
451     with_gnu_ld=unknown
452     ;;
453   esac
454 elif test "$with_gnu_ld" = yes; then
455   AC_MSG_CHECKING([for GNU ld])
456 else
457   AC_MSG_CHECKING([for non-GNU ld])
458 fi
459 AC_CACHE_VAL(ac_cv_path_LD,
460 [if test -z "$LD"; then
461   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
462   for ac_dir in $PATH; do
463     test -z "$ac_dir" && ac_dir=.
464     if test -f "$ac_dir/$ac_prog"; then
465       ac_cv_path_LD="$ac_dir/$ac_prog"
466       # Check to see if the program is GNU ld.  I'd rather use --version,
467       # but apparently some GNU ld's only accept -v.
468       # Break only if it was the GNU/non-GNU ld that we prefer.
469       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
470         test "$with_gnu_ld" != no && break
471       else
472         test "$with_gnu_ld" != yes && break
473       fi
474     fi
475   done
476   IFS="$ac_save_ifs"
477 else
478   ac_cv_path_LD="$LD" # Let the user override the test with a path.
479 fi])
480 LD="$ac_cv_path_LD"
481 if test -n "$LD"; then
482   AC_MSG_RESULT($LD)
483 else
484   AC_MSG_RESULT(no)
485 fi
486 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
487 AC_SUBST(LD)
488 AM_PROG_LD_GNU
489 ])
490
491 AC_DEFUN(AM_PROG_LD_GNU,
492 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
493 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
494 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
495   ac_cv_prog_gnu_ld=yes
496 else
497   ac_cv_prog_gnu_ld=no
498 fi])
499 ])
500
501 # AM_PROG_NM - find the path to a BSD-compatible name lister
502 AC_DEFUN(AM_PROG_NM,
503 [AC_MSG_CHECKING([for BSD-compatible nm])
504 AC_CACHE_VAL(ac_cv_path_NM,
505 [if test -n "$NM"; then
506   # Let the user override the test.
507   ac_cv_path_NM="$NM"
508 else
509   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
510   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
511     test -z "$ac_dir" && ac_dir=.
512     if test -f $ac_dir/nm; then
513       # Check to see if the nm accepts a BSD-compat flag.
514       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
515       #   nm: unknown option "B" ignored
516       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
517         ac_cv_path_NM="$ac_dir/nm -B"
518       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
519         ac_cv_path_NM="$ac_dir/nm -p"
520       else
521         ac_cv_path_NM="$ac_dir/nm"
522       fi
523       break
524     fi
525   done
526   IFS="$ac_save_ifs"
527   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
528 fi])
529 NM="$ac_cv_path_NM"
530 AC_MSG_RESULT([$NM])
531 AC_SUBST(NM)
532 ])
533
534 dnl $Id: wflags.m4,v 1.3 1999/03/11 12:11:41 joda Exp $
535 dnl
536 dnl set WFLAGS
537
538 AC_DEFUN(AC_WFLAGS,[
539 WFLAGS_NOUNUSED=""
540 WFLAGS_NOIMPLICITINT=""
541 if test -z "$WFLAGS" -a "$GCC" = "yes"; then
542   # -Wno-implicit-int for broken X11 headers
543   # leave these out for now:
544   #   -Wcast-align doesn't work well on alpha osf/1
545   #   -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast
546   #   -Wmissing-declarations -Wnested-externs
547   WFLAGS="ifelse($#, 0,-Wall, $1)"
548   WFLAGS_NOUNUSED="-Wno-unused"
549   WFLAGS_NOIMPLICITINT="-Wno-implicit-int"
550 fi
551 AC_SUBST(WFLAGS)dnl
552 AC_SUBST(WFLAGS_NOUNUSED)dnl
553 AC_SUBST(WFLAGS_NOIMPLICITINT)dnl
554 ])
555
556 dnl $Id: test-package.m4,v 1.7 1999/04/19 13:33:05 assar Exp $
557 dnl
558 dnl AC_TEST_PACKAGE_NEW(package,headers,libraries,extra libs,default locations)
559
560 AC_DEFUN(AC_TEST_PACKAGE,[AC_TEST_PACKAGE_NEW($1,[#include <$2>],$4,,$5)])
561
562 AC_DEFUN(AC_TEST_PACKAGE_NEW,[
563 AC_ARG_WITH($1,
564 [  --with-$1=dir                use $1 in dir])
565 AC_ARG_WITH($1-lib,
566 [  --with-$1-lib=dir            use $1 libraries in dir],
567 [if test "$withval" = "yes" -o "$withval" = "no"; then
568   AC_MSG_ERROR([No argument for --with-$1-lib])
569 elif test "X$with_$1" = "X"; then
570   with_$1=yes
571 fi])
572 AC_ARG_WITH($1-include,
573 [  --with-$1-include=dir        use $1 headers in dir],
574 [if test "$withval" = "yes" -o "$withval" = "no"; then
575   AC_MSG_ERROR([No argument for --with-$1-include])
576 elif test "X$with_$1" = "X"; then
577   with_$1=yes
578 fi])
579
580 AC_MSG_CHECKING(for $1)
581
582 case "$with_$1" in
583 yes)    ;;
584 no)     ;;
585 "")     ;;
586 *)      if test "$with_$1_include" = ""; then
587                 with_$1_include="$with_$1/include"
588         fi
589         if test "$with_$1_lib" = ""; then
590                 with_$1_lib="$with_$1/lib$abilibdirext"
591         fi
592         ;;
593 esac
594 header_dirs=
595 lib_dirs=
596 d='$5'
597 for i in $d; do
598         header_dirs="$header_dirs $i/include"
599         lib_dirs="$lib_dirs $i/lib$abilibdirext"
600 done
601
602 case "$with_$1_include" in
603 yes) ;;
604 no)  ;;
605 *)   header_dirs="$with_$1_include $header_dirs";;
606 esac
607 case "$with_$1_lib" in
608 yes) ;;
609 no)  ;;
610 *)   lib_dirs="$with_$1_lib $lib_dirs";;
611 esac
612
613 save_CFLAGS="$CFLAGS"
614 save_LIBS="$LIBS"
615 ires= lres=
616 for i in $header_dirs; do
617         CFLAGS="-I$i $save_CFLAGS"
618         AC_TRY_COMPILE([$2],,ires=$i;break)
619 done
620 for i in $lib_dirs; do
621         LIBS="-L$i $3 $4 $save_LIBS"
622         AC_TRY_LINK([$2],,lres=$i;break)
623 done
624 CFLAGS="$save_CFLAGS"
625 LIBS="$save_LIBS"
626
627 if test "$ires" -a "$lres" -a "$with_$1" != "no"; then
628         $1_includedir="$ires"
629         $1_libdir="$lres"
630         INCLUDE_$1="-I$$1_includedir"
631         LIB_$1="-L$$1_libdir $3"
632         AC_DEFINE_UNQUOTED(upcase($1),1,[Define if you have the $1 package.])
633         with_$1=yes
634         AC_MSG_RESULT([headers $ires, libraries $lres])
635 else
636         INCLUDE_$1=
637         LIB_$1=
638         with_$1=no
639         AC_MSG_RESULT($with_$1)
640 fi
641 AC_SUBST(INCLUDE_$1)
642 AC_SUBST(LIB_$1)
643 ])
644
645 dnl $Id: find-func.m4,v 1.1 1997/12/14 15:58:58 joda Exp $
646 dnl
647 dnl AC_FIND_FUNC(func, libraries, includes, arguments)
648 AC_DEFUN(AC_FIND_FUNC, [
649 AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4])
650 if test -n "$LIB_$1"; then
651         LIBS="$LIB_$1 $LIBS"
652 fi
653 ])
654
655 dnl $Id: find-func-no-libs.m4,v 1.5 1999/10/30 21:08:18 assar Exp $
656 dnl
657 dnl
658 dnl Look for function in any of the specified libraries
659 dnl
660
661 dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments, extra libs, extra args)
662 AC_DEFUN(AC_FIND_FUNC_NO_LIBS, [
663 AC_FIND_FUNC_NO_LIBS2([$1], ["" $2], [$3], [$4], [$5], [$6])])
664
665 dnl $Id: find-func-no-libs2.m4,v 1.3 1999/10/30 21:09:53 assar Exp $
666 dnl
667 dnl
668 dnl Look for function in any of the specified libraries
669 dnl
670
671 dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args)
672 AC_DEFUN(AC_FIND_FUNC_NO_LIBS2, [
673
674 AC_MSG_CHECKING([for $1])
675 AC_CACHE_VAL(ac_cv_funclib_$1,
676 [
677 if eval "test \"\$ac_cv_func_$1\" != yes" ; then
678         ac_save_LIBS="$LIBS"
679         for ac_lib in $2; do
680                 if test -n "$ac_lib"; then 
681                         ac_lib="-l$ac_lib"
682                 else
683                         ac_lib=""
684                 fi
685                 LIBS="$6 $ac_lib $5 $ac_save_LIBS"
686                 AC_TRY_LINK([$3],[$1($4)],eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break)
687         done
688         eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}"
689         LIBS="$ac_save_LIBS"
690 fi
691 ])
692
693 eval "ac_res=\$ac_cv_funclib_$1"
694
695 dnl autoheader tricks *sigh*
696 : << END
697 @@@funcs="$funcs $1"@@@
698 @@@libs="$libs $2"@@@
699 END
700
701 # $1
702 eval "ac_tr_func=HAVE_[]upcase($1)"
703 eval "ac_tr_lib=HAVE_LIB[]upcase($ac_res | sed -e 's/-l//')"
704 eval "LIB_$1=$ac_res"
705
706 case "$ac_res" in
707         yes)
708         eval "ac_cv_func_$1=yes"
709         eval "LIB_$1="
710         AC_DEFINE_UNQUOTED($ac_tr_func)
711         AC_MSG_RESULT([yes])
712         ;;
713         no)
714         eval "ac_cv_func_$1=no"
715         eval "LIB_$1="
716         AC_MSG_RESULT([no])
717         ;;
718         *)
719         eval "ac_cv_func_$1=yes"
720         eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes"
721         AC_DEFINE_UNQUOTED($ac_tr_func)
722         AC_DEFINE_UNQUOTED($ac_tr_lib)
723         AC_MSG_RESULT([yes, in $ac_res])
724         ;;
725 esac
726 AC_SUBST(LIB_$1)
727 ])
728
729 # Define a conditional.
730
731 AC_DEFUN(AM_CONDITIONAL,
732 [AC_SUBST($1_TRUE)
733 AC_SUBST($1_FALSE)
734 if $2; then
735   $1_TRUE=
736   $1_FALSE='#'
737 else
738   $1_TRUE='#'
739   $1_FALSE=
740 fi])
741
742 dnl $Id: osfc2.m4,v 1.2 1999/03/27 17:28:16 joda Exp $
743 dnl
744 dnl enable OSF C2 stuff
745
746 AC_DEFUN(AC_CHECK_OSFC2,[
747 AC_ARG_ENABLE(osfc2,
748 [  --enable-osfc2          enable some OSF C2 support])
749 LIB_security=
750 if test "$enable_osfc2" = yes; then
751         AC_DEFINE(HAVE_OSFC2, 1, [Define to enable basic OSF C2 support.])
752         LIB_security=-lsecurity
753 fi
754 AC_SUBST(LIB_security)
755 ])
756
757 dnl $Id: check-man.m4,v 1.2 1999/03/21 14:30:50 joda Exp $
758 dnl check how to format manual pages
759 dnl
760
761 AC_DEFUN(AC_CHECK_MAN,
762 [AC_PATH_PROG(NROFF, nroff)
763 AC_PATH_PROG(GROFF, groff)
764 AC_CACHE_CHECK(how to format man pages,ac_cv_sys_man_format,
765 [cat > conftest.1 << END
766 .Dd January 1, 1970
767 .Dt CONFTEST 1
768 .Sh NAME
769 .Nm conftest
770 .Nd
771 foobar
772 END
773
774 if test "$NROFF" ; then
775         for i in "-mdoc" "-mandoc"; do
776                 if "$NROFF" $i conftest.1 2> /dev/null | \
777                         grep Jan > /dev/null 2>&1 ; then
778                         ac_cv_sys_man_format="$NROFF $i"
779                         break
780                 fi
781         done
782 fi
783 if test "$ac_cv_sys_man_format" = "" -a "$GROFF" ; then
784         for i in "-mdoc" "-mandoc"; do
785                 if "$GROFF" -Tascii $i conftest.1 2> /dev/null | \
786                         grep Jan > /dev/null 2>&1 ; then
787                         ac_cv_sys_man_format="$GROFF -Tascii $i"
788                         break
789                 fi
790         done
791 fi
792 if test "$ac_cv_sys_man_format"; then
793         ac_cv_sys_man_format="$ac_cv_sys_man_format \[$]< > \[$]@"
794 fi
795 ])
796 if test "$ac_cv_sys_man_format"; then
797         CATMAN="$ac_cv_sys_man_format"
798         AC_SUBST(CATMAN)
799 fi
800 AM_CONDITIONAL(CATMAN, test "$CATMAN")
801 AC_CACHE_CHECK(extension of pre-formatted manual pages,ac_cv_sys_catman_ext,
802 [if grep _suffix /etc/man.conf > /dev/null 2>&1; then
803         ac_cv_sys_catman_ext=0
804 else
805         ac_cv_sys_catman_ext=number
806 fi
807 ])
808 if test "$ac_cv_sys_catman_ext" = number; then
809         CATMANEXT='$$ext'
810 else
811         CATMANEXT=0
812 fi
813 AC_SUBST(CATMANEXT)
814
815 ])
816 dnl
817 dnl $Id: krb-bigendian.m4,v 1.5 2000/01/08 10:34:44 assar Exp $
818 dnl
819
820 dnl check if this computer is little or big-endian
821 dnl if we can figure it out at compile-time then don't define the cpp symbol
822 dnl otherwise test for it and define it.  also allow options for overriding
823 dnl it when cross-compiling
824
825 AC_DEFUN(KRB_C_BIGENDIAN, [
826 AC_ARG_ENABLE(bigendian,
827 [  --enable-bigendian   the target is big endian],
828 krb_cv_c_bigendian=yes)
829 AC_ARG_ENABLE(littleendian,
830 [  --enable-littleendian        the target is little endian],
831 krb_cv_c_bigendian=no)
832 AC_CACHE_CHECK(whether byte order is known at compile time,
833 krb_cv_c_bigendian_compile,
834 [AC_TRY_COMPILE([
835 #include <sys/types.h>
836 #include <sys/param.h>],[
837 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
838  bogus endian macros
839 #endif], krb_cv_c_bigendian_compile=yes, krb_cv_c_bigendian_compile=no)])
840 if test "$krb_cv_c_bigendian_compile" = "no"; then
841   AC_CACHE_CHECK(whether byte ordering is bigendian, krb_cv_c_bigendian,[
842   if test "$krb_cv_c_bigendian" = ""; then
843     krb_cv_c_bigendian=unknown
844   fi
845   AC_TRY_COMPILE([
846 #include <sys/types.h>
847 #include <sys/param.h>],[
848 #if BYTE_ORDER != BIG_ENDIAN
849   not big endian
850 #endif], krb_cv_c_bigendian=yes, krb_cv_c_bigendian=no)
851   if test "$krb_cv_c_bigendian" = "unknown"; then
852     AC_TRY_RUN([main () {
853       /* Are we little or big endian?  From Harbison&Steele.  */
854       union
855       {
856         long l;
857         char c[sizeof (long)];
858       } u;
859       u.l = 1;
860       exit (u.c[sizeof (long) - 1] == 1);
861     }], krb_cv_c_bigendian=no, krb_cv_c_bigendian=yes,
862     AC_MSG_ERROR([specify either --enable-bigendian or --enable-littleendian]))
863   fi
864   ])
865   if test "$krb_cv_c_bigendian" = "yes"; then
866     AC_DEFINE(WORDS_BIGENDIAN, 1, [define if target is big endian])dnl
867   fi
868 fi
869 if test "$krb_cv_c_bigendian_compile" = "yes"; then
870   AC_DEFINE(ENDIANESS_IN_SYS_PARAM_H, 1, [define if sys/param.h defines the endiness])dnl
871 fi
872 ])
873
874 dnl 
875 dnl See if there is any X11 present
876 dnl
877 dnl $Id: check-x.m4,v 1.2 1999/11/05 04:25:23 assar Exp $
878
879 AC_DEFUN(KRB_CHECK_X,[
880 AC_PATH_XTRA
881
882 # try to figure out if we need any additional ld flags, like -R
883 # and yes, the autoconf X test is utterly broken
884 if test "$no_x" != yes; then
885         AC_CACHE_CHECK(for special X linker flags,krb_cv_sys_x_libs_rpath,[
886         ac_save_libs="$LIBS"
887         ac_save_cflags="$CFLAGS"
888         CFLAGS="$CFLAGS $X_CFLAGS"
889         krb_cv_sys_x_libs_rpath=""
890         krb_cv_sys_x_libs=""
891         for rflag in "" "-R" "-R " "-rpath "; do
892                 if test "$rflag" = ""; then
893                         foo="$X_LIBS"
894                 else
895                         foo=""
896                         for flag in $X_LIBS; do
897                         case $flag in
898                         -L*)
899                                 foo="$foo $flag `echo $flag | sed \"s/-L/$rflag/\"`"
900                                 ;;
901                         *)
902                                 foo="$foo $flag"
903                                 ;;
904                         esac
905                         done
906                 fi
907                 LIBS="$ac_save_libs $foo $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
908                 AC_TRY_RUN([
909                 #include <X11/Xlib.h>
910                 foo()
911                 {
912                 XOpenDisplay(NULL);
913                 }
914                 main()
915                 {
916                 return 0;
917                 }
918                 ], krb_cv_sys_x_libs_rpath="$rflag"; krb_cv_sys_x_libs="$foo"; break,:)
919         done
920         LIBS="$ac_save_libs"
921         CFLAGS="$ac_save_cflags"
922         ])
923         X_LIBS="$krb_cv_sys_x_libs"
924 fi
925 ])
926
927 dnl $Id: check-xau.m4,v 1.3 1999/05/14 01:17:06 assar Exp $
928 dnl
929 dnl check for Xau{Read,Write}Auth and XauFileName
930 dnl
931 AC_DEFUN(AC_CHECK_XAU,[
932 save_CFLAGS="$CFLAGS"
933 CFLAGS="$X_CFLAGS $CFLAGS"
934 save_LIBS="$LIBS"
935 dnl LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
936 LIBS="$X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
937 save_LDFLAGS="$LDFLAGS"
938 LDFLAGS="$LDFLAGS $X_LIBS"
939
940
941 AC_FIND_FUNC_NO_LIBS(XauWriteAuth, X11 Xau)
942 ac_xxx="$LIBS"
943 LIBS="$LIB_XauWriteAuth $LIBS"
944 AC_FIND_FUNC_NO_LIBS(XauReadAuth, X11 Xau)
945 LIBS="$LIB_XauReadAauth $LIBS"
946 AC_FIND_FUNC_NO_LIBS(XauFileName, X11 Xau)
947 LIBS="$ac_xxx"
948
949 case "$ac_cv_funclib_XauWriteAuth" in
950 yes)    ;;
951 no)     ;;
952 *)      if test "$ac_cv_funclib_XauReadAuth" = yes; then
953                 if test "$ac_cv_funclib_XauFileName" = yes; then
954                         LIB_XauReadAuth="$LIB_XauWriteAuth"
955                 else
956                         LIB_XauReadAuth="$LIB_XauWriteAuth $LIB_XauFileName"
957                 fi
958         else
959                 if test "$ac_cv_funclib_XauFileName" = yes; then
960                         LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth"
961                 else
962                         LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth $LIB_XauFileName"
963                 fi
964         fi
965         ;;
966 esac
967
968 if test "$AUTOMAKE" != ""; then
969         AM_CONDITIONAL(NEED_WRITEAUTH, test "$ac_cv_func_XauWriteAuth" != "yes")
970 else
971         AC_SUBST(NEED_WRITEAUTH_TRUE)
972         AC_SUBST(NEED_WRITEAUTH_FALSE)
973         if test "$ac_cv_func_XauWriteAuth" != "yes"; then
974                 NEED_WRITEAUTH_TRUE=
975                 NEED_WRITEAUTH_FALSE='#'
976         else
977                 NEED_WRITEAUTH_TRUE='#'
978                 NEED_WRITEAUTH_FALSE=
979         fi
980 fi
981 CFLAGS=$save_CFLAGS
982 LIBS=$save_LIBS
983 LDFLAGS=$save_LDFLAGS
984 ])
985
986 dnl $Id: check-type-extra.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
987 dnl
988 dnl ac_check_type + extra headers
989
990 dnl AC_CHECK_TYPE_EXTRA(TYPE, DEFAULT, HEADERS)
991 AC_DEFUN(AC_CHECK_TYPE_EXTRA,
992 [AC_REQUIRE([AC_HEADER_STDC])dnl
993 AC_MSG_CHECKING(for $1)
994 AC_CACHE_VAL(ac_cv_type_$1,
995 [AC_EGREP_CPP(dnl
996 changequote(<<,>>)dnl
997 <<$1[^a-zA-Z_0-9]>>dnl
998 changequote([,]), [#include <sys/types.h>
999 #if STDC_HEADERS
1000 #include <stdlib.h>
1001 #include <stddef.h>
1002 #endif
1003 $3], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
1004 AC_MSG_RESULT($ac_cv_type_$1)
1005 if test $ac_cv_type_$1 = no; then
1006   AC_DEFINE($1, $2, [Define this to what the type $1 should be.])
1007 fi
1008 ])
1009
1010 dnl $Id: have-type.m4,v 1.5 1999/12/31 03:10:22 assar Exp $
1011 dnl
1012 dnl check for existance of a type
1013
1014 dnl AC_HAVE_TYPE(TYPE,INCLUDES)
1015 AC_DEFUN(AC_HAVE_TYPE, [
1016 AC_REQUIRE([AC_HEADER_STDC])
1017 cv=`echo "$1" | sed 'y%./+- %__p__%'`
1018 AC_MSG_CHECKING(for $1)
1019 AC_CACHE_VAL([ac_cv_type_$cv],
1020 AC_TRY_COMPILE(
1021 [#include <sys/types.h>
1022 #if STDC_HEADERS
1023 #include <stdlib.h>
1024 #include <stddef.h>
1025 #endif
1026 $2],
1027 [$1 foo;],
1028 eval "ac_cv_type_$cv=yes",
1029 eval "ac_cv_type_$cv=no"))dnl
1030 AC_MSG_RESULT(`eval echo \\$ac_cv_type_$cv`)
1031 if test `eval echo \\$ac_cv_type_$cv` = yes; then
1032   ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
1033 dnl autoheader tricks *sigh*
1034 define(foo,translit($1, [ ], [_]))
1035 : << END
1036 @@@funcs="$funcs foo"@@@
1037 END
1038 undefine([foo])
1039   AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
1040 fi
1041 ])
1042
1043 dnl
1044 dnl $Id: check-netinet-ip-and-tcp.m4,v 1.2 1999/05/14 13:15:40 assar Exp $
1045 dnl
1046
1047 dnl extra magic check for netinet/{ip.h,tcp.h} because on irix 6.5.3
1048 dnl you have to include standards.h before including these files
1049
1050 AC_DEFUN(CHECK_NETINET_IP_AND_TCP,
1051 [
1052 AC_CHECK_HEADERS(standards.h)
1053 for i in netinet/ip.h netinet/tcp.h; do
1054
1055 cv=`echo "$i" | sed 'y%./+-%__p_%'`
1056
1057 AC_MSG_CHECKING([for $i])
1058 AC_CACHE_VAL([ac_cv_header_$cv],
1059 [AC_TRY_CPP([\
1060 #ifdef HAVE_STANDARDS_H
1061 #include <standards.h>
1062 #endif
1063 #include <$i>
1064 ],
1065 eval "ac_cv_header_$cv=yes",
1066 eval "ac_cv_header_$cv=no")])
1067 AC_MSG_RESULT(`eval echo \\$ac_cv_header_$cv`)
1068 changequote(, )dnl
1069 if test `eval echo \\$ac_cv_header_$cv` = yes; then
1070   ac_tr_hdr=HAVE_`echo $i | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
1071 changequote([, ])dnl
1072   AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
1073 fi
1074 done
1075 dnl autoheader tricks *sigh*
1076 : << END
1077 @@@headers="$headers netinet/ip.h netinet/tcp.h"@@@
1078 END
1079
1080 ])
1081
1082 dnl $Id: krb-ipv6.m4,v 1.8 2000/01/01 11:44:45 assar Exp $
1083 dnl
1084 dnl test for IPv6
1085 dnl
1086 AC_DEFUN(AC_KRB_IPV6, [
1087 AC_ARG_WITH(ipv6,
1088 [  --without-ipv6       do not enable IPv6 support],[
1089 if test "$withval" = "no"; then
1090         ac_cv_lib_ipv6=no
1091 fi])
1092 AC_CACHE_VAL(ac_cv_lib_ipv6,
1093 [dnl check for different v6 implementations (by itojun)
1094 v6type=unknown
1095 v6lib=none
1096
1097 AC_MSG_CHECKING([ipv6 stack type])
1098 for i in v6d toshiba kame inria zeta linux; do
1099         case $i in
1100         v6d)
1101                 AC_EGREP_CPP(yes, [dnl
1102 #include </usr/local/v6/include/sys/types.h>
1103 #ifdef __V6D__
1104 yes
1105 #endif],
1106                         [v6type=$i; v6lib=v6;
1107                         v6libdir=/usr/local/v6/lib;
1108                         CFLAGS="-I/usr/local/v6/include $CFLAGS"])
1109                 ;;
1110         toshiba)
1111                 AC_EGREP_CPP(yes, [dnl
1112 #include <sys/param.h>
1113 #ifdef _TOSHIBA_INET6
1114 yes
1115 #endif],
1116                         [v6type=$i; v6lib=inet6;
1117                         v6libdir=/usr/local/v6/lib;
1118                         CFLAGS="-DINET6 $CFLAGS"])
1119                 ;;
1120         kame)
1121                 AC_EGREP_CPP(yes, [dnl
1122 #include <netinet/in.h>
1123 #ifdef __KAME__
1124 yes
1125 #endif],
1126                         [v6type=$i; v6lib=inet6;
1127                         v6libdir=/usr/local/v6/lib;
1128                         CFLAGS="-DINET6 $CFLAGS"])
1129                 ;;
1130         inria)
1131                 AC_EGREP_CPP(yes, [dnl
1132 #include <netinet/in.h>
1133 #ifdef IPV6_INRIA_VERSION
1134 yes
1135 #endif],
1136                         [v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
1137                 ;;
1138         zeta)
1139                 AC_EGREP_CPP(yes, [dnl
1140 #include <sys/param.h>
1141 #ifdef _ZETA_MINAMI_INET6
1142 yes
1143 #endif],
1144                         [v6type=$i; v6lib=inet6;
1145                         v6libdir=/usr/local/v6/lib;
1146                         CFLAGS="-DINET6 $CFLAGS"])
1147                 ;;
1148         linux)
1149                 if test -d /usr/inet6; then
1150                         v6type=$i
1151                         v6lib=inet6
1152                         v6libdir=/usr/inet6
1153                         CFLAGS="-DINET6 $CFLAGS"
1154                 fi
1155                 ;;
1156         esac
1157         if test "$v6type" != "unknown"; then
1158                 break
1159         fi
1160 done
1161 AC_MSG_RESULT($v6type)
1162
1163 if test "$v6lib" != "none"; then
1164         for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
1165                 if test -d $dir -a -f $dir/lib$v6lib.a; then
1166                         LIBS="-L$dir -l$v6lib $LIBS"
1167                         break
1168                 fi
1169         done
1170 fi
1171 AC_TRY_LINK([
1172 #ifdef HAVE_SYS_TYPES_H
1173 #include <sys/types.h>
1174 #endif
1175 #ifdef HAVE_SYS_SOCKET_H
1176 #include <sys/socket.h>
1177 #endif
1178 #ifdef HAVE_NETINET_IN_H
1179 #include <netinet/in.h>
1180 #endif
1181 #ifdef HAVE_NETINET_IN6_H
1182 #include <netinet/in6.h>
1183 #endif
1184 ],
1185 [
1186  struct sockaddr_in6 sin6;
1187  int s;
1188
1189  s = socket(AF_INET6, SOCK_DGRAM, 0);
1190
1191  sin6.sin6_family = AF_INET6;
1192  sin6.sin6_port = htons(17);
1193  sin6.sin6_addr = in6addr_any;
1194  bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
1195 ],
1196 ac_cv_lib_ipv6=yes,
1197 ac_cv_lib_ipv6=no)])
1198 AC_MSG_CHECKING(for IPv6)
1199 AC_MSG_RESULT($ac_cv_lib_ipv6)
1200 if test "$ac_cv_lib_ipv6" = yes; then
1201   AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])
1202 fi
1203 ])
1204
1205 dnl $Id: broken-snprintf.m4,v 1.3 1999/03/01 09:52:22 joda Exp $
1206 dnl
1207 AC_DEFUN(AC_BROKEN_SNPRINTF, [
1208 AC_CACHE_CHECK(for working snprintf,ac_cv_func_snprintf_working,
1209 ac_cv_func_snprintf_working=yes
1210 AC_TRY_RUN([
1211 #include <stdio.h>
1212 #include <string.h>
1213 int main()
1214 {
1215 changequote(`,')dnl
1216         char foo[3];
1217 changequote([,])dnl
1218         snprintf(foo, 2, "12");
1219         return strcmp(foo, "1");
1220 }],:,ac_cv_func_snprintf_working=no,:))
1221
1222 if test "$ac_cv_func_snprintf_working" = yes; then
1223         AC_DEFINE_UNQUOTED(HAVE_SNPRINTF, 1, [define if you have a working snprintf])
1224 fi
1225 if test "$ac_cv_func_snprintf_working" = yes; then
1226 AC_NEED_PROTO([#include <stdio.h>],snprintf)
1227 fi
1228 ])
1229
1230 AC_DEFUN(AC_BROKEN_VSNPRINTF,[
1231 AC_CACHE_CHECK(for working vsnprintf,ac_cv_func_vsnprintf_working,
1232 ac_cv_func_vsnprintf_working=yes
1233 AC_TRY_RUN([
1234 #include <stdio.h>
1235 #include <string.h>
1236 #include <stdarg.h>
1237
1238 int foo(int num, ...)
1239 {
1240 changequote(`,')dnl
1241         char bar[3];
1242 changequote([,])dnl
1243         va_list arg;
1244         va_start(arg, num);
1245         vsnprintf(bar, 2, "%s", arg);
1246         va_end(arg);
1247         return strcmp(bar, "1");
1248 }
1249
1250
1251 int main()
1252 {
1253         return foo(0, "12");
1254 }],:,ac_cv_func_vsnprintf_working=no,:))
1255
1256 if test "$ac_cv_func_vsnprintf_working" = yes; then
1257         AC_DEFINE_UNQUOTED(HAVE_VSNPRINTF, 1, [define if you have a working vsnprintf])
1258 fi
1259 if test "$ac_cv_func_vsnprintf_working" = yes; then
1260 AC_NEED_PROTO([#include <stdio.h>],vsnprintf)
1261 fi
1262 ])
1263
1264 dnl $Id: need-proto.m4,v 1.2 1999/03/01 09:52:24 joda Exp $
1265 dnl
1266 dnl
1267 dnl Check if we need the prototype for a function
1268 dnl
1269
1270 dnl AC_NEED_PROTO(includes, function)
1271
1272 AC_DEFUN(AC_NEED_PROTO, [
1273 if test "$ac_cv_func_$2+set" != set -o "$ac_cv_func_$2" = yes; then
1274 AC_CACHE_CHECK([if $2 needs a prototype], ac_cv_func_$2_noproto,
1275 AC_TRY_COMPILE([$1],
1276 [struct foo { int foo; } xx;
1277 extern int $2 (struct foo*);
1278 $2(&xx);
1279 ],
1280 eval "ac_cv_func_$2_noproto=yes",
1281 eval "ac_cv_func_$2_noproto=no"))
1282 define([foo], [NEED_]translit($2, [a-z], [A-Z])[_PROTO])
1283 if test "$ac_cv_func_$2_noproto" = yes; then
1284         AC_DEFINE(foo, 1, [define if the system is missing a prototype for $2()])
1285 fi
1286 undefine([foo])
1287 fi
1288 ])
1289
1290 dnl $Id: broken-glob.m4,v 1.2 1999/03/01 09:52:15 joda Exp $
1291 dnl
1292 dnl check for glob(3)
1293 dnl
1294 AC_DEFUN(AC_BROKEN_GLOB,[
1295 AC_CACHE_CHECK(for working glob, ac_cv_func_glob_working,
1296 ac_cv_func_glob_working=yes
1297 AC_TRY_LINK([
1298 #include <stdio.h>
1299 #include <glob.h>],[
1300 glob(NULL, GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE, NULL, NULL);
1301 ],:,ac_cv_func_glob_working=no,:))
1302
1303 if test "$ac_cv_func_glob_working" = yes; then
1304         AC_DEFINE(HAVE_GLOB, 1, [define if you have a glob() that groks 
1305         GLOB_BRACE, GLOB_NOCHECK, GLOB_QUOTE, and GLOB_TILDE])
1306 fi
1307 if test "$ac_cv_func_glob_working" = yes; then
1308 AC_NEED_PROTO([#include <stdio.h>
1309 #include <glob.h>],glob)
1310 fi
1311 ])
1312
1313 dnl
1314 dnl $Id: krb-func-getlogin.m4,v 1.1 1999/07/13 17:45:30 assar Exp $
1315 dnl
1316 dnl test for POSIX (broken) getlogin
1317 dnl
1318
1319
1320 AC_DEFUN(AC_FUNC_GETLOGIN, [
1321 AC_CHECK_FUNCS(getlogin setlogin)
1322 if test "$ac_cv_func_getlogin" = yes; then
1323 AC_CACHE_CHECK(if getlogin is posix, ac_cv_func_getlogin_posix, [
1324 if test "$ac_cv_func_getlogin" = yes -a "$ac_cv_func_setlogin" = yes; then
1325         ac_cv_func_getlogin_posix=no
1326 else
1327         ac_cv_func_getlogin_posix=yes
1328 fi
1329 ])
1330 if test "$ac_cv_func_getlogin_posix" = yes; then
1331         AC_DEFINE(POSIX_GETLOGIN, 1, [Define if getlogin has POSIX flavour (and not BSD).])
1332 fi
1333 fi
1334 ])
1335
1336 dnl
1337 dnl $Id: capabilities.m4,v 1.2 1999/09/01 11:02:26 joda Exp $
1338 dnl
1339
1340 dnl
1341 dnl Test SGI capabilities
1342 dnl
1343
1344 AC_DEFUN(KRB_CAPABILITIES,[
1345
1346 AC_CHECK_HEADERS(capability.h sys/capability.h)
1347
1348 AC_CHECK_FUNCS(sgi_getcapabilitybyname cap_set_proc)
1349 ])
1350
1351 dnl $Id: check-getpwnam_r-posix.m4,v 1.2 1999/03/23 16:47:31 joda Exp $
1352 dnl
1353 dnl check for getpwnam_r, and if it's posix or not
1354
1355 AC_DEFUN(AC_CHECK_GETPWNAM_R_POSIX,[
1356 AC_FIND_FUNC_NO_LIBS(getpwnam_r,c_r)
1357 if test "$ac_cv_func_getpwnam_r" = yes; then
1358         AC_CACHE_CHECK(if getpwnam_r is posix,ac_cv_func_getpwnam_r_posix,
1359         ac_libs="$LIBS"
1360         LIBS="$LIBS $LIB_getpwnam_r"
1361         AC_TRY_RUN([
1362 #include <pwd.h>
1363 int main()
1364 {
1365         struct passwd pw, *pwd;
1366         return getpwnam_r("", &pw, NULL, 0, &pwd) < 0;
1367 }
1368 ],ac_cv_func_getpwnam_r_posix=yes,ac_cv_func_getpwnam_r_posix=no,:)
1369 LIBS="$ac_libs")
1370 if test "$ac_cv_func_getpwnam_r_posix" = yes; then
1371         AC_DEFINE(POSIX_GETPWNAM_R, 1, [Define if getpwnam_r has POSIX flavour.])
1372 fi
1373 fi
1374 ])
1375 dnl $Id: find-if-not-broken.m4,v 1.2 1998/03/16 22:16:27 joda Exp $
1376 dnl
1377 dnl
1378 dnl Mix between AC_FIND_FUNC and AC_BROKEN
1379 dnl
1380
1381 AC_DEFUN(AC_FIND_IF_NOT_BROKEN,
1382 [AC_FIND_FUNC([$1], [$2], [$3], [$4])
1383 if eval "test \"$ac_cv_func_$1\" != yes"; then
1384 LIBOBJS[]="$LIBOBJS $1.o"
1385 fi
1386 AC_SUBST(LIBOBJS)dnl
1387 ])
1388
1389 dnl $Id: broken.m4,v 1.3 1998/03/16 22:16:19 joda Exp $
1390 dnl
1391 dnl
1392 dnl Same as AC _REPLACE_FUNCS, just define HAVE_func if found in normal
1393 dnl libraries 
1394
1395 AC_DEFUN(AC_BROKEN,
1396 [for ac_func in $1
1397 do
1398 AC_CHECK_FUNC($ac_func, [
1399 ac_tr_func=HAVE_[]upcase($ac_func)
1400 AC_DEFINE_UNQUOTED($ac_tr_func)],[LIBOBJS[]="$LIBOBJS ${ac_func}.o"])
1401 dnl autoheader tricks *sigh*
1402 : << END
1403 @@@funcs="$funcs $1"@@@
1404 END
1405 done
1406 AC_SUBST(LIBOBJS)dnl
1407 ])
1408
1409 dnl $Id: proto-compat.m4,v 1.3 1999/03/01 13:03:48 joda Exp $
1410 dnl
1411 dnl
1412 dnl Check if the prototype of a function is compatible with another one
1413 dnl
1414
1415 dnl AC_PROTO_COMPAT(includes, function, prototype)
1416
1417 AC_DEFUN(AC_PROTO_COMPAT, [
1418 AC_CACHE_CHECK([if $2 is compatible with system prototype],
1419 ac_cv_func_$2_proto_compat,
1420 AC_TRY_COMPILE([$1],
1421 [$3;],
1422 eval "ac_cv_func_$2_proto_compat=yes",
1423 eval "ac_cv_func_$2_proto_compat=no"))
1424 define([foo], translit($2, [a-z], [A-Z])[_PROTO_COMPATIBLE])
1425 if test "$ac_cv_func_$2_proto_compat" = yes; then
1426         AC_DEFINE(foo, 1, [define if prototype of $2 is compatible with
1427         $3])
1428 fi
1429 undefine([foo])
1430 ])
1431 dnl $Id: check-var.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
1432 dnl
1433 dnl AC_CHECK_VAR(includes, variable)
1434 AC_DEFUN(AC_CHECK_VAR, [
1435 AC_MSG_CHECKING(for $2)
1436 AC_CACHE_VAL(ac_cv_var_$2, [
1437 AC_TRY_LINK([extern int $2;
1438 int foo() { return $2; }],
1439             [foo()],
1440             ac_cv_var_$2=yes, ac_cv_var_$2=no)
1441 ])
1442 define([foo], [HAVE_]translit($2, [a-z], [A-Z]))
1443
1444 AC_MSG_RESULT(`eval echo \\$ac_cv_var_$2`)
1445 if test `eval echo \\$ac_cv_var_$2` = yes; then
1446         AC_DEFINE_UNQUOTED(foo, 1, [define if you have $2])
1447         AC_CHECK_DECLARATION([$1],[$2])
1448 fi
1449 undefine([foo])
1450 ])
1451
1452 dnl $Id: check-declaration.m4,v 1.3 1999/03/01 13:03:08 joda Exp $
1453 dnl
1454 dnl
1455 dnl Check if we need the declaration of a variable
1456 dnl
1457
1458 dnl AC_HAVE_DECLARATION(includes, variable)
1459 AC_DEFUN(AC_CHECK_DECLARATION, [
1460 AC_MSG_CHECKING([if $2 is properly declared])
1461 AC_CACHE_VAL(ac_cv_var_$2_declaration, [
1462 AC_TRY_COMPILE([$1
1463 extern struct { int foo; } $2;],
1464 [$2.foo = 1;],
1465 eval "ac_cv_var_$2_declaration=no",
1466 eval "ac_cv_var_$2_declaration=yes")
1467 ])
1468
1469 define(foo, [HAVE_]translit($2, [a-z], [A-Z])[_DECLARATION])
1470
1471 AC_MSG_RESULT($ac_cv_var_$2_declaration)
1472 if eval "test \"\$ac_cv_var_$2_declaration\" = yes"; then
1473         AC_DEFINE(foo, 1, [define if your system declares $2])
1474 fi
1475 undefine([foo])
1476 ])
1477
1478 dnl $Id: have-struct-field.m4,v 1.6 1999/07/29 01:44:32 assar Exp $
1479 dnl
1480 dnl check for fields in a structure
1481 dnl
1482 dnl AC_HAVE_STRUCT_FIELD(struct, field, headers)
1483
1484 AC_DEFUN(AC_HAVE_STRUCT_FIELD, [
1485 define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_]))
1486 AC_CACHE_CHECK([for $2 in $1], cache_val,[
1487 AC_TRY_COMPILE([$3],[$1 x; x.$2;],
1488 cache_val=yes,
1489 cache_val=no)])
1490 if test "$cache_val" = yes; then
1491         define(foo, translit(HAVE_$1_$2, [a-z ], [A-Z_]))
1492         AC_DEFINE(foo, 1, [Define if $1 has field $2.])
1493         undefine([foo])
1494 fi
1495 undefine([cache_val])
1496 ])
1497
1498 dnl $Id: krb-struct-winsize.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
1499 dnl
1500 dnl
1501 dnl Search for struct winsize
1502 dnl
1503
1504 AC_DEFUN(AC_KRB_STRUCT_WINSIZE, [
1505 AC_MSG_CHECKING(for struct winsize)
1506 AC_CACHE_VAL(ac_cv_struct_winsize, [
1507 ac_cv_struct_winsize=no
1508 for i in sys/termios.h sys/ioctl.h; do
1509 AC_EGREP_HEADER(
1510 changequote(, )dnl
1511 struct[         ]*winsize,dnl
1512 changequote([,])dnl
1513 $i, ac_cv_struct_winsize=yes; break)dnl
1514 done
1515 ])
1516 if test "$ac_cv_struct_winsize" = "yes"; then
1517   AC_DEFINE(HAVE_STRUCT_WINSIZE, 1, [define if struct winsize is declared in sys/termios.h])
1518 fi
1519 AC_MSG_RESULT($ac_cv_struct_winsize)
1520 AC_EGREP_HEADER(ws_xpixel, termios.h, 
1521         AC_DEFINE(HAVE_WS_XPIXEL, 1, [define if struct winsize has ws_xpixel]))
1522 AC_EGREP_HEADER(ws_ypixel, termios.h, 
1523         AC_DEFINE(HAVE_WS_YPIXEL, 1, [define if struct winsize has ws_ypixel]))
1524 ])
1525
1526 dnl $Id: krb-struct-spwd.m4,v 1.3 1999/07/13 21:04:11 assar Exp $
1527 dnl
1528 dnl Test for `struct spwd'
1529
1530 AC_DEFUN(AC_KRB_STRUCT_SPWD, [
1531 AC_MSG_CHECKING(for struct spwd)
1532 AC_CACHE_VAL(ac_cv_struct_spwd, [
1533 AC_TRY_COMPILE(
1534 [#include <pwd.h>
1535 #ifdef HAVE_SHADOW_H
1536 #include <shadow.h>
1537 #endif],
1538 [struct spwd foo;],
1539 ac_cv_struct_spwd=yes,
1540 ac_cv_struct_spwd=no)
1541 ])
1542 AC_MSG_RESULT($ac_cv_struct_spwd)
1543
1544 if test "$ac_cv_struct_spwd" = "yes"; then
1545   AC_DEFINE(HAVE_STRUCT_SPWD, 1, [define if you have struct spwd])
1546 fi
1547 ])
1548
1549 dnl $Id: grok-type.m4,v 1.4 1999/11/29 11:16:48 joda Exp $
1550 dnl
1551 AC_DEFUN(AC_GROK_TYPE, [
1552 AC_CACHE_VAL(ac_cv_type_$1, 
1553 AC_TRY_COMPILE([
1554 #ifdef HAVE_INTTYPES_H
1555 #include <inttypes.h>
1556 #endif
1557 #ifdef HAVE_SYS_TYPES_H
1558 #include <sys/types.h>
1559 #endif
1560 #ifdef HAVE_SYS_BITYPES_H
1561 #include <sys/bitypes.h>
1562 #endif
1563 #ifdef HAVE_BIND_BITYPES_H
1564 #include <bind/bitypes.h>
1565 #endif
1566 #ifdef HAVE_NETINET_IN6_MACHTYPES_H
1567 #include <netinet/in6_machtypes.h>
1568 #endif
1569 ],
1570 $i x;
1571 ,
1572 eval ac_cv_type_$1=yes,
1573 eval ac_cv_type_$1=no))])
1574
1575 AC_DEFUN(AC_GROK_TYPES, [
1576 for i in $1; do
1577         AC_MSG_CHECKING(for $i)
1578         AC_GROK_TYPE($i)
1579         eval ac_res=\$ac_cv_type_$i
1580         if test "$ac_res" = yes; then
1581                 type=HAVE_[]upcase($i)
1582                 AC_DEFINE_UNQUOTED($type)
1583         fi
1584         AC_MSG_RESULT($ac_res)
1585 done
1586 ])
1587
1588 dnl $Id: auth-modules.m4,v 1.1 1999/03/21 13:48:00 joda Exp $
1589 dnl
1590 dnl Figure what authentication modules should be built
1591
1592 AC_DEFUN(AC_AUTH_MODULES,[
1593 AC_MSG_CHECKING(which authentication modules should be built)
1594
1595 LIB_AUTH_SUBDIRS=
1596
1597 if test "$ac_cv_header_siad_h" = yes; then
1598         LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS sia"
1599 fi
1600
1601 if test "$ac_cv_header_security_pam_modules_h" = yes -a "$enable_shared" = yes; then
1602         LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS pam"
1603 fi
1604
1605 case "${host}" in
1606 changequote(,)dnl
1607 *-*-irix[56]*) LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS afskauthlib" ;;
1608 changequote([,])dnl
1609 esac
1610
1611 AC_MSG_RESULT($LIB_AUTH_SUBDIRS)
1612
1613 AC_SUBST(LIB_AUTH_SUBDIRS)dnl
1614 ])
1615