1dnl process this file with GNU autoconf to produce a configure script.
2dnl
3dnl $Id: configure.in,v 1.1.1.1 2008/10/15 03:28:09 james26_jang Exp $
4
5dnl ----------------------------------------------------------------------------
6dnl ----------------- START OF GENERAL CONFIGURATION ---------------------------
7AC_INIT(Makefile.in)
8
9
10PACKAGE=LPRng
11VERSION=3.8.22
12
13
14AC_CONFIG_AUX_DIR(.)
15AC_CANONICAL_SYSTEM
16AC_CONFIG_HEADER(config.h)
17
18AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [package])
19AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [version])
20AC_SUBST(PACKAGE)
21AC_SUBST(VERSION)
22ALL_LINGUAS="fr"
23
24if test -z "$LOCALEDIR" ; then
25    LOCALEDIR='${prefix}/share/locale'
26fi;
27WITH_LOCALEDIR dnl
28export LOCALEDIR
29
30WITH_CCOPTS dnl
31WITH_CPPOPTS dnl
32WITH_LDOPTS dnl
33
34AC_PREFIX_DEFAULT(/usr/local)
35AC_SUBST(INSTALL)
36AC_SUBST(INSTALL_MAN)
37AC_SUBST(SHELL)
38AC_SUBST(CPP)
39AC_SUBST(CFLAGS)
40AC_SUBST(CPPFLAGS)
41AC_SUBST(LDFLAGS)
42AC_SUBST(LDCC)
43
44
45dnl check for awk
46AC_PROG_AWK
47AC_SUBST(AWK)
48AC_PATH_PROG(SED,sed)dnl
49AC_SUBST(SED)dnl
50AC_PATH_PROG(PERL,perl)dnl
51AC_SUBST(PERL)dnl
52AC_PATH_PROG(CHOWN,chown)dnl
53AC_SUBST(CHOWN)dnl
54AC_PATH_PROG(CHGRP,chgrp)dnl
55AC_SUBST(CHGRP)dnl
56AC_PATH_PROG(PRUTIL,pr)dnl
57AC_SUBST(PRUTIL)dnl
58AC_PATH_PROG(OPENSSL,openssl)dnl
59AC_SUBST(OPENSSL)dnl
60AC_PATH_PROG(PGP_PATH,pgp)dnl
61AC_SUBST(PGP_PATH)dnl
62AC_DEFINE_UNQUOTED(PGP_PATH, "$PGP_PATH",[pgp path])
63
64
65dnl ----------------------------------------------------------------------------
66dnl ----------- XXXXXX START OF OPTIONS ----------------------------------------
67
68dnl Unix socket pathname
69AC_MSG_CHECKING(unix socket pathname)
70AC_ARG_WITH(unix_socket_path,
71[  --with-unix_socket_path=DIR         unix socket path (default /var/run/lprng)],
72UNIXSOCKETPATH=$withval,
73UNIXSOCKETPATH=/var/run/lprng
74)
75AC_MSG_RESULT($UNIXSOCKETPATH)
76AC_SUBST(UNIXSOCKETPATH)
77
78
79dnl check to see if setuid is suppressed
80AC_MSG_CHECKING(if installing clients setuid)
81AC_ARG_ENABLE( setuid,
82[  --disable-setuid                  do not install client executables setuid root],
83[
84if test "$enableval" = "yes" ; then
85	PERMS=SUID_ROOT_PERMS
86else
87	PERMS=NORM_PERMS
88fi
89],
90[
91	PERMS=SUID_ROOT_PERMS
92],
93)
94AC_MSG_RESULT($PERMS)
95AC_SUBST(PERMS)
96
97dnl check to see if priv ports required
98AC_MSG_CHECKING(require connections from priviledged ports)
99AC_ARG_ENABLE( priv_ports,
100[  --enable-priv_ports               require connections from privileged ports],
101[
102if test "$enableval" = "yes" ; then
103	v=yes;  PRIV_PORTS="";
104else
105	v=no; PRIV_PORTS="#";
106fi
107],
108[
109	v=no; PRIV_PORTS="#";
110]
111)
112AC_MSG_RESULT($v);dnl
113AC_SUBST(PRIV_PORTS)
114
115dnl check to see if force_localhost is suppressed
116AC_MSG_CHECKING(disable force_localhost default)
117AC_ARG_ENABLE( force_localhost,
118[  --disable-force_localhost         disable force_localhost default],
119[
120if test "$enableval" = "yes" ; then
121	v=enabled;  FORCE_LOCALHOST=1;
122else
123	v=disabled; FORCE_LOCALHOST=0;
124fi
125],
126[
127	v=enabled;  FORCE_LOCALHOST=1;
128]
129)
130AC_MSG_RESULT($v)
131AC_DEFINE_UNQUOTED(FORCE_LOCALHOST,"$FORCE_LOCALHOST",[Force Localhost (force_localhost)])
132
133dnl check to see if clients require lpd.conf and printcap
134AC_MSG_CHECKING(require_configfiles default)
135AC_ARG_ENABLE( require_configfiles,
136[  --disable-require_configfiles     client programs require lpd.conf, printcap],
137[
138if test "$enableval" = "yes" ; then
139	v=yes;  REQUIRE_CONFIGFILES=1;
140else
141	v=no; REQUIRE_CONFIGFILES=0;
142fi
143],
144[
145	v=yes;  REQUIRE_CONFIGFILES=1;
146]
147)
148AC_MSG_RESULT($v)
149AC_SUBST(REQUIRE_CONFIGFILES)
150
151dnl check to see if kerberos is disabled
152AC_MSG_CHECKING(if Kerberos authentication is enabled)
153AC_ARG_ENABLE( kerberos,
154[  --enable-kerberos                 enable kerberos support],
155[
156if test "$enableval" = "yes" ; then
157	v=enabled;  KERBEROS=1;AC_DEFINE_UNQUOTED(KERBEROS,"$KERBEROS",[kerberos])
158else
159	v=disabled; KERBEROS=;
160fi
161],
162[
163	v=disabled; KERBEROS=;
164]
165)
166AC_MSG_RESULT($v (KERBEROS $KERBEROS));dnl
167AC_SUBST(KERBEROS)
168
169dnl check to see if MIT Kerberos 4 support is enabled
170AC_MSG_CHECKING(if MIT Kerberos4 is enabled)
171AC_ARG_ENABLE( mit_kerberos4,
172[  --enable-mit_kerberos4            enable MIT Kerberos 4 support],
173[
174if test "$enableval" = "yes" ; then
175	v=enabled; MIT_KERBEROS4=1;AC_DEFINE_UNQUOTED(MIT_KERBEROS4,"$MIT_KERBEROS4",[kerberos 4 support])
176else
177	v=disabled; MIT_KERBEROS4=;
178fi
179],
180[
181	v=disabled; MIT_KERBEROS4=;
182]
183)
184AC_MSG_RESULT($v (MIT_KERBEROS4 $MIT_KERBEROS4));dnl
185AC_SUBST(MIT_KERBEROS4)
186
187dnl find kerberos libraries
188AC_MSG_CHECKING(if Kerberos libraries are to located and other checks)
189AC_ARG_ENABLE( --disable-kerberos_checks,
190[  --disable-kerberos_checks         disable kerberos library location and checking for support],
191[
192if test "$enableval" = "yes" ; then
193	v=enabled; KERBEROS_CHECKS=1;
194else
195	v=disabled; KERBEROS_CHECKS=;
196fi
197],
198[
199	v=enabled; KERBEROS_CHECKS=1;
200]
201)
202AC_MSG_RESULT($v (KERBEROS_CHECKS $KERBEROS_CHECKS));dnl
203lpd_dir=/lpd
204export lpd_dir
205
206dnl Specify install dir for lpd
207AC_MSG_CHECKING(where to install the lpd binary)
208AC_ARG_WITH(lpddir,
209[  --with-lpddir=DIR                 lpd executable directory (default \${sbindir})],
210LPD_DIR=$withval,
211LPD_DIR=\${sbindir}
212)
213AC_MSG_RESULT($LPD_DIR)
214AC_SUBST(LPD_DIR)
215
216dnl  lpd.conf location
217AC_MSG_CHECKING(lpd.conf location)
218AC_ARG_WITH(lpd_conf_path,
219[  --with-lpd_conf_path=PATH         path of lpd.conf (default: \${sysconfdir}/lpd/lpd.conf)],
220LPD_CONF_PATH=$withval,
221LPD_CONF_PATH=\${sysconfdir}/lpd/lpd.conf,
222)
223AC_MSG_RESULT($LPD_CONF_PATH)
224AC_SUBST(LPD_CONF_PATH)
225
226dnl  lpd.perms location
227dnl
228AC_MSG_CHECKING(lpd.perms location)
229AC_ARG_WITH(lpd_perms_path,
230[  --with-lpd_perms_path=PATH        path of lpd.perms (default: \${sysconfdir}/lpd/lpd.perms)],
231LPD_PERMS_PATH=$withval,
232LPD_PERMS_PATH=\${sysconfdir}/lpd/lpd.perms,
233)
234AC_MSG_RESULT($LPD_PERMS_PATH)
235AC_SUBST(LPD_PERMS_PATH)
236
237dnl  printcap location
238dnl
239AC_MSG_CHECKING(printcap location)
240AC_ARG_WITH(printcap_path,
241[  --with-printcap_path=PATH         path of printcap (default \${sysconfdir}/printcap)],
242PRINTCAP_PATH=$withval,
243PRINTCAP_PATH=\${sysconfdir}/printcap,
244)
245AC_MSG_RESULT($PRINTCAP_PATH)
246AC_SUBST(PRINTCAP_PATH)
247
248dnl  lpd_printcap location
249dnl
250AC_MSG_CHECKING(lpd_printcap location)
251AC_ARG_WITH(lpd_printcap_path,
252[  --with-lpd_printcap_path=PATH     path of lpd_printcap (default \${sysconfdir}/lpd/lpd_printcap)],
253LPD_PRINTCAP_PATH=$withval,
254LPD_PRINTCAP_PATH=\${sysconfdir}/lpd/lpd_printcap,
255)
256AC_MSG_RESULT($LPD_PRINTCAP_PATH)
257AC_SUBST(LPD_PRINTCAP_PATH)
258dnl  startup file location
259dnl
260AC_MSG_CHECKING(startup (initialization) file location)
261AC_ARG_WITH(init_path,
262[  --with-initpath=PATH              path of lpd startup file (default /usr/local/etc/rc.d/lprng.sh)
263                                       use 'no' to disable installation and lpd startup],
264INIT=$withval,
265INIT=,
266)
267AC_MSG_RESULT($INIT)
268AC_SUBST(INIT)
269
270dnl  lockfile PATH value
271dnl
272AC_MSG_CHECKING(lockfile PATH value)
273AC_ARG_WITH(lockfile,
274[  --with-lockfile=PATH              lockfile PATH, default /var/run/lpd ],
275LOCKFILE="$withval", LOCKFILE="/var/run/lpd",
276)
277AC_MSG_RESULT("$LOCKFILE")
278AC_SUBST(LOCKFILE)
279
280
281dnl  LD_LIBRARY_PATH value
282dnl
283AC_MSG_CHECKING(LD_LIBRARY_PATH value)
284AC_ARG_WITH(ld_library_path,
285[  --with-ld_libary_path=PATH        LD_LIBRARY_PATH value, default /lib:/usr/lib:/usr/local/lib ],
286LD_LIBRARY_PATH="$withval",
287LD_LIBRARY_PATH="/lib:/usr/lib:/usr/local/lib"
288)
289AC_MSG_RESULT("$LD_LIBRARY_PATH")
290AC_SUBST(LD_LIBRARY_PATH)
291
292dnl  filter PATH value
293dnl
294AC_MSG_CHECKING(filter PATH value)
295AC_ARG_WITH(filter_path,
296[  --with-filter_path=PATH           filter PATH value, default /bin:/usr/bin:/usr/local/bin ],
297FILTER_PATH="$withval",
298FILTER_PATH="/bin:/usr/bin:/usr/local/bin"
299)
300AC_MSG_RESULT("$FILTER_PATH")
301AC_SUBST(FILTER_PATH)
302
303dnl  user name
304dnl
305AC_MSG_CHECKING(run lpd as userid)
306AC_ARG_WITH(userid,
307[  --with-userid=NAME                run LPRng software as this userid, default daemon ],
308USERID="$withval", USERID="daemon",
309)
310AC_MSG_RESULT("$USERID")
311AC_SUBST(USERID)
312
313dnl  group value
314dnl
315AC_MSG_CHECKING(run lpd as groupid)
316AC_ARG_WITH(groupid,
317[  --with-groupid=NAME               run LPRng software as this groupid, default daemon ],
318GROUPID="$withval", GROUPID="daemon",
319)
320AC_MSG_RESULT("$GROUPID")
321AC_SUBST(GROUPID)
322
323
324dnl  done_jobs value
325dnl
326AC_MSG_CHECKING(retain status for N jobs)
327AC_ARG_WITH(done_jobs,
328[  --with-done_jobs=N                retain last N job status, default 1],
329DONE_JOBS="$withval", DONE_JOBS="1",
330)
331AC_MSG_RESULT("$DONE_JOBS")
332AC_SUBST(DONE_JOBS)
333
334
335dnl  done_jobs_max_age value
336dnl
337AC_MSG_CHECKING(retain status for jobs less than N seconds old, default 0 - no expiry)
338AC_ARG_WITH(done_jobs_max_age,
339[  --with-done_jobs_max_age=N        retain job status N seconds, default 0 - no expiry],
340DONE_JOBS_MAX_AGE="$withval", DONE_JOBS_MAX_AGE="0",
341)
342AC_MSG_RESULT("$DONE_JOBS_MAX_AGE")
343AC_SUBST(DONE_JOBS_MAX_AGE)
344
345dnl  chooser routine
346dnl
347AC_MSG_CHECKING(load balance queue chooser routine name)
348AC_ARG_WITH(chooser_routine,
349[  --with-chooser_routine=NAME       load balance queue chooser routine name in user object file ],
350[
351CHOOSER_ROUTINE="$withval"
352AC_DEFINE_UNQUOTED(CHOOSER_ROUTINE,$CHOOSER_ROUTINE,[Chooser routine])
353]
354)
355AC_MSG_RESULT("$CHOOSER_ROUTINE")
356
357dnl  queue order routine
358dnl
359AC_MSG_CHECKING(queue order routine name)
360AC_ARG_WITH(order_routine,
361[  --with-order_routine=NAME         queue order routine name in user object file ],
362[
363ORDER_ROUTINE="$withval"
364AC_DEFINE_UNQUOTED(ORDER_ROUTINE,"$ORDER_ROUTINE",[job order routine])
365]
366)
367AC_MSG_RESULT("$ORDER_ROUTINE")
368
369dnl  user specified object files
370dnl
371AC_MSG_CHECKING(user specified object file)
372AC_ARG_WITH(user_objs,
373[  --with-user_objs=NAME             user specified object file ],
374USER_OBJS="$withval"
375)
376AC_MSG_RESULT("$USER_OBJS")
377AC_SUBST(USER_OBJS)
378
379dnl  user specified include files
380dnl
381AC_MSG_CHECKING(user specified include file for user object files)
382AC_ARG_WITH(user_include,
383[  --with-user_include=NAME          include file with function prototypes for user object file ],
384[
385USER_INCLUDE="$withval"
386AC_DEFINE_UNQUOTED(USER_INCLUDE,"$USER_INCLUDE",[user specified include files])
387]
388)
389AC_MSG_RESULT("$USER_INCLUDE")
390
391dnl  clear program
392dnl
393AC_MSG_CHECKING(terminal screen clear program)
394if test -z "$CLEAR" ; then
395  AC_PATH_PROG(CLEAR,clear)dnl
396fi
397if test -z "$CLEAR" ; then
398 AC_MSG_WARN([Program 'clear' is not found. Set environment CLEAR=no if you do not want to use it]);
399 exit 1
400fi
401if test "$CLEAR" = "no" ; then CLEAR= ; fi
402if test -n "$CLEAR" ; then
403	AC_DEFINE_UNQUOTED(CLEAR,"$CLEAR",[screen clear program])
404fi
405
406dnl  ps -what options
407dnl
408AC_MSG_CHECKING(ps options for displaying all processes)
409if test -z "$PSHOWALL" ; then
410  if ps -ax >/dev/null 2>/dev/null; then
411  	PSHOWALL="-ax"
412  elif ps -e >/dev/null 2>/dev/null;  then
413  	PSHOWALL="-e"
414  else
415  	AC_MSG_WARN(ps not available or -ax AND -e options do not work)
416  	AC_MSG_WARN(specify options in the PSHOWALL environment variable);
417	exit 1
418  fi
419fi
420AC_MSG_RESULT("using ${PSHOWALL}")
421AC_SUBST(PSHOWALL)
422
423dnl ----------------------------------------------------------------------------
424dnl ----------- XXXXXX END OF OPTIONS ------------------------------------------
425AC_MSG_CHECKING(filter directory)
426AC_ARG_WITH(filterdir,
427[  --with-filterdir=DIR              filter directory (default \${libexecdir}/filters)],
428FILTER_DIR=$withval,
429FILTER_DIR=\${libexecdir}/filters,
430)
431AC_MSG_RESULT($FILTER_DIR)
432AC_SUBST(FILTER_DIR)
433
434dnl default use -Werror
435AC_MSG_CHECKING(disable -Werror flag)
436AC_ARG_ENABLE( werror,
437[  --disable-werror                  disable -Werror compile flag],
438[
439if test "$enableval" = "yes" ; then
440	v=yes;  werror=" -Werror ";
441else
442	v=no; werror ="";
443fi
444],
445[
446	v=yes;  werror=" -Werror ";
447]
448)
449AC_MSG_RESULT($v)
450
451dnl default strip binaries 
452AC_MSG_CHECKING(disable stripped binaries)
453AC_ARG_ENABLE( strip,
454[  --disable-strip                   disable stripping binaries by default],
455[
456if test "$enableval" = "yes" ; then
457	v=yes;  STRIP_OPTION=" -s ";
458else
459	v=no; STRIP_OPTION="";
460fi
461],
462[
463	v=yes;  STRIP_OPTION=" -s ";
464]
465)
466AC_MSG_RESULT($v)
467AC_SUBST(STRIP_OPTION)
468
469dnl ----------------------------------------------------------------------------
470dnl ------------   OS Checks  --------------------------------------------------
471changequote(, )dnl
472release=`uname -r 2>/dev/null; exit 0`;
473version=`echo $target_os | sed -e 's/[^0-9][^0-9]*//' -e 's/\./X/' -e 's/\.//g' -e 's/X/./' \
474	| awk '{ v=$1+0; if( v > 0 ){ while( v < 100 || int(v) != v ){v = v * 10;}}; print v; }' `;
475if test "$version" -eq 0 ; then
476	version=`echo $release | sed -e 's/-.*//' -e 's/\.//g' \
477	| awk '{ v=$1+0; if( v > 0 ){ while( v < 100 || int(v) != v ){v = v * 10;}}; print v; }' `;
478fi
479osword=`echo $target_os | sed -e 's/[0-9].*//'`; export osword
480changequote([, ])dnl
481AC_MSG_RESULT([Target is $target, arch $target_cpu, os $target_os, release $release, version $version])
482
483AC_DEFINE_UNQUOTED(TARGETARCHITECTURE,"$target_cpu",[target CPU])
484AC_DEFINE_UNQUOTED(OSNAME,"$osword",[OS name])
485AC_DEFINE_UNQUOTED(OSVERSION,$version,[OS version])
486OSNAME=$osword
487OSVERSION=$version
488AC_SUBST(OSNAME)dnl
489AC_SUBST(OSVERSION)dnl
490
491
492dnl ----------------------------------------------------------------------------
493dnl -----------   C compiler checks    -----------------------------------------
494
495AC_PROG_CPP
496AC_PROG_CC
497
498AC_AIX
499AC_ISC_POSIX
500AC_MINIX
501
502
503if test "$ac_cv_prog_gcc" = yes; then
504	cat >conftest.c <<EOF
505#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
506yes
507#endif
508EOF
509    if ${CC-cc} -E conftest.c | egrep yes >/dev/null 2>&1; then
510        gcc -v
511		echo "WARNING: gcc -O (version 2.4.5 and below) produces incorrect code"
512		echo "  for lpd.c and other large routines. Update your GCC compiler"
513		exit 1
514	fi;
515fi;
516
517LDCC="$CC"
518
519AC_DISABLE_SHARED
520AM_PROG_LIBTOOL
521
522AC_C_CONST
523AC_C_INLINE
524AC_C_VOLATILE
525
526AC_HEADER_STDC
527AC_HEADER_DIRENT
528AC_HEADER_SYS_WAIT
529AC_HEADER_TIME
530
531dnl typedefs:
532AC_TYPE_SIGNAL
533AC_TYPE_UID_T
534AC_TYPE_SIZE_T
535AC_TYPE_MODE_T
536AC_TYPE_OFF_T
537AC_TYPE_PID_T
538
539
540AC_CHECK_TYPES( fd_set,,,[
541#include <sys/types.h>
542#include <sys/time.h>
543#include <sys/unistd.h>
544] )
545
546AC_CHECK_TYPES( socklen_t,,,[
547#include <sys/types.h>
548#include <sys/socket.h>
549] )
550
551AC_CACHE_CHECK(checking for long long,
552ac_cv_long_long,
553[
554AC_TRY_COMPILE([
555#include <stdio.h>
556#include <sys/types.h>
557], [printf("%d",sizeof(long long));],
558ac_cv_long_long=yes, ac_cv_long_long=no)
559])
560if test $ac_cv_long_long = yes; then
561  AC_DEFINE(HAVE_LONG_LONG,1,[have long long])
562fi
563
564AC_CACHE_CHECK(checking for long double,
565ac_cv_long_double,
566[
567AC_TRY_COMPILE([
568#include <stdio.h>
569#include <sys/types.h>
570], [printf("%d",sizeof(long double));],
571ac_cv_long_double=yes, ac_cv_long_double=no)
572])
573if test $ac_cv_long_double = yes; then
574  AC_DEFINE(HAVE_LONG_DOUBLE,1,[have long double])
575fi
576
577AC_CACHE_CHECK(checking for quad_t,
578ac_cv_quad_t,
579[
580AC_TRY_COMPILE([
581#include <stdio.h>
582#include <sys/types.h>
583], [printf("%d",sizeof(quad_t));],
584ac_cv_quad_t=yes, ac_cv_quad_t=no)
585])
586if test $ac_cv_quad_t = yes; then
587  AC_DEFINE(HAVE_QUAD_T,1,[have quad_t])
588fi
589
590
591dnl ----------------------------------------------------------------------------
592dnl OS dependency checks
593checklibs=
594case $target_os in
595	 *linux* )
596		no_resolv_lib=yes;
597		case $release in
598changequote(, )dnl
599		2.2.1[0-5]* )
600changequote([, ])dnl
601			AC_DEFINE(SETUID_CHECK,1,[run setuid check])
602			AC_MSG_WARN([Kernel may have SETUID compromise.  Update kernel])
603			;;
604		esac
605		CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
606		CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
607		;;
608	 *bsdi* )
609		LDCC=shlicc
610		dnl BSDI uses this for setproctitle
611		AC_CHECK_LIB(util, setproctitle, [LIBS="-lutil $LIBS"])
612		;;
613	 *bsd* )
614		dnl *BSD uses this for setproctitle
615		AC_CHECK_LIB(util, setproctitle, [LIBS="-lutil $LIBS"])
616		;;
617	 *unicos* )
618		checklibs=no
619		;;
620	 *irix6* )
621		checklibs=no
622		AC_DEFINE_UNQUOTED(IRIX,$version,[IRIX version])
623		;;
624	 *irix5* )
625		checklibs=no
626		AC_DEFINE(HAVE_BROKEN_TIOCEXCL,1,[IRIX broken TIOCEXL])
627		AC_DEFINE(SVR4,1,[SVR4])
628		AC_DEFINE_UNQUOTED(IRIX,$version,[IRIX version])
629		;;
630	 *irix* )
631		checklibs=no
632		AC_DEFINE_UNQUOTED(IRIX,$version,[IRIX version])
633		;;
634	*solaris* )
635		AC_DEFINE(SVR4,1,[SVR4])
636		AC_DEFINE_UNQUOTED(SOLARIS,$version,[Solaris version])
637		no_resolv_lib=yes;
638		;;
639	*hpux* )
640		AC_DEFINE(_HPUX_SOURCE,1,[_HPUX_SOURCE])
641		CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE=1"
642		CFLAGS="$CFLAGS -D_HPUX_SOURCE=1"
643		AC_DEFINE_UNQUOTED(HPUX,$version,[HPUX version])
644		;;
645	*sunos* )
646		AC_DEFINE_UNQUOTED(SUNOS,$version,[Sun OS])
647		;;
648	osf* )
649		AC_DEFINE_UNQUOTED(DECALPHA,$version,[DEC Alpha])
650		if test "$ac_cv_prog_gcc" != yes; then
651			CPPFLAGS="$CPPFLAGS -std";
652			CFLAGS="$CFLAGS -std";
653        else
654            CPPFLAGS="$CPPFLAGS -DAES_SOURCE"
655            CFLAGS="$CFLAGS -DAES_SOURCE"
656		fi
657		;;
658	*mips-sni* )
659		;;
660esac
661AC_MSG_RESULT([using CPPFLAGS=\"${CPPFLAGS}\", CFLAGS=\"${CFLAGS}\"])
662
663dnl ----------------------------------------------------------------------------
664dnl headers:
665
666AC_CHECK_HEADERS(a_out.h aouthdr.h ar.h arpa/inet.h arpa/nameser.h assert.h)
667AC_CHECK_HEADERS(com_err.h compat.h ctype.h ctypes.h dirent.h errno.h)
668AC_CHECK_HEADERS(exechdr.h fcntl.h filehdr.h grp.h limits.h locale.h)
669AC_CHECK_HEADERS(machine/vmparam.h malloc.h memory.h ndir.h netdb.h netinet/in.h)
670AC_CHECK_HEADERS(nlist.h pwd.h reloc.h resolv.h select.h setjmp.h)
671AC_CHECK_HEADERS(sgs.h sgtty.h signal.h stab.h stdarg.h stdio.h)
672AC_CHECK_HEADERS(stdlib.h string.h strings.h sys/dir.h sys/exec.h sys/exechdr.h)
673AC_CHECK_HEADERS(sys/fcntl.h sys/file.h sys/ioctl.h sys/loader.h sys/mount.h sys/ndir.h)
674AC_CHECK_HEADERS(sys/param.h sys/pstat.h sys/resource.h sys/select.h sys/signal.h sys/socket.h)
675AC_CHECK_HEADERS(sys/stat.h sys/statfs.h sys/statvfs.h sys/syslog.h sys/systeminfo.h sys/termio.h)
676AC_CHECK_HEADERS(sys/termiox.h sys/time.h sys/ttold.h sys/ttycom.h sys/types.h sys/utsname.h)
677AC_CHECK_HEADERS(sys/vfs.h sys/wait.h syslog.h term.h termcap.h termio.h)
678AC_CHECK_HEADERS(termios.h time.h unistd.h utsname.h varargs.h vmparam.h)
679
680dnl ----------------------------------------------------------------------------
681dnl libraries:
682
683dnl check to see if we suppress probing for libraries
684dnl this is done by using the checklibs variable
685
686if test -z "$checklibs"; then
687	dnl A/UX uses this...
688	AC_CHECK_LIB(posix, getpwent, [LIBS="$LIBS -lposix"])
689
690	dnl use old-style shared libs if we have 'em.
691	AC_CHECK_LIB(socket_s, socket, [LIBS="$LIBS -lsocket_s"; have_socket=1], ,-lnsl)
692	if test -z "$have_socket"; then
693		AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"], , -lnsl)
694	fi
695
696	AC_TRY_LINK(,[extern int gethostbyaddr; return (gethostbyaddr);],
697		have_gethost=1)
698	if test -z "$have_gethost" ; then
699		h="you need additional libs for gethostbyaddr";
700	else
701		h="no additional libs for gethostbyaddr";
702	fi
703	AC_MSG_RESULT($h)
704	if test -z "$have_gethost" ; then
705		AC_CHECK_LIB(nsl_s, gethostbyaddr, [LIBS="$LIBS -lnsl_s"; have_gethost=1])
706	fi
707	if test -z "$have_gethost"; then
708		AC_CHECK_LIB(nsl, gethostbyaddr, [LIBS="$LIBS -lnsl"; have_gethost=1])
709	fi
710
711	if test -z "$have_gethost"; then
712		AC_CHECK_LIB(net_s, gethostbyaddr, [LIBS="$LIBS -lnet_s"; have_gethost=1])
713	fi
714	if test -z "$have_gethost"; then
715		AC_CHECK_LIB(net, gethostbyaddr, [LIBS="$LIBS -lnet"; have_gethost=1])
716	fi
717
718	dnl BIND library may be needed,  need to force this first
719	if test -z "$no_resolv_lib"; then
720	  AC_CHECK_FUNC(inet_ntop,name2=yes)
721	  if test -z "$name2" ; then
722		AC_CHECK_LIB(resolv, inet_ntop, [LIBS="$LIBS -lresolv";name2=yes])
723	  fi;
724	fi
725fi
726
727dnl ----------------------------------------------------------------------------
728dnl function checks:
729
730AC_CHECK_FUNCS(_res cfsetispeed fcntl flock gethostbyname2 getdtablesize)
731AC_CHECK_FUNCS(gethostname getrlimit inet_aton inet_ntop inet_pton)
732AC_CHECK_FUNCS(innetgr initgroups killpg lockf mkstemp)
733AC_CHECK_FUNCS(mktemp openlog putenv random rand setenv seteuid setgroups setlocale setpgid setproctitle)
734AC_CHECK_FUNCS(setresuid setreuid setruid setsid sigaction)
735AC_CHECK_FUNCS(sigprocmask siglongjmp socketpair strcasecmp)
736AC_CHECK_FUNCS(strchr strdup strerror strncasecmp sysconf sysinfo)
737AC_CHECK_FUNCS(tcdrain tcflush tcsetattr uname unsetenv wait3 waitpid)
738
739if test ! "$ac_cv_func_setreuid" = yes -a ! "$ac_cv_func_seteuid" = yes -a ! "$ac_cv_func_setresuid" = yes; then
740	echo "WARNING: missing setreuid(), seteuid(), and setresuid()"
741fi
742
743AC_FUNC_VFORK
744AC_FUNC_VPRINTF
745
746
747dnl ----------------------------------------------------------------------------
748dnl special system checks
749
750AC_CACHE_CHECK(how to manipulate tty attributes,
751ac_cv_struct_term,
752[
753
754if test "$ac_cv_header_termios_h" = yes; then
755	ac_cv_struct_term=termios
756fi
757if test "$ac_cv_header_sys_termios_h" = yes; then
758	ac_cv_struct_term=termios
759fi
760
761dnl test to see if we need to compile
762if test -z "$ac_cv_struct_term" ; then
763AC_TRY_COMPILE([
764#ifdef HAVE_TERMIO_H
765#include <termio.h>
766#endif
767#ifdef HAVE_SYS_TERMIO_H
768#include <sys/termio.h>
769#endif],[struct termio t;t.c_iflag = 0],
770ac_cv_struct_term=termio)
771fi
772
773dnl now you have determined if you have termio
774if test -z "$ac_cv_struct_term" ; then
775    AC_TRY_COMPILE([#include <sgtty.h>],[
776    struct sgttyb s;s.sg_flags = 0],
777    ac_cv_struct_term=sgttyb)
778fi
779if test -z "$ac_cv_struct_term" ; then
780	ac_cv_struct_term=UNDEFINED
781fi
782])
783if test "$ac_cv_struct_term" = "sgttyb"; then
784	AC_DEFINE(USE_SGTTYB,1,[use sgttyb])
785	AC_DEFINE(USE_STTY,SGTTYB,[use sgttyb])
786fi
787if test "$ac_cv_struct_term" = "termio"; then
788	AC_DEFINE(USE_TERMIO,1,[use termio])
789	AC_DEFINE(USE_STTY,TERMIO,[use termio])
790fi
791if test "$ac_cv_struct_term" = "termios"; then
792	AC_DEFINE(USE_TERMIOS,1,[use termios])
793	AC_DEFINE(USE_STTY,TERMIOS,[use termios])
794	if test "$ac_cv_header_sys_termiox_h" = yes; then
795		AC_DEFINE(USE_TERMIOX,1,[use termiox])
796	fi
797fi
798
799dnl ----------------------------------------------------------------------------
800
801AC_CACHE_CHECK(checking for struct exec,
802ac_cv_struct_exec,
803[
804ac_cv_struct_exec=no
805if test "$ac_cv_header_a_out_h" != no ; then
806  AC_TRY_COMPILE([
807#include <sys/types.h>
808#include <a.out.h>],[struct exec b; b.a_text = 0],
809	ac_cv_struct_exec=yes, ac_cv_struct_exec=no )
810fi
811])
812if test "$ac_cv_struct_exec" = yes; then
813  AC_DEFINE(HAVE_STRUCT_EXEC,1,[have struct exec])
814fi
815
816dnl ----------------------------------------------------------------------------
817
818dnl test to see if long long is defined
819
820AC_CACHE_CHECK(checking for long long,
821ac_cv_long_long,
822[
823AC_TRY_COMPILE([
824#include <sys/types.h>
825],[long long x; x = 0],
826ac_cv_long_long=yes, ac_cv_long_long=no)
827])
828if test "$ac_cv_long_long" = yes; then
829  AC_DEFINE(HAVE_LONG_LONG,1,[have long long])
830fi
831
832dnl ----------------------------------------------------------------------------
833
834dnl test to see if lseek has a prototype - you make it get an error
835
836AC_CACHE_CHECK(checking for lseek prototype,
837ac_cv_lseek_proto,
838[
839AC_TRY_COMPILE([
840#ifdef HAVE_CTYPES_H
841#include <ctypes.h>
842#endif
843#ifdef HAVE_SYS_TYPES_H
844#include <sys/types.h>
845#endif
846#ifdef HAVE_SYS_UNISTD_H
847#include <sys/unistd.h>
848#endif
849],[off_t x; x = lseek(0,"test",SEEK_SET);],
850ac_cv_lseek_proto=no, ac_cv_lseek_proto=yes)
851])
852if test "$ac_cv_lseek_proto" = yes; then
853  AC_DEFINE(HAVE_LSEEK_PROTO,1,[have lseek definition])
854fi
855
856dnl ----------------------------------------------------------------------------
857
858AC_CACHE_CHECK(how to get filesystem free space,
859ac_cv_struct_fstype,
860[
861fstype=
862
863dnl do this check if statvfs is a valid function
864if test "$ac_cv_func_statvfs" != no ; then		#{
865  AC_TRY_COMPILE([
866#ifdef HAVE_CTYPES_H
867#include <ctypes.h>
868#endif
869#include <sys/types.h>
870#include <sys/param.h>
871#ifdef HAVE_SYS_STATVFS_H
872# include <sys/statvfs.h>
873#endif
874#ifdef HAVE_SYS_STATFS_H
875# include <sys/statfs.h>
876#endif
877
878#ifdef HAVE_SYS_MOUNT_H
879# include <sys/mount.h>
880#endif
881#ifdef HAVE_SYS_VFS_H
882# include <sys/vfs.h>
883#endif],[struct statvfs s; statvfs ("/", &s); return(s.f_bavail+s.f_bsize)],
884  fstype=statvfs)
885fi							#}
886
887dnl do these checks if statfs is a valid function
888
889if test "$ac_cv_func_statfs" != no ; then		#{
890  if test -z "$fstype" ; then				#{
891    AC_TRY_COMPILE([
892#ifdef HAVE_CTYPES_H
893#include <ctypes.h>
894#endif
895#include <sys/types.h>
896#include <sys/param.h>
897#ifdef HAVE_SYS_STATFS_H
898# include <sys/statfs.h>
899#endif
900
901#ifdef HAVE_SYS_STATVFS_H
902# include <sys/statvfs.h>
903#endif
904#ifdef HAVE_SYS_MOUNT_H
905# include <sys/mount.h>
906#endif
907#ifdef HAVE_SYS_VFS_H
908# include <sys/vfs.h>
909#endif],[struct fs_data s; return(s.fd_bfree+s.fd_bsize)],
910    fstype=Ultrix-statfs)
911  fi							#}
912
913  if test -z "$fstype" ; then				#{
914    AC_TRY_COMPILE([
915#ifdef HAVE_CTYPES_H
916#include <ctypes.h>
917#endif
918#include <sys/types.h>
919#include <sys/param.h>
920#ifdef HAVE_SYS_STATFS_H
921#include <sys/statfs.h>
922#endif
923#ifdef HAVE_SYS_MOUNT_H
924#include <sys/mount.h>
925#endif
926#ifdef HAVE_SYS_VFS_H
927#include <sys/vfs.h>
928#endif],[struct statfs s; return(s.f_bavail+s.f_bsize)],
929    fstype=statfs)
930  fi							# }
931
932  if test -z "$fstype" ; then				# {
933    AC_TRY_COMPILE([
934#ifdef HAVE_CTYPES_H
935#include <ctypes.h>
936#endif
937#include <sys/types.h>
938#include <sys/param.h>
939#ifdef HAVE_SYS_STATFS_H
940#include <sys/statfs.h>
941#endif
942#ifdef HAVE_SYS_MOUNT_H
943#include <sys/mount.h>
944#endif
945#ifdef HAVE_SYS_VFS_H
946#include <sys/vfs.h>
947#endif],[struct statfs s; return(s.f_bfree+s.f_bsize)],
948    fstype=SVR3-statfs)
949  fi							# }
950fi							# }
951
952if test -z "$fstype" ; then
953    echo "cannot find a valid statfs-like structure!"
954	fstype=UNKNOWN
955fi
956
957ac_cv_struct_fstype=$fstype
958
959])
960
961if test "$ac_cv_struct_fstype" = SVR3-statfs; then
962	AC_DEFINE(USE_STATFS_TYPE,SVR3_STATFS,[svr3 statfs])
963fi
964if test "$ac_cv_struct_fstype" = Ultrix-statfs; then
965	AC_DEFINE(USE_STATFS_TYPE,ULTRIX_STATFS,[ultix statfs])
966fi
967if test "$ac_cv_struct_fstype" = statfs; then
968	AC_DEFINE(USE_STATFS_TYPE,STATFS,[plain statfs])
969fi
970if test "$ac_cv_struct_fstype" = statvfs; then
971	AC_DEFINE(USE_STATFS_TYPE,STATVFS,[statvfs statfs])
972fi
973
974dnl ----------------------------------------------------------------------------
975dnl
976
977AC_CACHE_CHECK(for errno,
978ac_cv_errno,
979[
980AC_TRY_LINK(,[extern int errno; return (errno);],
981	ac_cv_errno=yes, ac_cv_errno=no)
982])
983if test "$ac_cv_errno" = yes; then
984	AC_DEFINE(HAVE_ERRNO,1,[have errno])
985	AC_CACHE_CHECK(for errno declaration,
986	ac_cv_decl_errno,
987	[
988	AC_TRY_COMPILE([
989	#include <stdio.h>
990	#ifdef HAVE_STDLIB_H
991	#include <stdlib.h>
992	#endif
993	#ifdef HAVE_UNISTD_H
994	#include <unistd.h>
995	#endif
996	#ifdef HAVE_ERRNO_H
997	#include <errno.h>
998	],[return(sys_nerr);],
999		ac_cv_decl_errno=yes, ac_cv_decl_errno=no)
1000	])
1001	if test "$ac_cv_decl_errno" = yes; then
1002		AC_DEFINE(HAVE_DECL_ERRNO,1,[have errno declaration])
1003	fi;
1004fi
1005
1006AC_CACHE_CHECK(for sys_nerr,
1007ac_cv_sys_nerr,
1008[
1009AC_TRY_LINK(,[extern int sys_nerr; return (sys_nerr);],
1010	ac_cv_sys_nerr=yes, ac_cv_sys_nerr=no)
1011])
1012if test "$ac_cv_sys_nerr" = yes; then
1013	AC_DEFINE(HAVE_SYS_NERR,1,[have sys_nerr])
1014	AC_CACHE_CHECK(for sys_nerr declaration,
1015	ac_cv_decl_sys_nerr,
1016	[
1017	AC_TRY_COMPILE([
1018	#include <stdio.h>
1019	#ifdef HAVE_STDLIB_H
1020	#include <stdlib.h>
1021	#endif
1022	#ifdef HAVE_UNISTD_H
1023	#include <unistd.h>
1024	#endif],[return(sys_nerr);],
1025	ac_cv_decl_sys_nerr_def=yes, ac_cv_decl_sys_nerr_def=no)
1026	])
1027	if test "$ac_cv_decl_sys_nerr" = yes; then
1028		AC_DEFINE(HAVE_DECL_SYS_NERR,1,[have sys_nerr declaration])
1029	fi
1030fi
1031
1032AC_CACHE_CHECK(for sys_errlist array,
1033ac_cv_sys_errlist,
1034[AC_TRY_LINK(,[extern char *sys_errlist[];
1035	sys_errlist[0];],
1036	ac_cv_sys_errlist=yes, ac_cv_sys_errlist=no)
1037])
1038if test "$ac_cv_sys_errlist" = yes; then
1039	AC_DEFINE(HAVE_SYS_ERRLIST,1,[have sys_errlist])
1040	AC_CACHE_CHECK(for sys_errlist declaration,
1041	ac_cv_sys_errlist_def,
1042	[AC_TRY_COMPILE([
1043	#include <stdio.h>
1044	#include <errno.h>
1045	#ifdef HAVE_STDLIB_H
1046	#include <stdlib.h>
1047	#endif
1048	#ifdef HAVE_UNISTD_H
1049	#include <unistd.h>
1050	#endif],[char *s = sys_errlist[0]; return(*s);],
1051	ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)
1052	])
1053	if test "$ac_cv_decl_sys_errlist" = yes; then
1054		AC_DEFINE(HAVE_DECL_SYS_ERRLIST,1,[sys_errlist declared])
1055	fi
1056fi
1057
1058
1059AC_CACHE_CHECK(for setproctitle declaration,
1060ac_cv_decl_setproctitle_def,
1061[AC_TRY_COMPILE([
1062#include <stdio.h>
1063#ifdef HAVE_STDLIB_H
1064#include <stdlib.h>
1065#endif
1066#ifdef HAVE_UNISTD_H
1067#include <unistd.h>
1068#endif
1069#ifdef HAVE_ERRNO_H
1070#include <errno.h>
1071#endif
1072],[setproctitle(0);],
1073ac_cv_decl_setproctitle_def=no, ac_cv_decl_setproctitle_def=yes)
1074])
1075if test "$ac_cv_decl_setproctitle_def" = yes; then
1076    AC_DEFINE(HAVE_SETPROCTITLE_DEF,1,[setproctitle defined])
1077fi
1078
1079
1080dnl ----------------------------------------------------------------------------
1081dnl sys_siglist array (list of signals)
1082
1083AC_CACHE_CHECK(for sys_siglist declaration,
1084ac_cv_decl_sys_siglist_def,
1085[AC_TRY_COMPILE([
1086#include <stdio.h>
1087#include <sys/types.h>
1088#ifdef HAVE_STDLIB_H
1089#include <stdlib.h>
1090#endif
1091#ifdef HAVE_UNISTD_H
1092#include <unistd.h>
1093#endif
1094#include <signal.h>],
1095[printf("%s",sys_siglist[0]);],
1096ac_cv_decl_sys_siglist_def=yes, ac_cv_decl_sys_siglist_def=no)
1097])
1098if test "$ac_cv_decl_sys_siglist_def" = yes; then
1099    AC_DEFINE(HAVE_SYS_SIGLIST_DEF,1,[sys_siglist defined])
1100	ac_cv_sys_siglist=yes
1101fi
1102
1103AC_CACHE_CHECK(for _sys_siglist declaration,
1104ac_cv_decl__sys_siglist_def,
1105[AC_TRY_COMPILE([
1106#include <stdio.h>
1107#include <sys/types.h>
1108#ifdef HAVE_STDLIB_H
1109#include <stdlib.h>
1110#endif
1111#ifdef HAVE_UNISTD_H
1112#include <unistd.h>
1113#endif
1114#include <signal.h>],
1115[printf("%s",_sys_siglist[0]);],
1116ac_cv_decl__sys_siglist_def=yes, ac_cv_decl__sys_siglist_def=no)
1117])
1118if test "$ac_cv_decl__sys_siglist_def" = yes; then
1119    AC_DEFINE(HAVE__SYS_SIGLIST_DEF,1,[_sys_siglist defined])
1120	ac_cv__sys_siglist=yes
1121fi
1122
1123AC_CACHE_CHECK(for sys_siglist array,
1124ac_cv_sys_siglist,
1125[AC_TRY_LINK([
1126#include <stdio.h>],
1127[extern int sys_siglist; printf("%d",sys_siglist);],
1128ac_cv_sys_siglist=yes, ac_cv_sys_siglist=no)
1129])
1130if test "$ac_cv_sys_siglist" = yes; then
1131    AC_DEFINE(HAVE_SYS_SIGLIST,1,[have sys_syslist])
1132fi
1133
1134AC_CACHE_CHECK(for _sys_siglist array,
1135ac_cv__sys_siglist,
1136[AC_TRY_LINK([
1137#include <stdio.h>],
1138[extern int _sys_siglist; printf("%d",_sys_siglist);],
1139ac_cv__sys_siglist=yes, ac_cv__sys_siglist=no)
1140])
1141if test "$ac_cv__sys_siglist" = yes; then
1142    AC_DEFINE(HAVE__SYS_SIGLIST,1,[have _sys_siglist])
1143fi
1144
1145dnl ----------------------------------------------------------------------------
1146dnl just for (really) backwards compatibility
1147dnl we really try not to use union wait -- it's heinously unportable.
1148dnl nicked this check from Tcl as well. ;
1149dnl
1150dnl The check below checks whether <sys/wait.h> defines the type
1151dnl "union wait" correctly.  It's needed because of weirdness in
1152dnl HP-UX where "union wait" is defined in both the BSD and SYS-V
1153dnl environments.  Checking the usability of WIFEXITED seems to do
1154dnl the trick.
1155
1156AC_CACHE_CHECK(for obsolete union wait compatibility,
1157ac_cv_unionwait,
1158[
1159AC_TRY_COMPILE([
1160#ifdef HAVE_CTYPES_H
1161#include <ctypes.h>
1162#endif
1163#include <sys/types.h>
1164#include <sys/wait.h>], [union wait x;WIFEXITED(x);],
1165ac_cv_unionwait=yes, ac_cv_unionwait=no)
1166])
1167if test "$ac_cv_unionwait" = yes; then
1168	AC_DEFINE(HAVE_UNION_WAIT,1,[have union wait])
1169fi
1170
1171dnl ----------------------------------------------------------------------------
1172dnl Would you believe the gethostname declarations are broken on some machines
1173dnl ----------------------------------------------------------------------------
1174AC_CACHE_CHECK(for gethostname declaration,
1175ac_cv_decl_gethostname_def,
1176[AC_TRY_COMPILE([
1177#ifdef HAVE_CTYPES_H
1178#include <ctypes.h>
1179#endif
1180#ifdef HAVE_STDIO_H
1181#include <stdio.h>
1182#endif
1183#ifdef HAVE_STDLIB_H
1184#include <stdlib.h>
1185#endif
1186#ifdef HAVE_UNISTD_H
1187#include <unistd.h>
1188#endif],[gethostname(1);],
1189ac_cv_decl_gethostname_def=no, ac_cv_decl_gethostname_def=yes)
1190])
1191if test "$ac_cv_decl_gethostname_def" = yes; then
1192    AC_DEFINE(HAVE_GETHOSTNAME_DEF,1,[have gethostname definition])
1193fi
1194
1195dnl ----------------------------------------------------------------------------
1196dnl innetgr() declarations missing
1197dnl ----------------------------------------------------------------------------
1198AC_CACHE_CHECK(for innetgr declaration,
1199ac_cv_decl_innetgr_def,
1200[
1201AC_TRY_COMPILE([
1202#ifdef HAVE_CTYPES_H
1203#include <ctypes.h>
1204#endif
1205#ifdef HAVE_STDIO_H
1206#include <stdio.h>
1207#endif
1208#ifdef HAVE_STDLIB_H
1209#include <stdlib.h>
1210#endif
1211#ifdef HAVE_UNISTD_H
1212#include <unistd.h>
1213#endif
1214#ifdef HAVE_NETDB_H
1215#include <netdb.h>
1216#endif],[printf("%d", innetgr(1));],
1217ac_cv_decl_innetgr_def=no, ac_cv_decl_innetgr_def=yes )
1218]
1219)
1220if test "$ac_cv_decl_innetgr_def" = yes; then
1221  AC_DEFINE(HAVE_INNETGR_DEF,1,[use innetgr(1)])
1222fi
1223
1224dnl ----------------------------------------------------------------------------
1225dnl openlog() declarations missing
1226dnl ----------------------------------------------------------------------------
1227AC_CACHE_CHECK(for openlog declaration,
1228ac_cv_decl_openlog_def,
1229[AC_TRY_COMPILE([
1230#include <stdio.h>
1231#ifdef HAVE_CTYPES_H
1232#include <ctypes.h>
1233#endif
1234#ifdef HAVE_STDARG_H
1235#include <stdarg.h>
1236#endif
1237#ifdef HAVE_SYSLOG_H
1238#include <syslog.h>
1239#endif],[printf("%d",openlog);],
1240ac_cv_decl_openlog_def=yes, ac_cv_decl_openlog_def=no)
1241])
1242if test "$ac_cv_decl_openlog_def" = yes; then
1243    AC_DEFINE(HAVE_OPENLOG_DEF,1,[have openlog definition])
1244fi
1245
1246
1247dnl ----------------------------------------------------------------------------
1248dnl syslog() declarations missing
1249dnl ----------------------------------------------------------------------------
1250AC_CACHE_CHECK(for syslog declaration,
1251ac_cv_decl_syslog_def,
1252[AC_TRY_COMPILE([
1253#include <stdio.h>
1254#ifdef HAVE_STDARG_H
1255#include <stdarg.h>
1256#endif
1257#ifdef HAVE_SYSLOG_H
1258#include <syslog.h>
1259#endif],[printf("%d",syslog);],
1260ac_cv_decl_syslog_def=yes, ac_cv_decl_syslog_def=no)
1261])
1262if test "$ac_cv_decl_syslog_def" = yes; then
1263    AC_DEFINE(HAVE_SYSLOG_DEF,1,[have syslog definition])
1264fi
1265
1266dnl ----------------------------------------------------------------------------
1267dnl IPV6 - check for structure declarations
1268dnl ----------------------------------------------------------------------------
1269
1270AC_CACHE_CHECK(for struct in6_addr declaration,
1271ac_cv_decl_in6_addr_def,
1272[AC_TRY_COMPILE([
1273#ifdef HAVE_CTYPES_H
1274#include <ctypes.h>
1275#endif
1276#include <sys/types.h>
1277#include <sys/socket.h>
1278#include <netinet/in.h>],[struct in6_addr v;],
1279ac_cv_decl_in6_addr_def=yes, ac_cv_decl_in6_addr_def=no)
1280])
1281if test "$ac_cv_decl_in6_addr_def" = yes; then
1282    AC_DEFINE(IN6_ADDR,1,[in6_addr defined])
1283fi
1284
1285
1286AC_CACHE_CHECK([for struct in_addr6 declaration (LINUX)],
1287ac_cv_decl_in_addr6_def,
1288[AC_TRY_COMPILE([
1289#ifdef HAVE_CTYPES_H
1290#include <ctypes.h>
1291#endif
1292#include <sys/types.h>
1293#include <sys/socket.h>
1294#include <netinet/in.h>],[struct in_addr6 v;],
1295ac_cv_decl_in_addr6_def=yes, ac_cv_decl_in_addr6_def=no)
1296])
1297if test "$ac_cv_decl_in_addr6_def" = yes; then
1298    AC_DEFINE(IN_ADDR6,1,[in_addr6 defined])
1299fi
1300
1301dnl ----------------------------------------------------------------------------
1302dnl struct stat can have a st_mtime_nsec field
1303dnl ----------------------------------------------------------------------------
1304
1305
1306AC_CACHE_CHECK(for struct stat has st_mtimespec.tv_nsec,
1307ac_cv_decl_st_mtimespec_tv_nsec,
1308[AC_TRY_COMPILE([
1309#ifdef HAVE_CTYPES_H
1310#include <ctypes.h>
1311#endif
1312#include <sys/types.h>
1313#ifdef HAVE_SYS_TIME_H
1314#include <sys/time.h>
1315#endif
1316#include <sys/stat.h>],[struct stat statb; statb.st_mtimespec.tv_nsec;],
1317ac_cv_decl_st_mtimespec_tv_nsec=yes,
1318ac_cv_decl_st_mtimespec_tv_nsec=no)
1319])
1320if test "$ac_cv_decl_st_mtimespec_tv_nsec" = yes; then
1321    AC_DEFINE_UNQUOTED(ST_MTIMESPEC_TV_NSEC,1,[stat st_mtimespec.tv_nsec present])
1322fi
1323
1324AC_CACHE_CHECK(for struct stat has st_mtimensec,
1325ac_cv_decl_st_mtimensec,
1326[AC_TRY_COMPILE([
1327#ifdef HAVE_CTYPES_H
1328#include <ctypes.h>
1329#endif
1330#include <sys/types.h>
1331#if defined(HAVE_SYS_TIME_H)
1332#include <sys/time.h>
1333#endif
1334#include <sys/stat.h>],[struct stat statb; statb.st_mtimensec;],
1335ac_cv_decl_st_mtimensec=yes,
1336ac_cv_decl_st_mtimensec=no)
1337])
1338if test "$ac_cv_decl_st_mtimensec" = yes; then
1339    AC_DEFINE_UNQUOTED(ST_MTIMENSEC,1,[struct st_mtimensec present])
1340fi
1341
1342dnl ----------------------------------------------------------------------------
1343
1344AC_CACHE_CHECK(for strcasecmp definition,
1345ac_cv_decl_strcasecmp,
1346[AC_TRY_COMPILE([
1347#ifdef HAVE_CTYPES_H
1348#include <ctypes.h>
1349#endif
1350#if defined(HAVE_STDLIB_H)
1351#include <stdlib.h>
1352#endif
1353#if defined(HAVE_STRING_H)
1354#include <string.h>
1355#endif
1356#if defined(HAVE_STRINGS_H)
1357#include <strings.h>
1358#endif
1359],[strcasecmp(1)],
1360ac_cv_decl_strcasecmp=no,
1361ac_cv_decl_strcasecmp=yes)
1362])
1363if test "$ac_cv_decl_strcasecmp" = yes; then
1364    AC_DEFINE_UNQUOTED(HAVE_STRCASECMP_DEF,1,[have strcasecmp definition])
1365fi
1366
1367dnl ----------------------------------------------------------------------------
1368
1369AC_CACHE_CHECK(for flock definition,
1370ac_cv_decl_flock,
1371[AC_TRY_COMPILE([
1372#ifdef HAVE_CTYPES_H
1373#include <ctypes.h>
1374#endif
1375#if defined(HAVE_STDLIB_H)
1376#include <stdlib.h>
1377#endif
1378#if defined(HAVE_SYS_FILE_H)
1379#include <sys/file.h>
1380#endif
1381#if defined(HAVE_FCNTL_H)
1382#include <fcntl.h>
1383#endif
1384],[flock(1)],
1385ac_cv_decl_flock=no,
1386ac_cv_decl_flock=yes)
1387])
1388if test "$ac_cv_decl_flock" = yes; then
1389    AC_DEFINE_UNQUOTED(HAVE_FLOCK_DEF,1,[have flock definition])
1390fi
1391
1392dnl ----------------------------------------------------------------------------
1393
1394AC_PROG_INSTALL
1395AC_CHECK_PROG(INSTALL_MAN,auxman,auxman,[$INSTALL -m 644])
1396
1397AC_PROG_MAKE_SET
1398
1399dnl ----------------- force this to be Bourne Shell for now ---------------
1400AC_MSG_CHECKING(for shell)
1401SHELL=/bin/sh
1402AC_MSG_RESULT(using $SHELL (FORCED))
1403
1404AM_GNU_GETTEXT([external])
1405
1406dnl XX AC_MSG_RESULT([LIBS $LIBS, INTLLIBS $INTLLIBS])
1407dnl XX  if test "${USE_NLS}" = yes; then
1408dnl XX    AC_MSG_RESULT([Using NLS, localedir ${LOCALEDIR}, need intl/libintl.a - "${USE_INCLUDED_LIBINTL}" ])
1409dnl XX    if test "${USE_INCLUDED_LIBINTL}" = yes ; then
1410dnl XX       CPPFLAGS="$CPPFLAGS -I \${top_builddir}/intl"
1411dnl XX 	  AC_MSG_RESULT([using \${top_builddir}/intl])
1412dnl XX 	  if test "$nls_cv_force_use_gnu_gettext" = no ; then
1413dnl XX 		echo "NLS enabled and requested system gettext support not available."
1414dnl XX 		echo " You may need to use:"
1415dnl XX 		echo "  configure 'CPPFLAGS=-I/usr/local/include' 'LDFLAGS=-L/usr/local/lib'"
1416dnl XX 		echo " See ${srcdir}/ABOUT-NLS.LPRng in the LPRng distribution for details."
1417dnl XX 		exit 1;
1418dnl XX       fi
1419dnl XX 	  if test ! -f ${srcdir}/intl/gettext.h ; then
1420dnl XX 		echo "gettext code is not in the ${srcdir}/intl directory."
1421dnl XX 		echo "See ${srcdir}/ABOUT-NLS.LPRng in the LPRng distribution for details."
1422dnl XX 		exit 1;
1423dnl XX 	  fi
1424dnl XX    fi
1425dnl XX    LIBS="$INTLLIBS $LIBS"
1426dnl XX  else
1427dnl XX    AC_MSG_RESULT([No NLS])
1428dnl XX  fi   
1429dnl XX  if test "$XGETTEXT" = "" ; then
1430dnl XX 	 XGETTEXT=xgettext;
1431dnl XX  fi
1432dnl XX  AC_MSG_RESULT(using XGETTEXT $XGETTEXT)
1433
1434
1435if test "${enable_nls}" = yes -a "$nls_cv_force_use_gnu_gettext" != yes \
1436	-a "$gt_use_preinstalled_gnugettext" != "yes" ; then
1437	   AC_MSG_ERROR([
1438NLS enabled and requested system gettext support not available.
1439You may need to use:
1440configure 'CPPFLAGS=-I/usr/local/include' 'LDFLAGS=-L/usr/local/lib'
1441See ABOUT-NLS.LPRng in the LPRng distribution for details.
1442])
1443fi
1444AC_MSG_RESULT([LIBS $LIBS, INTLLIBS $INTLLIBS])
1445
1446dnl ----------------------------------------------------------------------------
1447dnl ----------------- END OF GENERAL CONFIGURATION   ---------------------------
1448
1449dnl check to see if tcp wrappers required
1450AC_MSG_CHECKING(use tcp wrappers)
1451AC_ARG_ENABLE( tcpwrappers,
1452[  --enable-tcpwrappers             use tcp wrappers (-lwrap)],
1453[
1454if test "$enableval" = "yes" ; then
1455 v=yes
1456 AC_CHECK_HEADERS(tcpd.h,
1457  [AC_DEFINE(HAVE_TCPD_H,1,[have tcpd])],
1458  [AC_MSG_ERROR(tcpd.h not found);
1459   v=no;
1460  ]
1461 )
1462 AC_CHECK_LIB(wrap, request_init,
1463  [LIBS="-lwrap $LIBS"],
1464  [AC_MSG_ERROR(request_init not found in -wrap library);
1465   v=no;
1466  ]
1467 )
1468else
1469 v=no;
1470fi
1471],
1472[
1473 v=no;
1474]
1475)
1476
1477if test "$v" = "yes" ; then
1478	 AC_DEFINE(TCPWRAPPERS,1,[tcpwrappers])
1479fi
1480AC_MSG_RESULT($v);dnl
1481
1482dnl check to see if ssl is disabled
1483AC_MSG_CHECKING(if ssl authentication is disabled)
1484AC_ARG_ENABLE( ssl,
1485[  --disable-ssl                 disable ssl support],
1486[
1487if test "$enableval" = "yes" ; then
1488	v=enabled;  SSL_ENABLE=1;
1489else
1490	v=disabled; SSL_ENABLE=;
1491fi
1492],
1493[
1494	v=enabled;  SSL_ENABLE=1;
1495],
1496)
1497AC_MSG_RESULT($v);dnl
1498
1499dnl Now look for OpenSSL
1500ac_openssl_lib_dir=
1501ac_openssl_inc_dir=
1502if test "$SSL_ENABLE" != ""; then
1503
1504	dnl See if we can find OpenSSL
1505	dnl We can compile without OpenSSL if we have to
1506	ac_openssl_lib_dir="/usr/lib /usr/local /usr/local/ssl /usr/local/ssl/lib /usr/pkg"
1507	ac_openssl_inc_dir="/usr/include /usr/local /usr/local/ssl /usr/pkg /usr/local/ssl/include"
1508
1509	AC_ARG_WITH(openssl,
1510	[  --with-openssl=DIR          root location for OpenSSL],
1511	[
1512		ac_openssl_lib_dir="$withval/lib $withval"
1513		ac_openssl_inc_dir="$withval/include $withval"
1514	]
1515	)
1516
1517	AC_ARG_WITH(openssl-inc,
1518	[  --with-openssl-inc        OpenSSL include files],
1519		ac_openssl_inc_dir=$withval
1520	)
1521	AC_ARG_WITH(openssl-lib,
1522	[  --with-openssl-lib        OpenSSL library files],
1523		ac_openssl_lib_dir=$withval
1524	)
1525
1526	ac_found_openssl_inc_dir="no"
1527	AC_MSG_CHECKING(for OpenSSL include files)
1528	for dir in $ac_openssl_inc_dir; do
1529		if test -f $dir/openssl/ssl.h; then
1530		   ac_found_openssl_inc_dir=$dir
1531		   break
1532		fi
1533        done
1534	if test "$ac_found_openssl_inc_dir" != "no"; then
1535	   	echo "found in $ac_found_openssl_inc_dir"
1536	else
1537		echo "not found."
1538		SSL_ENABLE=""
1539	fi
1540fi
1541
1542if test "$SSL_ENABLE" != ""; then
1543	ac_found_openssl_lib_dir="no"
1544	AC_MSG_CHECKING(for OpenSSL libraries)
1545	for dir in $ac_openssl_lib_dir; do
1546		found_ssl="false"
1547		if test -f $dir/libssl.a -a -f $dir/libcrypto.a; then
1548		  found_ssl="true"
1549		fi
1550		if test -f $dir/libssl.so -a -f $dir/libcrypto.so; then
1551		  found_ssl="true"
1552		fi
1553		if $found_ssl != "false"; then
1554		dnl Ok, we think we've found them, but check that they
1555		dnl actually ontain the right functions
1556		save_LIBS=$LIBS
1557		save_LDFLAGS=$LDFLAGS
1558		LIBS="-lssl -lcrypto $LIBS"
1559		LDFLAGS="$LDFLAGS -L$dir "
1560		AC_TRY_LINK_FUNC(SSL_load_error_strings,ac_linked_libssl="true",
1561			ac_linked_libssl="false");
1562		AC_TRY_LINK_FUNC(RC4_set_key,ac_linked_libcrypto="true",
1563			ac_linked_libcrypto="false");
1564		if test "$ac_linked_libssl" != "false" -a \
1565			"$ac_linked_libcrypto" != "false"; then
1566				ac_found_openssl_lib_dir=$dir
1567				break
1568		fi
1569		LIBS=$save_LIBS
1570		LDFLAGS=$save_LDFLAGS
1571		fi
1572	done
1573	if test "$ac_found_openssl_lib_dir" != "no"; then
1574	   	echo "found in $ac_found_openssl_lib_dir"
1575		CPPFLAGS="$CPPFLAGS -I$ac_found_openssl_inc_dir " ;
1576	else
1577		echo "not found."
1578		SSL_ENABLE=""
1579	fi
1580fi
1581
1582test "$SSL_ENABLE" != "" && AC_DEFINE(SSL_ENABLE,1,[ssl enabled])
1583
1584
1585dnl  ssl certificate authority CERT file
1586dnl
1587AC_MSG_CHECKING(ssl Certificate Authority CERT file)
1588AC_ARG_WITH(ssl_ca_file,
1589[  --with-ssl_ca_file=FILE     ssl Certificate Authority CERT file (default \${sysconfdir}/lpd/ssl.ca/ca.crt)],
1590SSL_CA_FILE=$withval,
1591SSL_CA_FILE=\${sysconfdir}/lpd/ssl.ca/ca.crt,
1592)
1593AC_MSG_RESULT($SSL_CA_FILE)
1594AC_SUBST(SSL_CA_FILE)
1595
1596dnl  ssl certificate authority private key file
1597dnl
1598AC_MSG_CHECKING(ssl Certificate Authority private key file)
1599AC_ARG_WITH(ssl_ca_key,
1600[  --with-ssl_ca_key=KEY     ssl Certificate Authority private key file (default \${sysconfdir}/lpd/ssl.ca/ca.key)],
1601SSL_CA_KEY=$withval,
1602SSL_CA_KEY=\${sysconfdir}/lpd/ssl.ca/ca.key,
1603)
1604AC_MSG_RESULT($SSL_CA_KEY)
1605AC_SUBST(SSL_CA_KEY)
1606
1607dnl  ssl certificate authority certs working directory
1608dnl
1609AC_MSG_CHECKING(ssl Certificate Authority certs working directory)
1610AC_ARG_WITH(ssl_certs_dir,
1611[  --with-ssl_certs_dir=DIR     ssl Certificate Authority certs working directory (default \${sysconfdir}/lpd/ssl.certs/)],
1612SSL_CERTS_DIR=$withval,
1613SSL_CERTS_DIR=\${sysconfdir}/lpd/ssl.certs,
1614)
1615AC_MSG_RESULT($SSL_CERTS_DIR)
1616AC_SUBST(SSL_CERTS_DIR)
1617
1618dnl  ssl certificate revocation list
1619dnl
1620AC_MSG_CHECKING(ssl Certificate Revocation List (CRL) file)
1621AC_ARG_WITH(ssl_crl_file,
1622[  --with-ssl_crl_file=PATH     ssl Certificate Revocation List File (default \${sysconfdir}/lpd/ssl.crl/ssl.crl)],
1623SSL_CRL_FILE=$withval,
1624SSL_CRL_FILE=\${sysconfdir}/lpd/ssl.crl/ssl.crl,
1625)
1626AC_MSG_RESULT($SSL_CRL_FILE)
1627AC_SUBST(SSL_CRL_FILE)
1628
1629dnl  ssl server certificate file
1630dnl
1631AC_MSG_CHECKING(ssl server certificate file)
1632AC_ARG_WITH(ssl_server_cert,
1633[  --with-ssl_server_cert=FILE     ssl server certificate file (default \${sysconfdir}/lpd/ssl.server/server.crt)],
1634SSL_SERVER_CERT=$withval,
1635SSL_SERVER_CERT=\${sysconfdir}/lpd/ssl.server/server.crt,
1636)
1637AC_MSG_RESULT($SSL_SERVER_CERT)
1638AC_SUBST(SSL_SERVER_CERT)
1639
1640dnl  ssl server password file for private key file
1641dnl
1642AC_MSG_CHECKING(ssl server password file for private key file)
1643AC_ARG_WITH(ssl_server_password_file,
1644[  --with-ssl_server_password_file=FILE     ssl server private key in password file (default \${sysconfdir}/lpd/ssl.server/server.pwd)],
1645SSL_SERVER_PASSWORD_FILE=$withval,
1646SSL_SERVER_PASSWORD_FILE=\${sysconfdir}/lpd/ssl.server/server.pwd,
1647)
1648AC_MSG_RESULT($SSL_SERVER_PASSWORD_FILE)
1649AC_SUBST(SSL_SERVER_PASSWORD_FILE)
1650
1651dnl ----------------------------------------------------------------------------
1652dnl ---------------- START OF KERBEROS -----------------------------------------
1653
1654dnl Kerberos stuff again
1655
1656if test -n "$KERBEROS" ; then
1657	echo "Kerberos checks with CFLAGS '$CFLAGS', CPPFLAGS '$CPPFLAGS',  LDFLAGS '$LDFLAGS"
1658	if test -d /usr/kerberos/include; then
1659		CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1660	fi
1661	if test -d /usr/kerberos/lib; then
1662		LDFLAGS="-L/usr/kerberos/lib $LDFLAGS"
1663	fi
1664	dnl Kerberos 5 - release 1.1.1
1665	found=
1666	AC_CHECK_HEADERS(krb5.h,found=yes)
1667    if test "$found" != "yes" ; then
1668		  AC_MSG_ERROR([
1669Kerberos 5 support wanted and cannot find krb5.h include file
1670use configure --disable-kerberos-checks or check your Kerberos 5 installation
1671If you have installed kerberos in /usr/local/{lib,include} then use
1672configure --enable-kerberos CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
1673])
1674	fi
1675	if test "$MIT_KERBEROS4" != "" ; then
1676		found=
1677		if test "$found" != "yes" ; then
1678			AC_CHECK_HEADERS(krb.h,found=yes)
1679		fi
1680		if test "$found" != "yes" ; then
1681			AC_CHECK_HEADERS(kerberosIV/krb.h,found=yes)
1682		fi
1683		if test "$found" != "yes" ; then
1684		  AC_MSG_ERROR(MIT Kerberos 4 support wanted and cannot find krb.h or kerberosIV/krb.h)
1685		fi
1686	fi
1687
1688	if test "$KERBEROS_CHECKS" = 1 ; then
1689		dnl we have the Kerberos 5 package, lets try for the rest
1690		AC_TRY_COMPILE([
1691		#include <stdio.h>
1692		#include <krb5.h>
1693		], [printf("%d",sizeof(HostAddress));],
1694		heimdal=yes, heimdal=no)
1695		if test $heimdal = yes; then
1696		    AC_MSG_WARN(compiling with CFLAGS $CFLAGS, CPPFLAGS $CPPFLAGS)
1697			AC_MSG_ERROR(You appear to be using the Heimdal Kerberos krb5.h file. You must use MIT Kerberos with LPRng)
1698		fi
1699
1700		dnl we check for the library we need to use
1701		dnl courtesy of mandrake linux and friends.
1702		dnl  Christian Zoffoli <czoffoli@linux-mandrake.com>
1703dnl X		SAVELIBS=$LIBS
1704dnl X		found=
1705dnl X		if test "$found" = "" ; then
1706dnl X			LIBS=" -lcrypto -lcom_err $SAVELIBS"
1707dnl X			AC_CHECKING(for krb5_des_string_to_key in $LIBS, )
1708dnl X			AC_TRY_LINK_FUNC(krb5_des_string_to_key,found="yes")
1709dnl X		fi;
1710dnl X		if test "$found" = "" ; then
1711dnl X			LIBS=" -lk5crypto -lcom_err $SAVELIBS"
1712dnl X			AC_CHECKING(for krb5_des_string_to_key in $LIBS, )
1713dnl X			AC_TRY_LINK_FUNC(krb5_des_string_to_key,found="yes")
1714dnl X		fi;
1715dnl X		if test "$found" = "" ; then
1716dnl X			echo "Kerberos 5 encryption support library not found."
1717dnl X			echo " You may need to use:"
1718dnl X			echo "  configure 'CPPFLAGS=-I/usr/local/include' 'LDFLAGS=-L/usr/local/lib'"
1719dnl X			exit 1
1720dnl X		fi
1721
1722		SAVELIBS=$LIBS
1723
1724		found=no
1725		if test "$found" "!=" "yes" ; then
1726			found=yes
1727			LIBS=" -lkrb5 -lcrypto -lcom_err $SAVELIBS"
1728			AC_CHECKING(for krb5_init_context and krb5_read_message in $LIBS )
1729			AC_TRY_LINK_FUNC(krb5_init_context,,found="no")
1730			AC_TRY_LINK_FUNC(krb5_read_message,,found="no")
1731		fi;
1732		if test "$found" "!=" "yes" ; then
1733			found=yes
1734			LIBS=" -lkrb5 -lk5crypto -lcom_err $SAVELIBS"
1735			AC_CHECKING(for krb5_init_context and krb5_read_message in $LIBS )
1736			AC_TRY_LINK_FUNC(krb5_init_context,,found="no")
1737			AC_TRY_LINK_FUNC(krb5_read_message,,found="no")
1738		fi;
1739		if test "$found" "!=" "yes" ; then
1740			  AC_MSG_WARN(Kerberos 5 library does not have krb5_init_context or krb5_read_message )
1741			  AC_MSG_WARN(use configure --disable-kerberos or check your Kerberos 5 installation)
1742			  exit 1
1743        fi
1744		AC_MSG_RESULT(found in $LIBS)
1745
1746		if test "$MIT_KERBEROS4" != "" ; then
1747			SAVELIBS=$LIBS
1748			found=;
1749			if test "$found" = "" ; then
1750				LIBS=" -lkrb4 -ldes425 $SAVELIBS"
1751				AC_CHECKING(for krb_recvauth in $LIBS, )
1752				AC_TRY_LINK_FUNC(krb_recvauth,found="yes")
1753			fi;
1754			if test "$found" = "" ; then
1755				LIBS=" -lkrb4 -ldes $SAVELIBS"
1756				AC_CHECKING(for krb_recvauth in $LIBS, )
1757				AC_TRY_LINK_FUNC(krb_recvauth,found="yes")
1758			fi;
1759			if test "$found" = "" ; then
1760			  AC_MSG_WARN(MIT Kerberos 4 support wanted and cannot find krb_recvauth in Kerberos 4 libraries)
1761			  exit 1
1762            fi
1763		fi;
1764	fi
1765
1766	AC_CHECK_FUNCS(krb5_free_data_contents)
1767
1768	AC_CACHE_CHECK(for krb5_xfree,
1769	ac_cv_krb5_xfree,
1770	[AC_TRY_LINK([
1771	# define KRB5_DEPRECATED 1
1772	#if defined(HAVE_KRB5_H)
1773	#include <krb5.h>
1774	#endif
1775	],[krb5_xfree((void *)0);],
1776	ac_cv_krb5_xfree=yes,
1777	ac_cv_krb5_xfree=no)
1778	])
1779	if test "$ac_cv_krb5_xfree" = yes; then
1780		AC_DEFINE_UNQUOTED(HAVE_KRB5_XFREE,1,[have krb5_xfree])
1781	fi
1782
1783	AC_CACHE_CHECK(for krb_xfree,
1784	ac_cv_krb_xfree,
1785	[AC_TRY_LINK([
1786	# define KRB5_DEPRECATED 1
1787	#if defined(HAVE_KRB5_H)
1788	#include <krb5.h>
1789	#endif
1790	],[krb_xfree((void *)0);],
1791	ac_cv_krb_xfree=yes,
1792	ac_cv_krb_xfree=no)
1793	])
1794	if test "$ac_cv_krb_xfree" = yes; then
1795		AC_DEFINE_UNQUOTED(HAVE_KRB_XFREE,1,[have krb_xfree])
1796	fi
1797
1798	AC_CACHE_CHECK(for kerberos 4 krb_sendauth definition,
1799	ac_cv_decl_krb_sendauth_def,
1800	[AC_TRY_COMPILE([
1801	# define KRB5_DEPRECATED 1
1802	#if defined(HAVE_KRB5_H)
1803	#include <krb5.h>
1804	#endif
1805	#if defined(HAVE_KRB_H)
1806	#include <krb.h>
1807	#include <des.h>
1808	#endif
1809	#if defined(HAVE_KERBEROSIV_KRB_H)
1810	#include <kerberosIV/krb.h>
1811	#include <kerberosIV/des.h>
1812	#endif
1813	],[printf("%d",krb_sendauth(1));],
1814	ac_cv_decl_krb_sendauth_def=no,
1815	ac_cv_decl_krb_sendauth_def=yes)
1816	])
1817	if test "$ac_cv_decl_krb_sendauth_def" = yes; then
1818		AC_DEFINE_UNQUOTED(HAVE_KRB_AUTH_DEF,1,[have krb_sendauth defined])
1819	fi
1820
1821fi;
1822
1823dnl ----------------------------------------------------------------------------
1824dnl ---------------- END OF KERBEROS -----------------------------------------
1825
1826
1827dnl ----------------------------------------------------------------------------
1828dnl ----------------- START OF OUTPUT ------------------------------------------
1829
1830
1831if test "$ac_cv_prog_gcc" = yes; then
1832	CFLAGS="$CFLAGS -g -W -Wall $werror -Wno-unused "
1833	CPPFLAGS="$CPPFLAGS -g -W -Wall $werror -Wno-unused "
1834fi;
1835
1836AC_OUTPUT( po/Makefile.in 
1837[
1838Makefile
1839DOCS/Makefile
1840TESTSUPPORT/Makefile
1841DISTRIBUTIONS/Makefile
1842UTILS/LPRng.pm
1843UTILS/Makefile
1844UTILS/accounting.pl
1845UTILS/decode_args_with_perl
1846UTILS/decode_args_with_sh
1847UTILS/fixid
1848UTILS/fixupdate
1849UTILS/lpq_in_perl
1850UTILS/lpr_in_perl
1851UTILS/lprm_in_perl
1852UTILS/make_lpd_conf
1853UTILS/make_printcap_use
1854UTILS/makeinc
1855UTILS/read_conf
1856UTILS/remote_active
1857UTILS/test_read
1858UTILS/update_z.pl
1859lpd.perms
1860man/Makefile
1861src/Makefile
1862src/pclbanner
1863src/psbanner
1864po/Makefile.in
1865],
1866[
1867for i in  \
1868UTILS/LPRng.pm \
1869UTILS/accounting.pl \
1870UTILS/decode_args_with_perl \
1871UTILS/decode_args_with_sh \
1872UTILS/fixid \
1873UTILS/fixupdate \
1874UTILS/lpq_in_perl \
1875UTILS/lpr_in_perl \
1876UTILS/lprm_in_perl \
1877UTILS/make_lpd_conf \
1878UTILS/make_printcap_use \
1879UTILS/makeinc \
1880UTILS/read_conf \
1881UTILS/remote_active \
1882UTILS/test_read \
1883UTILS/update_z.pl \
1884; do chmod +x $i ; done
1885]
1886
1887)
1888
1889dnl ----------------------------------------------------------------------------
1890dnl ----------------- END OF OUTPUT --------------------------------------------
1891