1 m4_define([upcase],`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
3 dnl love_FIND_FUNC(func, includes, arguments)
4 dnl kind of like AC_CHECK_FUNC, but with headerfiles
5 AC_DEFUN([love_FIND_FUNC], [
7 AC_MSG_CHECKING([for $1])
8 AC_CACHE_VAL(ac_cv_love_func_$1,
10 AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]],[[$1($3)]])],
11 [eval "ac_cv_love_func_$1=yes"],[eval "ac_cv_love_func_$1=no"])])
13 eval "ac_res=\$ac_cv_love_func_$1"
19 eval "ac_tr_func=HAVE_[]upcase($1)"
23 AC_DEFINE_UNQUOTED($ac_tr_func)
34 dnl Not all systems have err.h, so we provide a replacement. Heimdal
35 dnl unconditionally #includes <err.h>, so we need to create an err.h,
36 dnl but we can't just have a static one because we don't want to use
37 dnl it on systems that have a real err.h. If the system has a real
38 dnl err.h, we should use that (eg. on Darwin, the declarations get
39 dnl linker attributes added, so we can't guarantee that our local
40 dnl declarations will be correct). Phew!
41 AC_CHECK_HEADERS([err.h], [],
42 [ cp heimdal/lib/roken/err.hin heimdal_build/err.h ])
111 love_FIND_FUNC(bswap16, [#ifdef HAVE_SYS_BSWAP_H
112 #include <sys/bswap.h>
115 love_FIND_FUNC(bswap32, [#ifdef HAVE_SYS_BSWAP_H
116 #include <sys/bswap.h>
120 dnl AC_HAVE_TYPE(TYPE,INCLUDES)
121 AC_DEFUN([AC_HAVE_TYPE], [
122 AC_REQUIRE([AC_HEADER_STDC])
123 cv=`echo "$1" | sed 'y%./+- %__p__%'`
124 AC_MSG_CHECKING(for $1)
125 AC_CACHE_VAL([ac_cv_type_$cv],
126 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
130 [eval "ac_cv_type_$cv=yes"],
131 [eval "ac_cv_type_$cv=no"]))dnl
132 ac_foo=`eval echo \\$ac_cv_type_$cv`
133 AC_MSG_RESULT($ac_foo)
134 if test "$ac_foo" = yes; then
135 ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
139 AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])
143 AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
144 AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
145 AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/socket.h>])
146 AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
147 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
148 AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
151 AC_DEFUN([AC_KRB_STRUCT_WINSIZE], [
152 AC_MSG_CHECKING(for struct winsize)
153 AC_CACHE_VAL(ac_cv_struct_winsize, [
154 ac_cv_struct_winsize=no
155 for i in sys/termios.h sys/ioctl.h; do
157 struct[[ ]]*winsize,dnl
158 $i, ac_cv_struct_winsize=yes; break)dnl
161 if test "$ac_cv_struct_winsize" = "yes"; then
162 AC_DEFINE(HAVE_STRUCT_WINSIZE, 1, [define if struct winsize is declared in sys/termios.h])
164 AC_MSG_RESULT($ac_cv_struct_winsize)
165 AC_EGREP_HEADER(ws_xpixel, termios.h,
166 AC_DEFINE(HAVE_WS_XPIXEL, 1, [define if struct winsize has ws_xpixel]))
167 AC_EGREP_HEADER(ws_ypixel, termios.h,
168 AC_DEFINE(HAVE_WS_YPIXEL, 1, [define if struct winsize has ws_ypixel]))
171 AC_KRB_STRUCT_WINSIZE
174 if test "$ac_cv_type_signal" = "void" ; then
175 AC_DEFINE(VOID_RETSIGTYPE, 1, [Define if signal handlers return void.])
177 AC_SUBST(VOID_RETSIGTYPE)
180 m4_include(heimdal/cf/check-var.m4)
182 rk_CHECK_VAR(h_errno,
183 [#ifdef HAVE_SYS_TYPES_H
184 #include <sys/types.h>
190 m4_include(heimdal/cf/find-func.m4)
191 m4_include(heimdal/cf/find-func-no-libs.m4)
192 m4_include(heimdal/cf/find-func-no-libs2.m4)
193 m4_include(heimdal/cf/resolv.m4)
199 dnl This fills in the global LIBS...
202 dnl AC_CHECK_LIB_EXT(resolv, RESOLV_LIBS, res_search)
203 SMB_ENABLE(RESOLV,YES)
205 if test x"$LIBS" != "x"; then
211 SMB_EXT_LIB(RESOLV,[${RESOLV_LIBS}],[${RESOLV_CFLAGS}],[${RESOLV_CPPFLAGS}],[${RESOLV_LDFLAGS}])
214 # these are disabled unless heimdal is found below
215 SMB_ENABLE(KERBEROS_LIB, NO)
216 SMB_ENABLE(asn1_compile, NO)
217 SMB_ENABLE(compile_et, NO)
222 # Portions of heimdal kerberos are unpacked into source/heimdal
223 # of the samba source tree.
225 # if we ever get to using a host kerberos, we might add conditionals here
226 AC_DEFINE(HAVE_KRB5,1,[Whether kerberos is available])
228 SMB_ENABLE(KERBEROS_LIB, YES)
229 SMB_ENABLE(asn1_compile, YES)
230 SMB_ENABLE(compile_et, YES)
232 # only add getaddrinfo and related functions if needed
233 SMB_ENABLE(HEIMDAL_ROKEN_ADDRINFO, NO)
234 if test t$ac_cv_func_getaddrinfo != tyes; then
235 SMB_ENABLE(HEIMDAL_ROKEN_ADDRINFO, YES)
238 # only add inet_aton if needed
239 SMB_ENABLE(HEIMDAL_ROKEN_INET_ATON, NO)
240 if test t$ac_cv_func_inet_aton != tyes; then
241 SMB_ENABLE(HEIMDAL_ROKEN_INET_ATON, YES)
244 if test x"$ac_cv_func_inet_pton" = x"no"; then
245 AC_CHECK_LIB_EXT(nsl_s, NSL_LIBS, inet_pton)
246 AC_CHECK_LIB_EXT(nsl, NSL_LIBS, inet_pton)
248 if test x"$ac_cv_lib_ext_nsl_s_inet_pton" != x"yes" &&
249 test x"$ac_cv_lib_ext_nsl_inet_pton" != x"yes"; then
250 AC_MSG_ERROR([no inet_pton() function available!])
254 SMB_EXT_LIB(NSL,[${NSL_LIBS}],[],[],[])
256 # only add closefrom if needed
257 SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM, NO)
258 if test t$ac_cv_func_closefrom != tyes; then
259 SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM, YES)
262 # only add getprogname if needed
263 SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME, NO)
264 SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME_H, NO)
265 if test t$ac_cv_func_getprogname != tyes; then
266 SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME, YES)
267 SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME_H, YES)
270 # only add gai_strerror if needed
271 SMB_ENABLE(HEIMDAL_ROKEN_GAI_STRERROR, NO)
272 AC_CHECK_FUNC(gai_strerror)
274 if test t$ac_cv_func_gai_strerror != tyes; then
275 AC_CHECK_LIB_EXT(nsl, GAI_LIBS, gai_strerror)
276 AC_CHECK_LIB_EXT(socket, GAI_LIBS, gai_strerror)
277 AC_CHECK_LIB_EXT(xnet, GAI_LIBS, gai_strerror)
279 dnl We can't just call AC_CHECK_FUNCS(gai_strerror) here, because the value
281 if test x"$ac_cv_lib_ext_nsl_gai_strerror" = x"yes" ||
282 test x"$ac_cv_lib_ext_socket_gai_strerror" = x"yes" ||
283 test x"$ac_cv_lib_ext_xnet_gai_strerror" = x"yes"; then
284 AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror()])
287 SMB_ENABLE(HEIMDAL_ROKEN_GAI_STRERROR, YES)
291 AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether gai_strerror() is available])
294 SMB_EXT_LIB(GAI,[${GAI_LIBS}],[${GAI_CFLAGS}],[${GAI_CPPFLAGS}],[${GAI_LDFLAGS}])