Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / crypto / kerberosIV / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl $Id: acinclude.m4,v 1.2 1999/03/01 13:06:21 joda Exp $
14 dnl
15 dnl Only put things that for some reason can't live in the `cf'
16 dnl directory in this file.
17 dnl
18
19 dnl $xId: misc.m4,v 1.1 1997/12/14 15:59:04 joda Exp $
20 dnl
21 define(upcase,`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
22
23 dnl $Id: krb-prog-ln-s.m4,v 1.1 1997/12/14 15:59:01 joda Exp $
24 dnl
25 dnl
26 dnl Better test for ln -s, ln or cp
27 dnl
28
29 AC_DEFUN(AC_KRB_PROG_LN_S,
30 [AC_MSG_CHECKING(for ln -s or something else)
31 AC_CACHE_VAL(ac_cv_prog_LN_S,
32 [rm -f conftestdata
33 if ln -s X conftestdata 2>/dev/null
34 then
35   rm -f conftestdata
36   ac_cv_prog_LN_S="ln -s"
37 else
38   touch conftestdata1
39   if ln conftestdata1 conftestdata2; then
40     rm -f conftestdata*
41     ac_cv_prog_LN_S=ln
42   else
43     ac_cv_prog_LN_S=cp
44   fi
45 fi])dnl
46 LN_S="$ac_cv_prog_LN_S"
47 AC_MSG_RESULT($ac_cv_prog_LN_S)
48 AC_SUBST(LN_S)dnl
49 ])
50
51
52 dnl $Id: krb-prog-yacc.m4,v 1.1 1997/12/14 15:59:02 joda Exp $
53 dnl
54 dnl
55 dnl We prefer byacc or yacc because they do not use `alloca'
56 dnl
57
58 AC_DEFUN(AC_KRB_PROG_YACC,
59 [AC_CHECK_PROGS(YACC, byacc yacc 'bison -y')])
60
61 dnl $Id: test-package.m4,v 1.7 1999/04/19 13:33:05 assar Exp $
62 dnl
63 dnl AC_TEST_PACKAGE_NEW(package,headers,libraries,extra libs,default locations)
64
65 AC_DEFUN(AC_TEST_PACKAGE,[AC_TEST_PACKAGE_NEW($1,[#include <$2>],$4,,$5)])
66
67 AC_DEFUN(AC_TEST_PACKAGE_NEW,[
68 AC_ARG_WITH($1,
69 [  --with-$1=dir                use $1 in dir])
70 AC_ARG_WITH($1-lib,
71 [  --with-$1-lib=dir            use $1 libraries in dir],
72 [if test "$withval" = "yes" -o "$withval" = "no"; then
73   AC_MSG_ERROR([No argument for --with-$1-lib])
74 elif test "X$with_$1" = "X"; then
75   with_$1=yes
76 fi])
77 AC_ARG_WITH($1-include,
78 [  --with-$1-include=dir        use $1 headers in dir],
79 [if test "$withval" = "yes" -o "$withval" = "no"; then
80   AC_MSG_ERROR([No argument for --with-$1-include])
81 elif test "X$with_$1" = "X"; then
82   with_$1=yes
83 fi])
84
85 AC_MSG_CHECKING(for $1)
86
87 case "$with_$1" in
88 yes)    ;;
89 no)     ;;
90 "")     ;;
91 *)      if test "$with_$1_include" = ""; then
92                 with_$1_include="$with_$1/include"
93         fi
94         if test "$with_$1_lib" = ""; then
95                 with_$1_lib="$with_$1/lib$abilibdirext"
96         fi
97         ;;
98 esac
99 header_dirs=
100 lib_dirs=
101 d='$5'
102 for i in $d; do
103         header_dirs="$header_dirs $i/include"
104         lib_dirs="$lib_dirs $i/lib$abilibdirext"
105 done
106
107 case "$with_$1_include" in
108 yes) ;;
109 no)  ;;
110 *)   header_dirs="$with_$1_include $header_dirs";;
111 esac
112 case "$with_$1_lib" in
113 yes) ;;
114 no)  ;;
115 *)   lib_dirs="$with_$1_lib $lib_dirs";;
116 esac
117
118 save_CFLAGS="$CFLAGS"
119 save_LIBS="$LIBS"
120 ires= lres=
121 for i in $header_dirs; do
122         CFLAGS="-I$i $save_CFLAGS"
123         AC_TRY_COMPILE([$2],,ires=$i;break)
124 done
125 for i in $lib_dirs; do
126         LIBS="-L$i $3 $4 $save_LIBS"
127         AC_TRY_LINK([$2],,lres=$i;break)
128 done
129 CFLAGS="$save_CFLAGS"
130 LIBS="$save_LIBS"
131
132 if test "$ires" -a "$lres" -a "$with_$1" != "no"; then
133         $1_includedir="$ires"
134         $1_libdir="$lres"
135         INCLUDE_$1="-I$$1_includedir"
136         LIB_$1="-L$$1_libdir $3"
137         AC_DEFINE_UNQUOTED(upcase($1),1,[Define if you have the $1 package.])
138         with_$1=yes
139         AC_MSG_RESULT([headers $ires, libraries $lres])
140 else
141         INCLUDE_$1=
142         LIB_$1=
143         with_$1=no
144         AC_MSG_RESULT($with_$1)
145 fi
146 AC_SUBST(INCLUDE_$1)
147 AC_SUBST(LIB_$1)
148 ])
149
150 dnl $Id: osfc2.m4,v 1.2 1999/03/27 17:28:16 joda Exp $
151 dnl
152 dnl enable OSF C2 stuff
153
154 AC_DEFUN(AC_CHECK_OSFC2,[
155 AC_ARG_ENABLE(osfc2,
156 [  --enable-osfc2          enable some OSF C2 support])
157 LIB_security=
158 if test "$enable_osfc2" = yes; then
159         AC_DEFINE(HAVE_OSFC2, 1, [Define to enable basic OSF C2 support.])
160         LIB_security=-lsecurity
161 fi
162 AC_SUBST(LIB_security)
163 ])
164
165 dnl $Id: mips-abi.m4,v 1.4 1998/05/16 20:44:15 joda Exp $
166 dnl
167 dnl
168 dnl Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext to some
169 dnl value.
170
171 AC_DEFUN(AC_MIPS_ABI, [
172 AC_ARG_WITH(mips_abi,
173 [  --with-mips-abi=abi     ABI to use for IRIX (32, n32, or 64)])
174
175 case "$host_os" in
176 irix*)
177 with_mips_abi="${with_mips_abi:-yes}"
178 if test -n "$GCC"; then
179
180 # GCC < 2.8 only supports the O32 ABI. GCC >= 2.8 has a flag to select
181 # which ABI to use, but only supports (as of 2.8.1) the N32 and 64 ABIs.
182 #
183 # Default to N32, but if GCC doesn't grok -mabi=n32, we assume an old
184 # GCC and revert back to O32. The same goes if O32 is asked for - old
185 # GCCs doesn't like the -mabi option, and new GCCs can't output O32.
186 #
187 # Don't you just love *all* the different SGI ABIs?
188
189 case "${with_mips_abi}" in 
190         32|o32) abi='-mabi=32';  abilibdirext=''     ;;
191        n32|yes) abi='-mabi=n32'; abilibdirext='32'  ;;
192         64) abi='-mabi=64';  abilibdirext='64'   ;;
193         no) abi=''; abilibdirext='';;
194          *) AC_ERROR("Invalid ABI specified") ;;
195 esac
196 if test -n "$abi" ; then
197 ac_foo=krb_cv_gcc_`echo $abi | tr =- __`
198 dnl
199 dnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to
200 dnl AC_MSG_RESULT
201 dnl
202 AC_MSG_CHECKING([if $CC supports the $abi option])
203 AC_CACHE_VAL($ac_foo, [
204 save_CFLAGS="$CFLAGS"
205 CFLAGS="$CFLAGS $abi"
206 AC_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no)
207 CFLAGS="$save_CFLAGS"
208 ])
209 ac_res=`eval echo \\\$$ac_foo`
210 AC_MSG_RESULT($ac_res)
211 if test $ac_res = no; then
212 # Try to figure out why that failed...
213 case $abi in
214         -mabi=32) 
215         save_CFLAGS="$CFLAGS"
216         CFLAGS="$CFLAGS -mabi=n32"
217         AC_TRY_COMPILE(,int x;, ac_res=yes, ac_res=no)
218         CLAGS="$save_CFLAGS"
219         if test $ac_res = yes; then
220                 # New GCC
221                 AC_ERROR([$CC does not support the $with_mips_abi ABI])
222         fi
223         # Old GCC
224         abi=''
225         abilibdirext=''
226         ;;
227         -mabi=n32|-mabi=64)
228                 if test $with_mips_abi = yes; then
229                         # Old GCC, default to O32
230                         abi=''
231                         abilibdirext=''
232                 else
233                         # Some broken GCC
234                         AC_ERROR([$CC does not support the $with_mips_abi ABI])
235                 fi
236         ;;
237 esac
238 fi #if test $ac_res = no; then
239 fi #if test -n "$abi" ; then
240 else
241 case "${with_mips_abi}" in
242         32|o32) abi='-32'; abilibdirext=''     ;;
243        n32|yes) abi='-n32'; abilibdirext='32'  ;;
244         64) abi='-64'; abilibdirext='64'   ;;
245         no) abi=''; abilibdirext='';;
246          *) AC_ERROR("Invalid ABI specified") ;;
247 esac
248 fi #if test -n "$GCC"; then
249 ;;
250 esac
251 ])
252
253 dnl
254 dnl $Id: shared-libs.m4,v 1.4.14.3 2000/12/07 18:03:00 bg Exp $
255 dnl
256 dnl Shared library stuff has to be different everywhere
257 dnl
258
259 AC_DEFUN(AC_SHARED_LIBS, [
260
261 dnl Check if we want to use shared libraries
262 AC_ARG_ENABLE(shared,
263 [  --enable-shared         create shared libraries for Kerberos])
264
265 AC_SUBST(CFLAGS)dnl
266 AC_SUBST(LDFLAGS)dnl
267
268 case ${enable_shared} in
269   yes ) enable_shared=yes;;
270   no  ) enable_shared=no;;
271   *   ) enable_shared=no;;
272 esac
273
274 # NOTE: Building shared libraries may not work if you do not use gcc!
275 #
276 # OS            $SHLIBEXT
277 # HP-UX         sl
278 # Linux         so
279 # NetBSD        so
280 # FreeBSD       so
281 # OSF           so
282 # SunOS5        so
283 # SunOS4        so.0.5
284 # Irix          so
285 #
286 # LIBEXT is the extension we should build (.a or $SHLIBEXT)
287 LINK='$(CC)'
288 AC_SUBST(LINK)
289 lib_deps=yes
290 REAL_PICFLAGS="-fpic"
291 LDSHARED='$(CC) $(PICFLAGS) -shared'
292 LIBPREFIX=lib
293 build_symlink_command=@true
294 install_symlink_command=@true
295 install_symlink_command2=@true
296 REAL_SHLIBEXT=so
297 changequote({,})dnl
298 SHLIB_VERSION=`echo $VERSION | sed 's/\([0-9.]*\).*/\1/'`
299 SHLIB_SONAME=`echo $VERSION | sed 's/\([0-9]*\).*/\1/'`
300 changequote([,])dnl
301 case "${host}" in
302 *-*-hpux*)
303         REAL_SHLIBEXT=sl
304         REAL_LD_FLAGS='-Wl,+b$(libdir)'
305         if test -z "$GCC"; then
306                 LDSHARED="ld -b"
307                 REAL_PICFLAGS="+z"
308         fi
309         lib_deps=no
310         ;;
311 *-*-linux*)
312         LDSHARED='$(CC) -shared -Wl,-soname,$(LIBNAME).so.'"${SHLIB_SONAME}"
313         REAL_LD_FLAGS='-Wl,-rpath,$(libdir)'
314         REAL_SHLIBEXT=so.$SHLIB_VERSION
315         build_symlink_command='$(LN_S) -f [$][@] $(LIBNAME).so'
316         install_symlink_command='$(LN_S) -f $(LIB) $(DESTDIR)$(libdir)/$(LIBNAME).so.'"${SHLIB_SONAME}"';$(LN_S) -f $(LIB) $(DESTDIR)$(libdir)/$(LIBNAME).so'
317         install_symlink_command2='$(LN_S) -f $(LIB2) $(DESTDIR)$(libdir)/$(LIBNAME2).so.'"${SHLIB_SONAME}"';$(LN_S) -f $(LIB2) $(DESTDIR)$(libdir)/$(LIBNAME2).so'
318         ;;
319 changequote(,)dnl
320 *-*-freebsd[345]* | *-*-freebsdelf[345]*)
321 changequote([,])dnl
322         REAL_SHLIBEXT=so.$SHLIB_VERSION
323         REAL_LD_FLAGS='-Wl,-R$(libdir)'
324         build_symlink_command='$(LN_S) -f [$][@] $(LIBNAME).so'
325         install_symlink_command='$(LN_S) -f $(LIB) $(DESTDIR)$(libdir)/$(LIBNAME).so'
326         install_symlink_command2='$(LN_S) -f $(LIB2) $(DESTDIR)$(libdir)/$(LIBNAME2).so'
327         ;;
328 *-*-*bsd*)
329         REAL_SHLIBEXT=so.$SHLIB_VERSION
330         LDSHARED='ld -Bshareable'
331         REAL_LD_FLAGS='-Wl,-R$(libdir)'
332         ;;
333 *-*-osf*)
334         REAL_LD_FLAGS='-Wl,-rpath,$(libdir)'
335         REAL_PICFLAGS=
336         LDSHARED='ld -shared -expect_unresolved \*'
337         ;;
338 *-*-solaris2*)
339         LDSHARED='$(CC) -shared -Wl,-h$(LIBNAME).so.'"${SHLIB_SONAME}"
340         REAL_SHLIBEXT=so.$SHLIB_VERSION
341         build_symlink_command='$(LN_S) [$][@] $(LIBNAME).so'
342         install_symlink_command='$(LN_S) $(LIB) $(DESTDIR)$(libdir)/$(LIBNAME).so.'"${SHLIB_SONAME}"';$(LN_S) $(LIB) $(DESTDIR)$(libdir)/$(LIBNAME).so'
343         install_symlink_command2='$(LN_S) $(LIB2) $(DESTDIR)$(libdir)/$(LIBNAME2).so.'"${SHLIB_SONAME}"';$(LN_S) $(LIB2) $(DESTDIR)$(libdir)/$(LIBNAME2).so'
344         REAL_LD_FLAGS='-Wl,-R$(libdir)'
345         if test -z "$GCC"; then
346                 LDSHARED='$(CC) -G -h$(LIBNAME).so.'"${SHLIB_SONAME}"
347                 REAL_PICFLAGS="-Kpic"
348         fi
349         ;;
350 *-fujitsu-uxpv*)
351         REAL_LD_FLAGS='' # really: LD_RUN_PATH=$(libdir) cc -o ...
352         REAL_LINK='LD_RUN_PATH=$(libdir) $(CC)'
353         LDSHARED='$(CC) -G'
354         REAL_PICFLAGS="-Kpic"
355         lib_deps=no # fails in mysterious ways
356         ;;
357 *-*-sunos*)
358         REAL_SHLIBEXT=so.$SHLIB_VERSION
359         REAL_LD_FLAGS='-Wl,-L$(libdir)'
360         lib_deps=no
361         ;;
362 *-*-irix*)
363         libdir="${libdir}${abilibdirext}"
364         REAL_LD_FLAGS="${abi} -Wl,-rpath,\$(libdir)"
365         LD_FLAGS="${abi} -Wl,-rpath,\$(libdir)"
366         LDSHARED="\$(CC) -shared ${abi}"
367         REAL_PICFLAGS=
368         CFLAGS="${abi} ${CFLAGS}"
369         ;;
370 *-*-os2*)
371         LIBPREFIX=
372         EXECSUFFIX='.exe'
373         RANLIB=EMXOMF
374         LD_FLAGS=-Zcrtdll
375         REAL_SHLIBEXT=nobuild
376         ;;
377 *-*-cygwin32*)
378         EXECSUFFIX='.exe'
379         REAL_SHLIBEXT=nobuild
380         ;;
381 *)      REAL_SHLIBEXT=nobuild
382         REAL_PICFLAGS= 
383         ;;
384 esac
385
386 if test "${enable_shared}" != "yes" ; then 
387  PICFLAGS=""
388  SHLIBEXT="nobuild"
389  LIBEXT="a"
390  build_symlink_command=@true
391  install_symlink_command=@true
392  install_symlink_command2=@true
393 else
394  PICFLAGS="$REAL_PICFLAGS"
395  SHLIBEXT="$REAL_SHLIBEXT"
396  LIBEXT="$SHLIBEXT"
397  AC_MSG_CHECKING(whether to use -rpath)
398  case "$libdir" in
399    /lib | /usr/lib | /usr/local/lib)
400      AC_MSG_RESULT(no)
401      REAL_LD_FLAGS=
402      LD_FLAGS=
403      ;;
404    *)
405      LD_FLAGS="$REAL_LD_FLAGS"
406      test "$REAL_LINK" && LINK="$REAL_LINK"
407      AC_MSG_RESULT($LD_FLAGS)
408      ;;
409    esac
410 fi
411
412 if test "$lib_deps" = yes; then
413         lib_deps_yes=""
414         lib_deps_no="# "
415 else
416         lib_deps_yes="# "
417         lib_deps_no=""
418 fi
419 AC_SUBST(lib_deps_yes)
420 AC_SUBST(lib_deps_no)
421
422 # use supplied ld-flags, or none if `no'
423 if test "$with_ld_flags" = no; then
424         LD_FLAGS=
425 elif test -n "$with_ld_flags"; then
426         LD_FLAGS="$with_ld_flags"
427 fi
428
429 AC_SUBST(REAL_PICFLAGS) dnl
430 AC_SUBST(REAL_SHLIBEXT) dnl
431 AC_SUBST(REAL_LD_FLAGS) dnl
432
433 AC_SUBST(PICFLAGS) dnl
434 AC_SUBST(SHLIBEXT) dnl
435 AC_SUBST(LDSHARED) dnl
436 AC_SUBST(LD_FLAGS) dnl
437 AC_SUBST(LIBEXT) dnl
438 AC_SUBST(LIBPREFIX) dnl
439 AC_SUBST(EXECSUFFIX) dnl
440
441 AC_SUBST(build_symlink_command)dnl
442 AC_SUBST(install_symlink_command)dnl
443 AC_SUBST(install_symlink_command2)dnl
444 ])
445
446 dnl
447 dnl $Id: c-attribute.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
448 dnl
449
450 dnl
451 dnl Test for __attribute__
452 dnl
453
454 AC_DEFUN(AC_C___ATTRIBUTE__, [
455 AC_MSG_CHECKING(for __attribute__)
456 AC_CACHE_VAL(ac_cv___attribute__, [
457 AC_TRY_COMPILE([
458 #include <stdlib.h>
459 ],
460 [
461 static void foo(void) __attribute__ ((noreturn));
462
463 static void
464 foo(void)
465 {
466   exit(1);
467 }
468 ],
469 ac_cv___attribute__=yes,
470 ac_cv___attribute__=no)])
471 if test "$ac_cv___attribute__" = "yes"; then
472   AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
473 fi
474 AC_MSG_RESULT($ac_cv___attribute__)
475 ])
476
477
478 dnl $Id: krb-sys-nextstep.m4,v 1.2 1998/06/03 23:48:40 joda Exp $
479 dnl
480 dnl
481 dnl NEXTSTEP is not posix compliant by default,
482 dnl you need a switch -posix to the compiler
483 dnl
484
485 AC_DEFUN(AC_KRB_SYS_NEXTSTEP, [
486 AC_MSG_CHECKING(for NEXTSTEP)
487 AC_CACHE_VAL(krb_cv_sys_nextstep,
488 AC_EGREP_CPP(yes, 
489 [#if defined(NeXT) && !defined(__APPLE__)
490         yes
491 #endif 
492 ], krb_cv_sys_nextstep=yes, krb_cv_sys_nextstep=no) )
493 if test "$krb_cv_sys_nextstep" = "yes"; then
494   CFLAGS="$CFLAGS -posix"
495   LIBS="$LIBS -posix"
496 fi
497 AC_MSG_RESULT($krb_cv_sys_nextstep)
498 ])
499
500 dnl $Id: krb-sys-aix.m4,v 1.1 1997/12/14 15:59:02 joda Exp $
501 dnl
502 dnl
503 dnl AIX have a very different syscall convention
504 dnl
505 AC_DEFUN(AC_KRB_SYS_AIX, [
506 AC_MSG_CHECKING(for AIX)
507 AC_CACHE_VAL(krb_cv_sys_aix,
508 AC_EGREP_CPP(yes, 
509 [#ifdef _AIX
510         yes
511 #endif 
512 ], krb_cv_sys_aix=yes, krb_cv_sys_aix=no) )
513 AC_MSG_RESULT($krb_cv_sys_aix)
514 ])
515
516 dnl $Id: find-func-no-libs.m4,v 1.5 1999/10/30 21:08:18 assar Exp $
517 dnl
518 dnl
519 dnl Look for function in any of the specified libraries
520 dnl
521
522 dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments, extra libs, extra args)
523 AC_DEFUN(AC_FIND_FUNC_NO_LIBS, [
524 AC_FIND_FUNC_NO_LIBS2([$1], ["" $2], [$3], [$4], [$5], [$6])])
525
526 dnl $Id: find-func-no-libs2.m4,v 1.3 1999/10/30 21:09:53 assar Exp $
527 dnl
528 dnl
529 dnl Look for function in any of the specified libraries
530 dnl
531
532 dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args)
533 AC_DEFUN(AC_FIND_FUNC_NO_LIBS2, [
534
535 AC_MSG_CHECKING([for $1])
536 AC_CACHE_VAL(ac_cv_funclib_$1,
537 [
538 if eval "test \"\$ac_cv_func_$1\" != yes" ; then
539         ac_save_LIBS="$LIBS"
540         for ac_lib in $2; do
541                 if test -n "$ac_lib"; then 
542                         ac_lib="-l$ac_lib"
543                 else
544                         ac_lib=""
545                 fi
546                 LIBS="$6 $ac_lib $5 $ac_save_LIBS"
547                 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)
548         done
549         eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}"
550         LIBS="$ac_save_LIBS"
551 fi
552 ])
553
554 eval "ac_res=\$ac_cv_funclib_$1"
555
556 dnl autoheader tricks *sigh*
557 : << END
558 @@@funcs="$funcs $1"@@@
559 @@@libs="$libs $2"@@@
560 END
561
562 # $1
563 eval "ac_tr_func=HAVE_[]upcase($1)"
564 eval "ac_tr_lib=HAVE_LIB[]upcase($ac_res | sed -e 's/-l//')"
565 eval "LIB_$1=$ac_res"
566
567 case "$ac_res" in
568         yes)
569         eval "ac_cv_func_$1=yes"
570         eval "LIB_$1="
571         AC_DEFINE_UNQUOTED($ac_tr_func)
572         AC_MSG_RESULT([yes])
573         ;;
574         no)
575         eval "ac_cv_func_$1=no"
576         eval "LIB_$1="
577         AC_MSG_RESULT([no])
578         ;;
579         *)
580         eval "ac_cv_func_$1=yes"
581         eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes"
582         AC_DEFINE_UNQUOTED($ac_tr_func)
583         AC_DEFINE_UNQUOTED($ac_tr_lib)
584         AC_MSG_RESULT([yes, in $ac_res])
585         ;;
586 esac
587 AC_SUBST(LIB_$1)
588 ])
589
590 dnl
591 dnl $Id: check-netinet-ip-and-tcp.m4,v 1.2 1999/05/14 13:15:40 assar Exp $
592 dnl
593
594 dnl extra magic check for netinet/{ip.h,tcp.h} because on irix 6.5.3
595 dnl you have to include standards.h before including these files
596
597 AC_DEFUN(CHECK_NETINET_IP_AND_TCP,
598 [
599 AC_CHECK_HEADERS(standards.h)
600 for i in netinet/ip.h netinet/tcp.h; do
601
602 cv=`echo "$i" | sed 'y%./+-%__p_%'`
603
604 AC_MSG_CHECKING([for $i])
605 AC_CACHE_VAL([ac_cv_header_$cv],
606 [AC_TRY_CPP([\
607 #ifdef HAVE_STANDARDS_H
608 #include <standards.h>
609 #endif
610 #include <$i>
611 ],
612 eval "ac_cv_header_$cv=yes",
613 eval "ac_cv_header_$cv=no")])
614 AC_MSG_RESULT(`eval echo \\$ac_cv_header_$cv`)
615 changequote(, )dnl
616 if test `eval echo \\$ac_cv_header_$cv` = yes; then
617   ac_tr_hdr=HAVE_`echo $i | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
618 changequote([, ])dnl
619   AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
620 fi
621 done
622 dnl autoheader tricks *sigh*
623 : << END
624 @@@headers="$headers netinet/ip.h netinet/tcp.h"@@@
625 END
626
627 ])
628
629 dnl $Id: grok-type.m4,v 1.4 1999/11/29 11:16:48 joda Exp $
630 dnl
631 AC_DEFUN(AC_GROK_TYPE, [
632 AC_CACHE_VAL(ac_cv_type_$1, 
633 AC_TRY_COMPILE([
634 #ifdef HAVE_INTTYPES_H
635 #include <inttypes.h>
636 #endif
637 #ifdef HAVE_SYS_TYPES_H
638 #include <sys/types.h>
639 #endif
640 #ifdef HAVE_SYS_BITYPES_H
641 #include <sys/bitypes.h>
642 #endif
643 #ifdef HAVE_BIND_BITYPES_H
644 #include <bind/bitypes.h>
645 #endif
646 #ifdef HAVE_NETINET_IN6_MACHTYPES_H
647 #include <netinet/in6_machtypes.h>
648 #endif
649 ],
650 $i x;
651 ,
652 eval ac_cv_type_$1=yes,
653 eval ac_cv_type_$1=no))])
654
655 AC_DEFUN(AC_GROK_TYPES, [
656 for i in $1; do
657         AC_MSG_CHECKING(for $i)
658         AC_GROK_TYPE($i)
659         eval ac_res=\$ac_cv_type_$i
660         if test "$ac_res" = yes; then
661                 type=HAVE_[]upcase($i)
662                 AC_DEFINE_UNQUOTED($type)
663         fi
664         AC_MSG_RESULT($ac_res)
665 done
666 ])
667
668 dnl $Id: find-func.m4,v 1.1 1997/12/14 15:58:58 joda Exp $
669 dnl
670 dnl AC_FIND_FUNC(func, libraries, includes, arguments)
671 AC_DEFUN(AC_FIND_FUNC, [
672 AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4])
673 if test -n "$LIB_$1"; then
674         LIBS="$LIB_$1 $LIBS"
675 fi
676 ])
677
678 dnl 
679 dnl See if there is any X11 present
680 dnl
681 dnl $Id: check-x.m4,v 1.2 1999/11/05 04:25:23 assar Exp $
682
683 AC_DEFUN(KRB_CHECK_X,[
684 AC_PATH_XTRA
685
686 # try to figure out if we need any additional ld flags, like -R
687 # and yes, the autoconf X test is utterly broken
688 if test "$no_x" != yes; then
689         AC_CACHE_CHECK(for special X linker flags,krb_cv_sys_x_libs_rpath,[
690         ac_save_libs="$LIBS"
691         ac_save_cflags="$CFLAGS"
692         CFLAGS="$CFLAGS $X_CFLAGS"
693         krb_cv_sys_x_libs_rpath=""
694         krb_cv_sys_x_libs=""
695         for rflag in "" "-R" "-R " "-rpath "; do
696                 if test "$rflag" = ""; then
697                         foo="$X_LIBS"
698                 else
699                         foo=""
700                         for flag in $X_LIBS; do
701                         case $flag in
702                         -L*)
703                                 foo="$foo $flag `echo $flag | sed \"s/-L/$rflag/\"`"
704                                 ;;
705                         *)
706                                 foo="$foo $flag"
707                                 ;;
708                         esac
709                         done
710                 fi
711                 LIBS="$ac_save_libs $foo $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
712                 AC_TRY_RUN([
713                 #include <X11/Xlib.h>
714                 foo()
715                 {
716                 XOpenDisplay(NULL);
717                 }
718                 main()
719                 {
720                 return 0;
721                 }
722                 ], krb_cv_sys_x_libs_rpath="$rflag"; krb_cv_sys_x_libs="$foo"; break,:)
723         done
724         LIBS="$ac_save_libs"
725         CFLAGS="$ac_save_cflags"
726         ])
727         X_LIBS="$krb_cv_sys_x_libs"
728 fi
729 ])
730
731 dnl $Id: check-xau.m4,v 1.3 1999/05/14 01:17:06 assar Exp $
732 dnl
733 dnl check for Xau{Read,Write}Auth and XauFileName
734 dnl
735 AC_DEFUN(AC_CHECK_XAU,[
736 save_CFLAGS="$CFLAGS"
737 CFLAGS="$X_CFLAGS $CFLAGS"
738 save_LIBS="$LIBS"
739 dnl LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
740 LIBS="$X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
741 save_LDFLAGS="$LDFLAGS"
742 LDFLAGS="$LDFLAGS $X_LIBS"
743
744
745 AC_FIND_FUNC_NO_LIBS(XauWriteAuth, X11 Xau)
746 ac_xxx="$LIBS"
747 LIBS="$LIB_XauWriteAuth $LIBS"
748 AC_FIND_FUNC_NO_LIBS(XauReadAuth, X11 Xau)
749 LIBS="$LIB_XauReadAauth $LIBS"
750 AC_FIND_FUNC_NO_LIBS(XauFileName, X11 Xau)
751 LIBS="$ac_xxx"
752
753 case "$ac_cv_funclib_XauWriteAuth" in
754 yes)    ;;
755 no)     ;;
756 *)      if test "$ac_cv_funclib_XauReadAuth" = yes; then
757                 if test "$ac_cv_funclib_XauFileName" = yes; then
758                         LIB_XauReadAuth="$LIB_XauWriteAuth"
759                 else
760                         LIB_XauReadAuth="$LIB_XauWriteAuth $LIB_XauFileName"
761                 fi
762         else
763                 if test "$ac_cv_funclib_XauFileName" = yes; then
764                         LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth"
765                 else
766                         LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth $LIB_XauFileName"
767                 fi
768         fi
769         ;;
770 esac
771
772 if test "$AUTOMAKE" != ""; then
773         AM_CONDITIONAL(NEED_WRITEAUTH, test "$ac_cv_func_XauWriteAuth" != "yes")
774 else
775         AC_SUBST(NEED_WRITEAUTH_TRUE)
776         AC_SUBST(NEED_WRITEAUTH_FALSE)
777         if test "$ac_cv_func_XauWriteAuth" != "yes"; then
778                 NEED_WRITEAUTH_TRUE=
779                 NEED_WRITEAUTH_FALSE='#'
780         else
781                 NEED_WRITEAUTH_TRUE='#'
782                 NEED_WRITEAUTH_FALSE=
783         fi
784 fi
785 CFLAGS=$save_CFLAGS
786 LIBS=$save_LIBS
787 LDFLAGS=$save_LDFLAGS
788 ])
789
790 # Define a conditional.
791
792 AC_DEFUN(AM_CONDITIONAL,
793 [AC_SUBST($1_TRUE)
794 AC_SUBST($1_FALSE)
795 if $2; then
796   $1_TRUE=
797   $1_FALSE='#'
798 else
799   $1_TRUE='#'
800   $1_FALSE=
801 fi])
802
803 dnl $Id: krb-find-db.m4,v 1.5.16.1 2000/08/16 04:11:57 assar Exp $
804 dnl
805 dnl find a suitable database library
806 dnl
807 dnl AC_FIND_DB(libraries)
808 AC_DEFUN(KRB_FIND_DB, [
809
810 lib_dbm=no
811 lib_db=no
812
813 for i in $1; do
814
815         if test "$i"; then
816                 m="lib$i"
817                 l="-l$i"
818         else
819                 m="libc"
820                 l=""
821         fi      
822
823         AC_MSG_CHECKING(for dbm_open in $m)
824         AC_CACHE_VAL(ac_cv_krb_dbm_open_$m, [
825
826         save_LIBS="$LIBS"
827         LIBS="$l $LIBS"
828         AC_TRY_RUN([
829 #include <unistd.h>
830 #include <fcntl.h>
831 #if defined(HAVE_NDBM_H)
832 #include <ndbm.h>
833 #elif defined(HAVE_GDBM_NDBM_H)
834 #include <gdbm/ndbm.h>
835 #elif defined(HAVE_DBM_H)
836 #include <dbm.h>
837 #elif defined(HAVE_RPCSVC_DBM_H)
838 #include <rpcsvc/dbm.h>
839 #elif defined(HAVE_DB_H)
840 #define DB_DBM_HSEARCH 1
841 #include <db.h>
842 #endif
843 int main()
844 {
845   DBM *d;
846
847   d = dbm_open("conftest", O_RDWR | O_CREAT, 0666);
848   if(d == NULL)
849     return 1;
850   dbm_close(d);
851   return 0;
852 }], [
853         if test -f conftest.db; then
854                 ac_res=db
855         else
856                 ac_res=dbm
857         fi], ac_res=no, ac_res=no)
858
859         LIBS="$save_LIBS"
860
861         eval ac_cv_krb_dbm_open_$m=$ac_res])
862         eval ac_res=\$ac_cv_krb_dbm_open_$m
863         AC_MSG_RESULT($ac_res)
864
865         if test "$lib_dbm" = no -a $ac_res = dbm; then
866                 lib_dbm="$l"
867         elif test "$lib_db" = no -a $ac_res = db; then
868                 lib_db="$l"
869                 break
870         fi
871 done
872
873 AC_MSG_CHECKING(for NDBM library)
874 ac_ndbm=no
875 if test "$lib_db" != no; then
876         LIB_DBM="$lib_db"
877         ac_ndbm=yes
878         AC_DEFINE(HAVE_NEW_DB, 1, [Define if NDBM really is DB (creates files ending in .db).])
879         if test "$LIB_DBM"; then
880                 ac_res="yes, $LIB_DBM"
881         else
882                 ac_res=yes
883         fi
884 elif test "$lib_dbm" != no; then
885         LIB_DBM="$lib_dbm"
886         ac_ndbm=yes
887         if test "$LIB_DBM"; then
888                 ac_res="yes, $LIB_DBM"
889         else
890                 ac_res=yes
891         fi
892 else
893         LIB_DBM=""
894         ac_res=no
895 fi
896 test "$ac_ndbm" = yes && AC_DEFINE(NDBM, 1, [Define if you have NDBM (and not DBM)])dnl
897 AC_SUBST(LIB_DBM)
898 DBLIB="$LIB_DBM"
899 AC_SUBST(DBLIB)
900 AC_MSG_RESULT($ac_res)
901
902 ])
903
904 dnl $Id: broken-snprintf.m4,v 1.3 1999/03/01 09:52:22 joda Exp $
905 dnl
906 AC_DEFUN(AC_BROKEN_SNPRINTF, [
907 AC_CACHE_CHECK(for working snprintf,ac_cv_func_snprintf_working,
908 ac_cv_func_snprintf_working=yes
909 AC_TRY_RUN([
910 #include <stdio.h>
911 #include <string.h>
912 int main()
913 {
914 changequote(`,')dnl
915         char foo[3];
916 changequote([,])dnl
917         snprintf(foo, 2, "12");
918         return strcmp(foo, "1");
919 }],:,ac_cv_func_snprintf_working=no,:))
920
921 if test "$ac_cv_func_snprintf_working" = yes; then
922         AC_DEFINE_UNQUOTED(HAVE_SNPRINTF, 1, [define if you have a working snprintf])
923 fi
924 if test "$ac_cv_func_snprintf_working" = yes; then
925 AC_NEED_PROTO([#include <stdio.h>],snprintf)
926 fi
927 ])
928
929 AC_DEFUN(AC_BROKEN_VSNPRINTF,[
930 AC_CACHE_CHECK(for working vsnprintf,ac_cv_func_vsnprintf_working,
931 ac_cv_func_vsnprintf_working=yes
932 AC_TRY_RUN([
933 #include <stdio.h>
934 #include <string.h>
935 #include <stdarg.h>
936
937 int foo(int num, ...)
938 {
939 changequote(`,')dnl
940         char bar[3];
941 changequote([,])dnl
942         va_list arg;
943         va_start(arg, num);
944         vsnprintf(bar, 2, "%s", arg);
945         va_end(arg);
946         return strcmp(bar, "1");
947 }
948
949
950 int main()
951 {
952         return foo(0, "12");
953 }],:,ac_cv_func_vsnprintf_working=no,:))
954
955 if test "$ac_cv_func_vsnprintf_working" = yes; then
956         AC_DEFINE_UNQUOTED(HAVE_VSNPRINTF, 1, [define if you have a working vsnprintf])
957 fi
958 if test "$ac_cv_func_vsnprintf_working" = yes; then
959 AC_NEED_PROTO([#include <stdio.h>],vsnprintf)
960 fi
961 ])
962
963 dnl $Id: need-proto.m4,v 1.2 1999/03/01 09:52:24 joda Exp $
964 dnl
965 dnl
966 dnl Check if we need the prototype for a function
967 dnl
968
969 dnl AC_NEED_PROTO(includes, function)
970
971 AC_DEFUN(AC_NEED_PROTO, [
972 if test "$ac_cv_func_$2+set" != set -o "$ac_cv_func_$2" = yes; then
973 AC_CACHE_CHECK([if $2 needs a prototype], ac_cv_func_$2_noproto,
974 AC_TRY_COMPILE([$1],
975 [struct foo { int foo; } xx;
976 extern int $2 (struct foo*);
977 $2(&xx);
978 ],
979 eval "ac_cv_func_$2_noproto=yes",
980 eval "ac_cv_func_$2_noproto=no"))
981 define([foo], [NEED_]translit($2, [a-z], [A-Z])[_PROTO])
982 if test "$ac_cv_func_$2_noproto" = yes; then
983         AC_DEFINE(foo, 1, [define if the system is missing a prototype for $2()])
984 fi
985 undefine([foo])
986 fi
987 ])
988
989 dnl $Id: broken-glob.m4,v 1.2 1999/03/01 09:52:15 joda Exp $
990 dnl
991 dnl check for glob(3)
992 dnl
993 AC_DEFUN(AC_BROKEN_GLOB,[
994 AC_CACHE_CHECK(for working glob, ac_cv_func_glob_working,
995 ac_cv_func_glob_working=yes
996 AC_TRY_LINK([
997 #include <stdio.h>
998 #include <glob.h>],[
999 glob(NULL, GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE, NULL, NULL);
1000 ],:,ac_cv_func_glob_working=no,:))
1001
1002 if test "$ac_cv_func_glob_working" = yes; then
1003         AC_DEFINE(HAVE_GLOB, 1, [define if you have a glob() that groks 
1004         GLOB_BRACE, GLOB_NOCHECK, GLOB_QUOTE, and GLOB_TILDE])
1005 fi
1006 if test "$ac_cv_func_glob_working" = yes; then
1007 AC_NEED_PROTO([#include <stdio.h>
1008 #include <glob.h>],glob)
1009 fi
1010 ])
1011
1012 dnl
1013 dnl $Id: capabilities.m4,v 1.2 1999/09/01 11:02:26 joda Exp $
1014 dnl
1015
1016 dnl
1017 dnl Test SGI capabilities
1018 dnl
1019
1020 AC_DEFUN(KRB_CAPABILITIES,[
1021
1022 AC_CHECK_HEADERS(capability.h sys/capability.h)
1023
1024 AC_CHECK_FUNCS(sgi_getcapabilitybyname cap_set_proc)
1025 ])
1026
1027 dnl $Id: check-getpwnam_r-posix.m4,v 1.2 1999/03/23 16:47:31 joda Exp $
1028 dnl
1029 dnl check for getpwnam_r, and if it's posix or not
1030
1031 AC_DEFUN(AC_CHECK_GETPWNAM_R_POSIX,[
1032 AC_FIND_FUNC_NO_LIBS(getpwnam_r,c_r)
1033 if test "$ac_cv_func_getpwnam_r" = yes; then
1034         AC_CACHE_CHECK(if getpwnam_r is posix,ac_cv_func_getpwnam_r_posix,
1035         ac_libs="$LIBS"
1036         LIBS="$LIBS $LIB_getpwnam_r"
1037         AC_TRY_RUN([
1038 #include <pwd.h>
1039 int main()
1040 {
1041         struct passwd pw, *pwd;
1042         return getpwnam_r("", &pw, NULL, 0, &pwd) < 0;
1043 }
1044 ],ac_cv_func_getpwnam_r_posix=yes,ac_cv_func_getpwnam_r_posix=no,:)
1045 LIBS="$ac_libs")
1046 if test "$ac_cv_func_getpwnam_r_posix" = yes; then
1047         AC_DEFINE(POSIX_GETPWNAM_R, 1, [Define if getpwnam_r has POSIX flavour.])
1048 fi
1049 fi
1050 ])
1051 dnl
1052 dnl $Id: krb-func-getlogin.m4,v 1.1 1999/07/13 17:45:30 assar Exp $
1053 dnl
1054 dnl test for POSIX (broken) getlogin
1055 dnl
1056
1057
1058 AC_DEFUN(AC_FUNC_GETLOGIN, [
1059 AC_CHECK_FUNCS(getlogin setlogin)
1060 if test "$ac_cv_func_getlogin" = yes; then
1061 AC_CACHE_CHECK(if getlogin is posix, ac_cv_func_getlogin_posix, [
1062 if test "$ac_cv_func_getlogin" = yes -a "$ac_cv_func_setlogin" = yes; then
1063         ac_cv_func_getlogin_posix=no
1064 else
1065         ac_cv_func_getlogin_posix=yes
1066 fi
1067 ])
1068 if test "$ac_cv_func_getlogin_posix" = yes; then
1069         AC_DEFINE(POSIX_GETLOGIN, 1, [Define if getlogin has POSIX flavour (and not BSD).])
1070 fi
1071 fi
1072 ])
1073
1074 dnl $Id: find-if-not-broken.m4,v 1.2 1998/03/16 22:16:27 joda Exp $
1075 dnl
1076 dnl
1077 dnl Mix between AC_FIND_FUNC and AC_BROKEN
1078 dnl
1079
1080 AC_DEFUN(AC_FIND_IF_NOT_BROKEN,
1081 [AC_FIND_FUNC([$1], [$2], [$3], [$4])
1082 if eval "test \"$ac_cv_func_$1\" != yes"; then
1083 LIBOBJS[]="$LIBOBJS $1.o"
1084 fi
1085 AC_SUBST(LIBOBJS)dnl
1086 ])
1087
1088 dnl $Id: broken.m4,v 1.3 1998/03/16 22:16:19 joda Exp $
1089 dnl
1090 dnl
1091 dnl Same as AC _REPLACE_FUNCS, just define HAVE_func if found in normal
1092 dnl libraries 
1093
1094 AC_DEFUN(AC_BROKEN,
1095 [for ac_func in $1
1096 do
1097 AC_CHECK_FUNC($ac_func, [
1098 ac_tr_func=HAVE_[]upcase($ac_func)
1099 AC_DEFINE_UNQUOTED($ac_tr_func)],[LIBOBJS[]="$LIBOBJS ${ac_func}.o"])
1100 dnl autoheader tricks *sigh*
1101 : << END
1102 @@@funcs="$funcs $1"@@@
1103 END
1104 done
1105 AC_SUBST(LIBOBJS)dnl
1106 ])
1107
1108 dnl $Id: krb-func-getcwd-broken.m4,v 1.2 1999/03/01 13:03:32 joda Exp $
1109 dnl
1110 dnl
1111 dnl test for broken getcwd in (SunOS braindamage)
1112 dnl
1113
1114 AC_DEFUN(AC_KRB_FUNC_GETCWD_BROKEN, [
1115 if test "$ac_cv_func_getcwd" = yes; then
1116 AC_MSG_CHECKING(if getcwd is broken)
1117 AC_CACHE_VAL(ac_cv_func_getcwd_broken, [
1118 ac_cv_func_getcwd_broken=no
1119
1120 AC_TRY_RUN([
1121 #include <errno.h>
1122 char *getcwd(char*, int);
1123
1124 void *popen(char *cmd, char *mode)
1125 {
1126         errno = ENOTTY;
1127         return 0;
1128 }
1129
1130 int main()
1131 {
1132         char *ret;
1133         ret = getcwd(0, 1024);
1134         if(ret == 0 && errno == ENOTTY)
1135                 return 0;
1136         return 1;
1137 }
1138 ], ac_cv_func_getcwd_broken=yes,:,:)
1139 ])
1140 if test "$ac_cv_func_getcwd_broken" = yes; then
1141         AC_DEFINE(BROKEN_GETCWD, 1, [Define if getcwd is broken (like in SunOS 4).])dnl
1142         LIBOBJS="$LIBOBJS getcwd.o"
1143         AC_SUBST(LIBOBJS)dnl
1144         AC_MSG_RESULT($ac_cv_func_getcwd_broken)
1145 else
1146         AC_MSG_RESULT([seems ok])
1147 fi
1148 fi
1149 ])
1150
1151 dnl $Id: proto-compat.m4,v 1.3 1999/03/01 13:03:48 joda Exp $
1152 dnl
1153 dnl
1154 dnl Check if the prototype of a function is compatible with another one
1155 dnl
1156
1157 dnl AC_PROTO_COMPAT(includes, function, prototype)
1158
1159 AC_DEFUN(AC_PROTO_COMPAT, [
1160 AC_CACHE_CHECK([if $2 is compatible with system prototype],
1161 ac_cv_func_$2_proto_compat,
1162 AC_TRY_COMPILE([$1],
1163 [$3;],
1164 eval "ac_cv_func_$2_proto_compat=yes",
1165 eval "ac_cv_func_$2_proto_compat=no"))
1166 define([foo], translit($2, [a-z], [A-Z])[_PROTO_COMPATIBLE])
1167 if test "$ac_cv_func_$2_proto_compat" = yes; then
1168         AC_DEFINE(foo, 1, [define if prototype of $2 is compatible with
1169         $3])
1170 fi
1171 undefine([foo])
1172 ])
1173 dnl $Id: check-var.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
1174 dnl
1175 dnl AC_CHECK_VAR(includes, variable)
1176 AC_DEFUN(AC_CHECK_VAR, [
1177 AC_MSG_CHECKING(for $2)
1178 AC_CACHE_VAL(ac_cv_var_$2, [
1179 AC_TRY_LINK([extern int $2;
1180 int foo() { return $2; }],
1181             [foo()],
1182             ac_cv_var_$2=yes, ac_cv_var_$2=no)
1183 ])
1184 define([foo], [HAVE_]translit($2, [a-z], [A-Z]))
1185
1186 AC_MSG_RESULT(`eval echo \\$ac_cv_var_$2`)
1187 if test `eval echo \\$ac_cv_var_$2` = yes; then
1188         AC_DEFINE_UNQUOTED(foo, 1, [define if you have $2])
1189         AC_CHECK_DECLARATION([$1],[$2])
1190 fi
1191 undefine([foo])
1192 ])
1193
1194 dnl $Id: check-declaration.m4,v 1.3 1999/03/01 13:03:08 joda Exp $
1195 dnl
1196 dnl
1197 dnl Check if we need the declaration of a variable
1198 dnl
1199
1200 dnl AC_HAVE_DECLARATION(includes, variable)
1201 AC_DEFUN(AC_CHECK_DECLARATION, [
1202 AC_MSG_CHECKING([if $2 is properly declared])
1203 AC_CACHE_VAL(ac_cv_var_$2_declaration, [
1204 AC_TRY_COMPILE([$1
1205 extern struct { int foo; } $2;],
1206 [$2.foo = 1;],
1207 eval "ac_cv_var_$2_declaration=no",
1208 eval "ac_cv_var_$2_declaration=yes")
1209 ])
1210
1211 define(foo, [HAVE_]translit($2, [a-z], [A-Z])[_DECLARATION])
1212
1213 AC_MSG_RESULT($ac_cv_var_$2_declaration)
1214 if eval "test \"\$ac_cv_var_$2_declaration\" = yes"; then
1215         AC_DEFINE(foo, 1, [define if your system declares $2])
1216 fi
1217 undefine([foo])
1218 ])
1219
1220 dnl $Id: have-struct-field.m4,v 1.6 1999/07/29 01:44:32 assar Exp $
1221 dnl
1222 dnl check for fields in a structure
1223 dnl
1224 dnl AC_HAVE_STRUCT_FIELD(struct, field, headers)
1225
1226 AC_DEFUN(AC_HAVE_STRUCT_FIELD, [
1227 define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_]))
1228 AC_CACHE_CHECK([for $2 in $1], cache_val,[
1229 AC_TRY_COMPILE([$3],[$1 x; x.$2;],
1230 cache_val=yes,
1231 cache_val=no)])
1232 if test "$cache_val" = yes; then
1233         define(foo, translit(HAVE_$1_$2, [a-z ], [A-Z_]))
1234         AC_DEFINE(foo, 1, [Define if $1 has field $2.])
1235         undefine([foo])
1236 fi
1237 undefine([cache_val])
1238 ])
1239
1240 dnl $Id: have-type.m4,v 1.4 1999/07/24 19:23:01 assar Exp $
1241 dnl
1242 dnl check for existance of a type
1243
1244 dnl AC_HAVE_TYPE(TYPE,INCLUDES)
1245 AC_DEFUN(AC_HAVE_TYPE, [
1246 cv=`echo "$1" | sed 'y%./+- %__p__%'`
1247 AC_MSG_CHECKING(for $1)
1248 AC_CACHE_VAL([ac_cv_type_$cv],
1249 AC_TRY_COMPILE(
1250 [#include <sys/types.h>
1251 #if STDC_HEADERS
1252 #include <stdlib.h>
1253 #include <stddef.h>
1254 #endif
1255 $2],
1256 [$1 foo;],
1257 eval "ac_cv_type_$cv=yes",
1258 eval "ac_cv_type_$cv=no"))dnl
1259 AC_MSG_RESULT(`eval echo \\$ac_cv_type_$cv`)
1260 if test `eval echo \\$ac_cv_type_$cv` = yes; then
1261   ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
1262 dnl autoheader tricks *sigh*
1263 define(foo,translit($1, [ ], [_]))
1264 : << END
1265 @@@funcs="$funcs foo"@@@
1266 END
1267 undefine([foo])
1268   AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
1269 fi
1270 ])
1271
1272 dnl $Id: krb-struct-spwd.m4,v 1.3 1999/07/13 21:04:11 assar Exp $
1273 dnl
1274 dnl Test for `struct spwd'
1275
1276 AC_DEFUN(AC_KRB_STRUCT_SPWD, [
1277 AC_MSG_CHECKING(for struct spwd)
1278 AC_CACHE_VAL(ac_cv_struct_spwd, [
1279 AC_TRY_COMPILE(
1280 [#include <pwd.h>
1281 #ifdef HAVE_SHADOW_H
1282 #include <shadow.h>
1283 #endif],
1284 [struct spwd foo;],
1285 ac_cv_struct_spwd=yes,
1286 ac_cv_struct_spwd=no)
1287 ])
1288 AC_MSG_RESULT($ac_cv_struct_spwd)
1289
1290 if test "$ac_cv_struct_spwd" = "yes"; then
1291   AC_DEFINE(HAVE_STRUCT_SPWD, 1, [define if you have struct spwd])
1292 fi
1293 ])
1294
1295 dnl $Id: krb-struct-winsize.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
1296 dnl
1297 dnl
1298 dnl Search for struct winsize
1299 dnl
1300
1301 AC_DEFUN(AC_KRB_STRUCT_WINSIZE, [
1302 AC_MSG_CHECKING(for struct winsize)
1303 AC_CACHE_VAL(ac_cv_struct_winsize, [
1304 ac_cv_struct_winsize=no
1305 for i in sys/termios.h sys/ioctl.h; do
1306 AC_EGREP_HEADER(
1307 changequote(, )dnl
1308 struct[         ]*winsize,dnl
1309 changequote([,])dnl
1310 $i, ac_cv_struct_winsize=yes; break)dnl
1311 done
1312 ])
1313 if test "$ac_cv_struct_winsize" = "yes"; then
1314   AC_DEFINE(HAVE_STRUCT_WINSIZE, 1, [define if struct winsize is declared in sys/termios.h])
1315 fi
1316 AC_MSG_RESULT($ac_cv_struct_winsize)
1317 AC_EGREP_HEADER(ws_xpixel, termios.h, 
1318         AC_DEFINE(HAVE_WS_XPIXEL, 1, [define if struct winsize has ws_xpixel]))
1319 AC_EGREP_HEADER(ws_ypixel, termios.h, 
1320         AC_DEFINE(HAVE_WS_YPIXEL, 1, [define if struct winsize has ws_ypixel]))
1321 ])
1322
1323 dnl $Id: check-type-extra.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
1324 dnl
1325 dnl ac_check_type + extra headers
1326
1327 dnl AC_CHECK_TYPE_EXTRA(TYPE, DEFAULT, HEADERS)
1328 AC_DEFUN(AC_CHECK_TYPE_EXTRA,
1329 [AC_REQUIRE([AC_HEADER_STDC])dnl
1330 AC_MSG_CHECKING(for $1)
1331 AC_CACHE_VAL(ac_cv_type_$1,
1332 [AC_EGREP_CPP(dnl
1333 changequote(<<,>>)dnl
1334 <<$1[^a-zA-Z_0-9]>>dnl
1335 changequote([,]), [#include <sys/types.h>
1336 #if STDC_HEADERS
1337 #include <stdlib.h>
1338 #include <stddef.h>
1339 #endif
1340 $3], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
1341 AC_MSG_RESULT($ac_cv_type_$1)
1342 if test $ac_cv_type_$1 = no; then
1343   AC_DEFINE($1, $2, [Define this to what the type $1 should be.])
1344 fi
1345 ])
1346
1347 dnl $Id: krb-version.m4,v 1.1 1997/12/14 15:59:03 joda Exp $
1348 dnl
1349 dnl
1350 dnl output a C header-file with some version strings
1351 dnl
1352 AC_DEFUN(AC_KRB_VERSION,[
1353 dnl AC_OUTPUT_COMMANDS([
1354 cat > include/newversion.h.in <<FOOBAR
1355 char *${PACKAGE}_long_version = "@(#)\$Version: $PACKAGE-$VERSION by @USER@ on @HOST@ ($host) @DATE@ \$";
1356 char *${PACKAGE}_version = "$PACKAGE-$VERSION";
1357 FOOBAR
1358
1359 if test -f include/version.h && cmp -s include/newversion.h.in include/version.h.in; then
1360         echo "include/version.h is unchanged"
1361         rm -f include/newversion.h.in
1362 else
1363         echo "creating include/version.h"
1364         User=${USER-${LOGNAME}}
1365         Host=`(hostname || uname -n) 2>/dev/null | sed 1q`
1366         Date=`date`
1367         mv -f include/newversion.h.in include/version.h.in
1368         sed -e "s/@USER@/$User/" -e "s/@HOST@/$Host/" -e "s/@DATE@/$Date/" include/version.h.in > include/version.h
1369 fi
1370 dnl ],host=$host PACKAGE=$PACKAGE VERSION=$VERSION)
1371 ])
1372