Fix bugs exposed by hikari's update to configure.in.
[ircu2.10.12-pk.git] / aclocal.m4
1 # generated automatically by aclocal 1.7.9 -*- Autoconf -*-
2
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.
8
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
12 # PARTICULAR PURPOSE.
13
14 dnl
15 dnl Macro: unet_PIPE_CFLAGS
16 dnl
17 dnl   If the compiler understands -pipe, add it to CFLAGS if not already
18 dnl   there.
19 dnl
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
24   OLDCFLAGS="$CFLAGS"
25   CFLAGS="$CFLAGS -pipe"
26   AC_TRY_COMPILE(,,unet_cv_pipe_flags=yes,)
27   CFLAGS="$OLDCFLAGS"
28 fi
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"
34   fi
35 fi
36 ])
37
38 dnl
39 dnl Macro: unet_NONBLOCKING
40 dnl
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.
43 dnl
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>
49 #include <fcntl.h>
50 #include <sys/ioctl.h>
51 #include <sys/file.h>
52 #include <signal.h>
53 $ac_cv_type_signal alarmed() { exit(1); }
54 int main(void)
55 {
56   char b[12];
57   struct sockaddr x;
58   size_t l = sizeof(x);
59   int f = socket(AF_INET, SOCK_DGRAM, 0);
60   if (f >= 0 && !(fcntl(f, F_SETFL, O_NONBLOCK)))
61   {
62     signal(SIGALRM, alarmed);
63     alarm(2);
64     recvfrom(f, b, 12, 0, &x, &l);
65     alarm(0);
66     exit(0);
67   }
68   exit(1);
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.])
72 else
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>
76 #include <fcntl.h>
77 #include <sys/ioctl.h>
78 #include <sys/file.h>
79 #include <signal.h>
80 $ac_cv_type_signal alarmed() { exit(1); }
81 int main(void)
82 {
83   char b[12];
84   struct sockaddr x;
85   size_t l = sizeof(x);
86   int f = socket(AF_INET, SOCK_DGRAM, 0);
87   if (f >= 0 && !(fcntl(f, F_SETFL, O_NDELAY)))
88   {
89     signal(SIGALRM, alarmed);
90     alarm(2);
91     recvfrom(f, b, 12, 0, &x, &l);
92     alarm(0);
93     exit(0);
94   }
95   exit(1);
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.])
99 else
100   AC_DEFINE([NBLOCK_SYSV],,[Define if you have SysV non-blocking sockets.])
101 fi
102 fi])
103
104 dnl
105 dnl Macro: unet_SIGNALS
106 dnl
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.
110 dnl
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.])
119 else
120 AC_CACHE_CHECK([for bsd reliable signals], unet_cv_sys_signal_bsd,
121 [AC_TRY_RUN([#include <signal.h>
122 int calls = 0;
123 $ac_cv_type_signal handler()
124 {
125   if (calls) return;
126   calls++;
127   kill(getpid(), SIGTERM);
128   sleep(1);
129 }
130 int main(void)
131 {
132   signal(SIGTERM, handler);
133   kill(getpid(), SIGTERM);
134   exit (0);
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.])
138 else
139   AC_DEFINE([SYSV_UNRELIABLE_SIGNALS],,[Define if you have (unreliable) SysV signals.])
140 fi
141 fi])
142
143 dnl
144 dnl Macro: unet_CHECK_TYPE_SIZES
145 dnl
146 dnl Check the size of several types and define a valid int16_t and int32_t.
147 dnl
148 AC_DEFUN(unet_CHECK_TYPE_SIZES,
149 [dnl Check type sizes
150 AC_CHECK_SIZEOF(short)
151 AC_CHECK_SIZEOF(int)
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)
160 else
161   AC_MSG_ERROR([Cannot find a type with size of 16 bits])
162 fi
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)
172 else
173   AC_MSG_ERROR([Cannot find a type with size of 32 bits])
174 fi])
175
176 dnl Written by John Hawkinson <jhawk@mit.edu>. This code is in the Public
177 dnl Domain.
178 dnl
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
184 dnl IRIX).
185 dnl 
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.
191 dnl 
192 dnl This test exists so that every application developer does not test this in
193 dnl a different, and subtly broken fashion.
194 dnl 
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.
204 dnl
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).
207 dnl
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),
222              -lnsl)
223        )
224      )
225    )
226   AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
227     AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)))
228   ])
229
230
231 # Copyright 1996, 1997, 1999, 2000, 2001, 2002  Free Software Foundation, Inc.
232
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)
236 # any later version.
237
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.
242
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
246 # 02111-1307, USA.
247
248 # serial 2
249
250 # @defmac AC_PROG_CC_STDC
251 # @maindex PROG_CC_STDC
252 # @ovindex CC
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.
257 #
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.
263 # @end defmac
264
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
271 dnl like #elif.
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
278 ac_save_CC="$CC"
279 # Don't try gcc -ansi; that turns off useful extensions and
280 # breaks some systems' header files.
281 # AIX                   -qlanglvl=ansi
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__"
287 do
288   CC="$ac_save_CC $ac_arg"
289   AC_TRY_COMPILE(
290 [#include <stdarg.h>
291 #include <stdio.h>
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)
298      char **p;
299      int i;
300 {
301   return p[i];
302 }
303 static char *f (char * (*g) (char **, int), char **p, ...)
304 {
305   char *s;
306   va_list v;
307   va_start (v,p);
308   s = g (p, va_arg (v,int));
309   va_end (v);
310   return s;
311 }
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);
316 int argc;
317 char **argv;
318 ], [
319 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
320 ],
321 [am_cv_prog_cc_stdc="$ac_arg"; break])
322 done
323 CC="$ac_save_CC"
324 ])
325 if test -z "$am_cv_prog_cc_stdc"; then
326   AC_MSG_RESULT([none needed])
327 else
328   AC_MSG_RESULT([$am_cv_prog_cc_stdc])
329 fi
330 case "x$am_cv_prog_cc_stdc" in
331   x|xno) ;;
332   *) CC="$CC $am_cv_prog_cc_stdc" ;;
333 esac
334 ])
335
336 AU_DEFUN([fp_PROG_CC_STDC], [AM_PROG_CC_STDC])
337