From a5e3cad879a5e75c09d6c67174c9ba14fbaf57a5 Mon Sep 17 00:00:00 2001 From: Greg Stein Date: Thu, 23 Aug 2001 12:35:53 +0000 Subject: [PATCH] Revamp how the version stuff is handled. Use the header file as the 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 | 4 +--- expat/configure.in | 22 +++++++--------------- expat/lib/Makefile.in | 3 +-- expat/lib/expat.dsp | 6 +----- expat/lib/{expat.h.in => expat.h} | 12 +++++++++--- expat/lib/xmlparse.c | 17 ++++++++++++++++- 6 files changed, 35 insertions(+), 29 deletions(-) rename expat/lib/{expat.h.in => expat.h} (98%) diff --git a/expat/Makefile.in b/expat/Makefile.in index f26c3fc1..43f33076 100644 --- a/expat/Makefile.in +++ b/expat/Makefile.in @@ -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 diff --git a/expat/configure.in b/expat/configure.in index 33d0e8a1..def9cd95 100644 --- a/expat/configure.in +++ b/expat/configure.in @@ -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 diff --git a/expat/lib/Makefile.in b/expat/lib/Makefile.in index f7e622dd..fd6635ec 100644 --- a/expat/lib/Makefile.in +++ b/expat/lib/Makefile.in @@ -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@ diff --git a/expat/lib/expat.dsp b/expat/lib/expat.dsp index 20aeac60..7206ea12 100644 --- a/expat/lib/expat.dsp +++ b/expat/lib/expat.dsp @@ -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" diff --git a/expat/lib/expat.h.in b/expat/lib/expat.h similarity index 98% rename from expat/lib/expat.h.in rename to expat/lib/expat.h index bbbf792d..e8d9b354 100644 --- a/expat/lib/expat.h.in +++ b/expat/lib/expat.h @@ -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 } diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c index df69b749..9f12594a 100644 --- a/expat/lib/xmlparse.c +++ b/expat/lib/xmlparse.c @@ -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 -- 2.50.1