File: configure.in

package info (click to toggle)
cti-ifhp 2.1.8-2
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 932 kB
  • ctags: 845
  • sloc: ansic: 6,036; sh: 1,524; makefile: 318
file content (776 lines) | stat: -rw-r--r-- 21,678 bytes parent folder | download
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
dnl process this file with GNU autoconf to produce a configure script.
dnl
dnl jmason 23 dec 94 -- fixed union wait and sys_errlist checks
dnl Patrick Powell Fri Jul  7 21:08:48 PDT 1995
dnl $Id: configure.in,v 2.2 1997/02/05 22:35:25 papowell Exp $
dnl  Original version from PLP4.0 Release

AC_INIT(Makefile.in)
AC_CONFIG_AUX_DIR(.)
AC_CANONICAL_SYSTEM
AC_CONFIG_HEADER(config.h)
AC_PREFIX_DEFAULT(/usr/local)
AC_SUBST(INSTALL)
AC_SUBST(INSTALL_MAN)
AC_SUBST(SHELL)
AC_SUBST(CPP)
AC_SUBST(CFLAGS)
AC_SUBST(LDCC)


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

if test $ac_cv_prog_gcc = yes; then
cat >conftest.c <<EOF
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
yes;
#endif
EOF
    if ${CC-cc} -E conftest.c | egrep yes >/dev/null 2>&1; then
        gcc -v
		echo "WARNING: gcc -O (version 2.4.5 and below) produces incorrect code"
		echo "  for lpd.c and other large routines."
		CFLAGS="`echo ${CFLAGS} | sed s/-O//`"
	fi;
	CFLAGS="${CFLAGS} -Wall"
	echo "using CFLAGS=${CFLAGS}"
fi;

dnl ----------------------------------------------------------------------------
dnl ------------   OS Checks  --------------------------------------------------
AC_ISC_POSIX
AC_MINIX
AC_AIX

changequote(, )dnl
version=`echo $target_os | sed -e 's/[^0-9][^0-9]*//' -e 's/\.//g'`
changequote([, ])dnl
echo "Target is $target, arch $target_cpu, os $target_os, version $version"
AC_DEFINE_UNQUOTED(ARCHITECTURE,"$target_cpu")

LDCC="$CC"
checklibs=
case $target_os in
	 bsdi* )
		LDCC=shlicc
		;;
	 unicos* )
		checklibs=no
		;;
	 irix6* )
		checklibs=no
		AC_DEFINE_UNQUOTED(IRIX,$version)
		LIBS="$LIBS -lcurses"
		;;
	 irix5* )
		AC_DEFINE(HAVE_BROKEN_TIOCEXCL)
		AC_DEFINE(SVR4)
		AC_DEFINE_UNQUOTED(IRIX,$version)
		LIBS="$LIBS -lcurses"
		checklibs=no
		;;
	 irix* )
		AC_DEFINE_UNQUOTED(IRIX,$version)
		LIBS="$LIBS -ltermcap"
		checklibs=no
		;;
	solaris* )
		AC_DEFINE(SVR4)
		AC_DEFINE_UNQUOTED(SOLARIS,$version)
		;;
	hpux* )
		AC_DEFINE(_HPUX_SOURCE)
		CFLAGS="$CFLAGS -D_HPUX_SOURCE=1"
		AC_DEFINE_UNQUOTED(HPUX,$version)
		;;
	sunos* )
		AC_DEFINE_UNQUOTED(SUNOS,$version)
		;;
esac

dnl if egrep _HPUX_SOURCE /usr/include/sys/types.h > /dev/null 2>&1 ; then
dnl     # HP/UX support (kludgety kludge!)
dnl     AC_DEFINE(_HPUX_SOURCE)
dnl 	CFLAGS="$CFLAGS -D_HPUX_SOURCE=1"
dnl fi

dnl these must be before anything that links.


dnl check to see if we suppress probing for libraries
dnl this is done by using the checklibs variable

if test -z "$checklibs"; then

	dnl BSDI uses this for setproctitle
	AC_CHECK_LIB(util, setproctitle, [LIBS="$LIBS -lutil"])

	dnl A/UX uses this...
	AC_CHECK_LIB(posix, getpwent, [LIBS="$LIBS -lposix"])

	dnl use old-style shared libs if we have 'em.
	AC_CHECK_LIB(socket_s, socket, [LIBS="$LIBS -lsocket_s"; have_socket=1], ,-lnsl)
	if test -z "$have_socket"; then
		AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"], , -lnsl)
	fi

	AC_CHECK_LIB(nsl_s, gethostbyaddr, [LIBS="$LIBS -lnsl_s"; have_nsl=1])
	if test -z "$have_nsl"; then
		AC_CHECK_LIB(nsl, gethostbyaddr, [LIBS="$LIBS -lnsl"])
	fi

	AC_CHECK_LIB(net_s, gethostbyaddr, [LIBS="$LIBS -lnet_s"; have_net=1])
	if test -z "$have_net"; then
		AC_CHECK_LIB(net, gethostbyaddr, [LIBS="$LIBS -lnet"])
	fi

	dnl IRIX 4 uses these... NIS calls, shared C lib
	AC_CHECK_LIB(sun, getpwnam, [LIBS="$LIBS -lsun"])
	AC_CHECK_LIB(c_s, atoi, [LIBS="$LIBS -lc_s"])

	dnl Kerberos V
	AC_CHECK_LIB(krb5, krb5_init_context,
		[LIBS="$LIBS -lkrb5 -lcrypto -lcom_err"], , -lcrypto -lcom_err)

	dnl this should solve problems of missing termlib, termcap
	dnl libraries.  Note that there may be some conflicts if both
	dnl termcap and termlib are both included, but this is not
	dnl supposed to be the case - only one will get resolved
	TERMLIB=
	AC_CHECK_LIB(termlib, tgetent, [LIBS="$LIBS -ltermlib"; TERMLIB=yes])
	if test -z "$TERMLIB" ; then
	AC_CHECK_LIB(termcap, tgetent, [LIBS="$LIBS -ltermcap"; TERMLIB=yes])
	fi;
	if test -z "$TERMLIB" ; then
	AC_CHECK_LIB(curses, tgetent, [LIBS="$LIBS -lcurses"; TERMLIB=yes])
	fi;
fi
dnl **** end library checks 

AC_C_CONST
AC_C_INLINE

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

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

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

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

AC_CHECK_FUNCS(cfsetispeed fcntl flock gethostbyname2 getdtablesize)
AC_CHECK_FUNCS(gethostname getrlimit inet_aton inet_ntop inet_pton)
AC_CHECK_FUNCS(innetgr killpg lockf mkstemp)
AC_CHECK_FUNCS(mktemp openlog seteuid setpgid setproctitle)
AC_CHECK_FUNCS(setresuid setreuid setsid sigaction)
AC_CHECK_FUNCS(sigprocmask sigsetjmp socketpair strcasecmp)
AC_CHECK_FUNCS(strchr strdup strerror strncasecmp sysinfo)
AC_CHECK_FUNCS(tcflush tcsetattr uname wait3 waitpid)

if test ! "$ac_cv_func_setreuid" = yes -a ! "$ac_cv_func_seteuid" = yes -a ! "$ac_cv_func_setresuid" = yes; then
	echo "WARNING: missing setreuid(), seteuid(), and setresuid()"
fi

AC_FUNC_VFORK
AC_FUNC_VPRINTF


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

AC_MSG_CHECKING(how to manipulate tty attributes)
AC_CACHE_VAL(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
])
AC_MSG_RESULT(using $ac_cv_struct_term)

if test "$ac_cv_struct_term" = "sgttyb"; then
	AC_DEFINE(USE_SGTTYB)
	AC_DEFINE(USE_STTY,SGTTYB)
fi
if test "$ac_cv_struct_term" = "termio"; then
	AC_DEFINE(USE_TERMIO)
	AC_DEFINE(USE_STTY,TERMIO)
fi
if test "$ac_cv_struct_term" = "termios"; then
	AC_DEFINE(USE_TERMIOS)
	AC_DEFINE(USE_STTY,TERMIOS)
fi

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

AC_MSG_CHECKING(checking for struct exec)
AC_CACHE_VAL(ac_cv_struct_exec,
[
ac_cv_struct_exec=no
if test "$ac_cv_header_a_out_h" != no ; then
  AC_TRY_COMPILE([
#include <sys/types.h>
#include <a.out.h>],[struct exec b; b.a_text = 0],
	ac_cv_struct_exec=yes, ac_cv_struct_exec=no )
fi
])
AC_MSG_RESULT($ac_cv_struct_exec)
if test $ac_cv_struct_exec = yes; then
  AC_DEFINE(HAVE_STRUCT_EXEC)
fi

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

AC_MSG_CHECKING(how to get filesystem free space)

AC_CACHE_VAL(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([
#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([
#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([
#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([
#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

])

AC_MSG_RESULT(using $ac_cv_struct_fstype)

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

dnl ----------------------------------------------------------------------------
dnl
AC_MSG_CHECKING(for errno declaration)
AC_CACHE_VAL(ac_cv_decl_errno,
[AC_TRY_COMPILE([#include <errno.h>
#include <stdio.h>],[printf("%d",errno);],
	ac_cv_decl_errno=yes, ac_cv_decl_errno=no)
])
AC_MSG_RESULT($ac_cv_decl_errno)
if test $ac_cv_decl_errno = yes; then
	AC_DEFINE(HAVE_ERRNO_DECL)
fi;

AC_MSG_CHECKING(for sys_nerr)
AC_CACHE_VAL(ac_cv_decl_sys_nerr,
[AC_TRY_LINK(,[extern int sys_nerr; return (sys_nerr);],
	ac_cv_decl_sys_nerr=yes, ac_cv_decl_sys_nerr=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_nerr)
if test $ac_cv_decl_sys_nerr = yes; then
	AC_DEFINE(HAVE_SYS_NERR)
fi;

AC_MSG_CHECKING(for sys_nerr declaration)
AC_CACHE_VAL(ac_cv_decl_sys_nerr_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%d",sys_nerr);],
ac_cv_decl_sys_nerr_def=yes, ac_cv_decl_sys_nerr_def=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_nerr_def)
if test $ac_cv_decl_sys_nerr_def = yes; then
    AC_DEFINE(HAVE_SYS_NERR_DEF)
fi

AC_MSG_CHECKING(for sys_errlist array)
AC_CACHE_VAL(ac_cv_decl_sys_errlist,
[AC_TRY_LINK(,[extern char *sys_errlist[];
	sys_errlist[0];],
	ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_errlist)
if test $ac_cv_decl_sys_errlist = yes; then
	AC_DEFINE(HAVE_SYS_ERRLIST)
fi

AC_MSG_CHECKING(for sys_errlist declaration)
AC_CACHE_VAL(ac_cv_decl_sys_errlist_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%s",sys_errlist[0]);],
ac_cv_decl_sys_errlist_def=yes, ac_cv_decl_sys_errlist_def=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_errlist_def)
if test $ac_cv_decl_sys_errlist_def = yes; then
    AC_DEFINE(HAVE_SYS_ERRLIST_DEF)
fi


AC_MSG_CHECKING(for setproctitle declaration)
AC_CACHE_VAL(ac_cv_decl_setproctitle_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%s",setproctitle);],
ac_cv_decl_setproctitle_def=yes, ac_cv_decl_setproctitle_def=no)
])
AC_MSG_RESULT($ac_cv_decl_setproctitle_def)
if test $ac_cv_decl_setproctitle_def = yes; then
    AC_DEFINE(HAVE_SETPROCTITLE_DEF)
fi


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

AC_MSG_CHECKING(for sys_siglist array)
AC_CACHE_VAL(ac_cv_decl_sys_siglist,
[AC_TRY_LINK(,[extern char *sys_siglist[]; printf("%s",sys_siglist[0]);],
	ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_siglist)
if test $ac_cv_decl_sys_siglist = yes; then
	AC_DEFINE(HAVE_SYS_SIGLIST)
fi

AC_MSG_CHECKING(for sys_siglist declaration)
AC_CACHE_VAL(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
#include <signal.h>],[printf("%s",sys_siglist[0]);],
ac_cv_decl_sys_siglist_def=yes, ac_cv_decl_sys_siglist_def=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_siglist_def)
if test $ac_cv_decl_sys_siglist_def = yes; then
    AC_DEFINE(HAVE_SYS_SIGLIST_DEF)
fi

dnl ----------------------------------------------------------------------------
dnl check to see if you have getpgrp(0) or getpgrp()
dnl 
dnl POSIX `getpgrp(void)'  define HAVE_GETPGRP_0
dnl BSD   `getpgrp(int)' - takes 0 as argument
dnl                        define HAVE_GETPGRP_0 0

dnl check to see if you have getpgrp(0) or getpgrp()

AC_MSG_CHECKING(for getprgp() or getpgrp(0) form)
AC_CACHE_VAL(ac_cv_func_getpgrp_0,
[AC_TRY_COMPILE([
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif],[getpgrp(0);],
ac_cv_func_getpgrp_0=getpgrp_0, ac_cv_func_getpgrp_0=getpgrp)
])
AC_MSG_RESULT($ac_cv_func_getpgrp_0)
if test "$ac_cv_func_getpgrp_0" = getpgrp_0; then
AC_DEFINE(HAVE_GETPGRP_0,0)
else
AC_DEFINE(HAVE_GETPGRP_0,)
fi

dnl ----------------------------------------------------------------------------
dnl check to see if you have setpgrp(n,m) or setpgrp()

AC_MSG_CHECKING(for setprgp form)
AC_CACHE_VAL(ac_cv_func_setpgrp_0,
[AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
],[setpgrp(0,0);],
	ac_cv_func_setpgrp_0=setpgrp_0, ac_cv_func_setpgrp_0=setpgrp)
])
AC_MSG_RESULT($ac_cv_func_setpgrp_0)
if test $ac_cv_func_setpgrp_0 = setpgrp_0; then
	AC_DEFINE(HAVE_SETPGRP_0)
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_MSG_CHECKING(for obsolete union wait compatibility)
AC_CACHE_VAL(ac_cv_unionwait,
[
AC_TRY_COMPILE([#include <sys/types.h> 
#include <sys/wait.h>], [union wait x;WIFEXITED(x);],
ac_cv_unionwait=yes, ac_cv_unionwait=no)
])
AC_MSG_RESULT($ac_cv_unionwait)
if test $ac_cv_unionwait = yes; then
	AC_DEFINE(HAVE_UNION_WAIT)
fi

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


dnl ----------------------------------------------------------------------------
dnl tgetstr definitions are missing
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for tgetstr declaration)
AC_CACHE_VAL(ac_cv_decl_tgetstr_def,
[AC_TRY_COMPILE([
#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_TERM_H
#include <term.h>
#endif],[printf("%d",tgetstr);],
ac_cv_decl_tgetstr_def=yes, ac_cv_decl_tgetstr_def=no)
if test $ac_cv_decl_tgetstr_def != yes; then
	AC_TRY_COMPILE([
	#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_CURSES_H
	#include <curses.h>
	#endif],[printf("%d",tgetstr);],
	ac_cv_decl_tgetstr_def=yes, ac_cv_decl_tgetstr_def=no)
fi
])
AC_MSG_RESULT($ac_cv_decl_tgetstr_def)
if test $ac_cv_decl_tgetstr_def = yes; then
    AC_DEFINE(HAVE_TGETSTR_DEF)
fi


dnl ----------------------------------------------------------------------------
dnl innetgr() declarations missing
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for innetgr declaration)
AC_CACHE_VAL(ac_cv_decl_innetgr_def,
[AC_TRY_COMPILE([
#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);],
ac_cv_decl_innetgr_def=yes, ac_cv_decl_innetgr_def=no)
])
AC_MSG_RESULT($ac_cv_decl_innetgr_def)
if test $ac_cv_decl_innetgr_def = yes; then
    AC_DEFINE(HAVE_INNETGR_DEF)
fi


dnl ----------------------------------------------------------------------------
dnl openlog() declarations missing
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for openlog declaration)
AC_CACHE_VAL(ac_cv_decl_openlog_def,
[AC_TRY_COMPILE([
#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)
])
AC_MSG_RESULT($ac_cv_decl_openlog_def)
if test $ac_cv_decl_openlog_def = yes; then
    AC_DEFINE(HAVE_OPENLOG_DEF)
fi

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

AC_MSG_CHECKING(for struct in6_addr declaration)
AC_CACHE_VAL(ac_cv_decl_in6_addr_def,
[AC_TRY_COMPILE([
#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)
])
AC_MSG_RESULT($ac_cv_decl_in6_addr_def)
if test $ac_cv_decl_in6_addr_def = yes; then
    AC_DEFINE(IN6_ADDR)
fi


AC_MSG_CHECKING(for struct in_addr6 declaration (LINUX))
AC_CACHE_VAL(ac_cv_decl_in_addr6_def,
[AC_TRY_COMPILE([
#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)
])
AC_MSG_RESULT($ac_cv_decl_in_addr6_def)
if test "$ac_cv_decl_in_addr6_def" = yes; then
    AC_DEFINE(IN_ADDR6)
fi

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


AC_MSG_CHECKING(for struct stat has mtimespec.ts_nsec or mtimespec.ts_nsec)
AC_CACHE_VAL(ac_cv_decl_st_mtime_nsec_def,
[AC_TRY_COMPILE([
#include <sys/types.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/stat.h>],[struct stat statb; statb.st_mtimespec.ts_nsec;],
ac_cv_decl_st_mtime_nsec_def=st_mtimespec.ts_nsec)
])

if test -z "$ac_cv_decl_st_mtime_nsec_def" ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/stat.h>],[struct stat statb; statb.st_mtime_nsec;],
ac_cv_decl_st_mtime_nsec_def=st_mtime_nsec )
fi #}


if test -z "$ac_cv_decl_st_mtime_nsec_def" ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/stat.h>],[struct stat statb; statb.st_mtim.tv_nsec;],
ac_cv_decl_st_mtime_nsec_def=st_mtim.tv_nsec )
fi #}

if test -z "$ac_cv_decl_st_mtime_nsec_def"; then
ac_cv_decl_st_mtime_nsec_def=no
fi

AC_MSG_RESULT($ac_cv_decl_st_mtime_nsec_def)
if test ! "$ac_cv_decl_st_mtime_nsec_def" = no; then
    AC_DEFINE_UNQUOTED(ST_MTIME_NSEC,$ac_cv_decl_st_mtime_nsec_def)
fi

dnl ----------------------------------------------------------------------------
dnl make stuff:


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

AC_PROG_RANLIB
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))

dnl ----------------- GCC Compilation ----------------------------------
AC_OUTPUT(Makefile src/Makefile man/Makefile
 Makefile.bsd src/Makefile.bsd man/Makefile.bsd )