This commit was manufactured by cvs2svn to create tag
[heimdal.git] / cf / roken-frag.m4
blob79d08b4dcd8d5410aaf9a2ccecb5171cfaf514e6
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 AC_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_CHECK_TYPE_EXTRA(ssize_t, int, [#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         arpa/nameser.h                          \
50         config.h                                \
51         crypt.h                                 \
52         dbm.h                                   \
53         db.h                                    \
54         dirent.h                                \
55         errno.h                                 \
56         err.h                                   \
57         fcntl.h                                 \
58         gdbm/ndbm.h                             \
59         grp.h                                   \
60         ifaddrs.h                               \
61         ndbm.h                                  \
62         net/if.h                                \
63         netdb.h                                 \
64         netinet/in.h                            \
65         netinet/in6.h                           \
66         netinet/in_systm.h                      \
67         netinet6/in6.h                          \
68         netinet6/in6_var.h                      \
69         paths.h                                 \
70         pwd.h                                   \
71         resolv.h                                \
72         rpcsvc/dbm.h                            \
73         rpcsvc/ypclnt.h                         \
74         shadow.h                                \
75         sys/bswap.h                             \
76         sys/ioctl.h                             \
77         sys/param.h                             \
78         sys/proc.h                              \
79         sys/resource.h                          \
80         sys/socket.h                            \
81         sys/sockio.h                            \
82         sys/stat.h                              \
83         sys/sysctl.h                            \
84         sys/time.h                              \
85         sys/tty.h                               \
86         sys/types.h                             \
87         sys/uio.h                               \
88         sys/utsname.h                           \
89         sys/wait.h                              \
90         syslog.h                                \
91         termios.h                               \
92         unistd.h                                \
93         userconf.h                              \
94         usersec.h                               \
95         util.h                                  \
96         vis.h                                   \
97         winsock.h                               \
99         
100 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
102 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
103 AM_CONDITIONAL(have_fnmatch_h, test "$ac_cv_header_fnmatch_h" = yes)
104 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
105 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
107 dnl Check for functions and libraries
109 AC_KRB_IPV6
111 AC_FIND_FUNC(socket, socket)
112 AC_FIND_FUNC(gethostbyname, nsl)
113 AC_FIND_FUNC(syslog, syslog)
114 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
116 AC_FIND_FUNC(res_search, resolv,
118 #include <stdio.h>
119 #ifdef HAVE_SYS_TYPES_H
120 #include <sys/types.h>
121 #endif
122 #ifdef HAVE_NETINET_IN_H
123 #include <netinet/in.h>
124 #endif
125 #ifdef HAVE_ARPA_NAMESER_H
126 #include <arpa/nameser.h>
127 #endif
128 #ifdef HAVE_RESOLV_H
129 #include <resolv.h>
130 #endif
132 [0,0,0,0,0])
134 AC_FIND_FUNC(dn_expand, resolv,
136 #include <stdio.h>
137 #ifdef HAVE_SYS_TYPES_H
138 #include <sys/types.h>
139 #endif
140 #ifdef HAVE_NETINET_IN_H
141 #include <netinet/in.h>
142 #endif
143 #ifdef HAVE_ARPA_NAMESER_H
144 #include <arpa/nameser.h>
145 #endif
146 #ifdef HAVE_RESOLV_H
147 #include <resolv.h>
148 #endif
150 [0,0,0,0,0])
152 AC_BROKEN_SNPRINTF
153 AC_BROKEN_VSNPRINTF
155 AC_BROKEN_GLOB
156 if test "$ac_cv_func_glob_working" != yes; then
157         LIBOBJS="$LIBOBJS glob.o"
159 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
162 AC_CHECK_FUNCS([                                \
163         asnprintf                               \
164         asprintf                                \
165         cgetent                                 \
166         getconfattr                             \
167         getprogname                             \
168         getrlimit                               \
169         getspnam                                \
170         initstate                               \
171         random                                  \
172         setprogname                             \
173         setstate                                \
174         strsvis                                 \
175         strunvis                                \
176         strvis                                  \
177         strvisx                                 \
178         svis                                    \
179         sysconf                                 \
180         sysctl                                  \
181         uname                                   \
182         unvis                                   \
183         vasnprintf                              \
184         vasprintf                               \
185         vis                                     \
188 if test "$ac_cv_func_cgetent" = no; then
189         LIBOBJS="$LIBOBJS getcap.o"
192 AC_REQUIRE([AC_FUNC_GETLOGIN])
194 AC_FIND_FUNC_NO_LIBS(getsockopt,,
195 [#ifdef HAVE_SYS_TYPES_H
196 #include <sys/types.h>
197 #endif
198 #ifdef HAVE_SYS_SOCKET_H
199 #include <sys/socket.h>
200 #endif],
201 [0,0,0,0,0])
202 AC_FIND_FUNC_NO_LIBS(setsockopt,,
203 [#ifdef HAVE_SYS_TYPES_H
204 #include <sys/types.h>
205 #endif
206 #ifdef HAVE_SYS_SOCKET_H
207 #include <sys/socket.h>
208 #endif],
209 [0,0,0,0,0])
211 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
212 [#ifdef HAVE_NETDB_H
213 #include <netdb.h>
214 #endif],
216 if test "$ac_cv_func_hstrerror" = yes; then
217 AC_NEED_PROTO([
218 #ifdef HAVE_NETDB_H
219 #include <netdb.h>
220 #endif],
221 hstrerror)
224 dnl sigh, wish this could be done in a loop
225 if test "$ac_cv_func_asprintf" = yes; then
226 AC_NEED_PROTO([
227 #include <stdio.h>
228 #include <string.h>],
229 asprintf)dnl
231 if test "$ac_cv_func_vasprintf" = yes; then
232 AC_NEED_PROTO([
233 #include <stdio.h>
234 #include <string.h>],
235 vasprintf)dnl
237 if test "$ac_cv_func_asnprintf" = yes; then
238 AC_NEED_PROTO([
239 #include <stdio.h>
240 #include <string.h>],
241 asnprintf)dnl
243 if test "$ac_cv_func_vasnprintf" = yes; then
244 AC_NEED_PROTO([
245 #include <stdio.h>
246 #include <string.h>],
247 vasnprintf)dnl
250 AC_FIND_FUNC_NO_LIBS(bswap16,,
251 [#ifdef HAVE_SYS_BSWAP_H
252 #include <sys/bswap.h>
253 #endif],0)
255 AC_FIND_FUNC_NO_LIBS(bswap32,,
256 [#ifdef HAVE_SYS_BSWAP_H
257 #include <sys/bswap.h>
258 #endif],0)
260 AC_FIND_FUNC_NO_LIBS(pidfile,util,
261 [#ifdef HAVE_UTIL_H
262 #include <util.h>
263 #endif],0)
265 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
266 [#ifdef HAVE_NETDB_H
267 #include <netdb.h>
268 #endif],[0,0,0,0])
270 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
271 [#ifdef HAVE_NETDB_H
272 #include <netdb.h>
273 #endif],[0,0,0,0,0,0,0])
275 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
276 [#ifdef HAVE_NETDB_H
277 #include <netdb.h>
278 #endif],[0])
280 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
281 [#ifdef HAVE_NETDB_H
282 #include <netdb.h>
283 #endif],[0])
285 AC_BROKEN([                                     \
286         chown                                   \
287         copyhostent                             \
288         daemon                                  \
289         ecalloc                                 \
290         emalloc                                 \
291         erealloc                                \
292         estrdup                                 \
293         err                                     \
294         errx                                    \
295         fchown                                  \
296         flock                                   \
297         fnmatch                                 \
298         freehostent                             \
299         getcwd                                  \
300         getdtablesize                           \
301         getegid                                 \
302         geteuid                                 \
303         getgid                                  \
304         gethostname                             \
305         getifaddrs                              \
306         getipnodebyaddr                         \
307         getipnodebyname                         \
308         getopt                                  \
309         gettimeofday                            \
310         getuid                                  \
311         getusershell                            \
312         initgroups                              \
313         innetgr                                 \
314         iruserok                                \
315         lstat                                   \
316         memmove                                 \
317         mkstemp                                 \
318         putenv                                  \
319         rcmd                                    \
320         readv                                   \
321         recvmsg                                 \
322         sendmsg                                 \
323         setegid                                 \
324         setenv                                  \
325         seteuid                                 \
326         strcasecmp                              \
327         strdup                                  \
328         strerror                                \
329         strftime                                \
330         strlcat                                 \
331         strlcpy                                 \
332         strlwr                                  \
333         strncasecmp                             \
334         strndup                                 \
335         strnlen                                 \
336         strptime                                \
337         strsep                                  \
338         strsep_copy                             \
339         strtok_r                                \
340         strupr                                  \
341         swab                                    \
342         unsetenv                                \
343         verr                                    \
344         verrx                                   \
345         vsyslog                                 \
346         vwarn                                   \
347         vwarnx                                  \
348         warn                                    \
349         warnx                                   \
350         writev                                  \
353 AC_BROKEN2(inet_aton,
354 [#ifdef HAVE_SYS_TYPES_H
355 #include <sys/types.h>
356 #endif
357 #ifdef HAVE_SYS_SOCKET_H
358 #include <sys/socket.h>
359 #endif
360 #ifdef HAVE_NETINET_IN_H
361 #include <netinet/in.h>
362 #endif
363 #ifdef HAVE_ARPA_INET_H
364 #include <arpa/inet.h>
365 #endif],
366 [0,0])
368 AC_BROKEN2(inet_ntop,
369 [#ifdef HAVE_SYS_TYPES_H
370 #include <sys/types.h>
371 #endif
372 #ifdef HAVE_SYS_SOCKET_H
373 #include <sys/socket.h>
374 #endif
375 #ifdef HAVE_NETINET_IN_H
376 #include <netinet/in.h>
377 #endif
378 #ifdef HAVE_ARPA_INET_H
379 #include <arpa/inet.h>
380 #endif],
381 [0, 0, 0, 0])
383 AC_BROKEN2(inet_pton,
384 [#ifdef HAVE_SYS_TYPES_H
385 #include <sys/types.h>
386 #endif
387 #ifdef HAVE_SYS_SOCKET_H
388 #include <sys/socket.h>
389 #endif
390 #ifdef HAVE_NETINET_IN_H
391 #include <netinet/in.h>
392 #endif
393 #ifdef HAVE_ARPA_INET_H
394 #include <arpa/inet.h>
395 #endif],
396 [0,0,0])
399 dnl Check for sa_len in struct sockaddr, 
400 dnl needs to come before the getnameinfo test
402 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
403 #include <sys/socket.h>])
405 if test "$ac_cv_func_getnameinfo" = "yes"; then
406   rk_BROKEN_GETNAMEINFO
407   if test "$ac_cv_func_getnameinfo_broken" = yes; then
408     LIBOBJS="$LIBOBJS getnameinfo.o"
409   fi
412 AC_NEED_PROTO([#include <stdlib.h>], setenv)
413 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
414 AC_NEED_PROTO([#include <unistd.h>], gethostname)
415 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
416 AC_NEED_PROTO([#include <unistd.h>], getusershell)
418 AC_NEED_PROTO([
419 #ifdef HAVE_SYS_TYPES_H
420 #include <sys/types.h>
421 #endif
422 #ifdef HAVE_SYS_SOCKET_H
423 #include <sys/socket.h>
424 #endif
425 #ifdef HAVE_NETINET_IN_H
426 #include <netinet/in.h>
427 #endif
428 #ifdef HAVE_ARPA_INET_H
429 #include <arpa/inet.h>
430 #endif],
431 inet_aton)
433 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
435 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
437 dnl AC_KRB_FUNC_GETCWD_BROKEN
440 dnl Checks for prototypes and declarations
443 AC_PROTO_COMPAT([
444 #ifdef HAVE_SYS_TYPES_H
445 #include <sys/types.h>
446 #endif
447 #ifdef HAVE_SYS_SOCKET_H
448 #include <sys/socket.h>
449 #endif
450 #ifdef HAVE_NETINET_IN_H
451 #include <netinet/in.h>
452 #endif
453 #ifdef HAVE_ARPA_INET_H
454 #include <arpa/inet.h>
455 #endif
456 #ifdef HAVE_NETDB_H
457 #include <netdb.h>
458 #endif
460 gethostbyname, struct hostent *gethostbyname(const char *))
462 AC_PROTO_COMPAT([
463 #ifdef HAVE_SYS_TYPES_H
464 #include <sys/types.h>
465 #endif
466 #ifdef HAVE_SYS_SOCKET_H
467 #include <sys/socket.h>
468 #endif
469 #ifdef HAVE_NETINET_IN_H
470 #include <netinet/in.h>
471 #endif
472 #ifdef HAVE_ARPA_INET_H
473 #include <arpa/inet.h>
474 #endif
475 #ifdef HAVE_NETDB_H
476 #include <netdb.h>
477 #endif
479 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
481 AC_PROTO_COMPAT([
482 #ifdef HAVE_SYS_TYPES_H
483 #include <sys/types.h>
484 #endif
485 #ifdef HAVE_SYS_SOCKET_H
486 #include <sys/socket.h>
487 #endif
488 #ifdef HAVE_NETINET_IN_H
489 #include <netinet/in.h>
490 #endif
491 #ifdef HAVE_ARPA_INET_H
492 #include <arpa/inet.h>
493 #endif
494 #ifdef HAVE_NETDB_H
495 #include <netdb.h>
496 #endif
498 getservbyname, struct servent *getservbyname(const char *, const char *))
500 AC_PROTO_COMPAT([
501 #ifdef HAVE_SYS_TYPES_H
502 #include <sys/types.h>
503 #endif
504 #ifdef HAVE_SYS_SOCKET_H
505 #include <sys/socket.h>
506 #endif
508 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
510 AC_PROTO_COMPAT([
511 #ifdef HAVE_SYSLOG_H
512 #include <syslog.h>
513 #endif
515 openlog, void openlog(const char *, int, int))
517 AC_NEED_PROTO([
518 #ifdef HAVE_CRYPT_H
519 #include <crypt.h>
520 #endif
521 #ifdef HAVE_UNISTD_H
522 #include <unistd.h>
523 #endif
525 crypt)
527 AC_NEED_PROTO([
528 #include <string.h>
530 strtok_r)
532 AC_NEED_PROTO([
533 #include <string.h>
535 strsep)
537 dnl variables
539 rk_CHECK_VAR(h_errno, 
540 [#ifdef HAVE_SYS_TYPES_H
541 #include <sys/types.h>
542 #endif
543 #ifdef HAVE_NETDB_H
544 #include <netdb.h>
545 #endif])
547 rk_CHECK_VAR(h_errlist, 
548 [#ifdef HAVE_NETDB_H
549 #include <netdb.h>
550 #endif])
552 rk_CHECK_VAR(h_nerr, 
553 [#ifdef HAVE_NETDB_H
554 #include <netdb.h>
555 #endif])
557 rk_CHECK_VAR([__progname], 
558 [#ifdef HAVE_ERR_H
559 #include <err.h>
560 #endif])
562 AC_CHECK_DECLARATION([#include <stdlib.h>
563 #ifdef HAVE_UNISTD_H
564 #include <unistd.h>
565 #endif], optarg)
566 AC_CHECK_DECLARATION([#include <stdlib.h>
567 #ifdef HAVE_UNISTD_H
568 #include <unistd.h>
569 #endif], optind)
570 AC_CHECK_DECLARATION([#include <stdlib.h>
571 #ifdef HAVE_UNISTD_H
572 #include <unistd.h>
573 #endif], opterr)
574 AC_CHECK_DECLARATION([#include <stdlib.h>
575 #ifdef HAVE_UNISTD_H
576 #include <unistd.h>
577 #endif], optopt)
579 AC_CHECK_DECLARATION([#include <stdlib.h>], environ)
582 dnl Check for fields in struct tm
585 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
586 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
589 dnl or do we have a variable `timezone' ?
592 rk_CHECK_VAR(timezone,[#include <time.h>])
594 AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
595 AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
596 AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
597 AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/socket.h>])
598 AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
599 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
602 dnl Check for struct winsize
605 AC_KRB_STRUCT_WINSIZE
608 dnl Check for struct spwd
611 AC_KRB_STRUCT_SPWD
613 dnl won't work with automake
614 dnl moved to AC_OUTPUT in configure.in
615 dnl AC_CONFIG_FILES($1/Makefile)
617 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
619 AC_SUBST(DIR_roken)dnl
620 AC_SUBST(LIB_roken)dnl
621 AC_SUBST(INCLUDES_roken)dnl