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 if test "$ac_cv_sizeof_int" = 2 ; then
155 AC_CHECK_TYPE(int16_t, int)
156 AC_CHECK_TYPE(uint16_t, unsigned int)
157 elif test "$ac_cv_sizeof_short" = 2 ; then
158 AC_CHECK_TYPE(int16_t, short)
159 AC_CHECK_TYPE(uint16_t, unsigned short)
161 AC_MSG_ERROR([Cannot find a type with size of 16 bits])
163 if test "$ac_cv_sizeof_int" = 4 ; then
164 AC_CHECK_TYPE(int32_t, int)
165 AC_CHECK_TYPE(uint32_t, unsigned int)
166 elif test "$ac_cv_sizeof_short" = 4 ; then
167 AC_CHECK_TYPE(int32_t, short)
168 AC_CHECK_TYPE(uint32_t, unsigned short)
169 elif test "$ac_cv_sizeof_long" = 4 ; then
170 AC_CHECK_TYPE(int32_t, long)
171 AC_CHECK_TYPE(uint32_t, unsigned long)
173 AC_MSG_ERROR([Cannot find a type with size of 32 bits])
176 dnl Written by John Hawkinson <jhawk@mit.edu>. This code is in the Public
179 dnl This test is for network applications that need socket() and
180 dnl gethostbyname() -ish functions. Under Solaris, those applications need to
181 dnl link with "-lsocket -lnsl". Under IRIX, they should *not* link with
182 dnl "-lsocket" because libsocket.a breaks a number of things (for instance:
183 dnl gethostbyname() under IRIX 5.2, and snoop sockets under most versions of
186 dnl Unfortunately, many application developers are not aware of this, and
187 dnl mistakenly write tests that cause -lsocket to be used under IRIX. It is
188 dnl also easy to write tests that cause -lnsl to be used under operating
189 dnl systems where neither are necessary (or useful), such as SunOS 4.1.4, which
190 dnl uses -lnsl for TLI.
192 dnl This test exists so that every application developer does not test this in
193 dnl a different, and subtly broken fashion.
195 dnl It has been argued that this test should be broken up into two seperate
196 dnl tests, one for the resolver libraries, and one for the libraries necessary
197 dnl for using Sockets API. Unfortunately, the two are carefully intertwined and
198 dnl allowing the autoconf user to use them independantly potentially results in
199 dnl unfortunate ordering dependancies -- as such, such component macros would
200 dnl have to carefully use indirection and be aware if the other components were
201 dnl executed. Since other autoconf macros do not go to this trouble, and almost
202 dnl no applications use sockets without the resolver, this complexity has not
203 dnl been implemented.
205 dnl The check for libresolv is in case you are attempting to link statically
206 dnl and happen to have a libresolv.a lying around (and no libnsl.a).
208 AC_DEFUN(AC_LIBRARY_NET, [
209 # Most operating systems have gethostbyname() in the default searched
210 # libraries (i.e. libc):
211 AC_CHECK_FUNC(gethostbyname, ,
212 # Some OSes (eg. Solaris) place it in libnsl:
213 AC_CHECK_LIB(nsl, gethostbyname, ,
214 # Some strange OSes (SINIX) have it in libsocket:
215 AC_CHECK_LIB(socket, gethostbyname, ,
216 # Unfortunately libsocket sometimes depends on libnsl.
217 # AC_CHECK_LIB's API is essentially broken so the following
218 # ugliness is necessary:
219 AC_CHECK_LIB(socket, gethostbyname,
220 LIBS="-lsocket -lnsl $LIBS",
221 AC_CHECK_LIB(resolv, gethostbyname),
226 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
227 AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)))
231 # Copyright 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
233 # This program is free software; you can redistribute it and/or modify
234 # it under the terms of the GNU General Public License as published by
235 # the Free Software Foundation; either version 2, or (at your option)
238 # This program is distributed in the hope that it will be useful,
239 # but WITHOUT ANY WARRANTY; without even the implied warranty of
240 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
241 # GNU General Public License for more details.
243 # You should have received a copy of the GNU General Public License
244 # along with this program; if not, write to the Free Software
245 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
250 # @defmac AC_PROG_CC_STDC
251 # @maindex PROG_CC_STDC
253 # If the C compiler in not in ANSI C mode by default, try to add an option
254 # to output variable @code{CC} to make it so. This macro tries various
255 # options that select ANSI C on some system or another. It considers the
256 # compiler to be in ANSI C mode if it handles function prototypes correctly.
258 # If you use this macro, you should check after calling it whether the C
259 # compiler has been set to accept ANSI C; if not, the shell variable
260 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
261 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
262 # program @code{ansi2knr}, which comes with Ghostscript.
265 AC_DEFUN([AM_PROG_CC_STDC],
266 [AC_REQUIRE([AC_PROG_CC])
267 AC_BEFORE([$0], [AC_C_INLINE])
268 AC_BEFORE([$0], [AC_C_CONST])
269 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
270 dnl a magic option to avoid problems with ANSI preprocessor commands
272 dnl FIXME: can't do this because then AC_AIX won't work due to a
273 dnl circular dependency.
274 dnl AC_BEFORE([$0], [AC_PROG_CPP])
275 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
276 AC_CACHE_VAL(am_cv_prog_cc_stdc,
277 [am_cv_prog_cc_stdc=no
279 # Don't try gcc -ansi; that turns off useful extensions and
280 # breaks some systems' header files.
282 # Ultrix and OSF/1 -std1
283 # HP-UX 10.20 and later -Ae
284 # HP-UX older versions -Aa -D_HPUX_SOURCE
285 # SVR4 -Xc -D__EXTENSIONS__
286 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
288 CC="$ac_save_CC $ac_arg"
292 #include <sys/types.h>
293 #include <sys/stat.h>
294 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
295 struct buf { int x; };
296 FILE * (*rcsopen) (struct buf *, struct stat *, int);
297 static char *e (p, i)
303 static char *f (char * (*g) (char **, int), char **p, ...)
308 s = g (p, va_arg (v,int));
312 int test (int i, double x);
313 struct s1 {int (*f) (int a);};
314 struct s2 {int (*f) (double a);};
315 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
319 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
321 [am_cv_prog_cc_stdc="$ac_arg"; break])
325 if test -z "$am_cv_prog_cc_stdc"; then
326 AC_MSG_RESULT([none needed])
328 AC_MSG_RESULT([$am_cv_prog_cc_stdc])
330 case "x$am_cv_prog_cc_stdc" in
332 *) CC="$CC $am_cv_prog_cc_stdc" ;;
336 AU_DEFUN([fp_PROG_CC_STDC], [AM_PROG_CC_STDC])