gss: make gss_compare_name comply with RFC2743
[metze/heimdal/wip.git] / configure.ac
index 9637c129438410a5bd355110fad52f9e765dcad8..29709561b65626cc865a583f77c17e38a93e90b3 100644 (file)
@@ -2,19 +2,24 @@ dnl Process this file with autoconf to produce a configure script.
 AC_REVISION($Revision$)
 AC_PREREQ(2.62)
 test -z "$CFLAGS" && CFLAGS="-g"
-AC_INIT([Heimdal],[1.4.99],[heimdal-bugs@h5l.org])
+AC_INIT([Heimdal],[7.99.1],[https://github.com/heimdal/heimdal/issues])
 AC_CONFIG_SRCDIR([kuser/kinit.c])
 AC_CONFIG_HEADERS(include/config.h)
 AC_CONFIG_MACRO_DIR([cf])
 
-AM_INIT_AUTOMAKE([foreign 1.10.3])
+AM_INIT_AUTOMAKE([foreign 1.11])
 AM_MAINTAINER_MODE
 
+LT_PREREQ([2.2])
+LT_INIT([shared static win32-dll])
+
+
 dnl Checks for programs.
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CPP
-AC_PROG_LIBTOOL
+
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 AC_PREFIX_DEFAULT(/usr/heimdal)
 
@@ -40,9 +45,23 @@ AC_DEFINE([_GNU_SOURCE], 1,
 AC_OBJEXT
 AC_EXEEXT
 
+dnl
+dnl this is needed when der-protos.h or der-private.h has to be generated
+dnl
+if ! test -f "$srcdir/lib/asn1/der-protos.h" ||
+   ! test -f "$srcdir/lib/asn1/der-private.h"; then
+    AC_KRB_PROG_PERL
+    AC_KRB_PERL_MOD(Getopt::Std)
+    AC_KRB_PERL_MOD(File::Compare)
+    AC_KRB_PERL_MOD(JSON)
+fi
+
 dnl AC_KRB_PROG_YACC
 AC_PROG_YACC
 AM_PROG_LEX
+AS_IF([$LEX --nounput -V > /dev/null 2>&1 && test $? -eq 0],
+      [AC_SUBST([FLEXNOUNPUTARGS], ["--nounput"])],
+      [AC_SUBST([FLEXNOUNPUTARGS], [""])])
 dnl AC_PROG_RANLIB
 AC_PROG_AWK
 AC_KRB_PROG_LN_S
@@ -53,12 +72,15 @@ libdir="$libdir$abilibdirext"
 
 AC_C___ATTRIBUTE__
 
-LT_PREREQ([2.2])
-LT_INIT([shared static win32-dll])
-
 AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = "yes")
 rk_VERSIONSCRIPT
 
+dnl Code coverage
+AC_ARG_ENABLE([gcov],
+        AC_HELP_STRING([--enable-gcov], [enable gcov code coverage tool]))
+AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" = xyes])
+
+
 dnl
 dnl Helper bits for cross compiling
 dnl
@@ -88,6 +110,9 @@ else
 
    ASN1_COMPILE_DEP=
    SLC_DEP=
+
+   ac_cv_prog_COMPILE_ET=${with_cross_tools}compile_et
+
 fi
 
 AC_SUBST([ASN1_COMPILE])
@@ -95,7 +120,6 @@ AC_SUBST([ASN1_COMPILE_DEP])
 AC_SUBST([SLC])
 AC_SUBST([SLC_DEP])
 
-
 dnl ---
 
 AC_DEFINE(HEIM_WEAK_CRYPTO, 1, [Define if you want support for weak crypto])
@@ -139,13 +163,6 @@ if test "$enable_kx509" != no ;then
        AC_DEFINE([KX509], 1, [Define to enable kx509.])
 fi
 
-AC_ARG_ENABLE(krb4, 
-       AS_HELP_STRING([--disable-krb4],
-               [if you want disable to krb4 support]))
-if test "$enable_krb4" != no ;then
-       AC_DEFINE([KRB4], 1, [Define to enable Kerberos 4.])
-fi
-
 dnl Need to test if pkg-config exists
 PKG_PROG_PKG_CONFIG
 
@@ -165,6 +182,54 @@ AM_CONDITIONAL([HAVE_CAPNG], [test "$with_capng" != "no"])
 AC_SUBST([CAPNG_CFLAGS])
 AC_SUBST([CAPNG_LIBS])
 
+dnl libmicrohttpd
+AC_ARG_WITH([microhttpd],
+  AC_HELP_STRING([--with-microhttpd], [use microhttpd to serve KDC REST API @<:@default=check@:>@]),
+  [],
+  [with_microhttpd=check])
+if test "$with_microhttpd" != "no"; then
+  PKG_CHECK_MODULES([MICROHTTPD], [libmicrohttpd >= 0.9.37],
+                   [with_microhttpd=yes],[with_microhttpd=no])
+fi
+if test "$with_microhttpd" = "yes"; then
+  AC_DEFINE_UNQUOTED([HAVE_MICROHTTPD], 1, [whether libmicrohttpd is available for KDC REST API])
+fi
+AM_CONDITIONAL([HAVE_MICROHTTPD], [test "$with_microhttpd" != "no"])
+AC_SUBST([MICROHTTPD_CFLAGS])
+AC_SUBST([MICROHTTPD_LIBS])
+
+dnl libcjwt
+AC_ARG_WITH([cjwt],
+  AC_HELP_STRING([--with-cjwt], [(Experimental) use cjwt to validate JWT tokens @<:@default=check@:>@]),
+  [],
+  [with_cjwt=check])
+if test "$with_cjwt" != "no"; then
+  PKG_CHECK_MODULES([CJWT], [libcjwt >= 1.0.0],
+                   [with_cjwt=yes],[with_cjwt=no])
+fi
+if test "$with_cjwt" = "yes"; then
+  AC_DEFINE_UNQUOTED([HAVE_CJWT], 1, [whether libcjwt is available for KDC REST API])
+fi
+AM_CONDITIONAL([HAVE_CJWT], [test "$with_cjwt" != "no"])
+AC_SUBST([CJWT_CFLAGS])
+AC_SUBST([CJWT_LIBS])
+
+dnl libcjson
+AC_ARG_WITH([cjson],
+  AC_HELP_STRING([--with-cjson], [(Experimental) use cJSON to extract private claims from JWT tokens @<:@default=check@:>@]),
+  [],
+  [with_cjson=check])
+if test "$with_cjson" != "no"; then
+  PKG_CHECK_MODULES([CJSON], [libcjson >= 1.0.0],
+                   [with_cjson=yes],[with_cjson=no])
+fi
+if test "$with_cjson" = "yes"; then
+  AC_DEFINE_UNQUOTED([HAVE_CJSON], 1, [whether libcjson is available for KDC REST API])
+fi
+AM_CONDITIONAL([HAVE_CJSON], [test "$with_cjson" != "no"])
+AC_SUBST([CJSON_CFLAGS])
+AC_SUBST([CJSON_LIBS])
+
 dnl Check for sqlite
 rk_TEST_PACKAGE(sqlite3,
 [#include <sqlite3.h>
@@ -179,6 +244,8 @@ if test "X$with_sqlite3" != Xyes ; then
 fi
 AM_CONDITIONAL(SQLITE3,  test "X$with_sqlite3" = Xyes)
 
+AC_DEFINE(HAVE_SQLITE3, 1, [Define if you want support for sqlite in Heimdal.])
+
 AC_ARG_ENABLE(sqlite-cache, 
        AS_HELP_STRING([--disable-sqlite-cache],[if you want support for cache in sqlite]))
 if test "$enable_sqlite_cache" != no; then
@@ -201,12 +268,6 @@ DIR_hdbdir="$with_hdbdir"
 AC_SUBST([DIR_hdbdir])
 
 
-dnl no kerberos4 any more
-with_krb4=no
-AC_SUBST(INCLUDE_krb4)
-AC_SUBST(LIB_krb4)
-AM_CONDITIONAL(KRB4, false)
-
 AM_CONDITIONAL(KRB5, true)
 AM_CONDITIONAL(do_roken_rename, true)
 
@@ -248,6 +309,7 @@ if test "$enable_afs_support" = no; then
        NO_AFS="1"
 fi
 AC_SUBST(NO_AFS)dnl
+AM_CONDITIONAL(NO_AFS, test "$enable_afs_support" = no)
 
 rk_DB
 
@@ -277,26 +339,38 @@ AC_ARG_ENABLE(afs-string-to-key,
 
 if test "$enable_afs_string_to_key" = "yes"; then
        AC_DEFINE(ENABLE_AFS_STRING_TO_KEY, 1, [Define if want to use the weak AFS string to key functions.])
+       ENABLE_AFS_STRING_TO_KEY=1
 fi
+AC_SUBST(ENABLE_AFS_STRING_TO_KEY)dnl
 
 
 rk_CHECK_MAN
 
 rk_TEST_PACKAGE(readline,
 [#include <stdio.h>
- #include <readline.h>],-lreadline,,, READLINE)
+#if defined(HAVE_READLINE_READLINE_H)
+#include <readline/readline.h>
+#elif defined(HAVE_READLINE_H)
+#include <readline.h>
+#endif
+],-lreadline,,, READLINE,, [readline.h readline/readline.h])
+
+rk_TEST_PACKAGE(libedit,
+[#include <stdio.h>
+#if defined(HAVE_READLINE_READLINE_H)
+#include <readline/readline.h>
+#elif defined(HAVE_READLINE_H)
+#include <readline.h>
+#elif defined(HAVE_EDITLINE_READLINE_H)
+#include <editline/readline.h>
+#endif
+],-ledit,,, READLINE,, [readline.h readline/readline.h editline/readline.h])
 
-rk_TEST_PACKAGE(hesiod,[#include <hesiod.h>],-lhesiod,,, HESIOD)
+AC_CONFIG_SUBDIRS([lib/libedit])
 
 KRB_C_BIGENDIAN
 AC_C_INLINE
 
-KRB_CHECK_X
-
-AM_CONDITIONAL(HAVE_X, test "$no_x" != yes)
-
-AC_CHECK_XAU
-
 dnl AM_C_PROTOTYPES
 
 dnl Checks for typedefs, structures, and compiler characteristics.
@@ -314,20 +388,22 @@ AC_HEADER_STDC
 AC_CHECK_HEADERS([\
        CommonCrypto/CommonDigest.h             \
        CommonCrypto/CommonCryptor.h            \
-       arpa/ftp.h                              \
        arpa/telnet.h                           \
        bind/bitypes.h                          \
        bsdsetjmp.h                             \
        curses.h                                \
        dlfcn.h                                 \
+       execinfo.h                              \
        fnmatch.h                               \
        inttypes.h                              \
        io.h                                    \
+       keyutils.h                              \
        libutil.h                               \
        limits.h                                \
        maillock.h                              \
        netgroup.h                              \
        netinet/in6_machtypes.h                 \
+       netinet/tcp.h                           \
        pthread.h                               \
        pty.h                                   \
        sac.h                                   \
@@ -364,8 +440,6 @@ AC_CHECK_HEADERS([\
        tmpdir.h                                \
        udb.h                                   \
        util.h                                  \
-       utmp.h                                  \
-       utmpx.h                                 \
 ])
 
 dnl On Solaris 8 there's a compilation warning for term.h because
@@ -432,7 +506,7 @@ AC_FIND_FUNC_NO_LIBS(openpty, util,[
 #endif
 ],[0,0,0,0,0])
 
-AC_FIND_FUNC_NO_LIBS(tgetent, termcap ncurses curses,[
+AC_FIND_FUNC_NO_LIBS(tgetent, termcap ncurses curses tinfo,[
 #ifdef HAVE_TERMCAP_H
 #include <termcap.h>
 #endif
@@ -447,10 +521,17 @@ AC_CHECK_FUNCS([                          \
        _getpty                                 \
        _scrsize                                \
        arc4random                              \
+       backtrace                               \
        fcntl                                   \
+       fork                                    \
+       fseeko                                  \
+       ftello                                  \
        getpeereid                              \
        getpeerucred                            \
+       getresgid                               \
+       getresuid                               \
        grantpt                                 \
+       kill                                    \
        mktime                                  \
        ptsname                                 \
        rand                                    \
@@ -473,14 +554,26 @@ AC_CHECK_FUNCS([                          \
        umask                                   \
        unlockpt                                \
        vhangup                                 \
+       waitpid                                 \
        yp_get_default_domain                   \
 ])
 
+AC_MSG_CHECKING([checking for __sync_add_and_fetch])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
+       [[unsigned int foo, bar; bar = __sync_add_and_fetch(&foo, 1);]])],
+       [ac_rk_have___sync_add_and_fetch=yes], [ac_rk_have___sync_add_and_fetch=no])
+if test "$ac_rk_have___sync_add_and_fetch" = "yes" ; then
+       AC_DEFINE_UNQUOTED(HAVE___SYNC_ADD_AND_FETCH, 1, [have __sync_add_and_fetch])
+fi
+AC_MSG_RESULT($ac_rk_have___sync_add_and_fetch)
+
 AC_FUNC_MMAP
 
 KRB_CAPABILITIES
+rk_DLADDR
 
 AC_CHECK_GETPWNAM_R_POSIX
+AC_CHECK_GETPWUID_R_POSIX
 
 dnl detect doors on solaris
 if test "$enable_pthread_support" != no; then
@@ -505,33 +598,34 @@ if test "$enable_kcm" = yes; then
 fi
 AM_CONDITIONAL(KCM, test "$enable_kcm" = yes)
 
+dnl detect keyring on Linux
+if test "$ac_cv_header_keyutils_h" = yes; then
+    AC_CHECK_SIZEOF([key_serial_t],,[
+       #ifdef HAVE_INTTYPES_H
+       #include <inttypes.h>
+       #endif
+       #ifdef HAVE_SYS_TYPES_H
+       #include <sys/types.h>
+       #endif
+       #include <keyutils.h>
+    ])
+fi
+
+AC_FIND_FUNC_NO_LIBS(add_key, keyutils)
+if test -n "$LIB_add_key"; then
+    saved_LIBS="$LIBS"
+    LIBS="$LIBS $LIB_add_key"
+    AC_CHECK_FUNCS(keyctl_get_persistent)
+    LIBS="$saved_LIBS"
+fi
 
+AC_CHECK_SIZEOF([time_t])
 
 dnl Cray stuff
 AC_CHECK_FUNCS(getudbnam setlim)
 
 dnl AC_KRB_FUNC_GETCWD_BROKEN
 
-dnl
-dnl Check for fields in struct utmp
-dnl
-
-AC_HAVE_STRUCT_FIELD(struct utmp, ut_addr, [#include <utmp.h>])
-AC_HAVE_STRUCT_FIELD(struct utmp, ut_host, [#include <utmp.h>])
-AC_HAVE_STRUCT_FIELD(struct utmp, ut_id, [#include <utmp.h>])
-AC_HAVE_STRUCT_FIELD(struct utmp, ut_pid, [#include <utmp.h>])
-AC_HAVE_STRUCT_FIELD(struct utmp, ut_type, [#include <utmp.h>])
-AC_HAVE_STRUCT_FIELD(struct utmp, ut_user, [#include <utmp.h>])
-AC_HAVE_STRUCT_FIELD(struct utmpx, ut_host, [#include <utmpx.h>])
-AC_HAVE_STRUCT_FIELD(struct utmpx, ut_id, [#include <utmpx.h>])
-AC_HAVE_STRUCT_FIELD(struct utmpx, ut_line, [#include <utmpx.h>])
-AC_HAVE_STRUCT_FIELD(struct utmpx, ut_pid, [#include <utmpx.h>])
-AC_HAVE_STRUCT_FIELD(struct utmpx, ut_tv, [#include <utmpx.h>])
-AC_HAVE_STRUCT_FIELD(struct utmpx, ut_type, [#include <utmpx.h>])
-AC_HAVE_STRUCT_FIELD(struct utmpx, ut_user, [#include <utmpx.h>])
-AC_HAVE_STRUCT_FIELD(struct utmpx, ut_exit, [#include <utmpx.h>])
-AC_HAVE_STRUCT_FIELD(struct utmpx, ut_syslen, [#include <utmpx.h>])
-
 AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, 
        u_int8_t, u_int16_t, u_int32_t, u_int64_t,
        uint8_t, uint16_t, uint32_t, uint64_t],,,[
@@ -553,6 +647,7 @@ AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t,
 ])
 
 rk_FRAMEWORK_SECURITY
+rk_FRAMEWORK_COREFOUNDATION
 
 KRB_READLINE
 
@@ -576,6 +671,11 @@ AH_BOTTOM([#ifdef ROKEN_RENAME
 #include "roken_rename.h"
 #endif])
 
+AC_ARG_ENABLE(heimdal-documentation,
+       AS_HELP_STRING([--disable-heimdal-documentation],
+               [if you want disable to heimdal documentation]))
+AM_CONDITIONAL(HEIMDAL_DOCUMENTATION, test "$enable_heimdal_documentation" != no)
+
 AC_CONFIG_FILES(Makefile               \
        etc/Makefile                    \
        include/Makefile                \
@@ -583,11 +683,10 @@ AC_CONFIG_FILES(Makefile          \
        include/hcrypto/Makefile        \
        include/kadm5/Makefile          \
        lib/Makefile                    \
-       base/Makefile                   \
+       lib/base/Makefile                       \
        lib/asn1/Makefile               \
        lib/com_err/Makefile            \
        lib/hcrypto/Makefile            \
-       lib/editline/Makefile           \
        lib/hx509/Makefile              \
        lib/gssapi/Makefile             \
        lib/ntlm/Makefile               \
@@ -612,24 +711,9 @@ AC_CONFIG_FILES(Makefile           \
        kdc/Makefile                    \
        appl/Makefile                   \
        appl/afsutil/Makefile           \
-       appl/ftp/Makefile               \
-       appl/ftp/common/Makefile        \
-       appl/ftp/ftp/Makefile           \
-       appl/ftp/ftpd/Makefile          \
+       appl/dbutils/Makefile           \
        appl/gssmask/Makefile           \
-       appl/kx/Makefile                \
-       appl/login/Makefile             \
        appl/otp/Makefile               \
-       appl/popper/Makefile            \
-       appl/push/Makefile              \
-       appl/rsh/Makefile               \
-       appl/rcp/Makefile               \
-       appl/su/Makefile                \
-       appl/xnlock/Makefile            \
-       appl/telnet/Makefile            \
-       appl/telnet/libtelnet/Makefile  \
-       appl/telnet/telnet/Makefile     \
-       appl/telnet/telnetd/Makefile    \
        appl/test/Makefile              \
        appl/kf/Makefile                \
        appl/dceutils/Makefile          \
@@ -654,22 +738,71 @@ dnl
 dnl This is the release version name-number[beta]
 dnl
 
-cat > include/newversion.h.in <<EOF
+if test -d "$srcdir/.git"; then
+    cat > include/newversion.h.in <<EOF
+#ifndef VERSION_HIDDEN
+#define VERSION_HIDDEN
+#endif
+VERSION_HIDDEN const char *heimdal_long_version = "@([#])\$Version: $PACKAGE_STRING by @USER@ on @HOST@ @BRANCH@ @TAG@ ($host) @COMMIT@ @DATE@ \$";
+VERSION_HIDDEN const char *heimdal_version = "AC_PACKAGE_STRING";
+EOF
+else
+    cat > include/newversion.h.in <<EOF
 #ifndef VERSION_HIDDEN
 #define VERSION_HIDDEN
 #endif
 VERSION_HIDDEN const char *heimdal_long_version = "@([#])\$Version: $PACKAGE_STRING by @USER@ on @HOST@ ($host) @DATE@ \$";
 VERSION_HIDDEN const char *heimdal_version = "AC_PACKAGE_STRING";
 EOF
+fi
 
 if test -f include/version.h && cmp -s include/newversion.h.in include/version.h.in; then
        echo "include/version.h is unchanged"
        rm -f include/newversion.h.in
 else
        echo "creating include/version.h"
-       User=${USER-${LOGNAME}}
-       Host=`(hostname || uname -n || echo unknown) 2>/dev/null | sed 1q`
-       Date=`date`
+        if test -n "$SOURCE_DATE_EPOCH"; then
+            Date=`
+                  # BSD, OS X
+                  date -u -r "$SOURCE_DATE_EPOCH" "+%Y-%m-%dT%H:%M:%SZ" 2>/dev/null ||
+                  # Linux
+                  date -u -d "@${SOURCE_DATE_EPOCH}" 2>/dev/null ||
+                  # Illumos -- sorry, no -r/-d here
+                  date -u ||
+                  date`
+        else
+            Date=`date -u "+%Y-%m-%dT%H:%M:%SZ"`
+        fi
+        if test -n "$SOURCE_HOST"; then
+            Host=$SOURCE_HOST
+        else
+            Host=`uname -n`
+        fi
+        if test -n "$SOURCE_USER"; then
+            User=$SOURCE_USER
+        else
+            User=${USER:-${LOGNAME:-`id -nu`}}
+        fi
+        if test -d "$srcdir/.git"; then
+            GitCommit=`cd $srcdir && git rev-parse HEAD`
+            GitBranch=`cd $srcdir && git rev-parse --abbrev-ref HEAD`
+            if test "x$GitBranch" = master; then
+                GitDesc=`cd $srcdir && git describe --all --dirty`
+            else
+                GitDesc=`cd $srcdir && \
+                        git describe --tags --match 'heimdal-*' --dirty`
+            fi
+        else
+            GitCommit='<commit-unknown>'
+            GitBranch='<branch-unknown>'
+            GitDesc='<tag-unknown>'
+        fi
        mv -f include/newversion.h.in include/version.h.in
-       sed -e "s/@USER@/$User/" -e "s/@HOST@/$Host/" -e "s/@DATE@/$Date/" include/version.h.in > include/version.h
+       sed -e "s/@HOST@/$Host/" \
+            -e "s;@USER@;$User;" \
+            -e "s;@DATE@;$Date;" \
+            -e "s;@BRANCH@;$GitBranch;" \
+            -e "s;@TAG@;$GitDesc;" \
+            -e "s;@COMMIT@;$GitCommit;" \
+            include/version.h.in > include/version.h
 fi