@@ -173,8 +173,12 @@ qconf-cxxobjs := qconf.o
qconf-objs := zconf.tab.o
gconf-objs := gconf.o zconf.tab.o
+frontends-objs := $(conf-objs) $(mconf-objs) $(nconf-objs)
+
hostprogs-y :=
+KC_CHECK := gettext
+
ifeq ($(MAKECMDGOALS),nconfig)
hostprogs-y += nconf
endif
@@ -205,7 +209,7 @@ endif
hostprogs-y += conf
-clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck
+clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck .tmp_check
clean-files += zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
clean-files += mconf qconf gconf nconf
clean-files += config.pot linux.pot
@@ -218,9 +222,6 @@ $(obj)/dochecklxdialog:
always := dochecklxdialog
-# Add environment specific flags
-HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
-
# generated files seem to need this to find local include files
HOSTCFLAGS_lex.zconf.o := -I$(src)
HOSTCFLAGS_zconf.tab.o := -I$(src)
@@ -316,8 +317,21 @@ $(obj)/.tmp_gtkcheck:
echo "*"; \
false; \
fi
+
+need-check := $(addprefix $(obj)/,$(frontends-objs))
+
+$(need-check): $(obj)/.tmp_check
+
+-include $(obj)/.tmp_check
+
+KC_CHECKED := $(foreach check,$(KC_CHECK),$(if $(KCONFIG_CHECKED_$(check)),$(check),))
+ifneq ($(KC_CHECK),$(KC_CHECKED))
+$(obj)/.tmp_check: FORCE
endif
+$(obj)/.tmp_check: $(src)/Makefile
+ $(Q)$(srctree)/$(src)/check.sh $(KC_CHECK)
+
$(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
$(obj)/qconf.o: $(obj)/qconf.moc
@@ -1,14 +1,38 @@
#!/bin/sh
-# Needed for systems without gettext
-$* -xc -o /dev/null - > /dev/null 2>&1 << EOF
-#include <libintl.h>
-int main()
+#
+
+set -e
+
+check_gettext()
{
- gettext("");
- return 0;
+
+ echo '
+ #include <libintl.h>
+ int main()
+ {
+ gettext("");
+ return 0;
+ }' | \
+ {
+ $* -xc -o /dev/null - > /dev/null 2>&1 || \
+ echo HOST_EXTRACFLAGS += -DKBUILD_NO_NLS >> ${obj}/.tmp_check
+ }
}
-EOF
-if [ ! "$?" -eq "0" ]; then
- echo -DKBUILD_NO_NLS;
-fi
+rm -f ${obj}/.tmp_check
+
+for arg in $*; do
+ case $arg in
+ gettext) ;;
+ *)
+ echo " *"
+ echo " * Do not know how to check for \`$arg'"
+ echo " *"
+ false
+ ;;
+ esac
+ echo " CHECK $arg"
+
+ check_$arg
+ echo "KCONFIG_CHECKED_$arg := 1" >> ${obj}/.tmp_check
+done