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