tubik: Link with libafsauthent
[openafs.git] / acinclude.m4
index 911aaec..8375ed8 100644 (file)
@@ -463,11 +463,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"
@@ -770,6 +770,7 @@ 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])
@@ -886,7 +887,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
@@ -927,7 +927,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 ])
 
                 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')
@@ -981,6 +981,16 @@ 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>
@@ -1197,14 +1207,16 @@ 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(stdlib.h stdint.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 sys/resource.h sys/un.h)
 AC_CHECK_HEADERS(security/pam_modules.h ucontext.h regex.h sys/statvfs.h sys/statfs.h sys/bitypes.h)
+AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h errno.h time.h syslog.h)
 AC_CHECK_HEADERS(linux/errqueue.h,,,[#include <linux/types.h>])
-AC_CHECK_HEADERS(et/com_err.h)
+AC_CHECK_HEADERS(et/com_err.h stdio_ext.h)
+AC_CHECK_HEADERS(ncurses.h curses.h)
 
 AC_CHECK_TYPES([fsblkcnt_t],,,[
 #include <sys/types.h>
@@ -1219,6 +1231,14 @@ AC_CHECK_TYPES([fsblkcnt_t],,,[
 #endif
 ])
 
+dnl check for curses-lib
+save_LIBS=$LIBS
+AC_CHECK_LIB( [ncurses], [setupterm],
+[LIB_curses=-lncurses],
+[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.
@@ -1243,13 +1263,131 @@ else
 fi
 AC_SUBST(BUILD_LOGIN)
 
-AC_CHECK_FUNCS(arc4random)
-AC_CHECK_FUNCS(snprintf strlcat strlcpy flock getrlimit)
-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(fseeko64 ftello64)
-AC_CHECK_FUNCS(setitimer issetugidi getuid geteuid getgid getegid)
+AC_CHECK_FUNCS([ \
+       arc4random \
+       flock \
+       fseeko64 \
+       ftello64 \
+       getcwd \
+       getegid \
+       geteuid \
+       getgid \
+       getuid \
+       getprogname \
+       getrlimit \
+       issetugid \
+       mkstemp \
+       pread \
+       preadv \
+       pwrite \
+       pwritev \
+       regcomp \
+       regerror \
+       regexec \
+       setitimer \
+       setprogname \
+       setvbuf \
+       sigaction \
+       strcasestr \
+       strerror \
+       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 \
+       getdtablesize \
+       gethostname \
+       gettimeofday \
+       localtime_r \
+       lstat \
+       inet_aton \
+       inet_ntop \
+       inet_pton \
+       readv \
+       strdup \
+       strftime \
+       strndup \
+       strsep \
+])
+
+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 \
+       getopt \
+       getprogname \
+       mkstemp \
+       strcasecmp \
+       strlcat \
+       strnlen \
+       strlcpy \
+       strsep \
+       verr \
+       verrx \
+       vsyslog \
+       vwarn \
+       vwarnx \
+       warn \
+       warnx \
+])
+
+dnl Headers that we're going to try and get from libroken
+AC_CHECK_HEADERS([ \
+       err.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)
+
+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])
+if test "$ac_cv_func_preadv" = "yes" && \
+        test "$ac_cv_func_pwritev" = "yes"; then
+   AC_DEFINE(HAVE_PIOV, 1, [define if you have preadv() and pwritev()])
+   AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+
 AC_MSG_CHECKING([for POSIX regex library])
 if test "$ac_cv_header_regex_h" = "yes" && \
        test "$ac_cv_func_regcomp" = "yes" && \
@@ -1281,12 +1419,36 @@ AC_CHECK_TYPE([socklen_t],[],
 [#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
 
-AC_CHECK_FUNCS(timegm)
-AC_CHECK_FUNCS(daemon)
 
 dnl Directory PATH handling
 if test "x$enable_transarc_paths" = "xyes"  ; then 
@@ -1410,7 +1572,39 @@ struct labeltest struct_labeltest = {
 [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"
 AC_SUBST(LIB_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 "**************************************"
+])