aclocal.m4 revision 55682
1dnl aclocal.m4 generated automatically by aclocal 1.4
2
3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13dnl $Id: acinclude.m4,v 1.15 1998/05/23 14:54:53 joda Exp $
14dnl
15dnl Only put things that for some reason can't live in the `cf'
16dnl directory in this file.
17dnl
18
19dnl $xId: misc.m4,v 1.1 1997/12/14 15:59:04 joda Exp $
20dnl
21define(upcase,`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
22
23# Like AC_CONFIG_HEADER, but automatically create stamp file.
24
25AC_DEFUN(AM_CONFIG_HEADER,
26[AC_PREREQ([2.12])
27AC_CONFIG_HEADER([$1])
28dnl When config.status generates a header, we must update the stamp-h file.
29dnl This file resides in the same directory as the config header
30dnl that is generated.  We must strip everything past the first ":",
31dnl and everything past the last "/".
32AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
33ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
34<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
35<<am_indx=1
36for 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`
43done<<>>dnl>>)
44changequote([,]))])
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
52dnl Usage:
53dnl AM_INIT_AUTOMAKE(package,version, [no-define])
54
55AC_DEFUN(AM_INIT_AUTOMAKE,
56[AC_REQUIRE([AC_PROG_INSTALL])
57PACKAGE=[$1]
58AC_SUBST(PACKAGE)
59VERSION=[$2]
60AC_SUBST(VERSION)
61dnl test to see if srcdir already configured
62if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
63  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
64fi
65ifelse([$3],,
66AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
67AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
68AC_REQUIRE([AM_SANITY_CHECK])
69AC_REQUIRE([AC_ARG_PROGRAM])
70dnl FIXME This is truly gross.
71missing_dir=`cd $ac_aux_dir && pwd`
72AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
73AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
74AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
75AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
76AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
77AC_REQUIRE([AC_PROG_MAKE_SET])])
78
79#
80# Check to make sure that the build environment is sane.
81#
82
83AC_DEFUN(AM_SANITY_CHECK,
84[AC_MSG_CHECKING([whether build environment is sane])
85# Just in case
86sleep 1
87echo 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).
93if (
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
107alias in your environment])
108   fi
109
110   test "[$]2" = conftestfile
111   )
112then
113   # Ok.
114   :
115else
116   AC_MSG_ERROR([newly created file is older than distributed files!
117Check your system clock])
118fi
119rm -f conftest*
120AC_MSG_RESULT(yes)])
121
122dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
123dnl The program must properly implement --version.
124AC_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.
129if ($2 --version) < /dev/null > /dev/null 2>&1; then
130   $1=$2
131   AC_MSG_RESULT(found)
132else
133   $1="$3/missing $2"
134   AC_MSG_RESULT(missing)
135fi
136AC_SUBST($1)])
137
138
139dnl AM_PROG_LEX
140dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
141AC_DEFUN(AM_PROG_LEX,
142[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
143AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
144AC_PROG_LEX
145AC_DECL_YYTEXT])
146
147dnl $Id: krb-prog-ln-s.m4,v 1.1 1997/12/14 15:59:01 joda Exp $
148dnl
149dnl
150dnl Better test for ln -s, ln or cp
151dnl
152
153AC_DEFUN(AC_KRB_PROG_LN_S,
154[AC_MSG_CHECKING(for ln -s or something else)
155AC_CACHE_VAL(ac_cv_prog_LN_S,
156[rm -f conftestdata
157if ln -s X conftestdata 2>/dev/null
158then
159  rm -f conftestdata
160  ac_cv_prog_LN_S="ln -s"
161else
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
169fi])dnl
170LN_S="$ac_cv_prog_LN_S"
171AC_MSG_RESULT($ac_cv_prog_LN_S)
172AC_SUBST(LN_S)dnl
173])
174
175
176dnl $Id: mips-abi.m4,v 1.4 1998/05/16 20:44:15 joda Exp $
177dnl
178dnl
179dnl Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext to some
180dnl value.
181
182AC_DEFUN(AC_MIPS_ABI, [
183AC_ARG_WITH(mips_abi,
184[  --with-mips-abi=abi     ABI to use for IRIX (32, n32, or 64)])
185
186case "$host_os" in
187irix*)
188with_mips_abi="${with_mips_abi:-yes}"
189if 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
200case "${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") ;;
206esac
207if test -n "$abi" ; then
208ac_foo=krb_cv_gcc_`echo $abi | tr =- __`
209dnl
210dnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to
211dnl AC_MSG_RESULT
212dnl
213AC_MSG_CHECKING([if $CC supports the $abi option])
214AC_CACHE_VAL($ac_foo, [
215save_CFLAGS="$CFLAGS"
216CFLAGS="$CFLAGS $abi"
217AC_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no)
218CFLAGS="$save_CFLAGS"
219])
220ac_res=`eval echo \\\$$ac_foo`
221AC_MSG_RESULT($ac_res)
222if test $ac_res = no; then
223# Try to figure out why that failed...
224case $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	;;
248esac
249fi #if test $ac_res = no; then
250fi #if test -n "$abi" ; then
251else
252case "${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") ;;
258esac
259fi #if test -n "$GCC"; then
260;;
261esac
262])
263
264dnl
265dnl $Id: c-attribute.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
266dnl
267
268dnl
269dnl Test for __attribute__
270dnl
271
272AC_DEFUN(AC_C___ATTRIBUTE__, [
273AC_MSG_CHECKING(for __attribute__)
274AC_CACHE_VAL(ac_cv___attribute__, [
275AC_TRY_COMPILE([
276#include <stdlib.h>
277],
278[
279static void foo(void) __attribute__ ((noreturn));
280
281static void
282foo(void)
283{
284  exit(1);
285}
286],
287ac_cv___attribute__=yes,
288ac_cv___attribute__=no)])
289if test "$ac_cv___attribute__" = "yes"; then
290  AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
291fi
292AC_MSG_RESULT($ac_cv___attribute__)
293])
294
295
296
297# serial 25 AM_PROG_LIBTOOL
298AC_DEFUN(AM_PROG_LIBTOOL,
299[AC_REQUIRE([AM_ENABLE_SHARED])dnl
300AC_REQUIRE([AM_ENABLE_STATIC])dnl
301AC_REQUIRE([AC_CANONICAL_HOST])dnl
302AC_REQUIRE([AC_PROG_RANLIB])dnl
303AC_REQUIRE([AC_PROG_CC])dnl
304AC_REQUIRE([AM_PROG_LD])dnl
305AC_REQUIRE([AM_PROG_NM])dnl
306AC_REQUIRE([AC_PROG_LN_S])dnl
307dnl
308# Always use our own libtool.
309LIBTOOL='$(top_builddir)/libtool'
310AC_SUBST(LIBTOOL)dnl
311
312# Check for any special flags to pass to ltconfig.
313libtool_flags=
314test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
315test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
316test "$silent" = yes && libtool_flags="$libtool_flags --silent"
317test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
318test "$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.
322case "$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  ;;
346esac
347
348# Actually configure libtool.  ac_aux_dir is where install-sh is found.
349CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
350LD="$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.
357exec 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'.
364AC_DEFUN(AM_ENABLE_SHARED,
365[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
366AC_ARG_ENABLE(shared,
367changequote(<<, >>)dnl
368<<  --enable-shared[=PKGS]  build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
369changequote([, ])dnl
370[p=${PACKAGE-default}
371case "$enableval" in
372yes) enable_shared=yes ;;
373no) 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  ;;
385esac],
386enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
387])
388
389# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
390AC_DEFUN(AM_DISABLE_SHARED,
391[AM_ENABLE_SHARED(no)])
392
393# AM_DISABLE_STATIC - set the default static flag to --disable-static
394AC_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'.
401AC_DEFUN(AM_ENABLE_STATIC,
402[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
403AC_ARG_ENABLE(static,
404changequote(<<, >>)dnl
405<<  --enable-static[=PKGS]  build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
406changequote([, ])dnl
407[p=${PACKAGE-default}
408case "$enableval" in
409yes) enable_static=yes ;;
410no) 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  ;;
422esac],
423enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
424])
425
426
427# AM_PROG_LD - find the path to the GNU or non-GNU linker
428AC_DEFUN(AM_PROG_LD,
429[AC_ARG_WITH(gnu-ld,
430[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
431test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
432AC_REQUIRE([AC_PROG_CC])
433ac_prog=ld
434if 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.
440changequote(,)dnl
441  /* | [A-Za-z]:\\*)
442changequote([,])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
454elif test "$with_gnu_ld" = yes; then
455  AC_MSG_CHECKING([for GNU ld])
456else
457  AC_MSG_CHECKING([for non-GNU ld])
458fi
459AC_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"
477else
478  ac_cv_path_LD="$LD" # Let the user override the test with a path.
479fi])
480LD="$ac_cv_path_LD"
481if test -n "$LD"; then
482  AC_MSG_RESULT($LD)
483else
484  AC_MSG_RESULT(no)
485fi
486test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
487AC_SUBST(LD)
488AM_PROG_LD_GNU
489])
490
491AC_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.
494if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
495  ac_cv_prog_gnu_ld=yes
496else
497  ac_cv_prog_gnu_ld=no
498fi])
499])
500
501# AM_PROG_NM - find the path to a BSD-compatible name lister
502AC_DEFUN(AM_PROG_NM,
503[AC_MSG_CHECKING([for BSD-compatible nm])
504AC_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"
508else
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
528fi])
529NM="$ac_cv_path_NM"
530AC_MSG_RESULT([$NM])
531AC_SUBST(NM)
532])
533
534dnl $Id: wflags.m4,v 1.3 1999/03/11 12:11:41 joda Exp $
535dnl
536dnl set WFLAGS
537
538AC_DEFUN(AC_WFLAGS,[
539WFLAGS_NOUNUSED=""
540WFLAGS_NOIMPLICITINT=""
541if 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"
550fi
551AC_SUBST(WFLAGS)dnl
552AC_SUBST(WFLAGS_NOUNUSED)dnl
553AC_SUBST(WFLAGS_NOIMPLICITINT)dnl
554])
555
556dnl $Id: test-package.m4,v 1.7 1999/04/19 13:33:05 assar Exp $
557dnl
558dnl AC_TEST_PACKAGE_NEW(package,headers,libraries,extra libs,default locations)
559
560AC_DEFUN(AC_TEST_PACKAGE,[AC_TEST_PACKAGE_NEW($1,[#include <$2>],$4,,$5)])
561
562AC_DEFUN(AC_TEST_PACKAGE_NEW,[
563AC_ARG_WITH($1,
564[  --with-$1=dir                use $1 in dir])
565AC_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])
569elif test "X$with_$1" = "X"; then
570  with_$1=yes
571fi])
572AC_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])
576elif test "X$with_$1" = "X"; then
577  with_$1=yes
578fi])
579
580AC_MSG_CHECKING(for $1)
581
582case "$with_$1" in
583yes)	;;
584no)	;;
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	;;
593esac
594header_dirs=
595lib_dirs=
596d='$5'
597for i in $d; do
598	header_dirs="$header_dirs $i/include"
599	lib_dirs="$lib_dirs $i/lib$abilibdirext"
600done
601
602case "$with_$1_include" in
603yes) ;;
604no)  ;;
605*)   header_dirs="$with_$1_include $header_dirs";;
606esac
607case "$with_$1_lib" in
608yes) ;;
609no)  ;;
610*)   lib_dirs="$with_$1_lib $lib_dirs";;
611esac
612
613save_CFLAGS="$CFLAGS"
614save_LIBS="$LIBS"
615ires= lres=
616for i in $header_dirs; do
617	CFLAGS="-I$i $save_CFLAGS"
618	AC_TRY_COMPILE([$2],,ires=$i;break)
619done
620for i in $lib_dirs; do
621	LIBS="-L$i $3 $4 $save_LIBS"
622	AC_TRY_LINK([$2],,lres=$i;break)
623done
624CFLAGS="$save_CFLAGS"
625LIBS="$save_LIBS"
626
627if 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])
635else
636	INCLUDE_$1=
637	LIB_$1=
638	with_$1=no
639	AC_MSG_RESULT($with_$1)
640fi
641AC_SUBST(INCLUDE_$1)
642AC_SUBST(LIB_$1)
643])
644
645dnl $Id: find-func.m4,v 1.1 1997/12/14 15:58:58 joda Exp $
646dnl
647dnl AC_FIND_FUNC(func, libraries, includes, arguments)
648AC_DEFUN(AC_FIND_FUNC, [
649AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4])
650if test -n "$LIB_$1"; then
651	LIBS="$LIB_$1 $LIBS"
652fi
653])
654
655dnl $Id: find-func-no-libs.m4,v 1.5 1999/10/30 21:08:18 assar Exp $
656dnl
657dnl
658dnl Look for function in any of the specified libraries
659dnl
660
661dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments, extra libs, extra args)
662AC_DEFUN(AC_FIND_FUNC_NO_LIBS, [
663AC_FIND_FUNC_NO_LIBS2([$1], ["" $2], [$3], [$4], [$5], [$6])])
664
665dnl $Id: find-func-no-libs2.m4,v 1.3 1999/10/30 21:09:53 assar Exp $
666dnl
667dnl
668dnl Look for function in any of the specified libraries
669dnl
670
671dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args)
672AC_DEFUN(AC_FIND_FUNC_NO_LIBS2, [
673
674AC_MSG_CHECKING([for $1])
675AC_CACHE_VAL(ac_cv_funclib_$1,
676[
677if 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"
690fi
691])
692
693eval "ac_res=\$ac_cv_funclib_$1"
694
695dnl autoheader tricks *sigh*
696: << END
697@@@funcs="$funcs $1"@@@
698@@@libs="$libs $2"@@@
699END
700
701# $1
702eval "ac_tr_func=HAVE_[]upcase($1)"
703eval "ac_tr_lib=HAVE_LIB[]upcase($ac_res | sed -e 's/-l//')"
704eval "LIB_$1=$ac_res"
705
706case "$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	;;
725esac
726AC_SUBST(LIB_$1)
727])
728
729# Define a conditional.
730
731AC_DEFUN(AM_CONDITIONAL,
732[AC_SUBST($1_TRUE)
733AC_SUBST($1_FALSE)
734if $2; then
735  $1_TRUE=
736  $1_FALSE='#'
737else
738  $1_TRUE='#'
739  $1_FALSE=
740fi])
741
742dnl $Id: osfc2.m4,v 1.2 1999/03/27 17:28:16 joda Exp $
743dnl
744dnl enable OSF C2 stuff
745
746AC_DEFUN(AC_CHECK_OSFC2,[
747AC_ARG_ENABLE(osfc2,
748[  --enable-osfc2          enable some OSF C2 support])
749LIB_security=
750if test "$enable_osfc2" = yes; then
751	AC_DEFINE(HAVE_OSFC2, 1, [Define to enable basic OSF C2 support.])
752	LIB_security=-lsecurity
753fi
754AC_SUBST(LIB_security)
755])
756
757dnl $Id: check-man.m4,v 1.2 1999/03/21 14:30:50 joda Exp $
758dnl check how to format manual pages
759dnl
760
761AC_DEFUN(AC_CHECK_MAN,
762[AC_PATH_PROG(NROFF, nroff)
763AC_PATH_PROG(GROFF, groff)
764AC_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
771foobar
772END
773
774if 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
782fi
783if 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
791fi
792if test "$ac_cv_sys_man_format"; then
793	ac_cv_sys_man_format="$ac_cv_sys_man_format \[$]< > \[$]@"
794fi
795])
796if test "$ac_cv_sys_man_format"; then
797	CATMAN="$ac_cv_sys_man_format"
798	AC_SUBST(CATMAN)
799fi
800AM_CONDITIONAL(CATMAN, test "$CATMAN")
801AC_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
804else
805	ac_cv_sys_catman_ext=number
806fi
807])
808if test "$ac_cv_sys_catman_ext" = number; then
809	CATMANEXT='$$ext'
810else
811	CATMANEXT=0
812fi
813AC_SUBST(CATMANEXT)
814
815])
816dnl
817dnl $Id: krb-bigendian.m4,v 1.5 2000/01/08 10:34:44 assar Exp $
818dnl
819
820dnl check if this computer is little or big-endian
821dnl if we can figure it out at compile-time then don't define the cpp symbol
822dnl otherwise test for it and define it.  also allow options for overriding
823dnl it when cross-compiling
824
825AC_DEFUN(KRB_C_BIGENDIAN, [
826AC_ARG_ENABLE(bigendian,
827[  --enable-bigendian	the target is big endian],
828krb_cv_c_bigendian=yes)
829AC_ARG_ENABLE(littleendian,
830[  --enable-littleendian	the target is little endian],
831krb_cv_c_bigendian=no)
832AC_CACHE_CHECK(whether byte order is known at compile time,
833krb_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)])
840if 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
868fi
869if 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
871fi
872])
873
874dnl 
875dnl See if there is any X11 present
876dnl
877dnl $Id: check-x.m4,v 1.2 1999/11/05 04:25:23 assar Exp $
878
879AC_DEFUN(KRB_CHECK_X,[
880AC_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
884if 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"
924fi
925])
926
927dnl $Id: check-xau.m4,v 1.3 1999/05/14 01:17:06 assar Exp $
928dnl
929dnl check for Xau{Read,Write}Auth and XauFileName
930dnl
931AC_DEFUN(AC_CHECK_XAU,[
932save_CFLAGS="$CFLAGS"
933CFLAGS="$X_CFLAGS $CFLAGS"
934save_LIBS="$LIBS"
935dnl LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
936LIBS="$X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
937save_LDFLAGS="$LDFLAGS"
938LDFLAGS="$LDFLAGS $X_LIBS"
939
940
941AC_FIND_FUNC_NO_LIBS(XauWriteAuth, X11 Xau)
942ac_xxx="$LIBS"
943LIBS="$LIB_XauWriteAuth $LIBS"
944AC_FIND_FUNC_NO_LIBS(XauReadAuth, X11 Xau)
945LIBS="$LIB_XauReadAauth $LIBS"
946AC_FIND_FUNC_NO_LIBS(XauFileName, X11 Xau)
947LIBS="$ac_xxx"
948
949case "$ac_cv_funclib_XauWriteAuth" in
950yes)	;;
951no)	;;
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	;;
966esac
967
968if test "$AUTOMAKE" != ""; then
969	AM_CONDITIONAL(NEED_WRITEAUTH, test "$ac_cv_func_XauWriteAuth" != "yes")
970else
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
980fi
981CFLAGS=$save_CFLAGS
982LIBS=$save_LIBS
983LDFLAGS=$save_LDFLAGS
984])
985
986dnl $Id: check-type-extra.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
987dnl
988dnl ac_check_type + extra headers
989
990dnl AC_CHECK_TYPE_EXTRA(TYPE, DEFAULT, HEADERS)
991AC_DEFUN(AC_CHECK_TYPE_EXTRA,
992[AC_REQUIRE([AC_HEADER_STDC])dnl
993AC_MSG_CHECKING(for $1)
994AC_CACHE_VAL(ac_cv_type_$1,
995[AC_EGREP_CPP(dnl
996changequote(<<,>>)dnl
997<<$1[^a-zA-Z_0-9]>>dnl
998changequote([,]), [#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
1004AC_MSG_RESULT($ac_cv_type_$1)
1005if test $ac_cv_type_$1 = no; then
1006  AC_DEFINE($1, $2, [Define this to what the type $1 should be.])
1007fi
1008])
1009
1010dnl
1011dnl $Id: check-netinet-ip-and-tcp.m4,v 1.2 1999/05/14 13:15:40 assar Exp $
1012dnl
1013
1014dnl extra magic check for netinet/{ip.h,tcp.h} because on irix 6.5.3
1015dnl you have to include standards.h before including these files
1016
1017AC_DEFUN(CHECK_NETINET_IP_AND_TCP,
1018[
1019AC_CHECK_HEADERS(standards.h)
1020for i in netinet/ip.h netinet/tcp.h; do
1021
1022cv=`echo "$i" | sed 'y%./+-%__p_%'`
1023
1024AC_MSG_CHECKING([for $i])
1025AC_CACHE_VAL([ac_cv_header_$cv],
1026[AC_TRY_CPP([\
1027#ifdef HAVE_STANDARDS_H
1028#include <standards.h>
1029#endif
1030#include <$i>
1031],
1032eval "ac_cv_header_$cv=yes",
1033eval "ac_cv_header_$cv=no")])
1034AC_MSG_RESULT(`eval echo \\$ac_cv_header_$cv`)
1035changequote(, )dnl
1036if test `eval echo \\$ac_cv_header_$cv` = yes; then
1037  ac_tr_hdr=HAVE_`echo $i | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
1038changequote([, ])dnl
1039  AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
1040fi
1041done
1042dnl autoheader tricks *sigh*
1043: << END
1044@@@headers="$headers netinet/ip.h netinet/tcp.h"@@@
1045END
1046
1047])
1048
1049dnl $Id: krb-ipv6.m4,v 1.8 2000/01/01 11:44:45 assar Exp $
1050dnl
1051dnl test for IPv6
1052dnl
1053AC_DEFUN(AC_KRB_IPV6, [
1054AC_ARG_WITH(ipv6,
1055[  --without-ipv6	do not enable IPv6 support],[
1056if test "$withval" = "no"; then
1057	ac_cv_lib_ipv6=no
1058fi])
1059AC_CACHE_VAL(ac_cv_lib_ipv6,
1060[dnl check for different v6 implementations (by itojun)
1061v6type=unknown
1062v6lib=none
1063
1064AC_MSG_CHECKING([ipv6 stack type])
1065for i in v6d toshiba kame inria zeta linux; do
1066	case $i in
1067	v6d)
1068		AC_EGREP_CPP(yes, [dnl
1069#include </usr/local/v6/include/sys/types.h>
1070#ifdef __V6D__
1071yes
1072#endif],
1073			[v6type=$i; v6lib=v6;
1074			v6libdir=/usr/local/v6/lib;
1075			CFLAGS="-I/usr/local/v6/include $CFLAGS"])
1076		;;
1077	toshiba)
1078		AC_EGREP_CPP(yes, [dnl
1079#include <sys/param.h>
1080#ifdef _TOSHIBA_INET6
1081yes
1082#endif],
1083			[v6type=$i; v6lib=inet6;
1084			v6libdir=/usr/local/v6/lib;
1085			CFLAGS="-DINET6 $CFLAGS"])
1086		;;
1087	kame)
1088		AC_EGREP_CPP(yes, [dnl
1089#include <netinet/in.h>
1090#ifdef __KAME__
1091yes
1092#endif],
1093			[v6type=$i; v6lib=inet6;
1094			v6libdir=/usr/local/v6/lib;
1095			CFLAGS="-DINET6 $CFLAGS"])
1096		;;
1097	inria)
1098		AC_EGREP_CPP(yes, [dnl
1099#include <netinet/in.h>
1100#ifdef IPV6_INRIA_VERSION
1101yes
1102#endif],
1103			[v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
1104		;;
1105	zeta)
1106		AC_EGREP_CPP(yes, [dnl
1107#include <sys/param.h>
1108#ifdef _ZETA_MINAMI_INET6
1109yes
1110#endif],
1111			[v6type=$i; v6lib=inet6;
1112			v6libdir=/usr/local/v6/lib;
1113			CFLAGS="-DINET6 $CFLAGS"])
1114		;;
1115	linux)
1116		if test -d /usr/inet6; then
1117			v6type=$i
1118			v6lib=inet6
1119			v6libdir=/usr/inet6
1120			CFLAGS="-DINET6 $CFLAGS"
1121		fi
1122		;;
1123	esac
1124	if test "$v6type" != "unknown"; then
1125		break
1126	fi
1127done
1128AC_MSG_RESULT($v6type)
1129
1130if test "$v6lib" != "none"; then
1131	for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
1132		if test -d $dir -a -f $dir/lib$v6lib.a; then
1133			LIBS="-L$dir -l$v6lib $LIBS"
1134			break
1135		fi
1136	done
1137fi
1138AC_TRY_LINK([
1139#ifdef HAVE_SYS_TYPES_H
1140#include <sys/types.h>
1141#endif
1142#ifdef HAVE_SYS_SOCKET_H
1143#include <sys/socket.h>
1144#endif
1145#ifdef HAVE_NETINET_IN_H
1146#include <netinet/in.h>
1147#endif
1148#ifdef HAVE_NETINET_IN6_H
1149#include <netinet/in6.h>
1150#endif
1151],
1152[
1153 struct sockaddr_in6 sin6;
1154 int s;
1155
1156 s = socket(AF_INET6, SOCK_DGRAM, 0);
1157
1158 sin6.sin6_family = AF_INET6;
1159 sin6.sin6_port = htons(17);
1160 sin6.sin6_addr = in6addr_any;
1161 bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
1162],
1163ac_cv_lib_ipv6=yes,
1164ac_cv_lib_ipv6=no)])
1165AC_MSG_CHECKING(for IPv6)
1166AC_MSG_RESULT($ac_cv_lib_ipv6)
1167if test "$ac_cv_lib_ipv6" = yes; then
1168  AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])
1169fi
1170])
1171
1172dnl $Id: broken-snprintf.m4,v 1.3 1999/03/01 09:52:22 joda Exp $
1173dnl
1174AC_DEFUN(AC_BROKEN_SNPRINTF, [
1175AC_CACHE_CHECK(for working snprintf,ac_cv_func_snprintf_working,
1176ac_cv_func_snprintf_working=yes
1177AC_TRY_RUN([
1178#include <stdio.h>
1179#include <string.h>
1180int main()
1181{
1182changequote(`,')dnl
1183	char foo[3];
1184changequote([,])dnl
1185	snprintf(foo, 2, "12");
1186	return strcmp(foo, "1");
1187}],:,ac_cv_func_snprintf_working=no,:))
1188
1189if test "$ac_cv_func_snprintf_working" = yes; then
1190	AC_DEFINE_UNQUOTED(HAVE_SNPRINTF, 1, [define if you have a working snprintf])
1191fi
1192if test "$ac_cv_func_snprintf_working" = yes; then
1193AC_NEED_PROTO([#include <stdio.h>],snprintf)
1194fi
1195])
1196
1197AC_DEFUN(AC_BROKEN_VSNPRINTF,[
1198AC_CACHE_CHECK(for working vsnprintf,ac_cv_func_vsnprintf_working,
1199ac_cv_func_vsnprintf_working=yes
1200AC_TRY_RUN([
1201#include <stdio.h>
1202#include <string.h>
1203#include <stdarg.h>
1204
1205int foo(int num, ...)
1206{
1207changequote(`,')dnl
1208	char bar[3];
1209changequote([,])dnl
1210	va_list arg;
1211	va_start(arg, num);
1212	vsnprintf(bar, 2, "%s", arg);
1213	va_end(arg);
1214	return strcmp(bar, "1");
1215}
1216
1217
1218int main()
1219{
1220	return foo(0, "12");
1221}],:,ac_cv_func_vsnprintf_working=no,:))
1222
1223if test "$ac_cv_func_vsnprintf_working" = yes; then
1224	AC_DEFINE_UNQUOTED(HAVE_VSNPRINTF, 1, [define if you have a working vsnprintf])
1225fi
1226if test "$ac_cv_func_vsnprintf_working" = yes; then
1227AC_NEED_PROTO([#include <stdio.h>],vsnprintf)
1228fi
1229])
1230
1231dnl $Id: need-proto.m4,v 1.2 1999/03/01 09:52:24 joda Exp $
1232dnl
1233dnl
1234dnl Check if we need the prototype for a function
1235dnl
1236
1237dnl AC_NEED_PROTO(includes, function)
1238
1239AC_DEFUN(AC_NEED_PROTO, [
1240if test "$ac_cv_func_$2+set" != set -o "$ac_cv_func_$2" = yes; then
1241AC_CACHE_CHECK([if $2 needs a prototype], ac_cv_func_$2_noproto,
1242AC_TRY_COMPILE([$1],
1243[struct foo { int foo; } xx;
1244extern int $2 (struct foo*);
1245$2(&xx);
1246],
1247eval "ac_cv_func_$2_noproto=yes",
1248eval "ac_cv_func_$2_noproto=no"))
1249define([foo], [NEED_]translit($2, [a-z], [A-Z])[_PROTO])
1250if test "$ac_cv_func_$2_noproto" = yes; then
1251	AC_DEFINE(foo, 1, [define if the system is missing a prototype for $2()])
1252fi
1253undefine([foo])
1254fi
1255])
1256
1257dnl $Id: broken-glob.m4,v 1.2 1999/03/01 09:52:15 joda Exp $
1258dnl
1259dnl check for glob(3)
1260dnl
1261AC_DEFUN(AC_BROKEN_GLOB,[
1262AC_CACHE_CHECK(for working glob, ac_cv_func_glob_working,
1263ac_cv_func_glob_working=yes
1264AC_TRY_LINK([
1265#include <stdio.h>
1266#include <glob.h>],[
1267glob(NULL, GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE, NULL, NULL);
1268],:,ac_cv_func_glob_working=no,:))
1269
1270if test "$ac_cv_func_glob_working" = yes; then
1271	AC_DEFINE(HAVE_GLOB, 1, [define if you have a glob() that groks 
1272	GLOB_BRACE, GLOB_NOCHECK, GLOB_QUOTE, and GLOB_TILDE])
1273fi
1274if test "$ac_cv_func_glob_working" = yes; then
1275AC_NEED_PROTO([#include <stdio.h>
1276#include <glob.h>],glob)
1277fi
1278])
1279
1280dnl
1281dnl $Id: krb-func-getlogin.m4,v 1.1 1999/07/13 17:45:30 assar Exp $
1282dnl
1283dnl test for POSIX (broken) getlogin
1284dnl
1285
1286
1287AC_DEFUN(AC_FUNC_GETLOGIN, [
1288AC_CHECK_FUNCS(getlogin setlogin)
1289if test "$ac_cv_func_getlogin" = yes; then
1290AC_CACHE_CHECK(if getlogin is posix, ac_cv_func_getlogin_posix, [
1291if test "$ac_cv_func_getlogin" = yes -a "$ac_cv_func_setlogin" = yes; then
1292	ac_cv_func_getlogin_posix=no
1293else
1294	ac_cv_func_getlogin_posix=yes
1295fi
1296])
1297if test "$ac_cv_func_getlogin_posix" = yes; then
1298	AC_DEFINE(POSIX_GETLOGIN, 1, [Define if getlogin has POSIX flavour (and not BSD).])
1299fi
1300fi
1301])
1302
1303dnl
1304dnl $Id: capabilities.m4,v 1.2 1999/09/01 11:02:26 joda Exp $
1305dnl
1306
1307dnl
1308dnl Test SGI capabilities
1309dnl
1310
1311AC_DEFUN(KRB_CAPABILITIES,[
1312
1313AC_CHECK_HEADERS(capability.h sys/capability.h)
1314
1315AC_CHECK_FUNCS(sgi_getcapabilitybyname cap_set_proc)
1316])
1317
1318dnl $Id: check-getpwnam_r-posix.m4,v 1.2 1999/03/23 16:47:31 joda Exp $
1319dnl
1320dnl check for getpwnam_r, and if it's posix or not
1321
1322AC_DEFUN(AC_CHECK_GETPWNAM_R_POSIX,[
1323AC_FIND_FUNC_NO_LIBS(getpwnam_r,c_r)
1324if test "$ac_cv_func_getpwnam_r" = yes; then
1325	AC_CACHE_CHECK(if getpwnam_r is posix,ac_cv_func_getpwnam_r_posix,
1326	ac_libs="$LIBS"
1327	LIBS="$LIBS $LIB_getpwnam_r"
1328	AC_TRY_RUN([
1329#include <pwd.h>
1330int main()
1331{
1332	struct passwd pw, *pwd;
1333	return getpwnam_r("", &pw, NULL, 0, &pwd) < 0;
1334}
1335],ac_cv_func_getpwnam_r_posix=yes,ac_cv_func_getpwnam_r_posix=no,:)
1336LIBS="$ac_libs")
1337if test "$ac_cv_func_getpwnam_r_posix" = yes; then
1338	AC_DEFINE(POSIX_GETPWNAM_R, 1, [Define if getpwnam_r has POSIX flavour.])
1339fi
1340fi
1341])
1342dnl $Id: find-if-not-broken.m4,v 1.2 1998/03/16 22:16:27 joda Exp $
1343dnl
1344dnl
1345dnl Mix between AC_FIND_FUNC and AC_BROKEN
1346dnl
1347
1348AC_DEFUN(AC_FIND_IF_NOT_BROKEN,
1349[AC_FIND_FUNC([$1], [$2], [$3], [$4])
1350if eval "test \"$ac_cv_func_$1\" != yes"; then
1351LIBOBJS[]="$LIBOBJS $1.o"
1352fi
1353AC_SUBST(LIBOBJS)dnl
1354])
1355
1356dnl $Id: broken.m4,v 1.3 1998/03/16 22:16:19 joda Exp $
1357dnl
1358dnl
1359dnl Same as AC _REPLACE_FUNCS, just define HAVE_func if found in normal
1360dnl libraries 
1361
1362AC_DEFUN(AC_BROKEN,
1363[for ac_func in $1
1364do
1365AC_CHECK_FUNC($ac_func, [
1366ac_tr_func=HAVE_[]upcase($ac_func)
1367AC_DEFINE_UNQUOTED($ac_tr_func)],[LIBOBJS[]="$LIBOBJS ${ac_func}.o"])
1368dnl autoheader tricks *sigh*
1369: << END
1370@@@funcs="$funcs $1"@@@
1371END
1372done
1373AC_SUBST(LIBOBJS)dnl
1374])
1375
1376dnl $Id: proto-compat.m4,v 1.3 1999/03/01 13:03:48 joda Exp $
1377dnl
1378dnl
1379dnl Check if the prototype of a function is compatible with another one
1380dnl
1381
1382dnl AC_PROTO_COMPAT(includes, function, prototype)
1383
1384AC_DEFUN(AC_PROTO_COMPAT, [
1385AC_CACHE_CHECK([if $2 is compatible with system prototype],
1386ac_cv_func_$2_proto_compat,
1387AC_TRY_COMPILE([$1],
1388[$3;],
1389eval "ac_cv_func_$2_proto_compat=yes",
1390eval "ac_cv_func_$2_proto_compat=no"))
1391define([foo], translit($2, [a-z], [A-Z])[_PROTO_COMPATIBLE])
1392if test "$ac_cv_func_$2_proto_compat" = yes; then
1393	AC_DEFINE(foo, 1, [define if prototype of $2 is compatible with
1394	$3])
1395fi
1396undefine([foo])
1397])
1398dnl $Id: check-var.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
1399dnl
1400dnl AC_CHECK_VAR(includes, variable)
1401AC_DEFUN(AC_CHECK_VAR, [
1402AC_MSG_CHECKING(for $2)
1403AC_CACHE_VAL(ac_cv_var_$2, [
1404AC_TRY_LINK([extern int $2;
1405int foo() { return $2; }],
1406	    [foo()],
1407	    ac_cv_var_$2=yes, ac_cv_var_$2=no)
1408])
1409define([foo], [HAVE_]translit($2, [a-z], [A-Z]))
1410
1411AC_MSG_RESULT(`eval echo \\$ac_cv_var_$2`)
1412if test `eval echo \\$ac_cv_var_$2` = yes; then
1413	AC_DEFINE_UNQUOTED(foo, 1, [define if you have $2])
1414	AC_CHECK_DECLARATION([$1],[$2])
1415fi
1416undefine([foo])
1417])
1418
1419dnl $Id: check-declaration.m4,v 1.3 1999/03/01 13:03:08 joda Exp $
1420dnl
1421dnl
1422dnl Check if we need the declaration of a variable
1423dnl
1424
1425dnl AC_HAVE_DECLARATION(includes, variable)
1426AC_DEFUN(AC_CHECK_DECLARATION, [
1427AC_MSG_CHECKING([if $2 is properly declared])
1428AC_CACHE_VAL(ac_cv_var_$2_declaration, [
1429AC_TRY_COMPILE([$1
1430extern struct { int foo; } $2;],
1431[$2.foo = 1;],
1432eval "ac_cv_var_$2_declaration=no",
1433eval "ac_cv_var_$2_declaration=yes")
1434])
1435
1436define(foo, [HAVE_]translit($2, [a-z], [A-Z])[_DECLARATION])
1437
1438AC_MSG_RESULT($ac_cv_var_$2_declaration)
1439if eval "test \"\$ac_cv_var_$2_declaration\" = yes"; then
1440	AC_DEFINE(foo, 1, [define if your system declares $2])
1441fi
1442undefine([foo])
1443])
1444
1445dnl $Id: have-struct-field.m4,v 1.6 1999/07/29 01:44:32 assar Exp $
1446dnl
1447dnl check for fields in a structure
1448dnl
1449dnl AC_HAVE_STRUCT_FIELD(struct, field, headers)
1450
1451AC_DEFUN(AC_HAVE_STRUCT_FIELD, [
1452define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_]))
1453AC_CACHE_CHECK([for $2 in $1], cache_val,[
1454AC_TRY_COMPILE([$3],[$1 x; x.$2;],
1455cache_val=yes,
1456cache_val=no)])
1457if test "$cache_val" = yes; then
1458	define(foo, translit(HAVE_$1_$2, [a-z ], [A-Z_]))
1459	AC_DEFINE(foo, 1, [Define if $1 has field $2.])
1460	undefine([foo])
1461fi
1462undefine([cache_val])
1463])
1464
1465dnl $Id: have-type.m4,v 1.5 1999/12/31 03:10:22 assar Exp $
1466dnl
1467dnl check for existance of a type
1468
1469dnl AC_HAVE_TYPE(TYPE,INCLUDES)
1470AC_DEFUN(AC_HAVE_TYPE, [
1471AC_REQUIRE([AC_HEADER_STDC])
1472cv=`echo "$1" | sed 'y%./+- %__p__%'`
1473AC_MSG_CHECKING(for $1)
1474AC_CACHE_VAL([ac_cv_type_$cv],
1475AC_TRY_COMPILE(
1476[#include <sys/types.h>
1477#if STDC_HEADERS
1478#include <stdlib.h>
1479#include <stddef.h>
1480#endif
1481$2],
1482[$1 foo;],
1483eval "ac_cv_type_$cv=yes",
1484eval "ac_cv_type_$cv=no"))dnl
1485AC_MSG_RESULT(`eval echo \\$ac_cv_type_$cv`)
1486if test `eval echo \\$ac_cv_type_$cv` = yes; then
1487  ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
1488dnl autoheader tricks *sigh*
1489define(foo,translit($1, [ ], [_]))
1490: << END
1491@@@funcs="$funcs foo"@@@
1492END
1493undefine([foo])
1494  AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
1495fi
1496])
1497
1498dnl $Id: krb-struct-winsize.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
1499dnl
1500dnl
1501dnl Search for struct winsize
1502dnl
1503
1504AC_DEFUN(AC_KRB_STRUCT_WINSIZE, [
1505AC_MSG_CHECKING(for struct winsize)
1506AC_CACHE_VAL(ac_cv_struct_winsize, [
1507ac_cv_struct_winsize=no
1508for i in sys/termios.h sys/ioctl.h; do
1509AC_EGREP_HEADER(
1510changequote(, )dnl
1511struct[ 	]*winsize,dnl
1512changequote([,])dnl
1513$i, ac_cv_struct_winsize=yes; break)dnl
1514done
1515])
1516if test "$ac_cv_struct_winsize" = "yes"; then
1517  AC_DEFINE(HAVE_STRUCT_WINSIZE, 1, [define if struct winsize is declared in sys/termios.h])
1518fi
1519AC_MSG_RESULT($ac_cv_struct_winsize)
1520AC_EGREP_HEADER(ws_xpixel, termios.h, 
1521	AC_DEFINE(HAVE_WS_XPIXEL, 1, [define if struct winsize has ws_xpixel]))
1522AC_EGREP_HEADER(ws_ypixel, termios.h, 
1523	AC_DEFINE(HAVE_WS_YPIXEL, 1, [define if struct winsize has ws_ypixel]))
1524])
1525
1526dnl $Id: krb-struct-spwd.m4,v 1.3 1999/07/13 21:04:11 assar Exp $
1527dnl
1528dnl Test for `struct spwd'
1529
1530AC_DEFUN(AC_KRB_STRUCT_SPWD, [
1531AC_MSG_CHECKING(for struct spwd)
1532AC_CACHE_VAL(ac_cv_struct_spwd, [
1533AC_TRY_COMPILE(
1534[#include <pwd.h>
1535#ifdef HAVE_SHADOW_H
1536#include <shadow.h>
1537#endif],
1538[struct spwd foo;],
1539ac_cv_struct_spwd=yes,
1540ac_cv_struct_spwd=no)
1541])
1542AC_MSG_RESULT($ac_cv_struct_spwd)
1543
1544if test "$ac_cv_struct_spwd" = "yes"; then
1545  AC_DEFINE(HAVE_STRUCT_SPWD, 1, [define if you have struct spwd])
1546fi
1547])
1548
1549dnl $Id: grok-type.m4,v 1.4 1999/11/29 11:16:48 joda Exp $
1550dnl
1551AC_DEFUN(AC_GROK_TYPE, [
1552AC_CACHE_VAL(ac_cv_type_$1, 
1553AC_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,
1572eval ac_cv_type_$1=yes,
1573eval ac_cv_type_$1=no))])
1574
1575AC_DEFUN(AC_GROK_TYPES, [
1576for 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)
1585done
1586])
1587
1588dnl $Id: auth-modules.m4,v 1.1 1999/03/21 13:48:00 joda Exp $
1589dnl
1590dnl Figure what authentication modules should be built
1591
1592AC_DEFUN(AC_AUTH_MODULES,[
1593AC_MSG_CHECKING(which authentication modules should be built)
1594
1595LIB_AUTH_SUBDIRS=
1596
1597if test "$ac_cv_header_siad_h" = yes; then
1598	LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS sia"
1599fi
1600
1601if test "$ac_cv_header_security_pam_modules_h" = yes -a "$enable_shared" = yes; then
1602	LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS pam"
1603fi
1604
1605case "${host}" in
1606changequote(,)dnl
1607*-*-irix[56]*) LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS afskauthlib" ;;
1608changequote([,])dnl
1609esac
1610
1611AC_MSG_RESULT($LIB_AUTH_SUBDIRS)
1612
1613AC_SUBST(LIB_AUTH_SUBDIRS)dnl
1614])
1615
1616