1 dnl aclocal.m4 generated automatically by aclocal 1.4
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_NONBLOCKING
40 dnl Check whether we have posix, bsd or sysv non-blocking sockets and
41 dnl define respectively NBLOCK_POSIX, NBLOCK_BSD or NBLOCK_SYSV.
43 AC_DEFUN(unet_NONBLOCKING,
44 [dnl Do we have posix, bsd or sysv non-blocking stuff ?
45 AC_CACHE_CHECK([for posix non-blocking], unet_cv_sys_nonblocking_posix,
46 [AC_TRY_RUN([#include <sys/types.h>
47 #include <sys/socket.h>
49 #include <sys/ioctl.h>
52 $ac_cv_type_signal alarmed() { exit(1); }
58 int f = socket(AF_INET, SOCK_DGRAM, 0);
59 if (f >= 0 && !(fcntl(f, F_SETFL, O_NONBLOCK)))
61 signal(SIGALRM, alarmed);
63 recvfrom(f, b, 12, 0, &x, &l);
68 }], unet_cv_sys_nonblocking_posix=yes, unet_cv_sys_nonblocking_posix=no)])
69 if test $unet_cv_sys_nonblocking_posix = yes; then
70 AC_DEFINE(NBLOCK_POSIX)
72 AC_CACHE_CHECK([for bsd non-blocking], unet_cv_sys_nonblocking_bsd,
73 [AC_TRY_RUN([#include <sys/types.h>
74 #include <sys/socket.h>
76 #include <sys/ioctl.h>
79 $ac_cv_type_signal alarmed() { exit(1); }
85 int f = socket(AF_INET, SOCK_DGRAM, 0);
86 if (f >= 0 && !(fcntl(f, F_SETFL, O_NDELAY)))
88 signal(SIGALRM, alarmed);
90 recvfrom(f, b, 12, 0, &x, &l);
95 }], unet_cv_sys_nonblocking_bsd=yes, unet_cv_sys_nonblocking_bsd=no)])
96 if test $unet_cv_sys_nonblocking_bsd = yes; then
99 AC_DEFINE(NBLOCK_SYSV)
104 dnl Macro: unet_SIGNALS
106 dnl Check if we have posix signals, reliable bsd signals or
107 dnl unreliable sysv signals and define respectively POSIX_SIGNALS,
108 dnl BSD_RELIABLE_SIGNALS or SYSV_UNRELIABLE_SIGNALS.
110 AC_DEFUN(unet_SIGNALS,
111 [dnl Do we have posix signals, reliable bsd signals or unreliable sysv signals ?
112 AC_CACHE_CHECK([for posix signals], unet_cv_sys_signal_posix,
113 [AC_TRY_COMPILE([#include <signal.h>],
114 [sigaction(SIGTERM, (struct sigaction *)0L, (struct sigaction *)0L)],
115 unet_cv_sys_signal_posix=yes, unet_cv_sys_signal_posix=no)])
116 if test $unet_cv_sys_signal_posix = yes; then
117 AC_DEFINE(POSIX_SIGNALS)
119 AC_CACHE_CHECK([for bsd reliable signals], unet_cv_sys_signal_bsd,
120 [AC_TRY_RUN([#include <signal.h>
122 $ac_cv_type_signal handler()
126 kill(getpid(), SIGTERM);
131 signal(SIGTERM, handler);
132 kill(getpid(), SIGTERM);
134 }], unet_cv_sys_signal_bsd=yes, unet_cv_sys_signal_bsd=no)])
135 if test $unet_cv_sys_signal_bsd = yes; then
136 AC_DEFINE(BSD_RELIABLE_SIGNALS)
138 AC_DEFINE(SYSV_UNRELIABLE_SIGNALS)
143 dnl Macro: unet_CHECK_TYPE_SIZES
145 dnl Check the size of several types and define a valid int16_t and int32_t.
147 AC_DEFUN(unet_CHECK_TYPE_SIZES,
148 [dnl Check type sizes
149 AC_CHECK_SIZEOF(short)
151 AC_CHECK_SIZEOF(long)
152 AC_CHECK_SIZEOF(void *)
153 if test "$ac_cv_sizeof_int" = 2 ; then
154 AC_CHECK_TYPE(int16_t, int)
155 AC_CHECK_TYPE(u_int16_t, unsigned int)
156 elif test "$ac_cv_sizeof_short" = 2 ; then
157 AC_CHECK_TYPE(int16_t, short)
158 AC_CHECK_TYPE(u_int16_t, unsigned short)
160 AC_MSG_ERROR([Cannot find a type with size of 16 bits])
162 if test "$ac_cv_sizeof_int" = 4 ; then
163 AC_CHECK_TYPE(int32_t, int)
164 AC_CHECK_TYPE(u_int32_t, unsigned int)
165 elif test "$ac_cv_sizeof_short" = 4 ; then
166 AC_CHECK_TYPE(int32_t, short)
167 AC_CHECK_TYPE(u_int32_t, unsigned short)
168 elif test "$ac_cv_sizeof_long" = 4 ; then
169 AC_CHECK_TYPE(int32_t, long)
170 AC_CHECK_TYPE(u_int32_t, unsigned long)
172 AC_MSG_ERROR([Cannot find a type with size of 32 bits])
175 dnl Written by John Hawkinson <jhawk@mit.edu>. This code is in the Public
178 dnl This test is for network applications that need socket() and
179 dnl gethostbyname() -ish functions. Under Solaris, those applications need to
180 dnl link with "-lsocket -lnsl". Under IRIX, they should *not* link with
181 dnl "-lsocket" because libsocket.a breaks a number of things (for instance:
182 dnl gethostbyname() under IRIX 5.2, and snoop sockets under most versions of
185 dnl Unfortunately, many application developers are not aware of this, and
186 dnl mistakenly write tests that cause -lsocket to be used under IRIX. It is
187 dnl also easy to write tests that cause -lnsl to be used under operating
188 dnl systems where neither are necessary (or useful), such as SunOS 4.1.4, which
189 dnl uses -lnsl for TLI.
191 dnl This test exists so that every application developer does not test this in
192 dnl a different, and subtly broken fashion.
194 dnl It has been argued that this test should be broken up into two seperate
195 dnl tests, one for the resolver libraries, and one for the libraries necessary
196 dnl for using Sockets API. Unfortunately, the two are carefully intertwined and
197 dnl allowing the autoconf user to use them independantly potentially results in
198 dnl unfortunate ordering dependancies -- as such, such component macros would
199 dnl have to carefully use indirection and be aware if the other components were
200 dnl executed. Since other autoconf macros do not go to this trouble, and almost
201 dnl no applications use sockets without the resolver, this complexity has not
202 dnl been implemented.
204 dnl The check for libresolv is in case you are attempting to link statically
205 dnl and happen to have a libresolv.a lying around (and no libnsl.a).
207 AC_DEFUN(AC_LIBRARY_NET, [
208 # Most operating systems have gethostbyname() in the default searched
209 # libraries (i.e. libc):
210 AC_CHECK_FUNC(gethostbyname, ,
211 # Some OSes (eg. Solaris) place it in libnsl:
212 AC_CHECK_LIB(nsl, gethostbyname, ,
213 # Some strange OSes (SINIX) have it in libsocket:
214 AC_CHECK_LIB(socket, gethostbyname, ,
215 # Unfortunately libsocket sometimes depends on libnsl.
216 # AC_CHECK_LIB's API is essentially broken so the following
217 # ugliness is necessary:
218 AC_CHECK_LIB(socket, gethostbyname,
219 LIBS="-lsocket -lnsl $LIBS",
220 AC_CHECK_LIB(resolv, gethostbyname),
225 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
226 AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)))
232 # @defmac AC_PROG_CC_STDC
233 # @maindex PROG_CC_STDC
235 # If the C compiler in not in ANSI C mode by default, try to add an option
236 # to output variable @code{CC} to make it so. This macro tries various
237 # options that select ANSI C on some system or another. It considers the
238 # compiler to be in ANSI C mode if it handles function prototypes correctly.
240 # If you use this macro, you should check after calling it whether the C
241 # compiler has been set to accept ANSI C; if not, the shell variable
242 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
243 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
244 # program @code{ansi2knr}, which comes with Ghostscript.
247 AC_DEFUN(AM_PROG_CC_STDC,
248 [AC_REQUIRE([AC_PROG_CC])
249 AC_BEFORE([$0], [AC_C_INLINE])
250 AC_BEFORE([$0], [AC_C_CONST])
251 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
252 dnl a magic option to avoid problems with ANSI preprocessor commands
254 dnl FIXME: can't do this because then AC_AIX won't work due to a
255 dnl circular dependency.
256 dnl AC_BEFORE([$0], [AC_PROG_CPP])
257 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
258 AC_CACHE_VAL(am_cv_prog_cc_stdc,
259 [am_cv_prog_cc_stdc=no
261 # Don't try gcc -ansi; that turns off useful extensions and
262 # breaks some systems' header files.
264 # Ultrix and OSF/1 -std1
265 # HP-UX -Aa -D_HPUX_SOURCE
266 # SVR4 -Xc -D__EXTENSIONS__
267 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
269 CC="$ac_save_CC $ac_arg"
273 #include <sys/types.h>
274 #include <sys/stat.h>
275 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
276 struct buf { int x; };
277 FILE * (*rcsopen) (struct buf *, struct stat *, int);
278 static char *e (p, i)
284 static char *f (char * (*g) (char **, int), char **p, ...)
289 s = g (p, va_arg (v,int));
293 int test (int i, double x);
294 struct s1 {int (*f) (int a);};
295 struct s2 {int (*f) (double a);};
296 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
300 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
302 [am_cv_prog_cc_stdc="$ac_arg"; break])
306 if test -z "$am_cv_prog_cc_stdc"; then
307 AC_MSG_RESULT([none needed])
309 AC_MSG_RESULT($am_cv_prog_cc_stdc)
311 case "x$am_cv_prog_cc_stdc" in
313 *) CC="$CC $am_cv_prog_cc_stdc" ;;