File: configure.ac

package info (click to toggle)
lprng 3.8.B-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 4,260 kB
  • ctags: 2,422
  • sloc: ansic: 35,070; sh: 3,039; perl: 1,896; makefile: 379
file content (1289 lines) | stat: -rw-r--r-- 37,243 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
AC_INIT(LPRng,3.8.B,lprng-devel@lists.sf.net)
AC_CONFIG_SRCDIR(src/common/lpr.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([foreign])

AM_MAINTAINER_MODE

AC_PREFIX_DEFAULT(/usr/local)

mysaved_CFLAGSset="${CFLAGS+set}"
AC_PROG_CC
if test "$ac_cv_prog_gcc" = yes; then
	if test "$mysaved_CFLAGSset" != set ; then
		CFLAGS="-g -W -Wall -Wno-unused -Wstrict-prototypes -Wmissing-prototypes"
	fi
fi;
AC_SYS_LARGEFILE

AC_PROG_AWK
AC_SUBST(AWK)
AC_PATH_PROG(SED,sed)dnl
AC_SUBST(SED)dnl
AC_PATH_PROG(PERL,perl)dnl
AC_SUBST(PERL)dnl
dnl -- TODO:
dnl this is used in checkpc, why not just use "chown" there?
dnl same with chgrp
dnl --
AC_PATH_PROG(CHOWN,chown)dnl
AC_DEFINE_UNQUOTED(CHOWN, "$CHOWN",[full path to chown])
AC_PATH_PROG(CHGRP,chgrp)dnl
AC_DEFINE_UNQUOTED(CHGRP, "$CHGRP",[full path to chgrp])
AC_PATH_PROG(PRUTIL,pr)dnl
AC_DEFINE_UNQUOTED(PRUTIL, "$PRUTIL",[full path to prutil])
AC_PATH_PROG(OPENSSL,openssl)dnl
AC_SUBST(OPENSSL)dnl
AC_DEFINE_UNQUOTED(OPENSSL, "$OPENSSL",[full path to openssl])

dnl dnl check to see if setuid is suppressed
dnl AC_ARG_ENABLE( setuid,
dnl AS_HELP_STRING([--disable-setuid],[do not install client executables setuid root]),
dnl [
dnl if test "$enableval" = "yes" ; then
dnl 	PERMS=SUID_ROOT_PERMS
dnl else
dnl 	PERMS=NORM_PERMS
dnl fi
dnl ],
dnl [ PERMS=SUID_ROOT_PERMS ],
dnl )
dnl AC_MSG_NOTICE([installing client with $PERMS])
dnl AC_SUBST(PERMS)

dnl check to see if priv ports required
ENABLE_BOOLEAN(priv_ports,
[--enable-priv_ports],[require connections from privileged ports],
"no",
[require connections from priviledged ports: $v],
[PRIV_PORTS=""],[PRIV_PORTS="#"])
AC_SUBST(PRIV_PORTS)

dnl check if only accept from local host
ENABLE_BOOLEAN(remote,
[--disable-remote],[do not accept remote jobs by default],
"yes",
[listen for remote connections by default  : $v],
[NOREMOTE="#"
LPD_LISTEN_PORT='"=515"'
],[NOREMOTE=""
LPD_LISTEN_PORT='"=off"'
])
AC_SUBST(LPD_LISTEN_PORT)
AC_SUBST(NOREMOTE)
AC_DEFINE_UNQUOTED(LPD_LISTEN_PORT, $LPD_LISTEN_PORT,[default value for lpd_listen_port (0 means default port ("=515"), "=off" means to not listen at all])

ENABLE_BOOLEAN(lpd.conf.local,
[--enable-lpd.conf.local],[include lpd.conf.local in lpd.conf],
"no",
[include lpd.conf.local in lpd.conf        : $v],
[INCLUDELPDCONFLOCAL=""
],[INCLUDELPDCONFLOCAL="# "
])
AC_SUBST(INCLUDELPDCONFLOCAL)

dnl check to see if force_localhost is suppressed
ENABLE_BOOLEAN(force_localhost,
[--disable-force_localhost],[disable force_localhost default],
"yes",
[force_localhost is default                : $v],
[FORCE_LOCALHOST=1],[FORCE_LOCALHOST=0])
AC_DEFINE_UNQUOTED(FORCE_LOCALHOST,"$FORCE_LOCALHOST",[Force Localhost (force_localhost)])

dnl check to see if clients require lpd.conf and printcap
ENABLE_BOOLEAN(require_configfiles,
[--disable-require_configfiles],[client programs require lpd.conf, printcap],
"yes",
[client programs require lpd.conf, printcap: $v],
[REQUIRE_CONFIGFILES=1], [REQUIRE_CONFIGFILES=0])
AC_DEFINE_UNQUOTED(REQUIRE_CONFIGFILES, "$REQUIRE_CONFIGFILES",[require configfiles])

dnl check to see if kerberos is disabled
AH_TEMPLATE(KERBEROS,[enable Kerberos support])
ENABLE_BOOLEAN(kerberos,
[--enable-kerberos],[enable kerberos support],
"no",
[enable kerberos support                   : $v],
[KERBEROS=1;
AC_DEFINE_UNQUOTED(KERBEROS,"1")],
[KERBEROS=""])
AM_CONDITIONAL(WITHKERBEROS, test $v = yes)
AC_SUBST(KERBEROS)

dnl find kerberos libraries
ENABLE_BOOLEAN(kerberos_checks,
[--disable-kerberos_checks],[disable kerberos library location and checking for support],
"yes",
[locate Kerberos libraries and check       : $v],
[KERBEROS_CHECKS=1],[KERBEROS_CHECKS=""])

WITH_DIR(lpddir,
[--with-lpddir=DIR],[lpd executable directory (default ${sbindir})],
[lpdbindir],['${sbindir}'],
[directory to place lpd executable into    : $lpdbindir])

AC_ARG_WITH(config_subdir,
AS_HELP_STRING([--with-config_subdir=SUBDIR],[configuration subdirectory (default 'lpd')]),
CONFIGSUBDIR=$withval,CONFIGSUBDIR=lpd
)
configdir=\${sysconfdir}/${CONFIGSUBDIR}
AC_MSG_NOTICE([configuration directory          configdir= $configdir])
AC_SUBST(configdir)

WITH_DIR(lpd_conf_path,
[--with-lpd_conf_path=PATH],[path of lpd.conf (default: ${configdir}/lpd.conf)],
[LPD_CONF_PATH],['${configdir}/lpd.conf'],
[lpd.conf location                         : $LPD_CONF_PATH])
AC_SUBST(LPD_CONF_PATH)

WITH_DIR(lpd_perms_path,
[--with-lpd_perms_path=PATH],[path of lpd.perms (default: ${configdir}/lpd.perms)],
[LPD_PERMS_PATH],['${configdir}/lpd.perms'],
[lpd.perms location                        : $LPD_PERMS_PATH])
AC_SUBST(LPD_PERMS_PATH)

WITH_DIR(printcap_path,
[--with-printcap_path=PATH],[path of printcap (default ${sysconfdir}/printcap)],
[PRINTCAP_PATH],['${sysconfdir}/printcap'],
[printcap location                         : $PRINTCAP_PATH])
AC_SUBST(PRINTCAP_PATH)

WITH_DIR(lpd_printcap_path,
[--with-lpd_printcap_path=PATH],[path of lpd_printcap (default ${configdir}/lpd_printcap)],
[LPD_PRINTCAP_PATH],['${configdir}/lpd_printcap'],
[lpd_printcap location                     : $LPD_PRINTCAP_PATH])

WITH_DIR(localedir,
[--with-localedir=PATH],[specify locale information directory],
[localedir],['${datadir}/locale'],
[locale information directory is           : $localedir])
AC_SUBST(localedir)

WITH_DIR(unix_socket_path,
[--with-unix_socket_path=DIR],[unix socket path (default /var/run/lprng)],
[UNIXSOCKETPATH],[/var/run/lprng],
[unix socket path is                       : $UNIXSOCKETPATH])

WITH_DIR(lockfile,
[--with-lockfile=PATH],[lockfile PATH, default /var/run/lpd ],
[LOCKFILE],['/var/run/lpd'],
[lockfile directory                        : $LOCKFILE])

WITH_DIR(spooldir,
[--with-spooldir=PATH],[default spool directory, default /var/spool/lpd ],
[SD_DEFAULT],['/var/spool/lpd'],
[default spool directory (:sd=SPOOLDIR/%P) : $SD_DEFAULT])

WITH_DIR(plugindir,
[--with-plugindir=DIR],[dynamic loadable plugin directory (default ${libdir}/lprng/plugins)],
[plugindir],['${libdir}/lprng/plugins'],
[plugin directory                plugindir = $plugindir])

WITH_DIR(filterdir,
[--with-filterdir=DIR],[filter directory (default ${libexecdir}/filters)],
[filterdir],['${libexecdir}/filters'],
[filter directory                filterdir = $filterdir])

dnl  FILTER_LD_PATH (LD_LIBRARY_PATH for filters) value
dnl
AC_ARG_WITH(ld_library_path,
AS_HELP_STRING([--with-ld_library_path=PATH],[FILTER_LD_PATH value, default empty (for Solaris you might need /lib:/usr/lib:/usr/local/lib)]),
FILTER_LD_PATH="$withval",
FILTER_LD_PATH=""
)
AC_MSG_NOTICE([filter LD_LIBRARY_PATH:    FILTER_LD_PATH = $FILTER_LD_PATH])
AC_SUBST(FILTER_LD_PATH)
AC_DEFINE_UNQUOTED(FILTER_LD_PATH, "$FILTER_LD_PATH",[default LD_LIBRARY_PATH for filters])

dnl  filter PATH value
dnl
AC_ARG_WITH(filter-path,
AS_HELP_STRING([--with-filter-path=PATH],[filter PATH value, default /bin:/usr/bin:/usr/local/bin ]),
FILTER_PATH="$withval",
FILTER_PATH="/bin:/usr/bin:/usr/local/bin"
)
AC_MSG_NOTICE([filter PATH:                  FILTER_PATH = $FILTER_PATH])
AC_SUBST(FILTER_PATH)
AC_DEFINE_UNQUOTED(FILTER_PATH, "$FILTER_PATH",[default PATH for filters])

dnl  user name
dnl
AC_ARG_WITH(userid,
AS_HELP_STRING([--with-userid=NAME],[run LPRng software as this userid, default daemon ]),
USERID="$withval", USERID="daemon",
)
AC_MSG_NOTICE([userID to run lpd as                      : $USERID])
AC_DEFINE_UNQUOTED(USERID, "$USERID",[userid to run LPRng as, default daemon])

dnl  group value
dnl
AC_ARG_WITH(groupid,
AS_HELP_STRING([--with-groupid=NAME],[run LPRng software as this groupid, default daemon ]),
GROUPID="$withval", GROUPID="daemon",
)
AC_MSG_NOTICE([groupID to run lpd as                     : $GROUPID])
AC_DEFINE_UNQUOTED(GROUPID, "$GROUPID",[groupid to run LPRng as, default daemon])

dnl  done_jobs value
dnl
AC_ARG_WITH(done_jobs,
AS_HELP_STRING([--with-done_jobs=N],[retain last N job status, default 1]),
DONE_JOBS="$withval", DONE_JOBS="1",
)
AC_MSG_NOTICE([number of job status to retain            : $DONE_JOBS])
AC_DEFINE_UNQUOTED(DONE_JOBS, "$DONE_JOBS",[number of jobs to retain status of])

dnl  done_jobs_max_age value
dnl
AC_ARG_WITH(done_jobs_max_age,
AS_HELP_STRING([--with-done_jobs_max_age=N],[retain job status N seconds, default 0 - no expiry]),
DONE_JOBS_MAX_AGE="$withval", DONE_JOBS_MAX_AGE="0",
)
AC_MSG_NOTICE([max age to retain job status (0=no expiry): $DONE_JOBS_MAX_AGE])
AC_DEFINE_UNQUOTED(DONE_JOBS_MAX_AGE, "$DONE_JOBS_MAX_AGE",[number of seconds to retain job status])

dnl  clear program
dnl
AC_MSG_CHECKING(terminal screen clear program)
if test -z "$CLEAR" ; then
  AC_PATH_PROG(CLEAR,clear)dnl
fi
if test -z "$CLEAR" ; then
 AC_MSG_WARN([Program 'clear' is not found. Set environment CLEAR=no if you do not want to use it]);
 exit 1
fi
if test "$CLEAR" = "no" ; then CLEAR= ; fi
if test -n "$CLEAR" ; then
	AC_DEFINE_UNQUOTED(CLEAR,"$CLEAR",[screen clear program])
fi

dnl ----------------------------------------------------------------------------
dnl -----------   C compiler checks    -----------------------------------------

AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE

AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_HEADER_TIME

dnl typedefs:
AC_TYPE_SIGNAL
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T

AC_CHECK_TYPES( fd_set,,,[
#include <sys/types.h>
#include <sys/time.h>
#include <sys/unistd.h>
] )

AC_CHECK_TYPES( socklen_t,,,[
#include <sys/types.h>
#include <sys/socket.h>
] )

checklibs=

dnl ----------------------------------------------------------------------------
dnl headers:

AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h assert.h com_err.h compat.h ctype.h ctypes.h dirent.h errno.h fcntl.h filehdr.h grp.h limits.h locale.h machine/vmparam.h malloc.h memory.h ndir.h netdb.h netinet/in.h pwd.h resolv.h select.h setjmp.h sgtty.h signal.h stab.h stdarg.h stdio.h stdlib.h string.h strings.h sys/dir.h sys/exec.h sys/fcntl.h sys/file.h sys/ioctl.h sys/mount.h sys/ndir.h sys/param.h sys/pstat.h sys/resource.h sys/select.h sys/signal.h sys/socket.h sys/stat.h sys/statfs.h sys/statvfs.h sys/syslog.h sys/systeminfo.h sys/termio.h sys/termiox.h sys/time.h sys/ttold.h sys/ttycom.h sys/types.h sys/utsname.h sys/vfs.h sys/wait.h syslog.h term.h termcap.h termio.h termios.h time.h unistd.h utsname.h varargs.h vmparam.h endian.h stdint.h)

dnl ----------------------------------------------------------------------------
dnl libraries:

dnl it might be nice to put them to some SOCKETLIBS or stuff like that instead,
dnl but given it is not needed on Linux, this will both seldom tested and
dnl seldom be useful.

dnl A/UX uses this...
AC_SEARCH_LIBS(getpwent, posix)

dnl TODO: error out if not there?

AC_SEARCH_LIBS(gethostbyaddr, [nsl_s nsl net_s net])

AC_SEARCH_LIBS(socket, [socket_s socket])

	dnl BIND library may be needed,  need to force this first
	if test -z "$no_resolv_lib"; then
	  AC_CHECK_FUNC(inet_ntop,name2=yes)
	  if test -z "$name2" ; then
		AC_CHECK_LIB(resolv, inet_ntop, [LIBS="$LIBS -lresolv";name2=yes])
	  fi;
	fi

dnl ----------------------------------------------------------------------------
dnl function checks:

dnl BSDs have this:
AC_CHECK_LIB(util, setproctitle, [LIBS="-lutil $LIBS"])

AC_CHECK_FUNCS(_res cfsetispeed fcntl flock gethostbyname2 getdtablesize gethostname getrlimit inet_aton inet_ntop inet_pton innetgr initgroups killpg lockf mkstemp mktemp openlog putenv random rand setenv seteuid setgroups setlocale setpgid setproctitle setresuid setreuid setruid setsid sigaction sigprocmask siglongjmp socketpair strcasecmp strchr strdup strerror strncasecmp sysconf sysinfo tcdrain tcflush tcsetattr uname unsetenv wait3 waitpid)

if test ! "$ac_cv_func_setreuid" = yes -a ! "$ac_cv_func_seteuid" = yes -a ! "$ac_cv_func_setresuid" = yes; then
	AC_MSG_WARN([missing setreuid(), seteuid(), and setresuid()])
fi

AC_FUNC_VFORK
AC_FUNC_VPRINTF


dnl ----------------------------------------------------------------------------
dnl special system checks

AC_CACHE_CHECK(how to manipulate tty attributes,
ac_cv_struct_term,
[

if test "$ac_cv_header_termios_h" = yes; then
	ac_cv_struct_term=termios
fi
if test "$ac_cv_header_sys_termios_h" = yes; then
	ac_cv_struct_term=termios
fi

dnl test to see if we need to compile
if test -z "$ac_cv_struct_term" ; then
AC_TRY_COMPILE([
#ifdef HAVE_TERMIO_H
#include <termio.h>
#endif
#ifdef HAVE_SYS_TERMIO_H
#include <sys/termio.h>
#endif],[struct termio t;t.c_iflag = 0],
ac_cv_struct_term=termio)
fi

dnl now you have determined if you have termio
if test -z "$ac_cv_struct_term" ; then
    AC_TRY_COMPILE([#include <sgtty.h>],[
    struct sgttyb s;s.sg_flags = 0],
    ac_cv_struct_term=sgttyb)
fi
if test -z "$ac_cv_struct_term" ; then
	ac_cv_struct_term=UNDEFINED
fi
])
if test "$ac_cv_struct_term" = "sgttyb"; then
	AC_DEFINE(USE_SGTTYB,1,[use sgttyb])
	AC_DEFINE(USE_STTY,SGTTYB,[use sgttyb])
fi
if test "$ac_cv_struct_term" = "termio"; then
	AC_DEFINE(USE_TERMIO,1,[use termio])
	AC_DEFINE(USE_STTY,TERMIO,[use termio])
fi
if test "$ac_cv_struct_term" = "termios"; then
	AC_DEFINE(USE_TERMIOS,1,[use termios])
	AC_DEFINE(USE_STTY,TERMIOS,[use termios])
	if test "$ac_cv_header_sys_termiox_h" = yes; then
		AC_DEFINE(USE_TERMIOX,1,[use termiox])
	fi
fi

dnl ----------------------------------------------------------------------------

dnl test to see if lseek has a prototype - you make it get an error

AC_CACHE_CHECK(checking for lseek prototype,
ac_cv_lseek_proto,
[
AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_UNISTD_H
#include <sys/unistd.h>
#endif
],[off_t x; x = lseek(0,"test",SEEK_SET);],
ac_cv_lseek_proto=no, ac_cv_lseek_proto=yes)
])
if test "$ac_cv_lseek_proto" = yes; then
  AC_DEFINE(HAVE_LSEEK_PROTO,1,[have lseek definition])
fi

dnl ----------------------------------------------------------------------------

AC_CACHE_CHECK(how to get filesystem free space,
ac_cv_struct_fstype,
[
fstype=

dnl do this check if statvfs is a valid function
if test "$ac_cv_func_statvfs" != no ; then		#{
  AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
#endif
#ifdef HAVE_SYS_STATFS_H
# include <sys/statfs.h>
#endif

#ifdef HAVE_SYS_MOUNT_H
# include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
# include <sys/vfs.h>
#endif],[struct statvfs s; statvfs ("/", &s); return(s.f_bavail+s.f_bsize)],
  fstype=statvfs)
fi							#}

dnl do these checks if statfs is a valid function

if test "$ac_cv_func_statfs" != no ; then		#{
  if test -z "$fstype" ; then				#{
    AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATFS_H
# include <sys/statfs.h>
#endif

#ifdef HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
# include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
# include <sys/vfs.h>
#endif],[struct fs_data s; return(s.fd_bfree+s.fd_bsize)],
    fstype=Ultrix-statfs)
  fi							#}

  if test -z "$fstype" ; then				#{
    AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif],[struct statfs s; return(s.f_bavail+s.f_bsize)],
    fstype=statfs)
  fi							# }

  if test -z "$fstype" ; then				# {
    AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif],[struct statfs s; return(s.f_bfree+s.f_bsize)],
    fstype=SVR3-statfs)
  fi							# }
fi							# }

if test -z "$fstype" ; then
    echo "cannot find a valid statfs-like structure!"
	fstype=UNKNOWN
fi

ac_cv_struct_fstype=$fstype

])

if test "$ac_cv_struct_fstype" = SVR3-statfs; then
	AC_DEFINE(USE_STATFS_TYPE,SVR3_STATFS,[svr3 statfs])
fi
if test "$ac_cv_struct_fstype" = Ultrix-statfs; then
	AC_DEFINE(USE_STATFS_TYPE,ULTRIX_STATFS,[ultix statfs])
fi
if test "$ac_cv_struct_fstype" = statfs; then
	AC_DEFINE(USE_STATFS_TYPE,STATFS,[plain statfs])
fi
if test "$ac_cv_struct_fstype" = statvfs; then
	AC_DEFINE(USE_STATFS_TYPE,STATVFS,[statvfs statfs])
fi

dnl ----------------------------------------------------------------------------
dnl

AC_CACHE_CHECK(for setproctitle declaration,
ac_cv_decl_setproctitle_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
],[setproctitle(0);],
ac_cv_decl_setproctitle_def=no, ac_cv_decl_setproctitle_def=yes)
])
if test "$ac_cv_decl_setproctitle_def" = yes; then
    AC_DEFINE(HAVE_SETPROCTITLE_DEF,1,[setproctitle defined])
fi


dnl ----------------------------------------------------------------------------
dnl sys_siglist array (list of signals)



AC_CACHE_CHECK(for sys_siglist array,
ac_cv_sys_siglist,
[AC_TRY_LINK([
#include <stdio.h>],
[extern int sys_siglist; printf("%d",sys_siglist);],
ac_cv_sys_siglist=yes, ac_cv_sys_siglist=no)
])
if test "$ac_cv_sys_siglist" = yes; then
    AC_DEFINE(HAVE_SYS_SIGLIST,1,[have sys_syslist])
	AC_CACHE_CHECK(for sys_siglist declaration,
	ac_cv_decl_sys_siglist_def,
	[AC_TRY_COMPILE([
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_SIGNAL_H
#include <sys/signal.h>
#endif
#include <signal.h>],
	[printf("%s",sys_siglist[0]);],
	ac_cv_decl_sys_siglist_def=yes, ac_cv_decl_sys_siglist_def=no)
	])
	if test "$ac_cv_decl_sys_siglist_def" = yes; then
	    AC_DEFINE(HAVE_SYS_SIGLIST_DEF,1,[sys_siglist defined])
		ac_cv_sys_siglist=yes
	fi
else
AC_CACHE_CHECK(for _sys_siglist array,
ac_cv__sys_siglist,
[AC_TRY_LINK([
#include <stdio.h>],
[extern int _sys_siglist; printf("%d",_sys_siglist);],
ac_cv__sys_siglist=yes, ac_cv__sys_siglist=no)
])
if test "$ac_cv__sys_siglist" = yes; then
    AC_DEFINE(HAVE__SYS_SIGLIST,1,[have _sys_siglist])
	AC_CACHE_CHECK(for _sys_siglist declaration,
	ac_cv_decl__sys_siglist_def,
	[AC_TRY_COMPILE([
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_SIGNAL_H
#include <sys/signal.h>
#endif
#include <signal.h>],
	[printf("%s",_sys_siglist[0]);],
	ac_cv_decl__sys_siglist_def=yes, ac_cv_decl__sys_siglist_def=no)
	])
	if test "$ac_cv_decl__sys_siglist_def" = yes; then
	    AC_DEFINE(HAVE__SYS_SIGLIST_DEF,1,[_sys_siglist defined])
		ac_cv__sys_siglist=yes
	fi
fi
fi

dnl ----------------------------------------------------------------------------
dnl just for (really) backwards compatibility
dnl we really try not to use union wait -- it's heinously unportable.
dnl nicked this check from Tcl as well. ;
dnl
dnl The check below checks whether <sys/wait.h> defines the type
dnl "union wait" correctly.  It's needed because of weirdness in
dnl HP-UX where "union wait" is defined in both the BSD and SYS-V
dnl environments.  Checking the usability of WIFEXITED seems to do
dnl the trick.

AC_CACHE_CHECK(for obsolete union wait compatibility,
ac_cv_unionwait,
[
AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#include <sys/types.h>
#include <sys/wait.h>], [union wait x;WIFEXITED(x);],
ac_cv_unionwait=yes, ac_cv_unionwait=no)
])
if test "$ac_cv_unionwait" = yes; then
	AC_DEFINE(HAVE_UNION_WAIT,1,[have union wait])
fi

dnl ----------------------------------------------------------------------------
dnl Would you believe the gethostname declarations are broken on some machines
dnl ----------------------------------------------------------------------------
AC_CACHE_CHECK(for gethostname declaration,
ac_cv_decl_gethostname_def,
[AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[gethostname(1);],
ac_cv_decl_gethostname_def=no, ac_cv_decl_gethostname_def=yes)
])
if test "$ac_cv_decl_gethostname_def" = yes; then
    AC_DEFINE(HAVE_GETHOSTNAME_DEF,1,[have gethostname definition])
fi

dnl ----------------------------------------------------------------------------
dnl innetgr() declarations missing
dnl ----------------------------------------------------------------------------
AC_CACHE_CHECK(for innetgr declaration,
ac_cv_decl_innetgr_def,
[
AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif],[printf("%d", innetgr(1));],
ac_cv_decl_innetgr_def=no, ac_cv_decl_innetgr_def=yes )
]
)
if test "$ac_cv_decl_innetgr_def" = yes; then
  AC_DEFINE(HAVE_INNETGR_DEF,1,[use innetgr(1)])
fi

dnl ----------------------------------------------------------------------------
dnl openlog() declarations missing
dnl ----------------------------------------------------------------------------
AC_CACHE_CHECK(for openlog declaration,
ac_cv_decl_openlog_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif],[printf("%d",openlog);],
ac_cv_decl_openlog_def=yes, ac_cv_decl_openlog_def=no)
])
if test "$ac_cv_decl_openlog_def" = yes; then
    AC_DEFINE(HAVE_OPENLOG_DEF,1,[have openlog definition])
fi


dnl ----------------------------------------------------------------------------
dnl syslog() declarations missing
dnl ----------------------------------------------------------------------------
AC_CACHE_CHECK(for syslog declaration,
ac_cv_decl_syslog_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif],[printf("%d",syslog);],
ac_cv_decl_syslog_def=yes, ac_cv_decl_syslog_def=no)
])
if test "$ac_cv_decl_syslog_def" = yes; then
    AC_DEFINE(HAVE_SYSLOG_DEF,1,[have syslog definition])
fi

dnl ----------------------------------------------------------------------------
dnl IPV6 - check for structure declarations
dnl ----------------------------------------------------------------------------

AC_CACHE_CHECK(for struct in6_addr declaration,
ac_cv_decl_in6_addr_def,
[AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],[struct in6_addr v;],
ac_cv_decl_in6_addr_def=yes, ac_cv_decl_in6_addr_def=no)
])
if test "$ac_cv_decl_in6_addr_def" = yes; then
    AC_DEFINE(IN6_ADDR,1,[in6_addr defined])
    AC_DEFINE(IPV6,1,[ipV6])
fi


AC_CACHE_CHECK([for struct in_addr6 declaration (LINUX)],
ac_cv_decl_in_addr6_def,
[AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],[struct in_addr6 v;],
ac_cv_decl_in_addr6_def=yes, ac_cv_decl_in_addr6_def=no)
])
if test "$ac_cv_decl_in_addr6_def" = yes; then
    AC_DEFINE(IN_ADDR6,1,[in_addr6 defined])
    AC_DEFINE(IPV6,1,[ipV6])
fi

dnl ----------------------------------------------------------------------------
dnl struct stat can have a st_mtime_nsec field
dnl ----------------------------------------------------------------------------


AC_CACHE_CHECK(for struct stat has st_mtimespec.tv_nsec,
ac_cv_decl_st_mtimespec_tv_nsec,
[AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/stat.h>],[struct stat statb; statb.st_mtimespec.tv_nsec;],
ac_cv_decl_st_mtimespec_tv_nsec=yes,
ac_cv_decl_st_mtimespec_tv_nsec=no)
])
if test "$ac_cv_decl_st_mtimespec_tv_nsec" = yes; then
    AC_DEFINE_UNQUOTED(ST_MTIMESPEC_TV_NSEC,1,[stat st_mtimespec.tv_nsec present])
fi

AC_CACHE_CHECK(for struct stat has st_mtimensec,
ac_cv_decl_st_mtimensec,
[AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#include <sys/types.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/stat.h>],[struct stat statb; statb.st_mtimensec;],
ac_cv_decl_st_mtimensec=yes,
ac_cv_decl_st_mtimensec=no)
])
if test "$ac_cv_decl_st_mtimensec" = yes; then
    AC_DEFINE_UNQUOTED(ST_MTIMENSEC,1,[struct st_mtimensec present])
fi

dnl ----------------------------------------------------------------------------

AC_CACHE_CHECK(for strcasecmp definition,
ac_cv_decl_strcasecmp,
[AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#if defined(HAVE_STDLIB_H)
#include <stdlib.h>
#endif
#if defined(HAVE_STRING_H)
#include <string.h>
#endif
#if defined(HAVE_STRINGS_H)
#include <strings.h>
#endif
],[strcasecmp(1)],
ac_cv_decl_strcasecmp=no,
ac_cv_decl_strcasecmp=yes)
])
if test "$ac_cv_decl_strcasecmp" = yes; then
    AC_DEFINE_UNQUOTED(HAVE_STRCASECMP_DEF,1,[have strcasecmp definition])
fi

dnl ----------------------------------------------------------------------------

AC_CACHE_CHECK(for flock definition,
ac_cv_decl_flock,
[AC_TRY_COMPILE([
#ifdef HAVE_CTYPES_H
#include <ctypes.h>
#endif
#if defined(HAVE_STDLIB_H)
#include <stdlib.h>
#endif
#if defined(HAVE_SYS_FILE_H)
#include <sys/file.h>
#endif
#if defined(HAVE_FCNTL_H)
#include <fcntl.h>
#endif
],[flock(1)],
ac_cv_decl_flock=no,
ac_cv_decl_flock=yes)
])
if test "$ac_cv_decl_flock" = yes; then
    AC_DEFINE_UNQUOTED(HAVE_FLOCK_DEF,1,[have flock definition])
fi

dnl ----------------------------------------------------------------------------

AC_PROG_INSTALL
AC_CHECK_PROG(INSTALL_MAN,auxman,auxman,[$INSTALL -m 644])

AC_PROG_MAKE_SET

dnl ----------------- force this to be Bourne Shell for now ---------------
AC_MSG_CHECKING(for shell)
SHELL=/bin/sh
AC_MSG_RESULT(using $SHELL (FORCED))

MY_GETTEXT

dnl ----------------------------------------------------------------------------
dnl ----------------- END OF GENERAL CONFIGURATION   ---------------------------

dnl check to see if tcp wrappers required
AC_MSG_CHECKING(use tcp wrappers)
AC_ARG_ENABLE( tcpwrappers,
AS_HELP_STRING([--enable-tcpwrappers],[use tcp wrappers (-lwrap)]),
[
if test "$enableval" = "yes" ; then
 v=yes
 AC_CHECK_HEADERS(tcpd.h,
  [AC_DEFINE(HAVE_TCPD_H,1,[have tcpd])],
  [AC_MSG_ERROR(tcpd.h not found);
   v=no;
  ]
 )
 AC_CHECK_LIB(wrap, request_init,
  [LIBS="-lwrap $LIBS"],
  [AC_MSG_ERROR(request_init not found in -wrap library);
   v=no;
  ]
 )
else
 v=no;
fi
],
[
 v=no;
]
)

if test "$v" = "yes" ; then
	 AC_DEFINE(TCPWRAPPERS,1,[tcpwrappers])
fi
AC_MSG_RESULT($v);dnl

dnl check to see if ssl is disabled
AC_MSG_CHECKING(if ssl authentication is disabled)
AC_ARG_ENABLE( ssl,
AS_HELP_STRING([--disable-ssl],[disable ssl support]),
[
if test "$enableval" = "yes" ; then
	v=enabled;  SSL_ENABLE=1;
else
	v=disabled; SSL_ENABLE=;
fi
],
[
	v=enabled;  SSL_ENABLE=1;
],
)
AC_MSG_RESULT($v);dnl

dnl This does far too much by hand, try to just check for
dnl the headers and libs...

dnl Now look for OpenSSL
ac_openssl_lib_dir=
ac_openssl_inc_dir=
if test "$SSL_ENABLE" != ""; then

	dnl See if we can find OpenSSL
	dnl We can compile without OpenSSL if we have to
	ac_openssl_lib_dir="/usr/lib /usr/local /usr/local/ssl /usr/local/ssl/lib /usr/pkg"
	ac_openssl_inc_dir="/usr/include /usr/local /usr/local/ssl /usr/pkg /usr/local/ssl/include"

	AC_ARG_WITH(openssl,
	AS_HELP_STRING([--with-openssl=DIR],[root location for OpenSSL]),
	[
		ac_openssl_lib_dir="$withval/lib $withval"
		ac_openssl_inc_dir="$withval/include $withval"
	]
	)

	AC_ARG_WITH(openssl-inc,
	AS_HELP_STRING([--with-openssl-inc],[OpenSSL include files]),
		ac_openssl_inc_dir=$withval
	)
	AC_ARG_WITH(openssl-lib,
	AS_HELP_STRING([--with-openssl-lib],[OpenSSL library files]),
		ac_openssl_lib_dir=$withval
	)

	ac_found_openssl_inc_dir="no"
	AC_MSG_CHECKING(for OpenSSL include files)
	for dir in $ac_openssl_inc_dir; do
		if test -f $dir/openssl/ssl.h; then
		   ac_found_openssl_inc_dir=$dir
		   break
		fi
        done
	if test "$ac_found_openssl_inc_dir" != "no"; then
	   	echo "found in $ac_found_openssl_inc_dir"
	else
		echo "not found."
		SSL_ENABLE=""
	fi
fi

SSL_LDADD=""
if test "$SSL_ENABLE" != ""; then
	ac_found_openssl_lib_dir="no"
	AC_MSG_CHECKING(for OpenSSL libraries)
	for dir in $ac_openssl_lib_dir; do
		found_ssl="false"
		if test -f $dir/libssl.a -a -f $dir/libcrypto.a; then
		  found_ssl="true"
		fi
		if test -f $dir/libssl.so -a -f $dir/libcrypto.so; then
		  found_ssl="true"
		fi
		if $found_ssl != "false"; then
		dnl Ok, we think we've found them, but check that they
		dnl actually ontain the right functions
		save_LIBS=$LIBS
		save_LDFLAGS=$LDFLAGS
		SSL_LDADD="-lssl -lcrypto"
		if test "X$dir" != "X/usr/lib" ; then
			SSL_LDADD="-L$dir $SSL_LDADD"
		fi
		LDFLAGS="$LDFLAGS $SSL_LDADD"
		AC_TRY_LINK_FUNC(SSL_load_error_strings,ac_linked_libssl="true",
			ac_linked_libssl="false");
		AC_TRY_LINK_FUNC(RC4_set_key,ac_linked_libcrypto="true",
			ac_linked_libcrypto="false");
		if test "$ac_linked_libssl" != "false" -a \
			"$ac_linked_libcrypto" != "false"; then
				ac_found_openssl_lib_dir=$dir
				LIBS=$save_LIBS
				LDFLAGS=$save_LDFLAGS
				break
		fi
		LIBS=$save_LIBS
		LDFLAGS=$save_LDFLAGS
		SSL_LDADD=""
		fi
	done
	if test "$ac_found_openssl_lib_dir" != "no"; then
	   	echo "found in $ac_found_openssl_lib_dir"
		if test "X$ac_found_openssl_inc_dir" != "X/usr/include" ; then
			CPPFLAGS="$CPPFLAGS -I$ac_found_openssl_inc_dir " ;
		fi
	else
		echo "not found."
		SSL_ENABLE=""
	fi
fi
AC_SUBST(SSL_LDADD)
AM_CONDITIONAL(WITHSSL, test "$SSL_ENABLE" != "")
test "$SSL_ENABLE" != "" && AC_DEFINE(SSL_ENABLE,1,[ssl enabled])


dnl  ssl certificate authority CERT file
dnl
AC_MSG_CHECKING(ssl Certificate Authority CERT file)
AC_ARG_WITH(ssl_ca_file,
AS_HELP_STRING([--with-ssl_ca_file=FILE],[ssl Certificate Authority CERT file (default ${configdir}/ssl.ca/ca.crt)]),
SSL_CA_FILE=$withval,
SSL_CA_FILE=\${configdir}/ssl.ca/ca.crt,
)
AC_MSG_RESULT($SSL_CA_FILE)
AC_SUBST(SSL_CA_FILE)

dnl  ssl certificate authority private key file
dnl
AC_MSG_CHECKING(ssl Certificate Authority private key file)
AC_ARG_WITH(ssl_ca_key,
AS_HELP_STRING([--with-ssl_ca_key=KEY],[ssl Certificate Authority private key file (default ${configdir}/ssl.ca/ca.key)]),
SSL_CA_KEY=$withval,
SSL_CA_KEY=\${configdir}/ssl.ca/ca.key,
)
AC_MSG_RESULT($SSL_CA_KEY)
AC_SUBST(SSL_CA_KEY)

dnl  ssl certificate authority certs working directory
dnl
AC_MSG_CHECKING(ssl Certificate Authority certs working directory)
AC_ARG_WITH(ssl_certs_dir,
AS_HELP_STRING([--with-ssl_certs_dir=DIR],[ssl Certificate Authority certs working directory (default ${configdir}/ssl.certs/)]),
SSL_CERTS_DIR=$withval,
SSL_CERTS_DIR=\${configdir}/ssl.certs,
)
AC_MSG_RESULT($SSL_CERTS_DIR)
AC_SUBST(SSL_CERTS_DIR)

dnl  ssl certificate revocation list
dnl
AC_MSG_CHECKING(ssl Certificate Revocation List (CRL) file)
AC_ARG_WITH(ssl_crl_file,
AS_HELP_STRING([--with-ssl_crl_file=PATH],[ssl Certificate Revocation List File (default ${configdir}/ssl.crl/ssl.crl)]),
SSL_CRL_FILE=$withval,
SSL_CRL_FILE=\${configdir}/ssl.crl/ssl.crl,
)
AC_MSG_RESULT($SSL_CRL_FILE)
AC_SUBST(SSL_CRL_FILE)

dnl  ssl server certificate file
dnl
AC_MSG_CHECKING(ssl server certificate file)
AC_ARG_WITH(ssl_server_cert,
AS_HELP_STRING([--with-ssl_server_cert=FILE],[ssl server certificate file (default ${configdir}/ssl.server/server.crt)]),
SSL_SERVER_CERT=$withval,
SSL_SERVER_CERT=\${configdir}/ssl.server/server.crt,
)
AC_MSG_RESULT($SSL_SERVER_CERT)
AC_SUBST(SSL_SERVER_CERT)

dnl  ssl server password file for private key file
dnl
AC_MSG_CHECKING(ssl server password file for private key file)
AC_ARG_WITH(ssl_server_password_file,
AS_HELP_STRING([--with-ssl_server_password_file=FILE],[ssl server private key in password file (default ${configdir}/ssl.server/server.pwd)]),
SSL_SERVER_PASSWORD_FILE=$withval,
SSL_SERVER_PASSWORD_FILE=\${configdir}/ssl.server/server.pwd,
)
AC_MSG_RESULT($SSL_SERVER_PASSWORD_FILE)
AC_SUBST(SSL_SERVER_PASSWORD_FILE)

dnl ----------------------------------------------------------------------------
dnl ---------------- START OF KERBEROS -----------------------------------------

dnl Kerberos stuff again

KRB_LIBS=""
SAVELIBS="$LIBS"


if test -n "$KERBEROS" ; then
	echo "Kerberos checks with CFLAGS '$CFLAGS', CPPFLAGS '$CPPFLAGS',  LDFLAGS '$LDFLAGS"
	if test -d /usr/kerberos/include; then
		CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
	fi
	if test -d /usr/kerberos/lib; then
		LDFLAGS="-L/usr/kerberos/lib $LDFLAGS"
	fi
	dnl Kerberos 5 - release 1.1.1
	found=
	AC_CHECK_HEADERS(krb5.h,found=yes)
    if test "$found" != "yes" ; then
		  AC_MSG_ERROR([
Kerberos 5 support wanted and cannot find krb5.h include file
use configure --disable-kerberos-checks or check your Kerberos 5 installation
If you have installed kerberos in /usr/local/{lib,include} then use
configure --enable-kerberos CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
])
	fi

	if test "$KERBEROS_CHECKS" = 1 ; then
		dnl we have the Kerberos 5 package, lets try for the rest
		AC_TRY_COMPILE([
		#include <stdio.h>
		#include <krb5.h>
		], [printf("%d",sizeof(HostAddress));],
		heimdal=yes, heimdal=no)
		if test $heimdal = yes; then
		    AC_MSG_WARN(compiling with CFLAGS $CFLAGS, CPPFLAGS $CPPFLAGS)
			AC_MSG_ERROR(You appear to be using the Heimdal Kerberos krb5.h file. You must use MIT Kerberos with LPRng)
		fi

		dnl we check for the library we need to use
		dnl courtesy of mandrake linux and friends.
		dnl  Christian Zoffoli <czoffoli@linux-mandrake.com>

		found=no
		if test "$found" "!=" "yes" ; then
			found=yes
			KRB_LIBS="-lkrb5 -lk5crypto -lcom_err"
			LIBS=" $KRB_LIBS $SAVELIBS"
			AC_CHECKING(for krb5_init_context in $LIBS )
			AC_TRY_LINK_FUNC(krb5_init_context,,found="no")
			AC_CHECKING(for krb5_encrypt_size in $LIBS )
			AC_TRY_LINK_FUNC(krb5_encrypt_size,,found="no")
		fi;
		if test "$found" "!=" "yes" ; then
			found=yes
			KRB_LIBS="-lkrb5 -lcrypto -lcom_err"
			LIBS=" $KRB_LIBS $SAVELIBS"
			AC_CHECKING(for krb5_init_context in $LIBS )
			AC_TRY_LINK_FUNC(krb5_init_context,,found="no")
			AC_CHECKING(for krb5_encrypt_size in $LIBS )
			AC_TRY_LINK_FUNC(krb5_encrypt_size,,found="no")
		fi;
		if test "$found" "!=" "yes" ; then
			AC_PATH_PROG(KRB5CONFIG, krb5-config)
			found=yes
			KRB_LIBS="$($KRB5CONFIG --libs krb5)"
			LIBS=" $KRB_LIBS $SAVELIBS"
			AC_CHECKING(for krb5_init_context in $LIBS )
			AC_TRY_LINK_FUNC(krb5_init_context,,found="no")
			AC_CHECKING(for krb5_encrypt_size in $LIBS )
			AC_TRY_LINK_FUNC(krb5_encrypt_size,,found="no")
		fi;
		if test "$found" "!=" "yes" ; then
			  AC_MSG_WARN(Kerberos 5 library does not have krb5_init_context and krb5_encrypt_size or )
			  AC_MSG_WARN(use configure --disable-kerberos or check your Kerberos 5 installation)
			  exit 1
        fi
		AC_MSG_RESULT(found in $LIBS)

		AC_CHECK_FUNC(krb5_read_message,AC_DEFINE_UNQUOTED(HAVE_KRB5_READ_MESSAGE,1,[have krb5_read_message]),[AC_MSG_WARN(Kerberos 5 library does not have krb5_read_message)])

	fi

	AC_CHECK_FUNCS(krb5_free_data_contents)

	AC_CACHE_CHECK(for krb5_xfree,
	ac_cv_krb5_xfree,
	[AC_TRY_LINK([
	# define KRB5_DEPRECATED 1
	#if defined(HAVE_KRB5_H)
	#include <krb5.h>
	#endif
	],[krb5_xfree((void *)0);],
	ac_cv_krb5_xfree=yes,
	ac_cv_krb5_xfree=no)
	])
	if test "$ac_cv_krb5_xfree" = yes; then
		AC_DEFINE_UNQUOTED(HAVE_KRB5_XFREE,1,[have krb5_xfree])
	fi

	AC_CACHE_CHECK(for krb_xfree,
	ac_cv_krb_xfree,
	[AC_TRY_LINK([
	# define KRB5_DEPRECATED 1
	#if defined(HAVE_KRB5_H)
	#include <krb5.h>
	#endif
	],[krb_xfree((void *)0);],
	ac_cv_krb_xfree=yes,
	ac_cv_krb_xfree=no)
	])
	if test "$ac_cv_krb_xfree" = yes; then
		AC_DEFINE_UNQUOTED(HAVE_KRB_XFREE,1,[have krb_xfree])
	fi

	LIBS="$SAVELIBS"
fi;
AC_SUBST(KRB_LIBS)

dnl ----------------------------------------------------------------------------
dnl ---------------- END OF KERBEROS -----------------------------------------

CHECK_PLUGINS

dnl ----------------------------------------------------------------------------
dnl ----------------- START OF OUTPUT ------------------------------------------

AC_OUTPUT(
[
Makefile
UTILS/LPRng.pm
UTILS/Makefile
UTILS/accounting.pl
UTILS/decode_args_with_perl
UTILS/decode_args_with_sh
UTILS/fixid
UTILS/fixupdate
UTILS/lpq_in_perl
UTILS/lpr_in_perl
UTILS/lprm_in_perl
UTILS/make_lpd_conf
UTILS/make_printcap_use
UTILS/makeinc
UTILS/read_conf
UTILS/remote_active
UTILS/test_read
UTILS/update_z.pl
man/Makefile
src/Makefile
src/pclbanner
src/psbanner
po/Makefile
conf/Makefile
conf/lpd.perms
],
[
for i in  \
UTILS/LPRng.pm \
UTILS/accounting.pl \
UTILS/decode_args_with_perl \
UTILS/decode_args_with_sh \
UTILS/fixid \
UTILS/fixupdate \
UTILS/lpq_in_perl \
UTILS/lpr_in_perl \
UTILS/lprm_in_perl \
UTILS/make_lpd_conf \
UTILS/make_printcap_use \
UTILS/makeinc \
UTILS/read_conf \
UTILS/remote_active \
UTILS/test_read \
UTILS/update_z.pl \
; do chmod +x $i ; done
]

)

dnl ----------------------------------------------------------------------------
dnl ----------------- END OF OUTPUT --------------------------------------------