]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - crypto/heimdal/cf/roken-frag.m4
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / crypto / heimdal / cf / roken-frag.m4
1 dnl $Id: roken-frag.m4 20639 2007-05-10 17:22:58Z lha $
2 dnl
3 dnl some code to get roken working
4 dnl
5 dnl rk_ROKEN(subdir)
6 dnl
7 AC_DEFUN([rk_ROKEN], [
8
9 AC_REQUIRE([rk_CONFIG_HEADER])
10
11 DIR_roken=roken
12 LIB_roken='$(top_builddir)/$1/libroken.la'
13 INCLUDES_roken='-I$(top_builddir)/$1 -I$(top_srcdir)/$1'
14
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])
21
22 AC_REQUIRE([AC_MIPS_ABI])
23
24 dnl C characteristics
25
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)
30
31 AC_REQUIRE([rk_DB])
32
33 dnl C types
34
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])
40
41 AC_REQUIRE([rk_RETSIGTYPE])
42
43 dnl Checks for header files.
44 AC_REQUIRE([AC_HEADER_STDC])
45 AC_REQUIRE([AC_HEADER_TIME])
46
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                                  \
87 ])
88
89 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
90 #include <stdint.h>
91 #endif])
92
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
104 ])
105
106 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
107 #ifdef HAVE_SYS_TYPES_H
108 #include <sys/types.h>
109 #endif
110 ])
111
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])
119
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
130 ])
131
132 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
133 #ifdef HAVE_SYS_PARAM_H
134 #include <sys/param.h>
135 #endif
136 ])
137
138 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
139 #ifdef HAVE_SYS_PARAM_H
140 #include <sys/param.h>
141 #endif
142 ])
143
144 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
145
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)
149
150 dnl Check for functions and libraries
151
152 AC_FIND_FUNC(socket, socket)
153 AC_FIND_FUNC(gethostbyname, nsl)
154 AC_FIND_FUNC(syslog, syslog)
155
156 AC_KRB_IPV6
157
158 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
159
160 rk_RESOLV
161
162 AC_BROKEN_SNPRINTF
163 AC_BROKEN_VSNPRINTF
164
165 AC_BROKEN_GLOB
166 if test "$ac_cv_func_glob_working" != yes; then
167         AC_LIBOBJ(glob)
168 fi
169 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
170
171
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                                     \
200 ])
201
202 if test "$ac_cv_func_cgetent" = no; then
203         AC_LIBOBJ(getcap)
204 fi
205 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
206
207 AC_REQUIRE([AC_FUNC_GETLOGIN])
208
209 AC_REQUIRE([AC_FUNC_MMAP])
210
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])
227
228 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
229 [#ifdef HAVE_NETDB_H
230 #include <netdb.h>
231 #endif],
232 17)
233 AC_NEED_PROTO([
234 #ifdef HAVE_NETDB_H
235 #include <netdb.h>
236 #endif],
237 hstrerror)
238
239 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
240         [AC_NEED_PROTO([
241         #include <stdio.h>
242         #include <string.h>],
243         rk_func)])
244
245 AC_FIND_FUNC_NO_LIBS(bswap16,,
246 [#ifdef HAVE_SYS_BSWAP_H
247 #include <sys/bswap.h>
248 #endif],0)
249
250 AC_FIND_FUNC_NO_LIBS(bswap32,,
251 [#ifdef HAVE_SYS_BSWAP_H
252 #include <sys/bswap.h>
253 #endif],0)
254
255 AC_FIND_FUNC_NO_LIBS(pidfile,util,
256 [#ifdef HAVE_UTIL_H
257 #include <util.h>
258 #endif],0)
259
260 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
261 [#ifdef HAVE_NETDB_H
262 #include <netdb.h>
263 #endif],[0,0,0,0])
264
265 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
266 [#ifdef HAVE_NETDB_H
267 #include <netdb.h>
268 #endif],[0,0,0,0,0,0,0])
269
270 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
271 [#ifdef HAVE_NETDB_H
272 #include <netdb.h>
273 #endif],[0])
274
275 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
276 [#ifdef HAVE_NETDB_H
277 #include <netdb.h>
278 #endif],[0])
279
280 AC_BROKEN([                                     \
281         chown                                   \
282         copyhostent                             \
283         closefrom                               \
284         daemon                                  \
285         ecalloc                                 \
286         emalloc                                 \
287         erealloc                                \
288         estrdup                                 \
289         err                                     \
290         errx                                    \
291         fchown                                  \
292         flock                                   \
293         fnmatch                                 \
294         freehostent                             \
295         getcwd                                  \
296         getdtablesize                           \
297         getegid                                 \
298         geteuid                                 \
299         getgid                                  \
300         gethostname                             \
301         getifaddrs                              \
302         getipnodebyaddr                         \
303         getipnodebyname                         \
304         getopt                                  \
305         gettimeofday                            \
306         getuid                                  \
307         getusershell                            \
308         initgroups                              \
309         innetgr                                 \
310         iruserok                                \
311         localtime_r                             \
312         lstat                                   \
313         memmove                                 \
314         mkstemp                                 \
315         putenv                                  \
316         rcmd                                    \
317         readv                                   \
318         recvmsg                                 \
319         sendmsg                                 \
320         setegid                                 \
321         setenv                                  \
322         seteuid                                 \
323         strcasecmp                              \
324         strdup                                  \
325         strerror                                \
326         strftime                                \
327         strlcat                                 \
328         strlcpy                                 \
329         strlwr                                  \
330         strncasecmp                             \
331         strndup                                 \
332         strnlen                                 \
333         strptime                                \
334         strsep                                  \
335         strsep_copy                             \
336         strtok_r                                \
337         strupr                                  \
338         swab                                    \
339         timegm                                  \
340         unsetenv                                \
341         verr                                    \
342         verrx                                   \
343         vsyslog                                 \
344         vwarn                                   \
345         vwarnx                                  \
346         warn                                    \
347         warnx                                   \
348         writev                                  \
349 ])
350
351 AM_CONDITIONAL(have_fnmatch_h,
352         test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
353
354 AC_FOREACH([rk_func], [strndup strsep strtok_r],
355         [AC_NEED_PROTO([#include <string.h>], rk_func)])
356
357 AC_FOREACH([rk_func], [strsvis strunvis strvis strvisx svis unvis vis],
358 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
359 #include <vis.h>
360 #endif], rk_func)])
361
362 AC_BROKEN2(inet_aton,
363 [#ifdef HAVE_SYS_TYPES_H
364 #include <sys/types.h>
365 #endif
366 #ifdef HAVE_SYS_SOCKET_H
367 #include <sys/socket.h>
368 #endif
369 #ifdef HAVE_NETINET_IN_H
370 #include <netinet/in.h>
371 #endif
372 #ifdef HAVE_ARPA_INET_H
373 #include <arpa/inet.h>
374 #endif],
375 [0,0])
376
377 AC_BROKEN2(inet_ntop,
378 [#ifdef HAVE_SYS_TYPES_H
379 #include <sys/types.h>
380 #endif
381 #ifdef HAVE_SYS_SOCKET_H
382 #include <sys/socket.h>
383 #endif
384 #ifdef HAVE_NETINET_IN_H
385 #include <netinet/in.h>
386 #endif
387 #ifdef HAVE_ARPA_INET_H
388 #include <arpa/inet.h>
389 #endif],
390 [0, 0, 0, 0])
391
392 AC_BROKEN2(inet_pton,
393 [#ifdef HAVE_SYS_TYPES_H
394 #include <sys/types.h>
395 #endif
396 #ifdef HAVE_SYS_SOCKET_H
397 #include <sys/socket.h>
398 #endif
399 #ifdef HAVE_NETINET_IN_H
400 #include <netinet/in.h>
401 #endif
402 #ifdef HAVE_ARPA_INET_H
403 #include <arpa/inet.h>
404 #endif],
405 [0,0,0])
406
407 dnl
408 dnl Check for sa_len in struct sockaddr, 
409 dnl needs to come before the getnameinfo test
410 dnl
411 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
412 #include <sys/socket.h>])
413
414 if test "$ac_cv_func_getaddrinfo" = "yes"; then
415   rk_BROKEN_GETADDRINFO
416   if test "$ac_cv_func_getaddrinfo_numserv" = no; then
417         AC_LIBOBJ(getaddrinfo)
418         AC_LIBOBJ(freeaddrinfo)
419   fi
420 fi
421
422 AC_NEED_PROTO([#include <stdlib.h>], setenv)
423 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
424 AC_NEED_PROTO([#include <unistd.h>], gethostname)
425 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
426 AC_NEED_PROTO([#include <unistd.h>], getusershell)
427 AC_NEED_PROTO([#include <unistd.h>], daemon)
428 AC_NEED_PROTO([
429 #ifdef HAVE_SYS_TYPES_H
430 #include <sys/types.h>
431 #endif
432 #ifdef HAVE_SYS_SOCKET_H
433 #include <sys/socket.h>
434 #endif
435 #ifdef HAVE_NETINET_IN_H
436 #include <netinet/in.h>
437 #endif
438 #ifdef HAVE_ARPA_INET_H
439 #include <arpa/inet.h>
440 #endif
441 #ifdef HAVE_NETDB_H
442 #include <netdb.h>
443 #endif
444 #ifdef HAVE_UNISTD_H
445 #include <unistd.h>
446 #endif],
447 iruserok)
448
449 AC_NEED_PROTO([
450 #ifdef HAVE_SYS_TYPES_H
451 #include <sys/types.h>
452 #endif
453 #ifdef HAVE_SYS_SOCKET_H
454 #include <sys/socket.h>
455 #endif
456 #ifdef HAVE_NETINET_IN_H
457 #include <netinet/in.h>
458 #endif
459 #ifdef HAVE_ARPA_INET_H
460 #include <arpa/inet.h>
461 #endif],
462 inet_aton)
463
464 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
465
466 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
467
468 dnl AC_KRB_FUNC_GETCWD_BROKEN
469
470 dnl
471 dnl Checks for prototypes and declarations
472 dnl
473
474 AC_PROTO_COMPAT([
475 #ifdef HAVE_SYS_TYPES_H
476 #include <sys/types.h>
477 #endif
478 #ifdef HAVE_SYS_SOCKET_H
479 #include <sys/socket.h>
480 #endif
481 #ifdef HAVE_NETINET_IN_H
482 #include <netinet/in.h>
483 #endif
484 #ifdef HAVE_ARPA_INET_H
485 #include <arpa/inet.h>
486 #endif
487 #ifdef HAVE_NETDB_H
488 #include <netdb.h>
489 #endif
490 ],
491 gethostbyname, struct hostent *gethostbyname(const char *))
492
493 AC_PROTO_COMPAT([
494 #ifdef HAVE_SYS_TYPES_H
495 #include <sys/types.h>
496 #endif
497 #ifdef HAVE_SYS_SOCKET_H
498 #include <sys/socket.h>
499 #endif
500 #ifdef HAVE_NETINET_IN_H
501 #include <netinet/in.h>
502 #endif
503 #ifdef HAVE_ARPA_INET_H
504 #include <arpa/inet.h>
505 #endif
506 #ifdef HAVE_NETDB_H
507 #include <netdb.h>
508 #endif
509 ],
510 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
511
512 AC_PROTO_COMPAT([
513 #ifdef HAVE_SYS_TYPES_H
514 #include <sys/types.h>
515 #endif
516 #ifdef HAVE_SYS_SOCKET_H
517 #include <sys/socket.h>
518 #endif
519 #ifdef HAVE_NETINET_IN_H
520 #include <netinet/in.h>
521 #endif
522 #ifdef HAVE_ARPA_INET_H
523 #include <arpa/inet.h>
524 #endif
525 #ifdef HAVE_NETDB_H
526 #include <netdb.h>
527 #endif
528 ],
529 getservbyname, struct servent *getservbyname(const char *, const char *))
530
531 AC_PROTO_COMPAT([
532 #ifdef HAVE_SYS_TYPES_H
533 #include <sys/types.h>
534 #endif
535 #ifdef HAVE_SYS_SOCKET_H
536 #include <sys/socket.h>
537 #endif
538 ],
539 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
540
541 AC_PROTO_COMPAT([
542 #ifdef HAVE_SYSLOG_H
543 #include <syslog.h>
544 #endif
545 ],
546 openlog, void openlog(const char *, int, int))
547
548 AC_NEED_PROTO([
549 #ifdef HAVE_CRYPT_H
550 #include <crypt.h>
551 #endif
552 #ifdef HAVE_UNISTD_H
553 #include <unistd.h>
554 #endif
555 ],
556 crypt)
557
558 dnl variables
559
560 rk_CHECK_VAR(h_errno, 
561 [#ifdef HAVE_SYS_TYPES_H
562 #include <sys/types.h>
563 #endif
564 #ifdef HAVE_NETDB_H
565 #include <netdb.h>
566 #endif])
567
568 rk_CHECK_VAR(h_errlist, 
569 [#ifdef HAVE_NETDB_H
570 #include <netdb.h>
571 #endif])
572
573 rk_CHECK_VAR(h_nerr, 
574 [#ifdef HAVE_NETDB_H
575 #include <netdb.h>
576 #endif])
577
578 rk_CHECK_VAR([__progname], 
579 [#ifdef HAVE_ERR_H
580 #include <err.h>
581 #endif])
582
583 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[][
584 #include <stdlib.h>
585 #ifdef HAVE_UNISTD_H
586 #include <unistd.h>
587 #endif])
588
589 dnl
590 dnl Check for fields in struct tm
591 dnl
592
593 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
594 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
595
596 dnl
597 dnl or do we have a variable `timezone' ?
598 dnl
599
600 rk_CHECK_VAR(timezone,[#include <time.h>])
601 rk_CHECK_VAR(altzone,[#include <time.h>])
602
603 AC_HAVE_TYPE([sa_family_t],[
604 #include <sys/types.h>
605 #include <sys/socket.h>])
606 AC_HAVE_TYPE([socklen_t],[
607 #include <sys/types.h>
608 #include <sys/socket.h>])
609 AC_HAVE_TYPE([struct sockaddr], [
610 #include <sys/types.h>
611 #include <sys/socket.h>])
612 AC_HAVE_TYPE([struct sockaddr_storage], [
613 #include <sys/types.h>
614 #include <sys/socket.h>])
615 AC_HAVE_TYPE([struct addrinfo], [
616 #include <sys/types.h>
617 #include <netdb.h>])
618 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
619 AC_HAVE_TYPE([struct iovec],[
620 #include <sys/types.h>
621 #include <sys/uio.h>
622 ])
623 AC_HAVE_TYPE([struct msghdr],[
624 #include <sys/types.h>
625 #include <sys/socket.h>
626 ])
627
628 dnl
629 dnl Check for struct winsize
630 dnl
631
632 AC_KRB_STRUCT_WINSIZE
633
634 dnl
635 dnl Check for struct spwd
636 dnl
637
638 AC_KRB_STRUCT_SPWD
639
640 #
641 # Check if we want samba's socket wrapper
642 #
643
644 samba_SOCKET_WRAPPER
645
646 dnl won't work with automake
647 dnl moved to AC_OUTPUT in configure.in
648 dnl AC_CONFIG_FILES($1/Makefile)
649
650 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
651
652 AC_SUBST(DIR_roken)dnl
653 AC_SUBST(LIB_roken)dnl
654 AC_SUBST(INCLUDES_roken)dnl
655 ])