macos next support
[openafs.git] / acinclude.m4
index 276cace..a58f396 100644 (file)
@@ -712,6 +712,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 ;;
@@ -770,9 +772,11 @@ 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],
@@ -809,7 +813,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                                     [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>],
@@ -874,6 +878,7 @@ 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_REVALIDATE_TAKES_NAMEIDATA
@@ -886,7 +891,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
@@ -899,6 +903,8 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_KEY_ALLOC_NEEDS_CRED
                 LINUX_INIT_WORK_HAS_DATA
                 LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
+                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
@@ -927,7 +933,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')
@@ -1207,14 +1213,55 @@ 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 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([ \
+                  curses.h\
+                  direct.h \
+                  et/com_err.h \
+                  errno.h \
+                  fcntl.h \
+                  grp.h \
+                  mntent.h \
+                  ncurses.h \
+                  netdb.h \
+                  netinet/in.h \
+                  regex.h \
+                  security/pam_modules.h \
+                  signal.h \
+                  stdint.h \
+                  stdio_ext.h \
+                  stdlib.h \
+                  string.h \
+                  strings.h \
+                  sys/bitypes.h \
+                  sys/bswap.h \
+                  sys/fcntl.h \
+                  sys/file.h \
+                  sys/fs_types.h \
+                  sys/fstyp.h \
+                  sys/ioctl.h \
+                  sys/ipc.h \
+                  sys/mount.h \
+                  sys/mntent.h \
+                  sys/mnttab.h \
+                  sys/pag.h \
+                  sys/param.h \
+                  sys/resource.h \
+                  sys/statfs.h \
+                  sys/statvfs.h \
+                  sys/socket.h \
+                  sys/time.h \
+                  sys/types.h \
+                  sys/un.h \
+                  sys/vfs.h \
+                  syslog.h \
+                  termios.h \
+                  time.h \
+                  ucontext.h \
+                  unistd.h \
+                  windows.h \
+               ])
+
 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>
@@ -1229,6 +1276,17 @@ 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([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.
@@ -1255,7 +1313,6 @@ AC_SUBST(BUILD_LOGIN)
 
 AC_CHECK_FUNCS([ \
        arc4random \
-       daemon \
        flock \
        fseeko64 \
        ftello64 \
@@ -1270,8 +1327,10 @@ AC_CHECK_FUNCS([ \
        mkstemp \
        pread \
        preadv \
+       preadv64 \
        pwrite \
        pwritev \
+       pwritev64 \
        regcomp \
        regerror \
        regexec \
@@ -1279,32 +1338,142 @@ AC_CHECK_FUNCS([ \
        setprogname \
        setvbuf \
        sigaction \
-       snprintf \
        strcasestr \
        strerror \
-       strlcat \
-       strlcpy \
        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 \
 ])
 
-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
+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)
+
+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" && \
@@ -1337,6 +1506,32 @@ 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
@@ -1484,5 +1679,21 @@ OPENAFS_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
 
 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 "**************************************"
 ])