diff options
author | gstein <gstein> | 2001-08-23 12:35:53 +0000 |
---|---|---|
committer | gstein <gstein> | 2001-08-23 12:35:53 +0000 |
commit | 36b55064c74097ea6b65eac6c4c3e5ef8724c3da (patch) | |
tree | 48e130eec088d86a5afb5c2650d260f5b3ec774f | |
parent | c05aaf62652f60c1ca3c25ee12e403e79c855cbe (diff) | |
download | libexpat-36b55064c74097ea6b65eac6c4c3e5ef8724c3da.tar.gz |
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
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | configure.in | 22 | ||||
-rw-r--r-- | lib/Makefile.in | 3 | ||||
-rw-r--r-- | lib/expat.dsp | 6 | ||||
-rw-r--r-- | lib/expat.h (renamed from lib/expat.h.in) | 12 | ||||
-rw-r--r-- | lib/xmlparse.c | 17 |
6 files changed, 35 insertions, 29 deletions
diff --git a/Makefile.in b/Makefile.in index f26c3fc..43f3307 100644 --- a/Makefile.in +++ b/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/configure.in b/configure.in index 33d0e8a..def9cd9 100644 --- a/configure.in +++ b/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/lib/Makefile.in b/lib/Makefile.in index f7e622d..fd6635e 100644 --- a/lib/Makefile.in +++ b/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/lib/expat.dsp b/lib/expat.dsp index 20aeac6..7206ea1 100644 --- a/lib/expat.dsp +++ b/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/lib/expat.h.in b/lib/expat.h index bbbf792..e8d9b35 100644 --- a/lib/expat.h.in +++ b/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/lib/xmlparse.c b/lib/xmlparse.c index df69b74..9f12594 100644 --- a/lib/xmlparse.c +++ b/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 |