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
CC = @CC@
LIBTOOL = @LIBTOOL@
-VERSION = @VERSION@
SUBDIRS = lib examples xmlwf
CONFIG_HEADERS = config.h
LIBRARY = libexpat.la
-DISTDIR = expat-$(VERSION)
+DISTDIR = expat-@EXPAT_MAJOR_VERSION@.@EXPAT_MINOR_VERSION@.@EXPAT_MICRO_VERSION@
DISTRIBUTION = $(DISTDIR).tar.gz
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
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
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)
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
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@
!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
# 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"
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
}
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