forget about device fd, we don't need it
[arla.git] / cf / roken-frag.m4
blobb1f30b73f7149448c303d1b894692a132b992e02
1 dnl $Id$
2 dnl
3 dnl some code to get roken working
4 dnl
5 dnl rk_ROKEN(subdir)
6 dnl
7 AC_DEFUN([rk_ROKEN], [
9 AC_REQUIRE([rk_CONFIG_HEADER])
11 DIR_roken=roken
12 LIB_roken='$(top_builddir)/$1/libroken.la'
13 INCLUDES_roken='-I$(top_builddir)/$1 -I$(top_srcdir)/$1'
15 dnl Checks for programs
16 AC_REQUIRE([AC_PROG_CC])
17 AC_REQUIRE([AC_PROG_AWK])
18 AC_REQUIRE([AC_OBJEXT])
19 AC_REQUIRE([AC_EXEEXT])
20 AC_REQUIRE([AC_PROG_LIBTOOL])
22 AC_REQUIRE([AC_MIPS_ABI])
24 dnl C characteristics
26 AC_REQUIRE([AC_C___ATTRIBUTE__])
27 AC_REQUIRE([AC_C_INLINE])
28 AC_REQUIRE([AC_C_CONST])
29 AC_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
31 AC_REQUIRE([rk_DB])
33 dnl C types
35 AC_REQUIRE([AC_TYPE_SIZE_T])
36 AC_HAVE_TYPE([ssize_t],[#include <unistd.h>])
37 AC_REQUIRE([AC_TYPE_PID_T])
38 AC_REQUIRE([AC_TYPE_UID_T])
39 AC_HAVE_TYPE([long long])
41 AC_REQUIRE([rk_RETSIGTYPE])
43 dnl Checks for header files.
44 AC_REQUIRE([AC_HEADER_STDC])
45 AC_REQUIRE([AC_HEADER_TIME])
47 AC_CHECK_HEADERS([\
48         arpa/inet.h                             \
49         arpa/nameser.h                          \
50         config.h                                \
51         crypt.h                                 \
52         dirent.h                                \
53         errno.h                                 \
54         err.h                                   \
55         fcntl.h                                 \
56         grp.h                                   \
57         ifaddrs.h                               \
58         net/if.h                                \
59         netdb.h                                 \
60         netinet/in.h                            \
61         netinet/in6.h                           \
62         netinet/in_systm.h                      \
63         netinet6/in6.h                          \
64         netinet6/in6_var.h                      \
65         paths.h                                 \
66         pwd.h                                   \
67         resolv.h                                \
68         rpcsvc/ypclnt.h                         \
69         shadow.h                                \
70         sys/bswap.h                             \
71         sys/ioctl.h                             \
72         sys/mman.h                              \
73         sys/param.h                             \
74         sys/proc.h                              \
75         sys/resource.h                          \
76         sys/socket.h                            \
77         sys/sockio.h                            \
78         sys/stat.h                              \
79         sys/time.h                              \
80         sys/tty.h                               \
81         sys/types.h                             \
82         sys/uio.h                               \
83         sys/utsname.h                           \
84         sys/wait.h                              \
85         syslog.h                                \
86         termios.h                               \
87         unistd.h                                \
88         userconf.h                              \
89         usersec.h                               \
90         util.h                                  \
91         vis.h                                   \
93         
94 AC_CHECK_HEADERS([sys/sysctl.h], , , [AC_INCLUDES_DEFAULT
95 #if HAVE_SYS_TYPES_H
96 #include <sys/types.h>
97 #endif
98 #if HAVE_SYS_PARAM_H
99 #include <sys/param.h>
100 #endif])
103 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
105 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
106 AM_CONDITIONAL(have_fnmatch_h, test "$ac_cv_header_fnmatch_h" = yes)
107 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
108 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
110 dnl Check for functions and libraries
112 AC_FIND_FUNC(socket, socket)
113 AC_FIND_FUNC(gethostbyname, nsl)
114 AC_FIND_FUNC(syslog, syslog)
116 AC_KRB_IPV6
118 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
120 AC_FIND_FUNC(res_search, resolv,
122 #include <stdio.h>
123 #ifdef HAVE_SYS_TYPES_H
124 #include <sys/types.h>
125 #endif
126 #ifdef HAVE_NETINET_IN_H
127 #include <netinet/in.h>
128 #endif
129 #ifdef HAVE_ARPA_NAMESER_H
130 #include <arpa/nameser.h>
131 #endif
132 #ifdef HAVE_RESOLV_H
133 #include <resolv.h>
134 #endif
136 [0,0,0,0,0])
138 AC_FIND_FUNC(res_nsearch, resolv,
140 #include <stdio.h>
141 #ifdef HAVE_SYS_TYPES_H
142 #include <sys/types.h>
143 #endif
144 #ifdef HAVE_NETINET_IN_H
145 #include <netinet/in.h>
146 #endif
147 #ifdef HAVE_ARPA_NAMESER_H
148 #include <arpa/nameser.h>
149 #endif
150 #ifdef HAVE_RESOLV_H
151 #include <resolv.h>
152 #endif
154 [0,0,0,0,0,0])
156 AC_FIND_FUNC(dn_expand, resolv,
158 #include <stdio.h>
159 #ifdef HAVE_SYS_TYPES_H
160 #include <sys/types.h>
161 #endif
162 #ifdef HAVE_NETINET_IN_H
163 #include <netinet/in.h>
164 #endif
165 #ifdef HAVE_ARPA_NAMESER_H
166 #include <arpa/nameser.h>
167 #endif
168 #ifdef HAVE_RESOLV_H
169 #include <resolv.h>
170 #endif
172 [0,0,0,0,0])
174 rk_CHECK_VAR(_res, 
175 [#include <stdio.h>
176 #ifdef HAVE_SYS_TYPES_H
177 #include <sys/types.h>
178 #endif
179 #ifdef HAVE_NETINET_IN_H
180 #include <netinet/in.h>
181 #endif
182 #ifdef HAVE_ARPA_NAMESER_H
183 #include <arpa/nameser.h>
184 #endif
185 #ifdef HAVE_RESOLV_H
186 #include <resolv.h>
187 #endif])
190 AC_BROKEN_SNPRINTF
191 AC_BROKEN_VSNPRINTF
193 AC_BROKEN_GLOB
194 if test "$ac_cv_func_glob_working" != yes; then
195         AC_LIBOBJ(glob)
197 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
200 AC_CHECK_FUNCS([                                \
201         asnprintf                               \
202         asprintf                                \
203         atexit                                  \
204         cgetent                                 \
205         getconfattr                             \
206         getprogname                             \
207         getrlimit                               \
208         getspnam                                \
209         initstate                               \
210         issetugid                               \
211         on_exit                                 \
212         random                                  \
213         setprogname                             \
214         setstate                                \
215         strsvis                                 \
216         strunvis                                \
217         strvis                                  \
218         strvisx                                 \
219         svis                                    \
220         sysconf                                 \
221         sysctl                                  \
222         uname                                   \
223         unvis                                   \
224         vasnprintf                              \
225         vasprintf                               \
226         vis                                     \
229 if test "$ac_cv_func_cgetent" = no; then
230         AC_LIBOBJ(getcap)
233 AC_REQUIRE([AC_FUNC_GETLOGIN])
235 AC_REQUIRE([AC_FUNC_MMAP])
237 AC_FIND_FUNC_NO_LIBS(getsockopt,,
238 [#ifdef HAVE_SYS_TYPES_H
239 #include <sys/types.h>
240 #endif
241 #ifdef HAVE_SYS_SOCKET_H
242 #include <sys/socket.h>
243 #endif],
244 [0,0,0,0,0])
245 AC_FIND_FUNC_NO_LIBS(setsockopt,,
246 [#ifdef HAVE_SYS_TYPES_H
247 #include <sys/types.h>
248 #endif
249 #ifdef HAVE_SYS_SOCKET_H
250 #include <sys/socket.h>
251 #endif],
252 [0,0,0,0,0])
254 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
255 [#ifdef HAVE_NETDB_H
256 #include <netdb.h>
257 #endif],
259 AC_NEED_PROTO([
260 #ifdef HAVE_NETDB_H
261 #include <netdb.h>
262 #endif],
263 hstrerror)
265 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
266         [AC_NEED_PROTO([
267         #include <stdio.h>
268         #include <string.h>],
269         rk_func)])
271 AC_FIND_FUNC_NO_LIBS(bswap16,,
272 [#ifdef HAVE_SYS_BSWAP_H
273 #include <sys/bswap.h>
274 #endif],0)
276 AC_FIND_FUNC_NO_LIBS(bswap32,,
277 [#ifdef HAVE_SYS_BSWAP_H
278 #include <sys/bswap.h>
279 #endif],0)
281 AC_FIND_FUNC_NO_LIBS(pidfile,util,
282 [#ifdef HAVE_UTIL_H
283 #include <util.h>
284 #endif],0)
286 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
287 [#ifdef HAVE_NETDB_H
288 #include <netdb.h>
289 #endif],[0,0,0,0])
291 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
292 [#ifdef HAVE_NETDB_H
293 #include <netdb.h>
294 #endif],[0,0,0,0,0,0,0])
296 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
297 [#ifdef HAVE_NETDB_H
298 #include <netdb.h>
299 #endif],[0])
301 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
302 [#ifdef HAVE_NETDB_H
303 #include <netdb.h>
304 #endif],[0])
306 AC_BROKEN([                                     \
307         chown                                   \
308         copyhostent                             \
309         daemon                                  \
310         ecalloc                                 \
311         emalloc                                 \
312         erealloc                                \
313         estrdup                                 \
314         err                                     \
315         errx                                    \
316         fchown                                  \
317         flock                                   \
318         fnmatch                                 \
319         freehostent                             \
320         getcwd                                  \
321         getdtablesize                           \
322         getegid                                 \
323         geteuid                                 \
324         getgid                                  \
325         gethostname                             \
326         getifaddrs                              \
327         getipnodebyaddr                         \
328         getipnodebyname                         \
329         getopt                                  \
330         gettimeofday                            \
331         getuid                                  \
332         getusershell                            \
333         initgroups                              \
334         innetgr                                 \
335         iruserok                                \
336         localtime_r                             \
337         lstat                                   \
338         memmove                                 \
339         mkstemp                                 \
340         putenv                                  \
341         rcmd                                    \
342         readv                                   \
343         recvmsg                                 \
344         sendmsg                                 \
345         setegid                                 \
346         setenv                                  \
347         seteuid                                 \
348         strcasecmp                              \
349         strdup                                  \
350         strerror                                \
351         strftime                                \
352         strlcat                                 \
353         strlcpy                                 \
354         strlwr                                  \
355         strncasecmp                             \
356         strndup                                 \
357         strnlen                                 \
358         strptime                                \
359         strsep                                  \
360         strsep_copy                             \
361         strtok_r                                \
362         strupr                                  \
363         swab                                    \
364         unsetenv                                \
365         verr                                    \
366         verrx                                   \
367         vsyslog                                 \
368         vwarn                                   \
369         vwarnx                                  \
370         warn                                    \
371         warnx                                   \
372         writev                                  \
375 AC_FOREACH([rk_func], [strndup strsep strtok_r],
376         [AC_NEED_PROTO([#include <string.h>], rk_func)])
378 AC_FOREACH([rk_func], [strsvis strunvis strvis strvisx svis unvis vis],
379 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
380 #include <vis.h>
381 #endif], rk_func)])
383 AC_BROKEN2(inet_aton,
384 [#ifdef HAVE_SYS_TYPES_H
385 #include <sys/types.h>
386 #endif
387 #ifdef HAVE_SYS_SOCKET_H
388 #include <sys/socket.h>
389 #endif
390 #ifdef HAVE_NETINET_IN_H
391 #include <netinet/in.h>
392 #endif
393 #ifdef HAVE_ARPA_INET_H
394 #include <arpa/inet.h>
395 #endif],
396 [0,0])
398 AC_BROKEN2(inet_ntop,
399 [#ifdef HAVE_SYS_TYPES_H
400 #include <sys/types.h>
401 #endif
402 #ifdef HAVE_SYS_SOCKET_H
403 #include <sys/socket.h>
404 #endif
405 #ifdef HAVE_NETINET_IN_H
406 #include <netinet/in.h>
407 #endif
408 #ifdef HAVE_ARPA_INET_H
409 #include <arpa/inet.h>
410 #endif],
411 [0, 0, 0, 0])
413 AC_BROKEN2(inet_pton,
414 [#ifdef HAVE_SYS_TYPES_H
415 #include <sys/types.h>
416 #endif
417 #ifdef HAVE_SYS_SOCKET_H
418 #include <sys/socket.h>
419 #endif
420 #ifdef HAVE_NETINET_IN_H
421 #include <netinet/in.h>
422 #endif
423 #ifdef HAVE_ARPA_INET_H
424 #include <arpa/inet.h>
425 #endif],
426 [0,0,0])
429 dnl Check for sa_len in struct sockaddr, 
430 dnl needs to come before the getnameinfo test
432 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
433 #include <sys/socket.h>])
435 if test "$ac_cv_func_getnameinfo" = "yes"; then
436   rk_BROKEN_GETNAMEINFO
437   if test "$ac_cv_func_getnameinfo_broken" = yes; then
438         AC_LIBOBJ(getnameinfo)
439   fi
442 if test "$ac_cv_func_getaddrinfo" = "yes"; then
443   rk_BROKEN_GETADDRINFO
444   if test "$ac_cv_func_getaddrinfo_numserv" = no; then
445         AC_LIBOBJ(getaddrinfo)
446         AC_LIBOBJ(freeaddrinfo)
447   fi
450 AC_NEED_PROTO([#include <stdlib.h>], setenv)
451 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
452 AC_NEED_PROTO([#include <unistd.h>], gethostname)
453 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
454 AC_NEED_PROTO([#include <unistd.h>], getusershell)
456 AC_NEED_PROTO([
457 #ifdef HAVE_SYS_TYPES_H
458 #include <sys/types.h>
459 #endif
460 #ifdef HAVE_SYS_SOCKET_H
461 #include <sys/socket.h>
462 #endif
463 #ifdef HAVE_NETINET_IN_H
464 #include <netinet/in.h>
465 #endif
466 #ifdef HAVE_ARPA_INET_H
467 #include <arpa/inet.h>
468 #endif],
469 inet_aton)
471 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
473 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
475 dnl AC_KRB_FUNC_GETCWD_BROKEN
478 dnl Checks for prototypes and declarations
481 AC_PROTO_COMPAT([
482 #ifdef HAVE_SYS_TYPES_H
483 #include <sys/types.h>
484 #endif
485 #ifdef HAVE_SYS_SOCKET_H
486 #include <sys/socket.h>
487 #endif
488 #ifdef HAVE_NETINET_IN_H
489 #include <netinet/in.h>
490 #endif
491 #ifdef HAVE_ARPA_INET_H
492 #include <arpa/inet.h>
493 #endif
494 #ifdef HAVE_NETDB_H
495 #include <netdb.h>
496 #endif
498 gethostbyname, struct hostent *gethostbyname(const char *))
500 AC_PROTO_COMPAT([
501 #ifdef HAVE_SYS_TYPES_H
502 #include <sys/types.h>
503 #endif
504 #ifdef HAVE_SYS_SOCKET_H
505 #include <sys/socket.h>
506 #endif
507 #ifdef HAVE_NETINET_IN_H
508 #include <netinet/in.h>
509 #endif
510 #ifdef HAVE_ARPA_INET_H
511 #include <arpa/inet.h>
512 #endif
513 #ifdef HAVE_NETDB_H
514 #include <netdb.h>
515 #endif
517 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
519 AC_PROTO_COMPAT([
520 #ifdef HAVE_SYS_TYPES_H
521 #include <sys/types.h>
522 #endif
523 #ifdef HAVE_SYS_SOCKET_H
524 #include <sys/socket.h>
525 #endif
526 #ifdef HAVE_NETINET_IN_H
527 #include <netinet/in.h>
528 #endif
529 #ifdef HAVE_ARPA_INET_H
530 #include <arpa/inet.h>
531 #endif
532 #ifdef HAVE_NETDB_H
533 #include <netdb.h>
534 #endif
536 getservbyname, struct servent *getservbyname(const char *, const char *))
538 AC_PROTO_COMPAT([
539 #ifdef HAVE_SYS_TYPES_H
540 #include <sys/types.h>
541 #endif
542 #ifdef HAVE_SYS_SOCKET_H
543 #include <sys/socket.h>
544 #endif
546 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
548 AC_PROTO_COMPAT([
549 #ifdef HAVE_SYSLOG_H
550 #include <syslog.h>
551 #endif
553 openlog, void openlog(const char *, int, int))
555 AC_NEED_PROTO([
556 #ifdef HAVE_CRYPT_H
557 #include <crypt.h>
558 #endif
559 #ifdef HAVE_UNISTD_H
560 #include <unistd.h>
561 #endif
563 crypt)
565 dnl variables
567 rk_CHECK_VAR(h_errno, 
568 [#ifdef HAVE_SYS_TYPES_H
569 #include <sys/types.h>
570 #endif
571 #ifdef HAVE_NETDB_H
572 #include <netdb.h>
573 #endif])
575 rk_CHECK_VAR(h_errlist, 
576 [#ifdef HAVE_NETDB_H
577 #include <netdb.h>
578 #endif])
580 rk_CHECK_VAR(h_nerr, 
581 [#ifdef HAVE_NETDB_H
582 #include <netdb.h>
583 #endif])
585 rk_CHECK_VAR([__progname], 
586 [#ifdef HAVE_ERR_H
587 #include <err.h>
588 #endif])
590 AC_CHECK_DECLARATION([#include <stdlib.h>
591 #ifdef HAVE_UNISTD_H
592 #include <unistd.h>
593 #endif], optarg)
594 AC_CHECK_DECLARATION([#include <stdlib.h>
595 #ifdef HAVE_UNISTD_H
596 #include <unistd.h>
597 #endif], optind)
598 AC_CHECK_DECLARATION([#include <stdlib.h>
599 #ifdef HAVE_UNISTD_H
600 #include <unistd.h>
601 #endif], opterr)
602 AC_CHECK_DECLARATION([#include <stdlib.h>
603 #ifdef HAVE_UNISTD_H
604 #include <unistd.h>
605 #endif], optopt)
607 AC_CHECK_DECLARATION([#include <stdlib.h>], environ)
610 dnl Check for fields in struct tm
613 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
614 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
617 dnl or do we have a variable `timezone' ?
620 rk_CHECK_VAR(timezone,[#include <time.h>])
621 rk_CHECK_VAR(altzone,[#include <time.h>])
623 AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
624 AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
625 AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
626 AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/socket.h>])
627 AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
628 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
629 AC_HAVE_TYPE([struct iovec],[
630 #include <sys/types.h>
631 #include <sys/uio.h>
633 AC_HAVE_TYPE([struct msghdr],[
634 #include <sys/types.h>
635 #include <sys/socket.h>
639 dnl Check for struct winsize
642 AC_KRB_STRUCT_WINSIZE
645 dnl Check for struct spwd
648 AC_KRB_STRUCT_SPWD
650 dnl won't work with automake
651 dnl moved to AC_OUTPUT in configure.in
652 dnl AC_CONFIG_FILES($1/Makefile)
654 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
656 AC_SUBST(DIR_roken)dnl
657 AC_SUBST(LIB_roken)dnl
658 AC_SUBST(INCLUDES_roken)dnl