r8450: more configure tests for solaris. It now builds some binaries, but
[bbaumbach/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         inet_aton                               \
65         gethostname                             \
66         getnameinfo                             \
67         gai_strerror                            \
68         iruserok                                \
69         putenv                                  \
70         rcmd                                    \
71         readv                                   \
72         sendmsg                                 \
73         setitimer                               \
74         socket                                  \
75         strlwr                                  \
76         strncasecmp                             \
77         strptime                                \
78         strsep                                  \
79         strsep_copy                             \
80         strtok_r                                \
81         strupr                                  \
82         swab                                    \
83         umask                                   \
84         uname                                   \
85         unsetenv                                \
86         closefrom                               \
87         hstrerror                               \
88         err                                     \
89         errx                                    \
90         warnx                                   \
91         flock                                   \
92         writev
93 ])
94
95 love_FIND_FUNC(bswap16, [#ifdef HAVE_SYS_BSWAP_H
96 #include <sys/bswap.h>
97 #endif], 0)
98
99 love_FIND_FUNC(bswap32, [#ifdef HAVE_SYS_BSWAP_H
100 #include <sys/bswap.h>
101 #endif], 0)
102
103
104 dnl AC_HAVE_TYPE(TYPE,INCLUDES)
105 AC_DEFUN([AC_HAVE_TYPE], [
106 AC_REQUIRE([AC_HEADER_STDC])
107 cv=`echo "$1" | sed 'y%./+- %__p__%'`
108 AC_MSG_CHECKING(for $1)
109 AC_CACHE_VAL([ac_cv_type_$cv],
110 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
111 #include <sys/types.h>
112 #if STDC_HEADERS
113 #include <stdlib.h>
114 #include <stddef.h>
115 #endif
116 $2]],
117 [[$1 foo;]])],
118 [eval "ac_cv_type_$cv=yes"],
119 [eval "ac_cv_type_$cv=no"]))dnl
120 ac_foo=`eval echo \\$ac_cv_type_$cv`
121 AC_MSG_RESULT($ac_foo)
122 if test "$ac_foo" = yes; then
123   ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
124 if false; then
125         AC_CHECK_TYPES($1)
126 fi
127   AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])
128 fi
129 ])
130
131 AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
132 AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
133 AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
134 AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/socket.h>])
135 AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
136 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
137
138
139 AC_DEFUN([AC_KRB_STRUCT_WINSIZE], [
140 AC_MSG_CHECKING(for struct winsize)
141 AC_CACHE_VAL(ac_cv_struct_winsize, [
142 ac_cv_struct_winsize=no
143 for i in sys/termios.h sys/ioctl.h; do
144 AC_EGREP_HEADER(
145 struct[[        ]]*winsize,dnl
146 $i, ac_cv_struct_winsize=yes; break)dnl
147 done
148 ])
149 if test "$ac_cv_struct_winsize" = "yes"; then
150   AC_DEFINE(HAVE_STRUCT_WINSIZE, 1, [define if struct winsize is declared in sys/termios.h])
151 fi
152 AC_MSG_RESULT($ac_cv_struct_winsize)
153 AC_EGREP_HEADER(ws_xpixel, termios.h, 
154         AC_DEFINE(HAVE_WS_XPIXEL, 1, [define if struct winsize has ws_xpixel]))
155 AC_EGREP_HEADER(ws_ypixel, termios.h, 
156         AC_DEFINE(HAVE_WS_YPIXEL, 1, [define if struct winsize has ws_ypixel]))
157 ])
158
159 AC_KRB_STRUCT_WINSIZE
160
161
162 AC_CHECK_DECL(h_errno, 
163               [AC_DEFINE(HAVE_DECL_H_ERRNO,1,whether h_errno is declared)], [], [
164 #ifdef HAVE_SYS_TYPES_H
165 #include <sys/types.h>
166 #endif
167 #ifdef HAVE_NETDB_H
168 #include <netdb.h>
169 #endif])
170
171 # these are disabled unless heimdal is found below
172 SMB_MODULE_DEFAULT(KERBEROS_LIB, NOT)
173 SMB_BINARY_ENABLE(asn1_compile, NO)
174 SMB_BINARY_ENABLE(compile_et, NO)
175
176 AC_PROG_LEX
177 AC_PROG_YACC
178
179 AC_CHECK_TYPES(u_int32_t)
180 AC_CHECK_TYPES(u_int16_t)
181 AC_CHECK_TYPES(u_int8_t)
182
183 # to enable kerberos, unpack a heimdal source tree in the heimdal directory
184 # of the samba source tree
185 if test -d heimdal; then
186         AC_DEFINE(HAVE_KRB5,1,[Whether kerberos is available])
187         CFLAGS="${CFLAGS} -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/lib/gssapi -Iheimdal/lib/asn1 -Iheimdal/lib/com_err -Iheimdal/lib/hdb -Iheimdal/kdc"
188         HAVE_KRB5=YES
189         SMB_MODULE_DEFAULT(KERBEROS_LIB, STATIC)
190         SMB_BINARY_ENABLE(asn1_compile, YES)
191         SMB_BINARY_ENABLE(compile_et, YES)
192 fi