aclocal.m4 revision 78527
1# ./aclocal.m4 generated automatically by aclocal 1.4b
2
3# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
4# Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14dnl $Id: acinclude.m4,v 1.15 1998/05/23 14:54:53 joda Exp $
15dnl
16dnl Only put things that for some reason can't live in the `cf'
17dnl directory in this file.
18dnl
19
20dnl $xId: misc.m4,v 1.1 1997/12/14 15:59:04 joda Exp $
21dnl
22define(upcase,`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
23
24dnl $Id: misc.m4,v 1.2 2000/07/19 15:04:00 joda Exp $
25dnl
26AC_DEFUN([upcase],[`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`])dnl
27AC_DEFUN([rk_CONFIG_HEADER],[AH_TOP([#ifndef RCSID
28#define RCSID(msg) \
29static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg }
30#endif
31
32#undef BINDIR 
33#undef LIBDIR
34#undef LIBEXECDIR
35#undef SBINDIR
36
37#undef HAVE_INT8_T
38#undef HAVE_INT16_T
39#undef HAVE_INT32_T
40#undef HAVE_INT64_T
41#undef HAVE_U_INT8_T
42#undef HAVE_U_INT16_T
43#undef HAVE_U_INT32_T
44#undef HAVE_U_INT64_T
45
46/* Maximum values on all known systems */
47#define MaxHostNameLen (64+4)
48#define MaxPathLen (1024+4)
49
50])])
51# Like AC_CONFIG_HEADER, but automatically create stamp file.
52
53# serial 3
54
55# When config.status generates a header, we must update the stamp-h file.
56# This file resides in the same directory as the config header
57# that is generated.  We must strip everything past the first ":",
58# and everything past the last "/".
59
60AC_PREREQ([2.12])
61
62AC_DEFUN([AM_CONFIG_HEADER],
63[AC_CONFIG_HEADER([$1])
64  AC_OUTPUT_COMMANDS(
65   ifelse(patsubst([$1], [[^ ]], []),
66	  [],
67	  [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
68	   patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),
69  [am_indx=1
70  for am_file in $1; do
71    case " $CONFIG_HEADERS " in
72    *" $am_file "*)
73      echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx
74      ;;
75    esac
76    am_indx=\`expr \$am_indx + 1\`
77  done])
78])
79
80# Do all the work for Automake.  This macro actually does too much --
81# some checks are only needed if your package does certain things.
82# But this isn't really a big deal.
83
84# serial 3
85
86AC_PREREQ([2.13])
87
88# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
89# -----------------------------------------------------------
90# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
91# The purpose of this macro is to provide the user with a means to
92# check macros which are provided without letting her know how the
93# information is coded.
94# If this macro is not defined by Autoconf, define it here.
95ifdef([AC_PROVIDE_IFELSE],
96      [],
97      [define([AC_PROVIDE_IFELSE],
98              [ifdef([AC_PROVIDE_$1],
99                     [$2], [$3])])])
100
101
102# AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
103# ----------------------------------------------
104AC_DEFUN([AM_INIT_AUTOMAKE],
105[dnl We require 2.13 because we rely on SHELL being computed by configure.
106AC_REQUIRE([AC_PROG_INSTALL])dnl
107# test to see if srcdir already configured
108if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
109   test -f $srcdir/config.status; then
110  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
111fi
112
113# Define the identity of the package.
114PACKAGE=$1
115AC_SUBST(PACKAGE)dnl
116VERSION=$2
117AC_SUBST(VERSION)dnl
118ifelse([$3],,
119[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
120AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
121
122# Some tools Automake needs.
123AC_REQUIRE([AM_SANITY_CHECK])dnl
124AC_REQUIRE([AC_ARG_PROGRAM])dnl
125AM_MISSING_PROG(ACLOCAL, aclocal)
126AM_MISSING_PROG(AUTOCONF, autoconf)
127AM_MISSING_PROG(AUTOMAKE, automake)
128AM_MISSING_PROG(AUTOHEADER, autoheader)
129AM_MISSING_PROG(MAKEINFO, makeinfo)
130AM_MISSING_PROG(AMTAR, tar)
131AM_MISSING_INSTALL_SH
132# We need awk for the "check" target.  The system "awk" is bad on
133# some platforms.
134AC_REQUIRE([AC_PROG_AWK])dnl
135AC_REQUIRE([AC_PROG_MAKE_SET])dnl
136AC_REQUIRE([AM_DEP_TRACK])dnl
137AC_REQUIRE([AM_SET_DEPDIR])dnl
138AC_PROVIDE_IFELSE([AC_PROG_CC],
139                  [AM_DEPENDENCIES(CC)],
140                  [define([AC_PROG_CC],
141                          defn([AC_PROG_CC])[AM_DEPENDENCIES(CC)])])dnl
142AC_PROVIDE_IFELSE([AC_PROG_CXX],
143                  [AM_DEPENDENCIES(CXX)],
144                  [define([AC_PROG_CXX],
145                          defn([AC_PROG_CXX])[AM_DEPENDENCIES(CXX)])])dnl
146])
147
148#
149# Check to make sure that the build environment is sane.
150#
151
152AC_DEFUN([AM_SANITY_CHECK],
153[AC_MSG_CHECKING([whether build environment is sane])
154# Just in case
155sleep 1
156echo timestamp > conftestfile
157# Do `set' in a subshell so we don't clobber the current shell's
158# arguments.  Must try -L first in case configure is actually a
159# symlink; some systems play weird games with the mod time of symlinks
160# (eg FreeBSD returns the mod time of the symlink's containing
161# directory).
162if (
163   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
164   if test "[$]*" = "X"; then
165      # -L didn't work.
166      set X `ls -t $srcdir/configure conftestfile`
167   fi
168   if test "[$]*" != "X $srcdir/configure conftestfile" \
169      && test "[$]*" != "X conftestfile $srcdir/configure"; then
170
171      # If neither matched, then we have a broken ls.  This can happen
172      # if, for instance, CONFIG_SHELL is bash and it inherits a
173      # broken ls alias from the environment.  This has actually
174      # happened.  Such a system could not be considered "sane".
175      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
176alias in your environment])
177   fi
178
179   test "[$]2" = conftestfile
180   )
181then
182   # Ok.
183   :
184else
185   AC_MSG_ERROR([newly created file is older than distributed files!
186Check your system clock])
187fi
188rm -f conftest*
189AC_MSG_RESULT(yes)])
190
191# AM_MISSING_PROG(NAME, PROGRAM)
192AC_DEFUN([AM_MISSING_PROG], [
193AC_REQUIRE([AM_MISSING_HAS_RUN])
194$1=${$1-"${am_missing_run}$2"}
195AC_SUBST($1)])
196
197# Like AM_MISSING_PROG, but only looks for install-sh.
198# AM_MISSING_INSTALL_SH()
199AC_DEFUN([AM_MISSING_INSTALL_SH], [
200AC_REQUIRE([AM_MISSING_HAS_RUN])
201if test -z "$install_sh"; then
202   install_sh="$ac_aux_dir/install-sh"
203   test -f "$install_sh" || install_sh="$ac_aux_dir/install.sh"
204   test -f "$install_sh" || install_sh="${am_missing_run}${ac_auxdir}/install-sh"
205   dnl FIXME: an evil hack: we remove the SHELL invocation from
206   dnl install_sh because automake adds it back in.  Sigh.
207   install_sh="`echo $install_sh | sed -e 's/\${SHELL}//'`"
208fi
209AC_SUBST(install_sh)])
210
211# AM_MISSING_HAS_RUN.
212# Define MISSING if not defined so far and test if it supports --run.
213# If it does, set am_missing_run to use it, otherwise, to nothing.
214AC_DEFUN([AM_MISSING_HAS_RUN], [
215test x"${MISSING+set}" = xset || \
216  MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing"
217# Use eval to expand $SHELL
218if eval "$MISSING --run :"; then
219  am_missing_run="$MISSING --run "
220else
221  am_missing_run=
222  am_backtick='`'
223  AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
224fi
225])
226
227# See how the compiler implements dependency checking.
228# Usage:
229# AM_DEPENDENCIES(NAME)
230# NAME is "CC", "CXX" or "OBJC".
231
232# We try a few techniques and use that to set a single cache variable.
233
234AC_DEFUN([AM_DEPENDENCIES],[
235AC_REQUIRE([AM_SET_DEPDIR])
236AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])
237ifelse([$1],CC,[
238AC_REQUIRE([AC_PROG_CC])
239AC_REQUIRE([AC_PROG_CPP])
240depcc="$CC"
241depcpp="$CPP"],[$1],CXX,[
242AC_REQUIRE([AC_PROG_CXX])
243AC_REQUIRE([AC_PROG_CXXCPP])
244depcc="$CXX"
245depcpp="$CXXCPP"],[$1],OBJC,[
246am_cv_OBJC_dependencies_compiler_type=gcc],[
247AC_REQUIRE([AC_PROG_][$1])
248depcc="$[$1]"
249depcpp=""])
250AC_MSG_CHECKING([dependency style of $depcc])
251AC_CACHE_VAL(am_cv_[$1]_dependencies_compiler_type,[
252if test -z "$AMDEP"; then
253  echo '#include "conftest.h"' > conftest.c
254  echo 'int i;' > conftest.h
255
256  am_cv_[$1]_dependencies_compiler_type=none
257  for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_depcomp"`; do
258    case "$depmode" in
259    nosideeffect)
260      # after this tag, mechanisms are not by side-effect, so they'll
261      # only be used when explicitly requested
262      if test "x$enable_dependency_tracking" = xyes; then
263	continue
264      else
265	break
266      fi
267      ;;
268    none) break ;;
269    esac
270    # We check with `-c' and `-o' for the sake of the "dashmstdout"
271    # mode.  It turns out that the SunPro C++ compiler does not properly
272    # handle `-M -o', and we need to detect this.
273    if depmode="$depmode" \
274       source=conftest.c object=conftest.o \
275       depfile=conftest.Po tmpdepfile=conftest.TPo \
276       $SHELL $am_depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
277       grep conftest.h conftest.Po > /dev/null 2>&1; then
278      am_cv_[$1]_dependencies_compiler_type="$depmode"
279      break
280    fi
281  done
282
283  rm -f conftest.*
284else
285  am_cv_[$1]_dependencies_compiler_type=none
286fi
287])
288AC_MSG_RESULT($am_cv_[$1]_dependencies_compiler_type)
289[$1]DEPMODE="depmode=$am_cv_[$1]_dependencies_compiler_type"
290AC_SUBST([$1]DEPMODE)
291])
292
293# Choose a directory name for dependency files.
294# This macro is AC_REQUIREd in AM_DEPENDENCIES
295
296AC_DEFUN([AM_SET_DEPDIR],[
297if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then
298  DEPDIR=.deps
299  # We redirect because .deps might already exist and be populated.
300  # In this situation we don't want to see an error.
301  rmdir .deps > /dev/null 2>&1
302else
303  DEPDIR=_deps
304fi
305AC_SUBST(DEPDIR)
306])
307
308AC_DEFUN([AM_DEP_TRACK],[
309AC_ARG_ENABLE(dependency-tracking,
310[  --disable-dependency-tracking Speeds up one-time builds
311  --enable-dependency-tracking  Do not reject slow dependency extractors])
312if test "x$enable_dependency_tracking" = xno; then
313  AMDEP="#"
314else
315  am_depcomp="$ac_aux_dir/depcomp"
316  if test ! -f "$am_depcomp"; then
317    AMDEP="#"
318  else
319    AMDEP=
320  fi
321fi
322AC_SUBST(AMDEP)
323if test -z "$AMDEP"; then
324  AMDEPBACKSLASH='\'
325else
326  AMDEPBACKSLASH=
327fi
328pushdef([subst], defn([AC_SUBST]))
329subst(AMDEPBACKSLASH)
330popdef([subst])
331])
332
333# Generate code to set up dependency tracking.
334# This macro should only be invoked once -- use via AC_REQUIRE.
335# Usage:
336# AM_OUTPUT_DEPENDENCY_COMMANDS
337
338#
339# This code is only required when automatic dependency tracking
340# is enabled.  FIXME.  This creates each `.P' file that we will
341# need in order to bootstrap the dependency handling code.
342AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[
343AC_OUTPUT_COMMANDS([
344test x"$AMDEP" != x"" ||
345for mf in $CONFIG_FILES; do
346  case "$mf" in
347  Makefile) dirpart=.;;
348  */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
349  *) continue;;
350  esac
351  grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
352  # Extract the definition of DEP_FILES from the Makefile without
353  # running `make'.
354  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
355  test -z "$DEPDIR" && continue
356  # When using ansi2knr, U may be empty or an underscore; expand it
357  U=`sed -n -e '/^U = / s///p' < "$mf"`
358  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
359  # We invoke sed twice because it is the simplest approach to
360  # changing $(DEPDIR) to its actual value in the expansion.
361  for file in `sed -n -e '
362    /^DEP_FILES = .*\\\\$/ {
363      s/^DEP_FILES = //
364      :loop
365	s/\\\\$//
366	p
367	n
368	/\\\\$/ b loop
369      p
370    }
371    /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
372       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
373    # Make sure the directory exists.
374    test -f "$dirpart/$file" && continue
375    fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
376    $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
377    # echo "creating $dirpart/$file"
378    echo '# dummy' > "$dirpart/$file"
379  done
380done
381], [AMDEP="$AMDEP"
382ac_aux_dir="$ac_aux_dir"])])
383
384
385# AM_PROG_LEX
386# Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
387AC_DEFUN([AM_PROG_LEX],
388[AC_REQUIRE([AM_MISSING_HAS_RUN])
389AC_CHECK_PROGS(LEX, flex lex, [${am_missing_run}flex])
390AC_PROG_LEX
391AC_DECL_YYTEXT])
392
393dnl $Id: krb-prog-ln-s.m4,v 1.1 1997/12/14 15:59:01 joda Exp $
394dnl
395dnl
396dnl Better test for ln -s, ln or cp
397dnl
398
399AC_DEFUN(AC_KRB_PROG_LN_S,
400[AC_MSG_CHECKING(for ln -s or something else)
401AC_CACHE_VAL(ac_cv_prog_LN_S,
402[rm -f conftestdata
403if ln -s X conftestdata 2>/dev/null
404then
405  rm -f conftestdata
406  ac_cv_prog_LN_S="ln -s"
407else
408  touch conftestdata1
409  if ln conftestdata1 conftestdata2; then
410    rm -f conftestdata*
411    ac_cv_prog_LN_S=ln
412  else
413    ac_cv_prog_LN_S=cp
414  fi
415fi])dnl
416LN_S="$ac_cv_prog_LN_S"
417AC_MSG_RESULT($ac_cv_prog_LN_S)
418AC_SUBST(LN_S)dnl
419])
420
421
422dnl $Id: mips-abi.m4,v 1.5 2000/07/18 15:01:42 joda Exp $
423dnl
424dnl
425dnl Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext to some
426dnl value.
427
428AC_DEFUN(AC_MIPS_ABI, [
429AC_ARG_WITH(mips_abi,
430[  --with-mips-abi=abi     ABI to use for IRIX (32, n32, or 64)])
431
432case "$host_os" in
433irix*)
434with_mips_abi="${with_mips_abi:-yes}"
435if test -n "$GCC"; then
436
437# GCC < 2.8 only supports the O32 ABI. GCC >= 2.8 has a flag to select
438# which ABI to use, but only supports (as of 2.8.1) the N32 and 64 ABIs.
439#
440# Default to N32, but if GCC doesn't grok -mabi=n32, we assume an old
441# GCC and revert back to O32. The same goes if O32 is asked for - old
442# GCCs doesn't like the -mabi option, and new GCCs can't output O32.
443#
444# Don't you just love *all* the different SGI ABIs?
445
446case "${with_mips_abi}" in 
447        32|o32) abi='-mabi=32';  abilibdirext=''     ;;
448       n32|yes) abi='-mabi=n32'; abilibdirext='32'  ;;
449        64) abi='-mabi=64';  abilibdirext='64'   ;;
450	no) abi=''; abilibdirext='';;
451         *) AC_MSG_ERROR("Invalid ABI specified") ;;
452esac
453if test -n "$abi" ; then
454ac_foo=krb_cv_gcc_`echo $abi | tr =- __`
455dnl
456dnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to
457dnl AC_MSG_RESULT
458dnl
459AC_MSG_CHECKING([if $CC supports the $abi option])
460AC_CACHE_VAL($ac_foo, [
461save_CFLAGS="$CFLAGS"
462CFLAGS="$CFLAGS $abi"
463AC_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no)
464CFLAGS="$save_CFLAGS"
465])
466ac_res=`eval echo \\\$$ac_foo`
467AC_MSG_RESULT($ac_res)
468if test $ac_res = no; then
469# Try to figure out why that failed...
470case $abi in
471	-mabi=32) 
472	save_CFLAGS="$CFLAGS"
473	CFLAGS="$CFLAGS -mabi=n32"
474	AC_TRY_COMPILE(,int x;, ac_res=yes, ac_res=no)
475	CLAGS="$save_CFLAGS"
476	if test $ac_res = yes; then
477		# New GCC
478		AC_MSG_ERROR([$CC does not support the $with_mips_abi ABI])
479	fi
480	# Old GCC
481	abi=''
482	abilibdirext=''
483	;;
484	-mabi=n32|-mabi=64)
485		if test $with_mips_abi = yes; then
486			# Old GCC, default to O32
487			abi=''
488			abilibdirext=''
489		else
490			# Some broken GCC
491			AC_MSG_ERROR([$CC does not support the $with_mips_abi ABI])
492		fi
493	;;
494esac
495fi #if test $ac_res = no; then
496fi #if test -n "$abi" ; then
497else
498case "${with_mips_abi}" in
499        32|o32) abi='-32'; abilibdirext=''     ;;
500       n32|yes) abi='-n32'; abilibdirext='32'  ;;
501        64) abi='-64'; abilibdirext='64'   ;;
502	no) abi=''; abilibdirext='';;
503         *) AC_MSG_ERROR("Invalid ABI specified") ;;
504esac
505fi #if test -n "$GCC"; then
506;;
507esac
508])
509
510dnl
511dnl $Id: c-attribute.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
512dnl
513
514dnl
515dnl Test for __attribute__
516dnl
517
518AC_DEFUN(AC_C___ATTRIBUTE__, [
519AC_MSG_CHECKING(for __attribute__)
520AC_CACHE_VAL(ac_cv___attribute__, [
521AC_TRY_COMPILE([
522#include <stdlib.h>
523],
524[
525static void foo(void) __attribute__ ((noreturn));
526
527static void
528foo(void)
529{
530  exit(1);
531}
532],
533ac_cv___attribute__=yes,
534ac_cv___attribute__=no)])
535if test "$ac_cv___attribute__" = "yes"; then
536  AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
537fi
538AC_MSG_RESULT($ac_cv___attribute__)
539])
540
541
542
543# serial 44 AC_PROG_LIBTOOL
544AC_DEFUN(AC_PROG_LIBTOOL,[AC_REQUIRE([_AC_PROG_LIBTOOL])])
545AC_DEFUN(_AC_PROG_LIBTOOL,
546[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
547
548# Save cache, so that ltconfig can load it
549AC_CACHE_SAVE
550
551# Actually configure libtool.  ac_aux_dir is where install-sh is found.
552AR="$AR" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
553MAGIC="$MAGIC" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
554LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
555AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
556objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
557deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
558${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
559$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
560|| AC_MSG_ERROR([libtool configure failed])
561
562# Reload cache, that may have been modified by ltconfig
563AC_CACHE_LOAD
564
565# This can be used to rebuild libtool when needed
566LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
567
568# Always use our own libtool.
569LIBTOOL='$(SHELL) $(top_builddir)/libtool'
570AC_SUBST(LIBTOOL)dnl
571
572# Redirect the config.log output again, so that the ltconfig log is not
573# clobbered by the next message.
574exec 5>>./config.log
575])
576
577AC_DEFUN(AC_LIBTOOL_SETUP,
578[AC_PREREQ(2.13)dnl
579AC_REQUIRE([AC_ENABLE_SHARED])dnl
580AC_REQUIRE([AC_ENABLE_STATIC])dnl
581AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
582AC_REQUIRE([AC_CANONICAL_HOST])dnl
583AC_REQUIRE([AC_CANONICAL_BUILD])dnl
584AC_REQUIRE([AC_PROG_CC])dnl
585AC_REQUIRE([AC_PROG_LD])dnl
586AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
587AC_REQUIRE([AC_PROG_NM])dnl
588AC_REQUIRE([AC_PROG_LN_S])dnl
589AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
590AC_REQUIRE([AC_OBJEXT])dnl
591AC_REQUIRE([AC_EXEEXT])dnl
592dnl
593
594# Only perform the check for file, if the check method requires it
595case "$deplibs_check_method" in
596file_magic*)
597  if test "$file_magic_cmd" = '${MAGIC}'; then
598    AC_PATH_MAGIC
599  fi
600  ;;
601esac
602
603AC_CHECK_TOOL(RANLIB, ranlib, :)
604AC_CHECK_TOOL(STRIP, strip, :)
605
606# Check for any special flags to pass to ltconfig.
607libtool_flags="--cache-file=$cache_file"
608test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
609test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
610test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
611test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
612test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
613ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
614[libtool_flags="$libtool_flags --enable-dlopen"])
615ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
616[libtool_flags="$libtool_flags --enable-win32-dll"])
617AC_ARG_ENABLE(libtool-lock,
618  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
619test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
620test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
621
622AC_ARG_WITH(pic,
623  [  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
624     pic_mode="$withval", pic_mode=default)
625test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
626test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
627
628# Some flags need to be propagated to the compiler or linker for good
629# libtool support.
630case "$host" in
631*-*-irix6*)
632  # Find out which ABI we are using.
633  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
634  if AC_TRY_EVAL(ac_compile); then
635    case "`/usr/bin/file conftest.o`" in
636    *32-bit*)
637      LD="${LD-ld} -32"
638      ;;
639    *N32*)
640      LD="${LD-ld} -n32"
641      ;;
642    *64-bit*)
643      LD="${LD-ld} -64"
644      ;;
645    esac
646  fi
647  rm -rf conftest*
648  ;;
649
650*-*-sco3.2v5*)
651  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
652  SAVE_CFLAGS="$CFLAGS"
653  CFLAGS="$CFLAGS -belf"
654  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
655    [AC_LANG_SAVE
656     AC_LANG_C
657     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
658     AC_LANG_RESTORE])
659  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
660    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
661    CFLAGS="$SAVE_CFLAGS"
662  fi
663  ;;
664
665ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
666[*-*-cygwin* | *-*-mingw*)
667  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
668  AC_CHECK_TOOL(AS, as, false)
669  AC_CHECK_TOOL(OBJDUMP, objdump, false)
670
671  # recent cygwin and mingw systems supply a stub DllMain which the user
672  # can override, but on older systems we have to supply one
673  AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
674    [AC_TRY_LINK([],
675      [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
676      DllMain (0, 0, 0);],
677      [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
678
679  case "$host/$CC" in
680  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
681    # old mingw systems require "-dll" to link a DLL, while more recent ones
682    # require "-mdll"
683    SAVE_CFLAGS="$CFLAGS"
684    CFLAGS="$CFLAGS -mdll"
685    AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
686      [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
687    CFLAGS="$SAVE_CFLAGS" ;;
688  *-*-cygwin*)
689    # cygwin systems need to pass --dll to the linker, and not link
690    # crt.o which will require a WinMain@16 definition.
691    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
692  esac
693  ;;
694  ])
695esac
696])
697
698# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
699AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
700
701# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
702AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
703
704# AC_ENABLE_SHARED - implement the --enable-shared flag
705# Usage: AC_ENABLE_SHARED[(DEFAULT)]
706#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
707#   `yes'.
708AC_DEFUN(AC_ENABLE_SHARED, [dnl
709define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
710AC_ARG_ENABLE(shared,
711changequote(<<, >>)dnl
712<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
713changequote([, ])dnl
714[p=${PACKAGE-default}
715case "$enableval" in
716yes) enable_shared=yes ;;
717no) enable_shared=no ;;
718*)
719  enable_shared=no
720  # Look at the argument we got.  We use all the common list separators.
721  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
722  for pkg in $enableval; do
723    if test "X$pkg" = "X$p"; then
724      enable_shared=yes
725    fi
726  done
727  IFS="$ac_save_ifs"
728  ;;
729esac],
730enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
731])
732
733# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
734AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
735AC_ENABLE_SHARED(no)])
736
737# AC_ENABLE_STATIC - implement the --enable-static flag
738# Usage: AC_ENABLE_STATIC[(DEFAULT)]
739#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
740#   `yes'.
741AC_DEFUN(AC_ENABLE_STATIC, [dnl
742define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
743AC_ARG_ENABLE(static,
744changequote(<<, >>)dnl
745<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
746changequote([, ])dnl
747[p=${PACKAGE-default}
748case "$enableval" in
749yes) enable_static=yes ;;
750no) enable_static=no ;;
751*)
752  enable_static=no
753  # Look at the argument we got.  We use all the common list separators.
754  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
755  for pkg in $enableval; do
756    if test "X$pkg" = "X$p"; then
757      enable_static=yes
758    fi
759  done
760  IFS="$ac_save_ifs"
761  ;;
762esac],
763enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
764])
765
766# AC_DISABLE_STATIC - set the default static flag to --disable-static
767AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
768AC_ENABLE_STATIC(no)])
769
770
771# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
772# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
773#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
774#   `yes'.
775AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
776define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
777AC_ARG_ENABLE(fast-install,
778changequote(<<, >>)dnl
779<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
780changequote([, ])dnl
781[p=${PACKAGE-default}
782case "$enableval" in
783yes) enable_fast_install=yes ;;
784no) enable_fast_install=no ;;
785*)
786  enable_fast_install=no
787  # Look at the argument we got.  We use all the common list separators.
788  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
789  for pkg in $enableval; do
790    if test "X$pkg" = "X$p"; then
791      enable_fast_install=yes
792    fi
793  done
794  IFS="$ac_save_ifs"
795  ;;
796esac],
797enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
798])
799
800# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
801AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
802AC_ENABLE_FAST_INSTALL(no)])
803
804# AC_LIBTOOL_PICMODE - implement the --with-pic flag
805# Usage: AC_LIBTOOL_PICMODE[(MODE)]
806#   Where MODE is either `yes' or `no'.  If omitted, it defaults to
807#   `both'.
808AC_DEFUN(AC_LIBTOOL_PICMODE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
809pic_mode=ifelse($#,1,$1,default)])
810
811
812# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
813AC_DEFUN(AC_PATH_TOOL_PREFIX,
814[AC_MSG_CHECKING([for $1])
815AC_CACHE_VAL(lt_cv_path_MAGIC,
816[case "$MAGIC" in
817  /*)
818  lt_cv_path_MAGIC="$MAGIC" # Let the user override the test with a path.
819  ;;
820  ?:/*)
821  ac_cv_path_MAGIC="$MAGIC" # Let the user override the test with a dos path.
822  ;;
823  *)
824  ac_save_MAGIC="$MAGIC"
825  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
826dnl $ac_dummy forces splitting on constant user-supplied paths.
827dnl POSIX.2 word splitting is done only on the output of word expansions,
828dnl not every word.  This closes a longstanding sh security hole.
829  ac_dummy="ifelse([$2], , $PATH, [$2])"
830  for ac_dir in $ac_dummy; do
831    test -z "$ac_dir" && ac_dir=.
832    if test -f $ac_dir/$1; then
833      lt_cv_path_MAGIC="$ac_dir/$1"
834      if test -n "$file_magic_test_file"; then
835	case "$deplibs_check_method" in
836	"file_magic "*)
837	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
838	  MAGIC="$lt_cv_path_MAGIC"
839	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
840	    egrep "$file_magic_regex" > /dev/null; then
841	    :
842	  else
843	    cat <<EOF 1>&2
844
845*** Warning: the command libtool uses to detect shared libraries,
846*** $file_magic_cmd, produces output that libtool cannot recognize.
847*** The result is that libtool may fail to recognize shared libraries
848*** as such.  This will affect the creation of libtool libraries that
849*** depend on shared libraries, but programs linked with such libtool
850*** libraries will work regardless of this problem.  Nevertheless, you
851*** may want to report the problem to your system manager and/or to
852*** bug-libtool@gnu.org
853
854EOF
855	  fi ;;
856	esac
857      fi
858      break
859    fi
860  done
861  IFS="$ac_save_ifs"
862  MAGIC="$ac_save_MAGIC"
863  ;;
864esac])
865MAGIC="$lt_cv_path_MAGIC"
866if test -n "$MAGIC"; then
867  AC_MSG_RESULT($MAGIC)
868else
869  AC_MSG_RESULT(no)
870fi
871])
872
873
874# AC_PATH_MAGIC - find a file program which can recognise a shared library
875AC_DEFUN(AC_PATH_MAGIC,
876[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
877AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
878if test -z "$lt_cv_path_MAGIC"; then
879  if test -n "$ac_tool_prefix"; then
880    AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
881  else
882    MAGIC=:
883  fi
884fi
885])
886
887
888# AC_PROG_LD - find the path to the GNU or non-GNU linker
889AC_DEFUN(AC_PROG_LD,
890[AC_ARG_WITH(gnu-ld,
891[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
892test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
893AC_REQUIRE([AC_PROG_CC])dnl
894AC_REQUIRE([AC_CANONICAL_HOST])dnl
895AC_REQUIRE([AC_CANONICAL_BUILD])dnl
896ac_prog=ld
897if test "$ac_cv_prog_gcc" = yes; then
898  # Check if gcc -print-prog-name=ld gives a path.
899  AC_MSG_CHECKING([for ld used by GCC])
900  case $host in
901  *-*-mingw*)
902    # gcc leaves a trailing carriage return which upsets mingw
903    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
904  *)
905    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
906  esac
907  case "$ac_prog" in
908    # Accept absolute paths.
909changequote(,)dnl
910    [\\/]* | [A-Za-z]:[\\/]*)
911      re_direlt='/[^/][^/]*/\.\./'
912changequote([,])dnl
913      # Canonicalize the path of ld
914      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
915      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
916	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
917      done
918      test -z "$LD" && LD="$ac_prog"
919      ;;
920  "")
921    # If it fails, then pretend we aren't using GCC.
922    ac_prog=ld
923    ;;
924  *)
925    # If it is relative, then search for the first ld in PATH.
926    with_gnu_ld=unknown
927    ;;
928  esac
929elif test "$with_gnu_ld" = yes; then
930  AC_MSG_CHECKING([for GNU ld])
931else
932  AC_MSG_CHECKING([for non-GNU ld])
933fi
934AC_CACHE_VAL(ac_cv_path_LD,
935[if test -z "$LD"; then
936  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
937  for ac_dir in $PATH; do
938    test -z "$ac_dir" && ac_dir=.
939    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
940      ac_cv_path_LD="$ac_dir/$ac_prog"
941      # Check to see if the program is GNU ld.  I'd rather use --version,
942      # but apparently some GNU ld's only accept -v.
943      # Break only if it was the GNU/non-GNU ld that we prefer.
944      if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
945	test "$with_gnu_ld" != no && break
946      else
947	test "$with_gnu_ld" != yes && break
948      fi
949    fi
950  done
951  IFS="$ac_save_ifs"
952else
953  ac_cv_path_LD="$LD" # Let the user override the test with a path.
954fi])
955LD="$ac_cv_path_LD"
956if test -n "$LD"; then
957  AC_MSG_RESULT($LD)
958else
959  AC_MSG_RESULT(no)
960fi
961test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
962AC_PROG_LD_GNU
963])
964
965AC_DEFUN(AC_PROG_LD_GNU,
966[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
967[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
968if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
969  ac_cv_prog_gnu_ld=yes
970else
971  ac_cv_prog_gnu_ld=no
972fi])
973with_gnu_ld=$ac_cv_prog_gnu_ld
974])
975
976# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
977#   -- PORTME Some linkers may need a different reload flag.
978AC_DEFUN(AC_PROG_LD_RELOAD_FLAG,
979[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
980[lt_cv_ld_reload_flag='-r'])
981reload_flag=$lt_cv_ld_reload_flag
982test -n "$reload_flag" && reload_flag=" $reload_flag"
983])
984
985# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
986#  -- PORTME fill in with the dynamic library characteristics
987AC_DEFUN(AC_DEPLIBS_CHECK_METHOD,
988[AC_CACHE_CHECK([how to recognise dependant libraries],
989lt_cv_deplibs_check_method,
990[lt_cv_file_magic_cmd='${MAGIC}'
991lt_cv_file_magic_test_file=
992lt_cv_deplibs_check_method='unknown'
993# Need to set the preceding variable on all platforms that support
994# interlibrary dependencies.
995# 'none' -- dependencies not supported.
996# `unknown' -- same as none, but documents that we really don't know.
997# 'pass_all' -- all dependencies passed with no checks.
998# 'test_compile' -- check by making test program.
999# 'file_magic [regex]' -- check by looking for files in library path
1000# which responds to the $file_magic_cmd with a given egrep regex.
1001# If you have `file' or equivalent on your system and you're not sure
1002# whether `pass_all' will *always* work, you probably want this one.
1003
1004case "$host_os" in
1005aix4*)
1006  lt_cv_deplibs_check_method=pass_all
1007  ;;
1008
1009beos*)
1010  lt_cv_deplibs_check_method=pass_all
1011  ;;
1012
1013bsdi4*)
1014  changequote(,)dnl
1015  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
1016  changequote([, ])dnl
1017  lt_cv_file_magic_cmd='/usr/bin/file -L'
1018  lt_cv_file_magic_test_file=/shlib/libc.so
1019  ;;
1020
1021cygwin* | mingw*)
1022  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
1023  lt_cv_file_magic_cmd='${OBJDUMP} -f'
1024  ;;
1025
1026freebsd*)
1027  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
1028    case "$host_cpu" in
1029    i*86 )
1030      changequote(,)dnl
1031      lt_cv_deplibs_check_method=='file_magic OpenBSD/i[3-9]86 demand paged shared library'
1032      changequote([, ])dnl
1033      lt_cv_file_magic_cmd=/usr/bin/file
1034      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
1035      ;;
1036    esac
1037  else
1038    lt_cv_deplibs_check_method=pass_all
1039  fi
1040  ;;
1041
1042gnu*)
1043  lt_cv_deplibs_check_method=pass_all
1044  ;;
1045
1046hpux10.20*)
1047  # TODO:  Does this work for hpux-11 too?
1048  lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
1049  lt_cv_file_magic_cmd=/usr/bin/file
1050  lt_cv_file_magic_test_file=/usr/lib/libc.sl
1051  ;;
1052
1053irix5* | irix6*)
1054  case "$host_os" in
1055  irix5*)
1056    # this will be overridden with pass_all, but let us keep it just in case
1057    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
1058    ;;
1059  *)
1060    case "$LD" in
1061    *-32|*"-32 ") libmagic=32-bit;;
1062    *-n32|*"-n32 ") libmagic=N32;;
1063    *-64|*"-64 ") libmagic=64-bit;;
1064    *) libmagic=never-match;;
1065    esac
1066    # this will be overridden with pass_all, but let us keep it just in case
1067    changequote(,)dnl
1068    lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
1069    changequote([, ])dnl
1070    ;;
1071  esac
1072  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
1073  lt_cv_deplibs_check_method=pass_all
1074  ;;
1075
1076# This must be Linux ELF.
1077linux-gnu*)
1078  case "$host_cpu" in
1079  alpha* | i*86 | powerpc* | sparc* | ia64* )
1080    lt_cv_deplibs_check_method=pass_all ;;
1081  *)
1082    # glibc up to 2.1.1 does not perform some relocations on ARM
1083    changequote(,)dnl
1084    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
1085    changequote([, ])dnl
1086  esac
1087  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
1088  ;;
1089
1090netbsd*)
1091  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then :
1092  else
1093    changequote(,)dnl
1094    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
1095    changequote([, ])dnl
1096    lt_cv_file_magic_cmd='/usr/bin/file -L'
1097    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
1098  fi
1099  ;;
1100
1101osf3* | osf4* | osf5*)
1102  # this will be overridden with pass_all, but let us keep it just in case
1103  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
1104  lt_cv_file_magic_test_file=/shlib/libc.so
1105  lt_cv_deplibs_check_method=pass_all
1106  ;;
1107
1108sco3.2v5*)
1109  lt_cv_deplibs_check_method=pass_all
1110  ;;
1111
1112solaris*)
1113  lt_cv_deplibs_check_method=pass_all
1114  lt_cv_file_magic_test_file=/lib/libc.so
1115  ;;
1116
1117sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
1118  case "$host_vendor" in
1119  ncr)
1120    lt_cv_deplibs_check_method=pass_all
1121    ;;
1122  motorola)
1123    changequote(,)dnl
1124    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
1125    changequote([, ])dnl
1126    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
1127    ;;
1128  esac
1129  ;;
1130esac
1131])
1132file_magic_cmd=$lt_cv_file_magic_cmd
1133deplibs_check_method=$lt_cv_deplibs_check_method
1134])
1135
1136
1137# AC_PROG_NM - find the path to a BSD-compatible name lister
1138AC_DEFUN(AC_PROG_NM,
1139[AC_MSG_CHECKING([for BSD-compatible nm])
1140AC_CACHE_VAL(ac_cv_path_NM,
1141[if test -n "$NM"; then
1142  # Let the user override the test.
1143  ac_cv_path_NM="$NM"
1144else
1145  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1146  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
1147    test -z "$ac_dir" && ac_dir=.
1148    tmp_nm=$ac_dir/${ac_tool_prefix}nm
1149    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
1150      # Check to see if the nm accepts a BSD-compat flag.
1151      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
1152      #   nm: unknown option "B" ignored
1153      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1154	ac_cv_path_NM="$tmp_nm -B"
1155	break
1156      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1157	ac_cv_path_NM="$tmp_nm -p"
1158	break
1159      else
1160	ac_cv_path_NM=${ac_cv_path_NM="$tmp_nm"} # keep the first match, but
1161	continue # so that we can try to find one that supports BSD flags
1162      fi
1163    fi
1164  done
1165  IFS="$ac_save_ifs"
1166  test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
1167fi])
1168NM="$ac_cv_path_NM"
1169AC_MSG_RESULT([$NM])
1170])
1171
1172# AC_CHECK_LIBM - check for math library
1173AC_DEFUN(AC_CHECK_LIBM,
1174[AC_REQUIRE([AC_CANONICAL_HOST])dnl
1175LIBM=
1176case "$host" in
1177*-*-beos* | *-*-cygwin*)
1178  # These system don't have libm
1179  ;;
1180*-ncr-sysv4.3*)
1181  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
1182  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
1183  ;;
1184*)
1185  AC_CHECK_LIB(m, main, LIBM="-lm")
1186  ;;
1187esac
1188])
1189
1190# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
1191# the libltdl convenience library and INCLTDL to the include flags for
1192# the libltdl header and adds --enable-ltdl-convenience to the
1193# configure arguments.  Note that LIBLTDL and INCLTDL are not
1194# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
1195# provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
1196# with '${top_builddir}/' and INCLTDL will be prefixed with
1197# '${top_srcdir}/' (note the single quotes!).  If your package is not
1198# flat and you're not using automake, define top_builddir and
1199# top_srcdir appropriately in the Makefiles.
1200AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1201  case "$enable_ltdl_convenience" in
1202  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
1203  "") enable_ltdl_convenience=yes
1204      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
1205  esac
1206  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
1207  INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
1208])
1209
1210# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
1211# the libltdl installable library and INCLTDL to the include flags for
1212# the libltdl header and adds --enable-ltdl-install to the configure
1213# arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
1214# AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
1215# libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
1216# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
1217# with '${top_srcdir}/' (note the single quotes!).  If your package is
1218# not flat and you're not using automake, define top_builddir and
1219# top_srcdir appropriately in the Makefiles.
1220# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
1221AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1222  AC_CHECK_LIB(ltdl, main,
1223  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
1224  [if test x"$enable_ltdl_install" = xno; then
1225     AC_MSG_WARN([libltdl not installed, but installation disabled])
1226   else
1227     enable_ltdl_install=yes
1228   fi
1229  ])
1230  if test x"$enable_ltdl_install" = x"yes"; then
1231    ac_configure_args="$ac_configure_args --enable-ltdl-install"
1232    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
1233    INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
1234  else
1235    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
1236    LIBLTDL="-lltdl"
1237    INCLTDL=
1238  fi
1239])
1240
1241dnl old names
1242AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
1243AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
1244AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
1245AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
1246AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
1247AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
1248AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
1249
1250dnl This is just to silence aclocal about the macro not being used
1251ifelse([AC_DISABLE_FAST_INSTALL])dnl
1252
1253dnl $Id: wflags.m4,v 1.3 1999/03/11 12:11:41 joda Exp $
1254dnl
1255dnl set WFLAGS
1256
1257AC_DEFUN(AC_WFLAGS,[
1258WFLAGS_NOUNUSED=""
1259WFLAGS_NOIMPLICITINT=""
1260if test -z "$WFLAGS" -a "$GCC" = "yes"; then
1261  # -Wno-implicit-int for broken X11 headers
1262  # leave these out for now:
1263  #   -Wcast-align doesn't work well on alpha osf/1
1264  #   -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast
1265  #   -Wmissing-declarations -Wnested-externs
1266  WFLAGS="ifelse($#, 0,-Wall, $1)"
1267  WFLAGS_NOUNUSED="-Wno-unused"
1268  WFLAGS_NOIMPLICITINT="-Wno-implicit-int"
1269fi
1270AC_SUBST(WFLAGS)dnl
1271AC_SUBST(WFLAGS_NOUNUSED)dnl
1272AC_SUBST(WFLAGS_NOIMPLICITINT)dnl
1273])
1274
1275dnl $Id: db.m4,v 1.1 2000/07/19 11:21:07 joda Exp $
1276dnl
1277dnl tests for various db libraries
1278dnl
1279AC_DEFUN([rk_DB],[berkeley_db=db
1280AC_ARG_WITH(berkeley-db,
1281[  --without-berkeley-db   if you don't want berkeley db],[
1282if test "$withval" = no; then
1283	berkeley_db=""
1284fi
1285])
1286if test "$berkeley_db"; then
1287  AC_CHECK_HEADERS([				\
1288	db.h					\
1289	db_185.h				\
1290  ])
1291fi
1292
1293AC_FIND_FUNC_NO_LIBS2(dbopen, $berkeley_db, [
1294#include <stdio.h>
1295#if defined(HAVE_DB_185_H)
1296#include <db_185.h>
1297#elif defined(HAVE_DB_H)
1298#include <db.h>
1299#endif
1300],[NULL, 0, 0, 0, NULL])
1301
1302AC_FIND_FUNC_NO_LIBS(dbm_firstkey, $berkeley_db gdbm ndbm)
1303AC_FIND_FUNC_NO_LIBS(db_create, $berkeley_db)
1304
1305DBLIB="$LIB_dbopen"
1306if test "$LIB_dbopen" != "$LIB_db_create"; then
1307        DBLIB="$DBLIB $LIB_db_create"
1308fi
1309if test "$LIB_dbopen" != "$LIB_dbm_firstkey"; then
1310	DBLIB="$DBLIB $LIB_dbm_firstkey"
1311fi
1312AC_SUBST(DBLIB)dnl
1313
1314])
1315
1316dnl $Id: find-func-no-libs2.m4,v 1.4 2000/07/15 18:10:19 joda Exp $
1317dnl
1318dnl
1319dnl Look for function in any of the specified libraries
1320dnl
1321
1322dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args)
1323AC_DEFUN(AC_FIND_FUNC_NO_LIBS2, [
1324
1325AC_MSG_CHECKING([for $1])
1326AC_CACHE_VAL(ac_cv_funclib_$1,
1327[
1328if eval "test \"\$ac_cv_func_$1\" != yes" ; then
1329	ac_save_LIBS="$LIBS"
1330	for ac_lib in $2; do
1331		if test -n "$ac_lib"; then 
1332			ac_lib="-l$ac_lib"
1333		else
1334			ac_lib=""
1335		fi
1336		LIBS="$6 $ac_lib $5 $ac_save_LIBS"
1337		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)
1338	done
1339	eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}"
1340	LIBS="$ac_save_LIBS"
1341fi
1342])
1343
1344eval "ac_res=\$ac_cv_funclib_$1"
1345
1346if false; then
1347	AC_CHECK_FUNCS($1)
1348dnl	AC_CHECK_LIBS($2, foo)
1349fi
1350# $1
1351eval "ac_tr_func=HAVE_[]upcase($1)"
1352eval "ac_tr_lib=HAVE_LIB[]upcase($ac_res | sed -e 's/-l//')"
1353eval "LIB_$1=$ac_res"
1354
1355case "$ac_res" in
1356	yes)
1357	eval "ac_cv_func_$1=yes"
1358	eval "LIB_$1="
1359	AC_DEFINE_UNQUOTED($ac_tr_func)
1360	AC_MSG_RESULT([yes])
1361	;;
1362	no)
1363	eval "ac_cv_func_$1=no"
1364	eval "LIB_$1="
1365	AC_MSG_RESULT([no])
1366	;;
1367	*)
1368	eval "ac_cv_func_$1=yes"
1369	eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes"
1370	AC_DEFINE_UNQUOTED($ac_tr_func)
1371	AC_DEFINE_UNQUOTED($ac_tr_lib)
1372	AC_MSG_RESULT([yes, in $ac_res])
1373	;;
1374esac
1375AC_SUBST(LIB_$1)
1376])
1377
1378dnl $Id: find-func-no-libs.m4,v 1.5 1999/10/30 21:08:18 assar Exp $
1379dnl
1380dnl
1381dnl Look for function in any of the specified libraries
1382dnl
1383
1384dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments, extra libs, extra args)
1385AC_DEFUN(AC_FIND_FUNC_NO_LIBS, [
1386AC_FIND_FUNC_NO_LIBS2([$1], ["" $2], [$3], [$4], [$5], [$6])])
1387
1388dnl $Id: roken-frag.m4,v 1.21 2001/05/11 13:58:21 joda Exp $
1389dnl
1390dnl some code to get roken working
1391dnl
1392dnl rk_ROKEN(subdir)
1393dnl
1394AC_DEFUN(rk_ROKEN, [
1395
1396AC_REQUIRE([rk_CONFIG_HEADER])
1397
1398DIR_roken=roken
1399LIB_roken='$(top_builddir)/$1/libroken.la'
1400INCLUDES_roken='-I$(top_builddir)/$1 -I$(top_srcdir)/$1'
1401
1402dnl Checks for programs
1403AC_REQUIRE([AC_PROG_CC])
1404AC_REQUIRE([AC_PROG_AWK])
1405AC_REQUIRE([AC_OBJEXT])
1406AC_REQUIRE([AC_EXEEXT])
1407AC_REQUIRE([AC_PROG_LIBTOOL])
1408
1409AC_REQUIRE([AC_MIPS_ABI])
1410
1411dnl C characteristics
1412
1413AC_REQUIRE([AC_C___ATTRIBUTE__])
1414AC_REQUIRE([AC_C_INLINE])
1415AC_REQUIRE([AC_C_CONST])
1416AC_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
1417
1418AC_REQUIRE([rk_DB])
1419
1420dnl C types
1421
1422AC_REQUIRE([AC_TYPE_SIZE_T])
1423AC_CHECK_TYPE_EXTRA(ssize_t, int, [#include <unistd.h>])
1424AC_REQUIRE([AC_TYPE_PID_T])
1425AC_REQUIRE([AC_TYPE_UID_T])
1426AC_HAVE_TYPE([long long])
1427
1428AC_REQUIRE([rk_RETSIGTYPE])
1429
1430dnl Checks for header files.
1431AC_REQUIRE([AC_HEADER_STDC])
1432AC_REQUIRE([AC_HEADER_TIME])
1433
1434AC_CHECK_HEADERS([\
1435	arpa/inet.h				\
1436	arpa/nameser.h				\
1437	config.h				\
1438	crypt.h					\
1439	dbm.h					\
1440	db.h					\
1441	dirent.h				\
1442	errno.h					\
1443	err.h					\
1444	fcntl.h					\
1445	gdbm/ndbm.h				\
1446	grp.h					\
1447	ifaddrs.h				\
1448	ndbm.h					\
1449	net/if.h				\
1450	netdb.h					\
1451	netinet/in.h				\
1452	netinet/in6.h				\
1453	netinet/in_systm.h			\
1454	netinet6/in6.h				\
1455	netinet6/in6_var.h			\
1456	paths.h					\
1457	pwd.h					\
1458	resolv.h				\
1459	rpcsvc/dbm.h				\
1460	rpcsvc/ypclnt.h				\
1461	shadow.h				\
1462	sys/bswap.h				\
1463	sys/ioctl.h				\
1464	sys/param.h				\
1465	sys/proc.h				\
1466	sys/resource.h				\
1467	sys/socket.h				\
1468	sys/sockio.h				\
1469	sys/stat.h				\
1470	sys/sysctl.h				\
1471	sys/time.h				\
1472	sys/tty.h				\
1473	sys/types.h				\
1474	sys/uio.h				\
1475	sys/utsname.h				\
1476	sys/wait.h				\
1477	syslog.h				\
1478	termios.h				\
1479	unistd.h				\
1480	userconf.h				\
1481	usersec.h				\
1482	util.h					\
1483	vis.h					\
1484	winsock.h				\
1485])
1486	
1487AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
1488
1489AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
1490AM_CONDITIONAL(have_fnmatch_h, test "$ac_cv_header_fnmatch_h" = yes)
1491AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
1492AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
1493
1494dnl Check for functions and libraries
1495
1496AC_KRB_IPV6
1497
1498AC_FIND_FUNC(socket, socket)
1499AC_FIND_FUNC(gethostbyname, nsl)
1500AC_FIND_FUNC(syslog, syslog)
1501AC_FIND_FUNC(gethostbyname2, inet6 ip6)
1502
1503AC_FIND_FUNC(res_search, resolv,
1504[
1505#include <stdio.h>
1506#ifdef HAVE_SYS_TYPES_H
1507#include <sys/types.h>
1508#endif
1509#ifdef HAVE_NETINET_IN_H
1510#include <netinet/in.h>
1511#endif
1512#ifdef HAVE_ARPA_NAMESER_H
1513#include <arpa/nameser.h>
1514#endif
1515#ifdef HAVE_RESOLV_H
1516#include <resolv.h>
1517#endif
1518],
1519[0,0,0,0,0])
1520
1521AC_FIND_FUNC(dn_expand, resolv,
1522[
1523#include <stdio.h>
1524#ifdef HAVE_SYS_TYPES_H
1525#include <sys/types.h>
1526#endif
1527#ifdef HAVE_NETINET_IN_H
1528#include <netinet/in.h>
1529#endif
1530#ifdef HAVE_ARPA_NAMESER_H
1531#include <arpa/nameser.h>
1532#endif
1533#ifdef HAVE_RESOLV_H
1534#include <resolv.h>
1535#endif
1536],
1537[0,0,0,0,0])
1538
1539AC_BROKEN_SNPRINTF
1540AC_BROKEN_VSNPRINTF
1541
1542AC_BROKEN_GLOB
1543if test "$ac_cv_func_glob_working" != yes; then
1544	LIBOBJS="$LIBOBJS glob.o"
1545fi
1546AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
1547
1548
1549AC_CHECK_FUNCS([				\
1550	asnprintf				\
1551	asprintf				\
1552	cgetent					\
1553	getconfattr				\
1554	getprogname				\
1555	getrlimit				\
1556	getspnam				\
1557	setprogname				\
1558	strsvis					\
1559	strunvis				\
1560	strvis					\
1561	strvisx					\
1562	svis					\
1563	sysconf					\
1564	sysctl					\
1565	uname					\
1566	unvis					\
1567	vasnprintf				\
1568	vasprintf				\
1569	vis					\
1570])
1571
1572if test "$ac_cv_func_cgetent" = no; then
1573	LIBOBJS="$LIBOBJS getcap.o"
1574fi
1575
1576AC_REQUIRE([AC_FUNC_GETLOGIN])
1577
1578AC_FIND_FUNC_NO_LIBS(getsockopt,,
1579[#ifdef HAVE_SYS_TYPES_H
1580#include <sys/types.h>
1581#endif
1582#ifdef HAVE_SYS_SOCKET_H
1583#include <sys/socket.h>
1584#endif],
1585[0,0,0,0,0])
1586AC_FIND_FUNC_NO_LIBS(setsockopt,,
1587[#ifdef HAVE_SYS_TYPES_H
1588#include <sys/types.h>
1589#endif
1590#ifdef HAVE_SYS_SOCKET_H
1591#include <sys/socket.h>
1592#endif],
1593[0,0,0,0,0])
1594
1595AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
1596[#ifdef HAVE_NETDB_H
1597#include <netdb.h>
1598#endif],
159917)
1600if test "$ac_cv_func_hstrerror" = yes; then
1601AC_NEED_PROTO([
1602#ifdef HAVE_NETDB_H
1603#include <netdb.h>
1604#endif],
1605hstrerror)
1606fi
1607
1608dnl sigh, wish this could be done in a loop
1609if test "$ac_cv_func_asprintf" = yes; then
1610AC_NEED_PROTO([
1611#include <stdio.h>
1612#include <string.h>],
1613asprintf)dnl
1614fi
1615if test "$ac_cv_func_vasprintf" = yes; then
1616AC_NEED_PROTO([
1617#include <stdio.h>
1618#include <string.h>],
1619vasprintf)dnl
1620fi
1621if test "$ac_cv_func_asnprintf" = yes; then
1622AC_NEED_PROTO([
1623#include <stdio.h>
1624#include <string.h>],
1625asnprintf)dnl
1626fi
1627if test "$ac_cv_func_vasnprintf" = yes; then
1628AC_NEED_PROTO([
1629#include <stdio.h>
1630#include <string.h>],
1631vasnprintf)dnl
1632fi
1633
1634AC_FIND_FUNC_NO_LIBS(bswap16,,
1635[#ifdef HAVE_SYS_BSWAP_H
1636#include <sys/bswap.h>
1637#endif],0)
1638
1639AC_FIND_FUNC_NO_LIBS(bswap32,,
1640[#ifdef HAVE_SYS_BSWAP_H
1641#include <sys/bswap.h>
1642#endif],0)
1643
1644AC_FIND_FUNC_NO_LIBS(pidfile,util,
1645[#ifdef HAVE_UTIL_H
1646#include <util.h>
1647#endif],0)
1648
1649AC_BROKEN([					\
1650	chown					\
1651	copyhostent				\
1652	daemon					\
1653	err					\
1654	errx					\
1655	fchown					\
1656	flock					\
1657	fnmatch					\
1658	freeaddrinfo				\
1659	freehostent				\
1660	gai_strerror				\
1661	getaddrinfo				\
1662	getcwd					\
1663	getdtablesize				\
1664	getegid					\
1665	geteuid					\
1666	getgid					\
1667	gethostname				\
1668	getifaddrs				\
1669	getipnodebyaddr				\
1670	getipnodebyname				\
1671	getnameinfo				\
1672	getopt					\
1673	gettimeofday				\
1674	getuid					\
1675	getusershell				\
1676	initgroups				\
1677	innetgr					\
1678	iruserok				\
1679	lstat					\
1680	memmove					\
1681	mkstemp					\
1682	putenv					\
1683	rcmd					\
1684	readv					\
1685	recvmsg					\
1686	sendmsg					\
1687	setegid					\
1688	setenv					\
1689	seteuid					\
1690	strcasecmp				\
1691	strdup					\
1692	strerror				\
1693	strftime				\
1694	strlcat					\
1695	strlcpy					\
1696	strlwr					\
1697	strncasecmp				\
1698	strndup					\
1699	strnlen					\
1700	strptime				\
1701	strsep					\
1702	strsep_copy				\
1703	strtok_r				\
1704	strupr					\
1705	swab					\
1706	unsetenv				\
1707	verr					\
1708	verrx					\
1709	vsyslog					\
1710	vwarn					\
1711	vwarnx					\
1712	warn					\
1713	warnx					\
1714	writev					\
1715])
1716
1717AC_BROKEN2(inet_aton,
1718[#ifdef HAVE_SYS_TYPES_H
1719#include <sys/types.h>
1720#endif
1721#ifdef HAVE_SYS_SOCKET_H
1722#include <sys/socket.h>
1723#endif
1724#ifdef HAVE_NETINET_IN_H
1725#include <netinet/in.h>
1726#endif
1727#ifdef HAVE_ARPA_INET_H
1728#include <arpa/inet.h>
1729#endif],
1730[0,0])
1731
1732AC_BROKEN2(inet_ntop,
1733[#ifdef HAVE_SYS_TYPES_H
1734#include <sys/types.h>
1735#endif
1736#ifdef HAVE_SYS_SOCKET_H
1737#include <sys/socket.h>
1738#endif
1739#ifdef HAVE_NETINET_IN_H
1740#include <netinet/in.h>
1741#endif
1742#ifdef HAVE_ARPA_INET_H
1743#include <arpa/inet.h>
1744#endif],
1745[0, 0, 0, 0])
1746
1747AC_BROKEN2(inet_pton,
1748[#ifdef HAVE_SYS_TYPES_H
1749#include <sys/types.h>
1750#endif
1751#ifdef HAVE_SYS_SOCKET_H
1752#include <sys/socket.h>
1753#endif
1754#ifdef HAVE_NETINET_IN_H
1755#include <netinet/in.h>
1756#endif
1757#ifdef HAVE_ARPA_INET_H
1758#include <arpa/inet.h>
1759#endif],
1760[0,0,0])
1761
1762dnl
1763dnl Check for sa_len in struct sockaddr, 
1764dnl needs to come before the getnameinfo test
1765dnl
1766AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
1767#include <sys/socket.h>])
1768
1769if test "$ac_cv_func_getnameinfo" = "yes"; then
1770  rk_BROKEN_GETNAMEINFO
1771  if test "$ac_cv_func_getnameinfo_broken" = yes; then
1772    LIBOBJS="$LIBOBJS getnameinfo.o"
1773  fi
1774fi
1775
1776AC_NEED_PROTO([#include <stdlib.h>], setenv)
1777AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
1778AC_NEED_PROTO([#include <unistd.h>], gethostname)
1779AC_NEED_PROTO([#include <unistd.h>], mkstemp)
1780AC_NEED_PROTO([#include <unistd.h>], getusershell)
1781
1782AC_NEED_PROTO([
1783#ifdef HAVE_SYS_TYPES_H
1784#include <sys/types.h>
1785#endif
1786#ifdef HAVE_SYS_SOCKET_H
1787#include <sys/socket.h>
1788#endif
1789#ifdef HAVE_NETINET_IN_H
1790#include <netinet/in.h>
1791#endif
1792#ifdef HAVE_ARPA_INET_H
1793#include <arpa/inet.h>
1794#endif],
1795inet_aton)
1796
1797AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
1798
1799AC_REQUIRE([rk_BROKEN_REALLOC])dnl
1800
1801dnl AC_KRB_FUNC_GETCWD_BROKEN
1802
1803dnl
1804dnl Checks for prototypes and declarations
1805dnl
1806
1807AC_PROTO_COMPAT([
1808#ifdef HAVE_SYS_TYPES_H
1809#include <sys/types.h>
1810#endif
1811#ifdef HAVE_SYS_SOCKET_H
1812#include <sys/socket.h>
1813#endif
1814#ifdef HAVE_NETINET_IN_H
1815#include <netinet/in.h>
1816#endif
1817#ifdef HAVE_ARPA_INET_H
1818#include <arpa/inet.h>
1819#endif
1820#ifdef HAVE_NETDB_H
1821#include <netdb.h>
1822#endif
1823],
1824gethostbyname, struct hostent *gethostbyname(const char *))
1825
1826AC_PROTO_COMPAT([
1827#ifdef HAVE_SYS_TYPES_H
1828#include <sys/types.h>
1829#endif
1830#ifdef HAVE_SYS_SOCKET_H
1831#include <sys/socket.h>
1832#endif
1833#ifdef HAVE_NETINET_IN_H
1834#include <netinet/in.h>
1835#endif
1836#ifdef HAVE_ARPA_INET_H
1837#include <arpa/inet.h>
1838#endif
1839#ifdef HAVE_NETDB_H
1840#include <netdb.h>
1841#endif
1842],
1843gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
1844
1845AC_PROTO_COMPAT([
1846#ifdef HAVE_SYS_TYPES_H
1847#include <sys/types.h>
1848#endif
1849#ifdef HAVE_SYS_SOCKET_H
1850#include <sys/socket.h>
1851#endif
1852#ifdef HAVE_NETINET_IN_H
1853#include <netinet/in.h>
1854#endif
1855#ifdef HAVE_ARPA_INET_H
1856#include <arpa/inet.h>
1857#endif
1858#ifdef HAVE_NETDB_H
1859#include <netdb.h>
1860#endif
1861],
1862getservbyname, struct servent *getservbyname(const char *, const char *))
1863
1864AC_PROTO_COMPAT([
1865#ifdef HAVE_SYS_TYPES_H
1866#include <sys/types.h>
1867#endif
1868#ifdef HAVE_SYS_SOCKET_H
1869#include <sys/socket.h>
1870#endif
1871],
1872getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
1873
1874AC_PROTO_COMPAT([
1875#ifdef HAVE_SYSLOG_H
1876#include <syslog.h>
1877#endif
1878],
1879openlog, void openlog(const char *, int, int))
1880
1881AC_NEED_PROTO([
1882#ifdef HAVE_CRYPT_H
1883#include <crypt.h>
1884#endif
1885#ifdef HAVE_UNISTD_H
1886#include <unistd.h>
1887#endif
1888],
1889crypt)
1890
1891AC_NEED_PROTO([
1892#include <string.h>
1893],
1894strtok_r)
1895
1896AC_NEED_PROTO([
1897#include <string.h>
1898],
1899strsep)
1900
1901dnl variables
1902
1903rk_CHECK_VAR(h_errno, 
1904[#ifdef HAVE_SYS_TYPES_H
1905#include <sys/types.h>
1906#endif
1907#ifdef HAVE_NETDB_H
1908#include <netdb.h>
1909#endif])
1910
1911rk_CHECK_VAR(h_errlist, 
1912[#ifdef HAVE_NETDB_H
1913#include <netdb.h>
1914#endif])
1915
1916rk_CHECK_VAR(h_nerr, 
1917[#ifdef HAVE_NETDB_H
1918#include <netdb.h>
1919#endif])
1920
1921rk_CHECK_VAR([__progname], 
1922[#ifdef HAVE_ERR_H
1923#include <err.h>
1924#endif])
1925
1926AC_CHECK_DECLARATION([#include <stdlib.h>
1927#ifdef HAVE_UNISTD_H
1928#include <unistd.h>
1929#endif], optarg)
1930AC_CHECK_DECLARATION([#include <stdlib.h>
1931#ifdef HAVE_UNISTD_H
1932#include <unistd.h>
1933#endif], optind)
1934AC_CHECK_DECLARATION([#include <stdlib.h>
1935#ifdef HAVE_UNISTD_H
1936#include <unistd.h>
1937#endif], opterr)
1938AC_CHECK_DECLARATION([#include <stdlib.h>
1939#ifdef HAVE_UNISTD_H
1940#include <unistd.h>
1941#endif], optopt)
1942
1943AC_CHECK_DECLARATION([#include <stdlib.h>], environ)
1944
1945dnl
1946dnl Check for fields in struct tm
1947dnl
1948
1949AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
1950AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
1951
1952dnl
1953dnl or do we have a variable `timezone' ?
1954dnl
1955
1956rk_CHECK_VAR(timezone,[#include <time.h>])
1957
1958AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
1959AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
1960AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
1961AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/socket.h>])
1962AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
1963AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
1964
1965dnl
1966dnl Check for struct winsize
1967dnl
1968
1969AC_KRB_STRUCT_WINSIZE
1970
1971dnl
1972dnl Check for struct spwd
1973dnl
1974
1975AC_KRB_STRUCT_SPWD
1976
1977dnl won't work with automake
1978dnl moved to AC_OUTPUT in configure.in
1979dnl AC_CONFIG_FILES($1/Makefile)
1980
1981LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
1982
1983AC_SUBST(DIR_roken)dnl
1984AC_SUBST(LIB_roken)dnl
1985AC_SUBST(INCLUDES_roken)dnl
1986])
1987dnl $Id: check-type-extra.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
1988dnl
1989dnl ac_check_type + extra headers
1990
1991dnl AC_CHECK_TYPE_EXTRA(TYPE, DEFAULT, HEADERS)
1992AC_DEFUN(AC_CHECK_TYPE_EXTRA,
1993[AC_REQUIRE([AC_HEADER_STDC])dnl
1994AC_MSG_CHECKING(for $1)
1995AC_CACHE_VAL(ac_cv_type_$1,
1996[AC_EGREP_CPP(dnl
1997changequote(<<,>>)dnl
1998<<$1[^a-zA-Z_0-9]>>dnl
1999changequote([,]), [#include <sys/types.h>
2000#if STDC_HEADERS
2001#include <stdlib.h>
2002#include <stddef.h>
2003#endif
2004$3], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
2005AC_MSG_RESULT($ac_cv_type_$1)
2006if test $ac_cv_type_$1 = no; then
2007  AC_DEFINE($1, $2, [Define this to what the type $1 should be.])
2008fi
2009])
2010
2011dnl $Id: have-type.m4,v 1.6 2000/07/15 18:10:00 joda Exp $
2012dnl
2013dnl check for existance of a type
2014
2015dnl AC_HAVE_TYPE(TYPE,INCLUDES)
2016AC_DEFUN(AC_HAVE_TYPE, [
2017AC_REQUIRE([AC_HEADER_STDC])
2018cv=`echo "$1" | sed 'y%./+- %__p__%'`
2019AC_MSG_CHECKING(for $1)
2020AC_CACHE_VAL([ac_cv_type_$cv],
2021AC_TRY_COMPILE(
2022[#include <sys/types.h>
2023#if STDC_HEADERS
2024#include <stdlib.h>
2025#include <stddef.h>
2026#endif
2027$2],
2028[$1 foo;],
2029eval "ac_cv_type_$cv=yes",
2030eval "ac_cv_type_$cv=no"))dnl
2031ac_foo=`eval echo \\$ac_cv_type_$cv`
2032AC_MSG_RESULT($ac_foo)
2033if test "$ac_foo" = yes; then
2034  ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
2035if false; then
2036	AC_CHECK_TYPES($1)
2037fi
2038  AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])
2039fi
2040])
2041
2042dnl
2043dnl $Id: retsigtype.m4,v 1.1 2000/07/15 18:05:56 joda Exp $
2044dnl
2045dnl Figure out return type of signal handlers, and define SIGRETURN macro
2046dnl that can be used to return from one
2047dnl
2048AC_DEFUN(rk_RETSIGTYPE,[
2049AC_TYPE_SIGNAL
2050if test "$ac_cv_type_signal" = "void" ; then
2051	AC_DEFINE(VOID_RETSIGTYPE, 1, [Define if signal handlers return void.])
2052fi
2053AC_SUBST(VOID_RETSIGTYPE)
2054AH_BOTTOM([#ifdef VOID_RETSIGTYPE
2055#define SIGRETURN(x) return
2056#else
2057#define SIGRETURN(x) return (RETSIGTYPE)(x)
2058#endif])
2059])
2060dnl
2061dnl $Id: check-netinet-ip-and-tcp.m4,v 1.3 2000/07/18 10:33:02 joda Exp $
2062dnl
2063
2064dnl extra magic check for netinet/{ip.h,tcp.h} because on irix 6.5.3
2065dnl you have to include standards.h before including these files
2066
2067AC_DEFUN(CHECK_NETINET_IP_AND_TCP,
2068[
2069AC_CHECK_HEADERS(standards.h)
2070for i in netinet/ip.h netinet/tcp.h; do
2071
2072cv=`echo "$i" | sed 'y%./+-%__p_%'`
2073
2074AC_CACHE_CHECK([for $i],ac_cv_header_$cv,
2075[AC_TRY_CPP([\
2076#ifdef HAVE_STANDARDS_H
2077#include <standards.h>
2078#endif
2079#include <$i>
2080],
2081eval "ac_cv_header_$cv=yes",
2082eval "ac_cv_header_$cv=no")])
2083ac_res=`eval echo \\$ac_cv_header_$cv`
2084if test "$ac_res" = yes; then
2085	ac_tr_hdr=HAVE_`echo $i | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
2086	AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
2087fi
2088done
2089if false;then
2090	AC_CHECK_HEADERS(netinet/ip.h netinet/tcp.h)
2091fi
2092])
2093
2094# Define a conditional.
2095
2096AC_DEFUN([AM_CONDITIONAL],
2097[AC_SUBST($1_TRUE)
2098AC_SUBST($1_FALSE)
2099if $2; then
2100  $1_TRUE=
2101  $1_FALSE='#'
2102else
2103  $1_TRUE='#'
2104  $1_FALSE=
2105fi])
2106
2107dnl $Id: krb-ipv6.m4,v 1.10 2001/03/26 03:28:03 assar Exp $
2108dnl
2109dnl test for IPv6
2110dnl
2111AC_DEFUN(AC_KRB_IPV6, [
2112AC_ARG_WITH(ipv6,
2113[  --without-ipv6	do not enable IPv6 support],[
2114if test "$withval" = "no"; then
2115	ac_cv_lib_ipv6=no
2116fi])
2117save_CFLAGS="${CFLAGS}"
2118AC_CACHE_VAL(ac_cv_lib_ipv6,
2119[dnl check for different v6 implementations (by itojun)
2120v6type=unknown
2121v6lib=none
2122
2123AC_MSG_CHECKING([ipv6 stack type])
2124for i in v6d toshiba kame inria zeta linux; do
2125	case $i in
2126	v6d)
2127		AC_EGREP_CPP(yes, [
2128#include </usr/local/v6/include/sys/types.h>
2129#ifdef __V6D__
2130yes
2131#endif],
2132			[v6type=$i; v6lib=v6;
2133			v6libdir=/usr/local/v6/lib;
2134			CFLAGS="-I/usr/local/v6/include $CFLAGS"])
2135		;;
2136	toshiba)
2137		AC_EGREP_CPP(yes, [
2138#include <sys/param.h>
2139#ifdef _TOSHIBA_INET6
2140yes
2141#endif],
2142			[v6type=$i; v6lib=inet6;
2143			v6libdir=/usr/local/v6/lib;
2144			CFLAGS="-DINET6 $CFLAGS"])
2145		;;
2146	kame)
2147		AC_EGREP_CPP(yes, [
2148#include <netinet/in.h>
2149#ifdef __KAME__
2150yes
2151#endif],
2152			[v6type=$i; v6lib=inet6;
2153			v6libdir=/usr/local/v6/lib;
2154			CFLAGS="-DINET6 $CFLAGS"])
2155		;;
2156	inria)
2157		AC_EGREP_CPP(yes, [
2158#include <netinet/in.h>
2159#ifdef IPV6_INRIA_VERSION
2160yes
2161#endif],
2162			[v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
2163		;;
2164	zeta)
2165		AC_EGREP_CPP(yes, [
2166#include <sys/param.h>
2167#ifdef _ZETA_MINAMI_INET6
2168yes
2169#endif],
2170			[v6type=$i; v6lib=inet6;
2171			v6libdir=/usr/local/v6/lib;
2172			CFLAGS="-DINET6 $CFLAGS"])
2173		;;
2174	linux)
2175		if test -d /usr/inet6; then
2176			v6type=$i
2177			v6lib=inet6
2178			v6libdir=/usr/inet6
2179			CFLAGS="-DINET6 $CFLAGS"
2180		fi
2181		;;
2182	esac
2183	if test "$v6type" != "unknown"; then
2184		break
2185	fi
2186done
2187AC_MSG_RESULT($v6type)
2188
2189if test "$v6lib" != "none"; then
2190	for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
2191		if test -d $dir -a -f $dir/lib$v6lib.a; then
2192			LIBS="-L$dir -l$v6lib $LIBS"
2193			break
2194		fi
2195	done
2196fi
2197AC_TRY_LINK([
2198#ifdef HAVE_SYS_TYPES_H
2199#include <sys/types.h>
2200#endif
2201#ifdef HAVE_SYS_SOCKET_H
2202#include <sys/socket.h>
2203#endif
2204#ifdef HAVE_NETINET_IN_H
2205#include <netinet/in.h>
2206#endif
2207#ifdef HAVE_NETINET_IN6_H
2208#include <netinet/in6.h>
2209#endif
2210],
2211[
2212 struct sockaddr_in6 sin6;
2213 int s;
2214
2215 s = socket(AF_INET6, SOCK_DGRAM, 0);
2216
2217 sin6.sin6_family = AF_INET6;
2218 sin6.sin6_port = htons(17);
2219 sin6.sin6_addr = in6addr_any;
2220 bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
2221],
2222ac_cv_lib_ipv6=yes,
2223ac_cv_lib_ipv6=no)])
2224AC_MSG_CHECKING(for IPv6)
2225AC_MSG_RESULT($ac_cv_lib_ipv6)
2226if test "$ac_cv_lib_ipv6" = yes; then
2227  AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])
2228else
2229  CFLAGS="${save_CFLAGS}"
2230fi
2231])
2232
2233dnl $Id: find-func.m4,v 1.1 1997/12/14 15:58:58 joda Exp $
2234dnl
2235dnl AC_FIND_FUNC(func, libraries, includes, arguments)
2236AC_DEFUN(AC_FIND_FUNC, [
2237AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4])
2238if test -n "$LIB_$1"; then
2239	LIBS="$LIB_$1 $LIBS"
2240fi
2241])
2242
2243dnl $Id: broken-snprintf.m4,v 1.3 1999/03/01 09:52:22 joda Exp $
2244dnl
2245AC_DEFUN(AC_BROKEN_SNPRINTF, [
2246AC_CACHE_CHECK(for working snprintf,ac_cv_func_snprintf_working,
2247ac_cv_func_snprintf_working=yes
2248AC_TRY_RUN([
2249#include <stdio.h>
2250#include <string.h>
2251int main()
2252{
2253changequote(`,')dnl
2254	char foo[3];
2255changequote([,])dnl
2256	snprintf(foo, 2, "12");
2257	return strcmp(foo, "1");
2258}],:,ac_cv_func_snprintf_working=no,:))
2259
2260if test "$ac_cv_func_snprintf_working" = yes; then
2261	AC_DEFINE_UNQUOTED(HAVE_SNPRINTF, 1, [define if you have a working snprintf])
2262fi
2263if test "$ac_cv_func_snprintf_working" = yes; then
2264AC_NEED_PROTO([#include <stdio.h>],snprintf)
2265fi
2266])
2267
2268AC_DEFUN(AC_BROKEN_VSNPRINTF,[
2269AC_CACHE_CHECK(for working vsnprintf,ac_cv_func_vsnprintf_working,
2270ac_cv_func_vsnprintf_working=yes
2271AC_TRY_RUN([
2272#include <stdio.h>
2273#include <string.h>
2274#include <stdarg.h>
2275
2276int foo(int num, ...)
2277{
2278changequote(`,')dnl
2279	char bar[3];
2280changequote([,])dnl
2281	va_list arg;
2282	va_start(arg, num);
2283	vsnprintf(bar, 2, "%s", arg);
2284	va_end(arg);
2285	return strcmp(bar, "1");
2286}
2287
2288
2289int main()
2290{
2291	return foo(0, "12");
2292}],:,ac_cv_func_vsnprintf_working=no,:))
2293
2294if test "$ac_cv_func_vsnprintf_working" = yes; then
2295	AC_DEFINE_UNQUOTED(HAVE_VSNPRINTF, 1, [define if you have a working vsnprintf])
2296fi
2297if test "$ac_cv_func_vsnprintf_working" = yes; then
2298AC_NEED_PROTO([#include <stdio.h>],vsnprintf)
2299fi
2300])
2301
2302dnl $Id: need-proto.m4,v 1.2 1999/03/01 09:52:24 joda Exp $
2303dnl
2304dnl
2305dnl Check if we need the prototype for a function
2306dnl
2307
2308dnl AC_NEED_PROTO(includes, function)
2309
2310AC_DEFUN(AC_NEED_PROTO, [
2311if test "$ac_cv_func_$2+set" != set -o "$ac_cv_func_$2" = yes; then
2312AC_CACHE_CHECK([if $2 needs a prototype], ac_cv_func_$2_noproto,
2313AC_TRY_COMPILE([$1],
2314[struct foo { int foo; } xx;
2315extern int $2 (struct foo*);
2316$2(&xx);
2317],
2318eval "ac_cv_func_$2_noproto=yes",
2319eval "ac_cv_func_$2_noproto=no"))
2320define([foo], [NEED_]translit($2, [a-z], [A-Z])[_PROTO])
2321if test "$ac_cv_func_$2_noproto" = yes; then
2322	AC_DEFINE(foo, 1, [define if the system is missing a prototype for $2()])
2323fi
2324undefine([foo])
2325fi
2326])
2327
2328dnl $Id: broken-glob.m4,v 1.3 2001/03/26 11:40:24 assar Exp $
2329dnl
2330dnl check for glob(3)
2331dnl
2332AC_DEFUN(AC_BROKEN_GLOB,[
2333AC_CACHE_CHECK(for working glob, ac_cv_func_glob_working,
2334ac_cv_func_glob_working=yes
2335AC_TRY_LINK([
2336#include <stdio.h>
2337#include <glob.h>],[
2338glob(NULL, GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE|GLOB_LIMIT,
2339NULL, NULL);
2340],:,ac_cv_func_glob_working=no,:))
2341
2342if test "$ac_cv_func_glob_working" = yes; then
2343	AC_DEFINE(HAVE_GLOB, 1, [define if you have a glob() that groks 
2344	GLOB_BRACE, GLOB_NOCHECK, GLOB_QUOTE, GLOB_TILDE, and GLOB_LIMIT])
2345fi
2346if test "$ac_cv_func_glob_working" = yes; then
2347AC_NEED_PROTO([#include <stdio.h>
2348#include <glob.h>],glob)
2349fi
2350])
2351
2352dnl
2353dnl $Id: krb-func-getlogin.m4,v 1.1 1999/07/13 17:45:30 assar Exp $
2354dnl
2355dnl test for POSIX (broken) getlogin
2356dnl
2357
2358
2359AC_DEFUN(AC_FUNC_GETLOGIN, [
2360AC_CHECK_FUNCS(getlogin setlogin)
2361if test "$ac_cv_func_getlogin" = yes; then
2362AC_CACHE_CHECK(if getlogin is posix, ac_cv_func_getlogin_posix, [
2363if test "$ac_cv_func_getlogin" = yes -a "$ac_cv_func_setlogin" = yes; then
2364	ac_cv_func_getlogin_posix=no
2365else
2366	ac_cv_func_getlogin_posix=yes
2367fi
2368])
2369if test "$ac_cv_func_getlogin_posix" = yes; then
2370	AC_DEFINE(POSIX_GETLOGIN, 1, [Define if getlogin has POSIX flavour (and not BSD).])
2371fi
2372fi
2373])
2374
2375dnl $Id: find-if-not-broken.m4,v 1.2 1998/03/16 22:16:27 joda Exp $
2376dnl
2377dnl
2378dnl Mix between AC_FIND_FUNC and AC_BROKEN
2379dnl
2380
2381AC_DEFUN(AC_FIND_IF_NOT_BROKEN,
2382[AC_FIND_FUNC([$1], [$2], [$3], [$4])
2383if eval "test \"$ac_cv_func_$1\" != yes"; then
2384LIBOBJS[]="$LIBOBJS $1.o"
2385fi
2386AC_SUBST(LIBOBJS)dnl
2387])
2388
2389dnl $Id: broken.m4,v 1.4 2000/07/15 18:06:36 joda Exp $
2390dnl
2391dnl
2392dnl Same as AC _REPLACE_FUNCS, just define HAVE_func if found in normal
2393dnl libraries 
2394
2395AC_DEFUN(AC_BROKEN,
2396[for ac_func in $1
2397do
2398AC_CHECK_FUNC($ac_func, [
2399ac_tr_func=HAVE_[]upcase($ac_func)
2400AC_DEFINE_UNQUOTED($ac_tr_func)],[LIBOBJS[]="$LIBOBJS ${ac_func}.o"])
2401if false; then
2402	AC_CHECK_FUNCS($1)
2403fi
2404done
2405AC_SUBST(LIBOBJS)dnl
2406])
2407
2408dnl $Id: broken2.m4,v 1.1 2000/12/15 14:27:33 assar Exp $
2409dnl
2410dnl AC_BROKEN but with more arguments
2411
2412dnl AC_BROKEN2(func, includes, arguments)
2413AC_DEFUN(AC_BROKEN2,
2414[for ac_func in $1
2415do
2416AC_MSG_CHECKING([for $ac_func])
2417AC_CACHE_VAL(ac_cv_func_$ac_func,
2418[AC_TRY_LINK([$2],
2419[
2420/* The GNU C library defines this for functions which it implements
2421    to always fail with ENOSYS.  Some functions are actually named
2422    something starting with __ and the normal name is an alias.  */
2423#if defined (__stub_$1) || defined (__stub___$1)
2424choke me
2425#else
2426$ac_func($3)
2427#endif
2428], [eval "ac_cv_func_$ac_func=yes"], [eval "ac_cv_func_$ac_func=no"])])
2429if eval "test \"\${ac_cv_func_$ac_func}\" = yes"; then
2430  ac_tr_func=HAVE_[]upcase($ac_func)
2431  AC_DEFINE_UNQUOTED($ac_tr_func)
2432  AC_MSG_RESULT(yes)
2433else
2434  AC_MSG_RESULT(no)
2435  LIBOBJS[]="$LIBOBJS ${ac_func}.o"
2436fi
2437done
2438if false; then
2439	AC_CHECK_FUNCS($1)
2440fi
2441AC_SUBST(LIBOBJS)dnl
2442])
2443
2444dnl $Id: have-struct-field.m4,v 1.6 1999/07/29 01:44:32 assar Exp $
2445dnl
2446dnl check for fields in a structure
2447dnl
2448dnl AC_HAVE_STRUCT_FIELD(struct, field, headers)
2449
2450AC_DEFUN(AC_HAVE_STRUCT_FIELD, [
2451define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_]))
2452AC_CACHE_CHECK([for $2 in $1], cache_val,[
2453AC_TRY_COMPILE([$3],[$1 x; x.$2;],
2454cache_val=yes,
2455cache_val=no)])
2456if test "$cache_val" = yes; then
2457	define(foo, translit(HAVE_$1_$2, [a-z ], [A-Z_]))
2458	AC_DEFINE(foo, 1, [Define if $1 has field $2.])
2459	undefine([foo])
2460fi
2461undefine([cache_val])
2462])
2463
2464dnl $Id: broken-getnameinfo.m4,v 1.2 2000/12/05 09:09:00 joda Exp $
2465dnl
2466dnl test for broken AIX getnameinfo
2467
2468AC_DEFUN(rk_BROKEN_GETNAMEINFO,[
2469AC_CACHE_CHECK([if getnameinfo is broken], ac_cv_func_getnameinfo_broken,
2470AC_TRY_RUN([[#include <stdio.h>
2471#include <sys/types.h>
2472#include <sys/socket.h>
2473#include <netinet/in.h>
2474#include <netdb.h>
2475
2476int
2477main(int argc, char **argv)
2478{
2479  struct sockaddr_in sin;
2480  char host[256];
2481  memset(&sin, 0, sizeof(sin));
2482#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
2483  sin.sin_len = sizeof(sin);
2484#endif
2485  sin.sin_family = AF_INET;
2486  sin.sin_addr.s_addr = 0xffffffff;
2487  sin.sin_port = 0;
2488  return getnameinfo((struct sockaddr*)&sin, sizeof(sin), host, sizeof(host),
2489	      NULL, 0, 0);
2490}
2491]], ac_cv_func_getnameinfo_broken=no, ac_cv_func_getnameinfo_broken=yes))])
2492
2493dnl
2494dnl $Id: broken-realloc.m4,v 1.1 2000/07/15 18:05:36 joda Exp $
2495dnl
2496dnl Test for realloc that doesn't handle NULL as first parameter
2497dnl
2498AC_DEFUN(rk_BROKEN_REALLOC, [
2499AC_CACHE_CHECK(if realloc if broken, ac_cv_func_realloc_broken, [
2500ac_cv_func_realloc_broken=no
2501AC_TRY_RUN([
2502#include <stddef.h>
2503#include <stdlib.h>
2504
2505int main()
2506{
2507	return realloc(NULL, 17) == NULL;
2508}
2509],:, ac_cv_func_realloc_broken=yes, :)
2510])
2511if test "$ac_cv_func_realloc_broken" = yes ; then
2512	AC_DEFINE(BROKEN_REALLOC, 1, [Define if realloc(NULL) doesn't work.])
2513fi
2514AH_BOTTOM([#ifdef BROKEN_REALLOC
2515#define realloc(X, Y) isoc_realloc((X), (Y))
2516#define isoc_realloc(X, Y) ((X) ? realloc((X), (Y)) : malloc(Y))
2517#endif])
2518])
2519
2520dnl $Id: proto-compat.m4,v 1.3 1999/03/01 13:03:48 joda Exp $
2521dnl
2522dnl
2523dnl Check if the prototype of a function is compatible with another one
2524dnl
2525
2526dnl AC_PROTO_COMPAT(includes, function, prototype)
2527
2528AC_DEFUN(AC_PROTO_COMPAT, [
2529AC_CACHE_CHECK([if $2 is compatible with system prototype],
2530ac_cv_func_$2_proto_compat,
2531AC_TRY_COMPILE([$1],
2532[$3;],
2533eval "ac_cv_func_$2_proto_compat=yes",
2534eval "ac_cv_func_$2_proto_compat=no"))
2535define([foo], translit($2, [a-z], [A-Z])[_PROTO_COMPATIBLE])
2536if test "$ac_cv_func_$2_proto_compat" = yes; then
2537	AC_DEFINE(foo, 1, [define if prototype of $2 is compatible with
2538	$3])
2539fi
2540undefine([foo])
2541])
2542dnl $Id: check-var.m4,v 1.5 2000/12/15 04:54:06 assar Exp $
2543dnl
2544dnl rk_CHECK_VAR(variable, includes)
2545AC_DEFUN([rk_CHECK_VAR], [
2546AC_MSG_CHECKING(for $1)
2547AC_CACHE_VAL(ac_cv_var_$1, [
2548AC_TRY_LINK([extern int $1;
2549int foo() { return $1; }],
2550	    [foo()],
2551	    ac_cv_var_$1=yes, ac_cv_var_$1=no)
2552])
2553ac_foo=`eval echo \\$ac_cv_var_$1`
2554AC_MSG_RESULT($ac_foo)
2555if test "$ac_foo" = yes; then
2556	AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]$1), 1, 
2557		[Define if you have the `]$1[' variable.])
2558	m4_ifval([$2], AC_CHECK_DECLARATION([$2],[$1]))
2559fi
2560])
2561
2562AC_WARNING_ENABLE([obsolete])
2563AU_DEFUN([AC_CHECK_VAR], [rk_CHECK_VAR([$2], [$1])], [foo])
2564dnl $Id: check-declaration.m4,v 1.3 1999/03/01 13:03:08 joda Exp $
2565dnl
2566dnl
2567dnl Check if we need the declaration of a variable
2568dnl
2569
2570dnl AC_HAVE_DECLARATION(includes, variable)
2571AC_DEFUN(AC_CHECK_DECLARATION, [
2572AC_MSG_CHECKING([if $2 is properly declared])
2573AC_CACHE_VAL(ac_cv_var_$2_declaration, [
2574AC_TRY_COMPILE([$1
2575extern struct { int foo; } $2;],
2576[$2.foo = 1;],
2577eval "ac_cv_var_$2_declaration=no",
2578eval "ac_cv_var_$2_declaration=yes")
2579])
2580
2581define(foo, [HAVE_]translit($2, [a-z], [A-Z])[_DECLARATION])
2582
2583AC_MSG_RESULT($ac_cv_var_$2_declaration)
2584if eval "test \"\$ac_cv_var_$2_declaration\" = yes"; then
2585	AC_DEFINE(foo, 1, [define if your system declares $2])
2586fi
2587undefine([foo])
2588])
2589
2590dnl $Id: krb-struct-winsize.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
2591dnl
2592dnl
2593dnl Search for struct winsize
2594dnl
2595
2596AC_DEFUN(AC_KRB_STRUCT_WINSIZE, [
2597AC_MSG_CHECKING(for struct winsize)
2598AC_CACHE_VAL(ac_cv_struct_winsize, [
2599ac_cv_struct_winsize=no
2600for i in sys/termios.h sys/ioctl.h; do
2601AC_EGREP_HEADER(
2602changequote(, )dnl
2603struct[ 	]*winsize,dnl
2604changequote([,])dnl
2605$i, ac_cv_struct_winsize=yes; break)dnl
2606done
2607])
2608if test "$ac_cv_struct_winsize" = "yes"; then
2609  AC_DEFINE(HAVE_STRUCT_WINSIZE, 1, [define if struct winsize is declared in sys/termios.h])
2610fi
2611AC_MSG_RESULT($ac_cv_struct_winsize)
2612AC_EGREP_HEADER(ws_xpixel, termios.h, 
2613	AC_DEFINE(HAVE_WS_XPIXEL, 1, [define if struct winsize has ws_xpixel]))
2614AC_EGREP_HEADER(ws_ypixel, termios.h, 
2615	AC_DEFINE(HAVE_WS_YPIXEL, 1, [define if struct winsize has ws_ypixel]))
2616])
2617
2618dnl $Id: krb-struct-spwd.m4,v 1.3 1999/07/13 21:04:11 assar Exp $
2619dnl
2620dnl Test for `struct spwd'
2621
2622AC_DEFUN(AC_KRB_STRUCT_SPWD, [
2623AC_MSG_CHECKING(for struct spwd)
2624AC_CACHE_VAL(ac_cv_struct_spwd, [
2625AC_TRY_COMPILE(
2626[#include <pwd.h>
2627#ifdef HAVE_SHADOW_H
2628#include <shadow.h>
2629#endif],
2630[struct spwd foo;],
2631ac_cv_struct_spwd=yes,
2632ac_cv_struct_spwd=no)
2633])
2634AC_MSG_RESULT($ac_cv_struct_spwd)
2635
2636if test "$ac_cv_struct_spwd" = "yes"; then
2637  AC_DEFINE(HAVE_STRUCT_SPWD, 1, [define if you have struct spwd])
2638fi
2639])
2640
2641dnl $Id: test-package.m4,v 1.9 2000/12/15 04:54:24 assar Exp $
2642dnl
2643dnl AC_TEST_PACKAGE_NEW(package,headers,libraries,extra libs,default locations, conditional)
2644
2645AC_DEFUN(AC_TEST_PACKAGE,[AC_TEST_PACKAGE_NEW($1,[#include <$2>],$4,,$5)])
2646
2647AC_DEFUN(AC_TEST_PACKAGE_NEW,[
2648AC_ARG_WITH($1,
2649[  --with-$1=dir                use $1 in dir])
2650AC_ARG_WITH($1-lib,
2651[  --with-$1-lib=dir            use $1 libraries in dir],
2652[if test "$withval" = "yes" -o "$withval" = "no"; then
2653  AC_MSG_ERROR([No argument for --with-$1-lib])
2654elif test "X$with_$1" = "X"; then
2655  with_$1=yes
2656fi])
2657AC_ARG_WITH($1-include,
2658[  --with-$1-include=dir        use $1 headers in dir],
2659[if test "$withval" = "yes" -o "$withval" = "no"; then
2660  AC_MSG_ERROR([No argument for --with-$1-include])
2661elif test "X$with_$1" = "X"; then
2662  with_$1=yes
2663fi])
2664
2665AC_MSG_CHECKING(for $1)
2666
2667case "$with_$1" in
2668yes)	;;
2669no)	;;
2670"")	;;
2671*)	if test "$with_$1_include" = ""; then
2672		with_$1_include="$with_$1/include"
2673	fi
2674	if test "$with_$1_lib" = ""; then
2675		with_$1_lib="$with_$1/lib$abilibdirext"
2676	fi
2677	;;
2678esac
2679header_dirs=
2680lib_dirs=
2681d='$5'
2682for i in $d; do
2683	header_dirs="$header_dirs $i/include"
2684	lib_dirs="$lib_dirs $i/lib$abilibdirext"
2685done
2686
2687case "$with_$1_include" in
2688yes) ;;
2689no)  ;;
2690*)   header_dirs="$with_$1_include $header_dirs";;
2691esac
2692case "$with_$1_lib" in
2693yes) ;;
2694no)  ;;
2695*)   lib_dirs="$with_$1_lib $lib_dirs";;
2696esac
2697
2698save_CFLAGS="$CFLAGS"
2699save_LIBS="$LIBS"
2700ires= lres=
2701for i in $header_dirs; do
2702	CFLAGS="-I$i $save_CFLAGS"
2703	AC_TRY_COMPILE([$2],,ires=$i;break)
2704done
2705for i in $lib_dirs; do
2706	LIBS="-L$i $3 $4 $save_LIBS"
2707	AC_TRY_LINK([$2],,lres=$i;break)
2708done
2709CFLAGS="$save_CFLAGS"
2710LIBS="$save_LIBS"
2711
2712if test "$ires" -a "$lres" -a "$with_$1" != "no"; then
2713	$1_includedir="$ires"
2714	$1_libdir="$lres"
2715	INCLUDE_$1="-I$$1_includedir"
2716	LIB_$1="-L$$1_libdir $3"
2717	m4_ifval([$6],
2718		AC_DEFINE_UNQUOTED($6,1,[Define if you have the $1 package.]),
2719		AC_DEFINE_UNQUOTED(upcase($1),1,[Define if you have the $1 package.]))
2720	with_$1=yes
2721	AC_MSG_RESULT([headers $ires, libraries $lres])
2722else
2723	INCLUDE_$1=
2724	LIB_$1=
2725	with_$1=no
2726	AC_MSG_RESULT($with_$1)
2727fi
2728dnl m4_ifval([$6],
2729dnl 	AM_CONDITIONAL($6, test "$with_$1" = yes)
2730dnl 	AM_CONDITIONAL(upcase($1), test "$with_$1" = yes))
2731AC_SUBST(INCLUDE_$1)
2732AC_SUBST(LIB_$1)
2733])
2734
2735dnl $Id: osfc2.m4,v 1.2 1999/03/27 17:28:16 joda Exp $
2736dnl
2737dnl enable OSF C2 stuff
2738
2739AC_DEFUN(AC_CHECK_OSFC2,[
2740AC_ARG_ENABLE(osfc2,
2741[  --enable-osfc2          enable some OSF C2 support])
2742LIB_security=
2743if test "$enable_osfc2" = yes; then
2744	AC_DEFINE(HAVE_OSFC2, 1, [Define to enable basic OSF C2 support.])
2745	LIB_security=-lsecurity
2746fi
2747AC_SUBST(LIB_security)
2748])
2749
2750dnl $Id: check-man.m4,v 1.3 2000/11/30 01:47:17 joda Exp $
2751dnl check how to format manual pages
2752dnl
2753
2754AC_DEFUN(rk_CHECK_MAN,
2755[AC_PATH_PROG(NROFF, nroff)
2756AC_PATH_PROG(GROFF, groff)
2757AC_CACHE_CHECK(how to format man pages,ac_cv_sys_man_format,
2758[cat > conftest.1 << END
2759.Dd January 1, 1970
2760.Dt CONFTEST 1
2761.Sh NAME
2762.Nm conftest
2763.Nd
2764foobar
2765END
2766
2767if test "$NROFF" ; then
2768	for i in "-mdoc" "-mandoc"; do
2769		if "$NROFF" $i conftest.1 2> /dev/null | \
2770			grep Jan > /dev/null 2>&1 ; then
2771			ac_cv_sys_man_format="$NROFF $i"
2772			break
2773		fi
2774	done
2775fi
2776if test "$ac_cv_sys_man_format" = "" -a "$GROFF" ; then
2777	for i in "-mdoc" "-mandoc"; do
2778		if "$GROFF" -Tascii $i conftest.1 2> /dev/null | \
2779			grep Jan > /dev/null 2>&1 ; then
2780			ac_cv_sys_man_format="$GROFF -Tascii $i"
2781			break
2782		fi
2783	done
2784fi
2785if test "$ac_cv_sys_man_format"; then
2786	ac_cv_sys_man_format="$ac_cv_sys_man_format \[$]< > \[$]@"
2787fi
2788])
2789if test "$ac_cv_sys_man_format"; then
2790	CATMAN="$ac_cv_sys_man_format"
2791	AC_SUBST(CATMAN)
2792fi
2793AM_CONDITIONAL(CATMAN, test "$CATMAN")
2794AC_CACHE_CHECK(extension of pre-formatted manual pages,ac_cv_sys_catman_ext,
2795[if grep _suffix /etc/man.conf > /dev/null 2>&1; then
2796	ac_cv_sys_catman_ext=0
2797else
2798	ac_cv_sys_catman_ext=number
2799fi
2800])
2801if test "$ac_cv_sys_catman_ext" = number; then
2802	CATMANEXT='$$section'
2803else
2804	CATMANEXT=0
2805fi
2806AC_SUBST(CATMANEXT)
2807])
2808dnl
2809dnl $Id: krb-bigendian.m4,v 1.6 2000/08/19 15:37:00 assar Exp $
2810dnl
2811
2812dnl check if this computer is little or big-endian
2813dnl if we can figure it out at compile-time then don't define the cpp symbol
2814dnl otherwise test for it and define it.  also allow options for overriding
2815dnl it when cross-compiling
2816
2817AC_DEFUN(KRB_C_BIGENDIAN, [
2818AC_ARG_ENABLE(bigendian,
2819[  --enable-bigendian	the target is big endian],
2820krb_cv_c_bigendian=yes)
2821AC_ARG_ENABLE(littleendian,
2822[  --enable-littleendian	the target is little endian],
2823krb_cv_c_bigendian=no)
2824AC_CACHE_CHECK(whether byte order is known at compile time,
2825krb_cv_c_bigendian_compile,
2826[AC_TRY_COMPILE([
2827#include <sys/types.h>
2828#include <sys/param.h>],[
2829#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
2830 bogus endian macros
2831#endif], krb_cv_c_bigendian_compile=yes, krb_cv_c_bigendian_compile=no)])
2832AC_CACHE_CHECK(whether byte ordering is bigendian, krb_cv_c_bigendian,[
2833  if test "$krb_cv_c_bigendian_compile" = "yes"; then
2834    AC_TRY_COMPILE([
2835#include <sys/types.h>
2836#include <sys/param.h>],[
2837#if BYTE_ORDER != BIG_ENDIAN
2838  not big endian
2839#endif], krb_cv_c_bigendian=yes, krb_cv_c_bigendian=no)
2840  else
2841    AC_TRY_RUN([main () {
2842      /* Are we little or big endian?  From Harbison&Steele.  */
2843      union
2844      {
2845	long l;
2846	char c[sizeof (long)];
2847    } u;
2848    u.l = 1;
2849    exit (u.c[sizeof (long) - 1] == 1);
2850  }], krb_cv_c_bigendian=no, krb_cv_c_bigendian=yes,
2851  AC_MSG_ERROR([specify either --enable-bigendian or --enable-littleendian]))
2852  fi
2853])
2854if test "$krb_cv_c_bigendian" = "yes"; then
2855  AC_DEFINE(WORDS_BIGENDIAN, 1, [define if target is big endian])dnl
2856fi
2857if test "$krb_cv_c_bigendian_compile" = "yes"; then
2858  AC_DEFINE(ENDIANESS_IN_SYS_PARAM_H, 1, [define if sys/param.h defines the endiness])dnl
2859fi
2860])
2861
2862dnl
2863dnl $Id: aix.m4,v 1.5 2000/11/05 17:15:46 joda Exp $
2864dnl
2865
2866AC_DEFUN(KRB_AIX,[
2867aix=no
2868case "$host" in 
2869*-*-aix3*)
2870	aix=3
2871	;;
2872*-*-aix4*)
2873	aix=4
2874	;;
2875esac
2876AM_CONDITIONAL(AIX, test "$aix" != no)dnl
2877AM_CONDITIONAL(AIX4, test "$aix" = 4)
2878aix_dynamic_afs=yes
2879AM_CONDITIONAL(AIX_DYNAMIC_AFS, test "$aix_dynamic_afs" = yes)dnl
2880
2881AC_FIND_FUNC_NO_LIBS(dlopen, dl)
2882
2883if test "$aix" != no; then
2884	if test "$aix_dynamic_afs" = yes; then
2885		if test "$ac_cv_funclib_dlopen" = yes; then
2886			AIX_EXTRA_KAFS=
2887		elif test "$ac_cv_funclib_dlopen" != no; then
2888			AIX_EXTRA_KAFS="$ac_cv_funclib_dlopen"
2889		else
2890			AIX_EXTRA_KAFS=-lld
2891		fi
2892	else
2893		AIX_EXTRA_KAFS=
2894	fi
2895fi
2896
2897AM_CONDITIONAL(HAVE_DLOPEN, test "$ac_cv_funclib_dlopen" != no)dnl
2898AC_SUBST(AIX_EXTRA_KAFS)dnl
2899
2900])
2901dnl
2902dnl $Id: krb-irix.m4,v 1.2 2000/12/13 12:48:45 assar Exp $
2903dnl
2904
2905dnl requires AC_CANONICAL_HOST
2906AC_DEFUN(KRB_IRIX,[
2907irix=no
2908case "$host_os" in
2909irix*) irix=yes ;;
2910esac
2911AM_CONDITIONAL(IRIX, test "$irix" != no)dnl
2912])
2913
2914dnl 
2915dnl See if there is any X11 present
2916dnl
2917dnl $Id: check-x.m4,v 1.2 1999/11/05 04:25:23 assar Exp $
2918
2919AC_DEFUN(KRB_CHECK_X,[
2920AC_PATH_XTRA
2921
2922# try to figure out if we need any additional ld flags, like -R
2923# and yes, the autoconf X test is utterly broken
2924if test "$no_x" != yes; then
2925	AC_CACHE_CHECK(for special X linker flags,krb_cv_sys_x_libs_rpath,[
2926	ac_save_libs="$LIBS"
2927	ac_save_cflags="$CFLAGS"
2928	CFLAGS="$CFLAGS $X_CFLAGS"
2929	krb_cv_sys_x_libs_rpath=""
2930	krb_cv_sys_x_libs=""
2931	for rflag in "" "-R" "-R " "-rpath "; do
2932		if test "$rflag" = ""; then
2933			foo="$X_LIBS"
2934		else
2935			foo=""
2936			for flag in $X_LIBS; do
2937			case $flag in
2938			-L*)
2939				foo="$foo $flag `echo $flag | sed \"s/-L/$rflag/\"`"
2940				;;
2941			*)
2942				foo="$foo $flag"
2943				;;
2944			esac
2945			done
2946		fi
2947		LIBS="$ac_save_libs $foo $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
2948		AC_TRY_RUN([
2949		#include <X11/Xlib.h>
2950		foo()
2951		{
2952		XOpenDisplay(NULL);
2953		}
2954		main()
2955		{
2956		return 0;
2957		}
2958		], krb_cv_sys_x_libs_rpath="$rflag"; krb_cv_sys_x_libs="$foo"; break,:)
2959	done
2960	LIBS="$ac_save_libs"
2961	CFLAGS="$ac_save_cflags"
2962	])
2963	X_LIBS="$krb_cv_sys_x_libs"
2964fi
2965])
2966
2967dnl $Id: check-xau.m4,v 1.3 1999/05/14 01:17:06 assar Exp $
2968dnl
2969dnl check for Xau{Read,Write}Auth and XauFileName
2970dnl
2971AC_DEFUN(AC_CHECK_XAU,[
2972save_CFLAGS="$CFLAGS"
2973CFLAGS="$X_CFLAGS $CFLAGS"
2974save_LIBS="$LIBS"
2975dnl LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
2976LIBS="$X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
2977save_LDFLAGS="$LDFLAGS"
2978LDFLAGS="$LDFLAGS $X_LIBS"
2979
2980
2981AC_FIND_FUNC_NO_LIBS(XauWriteAuth, X11 Xau)
2982ac_xxx="$LIBS"
2983LIBS="$LIB_XauWriteAuth $LIBS"
2984AC_FIND_FUNC_NO_LIBS(XauReadAuth, X11 Xau)
2985LIBS="$LIB_XauReadAauth $LIBS"
2986AC_FIND_FUNC_NO_LIBS(XauFileName, X11 Xau)
2987LIBS="$ac_xxx"
2988
2989case "$ac_cv_funclib_XauWriteAuth" in
2990yes)	;;
2991no)	;;
2992*)	if test "$ac_cv_funclib_XauReadAuth" = yes; then
2993		if test "$ac_cv_funclib_XauFileName" = yes; then
2994			LIB_XauReadAuth="$LIB_XauWriteAuth"
2995		else
2996			LIB_XauReadAuth="$LIB_XauWriteAuth $LIB_XauFileName"
2997		fi
2998	else
2999		if test "$ac_cv_funclib_XauFileName" = yes; then
3000			LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth"
3001		else
3002			LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth $LIB_XauFileName"
3003		fi
3004	fi
3005	;;
3006esac
3007
3008if test "$AUTOMAKE" != ""; then
3009	AM_CONDITIONAL(NEED_WRITEAUTH, test "$ac_cv_func_XauWriteAuth" != "yes")
3010else
3011	AC_SUBST(NEED_WRITEAUTH_TRUE)
3012	AC_SUBST(NEED_WRITEAUTH_FALSE)
3013	if test "$ac_cv_func_XauWriteAuth" != "yes"; then
3014		NEED_WRITEAUTH_TRUE=
3015		NEED_WRITEAUTH_FALSE='#'
3016	else
3017		NEED_WRITEAUTH_TRUE='#'
3018		NEED_WRITEAUTH_FALSE=
3019	fi
3020fi
3021CFLAGS=$save_CFLAGS
3022LIBS=$save_LIBS
3023LDFLAGS=$save_LDFLAGS
3024])
3025
3026dnl
3027dnl $Id: capabilities.m4,v 1.2 1999/09/01 11:02:26 joda Exp $
3028dnl
3029
3030dnl
3031dnl Test SGI capabilities
3032dnl
3033
3034AC_DEFUN(KRB_CAPABILITIES,[
3035
3036AC_CHECK_HEADERS(capability.h sys/capability.h)
3037
3038AC_CHECK_FUNCS(sgi_getcapabilitybyname cap_set_proc)
3039])
3040
3041dnl $Id: check-getpwnam_r-posix.m4,v 1.2 1999/03/23 16:47:31 joda Exp $
3042dnl
3043dnl check for getpwnam_r, and if it's posix or not
3044
3045AC_DEFUN(AC_CHECK_GETPWNAM_R_POSIX,[
3046AC_FIND_FUNC_NO_LIBS(getpwnam_r,c_r)
3047if test "$ac_cv_func_getpwnam_r" = yes; then
3048	AC_CACHE_CHECK(if getpwnam_r is posix,ac_cv_func_getpwnam_r_posix,
3049	ac_libs="$LIBS"
3050	LIBS="$LIBS $LIB_getpwnam_r"
3051	AC_TRY_RUN([
3052#include <pwd.h>
3053int main()
3054{
3055	struct passwd pw, *pwd;
3056	return getpwnam_r("", &pw, NULL, 0, &pwd) < 0;
3057}
3058],ac_cv_func_getpwnam_r_posix=yes,ac_cv_func_getpwnam_r_posix=no,:)
3059LIBS="$ac_libs")
3060if test "$ac_cv_func_getpwnam_r_posix" = yes; then
3061	AC_DEFINE(POSIX_GETPWNAM_R, 1, [Define if getpwnam_r has POSIX flavour.])
3062fi
3063fi
3064])
3065dnl $Id: grok-type.m4,v 1.4 1999/11/29 11:16:48 joda Exp $
3066dnl
3067AC_DEFUN(AC_GROK_TYPE, [
3068AC_CACHE_VAL(ac_cv_type_$1, 
3069AC_TRY_COMPILE([
3070#ifdef HAVE_INTTYPES_H
3071#include <inttypes.h>
3072#endif
3073#ifdef HAVE_SYS_TYPES_H
3074#include <sys/types.h>
3075#endif
3076#ifdef HAVE_SYS_BITYPES_H
3077#include <sys/bitypes.h>
3078#endif
3079#ifdef HAVE_BIND_BITYPES_H
3080#include <bind/bitypes.h>
3081#endif
3082#ifdef HAVE_NETINET_IN6_MACHTYPES_H
3083#include <netinet/in6_machtypes.h>
3084#endif
3085],
3086$i x;
3087,
3088eval ac_cv_type_$1=yes,
3089eval ac_cv_type_$1=no))])
3090
3091AC_DEFUN(AC_GROK_TYPES, [
3092for i in $1; do
3093	AC_MSG_CHECKING(for $i)
3094	AC_GROK_TYPE($i)
3095	eval ac_res=\$ac_cv_type_$i
3096	if test "$ac_res" = yes; then
3097		type=HAVE_[]upcase($i)
3098		AC_DEFINE_UNQUOTED($type)
3099	fi
3100	AC_MSG_RESULT($ac_res)
3101done
3102])
3103
3104dnl $Id: krb-readline.m4,v 1.2 2000/11/15 00:47:08 assar Exp $
3105dnl
3106dnl Tests for readline functions
3107dnl
3108
3109dnl el_init
3110
3111AC_DEFUN(KRB_READLINE,[
3112AC_FIND_FUNC_NO_LIBS(el_init, edit, [], [], [$LIB_tgetent])
3113if test "$ac_cv_func_el_init" = yes ; then
3114	AC_CACHE_CHECK(for four argument el_init, ac_cv_func_el_init_four,[
3115		AC_TRY_COMPILE([#include <stdio.h>
3116			#include <histedit.h>],
3117			[el_init("", NULL, NULL, NULL);],
3118			ac_cv_func_el_init_four=yes,
3119			ac_cv_func_el_init_four=no)])
3120	if test "$ac_cv_func_el_init_four" = yes; then
3121		AC_DEFINE(HAVE_FOUR_VALUED_EL_INIT, 1, [Define if el_init takes four arguments.])
3122	fi
3123fi
3124
3125dnl readline
3126
3127ac_foo=no
3128if test "$with_readline" = yes; then
3129	:
3130elif test "$ac_cv_func_readline" = yes; then
3131	:
3132elif test "$ac_cv_func_el_init" = yes; then
3133	ac_foo=yes
3134	LIB_readline="\$(top_builddir)/lib/editline/libel_compat.la $LIB_el_init"
3135else
3136	LIB_readline='$(top_builddir)/lib/editline/libeditline.la'
3137fi
3138AM_CONDITIONAL(el_compat, test "$ac_foo" = yes)
3139if test "$readline_libdir"; then
3140	LIB_readline="-rpath $readline_libdir $LIB_readline"
3141fi
3142LIB_readline="$LIB_readline \$(LIB_tgetent)"
3143AC_DEFINE(HAVE_READLINE, 1, 
3144	[Define if you have a readline compatible library.])dnl
3145
3146])
3147dnl $Id: auth-modules.m4,v 1.1 1999/03/21 13:48:00 joda Exp $
3148dnl
3149dnl Figure what authentication modules should be built
3150
3151AC_DEFUN(AC_AUTH_MODULES,[
3152AC_MSG_CHECKING(which authentication modules should be built)
3153
3154LIB_AUTH_SUBDIRS=
3155
3156if test "$ac_cv_header_siad_h" = yes; then
3157	LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS sia"
3158fi
3159
3160if test "$ac_cv_header_security_pam_modules_h" = yes -a "$enable_shared" = yes; then
3161	LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS pam"
3162fi
3163
3164case "${host}" in
3165changequote(,)dnl
3166*-*-irix[56]*) LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS afskauthlib" ;;
3167changequote([,])dnl
3168esac
3169
3170AC_MSG_RESULT($LIB_AUTH_SUBDIRS)
3171
3172AC_SUBST(LIB_AUTH_SUBDIRS)dnl
3173])
3174
3175