store is never read again
[heimdal.git] / cf / roken-frag.m4
bloba0d7aaae17b5be8b51dbade961c2378506037b93
1 dnl $Id$
2 dnl
3 dnl some code to get roken working
4 dnl
5 dnl rk_ROKEN(subdir)
6 dnl
7 AC_DEFUN([rk_ROKEN], [
9 AC_REQUIRE([rk_CONFIG_HEADER])
11 DIR_roken=roken
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 dnl C characteristics
26 AC_REQUIRE([AC_C___ATTRIBUTE__])
27 AC_REQUIRE([AC_C_INLINE])
28 AC_REQUIRE([AC_C_CONST])
29 rk_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
31 AC_REQUIRE([rk_DB])
33 dnl C types
35 AC_REQUIRE([AC_TYPE_SIZE_T])
36 AC_HAVE_TYPE([ssize_t],[#include <unistd.h>])
37 AC_REQUIRE([AC_TYPE_PID_T])
38 AC_REQUIRE([AC_TYPE_UID_T])
39 AC_HAVE_TYPE([long long])
41 AC_REQUIRE([rk_RETSIGTYPE])
43 dnl Checks for header files.
44 AC_REQUIRE([AC_HEADER_STDC])
45 AC_REQUIRE([AC_HEADER_TIME])
47 AC_CHECK_HEADERS([\
48         arpa/inet.h                             \
49         config.h                                \
50         crypt.h                                 \
51         dirent.h                                \
52         errno.h                                 \
53         err.h                                   \
54         fcntl.h                                 \
55         fnmatch.h                               \
56         grp.h                                   \
57         ifaddrs.h                               \
58         netinet/in.h                            \
59         netinet/in6.h                           \
60         netinet/in_systm.h                      \
61         netinet6/in6.h                          \
62         paths.h                                 \
63         poll.h                                  \
64         pwd.h                                   \
65         rpcsvc/ypclnt.h                         \
66         shadow.h                                \
67         stdint.h                                \
68         sys/bswap.h                             \
69         sys/ioctl.h                             \
70         sys/mman.h                              \
71         sys/param.h                             \
72         sys/resource.h                          \
73         sys/sockio.h                            \
74         sys/stat.h                              \
75         sys/time.h                              \
76         sys/tty.h                               \
77         sys/types.h                             \
78         sys/uio.h                               \
79         sys/utsname.h                           \
80         sys/wait.h                              \
81         syslog.h                                \
82         termios.h                               \
83         unistd.h                                \
84         userconf.h                              \
85         usersec.h                               \
86         util.h                                  \
89 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
90 #include <stdint.h>
91 #endif])
93 dnl Sunpro 5.2 has a vis.h which is something different.
94 AC_CHECK_HEADERS(vis.h, , , [
95 #include <vis.h>
96 #ifndef VIS_SP
97 #error invis
98 #endif])
99         
100 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
101 #ifdef HAVE_SYS_TYPES_H
102 #include <sys/types.h>
103 #endif
106 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
107 #ifdef HAVE_SYS_TYPES_H
108 #include <sys/types.h>
109 #endif
112 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
113 #ifdef HAVE_SYS_TYPES_H
114 #include <sys/types.h>
115 #endif
116 #if HAVE_SYS_SOCKET_H
117 #include <sys/socket.h>
118 #endif])
120 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
121 #ifdef HAVE_SYS_TYPES_H
122 #include <sys/types.h>
123 #endif
124 #if HAVE_SYS_SOCKET_H
125 #include <sys/socket.h>
126 #endif
127 #ifdef HAVE_NETINET6_IN6_H
128 #include <netinet6/in6.h>
129 #endif
132 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
133 #ifdef HAVE_SYS_PARAM_H
134 #include <sys/param.h>
135 #endif
138 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
139 #ifdef HAVE_SYS_PARAM_H
140 #include <sys/param.h>
141 #endif
144 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
146 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
147 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
148 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
150 dnl Check for functions and libraries
152 AC_FIND_FUNC(socket, socket)
153 AC_FIND_FUNC(gethostbyname, nsl)
154 AC_FIND_FUNC(syslog, syslog)
156 AC_KRB_IPV6
158 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
160 rk_RESOLV
162 AC_BROKEN_SNPRINTF
163 AC_BROKEN_VSNPRINTF
165 AC_BROKEN_GLOB
166 if test "$ac_cv_func_glob_working" != yes; then
167         AC_LIBOBJ(glob)
169 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
172 AC_CHECK_FUNCS([                                \
173         asnprintf                               \
174         asprintf                                \
175         atexit                                  \
176         cgetent                                 \
177         getconfattr                             \
178         getprogname                             \
179         getrlimit                               \
180         getspnam                                \
181         initstate                               \
182         issetugid                               \
183         on_exit                                 \
184         poll                                    \
185         random                                  \
186         setprogname                             \
187         setstate                                \
188         strsvis                                 \
189         strunvis                                \
190         strvis                                  \
191         strvisx                                 \
192         svis                                    \
193         sysconf                                 \
194         sysctl                                  \
195         uname                                   \
196         unvis                                   \
197         vasnprintf                              \
198         vasprintf                               \
199         vis                                     \
202 if test "$ac_cv_func_cgetent" = no; then
203         AC_LIBOBJ(getcap)
205 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
207 AC_REQUIRE([AC_FUNC_GETLOGIN])
209 AC_REQUIRE([AC_FUNC_MMAP])
211 AC_FIND_FUNC_NO_LIBS(getsockopt,,
212 [#ifdef HAVE_SYS_TYPES_H
213 #include <sys/types.h>
214 #endif
215 #ifdef HAVE_SYS_SOCKET_H
216 #include <sys/socket.h>
217 #endif],
218 [0,0,0,0,0])
219 AC_FIND_FUNC_NO_LIBS(setsockopt,,
220 [#ifdef HAVE_SYS_TYPES_H
221 #include <sys/types.h>
222 #endif
223 #ifdef HAVE_SYS_SOCKET_H
224 #include <sys/socket.h>
225 #endif],
226 [0,0,0,0,0])
228 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
229 [#ifdef HAVE_NETDB_H
230 #include <netdb.h>
231 #endif],
233 AC_NEED_PROTO([
234 #ifdef HAVE_NETDB_H
235 #include <netdb.h>
236 #endif],
237 hstrerror)
239 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
240         [AC_NEED_PROTO([
241         #include <stdio.h>
242         #include <string.h>],
243         rk_func)])
245 AC_FIND_FUNC_NO_LIBS(bswap16,,
246 [#ifdef HAVE_SYS_TYPES_H
247 #include <sys/types.h>
248 #endif
249 #ifdef HAVE_SYS_BSWAP_H
250 #include <sys/bswap.h>
251 #endif],0)
253 AC_FIND_FUNC_NO_LIBS(bswap32,,
254 [#ifdef HAVE_SYS_TYPES_H
255 #include <sys/types.h>
256 #endif
257 #ifdef HAVE_SYS_BSWAP_H
258 #include <sys/bswap.h>
259 #endif],0)
261 AC_FIND_FUNC_NO_LIBS(pidfile,util,
262 [#ifdef HAVE_UTIL_H
263 #include <util.h>
264 #endif],0)
266 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
267 [#ifdef HAVE_NETDB_H
268 #include <netdb.h>
269 #endif],[0,0,0,0])
271 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
272 [#ifdef HAVE_NETDB_H
273 #include <netdb.h>
274 #endif],[0,0,0,0,0,0,0])
276 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
277 [#ifdef HAVE_NETDB_H
278 #include <netdb.h>
279 #endif],[0])
281 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
282 [#ifdef HAVE_NETDB_H
283 #include <netdb.h>
284 #endif],[0])
286 dnl Darwin is weird, and in some senses not unix, launchd doesn't want
287 dnl servers to use daemon(), so its deprecated.
288 case "$host_os" in
289         darwin*)
290                 ;;
291         *)
292                 AC_DEFINE([SUPPORT_DETACH], 1,
293                     [Define if os support want to detach is daemonens.])
294                 AC_BROKEN([daemon]) ;;
295 esac
298 AC_BROKEN([                                     \
299         chown                                   \
300         copyhostent                             \
301         closefrom                               \
302         ecalloc                                 \
303         emalloc                                 \
304         erealloc                                \
305         estrdup                                 \
306         err                                     \
307         errx                                    \
308         fchown                                  \
309         flock                                   \
310         fnmatch                                 \
311         freehostent                             \
312         getcwd                                  \
313         getdtablesize                           \
314         getegid                                 \
315         geteuid                                 \
316         getgid                                  \
317         gethostname                             \
318         getifaddrs                              \
319         getipnodebyaddr                         \
320         getipnodebyname                         \
321         getopt                                  \
322         gettimeofday                            \
323         getuid                                  \
324         getusershell                            \
325         initgroups                              \
326         innetgr                                 \
327         iruserok                                \
328         localtime_r                             \
329         lstat                                   \
330         memmove                                 \
331         mkstemp                                 \
332         putenv                                  \
333         rcmd                                    \
334         readv                                   \
335         recvmsg                                 \
336         sendmsg                                 \
337         setegid                                 \
338         setenv                                  \
339         seteuid                                 \
340         strcasecmp                              \
341         strdup                                  \
342         strerror                                \
343         strftime                                \
344         strlcat                                 \
345         strlcpy                                 \
346         strlwr                                  \
347         strncasecmp                             \
348         strndup                                 \
349         strnlen                                 \
350         strptime                                \
351         strsep                                  \
352         strsep_copy                             \
353         strtok_r                                \
354         strupr                                  \
355         swab                                    \
356         timegm                                  \
357         unsetenv                                \
358         verr                                    \
359         verrx                                   \
360         vsyslog                                 \
361         vwarn                                   \
362         vwarnx                                  \
363         warn                                    \
364         warnx                                   \
365         writev                                  \
368 AM_CONDITIONAL(have_fnmatch_h,
369         test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
371 AC_FOREACH([rk_func], [strndup strsep strtok_r],
372         [AC_NEED_PROTO([#include <string.h>], rk_func)])
374 AC_FOREACH([rk_func], [strsvis strunvis strvis strvisx svis unvis vis],
375 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
376 #include <vis.h>
377 #endif], rk_func)])
379 AC_BROKEN2(inet_aton,
380 [#ifdef HAVE_SYS_TYPES_H
381 #include <sys/types.h>
382 #endif
383 #ifdef HAVE_SYS_SOCKET_H
384 #include <sys/socket.h>
385 #endif
386 #ifdef HAVE_NETINET_IN_H
387 #include <netinet/in.h>
388 #endif
389 #ifdef HAVE_ARPA_INET_H
390 #include <arpa/inet.h>
391 #endif],
392 [0,0])
394 AC_BROKEN2(inet_ntop,
395 [#ifdef HAVE_SYS_TYPES_H
396 #include <sys/types.h>
397 #endif
398 #ifdef HAVE_SYS_SOCKET_H
399 #include <sys/socket.h>
400 #endif
401 #ifdef HAVE_NETINET_IN_H
402 #include <netinet/in.h>
403 #endif
404 #ifdef HAVE_ARPA_INET_H
405 #include <arpa/inet.h>
406 #endif],
407 [0, 0, 0, 0])
409 AC_BROKEN2(inet_pton,
410 [#ifdef HAVE_SYS_TYPES_H
411 #include <sys/types.h>
412 #endif
413 #ifdef HAVE_SYS_SOCKET_H
414 #include <sys/socket.h>
415 #endif
416 #ifdef HAVE_NETINET_IN_H
417 #include <netinet/in.h>
418 #endif
419 #ifdef HAVE_ARPA_INET_H
420 #include <arpa/inet.h>
421 #endif],
422 [0,0,0])
425 dnl Check for sa_len in struct sockaddr, 
426 dnl needs to come before the getnameinfo test
428 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
429 #include <sys/socket.h>])
431 if test "$ac_cv_func_getaddrinfo" = "yes"; then
432   rk_BROKEN_GETADDRINFO
433   if test "$ac_cv_func_getaddrinfo_numserv" = no; then
434         AC_LIBOBJ(getaddrinfo)
435         AC_LIBOBJ(freeaddrinfo)
436   fi
439 AC_NEED_PROTO([#include <stdlib.h>], setenv)
440 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
441 AC_NEED_PROTO([#include <unistd.h>], gethostname)
442 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
443 AC_NEED_PROTO([#include <unistd.h>], getusershell)
444 AC_NEED_PROTO([#include <unistd.h>], daemon)
445 AC_NEED_PROTO([
446 #ifdef HAVE_SYS_TYPES_H
447 #include <sys/types.h>
448 #endif
449 #ifdef HAVE_SYS_SOCKET_H
450 #include <sys/socket.h>
451 #endif
452 #ifdef HAVE_NETINET_IN_H
453 #include <netinet/in.h>
454 #endif
455 #ifdef HAVE_ARPA_INET_H
456 #include <arpa/inet.h>
457 #endif
458 #ifdef HAVE_NETDB_H
459 #include <netdb.h>
460 #endif
461 #ifdef HAVE_UNISTD_H
462 #include <unistd.h>
463 #endif],
464 iruserok)
466 AC_NEED_PROTO([
467 #ifdef HAVE_SYS_TYPES_H
468 #include <sys/types.h>
469 #endif
470 #ifdef HAVE_SYS_SOCKET_H
471 #include <sys/socket.h>
472 #endif
473 #ifdef HAVE_NETINET_IN_H
474 #include <netinet/in.h>
475 #endif
476 #ifdef HAVE_ARPA_INET_H
477 #include <arpa/inet.h>
478 #endif],
479 inet_aton)
481 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
483 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
485 dnl AC_KRB_FUNC_GETCWD_BROKEN
488 dnl Checks for prototypes and declarations
491 AC_PROTO_COMPAT([
492 #ifdef HAVE_SYS_TYPES_H
493 #include <sys/types.h>
494 #endif
495 #ifdef HAVE_SYS_SOCKET_H
496 #include <sys/socket.h>
497 #endif
498 #ifdef HAVE_NETINET_IN_H
499 #include <netinet/in.h>
500 #endif
501 #ifdef HAVE_ARPA_INET_H
502 #include <arpa/inet.h>
503 #endif
504 #ifdef HAVE_NETDB_H
505 #include <netdb.h>
506 #endif
508 gethostbyname, struct hostent *gethostbyname(const char *))
510 AC_PROTO_COMPAT([
511 #ifdef HAVE_SYS_TYPES_H
512 #include <sys/types.h>
513 #endif
514 #ifdef HAVE_SYS_SOCKET_H
515 #include <sys/socket.h>
516 #endif
517 #ifdef HAVE_NETINET_IN_H
518 #include <netinet/in.h>
519 #endif
520 #ifdef HAVE_ARPA_INET_H
521 #include <arpa/inet.h>
522 #endif
523 #ifdef HAVE_NETDB_H
524 #include <netdb.h>
525 #endif
527 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
529 AC_PROTO_COMPAT([
530 #ifdef HAVE_SYS_TYPES_H
531 #include <sys/types.h>
532 #endif
533 #ifdef HAVE_SYS_SOCKET_H
534 #include <sys/socket.h>
535 #endif
536 #ifdef HAVE_NETINET_IN_H
537 #include <netinet/in.h>
538 #endif
539 #ifdef HAVE_ARPA_INET_H
540 #include <arpa/inet.h>
541 #endif
542 #ifdef HAVE_NETDB_H
543 #include <netdb.h>
544 #endif
546 getservbyname, struct servent *getservbyname(const char *, const char *))
548 AC_PROTO_COMPAT([
549 #ifdef HAVE_SYS_TYPES_H
550 #include <sys/types.h>
551 #endif
552 #ifdef HAVE_SYS_SOCKET_H
553 #include <sys/socket.h>
554 #endif
556 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
558 AC_PROTO_COMPAT([
559 #ifdef HAVE_SYSLOG_H
560 #include <syslog.h>
561 #endif
563 openlog, void openlog(const char *, int, int))
565 AC_NEED_PROTO([
566 #ifdef HAVE_CRYPT_H
567 #include <crypt.h>
568 #endif
569 #ifdef HAVE_UNISTD_H
570 #include <unistd.h>
571 #endif
573 crypt)
575 dnl variables
577 rk_CHECK_VAR(h_errno, 
578 [#ifdef HAVE_SYS_TYPES_H
579 #include <sys/types.h>
580 #endif
581 #ifdef HAVE_NETDB_H
582 #include <netdb.h>
583 #endif])
585 rk_CHECK_VAR(h_errlist, 
586 [#ifdef HAVE_NETDB_H
587 #include <netdb.h>
588 #endif])
590 rk_CHECK_VAR(h_nerr, 
591 [#ifdef HAVE_NETDB_H
592 #include <netdb.h>
593 #endif])
595 rk_CHECK_VAR([__progname], 
596 [#ifdef HAVE_ERR_H
597 #include <err.h>
598 #endif])
600 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[][
601 #include <stdlib.h>
602 #ifdef HAVE_UNISTD_H
603 #include <unistd.h>
604 #endif])
607 dnl Check for fields in struct tm
610 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
611 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
614 dnl or do we have a variable `timezone' ?
617 rk_CHECK_VAR(timezone,[#include <time.h>])
618 rk_CHECK_VAR(altzone,[#include <time.h>])
620 AC_HAVE_TYPE([sa_family_t],[
621 #include <sys/types.h>
622 #include <sys/socket.h>])
623 AC_HAVE_TYPE([socklen_t],[
624 #include <sys/types.h>
625 #include <sys/socket.h>])
626 AC_HAVE_TYPE([struct sockaddr], [
627 #include <sys/types.h>
628 #include <sys/socket.h>])
629 AC_HAVE_TYPE([struct sockaddr_storage], [
630 #include <sys/types.h>
631 #include <sys/socket.h>])
632 AC_HAVE_TYPE([struct addrinfo], [
633 #include <sys/types.h>
634 #include <netdb.h>])
635 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
636 AC_HAVE_TYPE([struct iovec],[
637 #include <sys/types.h>
638 #include <sys/uio.h>
640 AC_HAVE_TYPE([struct msghdr],[
641 #include <sys/types.h>
642 #include <sys/socket.h>
646 dnl Check for struct winsize
649 AC_KRB_STRUCT_WINSIZE
652 dnl Check for struct spwd
655 AC_KRB_STRUCT_SPWD
658 # Check if we want samba's socket wrapper
661 samba_SOCKET_WRAPPER
663 dnl won't work with automake
664 dnl moved to AC_OUTPUT in configure.in
665 dnl AC_CONFIG_FILES($1/Makefile)
667 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
669 AC_SUBST(DIR_roken)dnl
670 AC_SUBST(LIB_roken)dnl
671 AC_SUBST(INCLUDES_roken)dnl