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])
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])
98 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
102 dnl Sunpro 5.2 has a vis.h which is something different.
103 AC_CHECK_HEADERS(vis.h, , , [
109 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
110 #ifdef HAVE_SYS_TYPES_H
111 #include <sys/types.h>
115 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
116 #ifdef HAVE_SYS_TYPES_H
117 #include <sys/types.h>
121 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
122 #ifdef HAVE_SYS_TYPES_H
123 #include <sys/types.h>
125 #if HAVE_SYS_SOCKET_H
126 #include <sys/socket.h>
129 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
130 #ifdef HAVE_SYS_TYPES_H
131 #include <sys/types.h>
133 #if HAVE_SYS_SOCKET_H
134 #include <sys/socket.h>
136 #ifdef HAVE_NETINET6_IN6_H
137 #include <netinet6/in6.h>
141 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
142 #ifdef HAVE_SYS_PARAM_H
143 #include <sys/param.h>
147 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
148 #ifdef HAVE_SYS_PARAM_H
149 #include <sys/param.h>
153 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
155 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
156 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
157 AM_CONDITIONAL(have_search_h, test "$ac_cv_header_search_h" = yes)
158 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
160 dnl Check for functions and libraries
162 AC_FIND_FUNC(socket, socket)
163 AC_FIND_FUNC(gethostbyname, nsl)
164 AC_FIND_FUNC(syslog, syslog)
168 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
176 if test "$ac_cv_func_glob_working" != yes; then
179 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
214 if test "$ac_cv_func_cgetent" = no; then
217 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
219 AC_REQUIRE([AC_FUNC_GETLOGIN])
221 AC_REQUIRE([AC_FUNC_MMAP])
223 AC_FIND_FUNC_NO_LIBS(getsockopt,,
224 [#ifdef HAVE_SYS_TYPES_H
225 #include <sys/types.h>
227 #ifdef HAVE_SYS_SOCKET_H
228 #include <sys/socket.h>
231 AC_FIND_FUNC_NO_LIBS(setsockopt,,
232 [#ifdef HAVE_SYS_TYPES_H
233 #include <sys/types.h>
235 #ifdef HAVE_SYS_SOCKET_H
236 #include <sys/socket.h>
240 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
251 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
254 #include <string.h>],
257 AC_FIND_FUNC_NO_LIBS(bswap16,,
258 [#ifdef HAVE_SYS_TYPES_H
259 #include <sys/types.h>
261 #ifdef HAVE_SYS_BSWAP_H
262 #include <sys/bswap.h>
265 AC_FIND_FUNC_NO_LIBS(bswap32,,
266 [#ifdef HAVE_SYS_TYPES_H
267 #include <sys/types.h>
269 #ifdef HAVE_SYS_BSWAP_H
270 #include <sys/bswap.h>
273 AC_FIND_FUNC_NO_LIBS(pidfile,util,
278 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
282 #ifdef HAVE_WS2TCPIP_H
283 #include <ws2tcpip.h>
286 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
290 #ifdef HAVE_WS2TCPIP_H
291 #include <ws2tcpip.h>
292 #endif],[0,0,0,0,0,0,0])
294 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
298 #ifdef HAVE_WS2TCPIP_H
299 #include <ws2tcpip.h>
302 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
306 #ifdef HAVE_WS2TCPIP_H
307 #include <ws2tcpip.h>
310 dnl Darwin is weird, and in some senses not unix, launchd doesn't want
311 dnl servers to use daemon(), so its deprecated.
316 AC_DEFINE([SUPPORT_DETACH], 1,
317 [Define if os support want to detach is daemonens.])
318 AC_BROKEN([daemon]) ;;
394 AM_CONDITIONAL(have_fnmatch_h,
395 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
397 AC_FOREACH([rk_func], [strndup strsep strtok_r],
398 [AC_NEED_PROTO([#include <string.h>], rk_func)])
400 AC_CHECK_FUNC([strtoll],
401 [AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
402 [Define if you have the function strtoll.])])
404 AC_CHECK_FUNC([strtoull],
405 [AC_DEFINE_UNQUOTED(HAVE_STRTOULL, 1,
406 [Define if you have the function strtoull.])])
408 AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
409 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
413 AC_MSG_CHECKING([checking for dirfd])
414 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
419 [[DIR *d = 0; dirfd(d);]])],
420 [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
421 if test "$ac_rk_have_dirfd" = "yes" ; then
422 AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
424 AC_MSG_RESULT($ac_rk_have_dirfd)
426 AC_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
432 AC_BROKEN2(inet_aton,
433 [#ifdef HAVE_SYS_TYPES_H
434 #include <sys/types.h>
436 #ifdef HAVE_SYS_SOCKET_H
437 #include <sys/socket.h>
439 #ifdef HAVE_NETINET_IN_H
440 #include <netinet/in.h>
442 #ifdef HAVE_ARPA_INET_H
443 #include <arpa/inet.h>
447 AC_BROKEN2(inet_ntop,
448 [#ifdef HAVE_SYS_TYPES_H
449 #include <sys/types.h>
451 #ifdef HAVE_SYS_SOCKET_H
452 #include <sys/socket.h>
454 #ifdef HAVE_NETINET_IN_H
455 #include <netinet/in.h>
457 #ifdef HAVE_ARPA_INET_H
458 #include <arpa/inet.h>
462 AC_BROKEN2(inet_pton,
463 [#ifdef HAVE_SYS_TYPES_H
464 #include <sys/types.h>
466 #ifdef HAVE_SYS_SOCKET_H
467 #include <sys/socket.h>
469 #ifdef HAVE_NETINET_IN_H
470 #include <netinet/in.h>
472 #ifdef HAVE_ARPA_INET_H
473 #include <arpa/inet.h>
478 dnl Check for sa_len in struct sockaddr,
479 dnl needs to come before the getnameinfo test
481 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
482 #include <sys/socket.h>])
484 if test "$ac_cv_func_getaddrinfo" = "yes"; then
485 rk_BROKEN_GETADDRINFO
486 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
487 AC_LIBOBJ(getaddrinfo)
488 AC_LIBOBJ(freeaddrinfo)
492 AC_NEED_PROTO([#include <stdlib.h>], setenv)
493 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
494 AC_NEED_PROTO([#include <unistd.h>], gethostname)
495 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
496 AC_NEED_PROTO([#include <unistd.h>], getusershell)
497 AC_NEED_PROTO([#include <unistd.h>], daemon)
499 #ifdef HAVE_SYS_TYPES_H
500 #include <sys/types.h>
502 #ifdef HAVE_SYS_SOCKET_H
503 #include <sys/socket.h>
505 #ifdef HAVE_NETINET_IN_H
506 #include <netinet/in.h>
508 #ifdef HAVE_ARPA_INET_H
509 #include <arpa/inet.h>
520 #ifdef HAVE_SYS_TYPES_H
521 #include <sys/types.h>
523 #ifdef HAVE_SYS_SOCKET_H
524 #include <sys/socket.h>
526 #ifdef HAVE_NETINET_IN_H
527 #include <netinet/in.h>
529 #ifdef HAVE_ARPA_INET_H
530 #include <arpa/inet.h>
534 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
536 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
538 dnl AC_KRB_FUNC_GETCWD_BROKEN
540 dnl strerror_r is great fun, on linux it exists before sus catched up,
541 dnl so the return type is diffrent, lets check for both
547 strerror_r, int strerror_r(int, char *, size_t))
549 AC_CHECK_FUNC([strerror_r],
550 [AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
551 [Define if you have the function strerror_r.])])
554 dnl Checks for prototypes and declarations
558 #ifdef HAVE_SYS_TYPES_H
559 #include <sys/types.h>
561 #ifdef HAVE_SYS_SOCKET_H
562 #include <sys/socket.h>
564 #ifdef HAVE_NETINET_IN_H
565 #include <netinet/in.h>
567 #ifdef HAVE_ARPA_INET_H
568 #include <arpa/inet.h>
574 gethostbyname, struct hostent *gethostbyname(const char *))
577 #ifdef HAVE_SYS_TYPES_H
578 #include <sys/types.h>
580 #ifdef HAVE_SYS_SOCKET_H
581 #include <sys/socket.h>
583 #ifdef HAVE_NETINET_IN_H
584 #include <netinet/in.h>
586 #ifdef HAVE_ARPA_INET_H
587 #include <arpa/inet.h>
593 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
596 #ifdef HAVE_SYS_TYPES_H
597 #include <sys/types.h>
599 #ifdef HAVE_SYS_SOCKET_H
600 #include <sys/socket.h>
602 #ifdef HAVE_NETINET_IN_H
603 #include <netinet/in.h>
605 #ifdef HAVE_ARPA_INET_H
606 #include <arpa/inet.h>
612 getservbyname, struct servent *getservbyname(const char *, const char *))
615 #ifdef HAVE_SYS_TYPES_H
616 #include <sys/types.h>
618 #ifdef HAVE_SYS_SOCKET_H
619 #include <sys/socket.h>
622 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
629 openlog, void openlog(const char *, int, int))
643 rk_CHECK_VAR(h_errno,
644 [#ifdef HAVE_SYS_TYPES_H
645 #include <sys/types.h>
650 #ifdef HAVE_WS2TCPIP_H
651 #include <ws2tcpip.h>
655 rk_CHECK_VAR(h_errlist,
659 #ifdef HAVE_WS2TCPIP_H
660 #include <ws2tcpip.h>
667 #ifdef HAVE_WS2TCPIP_H
668 #include <ws2tcpip.h>
671 rk_CHECK_VAR([__progname],
676 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[],[
683 dnl Check for fields in struct tm
686 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
687 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
690 dnl or do we have a variable `timezone' ?
693 rk_CHECK_VAR(timezone,[#include <time.h>])
694 rk_CHECK_VAR(altzone,[#include <time.h>])
696 AC_HAVE_TYPE([sa_family_t],[
697 #include <sys/types.h>
698 #ifdef HAVE_SYS_SOCKET_H
699 #include <sys/socket.h>
701 #ifdef HAVE_WS2TCPIP_H
702 #include <ws2tcpip.h>
704 AC_HAVE_TYPE([socklen_t],[
705 #include <sys/types.h>
706 #ifdef HAVE_SYS_SOCKET_H
707 #include <sys/socket.h>
709 #ifdef HAVE_WS2TCPIP_H
710 #include <ws2tcpip.h>
712 AC_HAVE_TYPE([struct sockaddr], [
713 #include <sys/types.h>
714 #ifdef HAVE_SYS_SOCKET_H
715 #include <sys/socket.h>
717 #ifdef HAVE_WS2TCPIP_H
718 #include <ws2tcpip.h>
720 AC_HAVE_TYPE([struct sockaddr_storage], [
721 #include <sys/types.h>
722 #ifdef HAVE_SYS_SOCKET_H
723 #include <sys/socket.h>
725 #ifdef HAVE_WS2TCPIP_H
726 #include <ws2tcpip.h>
728 AC_HAVE_TYPE([struct addrinfo], [
729 #include <sys/types.h>
733 #ifdef HAVE_WS2TCPIP_H
734 #include <ws2tcpip.h>
736 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
737 AC_HAVE_TYPE([struct iovec],[
738 #include <sys/types.h>
741 AC_HAVE_TYPE([struct msghdr],[
742 #include <sys/types.h>
743 #ifdef HAVE_SYS_SOCKET_H
744 #include <sys/socket.h>
746 #ifdef HAVE_WS2TCPIP_H
747 #include <ws2tcpip.h>
751 dnl Check for struct winsize
754 AC_KRB_STRUCT_WINSIZE
757 dnl Check for struct spwd
763 # Check if we want samba's socket wrapper
768 dnl won't work with automake
769 dnl moved to AC_OUTPUT in configure.in
770 dnl AC_CONFIG_FILES($1/Makefile)
772 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
774 AC_SUBST(DIR_roken)dnl
775 AC_SUBST(LIB_roken)dnl
776 AC_SUBST(INCLUDES_roken)dnl