summaryrefslogtreecommitdiff
path: root/source4/heimdal_build/config.m4
blob: 75667ab7723fc3a0d46cdf290c764dda4c90ba9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
m4_define([upcase],`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl

dnl love_FIND_FUNC(func, includes, arguments)
dnl kind of like AC_CHECK_FUNC, but with headerfiles
AC_DEFUN([love_FIND_FUNC], [

AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(ac_cv_love_func_$1,
[
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]],[[$1($3)]])],
[eval "ac_cv_love_func_$1=yes"],[eval "ac_cv_love_func_$1=no"])])

eval "ac_res=\$ac_cv_love_func_$1"

if false; then
	AC_CHECK_FUNCS($1)
fi
# $1
eval "ac_tr_func=HAVE_[]upcase($1)"

case "$ac_res" in
	yes)
	AC_DEFINE_UNQUOTED($ac_tr_func)
	AC_MSG_RESULT([yes])
	;;
	no)
	AC_MSG_RESULT([no])
	;;
esac


])



AC_CHECK_HEADERS([				\
	crypt.h					\
	curses.h				\
	errno.h					\
	inttypes.h				\
	netdb.h					\
	signal.h				\
	sys/bitypes.h				\
	sys/bswap.h				\
	sys/file.h				\
	sys/stropts.h				\
	sys/timeb.h				\
	sys/times.h				\
	sys/uio.h				\
	sys/un.h				\
	sys/utsname.h				\
	term.h					\
	termcap.h				\
	time.h					\
	timezone.h				\
	ttyname.h				\
	netinet/in.h				\
	netinet/in6.h				\
	netinet6/in6.h
])

AC_CHECK_FUNCS([				\
	atexit					\
	cgetent					\
	inet_ntop				\
	inet_aton				\
	gethostname				\
	getnameinfo				\
	iruserok				\
	putenv					\
	rcmd					\
	readv					\
	sendmsg					\
	setitimer				\
	socket					\
	strlwr					\
	strncasecmp				\
	strptime				\
	strsep					\
	strsep_copy				\
	strtok_r				\
	strupr					\
	swab					\
	umask					\
	uname					\
	unsetenv				\
	closefrom				\
	hstrerror				\
	err					\
	errx					\
	warnx					\
	flock					\
	getaddrinfo				\
	freeaddrinfo				\
	getipnodebyname				\
	getipnodebyaddr				\
	freehostent				\
	writev
])

love_FIND_FUNC(bswap16, [#ifdef HAVE_SYS_BSWAP_H
#include <sys/bswap.h>
#endif], 0)

love_FIND_FUNC(bswap32, [#ifdef HAVE_SYS_BSWAP_H
#include <sys/bswap.h>
#endif], 0)


dnl AC_HAVE_TYPE(TYPE,INCLUDES)
AC_DEFUN([AC_HAVE_TYPE], [
AC_REQUIRE([AC_HEADER_STDC])
cv=`echo "$1" | sed 'y%./+- %__p__%'`
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL([ac_cv_type_$cv],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
$2]],
[[$1 foo;]])],
[eval "ac_cv_type_$cv=yes"],
[eval "ac_cv_type_$cv=no"]))dnl
ac_foo=`eval echo \\$ac_cv_type_$cv`
AC_MSG_RESULT($ac_foo)
if test "$ac_foo" = yes; then
  ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
if false; then
	AC_CHECK_TYPES($1)
fi
  AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])
fi
])

AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/socket.h>])
AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])


AC_DEFUN([AC_KRB_STRUCT_WINSIZE], [
AC_MSG_CHECKING(for struct winsize)
AC_CACHE_VAL(ac_cv_struct_winsize, [
ac_cv_struct_winsize=no
for i in sys/termios.h sys/ioctl.h; do
AC_EGREP_HEADER(
struct[[ 	]]*winsize,dnl
$i, ac_cv_struct_winsize=yes; break)dnl
done
])
if test "$ac_cv_struct_winsize" = "yes"; then
  AC_DEFINE(HAVE_STRUCT_WINSIZE, 1, [define if struct winsize is declared in sys/termios.h])
fi
AC_MSG_RESULT($ac_cv_struct_winsize)
AC_EGREP_HEADER(ws_xpixel, termios.h, 
	AC_DEFINE(HAVE_WS_XPIXEL, 1, [define if struct winsize has ws_xpixel]))
AC_EGREP_HEADER(ws_ypixel, termios.h, 
	AC_DEFINE(HAVE_WS_YPIXEL, 1, [define if struct winsize has ws_ypixel]))
])

AC_KRB_STRUCT_WINSIZE

AC_TYPE_SIGNAL
if test "$ac_cv_type_signal" = "void" ; then
	AC_DEFINE(VOID_RETSIGTYPE, 1, [Define if signal handlers return void.])
fi
AC_SUBST(VOID_RETSIGTYPE)


sinclude(heimdal/cf/check-var.m4)

rk_CHECK_VAR(h_errno, 
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif])

sinclude(heimdal/cf/find-func.m4)
sinclude(heimdal/cf/find-func-no-libs.m4)
sinclude(heimdal/cf/find-func-no-libs2.m4)
sinclude(heimdal/cf/resolv.m4)

smb_save_LIBS=$LIBS
RESOLV_LIBS=""
LIBS=""

dnl  This fills in the global LIBS...
rk_RESOLV

dnl AC_CHECK_LIB_EXT(resolv, RESOLV_LIBS, res_search)
	SMB_EXT_LIB_ENABLE(RESOLV,YES)

if test x"$LIBS" != "x"; then
	RESOLV_LIBS=$LIBS
fi

LIBS=$smb_save_LIBS

SMB_EXT_LIB(RESOLV,[${RESOLV_LIBS}],[${RESOLV_CFLAGS}],[${RESOLV_CPPFLAGS}],[${RESOLV_LDFLAGS}])


# these are disabled unless heimdal is found below
SMB_ENABLE(KERBEROS_LIB, NO)
SMB_ENABLE(asn1_compile, NO)
SMB_ENABLE(compile_et, NO)

AC_PROG_LEX
AC_PROG_YACC

# Portions of heimdal kerberos are unpacked into source/heimdal
# of the samba source tree.  

# if we ever get to using a host kerberos, we might add conditionals here
AC_DEFINE(HAVE_KRB5,1,[Whether kerberos is available])
HAVE_KRB5=YES
SMB_ENABLE(KERBEROS_LIB, YES)
SMB_ENABLE(asn1_compile, YES)
SMB_ENABLE(compile_et, YES)

# only add getaddrinfo and related functions if needed
SMB_ENABLE(HEIMDAL_ROKEN_ADDRINFO, NO)
if test t$ac_cv_func_getaddrinfo != tyes; then
	SMB_ENABLE(HEIMDAL_ROKEN_ADDRINFO, YES)
fi

# only add inet_aton if needed
SMB_ENABLE(HEIMDAL_ROKEN_INET_ATON, NO)
if test t$ac_cv_func_inet_aton != tyes; then
	SMB_ENABLE(HEIMDAL_ROKEN_INET_ATON, YES)
fi

# only add gai_strerror if needed
SMB_ENABLE(HEIMDAL_ROKEN_GAI_STRERROR, NO)
AC_CHECK_FUNC(gai_strerror)

if test t$ac_cv_func_gai_strerror != tyes; then
    AC_CHECK_LIB_EXT(nsl, GAI_LIBS, gai_strerror)
    AC_CHECK_LIB_EXT(socket, GAI_LIBS, gai_strerror)
    AC_CHECK_LIB_EXT(xnet, GAI_LIBS, gai_strerror)

    dnl We can't just call AC_CHECK_FUNCS(gai_strerror) here, because the value
    dnl has been cached.
    if test x"$ac_cv_lib_ext_nsl_gai_strerror" = x"yes" ||
       test x"$ac_cv_lib_ext_socket_gai_strerror" = x"yes" ||
       test x"$ac_cv_lib_ext_xnet_gai_strerror" = x"yes"; then
        AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror()])
	SMB_EXT_LIB_ENABLE(GAI, YES)
    else
	SMB_ENABLE(HEIMDAL_ROKEN_GAI_STRERROR, YES)
    fi

else
    AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether gai_strerror() is available])
fi

SMB_EXT_LIB(GAI,[${GAI_LIBS}],[${GAI_CFLAGS}],[${GAI_CPPFLAGS}],[${GAI_LDFLAGS}])