autotools.mk: remove GNUmakefile before running autoreconf (spotted libgcrypt++)
[openwrt/staging/chunkeey.git] / include / autotools.mk
1 #
2 # Copyright (C) 2007-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 PKG_LIBTOOL_PATHS?=$(CONFIGURE_PATH)
9
10 autoconf_bool = $(patsubst %,$(if $($(1)),--enable,--disable)-%,$(2))
11
12 # delete *.la-files from staging_dir - we can not yet remove respective lines within all package
13 # Makefiles, since backfire still uses libtool v1.5.x which (may) require those files
14 define libtool_remove_files
15 find $(1) -name '*.la' | $(XARGS) rm -f;
16 endef
17
18 define autoreconf
19 (cd $(PKG_BUILD_DIR); \
20 if [ -x ./autogen.sh ]; then \
21 ./autogen.sh || true; \
22 elif [ -f ./configure.ac ] || [ -f ./configure.in ]; then \
23 rm -f ./GNUmakefile; \
24 $(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \
25 $(patsubst %,-I %,$(PKG_LIBTOOL_PATHS)) $(PKG_LIBTOOL_PATHS) || true; \
26 fi \
27 );
28 endef
29
30 Hooks/InstallDev/Post += libtool_remove_files
31
32 ifneq ($(filter libtool,$(PKG_FIXUP)),)
33 PKG_BUILD_DEPENDS += libtool
34 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
35 Hooks/Configure/Pre += autoreconf
36 endif
37 endif
38
39 ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
40 PKG_BUILD_DEPENDS += libtool
41 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
42 Hooks/Configure/Pre += autoreconf
43 endif
44 endif
45