From ce9b49046cdfc26f203b45b318b136d08b5a43b9 Mon Sep 17 00:00:00 2001
From: Nicolas Thill <nico@openwrt.org>
Date: Sat, 31 Jan 2015 08:15:51 +0000
Subject: [PATCH] include: improve 'gettext-version' fixup

 * enclose the fixup in brackets
 * match anything in the call to AM_GNU_GETTEXT_VERSION
 * call it early (before autoreconf if both are specified)
 * chain a call to autoreconf since it messes with configure.ac

Signed-off-by: Nicolas Thill <nico@openwrt.org>

SVN-Revision: 44225
---
 include/autotools.mk | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/include/autotools.mk b/include/autotools.mk
index 7ebeff6c76..3316998dc9 100644
--- a/include/autotools.mk
+++ b/include/autotools.mk
@@ -84,14 +84,22 @@ define patch_libtool_target
 endef
 
 define gettext_version_target
-  cd $(PKG_BUILD_DIR) && \
-  GETTEXT_VERSION=$(shell $(STAGING_DIR_HOST)/bin/gettext -V | $(STAGING_DIR_HOST)/bin/sed -ne '1s/.* //p') && \
-  $(STAGING_DIR_HOST)/bin/sed \
-  -i $(PKG_BUILD_DIR)/configure.ac \
-  -e "s/AM_GNU_GETTEXT_VERSION(\[.*\])/AM_GNU_GETTEXT_VERSION(\[$$$$GETTEXT_VERSION\])/g" && \
-  $(STAGING_DIR_HOST)/bin/autopoint --force
+	(cd $(PKG_BUILD_DIR) && \
+		GETTEXT_VERSION=$(shell $(STAGING_DIR_HOST)/bin/gettext -V | $(STAGING_DIR_HOST)/bin/sed -ne '1s/.* //p') && \
+		$(STAGING_DIR_HOST)/bin/sed \
+			-i $(PKG_BUILD_DIR)/configure.ac \
+			-e "s/AM_GNU_GETTEXT_VERSION(.*)/AM_GNU_GETTEXT_VERSION(\[$$$$GETTEXT_VERSION\])/g" && \
+		$(STAGING_DIR_HOST)/bin/autopoint --force \
+	);
 endef
 
+ifneq ($(filter gettext-version,$(PKG_FIXUP)),)
+  Hooks/Configure/Pre += gettext_version_target
+ ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
+  Hooks/Configure/Pre += autoreconf_target
+ endif
+endif
+
 ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
   Hooks/Configure/Pre += patch_libtool_target
 endif
@@ -116,10 +124,6 @@ ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
   endif
 endif
 
-ifneq ($(filter gettext-version,$(PKG_FIXUP)),)
-  Hooks/Configure/Pre += gettext_version_target
-endif
-
 
 HOST_FIXUP?=$(PKG_FIXUP)
 HOST_LIBTOOL_PATHS?=$(if $(PKG_LIBTOOL_PATHS),$(PKG_LIBTOOL_PATHS),.)
-- 
GitLab