No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / dist / heimdal / cf / roken-frag.m4
blob064e37ec81365297c8e5bdc781a34dd3243b38b0
1 dnl $Heimdal: roken-frag.m4 20639 2007-05-10 17:22:58Z lha $
2 dnl $NetBSD$
3 dnl
4 dnl some code to get roken working
5 dnl
6 dnl rk_ROKEN(subdir)
7 dnl
8 AC_DEFUN([rk_ROKEN], [
10 AC_REQUIRE([rk_CONFIG_HEADER])
12 DIR_roken=roken
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])
25 dnl C characteristics
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)
32 AC_REQUIRE([rk_DB])
34 dnl C types
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])
48 AC_CHECK_HEADERS([\
49         arpa/inet.h                             \
50         config.h                                \
51         crypt.h                                 \
52         dirent.h                                \
53         errno.h                                 \
54         err.h                                   \
55         fcntl.h                                 \
56         fnmatch.h                               \
57         grp.h                                   \
58         ifaddrs.h                               \
59         netinet/in.h                            \
60         netinet/in6.h                           \
61         netinet/in_systm.h                      \
62         netinet6/in6.h                          \
63         paths.h                                 \
64         poll.h                                  \
65         pwd.h                                   \
66         rpcsvc/ypclnt.h                         \
67         shadow.h                                \
68         stdint.h                                \
69         sys/bswap.h                             \
70         sys/ioctl.h                             \
71         sys/mman.h                              \
72         sys/param.h                             \
73         sys/resource.h                          \
74         sys/sockio.h                            \
75         sys/stat.h                              \
76         sys/time.h                              \
77         sys/tty.h                               \
78         sys/types.h                             \
79         sys/uio.h                               \
80         sys/utsname.h                           \
81         sys/wait.h                              \
82         syslog.h                                \
83         termios.h                               \
84         unistd.h                                \
85         userconf.h                              \
86         usersec.h                               \
87         util.h                                  \
90 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
91 #include <stdint.h>
92 #endif])
94 dnl Sunpro 5.2 has a vis.h which is something different.
95 AC_CHECK_HEADERS(vis.h, , , [
96 #include <vis.h>
97 #ifndef VIS_SP
98 #error invis
99 #endif])
100         
101 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
102 #ifdef HAVE_SYS_TYPES_H
103 #include <sys/types.h>
104 #endif
107 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
108 #ifdef HAVE_SYS_TYPES_H
109 #include <sys/types.h>
110 #endif
113 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
114 #ifdef HAVE_SYS_TYPES_H
115 #include <sys/types.h>
116 #endif
117 #if HAVE_SYS_SOCKET_H
118 #include <sys/socket.h>
119 #endif])
121 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
122 #ifdef HAVE_SYS_TYPES_H
123 #include <sys/types.h>
124 #endif
125 #if HAVE_SYS_SOCKET_H
126 #include <sys/socket.h>
127 #endif
128 #ifdef HAVE_NETINET6_IN6_H
129 #include <netinet6/in6.h>
130 #endif
133 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
134 #ifdef HAVE_SYS_PARAM_H
135 #include <sys/param.h>
136 #endif
139 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
140 #ifdef HAVE_SYS_PARAM_H
141 #include <sys/param.h>
142 #endif
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)
157 AC_KRB_IPV6
159 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
161 rk_RESOLV
163 AC_BROKEN_SNPRINTF
164 AC_BROKEN_VSNPRINTF
166 AC_BROKEN_GLOB
167 if test "$ac_cv_func_glob_working" != yes; then
168         AC_LIBOBJ(glob)
170 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
173 AC_CHECK_FUNCS([                                \
174         asnprintf                               \
175         asprintf                                \
176         atexit                                  \
177         cgetent                                 \
178         getconfattr                             \
179         getprogname                             \
180         getrlimit                               \
181         getspnam                                \
182         initstate                               \
183         issetugid                               \
184         on_exit                                 \
185         poll                                    \
186         random                                  \
187         setprogname                             \
188         setstate                                \
189         strsvis                                 \
190         strunvis                                \
191         strvis                                  \
192         strvisx                                 \
193         svis                                    \
194         sysconf                                 \
195         sysctl                                  \
196         uname                                   \
197         unvis                                   \
198         vasnprintf                              \
199         vasprintf                               \
200         vis                                     \
203 if test "$ac_cv_func_cgetent" = no; then
204         AC_LIBOBJ(getcap)
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>
215 #endif
216 #ifdef HAVE_SYS_SOCKET_H
217 #include <sys/socket.h>
218 #endif],
219 [0,0,0,0,0])
220 AC_FIND_FUNC_NO_LIBS(setsockopt,,
221 [#ifdef HAVE_SYS_TYPES_H
222 #include <sys/types.h>
223 #endif
224 #ifdef HAVE_SYS_SOCKET_H
225 #include <sys/socket.h>
226 #endif],
227 [0,0,0,0,0])
229 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
230 [#ifdef HAVE_NETDB_H
231 #include <netdb.h>
232 #endif],
234 AC_NEED_PROTO([
235 #ifdef HAVE_NETDB_H
236 #include <netdb.h>
237 #endif],
238 hstrerror)
240 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
241         [AC_NEED_PROTO([
242         #include <stdio.h>
243         #include <string.h>],
244         rk_func)])
246 AC_FIND_FUNC_NO_LIBS(bswap16,,
247 [#ifdef HAVE_SYS_BSWAP_H
248 #include <sys/bswap.h>
249 #endif],0)
251 AC_FIND_FUNC_NO_LIBS(bswap32,,
252 [#ifdef HAVE_SYS_BSWAP_H
253 #include <sys/bswap.h>
254 #endif],0)
256 AC_FIND_FUNC_NO_LIBS(pidfile,util,
257 [#ifdef HAVE_UTIL_H
258 #include <util.h>
259 #endif],0)
261 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
262 [#ifdef HAVE_NETDB_H
263 #include <netdb.h>
264 #endif],[0,0,0,0])
266 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
267 [#ifdef HAVE_NETDB_H
268 #include <netdb.h>
269 #endif],[0,0,0,0,0,0,0])
271 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
272 [#ifdef HAVE_NETDB_H
273 #include <netdb.h>
274 #endif],[0])
276 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
277 [#ifdef HAVE_NETDB_H
278 #include <netdb.h>
279 #endif],[0])
281 AC_BROKEN([                                     \
282         chown                                   \
283         copyhostent                             \
284         closefrom                               \
285         daemon                                  \
286         ecalloc                                 \
287         emalloc                                 \
288         erealloc                                \
289         estrdup                                 \
290         err                                     \
291         errx                                    \
292         fchown                                  \
293         flock                                   \
294         fnmatch                                 \
295         freehostent                             \
296         getcwd                                  \
297         getdtablesize                           \
298         getegid                                 \
299         geteuid                                 \
300         getgid                                  \
301         gethostname                             \
302         getifaddrs                              \
303         getipnodebyaddr                         \
304         getipnodebyname                         \
305         getopt                                  \
306         gettimeofday                            \
307         getuid                                  \
308         getusershell                            \
309         initgroups                              \
310         innetgr                                 \
311         iruserok                                \
312         localtime_r                             \
313         lstat                                   \
314         memmove                                 \
315         mkstemp                                 \
316         putenv                                  \
317         rcmd                                    \
318         readv                                   \
319         recvmsg                                 \
320         sendmsg                                 \
321         setegid                                 \
322         setenv                                  \
323         seteuid                                 \
324         strcasecmp                              \
325         strdup                                  \
326         strerror                                \
327         strftime                                \
328         strlcat                                 \
329         strlcpy                                 \
330         strlwr                                  \
331         strncasecmp                             \
332         strndup                                 \
333         strnlen                                 \
334         strptime                                \
335         strsep                                  \
336         strsep_copy                             \
337         strtok_r                                \
338         strupr                                  \
339         swab                                    \
340         timegm                                  \
341         unsetenv                                \
342         verr                                    \
343         verrx                                   \
344         vsyslog                                 \
345         vwarn                                   \
346         vwarnx                                  \
347         warn                                    \
348         warnx                                   \
349         writev                                  \
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
360 #include <vis.h>
361 #endif], rk_func)])
363 AC_BROKEN2(inet_aton,
364 [#ifdef HAVE_SYS_TYPES_H
365 #include <sys/types.h>
366 #endif
367 #ifdef HAVE_SYS_SOCKET_H
368 #include <sys/socket.h>
369 #endif
370 #ifdef HAVE_NETINET_IN_H
371 #include <netinet/in.h>
372 #endif
373 #ifdef HAVE_ARPA_INET_H
374 #include <arpa/inet.h>
375 #endif],
376 [0,0])
378 AC_BROKEN2(inet_ntop,
379 [#ifdef HAVE_SYS_TYPES_H
380 #include <sys/types.h>
381 #endif
382 #ifdef HAVE_SYS_SOCKET_H
383 #include <sys/socket.h>
384 #endif
385 #ifdef HAVE_NETINET_IN_H
386 #include <netinet/in.h>
387 #endif
388 #ifdef HAVE_ARPA_INET_H
389 #include <arpa/inet.h>
390 #endif],
391 [0, 0, 0, 0])
393 AC_BROKEN2(inet_pton,
394 [#ifdef HAVE_SYS_TYPES_H
395 #include <sys/types.h>
396 #endif
397 #ifdef HAVE_SYS_SOCKET_H
398 #include <sys/socket.h>
399 #endif
400 #ifdef HAVE_NETINET_IN_H
401 #include <netinet/in.h>
402 #endif
403 #ifdef HAVE_ARPA_INET_H
404 #include <arpa/inet.h>
405 #endif],
406 [0,0,0])
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)
420   fi
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)
429 AC_NEED_PROTO([
430 #ifdef HAVE_SYS_TYPES_H
431 #include <sys/types.h>
432 #endif
433 #ifdef HAVE_SYS_SOCKET_H
434 #include <sys/socket.h>
435 #endif
436 #ifdef HAVE_NETINET_IN_H
437 #include <netinet/in.h>
438 #endif
439 #ifdef HAVE_ARPA_INET_H
440 #include <arpa/inet.h>
441 #endif
442 #ifdef HAVE_NETDB_H
443 #include <netdb.h>
444 #endif
445 #ifdef HAVE_UNISTD_H
446 #include <unistd.h>
447 #endif],
448 iruserok)
450 AC_NEED_PROTO([
451 #ifdef HAVE_SYS_TYPES_H
452 #include <sys/types.h>
453 #endif
454 #ifdef HAVE_SYS_SOCKET_H
455 #include <sys/socket.h>
456 #endif
457 #ifdef HAVE_NETINET_IN_H
458 #include <netinet/in.h>
459 #endif
460 #ifdef HAVE_ARPA_INET_H
461 #include <arpa/inet.h>
462 #endif],
463 inet_aton)
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
475 AC_PROTO_COMPAT([
476 #ifdef HAVE_SYS_TYPES_H
477 #include <sys/types.h>
478 #endif
479 #ifdef HAVE_SYS_SOCKET_H
480 #include <sys/socket.h>
481 #endif
482 #ifdef HAVE_NETINET_IN_H
483 #include <netinet/in.h>
484 #endif
485 #ifdef HAVE_ARPA_INET_H
486 #include <arpa/inet.h>
487 #endif
488 #ifdef HAVE_NETDB_H
489 #include <netdb.h>
490 #endif
492 gethostbyname, struct hostent *gethostbyname(const char *))
494 AC_PROTO_COMPAT([
495 #ifdef HAVE_SYS_TYPES_H
496 #include <sys/types.h>
497 #endif
498 #ifdef HAVE_SYS_SOCKET_H
499 #include <sys/socket.h>
500 #endif
501 #ifdef HAVE_NETINET_IN_H
502 #include <netinet/in.h>
503 #endif
504 #ifdef HAVE_ARPA_INET_H
505 #include <arpa/inet.h>
506 #endif
507 #ifdef HAVE_NETDB_H
508 #include <netdb.h>
509 #endif
511 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
513 AC_PROTO_COMPAT([
514 #ifdef HAVE_SYS_TYPES_H
515 #include <sys/types.h>
516 #endif
517 #ifdef HAVE_SYS_SOCKET_H
518 #include <sys/socket.h>
519 #endif
520 #ifdef HAVE_NETINET_IN_H
521 #include <netinet/in.h>
522 #endif
523 #ifdef HAVE_ARPA_INET_H
524 #include <arpa/inet.h>
525 #endif
526 #ifdef HAVE_NETDB_H
527 #include <netdb.h>
528 #endif
530 getservbyname, struct servent *getservbyname(const char *, const char *))
532 AC_PROTO_COMPAT([
533 #ifdef HAVE_SYS_TYPES_H
534 #include <sys/types.h>
535 #endif
536 #ifdef HAVE_SYS_SOCKET_H
537 #include <sys/socket.h>
538 #endif
540 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
542 AC_PROTO_COMPAT([
543 #ifdef HAVE_SYSLOG_H
544 #include <syslog.h>
545 #endif
547 openlog, void openlog(const char *, int, int))
549 AC_NEED_PROTO([
550 #ifdef HAVE_CRYPT_H
551 #include <crypt.h>
552 #endif
553 #ifdef HAVE_UNISTD_H
554 #include <unistd.h>
555 #endif
557 crypt)
559 dnl variables
561 rk_CHECK_VAR(h_errno, 
562 [#ifdef HAVE_SYS_TYPES_H
563 #include <sys/types.h>
564 #endif
565 #ifdef HAVE_NETDB_H
566 #include <netdb.h>
567 #endif])
569 rk_CHECK_VAR(h_errlist, 
570 [#ifdef HAVE_NETDB_H
571 #include <netdb.h>
572 #endif])
574 rk_CHECK_VAR(h_nerr, 
575 [#ifdef HAVE_NETDB_H
576 #include <netdb.h>
577 #endif])
579 rk_CHECK_VAR([__progname], 
580 [#ifdef HAVE_ERR_H
581 #include <err.h>
582 #endif])
584 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[][
585 #include <stdlib.h>
586 #ifdef HAVE_UNISTD_H
587 #include <unistd.h>
588 #endif])
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>
618 #include <netdb.h>])
619 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
620 AC_HAVE_TYPE([struct iovec],[
621 #include <sys/types.h>
622 #include <sys/uio.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
639 AC_KRB_STRUCT_SPWD
642 # Check if we want samba's socket wrapper
645 samba_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