+# --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
+# However we continue to support this option through Lustre 2.5.
+AC_ARG_WITH([ldiskfs],
+ [],
+ [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
+ AS_IF([test x$withval != xyes -a x$withval != xno],
+ [AC_MSG_ERROR([the ldiskfs option is deprecated, and
+ no longer supports paths to external ldiskfs source])])
+ ]
+)
+
+AC_ARG_ENABLE([ldiskfs],
+ [AS_HELP_STRING([--disable-ldiskfs],
+ [disable ldiskfs osd (default is enable)])],
+ [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
+ [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
+ [AS_IF([test "${with_ldiskfs+set}" = set],
+ [enable_ldiskfs=$with_ldiskfs],
+ [enable_ldiskfs=maybe])
+ ]
+)
+
+AS_IF([test x$enable_server = xno],
+ [AS_CASE([$enable_ldiskfs],
+ [maybe], [enable_ldiskfs=no],
+ [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
+ )]
+)
+
+AS_IF([test x$enable_ldiskfs != xno],[
+ # In the future, we chould change enable_ldiskfs from maybe to
+ # either yes or no based on additional tests, e.g. whether a patch
+ # set is available for the detected kernel. For now, we just always
+ # set it to "yes".
+ AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
+
+ LDISKFS_LINUX_SERIES
+ LDISKFS_AC_PATCH_PROGRAM
+ LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
+ LB_EXT_PBLOCK
+ AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
+ AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
+ AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
+ AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
+ AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
+ AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
+])