Commit 8dc311320c19b6b008fc6f55218b8f238ec982cb

Alexei Podtelezhnikov 2021-01-22T20:27:15

* autogen.sh: Absorb `version.sed'. * version.sed: Removed.

diff --git a/ChangeLog b/ChangeLog
index 6a72a89..1e4c9a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2021-01-22  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* autogen.sh: Absorb `version.sed'.
+	* version.sed: Removed.
+
 2021-01-19  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
 	* srd/base/ftlcdfil.c (FT_Library_SetLcdGeometry): Fix return value.
diff --git a/autogen.sh b/autogen.sh
index 41aad2d..1c7e815 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -138,18 +138,25 @@ check_tool_version $ACLOCAL    aclocal    ACLOCAL    1.10.1
 check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4
 check_tool_version $AUTOCONF   autoconf   AUTOCONF   2.62
 
-# This sets freetype_major, freetype_minor, and freetype_patch.
-eval `sed -nf version.sed include/freetype/freetype.h`
-
-# We set freetype-patch to an empty value if it is zero.
-if test "$freetype_patch" = ".0"; then
-  freetype_patch=
+# This sets FREETYPE version.
+eval `sed -n \
+-e 's/^#define  *\(FREETYPE_MAJOR\)  *\([0-9][0-9]*\).*/\1=\2/p' \
+-e 's/^#define  *\(FREETYPE_MINOR\)  *\([0-9][0-9]*\).*/\1=\2/p' \
+-e 's/^#define  *\(FREETYPE_PATCH\)  *\([0-9][0-9]*\).*/\1=\2/p' \
+include/freetype/freetype.h`
+
+if test "$FREETYPE_PATCH" = "0"; then
+  FREETYPE=$FREETYPE_MAJOR.$FREETYPE_MINOR
+else
+  FREETYPE=$FREETYPE_MAJOR.$FREETYPE_MINOR.$FREETYPE_PATCH
 fi
 
+echo "FreeType $FREETYPE:"
+
 cd builds/unix
 
 echo "generating \`configure.ac'"
-sed -e "s;@VERSION@;$freetype_major$freetype_minor$freetype_patch;" \
+sed -e "s;@VERSION@;$FREETYPE;" \
   < configure.raw > configure.ac
 
 run aclocal -I . --force
diff --git a/version.sed b/version.sed
deleted file mode 100644
index c281ff5..0000000
--- a/version.sed
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /usr/bin/sed -nf
-
-s/^#define  *FREETYPE_MAJOR  *\([^ ][^ ]*\).*$/freetype_major="\1" ;/p
-s/^#define  *FREETYPE_MINOR  *\([^ ][^ ]*\).*$/freetype_minor=".\1" ;/p
-s/^#define  *FREETYPE_PATCH  *\([^ ][^ ]*\).*$/freetype_patch=".\1" ;/p