summaryrefslogtreecommitdiff
path: root/expat/conftools/get-version.sh
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2013-07-23 16:24:19 +0100
committerChris Liddell <chris.liddell@artifex.com>2015-07-20 18:21:17 +0100
commit6948650efd3fb9e2a70b8cf16aca57e9d0b7eb0a (patch)
tree5c2a1c671c1d4521f8a770d1e69e3d4342718030 /expat/conftools/get-version.sh
parent7fd9e0be26e67c36f87733bc89ea07dc26d9f839 (diff)
downloadghostpdl-6948650efd3fb9e2a70b8cf16aca57e9d0b7eb0a.tar.gz
Commit of build_consolidation branch
Squashed into one commit (see branch for details of the evolution of the branch). This brings gpcl6 and gxps into the Ghostscript build system, and a shared set of graphics library object files for all the interpreters. Also, brings the same configuration options to the pcl and xps products as we have for Ghostscript.
Diffstat (limited to 'expat/conftools/get-version.sh')
-rw-r--r--expat/conftools/get-version.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/expat/conftools/get-version.sh b/expat/conftools/get-version.sh
new file mode 100644
index 000000000..a70e0fb47
--- /dev/null
+++ b/expat/conftools/get-version.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# USAGE: get-version.sh path/to/expat.h
+#
+# This script will print Expat's version number on stdout. For example:
+#
+# $ ./conftools/get-version.sh ./lib/expat.h
+# 1.95.3
+# $
+#
+
+if test $# = 0; then
+ echo "ERROR: pathname for expat.h was not provided."
+ echo ""
+ echo "USAGE: $0 path/to/expat.h"
+ exit 1
+fi
+if test $# != 1; then
+ echo "ERROR: too many arguments were provided."
+ echo ""
+ echo "USAGE: $0 path/to/expat.h"
+ exit 1
+fi
+
+hdr="$1"
+if test ! -r "$hdr"; then
+ echo "ERROR: '$hdr' does not exist, or is not readable."
+ exit 1
+fi
+
+MAJOR_VERSION="`sed -n -e '/MAJOR_VERSION/s/[^0-9]*//gp' $hdr`"
+MINOR_VERSION="`sed -n -e '/MINOR_VERSION/s/[^0-9]*//gp' $hdr`"
+MICRO_VERSION="`sed -n -e '/MICRO_VERSION/s/[^0-9]*//gp' $hdr`"
+
+# Determine how to tell echo not to print the trailing \n. This is
+# similar to Autoconf's @ECHO_C@ and @ECHO_N@; however, we don't
+# generate this file via autoconf (in fact, get-version.sh is used
+# to *create* ./configure), so we just do something similar inline.
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ;;
+ *) ECHO_N= ECHO_C='\c' ;;
+esac
+
+echo $ECHO_N "$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$ECHO_C"