#
-# LUSTRE_VERSION_VARIABLES
+# LUSTRE_VERSION_CPP_MACROS
#
-AC_DEFUN([LUSTRE_VERSION_VARIABLES], [
-
+AC_DEFUN([LUSTRE_VERSION_CPP_MACROS], [
LUSTRE_MAJOR=`echo AC_PACKAGE_VERSION | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\1/']`
LUSTRE_MINOR=`echo AC_PACKAGE_VERSION | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\2/']`
LUSTRE_PATCH=`echo AC_PACKAGE_VERSION | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\3/']`
LUSTRE_FIX=`echo AC_PACKAGE_VERSION | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\5/']`
AS_IF([test -z "$LUSTRE_FIX"], [LUSTRE_FIX="0"])
-m4_pattern_allow(AC_LUSTRE)
-[AC_LUSTRE_MAJOR]=$LUSTRE_MAJOR
-[AC_LUSTRE_MINOR]=$LUSTRE_MINOR
-[AC_LUSTRE_PATCH]=$LUSTRE_PATCH
-[AC_LUSTRE_FIX]=$LUSTRE_FIX
-
-AC_SUBST([AC_LUSTRE_MAJOR])
-AC_SUBST([AC_LUSTRE_MINOR])
-AC_SUBST([AC_LUSTRE_PATCH])
-AC_SUBST([AC_LUSTRE_FIX])
+AC_DEFINE_UNQUOTED([LUSTRE_MAJOR], [$LUSTRE_MAJOR], [First number in the Lustre version])
+AC_DEFINE_UNQUOTED([LUSTRE_MINOR], [$LUSTRE_MINOR], [Second number in the Lustre version])
+AC_DEFINE_UNQUOTED([LUSTRE_PATCH], [$LUSTRE_PATCH], [Third number in the Lustre version])
+AC_DEFINE_UNQUOTED([LUSTRE_FIX], [$LUSTRE_FIX], [Fourth number in the Lustre version])
+# Even though the code could just use VERSION or PACKAGE_VERSION directly,
+# we use this copy named LUSTRE_VERSION_STRING instead to maintain less
+# divergence from the Lustre client code in the upstream Linux kernel code.
+AC_DEFINE_UNQUOTED([LUSTRE_VERSION_STRING], ["$PACKAGE_VERSION"], [A copy of PACKAGE_VERSION])
])
#ifndef _LUSTRE_VER_H_
#define _LUSTRE_VER_H_
-/* This file automatically generated from lustre/include/lustre_ver.h.in,
- * based on parameters in lustre/autoconf/lustre-version.ac.
- * Changes made directly to this file will be lost. */
-#define LUSTRE_MAJOR @AC_LUSTRE_MAJOR@
-#define LUSTRE_MINOR @AC_LUSTRE_MINOR@
-#define LUSTRE_PATCH @AC_LUSTRE_PATCH@
-#define LUSTRE_FIX @AC_LUSTRE_FIX@
-#define LUSTRE_VERSION_STRING "@PACKAGE_VERSION@"
+/*
+ * LUSTRE_VERSION_STRING
+ *
+ * Note that some files may seem to include this header unnecessarily.
+ * If the file uses LUSTRE_VERSION_STRING, it is likely doing the include
+ * for compatibility with the Lustre code in the Linux kernel.
+ * In the Linux kernel, they are likely hard coding LUSTRE_VERSION_STRING
+ * right here in this file. The out-of-kernel Lustre code generates
+ * LUSTRE_VERSION_STRING in autoconf with AC_DEFINE.
+ */
#define OBD_OCD_VERSION(major, minor, patch, fix) \
(((major) << 24) + ((minor) << 16) + ((patch) << 8) + (fix))