+ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
+ [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
+ [AC_CHECK_LIB([gssglue], [gss_init_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)
+
+ AC_KERBEROS_V5
+ fi
+])
+
+#
+# LC_FUNC_HAVE_CAN_SLEEP_ARG
+#
+# 2.6.5 kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()
+#
+AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
+[AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ int cansleep;
+ struct file *file;
+ struct file_lock *file_lock;
+ flock_lock_file_wait(file, file_lock, cansleep);
+],[
+ AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
+ [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# LC_FUNC_F_OP_FLOCK
+#
+# rhel4.2 kernel has f_op->flock field
+#
+AC_DEFUN([LC_FUNC_F_OP_FLOCK],
+[AC_MSG_CHECKING([if struct file_operations has flock field])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ struct file_operations ll_file_operations_flock;
+ ll_file_operations_flock.flock = NULL;
+],[
+ AC_DEFINE(HAVE_F_OP_FLOCK, 1,
+ [struct file_operations has flock field])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+AC_DEFUN([LC_QUOTA_READ],
+[AC_MSG_CHECKING([if kernel supports quota_read])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ struct super_operations sp;
+ void *i = (void *)sp.quota_read;
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# LC_COOKIE_FOLLOW_LINK
+#
+# kernel 2.6.13+ ->follow_link returns a cookie
+#
+
+AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
+[AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ #include <linux/namei.h>
+],[
+ struct dentry dentry;
+ struct nameidata nd;
+
+ dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
+],[
+ AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# LC_FUNC_RCU
+#
+# kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
+# call_rcu takes three parameters.
+#
+AC_DEFUN([LC_FUNC_RCU],
+[AC_MSG_CHECKING([if kernel have RCU supported])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/rcupdate.h>
+],[],[
+ AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
+ AC_MSG_RESULT([yes])
+
+ AC_MSG_CHECKING([if call_rcu takes three parameters])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/rcupdate.h>
+ ],[
+ struct rcu_head rh;
+ call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
+ ],[
+ AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+AC_DEFUN([LC_PERCPU_COUNTER],
+[AC_MSG_CHECKING([if have struct percpu_counter defined])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/percpu_counter.h>
+],[],[
+ AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
+ AC_MSG_RESULT([yes])
+
+ AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/percpu_counter.h>
+ ],[
+ struct percpu_counter c;
+ percpu_counter_init(&c, 0);
+ ],[
+ AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
+ arguments])
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+AC_DEFUN([LC_TASK_CLENV_STORE],
+[
+ AC_MSG_CHECKING([if we can store cl_env in task_struct])
+ if test x$have_task_clenv_store != xyes ; then
+ LC_TASK_CLENV_TUX_INFO
+ fi
+])
+
+# ~2.6.11
+
+AC_DEFUN([LC_S_TIME_GRAN],
+[AC_MSG_CHECKING([if super block has s_time_gran member])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ struct super_block sb;
+
+ return sb.s_time_gran;
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+AC_DEFUN([LC_SB_TIME_GRAN],
+[AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ return get_sb_time_gran(NULL);
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
+],[
+ AC_MSG_RESULT([no])
+])
+])