1#! /bin/sh
2#
3# This script gets the version number from the configure.ac file and
4# fills it in to other places where the version number is needed but
5# cannot be filled in by the configure script.
6#
7
8version=`grep AC_INIT configure.ac | cut -d , -f 2 | cut -d ')' -f 1`
9version=`echo $version`
10version_1=`echo $version | cut -d . -f 1`
11version_2=`echo $version | cut -d . -f 2`
12version_3=`echo $version | cut -d . -f 3`
13
14for file in python/setup.py \
15            win32/tre-config.h; do
16  cp $file.in $file.tmp
17  for replace in @TRE_VERSION@:$version \
18                 @TRE_VERSION_1@:$version_1 \
19                 @TRE_VERSION_2@:$version_2 \
20                 @TRE_VERSION_3@:$version_3; do
21     var=`echo $replace | cut -d : -f 1`
22     val=`echo $replace | cut -d : -f 2`
23     echo "Replacing $var by $val to $file"
24     cat $file.tmp \
25       | sed "s/$var/$val/g" \
26       > $file.tmp2
27     mv $file.tmp2 $file.tmp
28  done
29  mv $file.tmp $file
30done
31