1 # generated automatically by aclocal 1.7.9 -*- Autoconf -*-
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 dnl Macro: unet_PIPE_CFLAGS
17 dnl If the compiler understands -pipe, add it to CFLAGS if not already
20 AC_DEFUN(unet_PIPE_CFLAGS,
21 [AC_MSG_CHECKING([if the compiler understands -pipe])
22 unet_cv_pipe_flags="$ac_cv_prog_gcc"
23 if test "$ac_cv_prog_gcc" = no; then
25 CFLAGS="$CFLAGS -pipe"
26 AC_TRY_COMPILE(,,unet_cv_pipe_flags=yes,)
29 AC_MSG_RESULT($unet_cv_pipe_flags)
30 if test "$unet_cv_pipe_flags" = yes ; then
31 x=`echo $CFLAGS | grep 'pipe' 2>/dev/null`
32 if test "$x" = "" ; then
33 CFLAGS="$CFLAGS -pipe"
39 dnl Macro: unet_NONBLOCKING
41 dnl Check whether we have posix, bsd or sysv non-blocking sockets and
42 dnl define respectively NBLOCK_POSIX, NBLOCK_BSD or NBLOCK_SYSV.
44 AC_DEFUN(unet_NONBLOCKING,
45 [dnl Do we have posix, bsd or sysv non-blocking stuff ?
46 AC_CACHE_CHECK([for posix non-blocking], unet_cv_sys_nonblocking_posix,
47 [AC_TRY_RUN([#include <sys/types.h>
48 #include <sys/socket.h>
50 #include <sys/ioctl.h>
53 $ac_cv_type_signal alarmed() { exit(1); }
59 int f = socket(AF_INET, SOCK_DGRAM, 0);
60 if (f >= 0 && !(fcntl(f, F_SETFL, O_NONBLOCK)))
62 signal(SIGALRM, alarmed);
64 recvfrom(f, b, 12, 0, &x, &l);
69 }], unet_cv_sys_nonblocking_posix=yes, unet_cv_sys_nonblocking_posix=no)])
70 if test $unet_cv_sys_nonblocking_posix = yes; then
71 AC_DEFINE([NBLOCK_POSIX],,[Define if you have POSIX non-blocking sockets.])
73 AC_CACHE_CHECK([for bsd non-blocking], unet_cv_sys_nonblocking_bsd,
74 [AC_TRY_RUN([#include <sys/types.h>
75 #include <sys/socket.h>
77 #include <sys/ioctl.h>
80 $ac_cv_type_signal alarmed() { exit(1); }
86 int f = socket(AF_INET, SOCK_DGRAM, 0);
87 if (f >= 0 && !(fcntl(f, F_SETFL, O_NDELAY)))
89 signal(SIGALRM, alarmed);
91 recvfrom(f, b, 12, 0, &x, &l);
96 }], unet_cv_sys_nonblocking_bsd=yes, unet_cv_sys_nonblocking_bsd=no)])
97 if test $unet_cv_sys_nonblocking_bsd = yes; then
98 AC_DEFINE([NBLOCK_BSD],,[Define if you have BSD non-blocking sockets.])
100 AC_DEFINE([NBLOCK_SYSV],,[Define if you have SysV non-blocking sockets.])
105 dnl Macro: unet_SIGNALS
107 dnl Check if we have posix signals, reliable bsd signals or
108 dnl unreliable sysv signals and define respectively POSIX_SIGNALS,
109 dnl BSD_RELIABLE_SIGNALS or SYSV_UNRELIABLE_SIGNALS.
111 AC_DEFUN(unet_SIGNALS,
112 [dnl Do we have posix signals, reliable bsd signals or unreliable sysv signals ?
113 AC_CACHE_CHECK([for posix signals], unet_cv_sys_signal_posix,
114 [AC_TRY_COMPILE([#include <signal.h>],
115 [sigaction(SIGTERM, (struct sigaction *)0L, (struct sigaction *)0L)],
116 unet_cv_sys_signal_posix=yes, unet_cv_sys_signal_posix=no)])
117 if test $unet_cv_sys_signal_posix = yes; then
118 AC_DEFINE([POSIX_SIGNALS],,[Define if you have POSIX signals.])
120 AC_CACHE_CHECK([for bsd reliable signals], unet_cv_sys_signal_bsd,
121 [AC_TRY_RUN([#include <signal.h>
123 $ac_cv_type_signal handler()
127 kill(getpid(), SIGTERM);
132 signal(SIGTERM, handler);
133 kill(getpid(), SIGTERM);
135 }], unet_cv_sys_signal_bsd=yes, unet_cv_sys_signal_bsd=no)])
136 if test $unet_cv_sys_signal_bsd = yes; then
137 AC_DEFINE([BSD_RELIABLE_SIGNALS],,[Define if you have (reliable) BSD signals.])
139 AC_DEFINE([SYSV_UNRELIABLE_SIGNALS],,[Define if you have (unreliable) SysV signals.])
144 dnl Macro: unet_CHECK_TYPE_SIZES
146 dnl Check the size of several types and define a valid int16_t and int32_t.
148 AC_DEFUN(unet_CHECK_TYPE_SIZES,
149 [dnl Check type sizes
150 AC_CHECK_SIZEOF(short)
152 AC_CHECK_SIZEOF(long)
153 AC_CHECK_SIZEOF(void *)
154 AC_CHECK_SIZEOF(int64_t)
155 AC_CHECK_SIZEOF(long long)
156 if test "$ac_cv_sizeof_int" = 2 ; then
157 AC_CHECK_TYPE(int16_t, int)
158 AC_CHECK_TYPE(uint16_t, unsigned int)
159 elif test "$ac_cv_sizeof_short" = 2 ; then
160 AC_CHECK_TYPE(int16_t, short)
161 AC_CHECK_TYPE(uint16_t, unsigned short)
163 AC_MSG_ERROR([Cannot find a type with size of 16 bits])
165 if test "$ac_cv_sizeof_int" = 4 ; then
166 AC_CHECK_TYPE(int32_t, int)
167 AC_CHECK_TYPE(uint32_t, unsigned int)
168 elif test "$ac_cv_sizeof_short" = 4 ; then
169 AC_CHECK_TYPE(int32_t, short)
170 AC_CHECK_TYPE(uint32_t, unsigned short)
171 elif test "$ac_cv_sizeof_long" = 4 ; then
172 AC_CHECK_TYPE(int32_t, long)
173 AC_CHECK_TYPE(uint32_t, unsigned long)
175 AC_MSG_ERROR([Cannot find a type with size of 32 bits])
177 if test "$ac_cv_sizeof_int64_t" = 8 ; then
178 AC_CHECK_TYPE(int64_t)
179 AC_CHECK_TYPE(uint64_t)
180 elif test "$ac_cv_sizeof_long_long" = 8 ; then
181 AC_CHECK_TYPE(int64_t, long long)
182 AC_CHECK_TYPE(uint64_t, unsigned long long)
184 AC_MSG_ERROR([Cannot find a type with size of 64 bits])
187 dnl Written by John Hawkinson <jhawk@mit.edu>. This code is in the Public
190 dnl This test is for network applications that need socket() and
191 dnl gethostbyname() -ish functions. Under Solaris, those applications need to
192 dnl link with "-lsocket -lnsl". Under IRIX, they should *not* link with
193 dnl "-lsocket" because libsocket.a breaks a number of things (for instance:
194 dnl gethostbyname() under IRIX 5.2, and snoop sockets under most versions of
197 dnl Unfortunately, many application developers are not aware of this, and
198 dnl mistakenly write tests that cause -lsocket to be used under IRIX. It is
199 dnl also easy to write tests that cause -lnsl to be used under operating
200 dnl systems where neither are necessary (or useful), such as SunOS 4.1.4, which
201 dnl uses -lnsl for TLI.
203 dnl This test exists so that every application developer does not test this in
204 dnl a different, and subtly broken fashion.
206 dnl It has been argued that this test should be broken up into two seperate
207 dnl tests, one for the resolver libraries, and one for the libraries necessary
208 dnl for using Sockets API. Unfortunately, the two are carefully intertwined and
209 dnl allowing the autoconf user to use them independantly potentially results in
210 dnl unfortunate ordering dependancies -- as such, such component macros would
211 dnl have to carefully use indirection and be aware if the other components were
212 dnl executed. Since other autoconf macros do not go to this trouble, and almost
213 dnl no applications use sockets without the resolver, this complexity has not
214 dnl been implemented.
216 dnl The check for libresolv is in case you are attempting to link statically
217 dnl and happen to have a libresolv.a lying around (and no libnsl.a).
219 AC_DEFUN(AC_LIBRARY_NET, [
220 # Most operating systems have gethostbyname() in the default searched
221 # libraries (i.e. libc):
222 AC_CHECK_FUNC(gethostbyname, ,
223 # Some OSes (eg. Solaris) place it in libnsl:
224 AC_CHECK_LIB(nsl, gethostbyname, ,
225 # Some strange OSes (SINIX) have it in libsocket:
226 AC_CHECK_LIB(socket, gethostbyname, ,
227 # Unfortunately libsocket sometimes depends on libnsl.
228 # AC_CHECK_LIB's API is essentially broken so the following
229 # ugliness is necessary:
230 AC_CHECK_LIB(socket, gethostbyname,
231 LIBS="-lsocket -lnsl $LIBS",
232 AC_CHECK_LIB(resolv, gethostbyname),
237 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
238 AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)))
242 # Copyright 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
244 # This program is free software; you can redistribute it and/or modify
245 # it under the terms of the GNU General Public License as published by
246 # the Free Software Foundation; either version 2, or (at your option)
249 # This program is distributed in the hope that it will be useful,
250 # but WITHOUT ANY WARRANTY; without even the implied warranty of
251 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
252 # GNU General Public License for more details.
254 # You should have received a copy of the GNU General Public License
255 # along with this program; if not, write to the Free Software
256 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
261 # @defmac AC_PROG_CC_STDC
262 # @maindex PROG_CC_STDC
264 # If the C compiler in not in ANSI C mode by default, try to add an option
265 # to output variable @code{CC} to make it so. This macro tries various
266 # options that select ANSI C on some system or another. It considers the
267 # compiler to be in ANSI C mode if it handles function prototypes correctly.
269 # If you use this macro, you should check after calling it whether the C
270 # compiler has been set to accept ANSI C; if not, the shell variable
271 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
272 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
273 # program @code{ansi2knr}, which comes with Ghostscript.
276 AC_DEFUN([AM_PROG_CC_STDC],
277 [AC_REQUIRE([AC_PROG_CC])
278 AC_BEFORE([$0], [AC_C_INLINE])
279 AC_BEFORE([$0], [AC_C_CONST])
280 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
281 dnl a magic option to avoid problems with ANSI preprocessor commands
283 dnl FIXME: can't do this because then AC_AIX won't work due to a
284 dnl circular dependency.
285 dnl AC_BEFORE([$0], [AC_PROG_CPP])
286 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
287 AC_CACHE_VAL(am_cv_prog_cc_stdc,
288 [am_cv_prog_cc_stdc=no
290 # Don't try gcc -ansi; that turns off useful extensions and
291 # breaks some systems' header files.
293 # Ultrix and OSF/1 -std1
294 # HP-UX 10.20 and later -Ae
295 # HP-UX older versions -Aa -D_HPUX_SOURCE
296 # SVR4 -Xc -D__EXTENSIONS__
297 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
299 CC="$ac_save_CC $ac_arg"
303 #include <sys/types.h>
304 #include <sys/stat.h>
305 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
306 struct buf { int x; };
307 FILE * (*rcsopen) (struct buf *, struct stat *, int);
308 static char *e (p, i)
314 static char *f (char * (*g) (char **, int), char **p, ...)
319 s = g (p, va_arg (v,int));
323 int test (int i, double x);
324 struct s1 {int (*f) (int a);};
325 struct s2 {int (*f) (double a);};
326 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
330 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
332 [am_cv_prog_cc_stdc="$ac_arg"; break])
336 if test -z "$am_cv_prog_cc_stdc"; then
337 AC_MSG_RESULT([none needed])
339 AC_MSG_RESULT([$am_cv_prog_cc_stdc])
341 case "x$am_cv_prog_cc_stdc" in
343 *) CC="$CC $am_cv_prog_cc_stdc" ;;
347 AU_DEFUN([fp_PROG_CC_STDC], [AM_PROG_CC_STDC])