1dnl
2dnl configure.in for the Dancer project
3dnl
4
5AC_INIT(dancer.h)
6AC_CONFIG_HEADER(config.h)
7
8dnl Check compiler
9
10CFLAGS=""
11AC_PROG_CC
12AC_C_INLINE
13
14dnl Check libraries
15
16AC_CHECK_LIB(m, exp)
17AC_CHECK_LIB(nsl, gethostbyname)
18AC_CHECK_LIB(socket, socket)
19AC_CHECK_LIB(ucb, gethostname)
20AC_CHECK_LIB(crypt, crypt)
21AC_CHECK_LIB(fpl, fplExecuteFile)
22
23dnl Checks for header files.
24
25AC_HEADER_STDC
26AC_CHECK_HEADERS(limits.h sys/time.h unistd.h pwd.h)
27
28dnl Checks for typedefs, structures, and compiler characteristics.
29
30AC_C_CONST
31AC_TYPE_SIZE_T
32AC_HEADER_TIME
33AC_STRUCT_TM
34AC_CHECK_TYPE(ulong, unsigned long)
35
36dnl Checks for library functions.
37
38AC_FUNC_ALLOCA
39AC_TYPE_SIGNAL
40AC_FUNC_VPRINTF
41AC_CHECK_FUNCS(gettimeofday mktime strftime)
42AC_CHECK_FUNCS(strdup strstr strtol strtoul atol strsep strcasecmp memmove)
43AC_CHECK_FUNCS(gethostname getdomainname select socket strerror getdtablesize)
44AC_CHECK_FUNCS(yp_get_default_domain yp_master inet_ntoa)
45AC_CHECK_FUNCS(re_comp regcomp _crypt)
46
47dnl
48dnl check if %n is available in sscanf()
49dnl
50
51AC_MSG_CHECKING(for %n in scanf)
52AC_TRY_RUN([
53#include <stdio.h>
54main()
55{
56  int a, b, i = 0;
57  char buf[] = "1 2";
58
59  sscanf(buf, "%d %d %n", &a, &b, &i);
60  exit (i-strlen(buf));
61}
62],AC_DEFINE(HAVE_N_IN_SCANF) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), :)
63
64dnl
65dnl following two checks "borrowed" from ircd
66dnl
67
68dnl
69dnl check for non-blocking fd style available..
70dnl
71
72AC_MSG_CHECKING(for non-blocking)
73changequote(<<, >>)dnl
74<<
75precode='#include <sys/types.h>
76#include <sys/socket.h>
77#include <fcntl.h>
78#include <sys/ioctl.h>
79#include <sys/file.h>
80#include <signal.h>
81
82alarmed()
83{
84        exit(1);
85}
86
87main()
88{
89        char b[12], x[32];
90        int f, l = sizeof(x);
91        f = socket(AF_INET, SOCK_DGRAM, 0);
92        if (f >= 0 && !(fcntl(f, F_SETFL,'
93postcode='))) {
94                signal(SIGALRM, alarmed);
95                alarm(3);
96                recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l);
97                alarm(0);
98                exit(0);
99        }
100        exit(1);
101}'
102>>
103changequote([, ])dnl
104
105code="$precode O_NONBLOCK $postcode"
106
107AC_TRY_RUN($code,
108  AC_DEFINE(NBLOCK_POSIX)
109  AC_MSG_RESULT(posix),
110  code="$precode O_NDELAY $postcode"
111  AC_TRY_RUN($code,
112    AC_DEFINE(NBLOCK_BSD)
113    AC_MSG_RESULT(bsd),
114    code="$precode FIONBIO $postcode"
115    AC_TRY_RUN($code,
116      AC_DEFINE(NBLOCK_SYSV)
117      AC_MSG_RESULT(system v),
118      AC_MSG_WARN(i can't find a working non blocking system),
119      :),
120    :),
121  :)
122
123
124dnl
125dnl check for sys_errlist declaration
126dnl
127
128AC_MSG_CHECKING(for sys_errlist declaration)
129AC_TRY_RUN([
130#include <sys/types.h>
131#include <stdio.h>
132#include <errno.h>
133main()
134{
135  char *s = sys_errlist[0];
136  exit(0);
137}
138],AC_DEFINE(SYS_ERRLIST_DECLARED) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), :)
139
140AC_OUTPUT(Makefile)
141