-m4_define([upcase],`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
+external_heimdal=no
+AC_MSG_CHECKING([Whether to use external heimdal libraries])
+AC_ARG_ENABLE(external-heimdal,
+[ --enable-external-heimdal Enable external heimdal libraries (experimental,default=no)],
+[ external_heimdal=$enableval ],
+[ external_heimdal=no ])
+AC_MSG_RESULT($external_heimdal)
-dnl love_FIND_FUNC(func, includes, arguments)
-dnl kind of like AC_CHECK_FUNC, but with headerfiles
-AC_DEFUN([love_FIND_FUNC], [
+if test x"$external_heimdal" = x"yes"; then
-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"])])
+# external_heimdal_start
+m4_include(heimdal_build/external.m4)
+# external_heimdal_end
-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
-])
-
-AC_CHECK_FUNCS([ \
- atexit \
- cgetent \
- inet_ntop \
- inet_aton \
- gethostname \
- getnameinfo \
- gai_strerror \
- iruserok \
- putenv \
- rcmd \
- readv \
- sendmsg \
- setitimer \
- socket \
- strlwr \
- strncasecmp \
- strptime \
- strsep \
- strsep_copy \
- strtok_r \
- strupr \
- swab \
- umask \
- uname \
- unsetenv \
- closefrom \
- hstrerror \
- 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)
+else
+# internal_heimdal_start
+m4_include(heimdal_build/internal.m4)
+# internal_heimdal_end
-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([socklen_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_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_CHECK_DECL(h_errno,
- [AC_DEFINE(HAVE_DECL_H_ERRNO,1,whether h_errno is declared)], [], [
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif])
-
-# these are disabled unless heimdal is found below
-SMB_MODULE_DEFAULT(KERBEROS_LIB, NOT)
-SMB_BINARY_ENABLE(asn1_compile, NO)
-SMB_BINARY_ENABLE(compile_et, NO)
-
-# to enable kerberos, unpack a heimdal source tree in the heimdal directory
-# of the samba source tree
-if test -d heimdal; then
- AC_DEFINE(HAVE_KRB5,1,[Whether kerberos is available])
- CFLAGS="${CFLAGS} -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/lib/gssapi -Iheimdal/lib/asn1 -Iheimdal/lib/com_err -Iheimdal/lib/hdb -Iheimdal/kdc"
- HAVE_KRB5=YES
- SMB_MODULE_DEFAULT(KERBEROS_LIB, STATIC)
- SMB_BINARY_ENABLE(asn1_compile, YES)
- SMB_BINARY_ENABLE(compile_et, YES)
-fi