libndr: EXT_NSL doesn't exist anymore, but it wasn't needed anyway
[jelmer/samba4-debian.git] / source / heimdal_build / config.m4
index 411c26a329d5dc6ab9ed02cd6fd6cd7af699e482..18ecbb75cdb56085d09eb5a5b61190887db90732 100644 (file)
@@ -31,7 +31,15 @@ esac
 
 ])
 
-
+dnl Not all systems have err.h, so we provide a replacement. Heimdal
+dnl unconditionally #includes <err.h>, so we need to create an err.h,
+dnl but we can't just have a static one because we don't want to use
+dnl it on systems that have a real err.h. If the system has a real
+dnl err.h, we should use that (eg. on Darwin, the declarations get
+dnl linker attributes added, so we can't guarantee that our local
+dnl declarations will be correct). Phew!
+AC_CHECK_HEADERS([err.h], [],
+       [ cp heimdal/lib/roken/err.hin heimdal_build/err.h ])
 
 AC_CHECK_HEADERS([                             \
        crypt.h                                 \
@@ -40,7 +48,6 @@ AC_CHECK_HEADERS([                            \
        inttypes.h                              \
        netdb.h                                 \
        signal.h                                \
-       sys/bitypes.h                           \
        sys/bswap.h                             \
        sys/file.h                              \
        sys/stropts.h                           \
@@ -53,13 +60,16 @@ AC_CHECK_HEADERS([                          \
        termcap.h                               \
        time.h                                  \
        timezone.h                              \
-       ttyname.h
+       ttyname.h                               \
+       netinet/in.h                            \
+       netinet/in6.h                           \
+       netinet6/in6.h
 ])
 
 AC_CHECK_FUNCS([                               \
        atexit                                  \
        cgetent                                 \
-       inet_ntop                               \
+       getprogname                             \
        inet_aton                               \
        gethostname                             \
        getnameinfo                             \
@@ -84,11 +94,10 @@ AC_CHECK_FUNCS([                            \
        closefrom                               \
        hstrerror                               \
        err                                     \
+       warn                                    \
        errx                                    \
        warnx                                   \
        flock                                   \
-       getaddrinfo                             \
-       freeaddrinfo                            \
        getipnodebyname                         \
        getipnodebyaddr                         \
        freehostent                             \
@@ -103,42 +112,6 @@ 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([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, [
@@ -168,7 +141,7 @@ fi
 AC_SUBST(VOID_RETSIGTYPE)
 
 
-sinclude(heimdal/cf/check-var.m4)
+m4_include(heimdal/cf/check-var.m4)
 
 rk_CHECK_VAR(h_errno, 
 [#ifdef HAVE_SYS_TYPES_H
@@ -178,10 +151,10 @@ rk_CHECK_VAR(h_errno,
 #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)
+m4_include(heimdal/cf/find-func.m4)
+m4_include(heimdal/cf/find-func-no-libs.m4)
+m4_include(heimdal/cf/find-func-no-libs2.m4)
+m4_include(heimdal/cf/resolv.m4)
 
 smb_save_LIBS=$LIBS
 RESOLV_LIBS=""
@@ -191,7 +164,7 @@ 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)
+       SMB_ENABLE(RESOLV,YES)
 
 if test x"$LIBS" != "x"; then
        RESOLV_LIBS=$LIBS
@@ -203,52 +176,81 @@ SMB_EXT_LIB(RESOLV,[${RESOLV_LIBS}],[${RESOLV_CFLAGS}],[${RESOLV_CPPFLAGS}],[${R
 
 
 # these are disabled unless heimdal is found below
-SMB_SUBSYSTEM_ENABLE(KERBEROS_LIB, NO)
-SMB_BINARY_ENABLE(asn1_compile, NO)
-SMB_BINARY_ENABLE(compile_et, NO)
+SMB_ENABLE(KERBEROS_LIB, NO)
+SMB_ENABLE(asn1_compile, NO)
+SMB_ENABLE(compile_et, NO)
 
-AC_PROG_LEX
-AC_PROG_YACC
+#
+# We need bison -y and flex in new versions
+# Otherwise we get random runtime failures
+#
+LEX_YACC_COMBINATIONS=""
+LEX_YACC_COMBINATIONS="$LEX_YACC_COMBINATIONS flex-2.5.33:bison-2.3"
 
-AC_CHECK_TYPES(u_int32_t)
-AC_CHECK_TYPES(u_int16_t)
-AC_CHECK_TYPES(u_int8_t)
-
-# 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 -Iheimdal/lib/roken -Iheimdal/lib/des"
-       HAVE_KRB5=YES
-       SMB_SUBSYSTEM_ENABLE(KERBEROS_LIB, YES)
-       SMB_BINARY_ENABLE(asn1_compile, YES)
-       SMB_BINARY_ENABLE(compile_et, YES)
+AC_PROG_LEX
+LEX_BASENAME=`basename "$LEX"`
+if test x"$LEX_BASENAME" = x"flex"; then
+       # "flex 2.5.33"
+       FLEX_VERSION=`$LEX --version | cut -d ' ' -f2`
+       AC_MSG_CHECKING(flex version)
+       AC_MSG_RESULT($FLEX_VERSION)
+       FLEX_MAJOR=`echo $FLEX_VERSION | cut -d '.' -f1`
+       FLEX_MINOR=`echo $FLEX_VERSION | cut -d '.' -f2`
+       FLEX_RELEASE=`echo $FLEX_VERSION | cut -d '.' -f3`
+
+       LEX_VERSION="flex-$FLEX_MAJOR.$FLEX_MINOR.$FLEX_RELEASE"
 fi
 
-# only add getaddrinfo and related functions if needed
-SMB_SUBSYSTEM_ENABLE(HEIMDAL_ROKEN_ADDRINFO, NO)
-if test t$ac_cv_func_getaddrinfo != tyes; then
-       SMB_SUBSYSTEM_ENABLE(HEIMDAL_ROKEN_ADDRINFO, YES)
+AC_PROG_YACC
+YACC_BASENAME=`basename "$YACC"`
+if test x"$YACC_BASENAME" = x"bison -y"; then
+       # bison (GNU Bison) 2.3
+       BISON_VERSION=`$YACC --version | head -1 | cut -d ' ' -f4`
+       AC_MSG_CHECKING(bison version)
+       AC_MSG_RESULT($BISON_VERSION)
+       BISON_MAJOR=`echo $BISON_VERSION | cut -d '.' -f1`
+       BISON_MINOR=`echo $BISON_VERSION | cut -d '.' -f2`
+
+       YACC_VERSION="bison-$BISON_MAJOR.$BISON_MINOR"
 fi
 
-# only add inet_aton if needed
-SMB_SUBSYSTEM_ENABLE(HEIMDAL_ROKEN_INET_ATON, NO)
-if test t$ac_cv_func_inet_aton != tyes; then
-       SMB_SUBSYSTEM_ENABLE(HEIMDAL_ROKEN_INET_ATON, YES)
+AC_MSG_CHECKING(working LEX YACC combination)
+LEX_YACC="no"
+if test x"$LEX_VERSION" != x"" -a x"$YACC_VERSION" != x""; then
+       V="$LEX_VERSION:$YACC_VERSION"
+       for C in $LEX_YACC_COMBINATIONS; do
+               if test x"$V" = x"$C"; then
+                       LEX_YACC=$V
+                       break;
+               fi
+       done
+fi
+if test x"$LEX_YACC" = x"no"; then
+       LEX=false
+       YACC=false
+fi
+AC_MSG_RESULT($LEX_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 closefrom if needed
+SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM, NO)
+if test t$ac_cv_func_closefrom != tyes; then
+       SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM, YES)
 fi
 
-# only add gai_strerror if needed
-SMB_SUBSYSTEM_ENABLE(HEIMDAL_ROKEN_GAI_STRERROR, NO)
-AC_CHECK_FUNC(gai_strerror)
-if test t$ac_cv_func_gai_strerror != tyes; then
-    AC_SEARCH_LIBS_EXT(gai_strerror, [xnet], XNET_LIBS)
-    AC_CHECK_FUNC_EXT(gai_strerror, $XNET_LIBS)
-    if test t$ac_cv_func_ext_gai_strerror != tyes; then
-       SMB_SUBSYSTEM_ENABLE(HEIMDAL_ROKEN_GAI_STRERROR, YES)
-    else
-       AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether gai_strerror() is available])
-    fi
-else
-    AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether gai_strerror() is available])
+# only add getprogname if needed
+SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME, NO)
+SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME_H, NO)
+if test t$ac_cv_func_getprogname != tyes; then
+       SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME, YES)
+       SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME_H, YES)
 fi
-SMB_EXT_LIB(XNET,[${XNET_LIBS}],[${XNET_CFLAGS}],[${XNET_CPPFLAGS}],[${XNET_LDFLAGS}])