FBSD: typo fix
[openafs.git] / acinclude.m4
index 189ee95..f9de460 100644 (file)
@@ -59,7 +59,6 @@ AH_BOTTOM([
 #undef RECALC_SIGPENDING_TAKES_VOID
 #undef STRUCT_FS_HAS_FS_ROLLED
 #undef ssize_t
-#undef HAVE_ARPA_NAMESER_COMPAT_H
 /* glue for RedHat kernel bug */
 #undef ENABLE_REDHAT_BUILDSYS
 #if defined(ENABLE_REDHAT_BUILDSYS) && defined(KERNEL) && defined(REDHAT_FIX)
@@ -86,47 +85,22 @@ AC_ARG_ENABLE([namei-fileserver],
          fileserver])],
     , 
     [enable_namei_fileserver="default"])
-AC_ARG_ENABLE([cache-bypass],
-    [AS_HELP_STRING([--enable-cache-bypass],
-        [enable client support for cache bypass])],
-    , 
-    [enable_cache_bypass="no"])
 AC_ARG_ENABLE([supergroups],
     [AS_HELP_STRING([--enable-supergroups],
         [enable support for nested pts groups])],
     , 
     [enable_supergroups="no"])
-AC_ARG_ENABLE([fast-restart],
-    [AS_HELP_STRING([--enable-fast-restart],
-        [enable fast startup of file server without salvaging])],
-    , 
-    [enable_fast_restart="no"])
 AC_ARG_ENABLE([bitmap-later],
     [AS_HELP_STRING([--enable-bitmap-later],
         [enable fast startup of file server by not reading bitmap till
          needed])],
     , 
     [enable_bitmap_later="no"])
-AC_ARG_ENABLE([demand-attach-fs],
-    [AS_HELP_STRING([--enable-demand-attach-fs],
-        [enable Demand Attach Fileserver (please see documentation)])],
-    , 
-    [enable_demand_attach_fs="no"])
-AC_ARG_ENABLE([disconnected],
-    [AS_HELP_STRING([--enable-disconnected],
-        [enable disconnected support in cache manager (experimental)])],
-    , 
-    [enable_disconnected="no"])
 AC_ARG_ENABLE([unix-sockets],
-    [AS_HELP_STRING([--enable-unix-sockets],
-        [enable use of unix domain sockets for fssync])],
+    [AS_HELP_STRING([--disable-unix-sockets],
+        [disable use of unix domain sockets for fssync (defaults to enabled)])],
     ,
     [enable_unix_sockets="yes"])
-AC_ARG_ENABLE([icmp-pmtu-discovery],
-    [AS_HELP_STRING([--enable-icmp-pmtu-discovery],
-        [enable path MTU discovery by decoding ICMP unreachable replies])],
-    , 
-    [enable_icmp_pmtu_discovery="no"])
 AC_ARG_ENABLE([tivoli-tsm],
     [AS_HELP_STRING([--enable-tivoli-tsm],
         [enable use of the Tivoli TSM API libraries for butc support])],
@@ -140,10 +114,6 @@ AC_ARG_ENABLE([pthreaded-ubik],
     [enable_pthreaded_ubik="no"])
 
 dnl Kernel module build options.
-AC_ARG_WITH([dux-kernel-headers],
-    [AS_HELP_STRING([--with-dux-kernel-headers=path],
-        [use the kernel headers found at path (optional, defaults to first
-         match in /usr/sys)])])
 AC_ARG_WITH([linux-kernel-headers],
     [AS_HELP_STRING([--with-linux-kernel-headers=path],
         [use the kernel headers found at path (optional, defaults to
@@ -255,27 +225,44 @@ AC_ARG_ENABLE([optimize-pam],
     ,
     [enable_optimize_pam="yes"])
 AC_ARG_ENABLE([linux-syscall-probing],
-    [AS_HELP_STRING([--disable-linux-syscall-probing],
-       [disabling Linux syscall probing (defaults to enabled)])],
+    [AS_HELP_STRING([--enable-linux-syscall-probing],
+       [enable Linux syscall probing (defaults to autodetect)])],
     ,
-    [AC_DEFINE(ENABLE_LINUX_SYSCALL_PROBING, 1, 
-       [define to enable syscall table probes])])
+    [enable_linux_syscall_probing="maybe"])
     
-
 AC_ARG_WITH([xslt-processor],
        AS_HELP_STRING([--with-xslt-processor=ARG],
        [which XSLT processor to use (possible choices are: libxslt, saxon, xalan-j, xsltproc)]),
-               XSLTPROC="$withval",
-               XSLTPROC="libxslt")
+               [XSLTPROC="$withval"],
+       AC_CHECK_PROGS([XSLTPROC], [libxslt saxon xalan-j xsltproc], [echo]))
 
 AC_ARG_WITH([html-xsl], 
         AS_HELP_STRING([--with-html-xsl],
-       [build HTML documentation using Norman Walsh's DocBook XSL stylesheets (default is no; specify a path to chunk.xsl or docbook.xsl)]),
-       HTML_XSL="$withval",
-       HTML_XSL=no)
+       [build HTML documentation using this stylesheet (default is html/chunk.dsl; specify either html/chunk.xsl or html/docbook.xsl)]),
+       [HTML_XSL="$withval"],
+       [HTML_XSL="html/chunk.xsl"])
+
+AC_ARG_WITH([docbook2pdf],
+       AS_HELP_STRING([--with-docbook2pdf=ARG],
+       [which Docbook to PDF utility to use (possible choices are: fop, dblatex, docbook2pdf)]),
+               [DOCBOOK2PDF="$withval"],
+       AC_CHECK_PROGS([DOCBOOK2PDF], [fop dblatex docbook2pdf], [echo]))
+
+AC_ARG_WITH([docbook-stylesheets],
+       AS_HELP_STRING([--with-docbook-stylesheets=ARG],
+       [location of DocBook stylesheets (default is to search a set of likely paths)]),
+               [DOCBOOK_STYLESHEETS="$withval"],
+       OPENAFS_SEARCH_DIRLIST([DOCBOOK_STYLESHEETS], [/usr/share/xml/docbook/stylesheet/nwalsh/current /usr/share/xml/docbook/stylesheet/nwalsh /usr/share/xml/docbook/xsl-stylesheets /usr/share/sgml/docbook/docbook-xsl-stylesheets /usr/share/sgml/docbook/xsl-stylesheets /usr/share/docbook-xsl /usr/share/sgml/docbkxsl /usr/local/share/xsl/docbook /sw/share/xml/xsl/docbook-xsl /opt/local/share/xsl/docbook-xsl], [$HTML_XSL])
+       if test "x$DOCBOOK_STYLESHEETS" = "x"; then
+               AC_WARN([Docbook stylesheets not found; some documentation can't be built])
+       fi)
 
 enable_login="no"
 
+dnl Check whether kindlegen exists.  If not, we'll suppress that part of the
+dnl documentation build.
+AC_CHECK_PROGS([KINDLEGEN], [kindlegen])
+
 dnl weird ass systems
 dnl AC_AIX
 AC_ISC_POSIX
@@ -291,7 +278,10 @@ AC_PROG_LN_S
 AC_PROG_RANLIB
 AC_PROG_YACC
 AM_PROG_LEX
+dnl if we are flex, be lex-compatible
+OPENAFS_LEX_IS_FLEX([AC_SUBST([LEX], ["$LEX -l"])])
 
+OPENAFS_FORCE_ABS_INSTALL
 OPENAFS_CHECK_BIGENDIAN
 OPENAFS_PRINTF_TAKES_Z_LEN
 
@@ -372,10 +362,12 @@ case $system in
                fi
                AC_MSG_RESULT(linux)
                 if test "x$enable_kernel_module" = "xyes"; then
-                 AFS_SYSKVERS=`echo $LINUX_VERSION | awk -F\. '{print $[]1 $[]2}'`
-                 if test "x${AFS_SYSKVERS}" = "x"; then
-                  AC_MSG_ERROR(Couldn't guess your Linux version [2])
-                 fi
+                 case "$LINUX_VERSION" in
+                  2.2.*) AFS_SYSKVERS=22 ;;
+                  2.4.*) AFS_SYSKVERS=24 ;;
+                  2.6.* | 3.*) AFS_SYSKVERS=26 ;;
+                  *) AC_MSG_ERROR(Couldn't guess your Linux version [2]) ;;
+                 esac
                 fi
                 ;;
         *-solaris*)
@@ -410,9 +402,9 @@ case $system in
                MKAFS_OSTYPE=AIX
                 AC_MSG_RESULT(rs_aix)
                 ;;
-        *-osf*)
-               MKAFS_OSTYPE=DUX
-                AC_MSG_RESULT(alpha_dux)
+        arm-*-darwin*)
+               MKAFS_OSTYPE=DARWIN
+                AC_MSG_RESULT(arm_darwin)
                 ;;
         powerpc-*-darwin*)
                MKAFS_OSTYPE=DARWIN
@@ -422,6 +414,10 @@ case $system in
                MKAFS_OSTYPE=DARWIN
                 AC_MSG_RESULT(x86_darwin)
                 ;;
+        x86_64-*-darwin*)
+               MKAFS_OSTYPE=DARWIN
+                AC_MSG_RESULT(x86_darwin)
+                ;;
        i386-*-freebsd*)
                MKAFS_OSTYPE=FBSD
                AC_MSG_RESULT(i386_fbsd)
@@ -486,11 +482,11 @@ else
                        vm=${v#*.}
                        AFS_SYSNAME="amd64_fbsd_${vM}${vm}"
                        ;;
-               i386-*-dragonfly2.2*)
-                       AFS_SYSNAME="i386_dfbsd_23"
-                       ;;
-               i386-*-dragonfly2.3*)
-                       AFS_SYSNAME="i386_dfbsd_23"
+               i386-*-dragonfly?.*)
+                       v=${host#*dragonfly}
+                       vM=${v%.*}
+                       vm=${v#*.}
+                       AFS_SYSNAME="i386_dfbsd_${vM}${vm}"
                        ;;
                i?86-*-netbsd*1.6[[M-Z]]*)
                        AFS_SYSNAME="i386_nbsd20"
@@ -540,31 +536,43 @@ else
                        ;;
                powerpc-apple-darwin7*)
                        AFS_SYSNAME="ppc_darwin_70"
+                       OSXSDK="macosx10.3"
                        ;;
                powerpc-apple-darwin8.*)
                        AFS_SYSNAME="ppc_darwin_80"
+                       OSXSDK="macosx10.4"
                        ;;
                i386-apple-darwin8.*)
                        AFS_SYSNAME="x86_darwin_80"
+                       OSXSDK="macosx10.4"
                        ;;
                powerpc-apple-darwin9.*)
                        AFS_SYSNAME="ppc_darwin_90"
+                       OSXSDK="macosx10.5"
                        ;;
                i386-apple-darwin9.*)
                        AFS_SYSNAME="x86_darwin_90"
+                       OSXSDK="macosx10.5"
                        ;;
                i?86-apple-darwin10.*)
                        AFS_SYSNAME="x86_darwin_100"
+                       OSXSDK="macosx10.6"
                        ;;
-               sparc-sun-solaris2.5*)
-                       AFS_SYSNAME="sun4x_55"
-                       enable_login="yes"
+               x86_64-apple-darwin10.*)
+                       AFS_SYSNAME="x86_darwin_100"
+                       OSXSDK="macosx10.6"
+                       ;;
+               arm-apple-darwin10.*)
+                       AFS_SYSNAME="arm_darwin_100"
+                       OSXSDK="iphoneos4.0"
                        ;;
-               sparc-sun-solaris2.6)
-                       AFS_SYSNAME="sun4x_56"
+               x86_64-apple-darwin11.*)
+                       AFS_SYSNAME="x86_darwin_110"
+                       OSXSDK="macosx10.7"
                        ;;
-               sparc-sun-solaris2.7)
-                       AFS_SYSNAME="sun4x_57"
+               i?86-apple-darwin11.*)
+                       AFS_SYSNAME="x86_darwin_110"
+                       OSXSDK="macosx10.7"
                        ;;
                sparc-sun-solaris2.8)
                        AFS_SYSNAME="sun4x_58"
@@ -582,9 +590,6 @@ else
                        AFS_SYSNAME="sun4_413"
                        enable_login="yes"
                        ;;
-               i386-pc-solaris2.7)
-                       AFS_SYSNAME="sunx86_57"
-                       ;;
                i386-pc-solaris2.8)
                        AFS_SYSNAME="sunx86_58"
                        ;;
@@ -700,8 +705,10 @@ fi
 
 case $AFS_SYSNAME in
        *_darwin*)
+               AC_CHECK_HEADERS(crt_externs.h)
                DARWIN_PLIST=src/libafs/afs.${AFS_SYSNAME}.plist
                DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
+               AC_SUBST(OSXSDK)
                ;;
 esac
 
@@ -715,6 +722,7 @@ case $AFS_SYSNAME in
     *_nbsd30)   AFS_PARAM_COMMON=param.nbsd30.h  ;;
     *_nbsd40)   AFS_PARAM_COMMON=param.nbsd40.h  ;;
     *_nbsd50)   AFS_PARAM_COMMON=param.nbsd50.h  ;;
+    *_nbsd60)   AFS_PARAM_COMMON=param.nbsd60.h  ;;
     *_obsd31)   AFS_PARAM_COMMON=param.obsd31.h  ;;
     *_obsd32)   AFS_PARAM_COMMON=param.obsd32.h  ;;
     *_obsd33)   AFS_PARAM_COMMON=param.obsd33.h  ;;
@@ -731,6 +739,8 @@ case $AFS_SYSNAME in
     *_obsd44)   AFS_PARAM_COMMON=param.obsd44.h  ;;
     *_obsd45)   AFS_PARAM_COMMON=param.obsd45.h  ;;
     *_obsd46)   AFS_PARAM_COMMON=param.obsd46.h  ;;
+    *_obsd47)   AFS_PARAM_COMMON=param.obsd47.h  ;;
+    *_obsd48)   AFS_PARAM_COMMON=param.obsd48.h  ;;
     *_linux22)  AFS_PARAM_COMMON=param.linux22.h ;;
     *_linux24)  AFS_PARAM_COMMON=param.linux24.h ;;
     *_linux26)  AFS_PARAM_COMMON=param.linux26.h ;;
@@ -781,6 +791,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                                       [write_begin], [fs.h])
                 AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
                                       [backing-dev.h])
+                AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h])
                 AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
                 AC_CHECK_LINUX_STRUCT([inode], [i_blkbits], [fs.h])
                 AC_CHECK_LINUX_STRUCT([inode], [i_blksize], [fs.h])
@@ -788,11 +799,15 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_STRUCT([inode], [i_security], [fs.h])
                 AC_CHECK_LINUX_STRUCT([file_operations], [flock], [fs.h])
                 AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
+                AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h])
                 AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
                 AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
                 AC_CHECK_LINUX_STRUCT([super_block], [s_bdi], [fs.h])
+                AC_CHECK_LINUX_STRUCT([super_block], [s_d_op], [fs.h])
                 AC_CHECK_LINUX_STRUCT([super_operations], [alloc_inode],
                                       [fs.h])
+                AC_CHECK_LINUX_STRUCT([super_operations], [evict_inode],
+                                      [fs.h])
                  AC_CHECK_LINUX_STRUCT([task_struct], [cred], [sched.h])
                 AC_CHECK_LINUX_STRUCT([task_struct], [exit_state], [sched.h])
                 AC_CHECK_LINUX_STRUCT([task_struct], [parent], [sched.h])
@@ -805,6 +820,10 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_STRUCT([task_struct], [thread_info], [sched.h])
                 LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM
 
+                dnl Check for typed structure elements
+                AC_CHECK_LINUX_TYPED_STRUCT([read_descriptor_t],
+                                            [buf], [fs.h])
+
                 dnl Function existence checks
 
                  AC_CHECK_LINUX_FUNC([bdi_init],
@@ -820,13 +839,12 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
 #include <linux/page-flags.h>],
                                     [struct page *_page;
                                       int bchecked = PageFsMisc(_page);])
-                AC_CHECK_LINUX_FUNC([ctl_table], [ctl_name], [sysctl.h])
                 AC_CHECK_LINUX_FUNC([current_kernel_time],
                                     [#include <linux/time.h>],
                                     [struct timespec s;
                                      s = current_kernel_time();])
                 AC_CHECK_LINUX_FUNC([d_alloc_anon],
-                                    [#include <linux/dcache.h>],
+                                    [#include <linux/fs.h>],
                                     [d_alloc_anon(NULL);])
                 AC_CHECK_LINUX_FUNC([do_sync_read],
                                     [#include <linux/fs.h>],
@@ -846,9 +864,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_FUNC([i_size_read],
                                     [#include <linux/fs.h>],
                                     [i_size_read(NULL);])
-                AC_CHECK_LINUX_FUNC([iget],
+                AC_CHECK_LINUX_FUNC([inode_setattr],
                                     [#include <linux/fs.h>],
-                                    [iget(NULL, NULL);])
+                                    [inode_setattr(NULL, NULL);])
                 AC_CHECK_LINUX_FUNC([kernel_setsockopt],
                                     [#include <linux/net.h>],
                                     [kernel_setsockopt(NULL, 0, 0, NULL, 0);])
@@ -861,6 +879,10 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_FUNC([pagevec_lru_add_file],
                                     [#include <linux/pagevec.h>],
                                     [__pagevec_lru_add_file(NULL);])
+                AC_CHECK_LINUX_FUNC([path_lookup],
+                                    [#include <linux/fs.h>
+                                     #include <linux/namei.h>],
+                                    [path_lookup(NULL, 0, NULL);])
                 AC_CHECK_LINUX_FUNC([rcu_read_lock],
                                     [#include <linux/rcupdate.h>],
                                     [rcu_read_lock();])
@@ -876,9 +898,6 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
 
                 dnl Consequences - things which get set as a result of the
                 dnl                above tests
-                AS_IF([test "x$ac_cv_linux_func_iget" = "xno"],
-                      [AC_DEFINE([LINUX_USE_FH], 1,
-                         [define to use linux file handles for cache files])])
                 AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"],
                       [AC_DEFINE([AFS_NONFSTRANS], 1,
                                  [define to disable the nfs translator])])
@@ -894,10 +913,14 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_INODE_SETATTR_RETURN_TYPE
                 LINUX_IOP_I_CREATE_TAKES_NAMEIDATA
                 LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA
+                LINUX_IOP_I_PERMISSION_TAKES_FLAGS
                 LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA
                 LINUX_IOP_I_PUT_LINK_TAKES_COOKIE
+                LINUX_DOP_D_DELETE_TAKES_CONST
                 LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA
                 LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T
+                LINUX_FOP_F_FSYNC_TAKES_DENTRY
+                LINUX_FOP_F_FSYNC_TAKES_RANGE
                 LINUX_AOP_WRITEBACK_CONTROL
                 LINUX_FS_STRUCT_FOP_HAS_SPLICE
                 LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG
@@ -905,7 +928,6 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_POSIX_TEST_LOCK_CONFLICT_ARG
                 LINUX_KERNEL_SOCK_CREATE
                 LINUX_EXPORTS_KEY_TYPE_KEYRING
-                LINUX_KEYS_HAVE_SESSION_TO_PARENT
                 LINUX_NEED_RHCONFIG
                 LINUX_RECALC_SIGPENDING_ARG_TYPE
                 LINUX_EXPORTS_TASKLIST_LOCK
@@ -918,12 +940,37 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_KEY_ALLOC_NEEDS_CRED
                 LINUX_INIT_WORK_HAS_DATA
                 LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
-                LINUX_EXPORTS_INIT_MM
-                 LINUX_EXPORTS_SYS_CHDIR
-                 LINUX_EXPORTS_SYS_OPEN
+                LINUX_HAVE_DCACHE_LOCK
+                LINUX_D_COUNT_IS_INT
+
+                dnl If we are guaranteed that keyrings will work - that is
+                dnl  a) The kernel has keyrings enabled
+                dnl  b) The code is new enough to give us a key_type_keyring
+                dnl then we just disable syscall probing unless we've been
+                dnl told otherwise
+
+                AS_IF([test "$enable_linux_syscall_probing" = "maybe"],
+                  [AS_IF([test "$ac_cv_linux_keyring_support" = "yes" -a "$ac_cv_linux_exports_key_type_keyring" = "yes"],
+                         [enable_linux_syscall_probing="no"],
+                         [enable_linux_syscall_probing="yes"])
+                 ])
+
+                dnl Syscall probing needs a few tests of its own, and just
+                dnl won't work if the kernel doesn't export init_mm
+                AS_IF([test "$enable_linux_syscall_probing" = "yes"], [
+                   LINUX_EXPORTS_INIT_MM
+                  AS_IF([test "$ac_cv_linux_exports_init_mm" = "no"], [
+                     AC_MSG_ERROR(
+                      [Can't do syscall probing without exported init_mm])
+                   ])
+                  LINUX_EXPORTS_SYS_CHDIR
+                  LINUX_EXPORTS_SYS_OPEN
+                  AC_DEFINE(ENABLE_LINUX_SYSCALL_PROBING, 1,
+                            [define to enable syscall table probes])
+                ])
 
                 dnl Packaging and SMP build
-                if test "x$with_linux_kernel_packaging" = "xno" ; then
+                if test "x$with_linux_kernel_packaging" != "xyes" ; then
                   LINUX_WHICH_MODULES
                 else
                   AC_SUBST(MPS,'SP')
@@ -931,7 +978,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
 
                 dnl Syscall probing
                  if test "x$ac_cv_linux_config_modversions" = "xno" -o $AFS_SYSKVERS -ge 26; then
-                   AC_MSG_WARN([Cannot determine sys_call_table status. assuming it isn't exported])
+                  AS_IF([test "$enable_linux_syscall_probing" = "yes"], [
+                     AC_MSG_WARN([Cannot determine sys_call_table status. assuming it isn't exported])
+                  ])
                    ac_cv_linux_exports_sys_call_table=no
                   if test -f "$LINUX_KERNEL_PATH/include/asm/ia32_unistd.h"; then
                     ac_cv_linux_exports_ia32_sys_call_table=yes
@@ -971,8 +1020,20 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 fi
                 :
                fi
+dnl Linux-only, but just enable always.
+               AC_DEFINE(AFS_CACHE_BYPASS, 1, [define to activate cache bypassing Unix client])
 esac
 
+AC_CACHE_CHECK([if compiler has __sync_add_and_fetch],
+    [ac_cv_sync_fetch_and_add],
+    [AC_TRY_LINK(, [int var; return __sync_add_and_fetch(&var, 1);],
+                   [ac_cv_sync_fetch_and_add=yes],
+                   [ac_cv_sync_fetch_and_add=no])
+])
+AS_IF([test "$ac_cv_sync_fetch_and_add" = "yes"],
+      [AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD, 1,
+               [define if your C compiler has __sync_add_and_fetch])])
+
 AC_CACHE_CHECK([if struct sockaddr has sa_len field],
     [ac_cv_sockaddr_len],
     [AC_TRY_COMPILE( [#include <sys/types.h>
@@ -1110,26 +1171,10 @@ if test "$enable_supergroups" = "yes"; then
        AC_DEFINE(SUPERGROUPS, 1, [define if you want to have support for nested pts groups])
 fi
 
-if test "$enable_fast_restart" = "yes"; then
-       AC_DEFINE(FAST_RESTART, 1, [define if you want to have fast restart])
-fi
-
 if test "$enable_bitmap_later" = "yes"; then
        AC_DEFINE(BITMAP_LATER, 1, [define if you want to salvager to check bitmasks later])
 fi
 
-if test "$enable_demand_attach_fs" = "yes"; then
-       AC_DEFINE(DEMAND_ATTACH_ENABLE, 1, [define if you want the demand attach fileserver])
-       DEMAND_ATTACH="yes"
-else
-       DEMAND_ATTACH="no"
-fi
-AC_SUBST(DEMAND_ATTACH)
-
-if test "$enable_disconnected" = "yes"; then
-       AC_DEFINE(AFS_DISCON_ENV, 1, [define if you want support for disconnected operation])
-fi
-
 if test "$enable_unix_sockets" = "yes"; then
        AC_DEFINE(USE_UNIX_SOCKETS, 1, [define if you want to use UNIX sockets for fssync.])
        USE_UNIX_SOCKETS="yes"
@@ -1138,21 +1183,9 @@ else
 fi
 AC_SUBST(USE_UNIX_SOCKETS)
 
-if test "$enable_fast_restart" = "yes" &&
-   test "$enable_demand_attach_fs" = "yes" ; then
-       AC_MSG_ERROR([The Demand Attach and Fast Restart extensions are mutually exclusive.  Demand Attach fileservers automatically salvage volumes in the background, thereby making Fast Restart pointless.])
-       exit 1
-fi
-
-if test "$enable_icmp_pmtu_discovery" = "yes"; then
-   if test "$ac_cv_setsockopt_iprecverr" = "yes"; then
-       AC_DEFINE(ADAPT_PMTU, 1, [define if you want to decode icmp unreachable packets to discover path mtu])
-   fi
-fi
-
-if test "$enable_cache_bypass" = "yes"; then
-       AC_DEFINE(AFS_CACHE_BYPASS, 1, [define to activate cache bypassing Unix client])
-fi
+dnl if test "$ac_cv_setsockopt_iprecverr" = "yes"; then
+dnl    AC_DEFINE(ADAPT_PMTU, 1, [define if you want to decode icmp unreachable packets to discover path mtu])
+dnl fi
 
 if test "$enable_namei_fileserver" = "yes"; then
        AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
@@ -1217,14 +1250,92 @@ dnl checks for header files.
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_HEADER_DIRENT
-AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h grp.h)
-AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
-AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h)
-AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h sys/pag.h)
-AC_CHECK_HEADERS(windows.h direct.h sys/ipc.h)
-AC_CHECK_HEADERS(security/pam_modules.h ucontext.h regex.h sys/statvfs.h sys/statfs.h sys/bitypes.h)
+AC_CHECK_HEADERS([ \
+                  arpa/inet.h \
+                  arpa/nameser.h \
+                  curses.h\
+                  direct.h \
+                  et/com_err.h \
+                  errno.h \
+                  fcntl.h \
+                  grp.h \
+                  math.h \
+                  mntent.h \
+                  ncurses.h \
+                  netdb.h \
+                  netinet/in.h \
+                  pthread_np.h \
+                  pwd.h \
+                  regex.h \
+                  security/pam_appl.h \
+                  signal.h \
+                  stdint.h \
+                  stdio_ext.h \
+                  stdlib.h \
+                  string.h \
+                  strings.h \
+                  sys/bitypes.h \
+                  sys/bswap.h \
+                  sys/dk.h \
+                  sys/fcntl.h \
+                  sys/file.h \
+                  sys/fs_types.h \
+                  sys/fstyp.h \
+                  sys/ioctl.h \
+                  sys/ipc.h \
+                  sys/lockf.h \
+                  sys/map.h \
+                  sys/mount.h \
+                  sys/mntent.h \
+                  sys/mnttab.h \
+                  sys/pag.h \
+                  sys/param.h \
+                  sys/resource.h \
+                  sys/select.h \
+                  sys/statfs.h \
+                  sys/statvfs.h \
+                  sys/socket.h \
+                  sys/sysctl.h \
+                  sys/time.h \
+                  sys/types.h \
+                  sys/uio.h \
+                  sys/un.h \
+                  sys/vfs.h \
+                  syslog.h \
+                  termios.h \
+                  time.h \
+                  ucontext.h \
+                  unistd.h \
+                  windows.h \
+               ])
+
+AC_CHECK_HEADERS([resolv.h], [], [], [AC_INCLUDES_DEFAULT
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif])
+
+AC_CHECK_HEADERS([net/if.h],[],[],[AC_INCLUDES_DEFAULT
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif])
+
+AC_CHECK_HEADERS([netinet/if_ether.h],[],[],[AC_INCLUDES_DEFAULT
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#ifdef HAVE_NET_IF_H
+# include <net/if.h>
+#endif])
+
+AC_CHECK_HEADERS([security/pam_modules.h],[],[],[AC_INCLUDES_DEFAULT
+#ifdef HAVE_SECURITY_PAM_APPL_H
+# include <security/pam_appl.h>
+#endif])
+
 AC_CHECK_HEADERS(linux/errqueue.h,,,[#include <linux/types.h>])
-AC_CHECK_HEADERS(et/com_err.h)
 
 AC_CHECK_TYPES([fsblkcnt_t],,,[
 #include <sys/types.h>
@@ -1239,6 +1350,20 @@ AC_CHECK_TYPES([fsblkcnt_t],,,[
 #endif
 ])
 
+dnl see what struct stat has for timestamps
+AC_CHECK_MEMBERS([struct stat.st_ctimespec, struct stat.st_ctimensec])
+
+dnl check for curses-lib
+save_LIBS=$LIBS
+AC_CHECK_LIB( [ncurses], [setupterm],
+[LIB_curses=-lncurses],
+    [AC_CHECK_LIB([Hcurses], [setupterm], [LIB_curses=-lHcurses],
+        [AC_CHECK_LIB([curses], [setupterm], [LIB_curses=-lcurses])
+    ])
+])
+LIBS=$save_LIBS
+AC_SUBST(LIB_curses)
+
 OPENAFS_TEST_PACKAGE(libintl,[#include <libintl.h>],[-lintl],,,INTL)
 
 dnl Don't build PAM on IRIX; the interface doesn't work for us.
@@ -1263,10 +1388,181 @@ else
 fi
 AC_SUBST(BUILD_LOGIN)
 
-AC_CHECK_FUNCS(snprintf strlcat strlcpy flock)
-AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp vsnprintf strerror strcasestr)
-AC_CHECK_FUNCS(setvbuf vsyslog getcwd)
-AC_CHECK_FUNCS(regcomp regexec regerror)
+AC_CHECK_FUNCS([ \
+       arc4random \
+       fcntl \
+       fseeko64 \
+       ftello64 \
+       getcwd \
+       getegid \
+       geteuid \
+       getgid \
+       getuid \
+       getprogname \
+       getrlimit \
+       issetugid \
+       mkstemp \
+       pread \
+       preadv \
+       preadv64 \
+       pwrite \
+       pwritev \
+       pwritev64 \
+       regcomp \
+       regerror \
+       regexec \
+       setitimer \
+       setprogname \
+       setvbuf \
+       sigaction \
+       strcasestr \
+       strerror \
+       sysconf \
+       sysctl \
+       timegm \
+])
+
+OPENAFS_ROKEN()
+OPENAFS_C_ATTRIBUTE()
+
+dnl Functions that Heimdal's libroken provides, but that we
+dnl haven't found a need for yet, and so haven't imported
+AC_CHECK_FUNCS([ \
+       chown \
+       fchown \
+       gethostname \
+       lstat \
+       inet_aton \
+       inet_ntop \
+       inet_pton \
+       putenv \
+       readv \
+       setenv \
+       strdup \
+       strftime \
+       strndup \
+       strsep \
+       unsetenv \
+])
+
+dnl Functions that are in objects that we always build from libroken
+AC_CHECK_FUNCS([ \
+       asprintf \
+       asnprintf \
+       vasprintf \
+       vasnprintf \
+       vsnprintf \
+       snprintf \
+])
+
+dnl Functions that we're going to try and get from libroken
+AC_REPLACE_FUNCS([ \
+       daemon \
+       ecalloc \
+       emalloc \
+       erealloc \
+       err \
+       errx \
+       flock \
+       getdtablesize \
+       getopt \
+       getprogname \
+       gettimeofday \
+       localtime_r \
+       mkstemp \
+       strcasecmp \
+       strlcat \
+       strnlen \
+       strlcpy \
+       strsep \
+       tdelete \
+       tfind \
+       tsearch \
+       twalk \
+       verr \
+       verrx \
+       vsyslog \
+       vwarn \
+       vwarnx \
+       warn \
+       warnx \
+])
+
+dnl Headers that we're going to try and get from libroken
+AC_CHECK_HEADERS([ \
+       err.h \
+       search.h \
+])
+
+AC_CHECK_DECLS([h_errno], [], [], [
+#include <sys/types.h>
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+])
+
+AC_HEADER_TIME
+
+ROKEN_HEADERS=
+AS_IF([test "$ac_cv_header_err_h" != "yes" ],
+      [ROKEN_HEADERS="$ROKEN_HEADERS \$(TOP_INCDIR)/err.h"],
+      [])
+AC_SUBST(ROKEN_HEADERS)
+
+dnl Stuff that's harder ...
+AC_MSG_CHECKING([for bswap16])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_BSWAP_H
+#include <sys/bswap.h>
+#endif
+],
+[short a, b; b = bswap16(a); ])],
+[AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BSWAP16, 1, [Define to 1 if you have the bswap16 function])
+],
+[AC_MSG_RESULT(no)])
+
+AC_MSG_CHECKING([for bswap32])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_BSWAP_H
+#include <sys/bswap.h>
+#endif
+],
+[int a, b; b = bswap32(a); ])],
+[AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BSWAP32, 1, [Define to 1 if you have the bswap32 function])
+],
+[AC_MSG_RESULT(no)])
+
+case $AFS_SYSNAME in
+*hp_ux* | *hpux*)
+   AC_MSG_WARN([Some versions of HP-UX have a buggy positional I/O implementation. Forcing no positional I/O.])
+   ;;
+*)
+   AC_MSG_CHECKING([for positional I/O])
+   if test "$ac_cv_func_pread" = "yes" && \
+           test "$ac_cv_func_pwrite" = "yes"; then
+      AC_DEFINE(HAVE_PIO, 1, [define if you have pread() and pwrite()])
+      AC_MSG_RESULT(yes)
+   else
+     AC_MSG_RESULT(no)
+   fi
+   AC_MSG_CHECKING([for vectored positional I/O])
+   AS_IF([test "$ac_cv_func_preadv" = "yes" -a \
+               "$ac_cv_func_pwritev" = "yes" -a \
+              "$ac_cv_func_preadv64" = "yes" -a \
+              "$ac_cv_func_pwritev64" = "yes"],
+        [AC_DEFINE(HAVE_PIOV, 1, [define if you have preadv() and pwritev()])
+         AC_MSG_RESULT(yes)],
+        [AC_MSG_RESULT(no)])
+   ;;
+esac
+
 AC_MSG_CHECKING([for POSIX regex library])
 if test "$ac_cv_header_regex_h" = "yes" && \
        test "$ac_cv_func_regcomp" = "yes" && \
@@ -1278,26 +1574,104 @@ else
     AC_MSG_RESULT(no)
 fi
 
+dnl Look for "non-portable" pthreads functions.
+save_LIBS="$LIBS"
+LIBS="$LIBS $PTHREAD_LIBS"
+AC_CHECK_FUNCS([ \
+       pthread_set_name_np \
+       pthread_setname_np \
+])
+
+dnl Sadly, there are three different versions of pthread_setname_np.
+dnl Try to cater for all of them.
+if test "$ac_cv_func_pthread_setname_np" = "yes" ; then
+    AC_MSG_CHECKING([for signature of pthread_setname_np])
+    AC_TRY_COMPILE([
+#include <pthread.h>
+#ifdef HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
+], [pthread_setname_np(pthread_self(), "test", (void *)0)], [
+       AC_MSG_RESULT([three arguments])
+       pthread_setname_np_args=3], [
+       AC_TRY_COMPILE([
+#include <pthread.h>
+#ifdef HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
+], [pthread_setname_np(pthread_self(), "test")], [
+           AC_MSG_RESULT([two arguments])
+           pthread_setname_np_args=2], [
+           AC_TRY_COMPILE([
+#include <pthread.h>
+#ifdef HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
+], [pthread_setname_np("test")], [
+               AC_MSG_RESULT([one argument])
+               pthread_setname_np_args=1], [pthread_setname_np_args=0])
+])
+])
+AC_DEFINE_UNQUOTED([PTHREAD_SETNAME_NP_ARGS], $pthread_setname_np_args, [Number of arguments required by pthread_setname_np() function])
+fi
+LIBS="$save_LIBS"
+
+OPENAFS_OSCONF
+openafs_cv_saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $XCFLAGS_NOCHECKING"
+
 AC_TYPE_SIGNAL
+OPENAFS_RETSIGTYPE
 AC_CHECK_SIZEOF(void *)
 AC_CHECK_SIZEOF(unsigned long long)
 AC_CHECK_SIZEOF(unsigned long)
 AC_CHECK_SIZEOF(unsigned int)
 AC_TYPE_INTPTR_T
 AC_TYPE_UINTPTR_T
-AC_CHECK_TYPES([ssize_t])
-AC_CHECK_TYPES([sig_atomic_t],[],[],
+AC_TYPE_SSIZE_T
+AC_CHECK_TYPE([sig_atomic_t],[],
+    [AC_DEFINE([sig_atomic_t], [int],
+        [Define to int if <signal.h> does not define.])],
 [#include <sys/types.h>
 #include <signal.h>])
-AC_CHECK_TYPES([socklen_t],[],[],
+AC_CHECK_TYPE([socklen_t],[],
+    [AC_DEFINE([socklen_t], [int],
+        [Define to int if <sys/socket.h> does not define.])],
 [#include <sys/types.h>
 #include <sys/socket.h>])
+AC_CHECK_TYPES(off64_t)
+AC_CHECK_TYPES([ssize_t], [], [], [#include <unistd.h>])
+AC_CHECK_TYPES([struct winsize], [], [], [
+#ifdef HAVE_TERMIOS_H
+# include <termios.h>
+#else
+# include <sys/termios.h>
+#endif
+#include <sys/ioctl.h>])
+AC_CHECK_TYPES([sa_family_t, socklen_t, struct sockaddr,
+               struct sockaddr_storage],
+              [], [], [
+#include <sys/types.h>
+#include <sys/socket.h>
+])
+AC_CHECK_TYPES([sa_family_t], [], [], [
+#include <sys/types.h>
+#include <sys/socket.h>
+])
+AC_CHECK_TYPES([struct addrinfo], [], [], [
+#include <sys/types.h>
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+])
+AC_CHECK_TYPES([long long], [], [], [])
+
 AC_SIZEOF_TYPE(long)
 
-AC_HEADER_PAM_CONST
+CFLAGS="$openafs_cv_saved_CFLAGS"
+
+RRA_HEADER_PAM_CONST
 
-AC_CHECK_FUNCS(timegm)
-AC_CHECK_FUNCS(daemon)
 
 dnl Directory PATH handling
 if test "x$enable_transarc_paths" = "xyes"  ; then 
@@ -1370,10 +1744,11 @@ AC_SUBST(DARWIN_INFOFILE)
 AC_SUBST(IRIX_BUILD_IP35)
 AC_SUBST(HTML_XSL)
 AC_SUBST(XSLTPROC)
+AC_SUBST(DOCBOOK2PDF)
+AC_SUBST(DOCBOOK_STYLESHEETS)
 
-OPENAFS_OSCONF
-OPENAFS_KRB5CONF
 OPENAFS_FUSE
+OPENAFS_SWIG
 
 TOP_SRCDIR="${srcdir}/src"
 dnl
@@ -1401,4 +1776,62 @@ AC_SUBST(HELPER_SPLINTCFG)
 
 mkdir -p ${TOP_OBJDIR}/src/JAVA/libjafs
 
+dnl Check to see if crypt lives in a different library
+AC_CHECK_LIB(crypt, crypt, LIB_crypt="-lcrypt")
+AC_SUBST(LIB_crypt)
+
+dnl Check to see if the compiler support labels in structs
+AC_MSG_CHECKING(for label support in structs)
+AC_TRY_COMPILE([], [
+extern void osi_UFSOpen(void);
+struct labeltest {
+   void (*open) (void);
+};
+struct labeltest struct_labeltest = {
+   .open       = osi_UFSOpen,
+}
+],
+[AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_STRUCT_LABEL_SUPPORT, 1, [Define to 1 if your compiler supports labels in structs.])
+],
+[AC_MSG_RESULT(no)
+])
+
+AC_MSG_CHECKING([checking for dirfd])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+]],
+        [[DIR *d = 0; dirfd(d);]])],
+        [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
+if test "$ac_rk_have_dirfd" = "yes" ; then
+        AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
+fi
+AC_MSG_RESULT($ac_rk_have_dirfd)
+
+OPENAFS_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif])
+
+dnl Eventually, this will look for the system one, or for OpenSSL
+LIB_hcrypto="-lafshcrypto"
+LDFLAGS_hcrypto="-L\$(TOP_LIBDIR)"
+AC_SUBST(LIB_hcrypto)
+AC_SUBST(LDFLAGS_hcrypto)
+])
+
+AC_DEFUN([SUMMARY], [
+    # Print a configuration summary
+echo 
+echo "**************************************"
+echo configure summary
+echo
+AS_IF([test $LIB_curses],[
+echo "LIB_curses :                $LIB_curses" ],[
+echo "XXX LIB_curses  not found! not building scout and afsmonitor!"
+])
+echo 
+echo "**************************************"
 ])