1 dnl $Heimdal: roken-frag.m4 20639 2007-05-10 17:22:58Z lha $
4 dnl some code to get roken working
10 AC_REQUIRE([rk_CONFIG_HEADER])
13 LIB_roken='$(top_builddir)/$1/libroken.la'
14 INCLUDES_roken='-I$(top_builddir)/$1 -I$(top_srcdir)/$1'
16 dnl Checks for programs
17 AC_REQUIRE([AC_PROG_CC])
18 AC_REQUIRE([AC_PROG_AWK])
19 AC_REQUIRE([AC_OBJEXT])
20 AC_REQUIRE([AC_EXEEXT])
21 AC_REQUIRE([AC_PROG_LIBTOOL])
23 AC_REQUIRE([AC_MIPS_ABI])
27 AC_REQUIRE([AC_C___ATTRIBUTE__])
28 AC_REQUIRE([AC_C_INLINE])
29 AC_REQUIRE([AC_C_CONST])
30 rk_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
36 AC_REQUIRE([AC_TYPE_SIZE_T])
37 AC_HAVE_TYPE([ssize_t],[#include <unistd.h>])
38 AC_REQUIRE([AC_TYPE_PID_T])
39 AC_REQUIRE([AC_TYPE_UID_T])
40 AC_HAVE_TYPE([long long])
42 AC_REQUIRE([rk_RETSIGTYPE])
44 dnl Checks for header files.
45 AC_REQUIRE([AC_HEADER_STDC])
46 AC_REQUIRE([AC_HEADER_TIME])
90 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
94 dnl Sunpro 5.2 has a vis.h which is something different.
95 AC_CHECK_HEADERS(vis.h, , , [
101 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
102 #ifdef HAVE_SYS_TYPES_H
103 #include <sys/types.h>
107 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
108 #ifdef HAVE_SYS_TYPES_H
109 #include <sys/types.h>
113 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
114 #ifdef HAVE_SYS_TYPES_H
115 #include <sys/types.h>
117 #if HAVE_SYS_SOCKET_H
118 #include <sys/socket.h>
121 AC_CHECK_HEADERS(netinet6/in6_var.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>
128 #ifdef HAVE_NETINET6_IN6_H
129 #include <netinet6/in6.h>
133 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
134 #ifdef HAVE_SYS_PARAM_H
135 #include <sys/param.h>
139 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
140 #ifdef HAVE_SYS_PARAM_H
141 #include <sys/param.h>
145 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
147 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
148 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
149 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
151 dnl Check for functions and libraries
153 AC_FIND_FUNC(socket, socket)
154 AC_FIND_FUNC(gethostbyname, nsl)
155 AC_FIND_FUNC(syslog, syslog)
159 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
167 if test "$ac_cv_func_glob_working" != yes; then
170 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
203 if test "$ac_cv_func_cgetent" = no; then
206 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
208 AC_REQUIRE([AC_FUNC_GETLOGIN])
210 AC_REQUIRE([AC_FUNC_MMAP])
212 AC_FIND_FUNC_NO_LIBS(getsockopt,,
213 [#ifdef HAVE_SYS_TYPES_H
214 #include <sys/types.h>
216 #ifdef HAVE_SYS_SOCKET_H
217 #include <sys/socket.h>
220 AC_FIND_FUNC_NO_LIBS(setsockopt,,
221 [#ifdef HAVE_SYS_TYPES_H
222 #include <sys/types.h>
224 #ifdef HAVE_SYS_SOCKET_H
225 #include <sys/socket.h>
229 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
240 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
243 #include <string.h>],
246 AC_FIND_FUNC_NO_LIBS(bswap16,,
247 [#ifdef HAVE_SYS_BSWAP_H
248 #include <sys/bswap.h>
251 AC_FIND_FUNC_NO_LIBS(bswap32,,
252 [#ifdef HAVE_SYS_BSWAP_H
253 #include <sys/bswap.h>
256 AC_FIND_FUNC_NO_LIBS(pidfile,util,
261 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
266 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
269 #endif],[0,0,0,0,0,0,0])
271 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
276 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
352 AM_CONDITIONAL(have_fnmatch_h,
353 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
355 AC_FOREACH([rk_func], [strndup strsep strtok_r],
356 [AC_NEED_PROTO([#include <string.h>], rk_func)])
358 AC_FOREACH([rk_func], [strsvis strunvis strvis strvisx svis unvis vis],
359 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
363 AC_BROKEN2(inet_aton,
364 [#ifdef HAVE_SYS_TYPES_H
365 #include <sys/types.h>
367 #ifdef HAVE_SYS_SOCKET_H
368 #include <sys/socket.h>
370 #ifdef HAVE_NETINET_IN_H
371 #include <netinet/in.h>
373 #ifdef HAVE_ARPA_INET_H
374 #include <arpa/inet.h>
378 AC_BROKEN2(inet_ntop,
379 [#ifdef HAVE_SYS_TYPES_H
380 #include <sys/types.h>
382 #ifdef HAVE_SYS_SOCKET_H
383 #include <sys/socket.h>
385 #ifdef HAVE_NETINET_IN_H
386 #include <netinet/in.h>
388 #ifdef HAVE_ARPA_INET_H
389 #include <arpa/inet.h>
393 AC_BROKEN2(inet_pton,
394 [#ifdef HAVE_SYS_TYPES_H
395 #include <sys/types.h>
397 #ifdef HAVE_SYS_SOCKET_H
398 #include <sys/socket.h>
400 #ifdef HAVE_NETINET_IN_H
401 #include <netinet/in.h>
403 #ifdef HAVE_ARPA_INET_H
404 #include <arpa/inet.h>
409 dnl Check for sa_len in struct sockaddr,
410 dnl needs to come before the getnameinfo test
412 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
413 #include <sys/socket.h>])
415 if test "$ac_cv_func_getaddrinfo" = "yes"; then
416 rk_BROKEN_GETADDRINFO
417 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
418 AC_LIBOBJ(getaddrinfo)
419 AC_LIBOBJ(freeaddrinfo)
423 AC_NEED_PROTO([#include <stdlib.h>], setenv)
424 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
425 AC_NEED_PROTO([#include <unistd.h>], gethostname)
426 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
427 AC_NEED_PROTO([#include <unistd.h>], getusershell)
428 AC_NEED_PROTO([#include <unistd.h>], daemon)
430 #ifdef HAVE_SYS_TYPES_H
431 #include <sys/types.h>
433 #ifdef HAVE_SYS_SOCKET_H
434 #include <sys/socket.h>
436 #ifdef HAVE_NETINET_IN_H
437 #include <netinet/in.h>
439 #ifdef HAVE_ARPA_INET_H
440 #include <arpa/inet.h>
451 #ifdef HAVE_SYS_TYPES_H
452 #include <sys/types.h>
454 #ifdef HAVE_SYS_SOCKET_H
455 #include <sys/socket.h>
457 #ifdef HAVE_NETINET_IN_H
458 #include <netinet/in.h>
460 #ifdef HAVE_ARPA_INET_H
461 #include <arpa/inet.h>
465 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
467 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
469 dnl AC_KRB_FUNC_GETCWD_BROKEN
472 dnl Checks for prototypes and declarations
476 #ifdef HAVE_SYS_TYPES_H
477 #include <sys/types.h>
479 #ifdef HAVE_SYS_SOCKET_H
480 #include <sys/socket.h>
482 #ifdef HAVE_NETINET_IN_H
483 #include <netinet/in.h>
485 #ifdef HAVE_ARPA_INET_H
486 #include <arpa/inet.h>
492 gethostbyname, struct hostent *gethostbyname(const char *))
495 #ifdef HAVE_SYS_TYPES_H
496 #include <sys/types.h>
498 #ifdef HAVE_SYS_SOCKET_H
499 #include <sys/socket.h>
501 #ifdef HAVE_NETINET_IN_H
502 #include <netinet/in.h>
504 #ifdef HAVE_ARPA_INET_H
505 #include <arpa/inet.h>
511 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
514 #ifdef HAVE_SYS_TYPES_H
515 #include <sys/types.h>
517 #ifdef HAVE_SYS_SOCKET_H
518 #include <sys/socket.h>
520 #ifdef HAVE_NETINET_IN_H
521 #include <netinet/in.h>
523 #ifdef HAVE_ARPA_INET_H
524 #include <arpa/inet.h>
530 getservbyname, struct servent *getservbyname(const char *, const char *))
533 #ifdef HAVE_SYS_TYPES_H
534 #include <sys/types.h>
536 #ifdef HAVE_SYS_SOCKET_H
537 #include <sys/socket.h>
540 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
547 openlog, void openlog(const char *, int, int))
561 rk_CHECK_VAR(h_errno,
562 [#ifdef HAVE_SYS_TYPES_H
563 #include <sys/types.h>
569 rk_CHECK_VAR(h_errlist,
579 rk_CHECK_VAR([__progname],
584 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[][
591 dnl Check for fields in struct tm
594 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
595 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
598 dnl or do we have a variable `timezone' ?
601 rk_CHECK_VAR(timezone,[#include <time.h>])
602 rk_CHECK_VAR(altzone,[#include <time.h>])
604 AC_HAVE_TYPE([sa_family_t],[
605 #include <sys/types.h>
606 #include <sys/socket.h>])
607 AC_HAVE_TYPE([socklen_t],[
608 #include <sys/types.h>
609 #include <sys/socket.h>])
610 AC_HAVE_TYPE([struct sockaddr], [
611 #include <sys/types.h>
612 #include <sys/socket.h>])
613 AC_HAVE_TYPE([struct sockaddr_storage], [
614 #include <sys/types.h>
615 #include <sys/socket.h>])
616 AC_HAVE_TYPE([struct addrinfo], [
617 #include <sys/types.h>
619 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
620 AC_HAVE_TYPE([struct iovec],[
621 #include <sys/types.h>
624 AC_HAVE_TYPE([struct msghdr],[
625 #include <sys/types.h>
626 #include <sys/socket.h>
630 dnl Check for struct winsize
633 AC_KRB_STRUCT_WINSIZE
636 dnl Check for struct spwd
642 # Check if we want samba's socket wrapper
647 dnl won't work with automake
648 dnl moved to AC_OUTPUT in configure.in
649 dnl AC_CONFIG_FILES($1/Makefile)
651 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
653 AC_SUBST(DIR_roken)dnl
654 AC_SUBST(LIB_roken)dnl
655 AC_SUBST(INCLUDES_roken)dnl