-# XXX the libtool fixups got deactivated in the course of switching to libtool2 in trunk XXX
-# ifneq ($(filter libtool,$(PKG_FIXUP)),)
-# PKG_BUILD_DEPENDS += libtool
-# Hooks/Configure/Pre += update_libtool remove_version_check
-# Hooks/Configure/Post += update_libtool
-# Hooks/InstallDev/Post += libtool_fixup_libdir
-# endif
-#
-# ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
-# PKG_BUILD_DEPENDS += libtool
-# Hooks/Configure/Pre += update_libtool_ucxx remove_version_check
-# Hooks/Configure/Post += update_libtool_ucxx
-# Hooks/InstallDev/Post += libtool_fixup_libdir
-# endif
+ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
+ Hooks/Configure/Pre += patch_libtool_target
+endif
+
+ifneq ($(filter libtool,$(PKG_FIXUP)),)
+ PKG_BUILD_DEPENDS += libtool libintl libiconv
+ ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
+ Hooks/Configure/Pre += autoreconf_target
+ endif
+endif
+
+ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
+ PKG_BUILD_DEPENDS += libtool libintl libiconv
+ ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
+ Hooks/Configure/Pre += autoreconf_target
+ endif
+endif
+
+ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
+ ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
+ Hooks/Configure/Pre += autoreconf_target
+ 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),.)
+HOST_AUTOMAKE_PATHS?=$(if $(PKG_AUTOMAKE_PATHS),$(PKG_AUTOMAKE_PATHS),.)
+HOST_MACRO_PATHS?=$(if $(PKG_MACRO_PATHS),$(PKG_MACRO_PATHS),m4)
+HOST_REMOVE_FILES?=$(PKG_REMOVE_FILES)
+
+define autoreconf_host
+ $(strip $(call autoreconf, \
+ $(HOST_BUILD_DIR), $(HOST_REMOVE_FILES), \
+ $(HOST_AUTOMAKE_PATHS), $(HOST_LIBTOOL_PATHS), \
+ $(HOST_MACRO_PATHS)))
+endef
+
+define patch_libtool_host
+ $(strip $(call patch_libtool, \
+ $(HOST_BUILD_DIR)))
+endef
+
+ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
+ Hooks/HostConfigure/Pre += patch_libtool_host
+endif
+
+ifneq ($(filter patch-libtool,$(HOST_FIXUP)),)
+ Hooks/HostConfigure/Pre += $(strip $(call patch_libtool,$(HOST_BUILD_DIR)))
+endif
+
+ifneq ($(filter libtool,$(HOST_FIXUP)),)
+ ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
+ Hooks/HostConfigure/Pre += autoreconf_host
+ endif
+endif
+
+ifneq ($(filter libtool-ucxx,$(HOST_FIXUP)),)
+ ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
+ Hooks/HostConfigure/Pre += autoreconf_host
+ endif
+endif