Whamcloud - gitweb
LU-3490 kerberos: Enable GSSAPI support by default
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
index ec50de0..359cee4 100644 (file)
@@ -216,10 +216,10 @@ AC_DEFUN([LC_QUOTA_CONFIG],
        ])
 ])
 
-# truncate_complete_page() was exported from RHEL5/SLES10, but not in SLES11 SP0 (2.6.27)
+# truncate_complete_page() has never been exported from an upstream kernel
 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
 # delete_from_page_cache() is exported from 2.6.39
-AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
+AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE_PAGE],
          [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
                                  [mm/truncate.c],
                                  [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
@@ -235,26 +235,6 @@ AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
          ])
 
 #
-# added in 2.6.17
-#
-AC_DEFUN([LC_BIT_SPINLOCK_H],
-[LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
-       AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
-       LB_LINUX_TRY_COMPILE([
-               #include <asm/processor.h>
-               #include <linux/spinlock.h>
-               #include <linux/bit_spinlock.h>
-       ],[],[
-               AC_MSG_RESULT([yes])
-               AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
-       ],[
-               AC_MSG_RESULT([no])
-       ])
-],
-[])
-])
-
-#
 # LC_CAPA_CRYPTO
 #
 AC_DEFUN([LC_CAPA_CRYPTO],
@@ -306,7 +286,9 @@ AC_DEFUN([LC_CONFIG_GSS_KEYRING],
 
 AC_DEFUN([LC_CONFIG_SUNRPC],
 [LB_LINUX_CONFIG_IM([SUNRPC],[],
-                    [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
+                    [if test x$sunrpc_required == xyes; then
+                         AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])
+                     fi])
 ])
 
 #
@@ -319,12 +301,14 @@ AC_DEFUN([LC_CONFIG_GSS],
 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
  AC_ARG_ENABLE([gss],
                [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
-               [],[enable_gss='no'])
+               [],[enable_gss='auto'])
  AC_MSG_RESULT([$enable_gss])
 
- if test x$enable_gss == xyes; then
+ if test x$enable_gss != xno; then
         LC_CONFIG_GSS_KEYRING
+        sunrpc_required=$enable_gss
         LC_CONFIG_SUNRPC
+        sunrpc_required=no
 
         AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
 
@@ -337,65 +321,25 @@ AC_DEFUN([LC_CONFIG_GSS],
         LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
                            [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
 
-        AC_CHECK_LIB([gssapi], [gss_export_lucid_sec_context],
-                     [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
-                     [AC_CHECK_LIB([gssglue], [gss_export_lucid_sec_context],
-                                   [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
-                                   [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
-
-        AC_SUBST(GSSAPI_LIBS)
-
+        require_krb5=$enable_gss
         AC_KERBEROS_V5
+        require_krb5=no
+
+        if test x$KRBDIR != x; then
+            AC_CHECK_LIB([gssapi], [gss_export_lucid_sec_context],
+                         [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
+                         [AC_CHECK_LIB([gssglue], [gss_export_lucid_sec_context],
+                                       [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
+                                       [if test x$enable_gss == xyes; then
+                                            AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])
+                                        fi])],)
+            AC_SUBST(GSSAPI_LIBS)
+        fi
  fi
 ])
 
-# 2.6.12
-
-# ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
-# yet tree_lock is converted from rwlock to spin_lock since v2.6.26
-AC_DEFUN([LC_RW_TREE_LOCK],
-[AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
-        #include <linux/fs.h>
-],[
-       struct address_space a;
-
-       write_lock(&a.tree_lock);
-],[
-        AC_MSG_RESULT([yes])
-       AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
-],[
-        AC_MSG_RESULT([no])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
 #2.6.18 + RHEL5 (fc6)
 
-#
-# LC_LINUX_FIEMAP_H
-#
-# fiemap.h is added since v2.6.28
-# RHEL5 2.6.18 has it, while SLES10 2.6.27 does not
-#
-AC_DEFUN([LC_LINUX_FIEMAP_H],
-[LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
-        AC_MSG_CHECKING([if fiemap.h can be compiled])
-        LB_LINUX_TRY_COMPILE([
-                #include <linux/types.h>
-                #include <linux/fiemap.h>
-        ],[],[
-                AC_MSG_RESULT([yes])
-                AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
-        ],[
-                AC_MSG_RESULT([no])
-        ])
-],
-[])
-])
-
 # raid5-zerocopy patch
 
 #
@@ -422,75 +366,6 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
-# 2.6.22
-
-#
-# 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
-#
-AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
-[AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/fs.h>
-],[
-        int v __attribute__ ((unused));
-        v = FS_RENAME_DOES_D_MOVE;
-],[
-        AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.23
-
-# 2.6.23 have return type 'void' for unregister_blkdev
-AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
-[AC_MSG_CHECKING([if unregister_blkdev return int])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/fs.h>
-],[
-        int i __attribute__ ((unused));
-        i = unregister_blkdev(0,NULL);
-],[
-        AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
-                [unregister_blkdev return int])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.23 add code to wait other users to complete before removing procfs entry
-AC_DEFUN([LC_PROCFS_USERS],
-[AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/proc_fs.h>
-],[
-        struct proc_dir_entry pde;
-
-        pde.pde_users   = 0;
-],[
-        AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_PROCFS_USERS, 1,
-                [kernel has pde_users member in procfs entry struct])
-],[
-       LB_LINUX_TRY_COMPILE([
-               #include "$LINUX/fs/proc/internal.h"
-       ],[
-               struct proc_dir_entry_aux pde_aux;
-
-               pde_aux.pde_users = 0;
-       ],[
-               AC_MSG_RESULT([yes])
-               AC_DEFINE(HAVE_PROCFS_USERS, 1,
-                       [kernel has pde_users member in proc_dir_entry_aux])
-       ],[
-               AC_MSG_RESULT([no])
-       ])
-])
-])
-
 # 2.6.24
 
 # 2.6.24 has bio_endio with 2 args
@@ -527,50 +402,14 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
-# 2.6.26
-
-# 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
-AC_DEFUN([LC_FS_STRUCT_USE_PATH],
-[AC_MSG_CHECKING([fs_struct use path structure])
-LB_LINUX_TRY_COMPILE([
-        #include <asm/atomic.h>
-        #include <linux/spinlock.h>
-        #include <linux/fs_struct.h>
-],[
-        struct fs_struct fs;
-
-        fs.pwd = *((struct path *)sizeof(fs));
-], [
-        AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
-                [fs_struct use path structure])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
 #
 # 2.6.27
 #
 
-# LC_SECURITY_PLUG  # for SLES10 SP2 (2.6.27)
-# check security plug in sles10 sp2 kernel
-AC_DEFUN([LC_SECURITY_PLUG],
-[AC_MSG_CHECKING([If kernel has security plug support])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/fs.h>
-        #include <linux/stddef.h>
-],[
-        notify_change(NULL, NULL, NULL);
-],[
-        AC_MSG_RESULT(yes)
-        AC_DEFINE(HAVE_SECURITY_PLUG, 1,
-                [SLES10 SP2 use extra parameter in vfs])
-],[
-        AC_MSG_RESULT(no)
-])
-])
-
+# up to v2.6.27 had a 3 arg version (inode, mask, nameidata)
+# v2.6.27->v2.6.37 had a 2 arg version (inode, mask)
+# v2.6.37->v3.0 had a 3 arg version (inode, mask, nameidata)
+# v3.1 onward have a 2 arg version (inode, mask)
 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
 [AC_MSG_CHECKING([inode_operations->permission has two args])
 LB_LINUX_TRY_COMPILE([
@@ -661,23 +500,6 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
-# LC_LOCK_MAP_ACQUIRE
-# after 2.6.27 lock_map_acquire replaces lock_acquire
-AC_DEFUN([LC_LOCK_MAP_ACQUIRE],
-[AC_MSG_CHECKING([if lock_map_acquire is defined])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/lockdep.h>
-],[
-        lock_map_acquire(NULL);
-],[
-        AC_MSG_RESULT(yes)
-        AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1,
-                [lock_map_acquire is defined])
-],[
-        AC_MSG_RESULT(no)
-])
-])
-
 # 2.6.27.15-2 sles11
 
 # 2.6.27 sles11 remove the bi_hw_segments
@@ -1528,6 +1350,28 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# 3.9 killed f_vfsmnt by
+# 182be684784334598eee1d90274e7f7aa0063616
+# replacement is f_path.mnt
+#
+AC_DEFUN([LC_HAVE_F_PATH_MNT],
+[AC_MSG_CHECKING([if struct file has f_path.mnt])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/fs.h>
+],[
+       struct file *fp = NULL;
+       struct path  path;
+
+       path.mnt = fp->f_path.mnt;
+],[
+       AC_DEFINE(HAVE_F_PATH_MNT,1,[yes])
+       AC_MSG_RESULT([yes])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -1541,44 +1385,20 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_CONFIG_LRU_RESIZE
          LC_LLITE_LLOOP_MODULE
 
-         # RHEL4 patches
-         LC_EXPORT_TRUNCATE_COMPLETE
-
-         LC_BIT_SPINLOCK_H
-
          LC_CAPA_CRYPTO
          LC_CONFIG_RMTCLIENT
          LC_CONFIG_GSS
 
-         # 2.6.12
-         LC_RW_TREE_LOCK
-
-         #2.6.18 + RHEL5 (fc6)
-         LC_LINUX_FIEMAP_H
-
          # raid5-zerocopy patch
          LC_PAGE_CONSTANT
 
-        # 2.6.22
-         LC_FS_RENAME_DOES_D_MOVE
-
-         # 2.6.23
-         LC_UNREGISTER_BLKDEV_RETURN_INT
-         LC_PROCFS_USERS
-
          # 2.6.24
          LC_BIO_ENDIO_2ARG
          LC_PROCFS_DELETED
 
-         # 2.6.26
-         LC_FS_STRUCT_USE_PATH
-
          # 2.6.27
-         LC_SECURITY_PLUG  # for SLES10 SP2
-         LC_INODE_PERMISION_2ARGS
          LC_QUOTA_ON_5ARGS
          LC_QUOTA_OFF_3ARGS
-         LC_LOCK_MAP_ACQUIRE
 
          # 2.6.27.15-2 sles11
          LC_BI_HW_SEGMENTS
@@ -1594,6 +1414,7 @@ AC_DEFUN([LC_PROG_LINUX],
          # 2.6.35, 3.0.0
          LC_FILE_FSYNC
          LC_EXPORT_SIMPLE_SETATTR
+        LC_EXPORT_TRUNCATE_COMPLETE_PAGE
 
          # 2.6.36
          LC_FS_STRUCT_RWLOCK
@@ -1623,6 +1444,7 @@ AC_DEFUN([LC_PROG_LINUX],
         LC_INODE_DIO_WAIT
         LC_IOP_GET_ACL
         LC_FILE_LLSEEK_SIZE
+        LC_INODE_PERMISION_2ARGS
 
         # 3.1.1
         LC_BLOCKS_FOR_TRUNCATE
@@ -1657,6 +1479,7 @@ AC_DEFUN([LC_PROG_LINUX],
 
         # 3.9
         LC_HAVE_HLIST_FOR_EACH_3ARG
+        LC_HAVE_F_PATH_MNT
 
         #
         if test x$enable_server = xyes ; then
@@ -1723,22 +1546,6 @@ if test x$enable_liblustre_acl = xyes ; then
   AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
 fi
 
-# 2.6.29 blkdev_put has 2 arguments
-AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
-[AC_MSG_CHECKING([blkdev_put needs 2 parameters])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/fs.h>
-],[
-        blkdev_put(NULL, 0);
-],[
-        AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
-                [blkdev_put needs 2 paramters])
-        AC_MSG_RESULT([yes])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
 #
 # --enable-mpitest
 #
@@ -2012,10 +1819,6 @@ if test x$enable_pgstat_track = xyes ; then
         AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
                   [enable page state tracking code])
 fi
-
-         #2.6.29
-         LC_BLKDEV_PUT_2ARGS
-
 ])
 
 #