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])
24 AC_DEFINE(rk_PATH_DELIM, '/', [Path name delimiter])
28 AC_REQUIRE([AC_C___ATTRIBUTE__])
29 AC_REQUIRE([AC_C_INLINE])
30 AC_REQUIRE([AC_C_CONST])
31 rk_WFLAGS(-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs -Wshadow)
33 dnl -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wstrict-prototypes
34 dnl -Wcast-qual -Wswitch -Wformat=2 -Wwrite-strings
40 AC_REQUIRE([AC_TYPE_SIZE_T])
41 AC_HAVE_TYPE([ssize_t],[#include <unistd.h>])
42 AC_REQUIRE([AC_TYPE_PID_T])
43 AC_REQUIRE([AC_TYPE_UID_T])
44 AC_HAVE_TYPE([long long])
46 AC_REQUIRE([rk_RETSIGTYPE])
48 dnl Checks for header files.
49 AC_REQUIRE([AC_HEADER_STDC])
50 AC_REQUIRE([AC_HEADER_TIME])
97 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
101 dnl Sunpro 5.2 has a vis.h which is something different.
102 AC_CHECK_HEADERS(vis.h, , , [
108 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
109 #ifdef HAVE_SYS_TYPES_H
110 #include <sys/types.h>
114 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
115 #ifdef HAVE_SYS_TYPES_H
116 #include <sys/types.h>
120 AC_CHECK_HEADERS(net/if.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>
128 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
129 #ifdef HAVE_SYS_TYPES_H
130 #include <sys/types.h>
132 #if HAVE_SYS_SOCKET_H
133 #include <sys/socket.h>
135 #ifdef HAVE_NETINET6_IN6_H
136 #include <netinet6/in6.h>
140 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
141 #ifdef HAVE_SYS_PARAM_H
142 #include <sys/param.h>
146 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
147 #ifdef HAVE_SYS_PARAM_H
148 #include <sys/param.h>
152 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
154 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
155 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
156 AM_CONDITIONAL(have_search_h, test "$ac_cv_header_search_h" = yes)
157 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
159 dnl Check for functions and libraries
161 AC_FIND_FUNC(socket, socket)
162 AC_FIND_FUNC(gethostbyname, nsl)
163 AC_FIND_FUNC(syslog, syslog)
167 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
175 if test "$ac_cv_func_glob_working" != yes; then
178 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
213 if test "$ac_cv_func_cgetent" = no; then
216 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
218 AC_REQUIRE([AC_FUNC_GETLOGIN])
220 AC_REQUIRE([AC_FUNC_MMAP])
222 AC_FIND_FUNC_NO_LIBS(getsockopt,,
223 [#ifdef HAVE_SYS_TYPES_H
224 #include <sys/types.h>
226 #ifdef HAVE_SYS_SOCKET_H
227 #include <sys/socket.h>
230 AC_FIND_FUNC_NO_LIBS(setsockopt,,
231 [#ifdef HAVE_SYS_TYPES_H
232 #include <sys/types.h>
234 #ifdef HAVE_SYS_SOCKET_H
235 #include <sys/socket.h>
239 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
250 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
253 #include <string.h>],
256 AC_FIND_FUNC_NO_LIBS(bswap16,,
257 [#ifdef HAVE_SYS_TYPES_H
258 #include <sys/types.h>
260 #ifdef HAVE_SYS_BSWAP_H
261 #include <sys/bswap.h>
264 AC_FIND_FUNC_NO_LIBS(bswap32,,
265 [#ifdef HAVE_SYS_TYPES_H
266 #include <sys/types.h>
268 #ifdef HAVE_SYS_BSWAP_H
269 #include <sys/bswap.h>
272 AC_FIND_FUNC_NO_LIBS(pidfile,util,
277 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
281 #ifdef HAVE_WS2TCPIP_H
282 #include <ws2tcpip.h>
285 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
289 #ifdef HAVE_WS2TCPIP_H
290 #include <ws2tcpip.h>
291 #endif],[0,0,0,0,0,0,0])
293 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
297 #ifdef HAVE_WS2TCPIP_H
298 #include <ws2tcpip.h>
301 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
305 #ifdef HAVE_WS2TCPIP_H
306 #include <ws2tcpip.h>
309 dnl Darwin is weird, and in some senses not unix, launchd doesn't want
310 dnl servers to use daemon(), so its deprecated.
315 AC_DEFINE([SUPPORT_DETACH], 1,
316 [Define if os support want to detach is daemonens.])
317 AC_BROKEN([daemon]) ;;
393 AM_CONDITIONAL(have_fnmatch_h,
394 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
396 AC_FOREACH([rk_func], [strndup strsep strtok_r],
397 [AC_NEED_PROTO([#include <string.h>], rk_func)])
399 AC_CHECK_FUNC([strtoll],
400 [AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
401 [Define if you have the function strtoll.])])
403 AC_CHECK_FUNC([strtoull],
404 [AC_DEFINE_UNQUOTED(HAVE_STRTOULL, 1,
405 [Define if you have the function strtoull.])])
407 AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
408 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
412 AC_MSG_CHECKING([checking for dirfd])
413 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
418 [[DIR *d = 0; dirfd(d);]])],
419 [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
420 if test "$ac_rk_have_dirfd" = "yes" ; then
421 AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
423 AC_MSG_RESULT($ac_rk_have_dirfd)
425 AC_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
431 AC_BROKEN2(inet_aton,
432 [#ifdef HAVE_SYS_TYPES_H
433 #include <sys/types.h>
435 #ifdef HAVE_SYS_SOCKET_H
436 #include <sys/socket.h>
438 #ifdef HAVE_NETINET_IN_H
439 #include <netinet/in.h>
441 #ifdef HAVE_ARPA_INET_H
442 #include <arpa/inet.h>
446 AC_BROKEN2(inet_ntop,
447 [#ifdef HAVE_SYS_TYPES_H
448 #include <sys/types.h>
450 #ifdef HAVE_SYS_SOCKET_H
451 #include <sys/socket.h>
453 #ifdef HAVE_NETINET_IN_H
454 #include <netinet/in.h>
456 #ifdef HAVE_ARPA_INET_H
457 #include <arpa/inet.h>
461 AC_BROKEN2(inet_pton,
462 [#ifdef HAVE_SYS_TYPES_H
463 #include <sys/types.h>
465 #ifdef HAVE_SYS_SOCKET_H
466 #include <sys/socket.h>
468 #ifdef HAVE_NETINET_IN_H
469 #include <netinet/in.h>
471 #ifdef HAVE_ARPA_INET_H
472 #include <arpa/inet.h>
477 dnl Check for sa_len in struct sockaddr,
478 dnl needs to come before the getnameinfo test
480 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
481 #include <sys/socket.h>])
483 if test "$ac_cv_func_getaddrinfo" = "yes"; then
484 rk_BROKEN_GETADDRINFO
485 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
486 AC_LIBOBJ(getaddrinfo)
487 AC_LIBOBJ(freeaddrinfo)
491 AC_NEED_PROTO([#include <stdlib.h>], setenv)
492 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
493 AC_NEED_PROTO([#include <unistd.h>], gethostname)
494 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
495 AC_NEED_PROTO([#include <unistd.h>], getusershell)
496 AC_NEED_PROTO([#include <unistd.h>], daemon)
498 #ifdef HAVE_SYS_TYPES_H
499 #include <sys/types.h>
501 #ifdef HAVE_SYS_SOCKET_H
502 #include <sys/socket.h>
504 #ifdef HAVE_NETINET_IN_H
505 #include <netinet/in.h>
507 #ifdef HAVE_ARPA_INET_H
508 #include <arpa/inet.h>
519 #ifdef HAVE_SYS_TYPES_H
520 #include <sys/types.h>
522 #ifdef HAVE_SYS_SOCKET_H
523 #include <sys/socket.h>
525 #ifdef HAVE_NETINET_IN_H
526 #include <netinet/in.h>
528 #ifdef HAVE_ARPA_INET_H
529 #include <arpa/inet.h>
533 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
535 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
537 dnl AC_KRB_FUNC_GETCWD_BROKEN
539 dnl strerror_r is great fun, on linux it exists before sus catched up,
540 dnl so the return type is diffrent, lets check for both
546 strerror_r, int strerror_r(int, char *, size_t))
548 AC_CHECK_FUNC([strerror_r],
549 [AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
550 [Define if you have the function strerror_r.])])
553 dnl Checks for prototypes and declarations
557 #ifdef HAVE_SYS_TYPES_H
558 #include <sys/types.h>
560 #ifdef HAVE_SYS_SOCKET_H
561 #include <sys/socket.h>
563 #ifdef HAVE_NETINET_IN_H
564 #include <netinet/in.h>
566 #ifdef HAVE_ARPA_INET_H
567 #include <arpa/inet.h>
573 gethostbyname, struct hostent *gethostbyname(const char *))
576 #ifdef HAVE_SYS_TYPES_H
577 #include <sys/types.h>
579 #ifdef HAVE_SYS_SOCKET_H
580 #include <sys/socket.h>
582 #ifdef HAVE_NETINET_IN_H
583 #include <netinet/in.h>
585 #ifdef HAVE_ARPA_INET_H
586 #include <arpa/inet.h>
592 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
595 #ifdef HAVE_SYS_TYPES_H
596 #include <sys/types.h>
598 #ifdef HAVE_SYS_SOCKET_H
599 #include <sys/socket.h>
601 #ifdef HAVE_NETINET_IN_H
602 #include <netinet/in.h>
604 #ifdef HAVE_ARPA_INET_H
605 #include <arpa/inet.h>
611 getservbyname, struct servent *getservbyname(const char *, const char *))
614 #ifdef HAVE_SYS_TYPES_H
615 #include <sys/types.h>
617 #ifdef HAVE_SYS_SOCKET_H
618 #include <sys/socket.h>
621 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
628 openlog, void openlog(const char *, int, int))
642 rk_CHECK_VAR(h_errno,
643 [#ifdef HAVE_SYS_TYPES_H
644 #include <sys/types.h>
649 #ifdef HAVE_WS2TCPIP_H
650 #include <ws2tcpip.h>
654 rk_CHECK_VAR(h_errlist,
658 #ifdef HAVE_WS2TCPIP_H
659 #include <ws2tcpip.h>
666 #ifdef HAVE_WS2TCPIP_H
667 #include <ws2tcpip.h>
670 rk_CHECK_VAR([__progname],
675 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[],[
682 dnl Check for fields in struct tm
685 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
686 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
689 dnl or do we have a variable `timezone' ?
692 rk_CHECK_VAR(timezone,[#include <time.h>])
693 rk_CHECK_VAR(altzone,[#include <time.h>])
695 AC_HAVE_TYPE([sa_family_t],[
696 #include <sys/types.h>
697 #ifdef HAVE_SYS_SOCKET_H
698 #include <sys/socket.h>
700 #ifdef HAVE_WS2TCPIP_H
701 #include <ws2tcpip.h>
703 AC_HAVE_TYPE([socklen_t],[
704 #include <sys/types.h>
705 #ifdef HAVE_SYS_SOCKET_H
706 #include <sys/socket.h>
708 #ifdef HAVE_WS2TCPIP_H
709 #include <ws2tcpip.h>
711 AC_HAVE_TYPE([struct sockaddr], [
712 #include <sys/types.h>
713 #ifdef HAVE_SYS_SOCKET_H
714 #include <sys/socket.h>
716 #ifdef HAVE_WS2TCPIP_H
717 #include <ws2tcpip.h>
719 AC_HAVE_TYPE([struct sockaddr_storage], [
720 #include <sys/types.h>
721 #ifdef HAVE_SYS_SOCKET_H
722 #include <sys/socket.h>
724 #ifdef HAVE_WS2TCPIP_H
725 #include <ws2tcpip.h>
727 AC_HAVE_TYPE([struct addrinfo], [
728 #include <sys/types.h>
732 #ifdef HAVE_WS2TCPIP_H
733 #include <ws2tcpip.h>
735 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
736 AC_HAVE_TYPE([struct iovec],[
737 #include <sys/types.h>
740 AC_HAVE_TYPE([struct msghdr],[
741 #include <sys/types.h>
742 #ifdef HAVE_SYS_SOCKET_H
743 #include <sys/socket.h>
745 #ifdef HAVE_WS2TCPIP_H
746 #include <ws2tcpip.h>
750 dnl Check for struct winsize
753 AC_KRB_STRUCT_WINSIZE
756 dnl Check for struct spwd
762 # Check if we want samba's socket wrapper
767 dnl won't work with automake
768 dnl moved to AC_OUTPUT in configure.in
769 dnl AC_CONFIG_FILES($1/Makefile)
771 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
773 AC_SUBST(DIR_roken)dnl
774 AC_SUBST(LIB_roken)dnl
775 AC_SUBST(INCLUDES_roken)dnl