32b512e26c198d2b2d042788a9018bbd7e089b43
[openwrt/svn-archive/archive.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 PKG_REMOVE_FILES?=aclocal.m4
10
11 autoconf_bool = $(patsubst %,$(if $($(1)),--enable,--disable)-%,$(2))
12
13 # delete *.la-files from staging_dir - we can not yet remove respective lines within all package
14 # Makefiles, since backfire still uses libtool v1.5.x which (may) require those files
15 define libtool_remove_files
16 find $(1) -name '*.la' | $(XARGS) rm -f;
17 endef
18
19 define autoreconf
20 (cd $(PKG_BUILD_DIR); \
21 $(patsubst %,rm -f %;,$(PKG_REMOVE_FILES)) \
22 if [ -x ./autogen.sh ]; then \
23 ./autogen.sh || true; \
24 elif [ -f ./configure.ac ] || [ -f ./configure.in ]; then \
25 [ -f ./aclocal.m4 ] && [ ! -f ./acinclude.m4 ] && mv aclocal.m4 acinclude.m4; \
26 [ -d ./autom4te.cache ] && rm -rf autom4te.cache; \
27 $(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \
28 -B $(STAGING_DIR_HOST)/share/aclocal \
29 -B $(STAGING_DIR)/host/share/aclocal \
30 $(patsubst %,-I %,$(PKG_LIBTOOL_PATHS)) $(PKG_LIBTOOL_PATHS) || true; \
31 fi \
32 );
33 endef
34
35 Hooks/InstallDev/Post += libtool_remove_files
36
37 ifneq ($(filter libtool,$(PKG_FIXUP)),)
38 PKG_BUILD_DEPENDS += libtool
39 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
40 Hooks/Configure/Pre += autoreconf
41 endif
42 endif
43
44 ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
45 PKG_BUILD_DEPENDS += libtool
46 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
47 Hooks/Configure/Pre += autoreconf
48 endif
49 endif
50
51 ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
52 ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
53 Hooks/Configure/Pre += autoreconf
54 endif
55 endif