Revamp how the version stuff is handled. Use the header file as the
authorGreg Stein <gstein@users.sourceforge.net>
Thu, 23 Aug 2001 12:35:53 +0000 (12:35 +0000)
committerGreg Stein <gstein@users.sourceforge.net>
Thu, 23 Aug 2001 12:35:53 +0000 (12:35 +0000)
original, and extract the numbers within the configure script.

* configure.in: extract the numbers from lib/expat.h

* Makefile.in: simplify the construction of DISTDIR

* lib/Makefile.in: no need to define the VERSION preprocessor symbol

* lib/expat.dsp: do not define VERSION (changed, but untested!)

* lib/xmlparse.c: revamp the XML_ExpatVersion() function

* lib/expat.h(.in): just ship the baby, rather than generating it

expat/Makefile.in
expat/configure.in
expat/lib/Makefile.in
expat/lib/expat.dsp
expat/lib/expat.h [moved from expat/lib/expat.h.in with 98% similarity]
expat/lib/xmlparse.c

index f26c3fc1252662596d20e29bc10a0986923521c0..43f33076415d1d5f4e8d4752f50ff4f0cca47fb2 100644 (file)
@@ -52,7 +52,6 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs
 CC = @CC@
 
 LIBTOOL = @LIBTOOL@
-VERSION = @VERSION@
 
 SUBDIRS = lib examples xmlwf
 CONFIG_HEADERS = config.h
@@ -61,7 +60,7 @@ APIHEADER = expat.h
 LIBRARY = libexpat.la
 
 
-DISTDIR = expat-$(VERSION)
+DISTDIR = expat-@EXPAT_MAJOR_VERSION@.@EXPAT_MINOR_VERSION@.@EXPAT_MICRO_VERSION@
 DISTRIBUTION = $(DISTDIR).tar.gz
 
 
@@ -83,7 +82,6 @@ clean:
 distclean: clean
        rm -f config.h config.status config.log config.cache libtool
        rm -f Makefile lib/Makefile examples/Makefile xmlwf/Makefile tests/Makefile
-       rm -f lib/expat.h
 
 extraclean: distclean
        rm -f config.h.in configure
index 33d0e8a16734dd619bf8376bf8dcbe35628591e7..def9cd95ef053b7c23b25553c4bc0af8c78a5885 100644 (file)
@@ -13,19 +13,12 @@ dnl
 AC_INIT(Makefile.in)
 AC_CONFIG_AUX_DIR(conftools)
 
-dnl
-dnl Follow the GNU/Linux convention of odd number minor version for
-dnl beta/development releases and even number minor version for stable
-dnl releases. Edit is bumped with each release and set to 0 with
-dnl change to major or minor version.
-dnl
-
-EXPAT_MAJOR_VERSION=1
-EXPAT_MINOR_VERSION=95
-EXPAT_EDIT=2
+changequote({,})
+EXPAT_MAJOR_VERSION="`sed -n '/MAJOR_VERSION/s/[^0-9]*//gp' lib/expat.h`"
+EXPAT_MINOR_VERSION="`sed -n '/MINOR_VERSION/s/[^0-9]*//gp' lib/expat.h`"
+EXPAT_MICRO_VERSION="`sed -n '/MICRO_VERSION/s/[^0-9]*//gp' lib/expat.h`"
+changequote([,])
 
-EXPAT_VERSION=$EXPAT_MAJOR_VERSION.$EXPAT_MINOR_VERSION.$EXPAT_EDIT
-VERSION=$EXPAT_VERSION
 
 dnl
 dnl Increment LIBREVISION if source code has changed at all
@@ -50,10 +43,9 @@ sinclude(conftools/ac_c_bigendian_cross.m4)
 AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
 
-AC_SUBST(VERSION)
 AC_SUBST(EXPAT_MAJOR_VERSION)
 AC_SUBST(EXPAT_MINOR_VERSION)
-AC_SUBST(EXPAT_EDIT)
+AC_SUBST(EXPAT_MICRO_VERSION)
 
 AC_SUBST(LIBCURRENT)
 AC_SUBST(LIBREVISION)
@@ -102,7 +94,7 @@ dnl this allows this (and the generated configure script) to work
 dnl in "embedded distributions", where only part of the Expat sources
 dnl are included in the sources for another project.
 
-OUTPUT="Makefile lib/Makefile lib/expat.h"
+OUTPUT="Makefile lib/Makefile"
 if test -d ${srcdir}/xmlwf; then
     OUTPUT="$OUTPUT xmlwf/Makefile"
 fi
index f7e622dd72b0cf0a53bc070eeb303a1e26abf5f0..fd6635ec18adb78d1ca31b457750fcf9fc481fbd 100644 (file)
@@ -33,13 +33,12 @@ top_builddir = ..
 
 CC = @CC@
 LIBTOOL = @LIBTOOL@
-VERSION = @VERSION@
 
 LIBRARY = libexpat.la
 LTOBJECTS = xmlparse.lo xmltok.lo xmlrole.lo
 
 INCLUDES = -I$(srcdir) -I. -I..
-DEFS = @DEFS@ -DVERSION='"expat_$(VERSION)"'
+DEFS = @DEFS@
 
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
index 20aeac60b18479db0c74b3deacad22a345ca24b2..7206ea1273785fdff6bd38baf451fdffc50e38cd 100644 (file)
@@ -96,11 +96,9 @@ SOURCE=.\xmlparse.c
 
 !IF  "$(CFG)" == "expat - Win32 Release"
 
-# ADD CPP /D VERSION=\"expat_1.95.2\"
-
 !ELSEIF  "$(CFG)" == "expat - Win32 Debug"
 
-# ADD CPP /GX- /Od /D VERSION=\"expat_1.95.2\"
+# ADD CPP /GX- /Od
 
 !ENDIF 
 
@@ -108,12 +106,10 @@ SOURCE=.\xmlparse.c
 # Begin Source File
 
 SOURCE=.\xmlrole.c
-# ADD CPP /D VERSION=\"expat_1.95.2\"
 # End Source File
 # Begin Source File
 
 SOURCE=.\xmltok.c
-# ADD CPP /D VERSION=\"expat_1.95.2\"
 # End Source File
 # End Group
 # Begin Group "Header Files"
similarity index 98%
rename from expat/lib/expat.h.in
rename to expat/lib/expat.h
index bbbf792d3a065a4a43b29ec44d32a49fc6b17525..e8d9b354029ac4f3c7dc70efa857ae6531c72c07 100644 (file)
@@ -724,9 +724,15 @@ typedef struct {
 XMLPARSEAPI(XML_Expat_Version)
 XML_ExpatVersionInfo(void);
 
-#define XML_MAJOR_VERSION @EXPAT_MAJOR_VERSION@
-#define XML_MINOR_VERSION @EXPAT_MINOR_VERSION@
-#define XML_MICRO_VERSION @EXPAT_EDIT@
+
+/* Expat follows the GNU/Linux convention of odd number minor version for
+   beta/development releases and even number minor version for stable
+   releases. Micro is bumped with each release, and set to 0 with each
+   change to major or minor version. */
+
+#define XML_MAJOR_VERSION 1
+#define XML_MINOR_VERSION 95
+#define XML_MICRO_VERSION 2
 
 #ifdef __cplusplus
 }
index df69b749a5d8c1cfd1e22b9fb9b9e7534f018676..9f12594afc040d3cac2633f40b344d0a9deed96d 100644 (file)
@@ -1329,7 +1329,22 @@ const XML_LChar *XML_ErrorString(int code)
 
 const XML_LChar *
 XML_ExpatVersion(void) {
-  return VERSION;
+
+  /* V1 is used to string-ize the version number. However, it would
+     string-ize the actual version macro *names* unless we get them
+     substituted before being passed to V1. CPP is defined to expand
+     a macro, then rescan for more expansions. Thus, we use V2 to expand
+     the version macros, then CPP will expand the resulting V1() macro
+     with the correct numerals. */
+  /* ### I'm assuming cpp is portable in this respect... */
+
+#define V1(a,b,c) "expat_"#a"."#b"."#c
+#define V2(a,b,c) V1(a,b,c)
+
+  return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION);
+
+#undef V1
+#undef V2
 }
 
 XML_Expat_Version