Generate XercesVersion.hpp

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@1824713 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5d67df..4254f89 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,6 +56,12 @@
   string(REGEX REPLACE "^INTERFACE_VERSION=(.*)" "\\1" xerces_c_interface_version "${line}")
   break()
 endforeach()
+file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/configure.ac" configure
+     REGEX "^GRAMMAR_SERIALIZATION_LEVEL=.*")
+foreach(line IN LISTS configure)
+  string(REGEX REPLACE "^GRAMMAR_SERIALIZATION_LEVEL=(.*)" "\\1" xerces_c_grammar_serialization_level "${line}")
+  break()
+endforeach()
 
 message(STATUS "Configuring Apache Xerces-C++ version ${xerces_c_version}")
 
@@ -85,6 +91,8 @@
 set(INTERFACE_VERSION_D "${INTERFACE_VERSION_MAJOR}.${INTERFACE_VERSION_MINOR}")
 set(INTERFACE_VERSION_U "${INTERFACE_VERSION_MAJOR}_${INTERFACE_VERSION_MINOR}")
 
+set(XERCES_GRAMMAR_SERIALIZATION_LEVEL "${xerces_c_grammar_serialization_level}")
+
 set(EXTRA_DIST
   xerces-c.spec
   xerces-c.pc.in
@@ -143,8 +151,8 @@
   ${CMAKE_CURRENT_BINARY_DIR}/src/xercesc/util/Xerces_autoconf_config.hpp
   @ONLY)
 configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/src/xercesc/util/Xerces_version_config.hpp.cmake.in
-  ${CMAKE_CURRENT_BINARY_DIR}/src/xercesc/util/Xerces_version_config.hpp
+  ${CMAKE_CURRENT_SOURCE_DIR}/src/xercesc/util/XercesVersion.hpp.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/src/xercesc/util/XercesVersion.hpp
   @ONLY)
 configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/doc/style/dtd/entities.ent.in
diff --git a/configure.ac b/configure.ac
index 331577d..5b68851 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@
 AC_PREREQ(2.60)
 AC_INIT([xerces-c],[3.2.1])
 INTERFACE_VERSION=3.2
+GRAMMAR_SERIALIZATION_LEVEL=7
 
 XERCES_VERSION_MAJOR=$(echo $PACKAGE_VERSION | cut -d. -f1)
 XERCES_VERSION_MINOR=$(echo $PACKAGE_VERSION | cut -d. -f2)
@@ -49,12 +50,17 @@
 AC_DEFINE_UNQUOTED([XERCES_VERSION_MINOR], $XERCES_VERSION_MINOR, [Definition of Xerces minor version])
 AC_DEFINE_UNQUOTED([XERCES_VERSION_REVISION], $XERCES_VERSION_REVISION, [Definition of Xerces patch version])
 
+AC_DEFINE_UNQUOTED([INTERFACE_VERSION_MAJOR], $INTERFACE_VERSION_MAJOR, [Definition of Xerces interface major version])
+AC_DEFINE_UNQUOTED([INTERFACE_VERSION_MINOR], $INTERFACE_VERSION_MINOR, [Definition of Xerces interface minor version])
+
+AC_DEFINE_UNQUOTED([XERCES_GRAMMAR_SERIALIZATION_LEVEL], $GRAMMAR_SERIALIZATION_LEVEL, [Definition of Xerces grammar serialization level])
+
 AC_CONFIG_SRCDIR([src/Makefile.am])
 AC_CONFIG_LIBOBJ_DIR([src])
 AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h src/xercesc/util/Xerces_autoconf_config.hpp])
-AC_CONFIG_HEADER([src/xercesc/util/Xerces_version_config.hpp])
+AC_CONFIG_HEADER([src/xercesc/util/XercesVersion.hpp])
 AC_CONFIG_FILES([Makefile
                  doc/Makefile
                  doc/Doxyfile
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 28cdc46..f79f458 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -553,7 +553,6 @@
   xercesc/util/ValueVectorOf.hpp
   xercesc/util/ValueVectorOf.c
   xercesc/util/XercesDefs.hpp
-  xercesc/util/XercesVersion.hpp
   xercesc/util/XMemory.hpp
   xercesc/util/XML256TableTranscoder.hpp
   xercesc/util/XML88591Transcoder.hpp
@@ -1345,9 +1344,9 @@
 unset(group_files)
 
 # Make sure cmake-generated Xerces_autoconf_config.hpp and
-# Xerces_version_config.hpp end up in a proper place when installed.
+# XercesVersion.hpp end up in a proper place when installed.
 install(
   FILES "${CMAKE_CURRENT_BINARY_DIR}/xercesc/util/Xerces_autoconf_config.hpp"
-        "${CMAKE_CURRENT_BINARY_DIR}/xercesc/util/Xerces_version_config.hpp"
+        "${CMAKE_CURRENT_BINARY_DIR}/xercesc/util/XercesVersion.hpp"
   DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/xercesc/util"
   COMPONENT "development")
diff --git a/src/Makefile.am b/src/Makefile.am
index 9756cd4..cc879f5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,12 +46,12 @@
 ${xinclude_headers}
 
 # Make sure autoconf-generated Xerces_autoconf_config.hpp and
-# Xerces_version_config.hpp end up in a proper place when installed.
+# XercesVersion.hpp end up in a proper place when installed.
 #
 autoconfheadersdir = $(includedir)/xercesc/util
 nodist_autoconfheaders_HEADERS = \
 	${top_builddir}/src/xercesc/util/Xerces_autoconf_config.hpp \
-	${top_builddir}/src/xercesc/util/Xerces_version_config.hpp
+	${top_builddir}/src/xercesc/util/XercesVersion.hpp
 
 # Compatibility library.
 #
@@ -60,7 +60,7 @@
         stricmp.h strnicmp.h towlower.h towupper.h \
         xercesc/NLS \
         xercesc/util/Xerces_autoconf_config.hpp.cmake.in \
-        xercesc/util/Xerces_version_config.hpp.cmake.in \
+        xercesc/util/XercesVersion.hpp.cmake.in \
         xercesc/util/MsgLoaders/ICU/resources
 
 libxerces_c_la_LIBADD = ${LTLIBOBJS}
@@ -694,7 +694,6 @@
 	xercesc/util/ValueVectorOf.hpp \
 	xercesc/util/ValueVectorOf.c \
 	xercesc/util/XercesDefs.hpp \
-	xercesc/util/XercesVersion.hpp \
 	xercesc/util/XMemory.hpp \
 	xercesc/util/XML256TableTranscoder.hpp \
 	xercesc/util/XML88591Transcoder.hpp \
diff --git a/src/xercesc/util/XercesVersion.hpp b/src/xercesc/util/XercesVersion.hpp.cmake.in
similarity index 96%
copy from src/xercesc/util/XercesVersion.hpp
copy to src/xercesc/util/XercesVersion.hpp.cmake.in
index dfd21f2..cfefb56 100644
--- a/src/xercesc/util/XercesVersion.hpp
+++ b/src/xercesc/util/XercesVersion.hpp.cmake.in
@@ -126,8 +126,9 @@
  * AND DO NOT MODIFY ANYTHING ELSE IN THIS VERSION HEADER FILE
  */
 
-// XERCES_VERSION_MAJOR, XERCES_VERSION_MINOR and XERCES_VERSION_REVISION
-#include <xercesc/util/Xerces_version_config.hpp>
+#define XERCES_VERSION_MAJOR @XERCES_VERSION_MAJOR@
+#define XERCES_VERSION_MINOR @XERCES_VERSION_MINOR@
+#define XERCES_VERSION_REVISION @XERCES_VERSION_REVISION@
 
 /***
  *
@@ -137,7 +138,7 @@
  * XERCES_GRAMMAR_SERIALIZATION_LEVEL = 7   size of line/column fields has changed
  *
  ***/
-#define XERCES_GRAMMAR_SERIALIZATION_LEVEL 7
+#define XERCES_GRAMMAR_SERIALIZATION_LEVEL @XERCES_GRAMMAR_SERIALIZATION_LEVEL@
 
 /** DO NOT MODIFY BELOW THIS LINE */
 
diff --git a/src/xercesc/util/XercesVersion.hpp b/src/xercesc/util/XercesVersion.hpp.in
similarity index 97%
rename from src/xercesc/util/XercesVersion.hpp
rename to src/xercesc/util/XercesVersion.hpp.in
index dfd21f2..2a58c1e 100644
--- a/src/xercesc/util/XercesVersion.hpp
+++ b/src/xercesc/util/XercesVersion.hpp.in
@@ -16,7 +16,7 @@
  */
 
 /*
- * $Id$
+ * $Id: XercesVersion.hpp 1824295 2018-02-15 11:17:15Z rleigh $
  */
 
 #if !defined(XERCESC_INCLUDE_GUARD_XERCESVERSION_HPP)
@@ -126,8 +126,9 @@
  * AND DO NOT MODIFY ANYTHING ELSE IN THIS VERSION HEADER FILE
  */
 
-// XERCES_VERSION_MAJOR, XERCES_VERSION_MINOR and XERCES_VERSION_REVISION
-#include <xercesc/util/Xerces_version_config.hpp>
+#undef XERCES_VERSION_MAJOR
+#undef XERCES_VERSION_MINOR
+#undef XERCES_VERSION_REVISION
 
 /***
  *
@@ -137,7 +138,7 @@
  * XERCES_GRAMMAR_SERIALIZATION_LEVEL = 7   size of line/column fields has changed
  *
  ***/
-#define XERCES_GRAMMAR_SERIALIZATION_LEVEL 7
+#undef XERCES_GRAMMAR_SERIALIZATION_LEVEL
 
 /** DO NOT MODIFY BELOW THIS LINE */
 
diff --git a/src/xercesc/util/Xerces_version_config.hpp.cmake.in b/src/xercesc/util/Xerces_version_config.hpp.cmake.in
deleted file mode 100644
index 3d0d982..0000000
--- a/src/xercesc/util/Xerces_version_config.hpp.cmake.in
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * $Id$
- */
-
-#ifndef XERCES_VERSION_CONFIG_HPP
-#define XERCES_VERSION_CONFIG_HPP
-
-// ---------------------------------------------------------------------------
-//  These defines are set by configure as appropriate for the platform.
-// ---------------------------------------------------------------------------
-
-#define XERCES_VERSION_MAJOR @XERCES_VERSION_MAJOR@
-#define XERCES_VERSION_MINOR @XERCES_VERSION_MINOR@
-#define XERCES_VERSION_REVISION @XERCES_VERSION_REVISION@
-
-#endif
diff --git a/src/xercesc/util/Xerces_version_config.hpp.in b/src/xercesc/util/Xerces_version_config.hpp.in
deleted file mode 100644
index e3cebf0..0000000
--- a/src/xercesc/util/Xerces_version_config.hpp.in
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * $Id$
- */
-
-#ifndef XERCES_VERSION_CONFIG_HPP
-#define XERCES_VERSION_CONFIG_HPP
-
-// ---------------------------------------------------------------------------
-//  These defines are set by configure as appropriate for the platform.
-// ---------------------------------------------------------------------------
-
-#undef XERCES_VERSION_MAJOR
-#undef XERCES_VERSION_MINOR
-#undef XERCES_VERSION_REVISION
-
-#endif