1dnl Process this file with autoconf to produce a configure script.
2dnl
3dnl Copyright 1998 - 2002 Double Precision, Inc.  See COPYING for
4dnl distribution information.
5
6AC_INIT(random128, 0.10, [courier-users@lists.sourceforge.net])
7
8>confdefs.h  # Kill PACKAGE_ macros
9
10AC_CONFIG_SRCDIR(random128.c)
11AC_CONFIG_AUX_DIR(../..)
12AM_INIT_AUTOMAKE([foreign no-define])
13LPATH="$PATH:/usr/local/bin"
14
15
16dnl Checks for programs.
17AC_CONFIG_HEADERS(config.h)
18AC_USE_SYSTEM_EXTENSIONS
19AC_PROG_INSTALL
20AC_PROG_LN_S
21AC_PROG_CC
22AC_PROG_CC_C99
23AC_PATH_PROGS(PS, ps, ps, $LPATH)
24AC_PATH_PROGS(W, w, w, $LPATH)
25AC_PROG_LIBTOOL
26
27if test "$PS" = "ps"
28then
29	AC_MSG_ERROR(Cannot find pathname to ps)
30fi
31
32if test x$GXX = xyes
33then
34	CFLAGS="-Wall $CFLAGS"
35fi
36
37CFLAGS="-I.. -I$srcdir/.. $CFLAGS"
38
39dnl Checks for libraries.
40
41dnl Checks for header files.
42AC_HEADER_SYS_WAIT
43AC_CHECK_HEADERS(unistd.h fcntl.h)
44
45AC_TYPE_PID_T
46AC_SYS_LARGEFILE
47
48AC_ARG_WITH(random, [ --with-random=/dev/urandom - location of the system random file generator
49--without-random            - there is no system random file generator ],
50	random="$withval",
51	random="y")
52
53case "$random" in
54/*)
55	;;
56y*|1*)
57	AC_CACHE_CHECK([for random source],random_cv_RANDOM,
58
59		if test -c /dev/urandom
60		then
61			random_cv_RANDOM=/dev/urandom
62		else
63			if test -c /dev/random
64			then
65				random_cv_RANDOM=/dev/random
66			else
67				random_cv_RANDOM="none"
68			fi
69		fi
70	)
71	random="$random_cv_RANDOM"
72	;;
73*)
74	random="none"
75	;;
76esac
77
78if test "$random" != "none"
79then
80	AC_DEFINE_UNQUOTED(RANDOM, "$random", [ Entropy source ])
81fi
82
83AC_CACHE_CHECK([for some good options for ps],random_cv_PS_OPTIONS,
84
85	for opts in -Afl -Afw -Af -Al -afl -afw -af -al Afl Afw Af Al afl afw af al
86	do
87		ps $opts >/dev/null 2>/dev/null || continue
88		break
89	done
90	random_cv_PS_OPTIONS="$opts"
91)
92
93AC_DEFINE_UNQUOTED(PS_OPTIONS,"$random_cv_PS_OPTIONS",
94	[ How to make ps(1) spit out lots of crap ])
95AC_DEFINE_UNQUOTED(PS,"$PS", [ The PS program ])
96
97if test "$W" != "w"
98then
99	AC_DEFINE_UNQUOTED(W, "$w", [ The W program ])
100fi
101
102AC_OUTPUT(Makefile)
103