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
This commit is contained in:
Greg Stein 2001-08-23 12:35:53 +00:00
parent 33589a12bc
commit a5e3cad879
6 changed files with 35 additions and 29 deletions

View 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

View 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
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_MAJOR_VERSION=1
EXPAT_MINOR_VERSION=95
EXPAT_EDIT=2
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

View 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@

View 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"

View 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
}

View 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