3 dnl some code to get roken working
9 AC_REQUIRE([rk_CONFIG_HEADER])
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])
26 AC_REQUIRE([AC_C___ATTRIBUTE__])
27 AC_REQUIRE([AC_C_INLINE])
28 AC_REQUIRE([AC_C_CONST])
29 rk_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
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])
89 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
93 dnl Sunpro 5.2 has a vis.h which is something different.
94 AC_CHECK_HEADERS(vis.h, , , [
100 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
101 #ifdef HAVE_SYS_TYPES_H
102 #include <sys/types.h>
106 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
107 #ifdef HAVE_SYS_TYPES_H
108 #include <sys/types.h>
112 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
113 #ifdef HAVE_SYS_TYPES_H
114 #include <sys/types.h>
116 #if HAVE_SYS_SOCKET_H
117 #include <sys/socket.h>
120 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
121 #ifdef HAVE_SYS_TYPES_H
122 #include <sys/types.h>
124 #if HAVE_SYS_SOCKET_H
125 #include <sys/socket.h>
127 #ifdef HAVE_NETINET6_IN6_H
128 #include <netinet6/in6.h>
132 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
133 #ifdef HAVE_SYS_PARAM_H
134 #include <sys/param.h>
138 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
139 #ifdef HAVE_SYS_PARAM_H
140 #include <sys/param.h>
144 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
146 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
147 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
148 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
150 dnl Check for functions and libraries
152 AC_FIND_FUNC(socket, socket)
153 AC_FIND_FUNC(gethostbyname, nsl)
154 AC_FIND_FUNC(syslog, syslog)
158 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
166 if test "$ac_cv_func_glob_working" != yes; then
169 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
202 if test "$ac_cv_func_cgetent" = no; then
205 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
207 AC_REQUIRE([AC_FUNC_GETLOGIN])
209 AC_REQUIRE([AC_FUNC_MMAP])
211 AC_FIND_FUNC_NO_LIBS(getsockopt,,
212 [#ifdef HAVE_SYS_TYPES_H
213 #include <sys/types.h>
215 #ifdef HAVE_SYS_SOCKET_H
216 #include <sys/socket.h>
219 AC_FIND_FUNC_NO_LIBS(setsockopt,,
220 [#ifdef HAVE_SYS_TYPES_H
221 #include <sys/types.h>
223 #ifdef HAVE_SYS_SOCKET_H
224 #include <sys/socket.h>
228 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
239 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
242 #include <string.h>],
245 AC_FIND_FUNC_NO_LIBS(bswap16,,
246 [#ifdef HAVE_SYS_BSWAP_H
247 #include <sys/bswap.h>
250 AC_FIND_FUNC_NO_LIBS(bswap32,,
251 [#ifdef HAVE_SYS_BSWAP_H
252 #include <sys/bswap.h>
255 AC_FIND_FUNC_NO_LIBS(pidfile,util,
260 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
265 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
268 #endif],[0,0,0,0,0,0,0])
270 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
275 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
351 AM_CONDITIONAL(have_fnmatch_h,
352 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
354 AC_FOREACH([rk_func], [strndup strsep strtok_r],
355 [AC_NEED_PROTO([#include <string.h>], rk_func)])
357 AC_FOREACH([rk_func], [strsvis strunvis strvis strvisx svis unvis vis],
358 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
362 AC_BROKEN2(inet_aton,
363 [#ifdef HAVE_SYS_TYPES_H
364 #include <sys/types.h>
366 #ifdef HAVE_SYS_SOCKET_H
367 #include <sys/socket.h>
369 #ifdef HAVE_NETINET_IN_H
370 #include <netinet/in.h>
372 #ifdef HAVE_ARPA_INET_H
373 #include <arpa/inet.h>
377 AC_BROKEN2(inet_ntop,
378 [#ifdef HAVE_SYS_TYPES_H
379 #include <sys/types.h>
381 #ifdef HAVE_SYS_SOCKET_H
382 #include <sys/socket.h>
384 #ifdef HAVE_NETINET_IN_H
385 #include <netinet/in.h>
387 #ifdef HAVE_ARPA_INET_H
388 #include <arpa/inet.h>
392 AC_BROKEN2(inet_pton,
393 [#ifdef HAVE_SYS_TYPES_H
394 #include <sys/types.h>
396 #ifdef HAVE_SYS_SOCKET_H
397 #include <sys/socket.h>
399 #ifdef HAVE_NETINET_IN_H
400 #include <netinet/in.h>
402 #ifdef HAVE_ARPA_INET_H
403 #include <arpa/inet.h>
408 dnl Check for sa_len in struct sockaddr,
409 dnl needs to come before the getnameinfo test
411 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
412 #include <sys/socket.h>])
414 if test "$ac_cv_func_getaddrinfo" = "yes"; then
415 rk_BROKEN_GETADDRINFO
416 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
417 AC_LIBOBJ(getaddrinfo)
418 AC_LIBOBJ(freeaddrinfo)
422 AC_NEED_PROTO([#include <stdlib.h>], setenv)
423 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
424 AC_NEED_PROTO([#include <unistd.h>], gethostname)
425 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
426 AC_NEED_PROTO([#include <unistd.h>], getusershell)
427 AC_NEED_PROTO([#include <unistd.h>], daemon)
429 #ifdef HAVE_SYS_TYPES_H
430 #include <sys/types.h>
432 #ifdef HAVE_SYS_SOCKET_H
433 #include <sys/socket.h>
435 #ifdef HAVE_NETINET_IN_H
436 #include <netinet/in.h>
438 #ifdef HAVE_ARPA_INET_H
439 #include <arpa/inet.h>
450 #ifdef HAVE_SYS_TYPES_H
451 #include <sys/types.h>
453 #ifdef HAVE_SYS_SOCKET_H
454 #include <sys/socket.h>
456 #ifdef HAVE_NETINET_IN_H
457 #include <netinet/in.h>
459 #ifdef HAVE_ARPA_INET_H
460 #include <arpa/inet.h>
464 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
466 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
468 dnl AC_KRB_FUNC_GETCWD_BROKEN
471 dnl Checks for prototypes and declarations
475 #ifdef HAVE_SYS_TYPES_H
476 #include <sys/types.h>
478 #ifdef HAVE_SYS_SOCKET_H
479 #include <sys/socket.h>
481 #ifdef HAVE_NETINET_IN_H
482 #include <netinet/in.h>
484 #ifdef HAVE_ARPA_INET_H
485 #include <arpa/inet.h>
491 gethostbyname, struct hostent *gethostbyname(const char *))
494 #ifdef HAVE_SYS_TYPES_H
495 #include <sys/types.h>
497 #ifdef HAVE_SYS_SOCKET_H
498 #include <sys/socket.h>
500 #ifdef HAVE_NETINET_IN_H
501 #include <netinet/in.h>
503 #ifdef HAVE_ARPA_INET_H
504 #include <arpa/inet.h>
510 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
513 #ifdef HAVE_SYS_TYPES_H
514 #include <sys/types.h>
516 #ifdef HAVE_SYS_SOCKET_H
517 #include <sys/socket.h>
519 #ifdef HAVE_NETINET_IN_H
520 #include <netinet/in.h>
522 #ifdef HAVE_ARPA_INET_H
523 #include <arpa/inet.h>
529 getservbyname, struct servent *getservbyname(const char *, const char *))
532 #ifdef HAVE_SYS_TYPES_H
533 #include <sys/types.h>
535 #ifdef HAVE_SYS_SOCKET_H
536 #include <sys/socket.h>
539 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
546 openlog, void openlog(const char *, int, int))
560 rk_CHECK_VAR(h_errno,
561 [#ifdef HAVE_SYS_TYPES_H
562 #include <sys/types.h>
568 rk_CHECK_VAR(h_errlist,
578 rk_CHECK_VAR([__progname],
583 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[][
590 dnl Check for fields in struct tm
593 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
594 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
597 dnl or do we have a variable `timezone' ?
600 rk_CHECK_VAR(timezone,[#include <time.h>])
601 rk_CHECK_VAR(altzone,[#include <time.h>])
603 AC_HAVE_TYPE([sa_family_t],[
604 #include <sys/types.h>
605 #include <sys/socket.h>])
606 AC_HAVE_TYPE([socklen_t],[
607 #include <sys/types.h>
608 #include <sys/socket.h>])
609 AC_HAVE_TYPE([struct sockaddr], [
610 #include <sys/types.h>
611 #include <sys/socket.h>])
612 AC_HAVE_TYPE([struct sockaddr_storage], [
613 #include <sys/types.h>
614 #include <sys/socket.h>])
615 AC_HAVE_TYPE([struct addrinfo], [
616 #include <sys/types.h>
618 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
619 AC_HAVE_TYPE([struct iovec],[
620 #include <sys/types.h>
623 AC_HAVE_TYPE([struct msghdr],[
624 #include <sys/types.h>
625 #include <sys/socket.h>
629 dnl Check for struct winsize
632 AC_KRB_STRUCT_WINSIZE
635 dnl Check for struct spwd
641 # Check if we want samba's socket wrapper
646 dnl won't work with automake
647 dnl moved to AC_OUTPUT in configure.in
648 dnl AC_CONFIG_FILES($1/Makefile)
650 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
652 AC_SUBST(DIR_roken)dnl
653 AC_SUBST(LIB_roken)dnl
654 AC_SUBST(INCLUDES_roken)dnl