Skip to content

Commit

Permalink
Generate config/configure.in directly
Browse files Browse the repository at this point in the history
from configure rather than substitute it from Makefile. Eventually we
might want to get rid of configure.in completely, doing on-the-fly
checks at the time of `ct-ng build`, but that is left for another day.

Signed-off-by: Alexey Neyman <stilor@att.net>
  • Loading branch information
stilor committed Apr 22, 2017
1 parent 6f5afbd commit 2c0fb22
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 26 deletions.
22 changes: 1 addition & 21 deletions Makefile.in
Expand Up @@ -89,9 +89,6 @@ export curses_hdr := @ac_ct_curses_hdr@
export gettext := @gettext@
export CPU_COUNT := @CPU_COUNT@

# config options to push down to kconfig
KCONFIG:= @kconfig_options@

###############################################################################
# Non-configure variables
MAN_SECTION := 1
Expand Down Expand Up @@ -169,8 +166,7 @@ build-bin: $(PROG_NAME) \
scripts/showConfig.sh
$(call __silent,CHMOD,$^)chmod 755 $^

build-lib: config/configure.in \
paths.mk \
build-lib: paths.mk \
paths.sh

build-lib-kconfig:
Expand Down Expand Up @@ -222,21 +218,6 @@ paths.mk: FORCE
paths.sh: FORCE
$(call __silent,GEN,$@){ $(foreach w,$(__paths_vars),$(if $($w),echo 'export $w="$(subst ','\'',$($w))"';)) :; } >$@

config/configure.in: FORCE
$(call __silent,GEN,$@) \
{ printf "# Generated file, do not edit\n"; \
printf "# Default values as found by ./configure\n"; \
for var in $(KCONFIG); do \
printf "\n"; \
printf "config CONFIGURE_$${var%%=*}\n"; \
if [ "$${var#*=}" = "y" ]; then \
printf " def_bool y\n"; \
else \
printf " bool\n"; \
fi; \
done; \
} >$@

FORCE:

#--------------------------------------
Expand All @@ -251,7 +232,6 @@ clean-bin:

clean-lib:
$(call __silent_rm,paths.mk paths.sh)
$(call __silent_rm,config/configure.in)

clean-lib-kconfig:
$(call __silent,ENTER,kconfig)$(MAKE) -C kconfig clean
Expand Down
46 changes: 46 additions & 0 deletions config/configure.in.in
@@ -0,0 +1,46 @@
# Default values as found by ./configure

config CONFIGURE_has_static_link
@KCONFIG_static_link@

config CONFIGURE_has_wget
@KCONFIG_wget@

config CONFIGURE_has_curl
@KCONFIG_curl@

config CONFIGURE_has_stat_flavor_BSD
@KCONFIG_stat_flavor_BSD@

config CONFIGURE_has_stat_flavor_GNU
@KCONFIG_stat_flavor_GNU@

config CONFIGURE_has_make_3_81_or_newer
@KCONFIG_make_3_81_or_newer@

config CONFIGURE_has_libtool_2_4_or_newer
@KCONFIG_libtool_2_4_or_newer@

config CONFIGURE_has_libtoolize_2_4_or_newer
@KCONFIG_libtoolize_2_4_or_newer@

config CONFIGURE_has_autoconf_2_63_or_newer
@KCONFIG_autoconf_2_63_or_newer@

config CONFIGURE_has_autoreconf_2_63_or_newer
@KCONFIG_autoreconf_2_63_or_newer@

config CONFIGURE_has_automake_1_15_or_newer
@KCONFIG_automake_1_15_or_newer@

config CONFIGURE_has_gnu_m4_1_4_12_or_newer
@KCONFIG_gnu_m4_1_4_12_or_newer@

config CONFIGURE_has_cvs
@KCONFIG_cvs@

config CONFIGURE_has_svn
@KCONFIG_svn@

config CONFIGURE_has_git
@KCONFIG_git@
9 changes: 4 additions & 5 deletions configure.ac
Expand Up @@ -65,10 +65,9 @@ AC_DEFUN(
AC_DEFUN(
[ACX_SET_KCONFIG_OPTION],
[AS_IF(
[test -n "$$1"],
[kconfig_options="$kconfig_options has_$1=y"],
[kconfig_options="$kconfig_options has_$1"])
])
[test -n "$$1"],
[AC_SUBST([KCONFIG_$1], ["def_bool y"])],
[AC_SUBST([KCONFIG_$1], ["bool"])])])

# Check if a given program is available with a particular version.
# ACX_PROG_VERSION(VAR, HELP, PROG, SRCH, VERSION_CHECK[, CONFIG_OPT])
Expand Down Expand Up @@ -466,5 +465,5 @@ AS_IF(
#--------------------------------------------------------------------
# Finally, generate the output file(s)
#--------------------------------------------------------------------
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([Makefile config/configure.in])
AC_OUTPUT

0 comments on commit 2c0fb22

Please sign in to comment.