1 dnl aclocal.m4 generated automatically by aclocal 1.4a
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
14 dnl Macro: unet_PIPE_CFLAGS
16 dnl If the compiler understands -pipe, add it to CFLAGS if not already
19 AC_DEFUN(unet_PIPE_CFLAGS,
20 [AC_MSG_CHECKING([if the compiler understands -pipe])
21 unet_cv_pipe_flags="$ac_cv_prog_gcc"
22 if test "$ac_cv_prog_gcc" = no; then
24 CFLAGS="$CFLAGS -pipe"
25 AC_TRY_COMPILE(,,unet_cv_pipe_flags=yes,)
28 AC_MSG_RESULT($unet_cv_pipe_flags)
29 if test "$unet_cv_pipe_flags" = yes ; then
30 x=`echo $CFLAGS | grep 'pipe' 2>/dev/null`
31 if test "$x" = "" ; then
32 CFLAGS="$CFLAGS -pipe"
38 dnl Macro: unet_CHECK_LIB_RESOLV
40 dnl Check for res_mkquery in -lresolv and add that to LIBS when needed.
42 AC_DEFUN(unet_CHECK_LIB_RESOLV,
43 [AC_CACHE_CHECK([for res_mkquery in -lresolv], unet_cv_lib_resolv,
44 [AC_TRY_LINK([struct rrec;
45 extern int res_mkquery(int, const char *, int, int, const char *,
46 int, struct rrec *, unsigned char *, int);],
55 res_mkquery(op,dname,class,type,data,datalen,newrr,buf,buflen)],
56 unet_cv_lib_resolv=no, [OLD_LIBS="$LIBS"
58 AC_TRY_LINK([extern char *_res;], [*_res=0],
59 unet_cv_lib_resolv=yes, unet_cv_lib_resolv=no)
61 if test $unet_cv_lib_resolv = yes; then
62 AC_DEFINE(HAVE_LIB_RESOLV)
67 dnl Macro: unet_NONBLOCKING
69 dnl Check whether we have posix, bsd or sysv non-blocking sockets and
70 dnl define respectively NBLOCK_POSIX, NBLOCK_BSD or NBLOCK_SYSV.
72 AC_DEFUN(unet_NONBLOCKING,
73 [dnl Do we have posix, bsd or sysv non-blocking stuff ?
74 AC_CACHE_CHECK([for posix non-blocking], unet_cv_sys_nonblocking_posix,
75 [AC_TRY_RUN([#include <sys/types.h>
76 #include <sys/socket.h>
78 #include <sys/ioctl.h>
81 $ac_cv_type_signal alarmed() { exit(1); }
87 int f = socket(AF_INET, SOCK_DGRAM, 0);
88 if (f >= 0 && !(fcntl(f, F_SETFL, O_NONBLOCK)))
90 signal(SIGALRM, alarmed);
92 recvfrom(f, b, 12, 0, &x, &l);
97 }], unet_cv_sys_nonblocking_posix=yes, unet_cv_sys_nonblocking_posix=no)])
98 if test $unet_cv_sys_nonblocking_posix = yes; then
99 AC_DEFINE(NBLOCK_POSIX)
101 AC_CACHE_CHECK([for bsd non-blocking], unet_cv_sys_nonblocking_bsd,
102 [AC_TRY_RUN([#include <sys/types.h>
103 #include <sys/socket.h>
105 #include <sys/ioctl.h>
106 #include <sys/file.h>
108 $ac_cv_type_signal alarmed() { exit(1); }
113 size_t l = sizeof(x);
114 int f = socket(AF_INET, SOCK_DGRAM, 0);
115 if (f >= 0 && !(fcntl(f, F_SETFL, O_NDELAY)))
117 signal(SIGALRM, alarmed);
119 recvfrom(f, b, 12, 0, &x, &l);
124 }], unet_cv_sys_nonblocking_bsd=yes, unet_cv_sys_nonblocking_bsd=no)])
125 if test $unet_cv_sys_nonblocking_bsd = yes; then
126 AC_DEFINE(NBLOCK_BSD)
128 AC_DEFINE(NBLOCK_SYSV)
133 dnl Macro: unet_SIGNALS
135 dnl Check if we have posix signals, reliable bsd signals or
136 dnl unreliable sysv signals and define respectively POSIX_SIGNALS,
137 dnl BSD_RELIABLE_SIGNALS or SYSV_UNRELIABLE_SIGNALS.
139 AC_DEFUN(unet_SIGNALS,
140 [dnl Do we have posix signals, reliable bsd signals or unreliable sysv signals ?
141 AC_CACHE_CHECK([for posix signals], unet_cv_sys_signal_posix,
142 [AC_TRY_COMPILE([#include <signal.h>],
143 [sigaction(SIGTERM, (struct sigaction *)0L, (struct sigaction *)0L)],
144 unet_cv_sys_signal_posix=yes, unet_cv_sys_signal_posix=no)])
145 if test $unet_cv_sys_signal_posix = yes; then
146 AC_DEFINE(POSIX_SIGNALS)
148 AC_CACHE_CHECK([for bsd reliable signals], unet_cv_sys_signal_bsd,
149 [AC_TRY_RUN([#include <signal.h>
151 $ac_cv_type_signal handler()
155 kill(getpid(), SIGTERM);
160 signal(SIGTERM, handler);
161 kill(getpid(), SIGTERM);
163 }], unet_cv_sys_signal_bsd=yes, unet_cv_sys_signal_bsd=no)])
164 if test $unet_cv_sys_signal_bsd = yes; then
165 AC_DEFINE(BSD_RELIABLE_SIGNALS)
167 AC_DEFINE(SYSV_UNRELIABLE_SIGNALS)
172 dnl Macro: unet_DEFINE_SIZE_T_FMT
174 dnl Define SIZE_T_FMT to be "%u" or "%lu", whichever seems more appropriate.
176 AC_DEFUN(unet_DEFINE_SIZE_T_FMT,
177 [dnl Make educated guess :/, if size_t is a long or not
178 AC_CHECK_SIZEOF(size_t)dnl
179 AC_MSG_CHECKING(printf format of size_t)
180 if test "$ac_cv_sizeof_size_t" = 4 ; then
182 AC_DEFINE(SIZE_T_FMT, "%u")
185 AC_DEFINE(SIZE_T_FMT, "%lu")
189 dnl Macro: unet_DEFINE_TIME_T_FMT
191 dnl Try to figure out if time_t is an int or not, and if so define
192 dnl TIME_T_FMT to be "%u", otherwise define it to be "%lu".
193 dnl Likewise define STIME_T_FMT for the signed format.
195 AC_DEFUN(unet_DEFINE_TIME_T_FMT,
196 [dnl Make educated guess :/, if time_t is a long or not
197 AC_MSG_CHECKING(size of time_t)
198 AC_CACHE_VAL(unet_cv_sizeof_time_t,
199 [AC_TRY_RUN([#include <stdio.h>
200 #include <sys/types.h>
203 FILE *f=fopen("conftestval", "w");
205 fprintf(f, "%d\n", sizeof(time_t));
207 }], unet_cv_sizeof_time_t=`cat conftestval`,
208 unet_cv_sizeof_time_t=0, unet_cv_sizeof_time_t=0)])
209 if test "$unet_cv_sizeof_time_t" = 0 ; then
210 AC_MSG_RESULT(unknown)
211 AC_DEFINE(TIME_T_FMT, "%lu")
212 AC_DEFINE(STIME_T_FMT, "%ld")
214 AC_MSG_RESULT([$unet_cv_sizeof_time_t])
215 AC_MSG_CHECKING(printf format of time_t)
216 if test "$unet_cv_sizeof_time_t" = "$ac_cv_sizeof_long" ; then
218 AC_DEFINE(TIME_T_FMT, "%lu")
219 AC_DEFINE(STIME_T_FMT, "%ld")
222 AC_DEFINE(TIME_T_FMT, "%u")
223 AC_DEFINE(STIME_T_FMT, "%d")
228 dnl Macro: unet_CHECK_TYPE_SIZES
230 dnl Check the size of several types and define a valid int16_t and int32_t.
232 AC_DEFUN(unet_CHECK_TYPE_SIZES,
233 [dnl Check type sizes
234 AC_CHECK_SIZEOF(short)
236 AC_CHECK_SIZEOF(long)
237 AC_CHECK_SIZEOF(void *)
238 if test "$ac_cv_sizeof_int" = 2 ; then
239 AC_CHECK_TYPE(int16_t, int)
240 AC_CHECK_TYPE(u_int16_t, unsigned int)
241 elif test "$ac_cv_sizeof_short" = 2 ; then
242 AC_CHECK_TYPE(int16_t, short)
243 AC_CHECK_TYPE(u_int16_t, unsigned short)
245 AC_MSG_ERROR([Cannot find a type with size of 16 bits])
247 if test "$ac_cv_sizeof_int" = 4 ; then
248 AC_CHECK_TYPE(int32_t, int)
249 AC_CHECK_TYPE(u_int32_t, unsigned int)
250 elif test "$ac_cv_sizeof_short" = 4 ; then
251 AC_CHECK_TYPE(int32_t, short)
252 AC_CHECK_TYPE(u_int32_t, unsigned short)
253 elif test "$ac_cv_sizeof_long" = 4 ; then
254 AC_CHECK_TYPE(int32_t, long)
255 AC_CHECK_TYPE(u_int32_t, unsigned long)
257 AC_MSG_ERROR([Cannot find a type with size of 32 bits])
261 dnl Macro: unet_FUNC_POLL_SYSCALL
263 dnl Try to figure out if we have a system call poll (not if it is emulated).
264 dnl Manical laughter...
266 AC_DEFUN(unet_FUNC_POLL_SYSCALL,
267 [AC_CHECK_HEADERS(poll.h)dnl
268 if test -z "$unet_cv_func_poll_syscall" ; then
269 AC_MSG_CHECKING([if poll is a system call (please wait)])
271 AC_MSG_CHECKING([if poll is a system call])
273 AC_CACHE_VAL(unet_cv_func_poll_syscall,
274 [unet_cv_func_poll_syscall=no
275 dnl No need to go through the trouble when we don't have poll.h:
277 if test "$ac_cv_header_poll_h" = yes; then
278 unet_dirs=`find /usr/include/sys -type f -name '*.h' -exec egrep '^#include <[^/]*/.*>' {} \; | sed -e 's/^.*<//' -e 's%/.*$%%' | sort | uniq`
279 for i in $unet_dirs ; do
280 if test "$unet_cv_func_poll_syscall" = no ; then
281 unet_files=`ls /usr/include/$i/*.h 2> /dev/null`
282 if test -n "$unet_files" ; then
283 for j in $unet_files ; do
284 if test "$unet_cv_func_poll_syscall" = no ; then
285 unet_line=`egrep '^#define[[:space:]]+[[:alnum:]_]*[Pp][Oo][Ll][Ll]' $j`
286 if test -n "$unet_line" ; then
287 unet_sig=`echo "$unet_line" | sed -e 's/poll/fork/g' -e 's/POLL/FORK/g' -e 's/[[:space:]]//g' -e 's%/\*.*\*/%%g' -e 's/[0-9]//g'`
288 unet_set=`for k in "$unet_sig" ; do echo $k; done | sed -e 's% %|%g'`
289 unet_match=`sed -e 's/[[:space:]]//g' -e 's%/\*.*\*/%%g' -e 's/[0-9]//g' $j | egrep "$unet_set"`
290 if test -n "$unet_match" ; then
291 unet_cv_func_poll_syscall=yes
302 AC_MSG_RESULT([$unet_cv_func_poll_syscall])
308 # @defmac AC_PROG_CC_STDC
309 # @maindex PROG_CC_STDC
311 # If the C compiler in not in ANSI C mode by default, try to add an option
312 # to output variable @code{CC} to make it so. This macro tries various
313 # options that select ANSI C on some system or another. It considers the
314 # compiler to be in ANSI C mode if it handles function prototypes correctly.
316 # If you use this macro, you should check after calling it whether the C
317 # compiler has been set to accept ANSI C; if not, the shell variable
318 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
319 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
320 # program @code{ansi2knr}, which comes with Ghostscript.
323 AC_DEFUN(AM_PROG_CC_STDC,
324 [AC_REQUIRE([AC_PROG_CC])
325 AC_BEFORE([$0], [AC_C_INLINE])
326 AC_BEFORE([$0], [AC_C_CONST])
327 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
328 dnl a magic option to avoid problems with ANSI preprocessor commands
330 dnl FIXME: can't do this because then AC_AIX won't work due to a
331 dnl circular dependency.
332 dnl AC_BEFORE([$0], [AC_PROG_CPP])
333 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
334 AC_CACHE_VAL(am_cv_prog_cc_stdc,
335 [am_cv_prog_cc_stdc=no
337 # Don't try gcc -ansi; that turns off useful extensions and
338 # breaks some systems' header files.
340 # Ultrix and OSF/1 -std1
341 # HP-UX -Aa -D_HPUX_SOURCE
342 # SVR4 -Xc -D__EXTENSIONS__
343 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
345 CC="$ac_save_CC $ac_arg"
349 #include <sys/types.h>
350 #include <sys/stat.h>
351 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
352 struct buf { int x; };
353 FILE * (*rcsopen) (struct buf *, struct stat *, int);
354 static char *e (p, i)
360 static char *f (char * (*g) (char **, int), char **p, ...)
365 s = g (p, va_arg (v,int));
369 int test (int i, double x);
370 struct s1 {int (*f) (int a);};
371 struct s2 {int (*f) (double a);};
372 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
376 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
378 [am_cv_prog_cc_stdc="$ac_arg"; break])
382 if test -z "$am_cv_prog_cc_stdc"; then
383 AC_MSG_RESULT([none needed])
385 AC_MSG_RESULT($am_cv_prog_cc_stdc)
387 case "x$am_cv_prog_cc_stdc" in
389 *) CC="$CC $am_cv_prog_cc_stdc" ;;