1 m4_define([upcase],`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
3 m4_ifndef([AC_WARNING_ENABLE],[AC_DEFUN([AC_WARNING_ENABLE],[])])
5 dnl love_FIND_FUNC(func, includes, arguments)
6 dnl kind of like AC_CHECK_FUNC, but with headerfiles
7 AC_DEFUN([love_FIND_FUNC], [
9 AC_MSG_CHECKING([for $1])
10 AC_CACHE_VAL(ac_cv_love_func_$1,
12 AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]],[[$1($3)]])],
13 [eval "ac_cv_love_func_$1=yes"],[eval "ac_cv_love_func_$1=no"])])
15 eval "ac_res=\$ac_cv_love_func_$1"
21 eval "ac_tr_func=HAVE_[]upcase($1)"
25 AC_DEFINE_UNQUOTED($ac_tr_func)
36 AC_CHECK_TYPE(u_char, uint8_t)
37 AC_CHECK_TYPE(u_int32_t, uint32_t)
39 dnl Not all systems have err.h, so we provide a replacement. Heimdal
40 dnl unconditionally #includes <err.h>, so we need to create an err.h,
41 dnl but we can't just have a static one because we don't want to use
42 dnl it on systems that have a real err.h. If the system has a real
43 dnl err.h, we should use that (eg. on Darwin, the declarations get
44 dnl linker attributes added, so we can't guarantee that our local
45 dnl declarations will be correct). Phew!
46 AC_CHECK_HEADERS([err.h], [],
47 [ cp heimdal/lib/roken/err.hin heimdal_build/err.h ])
49 dnl Not all systems have ifaddrs.h, so we provide a replacement. Heimdal
50 dnl unconditionally #includes <ifaddrs.h>, so we need to create an ifaddrs.h,
51 dnl but we can't just have a static one because we don't want to use
52 dnl it on systems that have a real ifaddrs.h. If the system has a real
53 dnl ifaddrs.h. We don't use heimdal's lib/roken/ifaddrs.hin because
54 dnl our libreplace would conflict with it.
55 AC_CHECK_HEADERS([ifaddrs.h], [],
56 [ cp heimdal_build/ifaddrs.hin heimdal_build/ifaddrs.h ])
123 love_FIND_FUNC(bswap16, [#ifdef HAVE_SYS_BSWAP_H
124 #include <sys/bswap.h>
127 love_FIND_FUNC(bswap32, [#ifdef HAVE_SYS_BSWAP_H
128 #include <sys/bswap.h>
131 AC_DEFUN([AC_KRB_STRUCT_WINSIZE], [
132 AC_MSG_CHECKING(for struct winsize)
133 AC_CACHE_VAL(ac_cv_struct_winsize, [
134 ac_cv_struct_winsize=no
135 for i in sys/termios.h sys/ioctl.h; do
137 struct[[ ]]*winsize,dnl
138 $i, ac_cv_struct_winsize=yes; break)dnl
141 if test "$ac_cv_struct_winsize" = "yes"; then
142 AC_DEFINE(HAVE_STRUCT_WINSIZE, 1, [define if struct winsize is declared in sys/termios.h])
144 AC_MSG_RESULT($ac_cv_struct_winsize)
145 AC_EGREP_HEADER(ws_xpixel, termios.h,
146 AC_DEFINE(HAVE_WS_XPIXEL, 1, [define if struct winsize has ws_xpixel]))
147 AC_EGREP_HEADER(ws_ypixel, termios.h,
148 AC_DEFINE(HAVE_WS_YPIXEL, 1, [define if struct winsize has ws_ypixel]))
151 AC_KRB_STRUCT_WINSIZE
154 if test "$ac_cv_type_signal" = "void" ; then
155 AC_DEFINE(VOID_RETSIGTYPE, 1, [Define if signal handlers return void.])
157 AC_SUBST(VOID_RETSIGTYPE)
160 m4_include(heimdal/cf/check-var.m4)
162 rk_CHECK_VAR(h_errno,
163 [#ifdef HAVE_SYS_TYPES_H
164 #include <sys/types.h>
170 m4_include(heimdal/cf/find-func.m4)
171 m4_include(heimdal/cf/find-func-no-libs.m4)
172 m4_include(heimdal/cf/find-func-no-libs2.m4)
173 m4_include(heimdal/cf/resolv.m4)
175 AC_CHECK_HEADERS([pty.h util.h libutil.h])
177 AC_CHECK_LIB_EXT(util, OPENPTY_LIBS, openpty)
179 SMB_ENABLE(OPENPTY,YES)
181 SMB_EXT_LIB(OPENPTY,[${OPENPTY_LIBS}],[${OPENPTY_CFLAGS}],[${OPENPTY_CPPFLAGS}],[${OPENPTY_LDFLAGS}])
183 AC_CHECK_LIB_EXT(intl, INTL_LIBS, gettext)
187 SMB_EXT_LIB(INTL, $INTL_LIBS)
193 dnl This fills in the global LIBS...
196 dnl AC_CHECK_LIB_EXT(resolv, RESOLV_LIBS, res_search)
197 SMB_ENABLE(RESOLV,YES)
199 if test x"$LIBS" != "x"; then
205 SMB_EXT_LIB(RESOLV,[${RESOLV_LIBS}],[${RESOLV_CFLAGS}],[${RESOLV_CPPFLAGS}],[${RESOLV_LDFLAGS}])
208 # these are disabled unless heimdal is found below
209 SMB_ENABLE(KERBEROS_LIB, NO)
210 SMB_ENABLE(asn1_compile, NO)
211 SMB_ENABLE(compile_et, NO)
214 # We need bison -y and flex in new versions
215 # Otherwise we get random runtime failures
217 LEX_YACC_COMBINATIONS=""
218 LEX_YACC_COMBINATIONS="$LEX_YACC_COMBINATIONS flex-2.5.33:bison-2.3"
219 LEX_YACC_COMBINATIONS="$LEX_YACC_COMBINATIONS flex-2.5.34:bison-2.3"
220 LEX_YACC_COMBINATIONS="$LEX_YACC_COMBINATIONS flex-2.5.35:bison-2.3"
221 LEX_YACC_COMBINATIONS="$LEX_YACC_COMBINATIONS flex-2.5.35:bison-2.4.1"
224 LEX_BASENAME=`basename "$LEX"`
225 if test x"$LEX_BASENAME" = x"flex"; then
227 FLEX_VERSION=`$LEX --version | cut -d ' ' -f2`
228 AC_MSG_CHECKING(flex version)
229 AC_MSG_RESULT($FLEX_VERSION)
230 FLEX_MAJOR=`echo $FLEX_VERSION | cut -d '.' -f1`
231 FLEX_MINOR=`echo $FLEX_VERSION | cut -d '.' -f2`
232 FLEX_RELEASE=`echo $FLEX_VERSION | cut -d '.' -f3`
234 LEX_VERSION="flex-$FLEX_MAJOR.$FLEX_MINOR.$FLEX_RELEASE"
238 YACC_BASENAME=`basename "$YACC"`
239 if test x"$YACC_BASENAME" = x"bison -y"; then
240 # bison (GNU Bison) 2.3
242 # bison (GNU Bison) 2.4.1
243 BISON_VERSION=`$YACC --version | head -1 | cut -d ' ' -f4`
244 AC_MSG_CHECKING(bison version)
245 AC_MSG_RESULT($BISON_VERSION)
246 BISON_MAJOR=`echo $BISON_VERSION | cut -d '.' -f1`
247 BISON_MINOR=`echo $BISON_VERSION | cut -d '.' -f2`
248 BISON_RELEASE=`echo $BISON_VERSION | cut -d '.' -f3`
250 if test x"$BISON_RELEASE" != x""; then
251 YACC_VERSION="bison-$BISON_MAJOR.$BISON_MINOR.$BISON_RELEASE"
253 YACC_VERSION="bison-$BISON_MAJOR.$BISON_MINOR"
257 AC_MSG_CHECKING(working LEX YACC combination)
259 if test x"$LEX_VERSION" != x"" -a x"$YACC_VERSION" != x""; then
260 V="$LEX_VERSION:$YACC_VERSION"
261 for C in $LEX_YACC_COMBINATIONS; do
262 if test x"$V" = x"$C"; then
268 if test x"$LEX_YACC" = x"no"; then
272 AC_MSG_RESULT($LEX_YACC)
274 # Portions of heimdal kerberos are unpacked into source/heimdal
275 # of the samba source tree.
277 # if we ever get to using a host kerberos, we might add conditionals here
278 AC_DEFINE(HAVE_COM_ERR,1,[Whether com_err is available])
280 AC_DEFINE(HAVE_KRB5,1,[Whether kerberos is available])
282 AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available])
284 SMB_ENABLE(KERBEROS_LIB, YES)
285 SMB_ENABLE(asn1_compile, YES)
286 SMB_ENABLE(compile_et, YES)
288 # only add closefrom if needed
289 SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM, NO)
290 SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM_H, NO)
291 if test t$ac_cv_func_closefrom != tyes; then
292 SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM, YES)
293 SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM_H, YES)
296 # only add getprogname if needed
297 SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME, NO)
298 SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME_H, NO)
299 if test t$ac_cv_func_getprogname != tyes; then
300 SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME, YES)
301 SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME_H, YES)
304 VPATH="$VPATH:\$(HEIMDAL_VPATH)"
306 AC_DEFINE(SAMBA4_INTERNAL_HEIMDAL,1,[Whether we use in internal heimdal build])
308 SMB_INCLUDE_MK(heimdal_build/internal.mk)