r8393: check for bswap16 and bswap32
[sfrench/samba-autobuild/.git] / source4 / heimdal_build / config.m4
1
2 m4_define([upcase],`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
3
4 dnl love_FIND_FUNC(func, includes, arguments)
5 dnl kind of like AC_CHECK_FUNC, but with headerfiles
6 AC_DEFUN([love_FIND_FUNC], [
7
8 AC_MSG_CHECKING([for $1])
9 AC_CACHE_VAL(ac_cv_love_func_$1,
10 [
11 AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]],[[$1($3)]])],
12 [eval "ac_cv_love_func_$1=yes"],[eval "ac_cv_love_func_$1=no"])])
13
14 eval "ac_res=\$ac_cv_love_func_$1"
15
16 if false; then
17         AC_CHECK_FUNCS($1)
18 fi
19 # $1
20 eval "ac_tr_func=HAVE_[]upcase($1)"
21
22 case "$ac_res" in
23         yes)
24         AC_DEFINE_UNQUOTED($ac_tr_func)
25         AC_MSG_RESULT([yes])
26         ;;
27         no)
28         AC_MSG_RESULT([no])
29         ;;
30 esac
31
32
33 ])
34
35
36
37 AC_CHECK_HEADERS([                              \
38         crypt.h                                 \
39         curses.h                                \
40         errno.h                                 \
41         inttypes.h                              \
42         netdb.h                                 \
43         signal.h                                \
44         sys/bitypes.h                           \
45         sys/bswap.h                             \
46         sys/file.h                              \
47         sys/stropts.h                           \
48         sys/timeb.h                             \
49         sys/times.h                             \
50         sys/uio.h                               \
51         sys/un.h                                \
52         sys/utsname.h                           \
53         term.h                                  \
54         termcap.h                               \
55         time.h                                  \
56         timezone.h                              \
57         ttyname.h
58 ])
59
60 AC_CHECK_FUNCS([                                \
61         atexit                                  \
62         cgetent                                 \
63         inet_ntop                               \
64         iruserok                                \
65         putenv                                  \
66         rcmd                                    \
67         readv                                   \
68         sendmsg                                 \
69         setitimer                               \
70         socket                                  \
71         strlwr                                  \
72         strncasecmp                             \
73         strptime                                \
74         strsep                                  \
75         strsep_copy                             \
76         strtok_r                                \
77         strupr                                  \
78         swab                                    \
79         umask                                   \
80         uname                                   \
81         unsetenv                                \
82         writev
83 ])
84
85 love_FIND_FUNC(bswap16, [#ifdef HAVE_SYS_BSWAP_H
86 #include <sys/bswap.h>
87 #endif], 0)
88
89 love_FIND_FUNC(bswap32, [#ifdef HAVE_SYS_BSWAP_H
90 #include <sys/bswap.h>
91 #endif], 0)
92
93
94 AC_CHECK_DECL(h_errno, 
95               [AC_DEFINE(HAVE_DECL_H_ERRNO,1,whether h_errno is declared)], [], [
96 #ifdef HAVE_SYS_TYPES_H
97 #include <sys/types.h>
98 #endif
99 #ifdef HAVE_NETDB_H
100 #include <netdb.h>
101 #endif])
102
103 # these are disabled unless heimdal is found below
104 SMB_MODULE_DEFAULT(KERBEROS_LIB, NOT)
105 SMB_BINARY_ENABLE(asn1_compile, NO)
106 SMB_BINARY_ENABLE(compile_et, NO)
107
108 # to enable kerberos, unpack a heimdal source tree in the heimdal directory
109 # of the samba source tree
110 if test -d heimdal; then
111         AC_DEFINE(HAVE_KRB5,1,[Whether kerberos is available])
112         CFLAGS="${CFLAGS} -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/lib/gssapi -Iheimdal/lib/asn1 -Iheimdal/lib/com_err -Iheimdal/lib/hdb -Iheimdal/kdc"
113         HAVE_KRB5=YES
114         SMB_MODULE_DEFAULT(KERBEROS_LIB, STATIC)
115         SMB_BINARY_ENABLE(asn1_compile, YES)
116         SMB_BINARY_ENABLE(compile_et, YES)
117 fi