]>
git.saurik.com Git - wxWidgets.git/blob - src/expat/conftools/get-version.sh
3 # USAGE: get-version.sh path/to/expat.h
5 # This script will print Expat's version number on stdout. For example:
7 # $ ./conftools/get-version.sh ./lib/expat.h
13 echo "ERROR: pathname for expat.h was not provided."
15 echo "USAGE: $0 path/to/expat.h"
19 echo "ERROR: too many arguments were provided."
21 echo "USAGE: $0 path/to/expat.h"
26 if test ! -r "$hdr"; then
27 echo "ERROR: '$hdr' does not exist, or is not readable."
31 MAJOR_VERSION
="`sed -n -e '/MAJOR_VERSION/s/[^0-9]*//gp' $hdr`"
32 MINOR_VERSION
="`sed -n -e '/MINOR_VERSION/s/[^0-9]*//gp' $hdr`"
33 MICRO_VERSION
="`sed -n -e '/MICRO_VERSION/s/[^0-9]*//gp' $hdr`"
35 # Determine how to tell echo not to print the trailing \n. This is
36 # similar to Autoconf's @ECHO_C@ and @ECHO_N@; however, we don't
37 # generate this file via autoconf (in fact, get-version.sh is used
38 # to *create* ./configure), so we just do something similar inline.
39 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
40 *c
*,-n*) ECHO_N
= ECHO_C
='
42 *c
*,* ) ECHO_N
=-n ECHO_C
= ;;
43 *) ECHO_N
= ECHO_C
='\c' ;;
46 echo $ECHO_N "$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$ECHO_C"