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])
101 AC_HAVE_TYPE([auxv_t],[#ifdef HAVE_AUXV_H
104 #ifdef HAVE_SYS_AUXV_H
105 #include <sys/auxv.h>
109 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
113 dnl Sunpro 5.2 has a vis.h which is something different.
114 AC_CHECK_HEADERS(vis.h, , , [
120 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
121 #ifdef HAVE_SYS_TYPES_H
122 #include <sys/types.h>
126 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
127 #ifdef HAVE_SYS_TYPES_H
128 #include <sys/types.h>
132 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
133 #ifdef HAVE_SYS_TYPES_H
134 #include <sys/types.h>
136 #if HAVE_SYS_SOCKET_H
137 #include <sys/socket.h>
140 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
141 #ifdef HAVE_SYS_TYPES_H
142 #include <sys/types.h>
144 #if HAVE_SYS_SOCKET_H
145 #include <sys/socket.h>
147 #ifdef HAVE_NETINET6_IN6_H
148 #include <netinet6/in6.h>
152 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
153 #ifdef HAVE_SYS_PARAM_H
154 #include <sys/param.h>
158 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
159 #ifdef HAVE_SYS_PARAM_H
160 #include <sys/param.h>
164 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
166 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
167 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
168 AM_CONDITIONAL(have_search_h, test "$ac_cv_header_search_h" = yes)
169 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
171 dnl Check for functions and libraries
173 AC_FIND_FUNC(socket, socket)
174 AC_FIND_FUNC(gethostbyname, nsl)
175 AC_FIND_FUNC(syslog, syslog)
179 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
224 if test "$ac_cv_func_cgetent" = no; then
227 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
229 AC_REQUIRE([AC_FUNC_GETLOGIN])
231 AC_REQUIRE([AC_FUNC_MMAP])
233 AC_FIND_FUNC_NO_LIBS(getsockopt,,
234 [#ifdef HAVE_SYS_TYPES_H
235 #include <sys/types.h>
237 #ifdef HAVE_SYS_SOCKET_H
238 #include <sys/socket.h>
241 AC_FIND_FUNC_NO_LIBS(setsockopt,,
242 [#ifdef HAVE_SYS_TYPES_H
243 #include <sys/types.h>
245 #ifdef HAVE_SYS_SOCKET_H
246 #include <sys/socket.h>
250 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
261 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
264 #include <string.h>],
267 AC_FIND_FUNC_NO_LIBS(bswap16,,
268 [#ifdef HAVE_SYS_TYPES_H
269 #include <sys/types.h>
271 #ifdef HAVE_SYS_BSWAP_H
272 #include <sys/bswap.h>
275 AC_FIND_FUNC_NO_LIBS(bswap32,,
276 [#ifdef HAVE_SYS_TYPES_H
277 #include <sys/types.h>
279 #ifdef HAVE_SYS_BSWAP_H
280 #include <sys/bswap.h>
283 AC_FIND_FUNC_NO_LIBS(bswap64,,
284 [#ifdef HAVE_SYS_TYPES_H
285 #include <sys/types.h>
287 #ifdef HAVE_SYS_BSWAP_H
288 #include <sys/bswap.h>
291 AC_FIND_FUNC_NO_LIBS(pidfile,util,
296 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
300 #ifdef HAVE_WS2TCPIP_H
301 #include <ws2tcpip.h>
304 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
308 #ifdef HAVE_WS2TCPIP_H
309 #include <ws2tcpip.h>
310 #endif],[0,0,0,0,0,0,0])
312 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
316 #ifdef HAVE_WS2TCPIP_H
317 #include <ws2tcpip.h>
320 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
324 #ifdef HAVE_WS2TCPIP_H
325 #include <ws2tcpip.h>
328 AC_CHECK_LIB(util, emalloc)
334 AC_BROKEN([daemon]) ;;
412 AM_CONDITIONAL(have_fnmatch_h,
413 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
415 AC_FOREACH([rk_func], [strndup strsep strtok_r],
416 [AC_NEED_PROTO([#include <string.h>], rk_func)])
418 AC_CHECK_FUNC([strtoll],
419 [AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
420 [Define if you have the function strtoll.])])
422 AC_CHECK_FUNC([strtoull],
423 [AC_DEFINE_UNQUOTED(HAVE_STRTOULL, 1,
424 [Define if you have the function strtoull.])])
426 AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
427 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
431 AC_MSG_CHECKING([checking for dirfd])
432 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
437 [[DIR *d = 0; dirfd(d);]])],
438 [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
439 if test "$ac_rk_have_dirfd" = "yes" ; then
440 AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
442 AC_MSG_RESULT($ac_rk_have_dirfd)
444 AC_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
449 AC_HAVE_STRUCT_FIELD(DIR, d_fd, [#include <sys/types.h>
454 AC_BROKEN2(inet_aton,
455 [#ifdef HAVE_SYS_TYPES_H
456 #include <sys/types.h>
458 #ifdef HAVE_SYS_SOCKET_H
459 #include <sys/socket.h>
461 #ifdef HAVE_NETINET_IN_H
462 #include <netinet/in.h>
464 #ifdef HAVE_ARPA_INET_H
465 #include <arpa/inet.h>
469 AC_BROKEN2(inet_ntop,
470 [#ifdef HAVE_SYS_TYPES_H
471 #include <sys/types.h>
473 #ifdef HAVE_SYS_SOCKET_H
474 #include <sys/socket.h>
476 #ifdef HAVE_NETINET_IN_H
477 #include <netinet/in.h>
479 #ifdef HAVE_ARPA_INET_H
480 #include <arpa/inet.h>
484 AC_BROKEN2(inet_pton,
485 [#ifdef HAVE_SYS_TYPES_H
486 #include <sys/types.h>
488 #ifdef HAVE_SYS_SOCKET_H
489 #include <sys/socket.h>
491 #ifdef HAVE_NETINET_IN_H
492 #include <netinet/in.h>
494 #ifdef HAVE_ARPA_INET_H
495 #include <arpa/inet.h>
500 dnl Check for sa_len in struct sockaddr,
501 dnl needs to come before the getnameinfo test
503 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
504 #include <sys/socket.h>])
506 if test "$ac_cv_func_getaddrinfo" = "yes"; then
507 rk_BROKEN_GETADDRINFO
508 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
509 AC_LIBOBJ(getaddrinfo)
510 AC_LIBOBJ(freeaddrinfo)
514 AC_NEED_PROTO([#include <stdlib.h>], setenv)
515 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
516 AC_NEED_PROTO([#include <unistd.h>], gethostname)
517 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
518 AC_NEED_PROTO([#include <unistd.h>], getusershell)
519 AC_NEED_PROTO([#include <unistd.h>], daemon)
522 #ifdef HAVE_SYS_TYPES_H
523 #include <sys/types.h>
525 #ifdef HAVE_SYS_SOCKET_H
526 #include <sys/socket.h>
528 #ifdef HAVE_NETINET_IN_H
529 #include <netinet/in.h>
531 #ifdef HAVE_ARPA_INET_H
532 #include <arpa/inet.h>
536 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
538 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
540 dnl AC_KRB_FUNC_GETCWD_BROKEN
542 dnl strerror_r is great fun, on linux it exists before sus catched up,
543 dnl so the return type is diffrent, lets check for both
549 strerror_r, int strerror_r(int, char *, size_t))
551 AC_CHECK_FUNC([strerror_r],
552 [AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
553 [Define if you have the function strerror_r.])])
556 dnl Checks for prototypes and declarations
560 #ifdef HAVE_SYS_TYPES_H
561 #include <sys/types.h>
563 #ifdef HAVE_SYS_SOCKET_H
564 #include <sys/socket.h>
566 #ifdef HAVE_NETINET_IN_H
567 #include <netinet/in.h>
569 #ifdef HAVE_ARPA_INET_H
570 #include <arpa/inet.h>
576 gethostbyname, struct hostent *gethostbyname(const char *))
579 #ifdef HAVE_SYS_TYPES_H
580 #include <sys/types.h>
582 #ifdef HAVE_SYS_SOCKET_H
583 #include <sys/socket.h>
585 #ifdef HAVE_NETINET_IN_H
586 #include <netinet/in.h>
588 #ifdef HAVE_ARPA_INET_H
589 #include <arpa/inet.h>
595 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
598 #ifdef HAVE_SYS_TYPES_H
599 #include <sys/types.h>
601 #ifdef HAVE_SYS_SOCKET_H
602 #include <sys/socket.h>
604 #ifdef HAVE_NETINET_IN_H
605 #include <netinet/in.h>
607 #ifdef HAVE_ARPA_INET_H
608 #include <arpa/inet.h>
614 getservbyname, struct servent *getservbyname(const char *, const char *))
617 #ifdef HAVE_SYS_TYPES_H
618 #include <sys/types.h>
620 #ifdef HAVE_SYS_SOCKET_H
621 #include <sys/socket.h>
624 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
631 openlog, void openlog(const char *, int, int))
645 rk_CHECK_VAR(h_errno,
646 [#ifdef HAVE_SYS_TYPES_H
647 #include <sys/types.h>
652 #ifdef HAVE_WS2TCPIP_H
653 #include <ws2tcpip.h>
657 rk_CHECK_VAR(h_errlist,
661 #ifdef HAVE_WS2TCPIP_H
662 #include <ws2tcpip.h>
669 #ifdef HAVE_WS2TCPIP_H
670 #include <ws2tcpip.h>
673 rk_CHECK_VAR([__progname],
678 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[],[
685 dnl Check for fields in struct tm
688 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
689 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
692 dnl or do we have a variable `timezone' ?
695 rk_CHECK_VAR(timezone,[#include <time.h>])
696 rk_CHECK_VAR(altzone,[#include <time.h>])
698 AC_HAVE_TYPE([sa_family_t],[
699 #include <sys/types.h>
700 #ifdef HAVE_SYS_SOCKET_H
701 #include <sys/socket.h>
703 #ifdef HAVE_WS2TCPIP_H
704 #include <ws2tcpip.h>
706 AC_HAVE_TYPE([socklen_t],[
707 #include <sys/types.h>
708 #ifdef HAVE_SYS_SOCKET_H
709 #include <sys/socket.h>
711 #ifdef HAVE_WS2TCPIP_H
712 #include <ws2tcpip.h>
714 AC_HAVE_TYPE([struct sockaddr], [
715 #include <sys/types.h>
716 #ifdef HAVE_SYS_SOCKET_H
717 #include <sys/socket.h>
719 #ifdef HAVE_WS2TCPIP_H
720 #include <ws2tcpip.h>
722 AC_HAVE_TYPE([struct sockaddr_storage], [
723 #include <sys/types.h>
724 #ifdef HAVE_SYS_SOCKET_H
725 #include <sys/socket.h>
727 #ifdef HAVE_WS2TCPIP_H
728 #include <ws2tcpip.h>
730 AC_HAVE_TYPE([struct addrinfo], [
731 #include <sys/types.h>
735 #ifdef HAVE_WS2TCPIP_H
736 #include <ws2tcpip.h>
738 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
739 AC_HAVE_TYPE([struct iovec],[
740 #include <sys/types.h>
743 AC_HAVE_TYPE([struct msghdr],[
744 #include <sys/types.h>
745 #ifdef HAVE_SYS_SOCKET_H
746 #include <sys/socket.h>
748 #ifdef HAVE_WS2TCPIP_H
749 #include <ws2tcpip.h>
753 dnl Check for struct winsize
756 AC_KRB_STRUCT_WINSIZE
759 dnl Check for struct spwd
765 # Check if we want samba's socket wrapper
770 dnl won't work with automake
771 dnl moved to AC_OUTPUT in configure.in
772 dnl AC_CONFIG_FILES($1/Makefile)
774 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
776 AC_SUBST(DIR_roken)dnl
777 AC_SUBST(LIB_roken)dnl
778 AC_SUBST(INCLUDES_roken)dnl