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])
99 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
103 dnl Sunpro 5.2 has a vis.h which is something different.
104 AC_CHECK_HEADERS(vis.h, , , [
110 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
111 #ifdef HAVE_SYS_TYPES_H
112 #include <sys/types.h>
116 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
117 #ifdef HAVE_SYS_TYPES_H
118 #include <sys/types.h>
122 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
123 #ifdef HAVE_SYS_TYPES_H
124 #include <sys/types.h>
126 #if HAVE_SYS_SOCKET_H
127 #include <sys/socket.h>
130 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
131 #ifdef HAVE_SYS_TYPES_H
132 #include <sys/types.h>
134 #if HAVE_SYS_SOCKET_H
135 #include <sys/socket.h>
137 #ifdef HAVE_NETINET6_IN6_H
138 #include <netinet6/in6.h>
142 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
143 #ifdef HAVE_SYS_PARAM_H
144 #include <sys/param.h>
148 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
149 #ifdef HAVE_SYS_PARAM_H
150 #include <sys/param.h>
154 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
156 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
157 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
158 AM_CONDITIONAL(have_search_h, test "$ac_cv_header_search_h" = yes)
159 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
161 dnl Check for functions and libraries
163 AC_FIND_FUNC(socket, socket)
164 AC_FIND_FUNC(gethostbyname, nsl)
165 AC_FIND_FUNC(syslog, syslog)
169 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
177 if test "$ac_cv_func_glob_working" != yes; then
180 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
216 if test "$ac_cv_func_cgetent" = no; then
219 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
221 AC_REQUIRE([AC_FUNC_GETLOGIN])
223 AC_REQUIRE([AC_FUNC_MMAP])
225 AC_FIND_FUNC_NO_LIBS(getsockopt,,
226 [#ifdef HAVE_SYS_TYPES_H
227 #include <sys/types.h>
229 #ifdef HAVE_SYS_SOCKET_H
230 #include <sys/socket.h>
233 AC_FIND_FUNC_NO_LIBS(setsockopt,,
234 [#ifdef HAVE_SYS_TYPES_H
235 #include <sys/types.h>
237 #ifdef HAVE_SYS_SOCKET_H
238 #include <sys/socket.h>
242 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
253 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
256 #include <string.h>],
259 AC_FIND_FUNC_NO_LIBS(bswap16,,
260 [#ifdef HAVE_SYS_TYPES_H
261 #include <sys/types.h>
263 #ifdef HAVE_SYS_BSWAP_H
264 #include <sys/bswap.h>
267 AC_FIND_FUNC_NO_LIBS(bswap32,,
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(bswap64,,
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(pidfile,util,
288 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
292 #ifdef HAVE_WS2TCPIP_H
293 #include <ws2tcpip.h>
296 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
300 #ifdef HAVE_WS2TCPIP_H
301 #include <ws2tcpip.h>
302 #endif],[0,0,0,0,0,0,0])
304 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
308 #ifdef HAVE_WS2TCPIP_H
309 #include <ws2tcpip.h>
312 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
316 #ifdef HAVE_WS2TCPIP_H
317 #include <ws2tcpip.h>
324 AC_BROKEN([daemon]) ;;
401 AM_CONDITIONAL(have_fnmatch_h,
402 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
404 AC_FOREACH([rk_func], [strndup strsep strtok_r],
405 [AC_NEED_PROTO([#include <string.h>], rk_func)])
407 AC_CHECK_FUNC([strtoll],
408 [AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
409 [Define if you have the function strtoll.])])
411 AC_CHECK_FUNC([strtoull],
412 [AC_DEFINE_UNQUOTED(HAVE_STRTOULL, 1,
413 [Define if you have the function strtoull.])])
415 AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
416 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
420 AC_MSG_CHECKING([checking for dirfd])
421 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
426 [[DIR *d = 0; dirfd(d);]])],
427 [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
428 if test "$ac_rk_have_dirfd" = "yes" ; then
429 AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
431 AC_MSG_RESULT($ac_rk_have_dirfd)
433 AC_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
439 AC_BROKEN2(inet_aton,
440 [#ifdef HAVE_SYS_TYPES_H
441 #include <sys/types.h>
443 #ifdef HAVE_SYS_SOCKET_H
444 #include <sys/socket.h>
446 #ifdef HAVE_NETINET_IN_H
447 #include <netinet/in.h>
449 #ifdef HAVE_ARPA_INET_H
450 #include <arpa/inet.h>
454 AC_BROKEN2(inet_ntop,
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_pton,
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>
485 dnl Check for sa_len in struct sockaddr,
486 dnl needs to come before the getnameinfo test
488 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
489 #include <sys/socket.h>])
491 if test "$ac_cv_func_getaddrinfo" = "yes"; then
492 rk_BROKEN_GETADDRINFO
493 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
494 AC_LIBOBJ(getaddrinfo)
495 AC_LIBOBJ(freeaddrinfo)
499 AC_NEED_PROTO([#include <stdlib.h>], setenv)
500 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
501 AC_NEED_PROTO([#include <unistd.h>], gethostname)
502 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
503 AC_NEED_PROTO([#include <unistd.h>], getusershell)
504 AC_NEED_PROTO([#include <unistd.h>], daemon)
506 #ifdef HAVE_SYS_TYPES_H
507 #include <sys/types.h>
509 #ifdef HAVE_SYS_SOCKET_H
510 #include <sys/socket.h>
512 #ifdef HAVE_NETINET_IN_H
513 #include <netinet/in.h>
515 #ifdef HAVE_ARPA_INET_H
516 #include <arpa/inet.h>
527 #ifdef HAVE_SYS_TYPES_H
528 #include <sys/types.h>
530 #ifdef HAVE_SYS_SOCKET_H
531 #include <sys/socket.h>
533 #ifdef HAVE_NETINET_IN_H
534 #include <netinet/in.h>
536 #ifdef HAVE_ARPA_INET_H
537 #include <arpa/inet.h>
541 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
543 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
545 dnl AC_KRB_FUNC_GETCWD_BROKEN
547 dnl strerror_r is great fun, on linux it exists before sus catched up,
548 dnl so the return type is diffrent, lets check for both
554 strerror_r, int strerror_r(int, char *, size_t))
556 AC_CHECK_FUNC([strerror_r],
557 [AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
558 [Define if you have the function strerror_r.])])
561 dnl Checks for prototypes and declarations
565 #ifdef HAVE_SYS_TYPES_H
566 #include <sys/types.h>
568 #ifdef HAVE_SYS_SOCKET_H
569 #include <sys/socket.h>
571 #ifdef HAVE_NETINET_IN_H
572 #include <netinet/in.h>
574 #ifdef HAVE_ARPA_INET_H
575 #include <arpa/inet.h>
581 gethostbyname, struct hostent *gethostbyname(const char *))
584 #ifdef HAVE_SYS_TYPES_H
585 #include <sys/types.h>
587 #ifdef HAVE_SYS_SOCKET_H
588 #include <sys/socket.h>
590 #ifdef HAVE_NETINET_IN_H
591 #include <netinet/in.h>
593 #ifdef HAVE_ARPA_INET_H
594 #include <arpa/inet.h>
600 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
603 #ifdef HAVE_SYS_TYPES_H
604 #include <sys/types.h>
606 #ifdef HAVE_SYS_SOCKET_H
607 #include <sys/socket.h>
609 #ifdef HAVE_NETINET_IN_H
610 #include <netinet/in.h>
612 #ifdef HAVE_ARPA_INET_H
613 #include <arpa/inet.h>
619 getservbyname, struct servent *getservbyname(const char *, const char *))
622 #ifdef HAVE_SYS_TYPES_H
623 #include <sys/types.h>
625 #ifdef HAVE_SYS_SOCKET_H
626 #include <sys/socket.h>
629 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
636 openlog, void openlog(const char *, int, int))
650 rk_CHECK_VAR(h_errno,
651 [#ifdef HAVE_SYS_TYPES_H
652 #include <sys/types.h>
657 #ifdef HAVE_WS2TCPIP_H
658 #include <ws2tcpip.h>
662 rk_CHECK_VAR(h_errlist,
666 #ifdef HAVE_WS2TCPIP_H
667 #include <ws2tcpip.h>
674 #ifdef HAVE_WS2TCPIP_H
675 #include <ws2tcpip.h>
678 rk_CHECK_VAR([__progname],
683 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[],[
690 dnl Check for fields in struct tm
693 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
694 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
697 dnl or do we have a variable `timezone' ?
700 rk_CHECK_VAR(timezone,[#include <time.h>])
701 rk_CHECK_VAR(altzone,[#include <time.h>])
703 AC_HAVE_TYPE([sa_family_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([socklen_t],[
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], [
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 sockaddr_storage], [
728 #include <sys/types.h>
729 #ifdef HAVE_SYS_SOCKET_H
730 #include <sys/socket.h>
732 #ifdef HAVE_WS2TCPIP_H
733 #include <ws2tcpip.h>
735 AC_HAVE_TYPE([struct addrinfo], [
736 #include <sys/types.h>
740 #ifdef HAVE_WS2TCPIP_H
741 #include <ws2tcpip.h>
743 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
744 AC_HAVE_TYPE([struct iovec],[
745 #include <sys/types.h>
748 AC_HAVE_TYPE([struct msghdr],[
749 #include <sys/types.h>
750 #ifdef HAVE_SYS_SOCKET_H
751 #include <sys/socket.h>
753 #ifdef HAVE_WS2TCPIP_H
754 #include <ws2tcpip.h>
758 dnl Check for struct winsize
761 AC_KRB_STRUCT_WINSIZE
764 dnl Check for struct spwd
770 # Check if we want samba's socket wrapper
775 dnl won't work with automake
776 dnl moved to AC_OUTPUT in configure.in
777 dnl AC_CONFIG_FILES($1/Makefile)
779 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
781 AC_SUBST(DIR_roken)dnl
782 AC_SUBST(LIB_roken)dnl
783 AC_SUBST(INCLUDES_roken)dnl