1.1 --- a/.hgignore Thu May 26 18:33:53 2011 +0200
1.2 +++ b/.hgignore Thu May 26 22:51:03 2011 +0200
1.3 @@ -13,6 +13,7 @@
1.4 kconfig/?conf
1.5 kconfig/**.o
1.6 kconfig/**.dep
1.7 +config/configure.in
1.8 config.gen/
1.9 .config
1.10 .config.2
2.1 --- a/Makefile.in Thu May 26 18:33:53 2011 +0200
2.2 +++ b/Makefile.in Thu May 26 22:51:03 2011 +0200
2.3 @@ -58,6 +58,9 @@
2.4 readelf:= @@readelf@@
2.5 patch := @@patch@@
2.6
2.7 +# config options to push down to kconfig
2.8 +KCONFIG:= @@KCONFIG@@
2.9 +
2.10 ###############################################################################
2.11 # Non-configure variables
2.12 MAN_SECTION := 1
2.13 @@ -115,7 +118,7 @@
2.14 build-bin: ct-ng scripts/crosstool-NG.sh scripts/saveSample.sh scripts/showTuple.sh
2.15 @chmod 755 $^
2.16
2.17 -build-lib: paths.mk
2.18 +build-lib: paths.mk config/configure.in
2.19
2.20 build-doc:
2.21
2.22 @@ -142,7 +145,7 @@
2.23 # use := to set variables, although that will incur a (very small)
2.24 # penalty from the Makefile that includes it (due to re-evaluation at
2.25 # each call).
2.26 -paths.mk:
2.27 +paths.mk: FORCE
2.28 @echo " GEN '$@'"
2.29 @(echo "export install=$(install)"; \
2.30 echo "export bash=$(bash)"; \
2.31 @@ -156,6 +159,22 @@
2.32 echo "export patch=$(patch)"; \
2.33 ) >paths.mk
2.34
2.35 +config/configure.in: FORCE
2.36 + @echo " GEN '$@'"
2.37 + @{ printf "# Generated file, do not edit\n"; \
2.38 + printf "# Default values as found by ./configure\n"; \
2.39 + for var in $(KCONFIG); do \
2.40 + printf "\n"; \
2.41 + printf "config CONFIGURE_$${var%%=*}\n"; \
2.42 + printf " bool\n"; \
2.43 + if [ "$${var#*=}" = "y" ]; then \
2.44 + printf " default y\n"; \
2.45 + fi; \
2.46 + done; \
2.47 + } >$@
2.48 +
2.49 +FORCE:
2.50 +
2.51 #--------------------------------------
2.52 # Clean rules
2.53
2.54 @@ -172,6 +191,8 @@
2.55 clean-lib:
2.56 @echo " RM 'paths.mk'"
2.57 @rm -f paths.mk
2.58 + @echo " RM 'config/configure.in'"
2.59 + @rm -f config/configure.in
2.60
2.61 clean-doc:
2.62
3.1 --- a/config/config.in Thu May 26 18:33:53 2011 +0200
3.2 +++ b/config/config.in Thu May 26 22:51:03 2011 +0200
3.3 @@ -1,4 +1,5 @@
3.4 mainmenu "The crosstool-NG configuration menu"
3.5 +source "config/configure.in"
3.6 source "config/backend.in"
3.7 source "config/global.in"
3.8 source "config/target.in"
4.1 --- a/configure Thu May 26 18:33:53 2011 +0200
4.2 +++ b/configure Thu May 26 22:51:03 2011 +0200
4.3 @@ -69,12 +69,24 @@
4.4 # var_list is a list of variables, each one holding a path to a
4.5 # tool, either detected by ./configure, or specified by the user.
4.6 var_list=""
4.7 +kconfig_list=""
4.8
4.9 # This function adds a variable name to the above list of variable names.
4.10 # $1: the name of the variable to add to the list
4.11 add_to_var_list() {
4.12 + local v
4.13 + for v in ${var_list}; do
4.14 + [ "${v}" = "${1}" ] && return 0
4.15 + done
4.16 var_list="${var_list} ${1}"
4.17 }
4.18 +add_to_kconfig_list() {
4.19 + local k
4.20 + for k in ${kconfig_list}; do
4.21 + [ "${k}" = "${1}" ] && return 0
4.22 + done
4.23 + kconfig_list="${kconfig_list} ${1}"
4.24 +}
4.25
4.26 # A function to test for required tools/headers/libraries
4.27 # Return 0 (true) if found, !0 (false) if not found
4.28 @@ -97,23 +109,32 @@
4.29 # optional, defaults to: '${prog}: none found'
4.30 # eg: err="'bash' 3.x or above was not found"
4.31 # Note: err may be printed by caller, not us
4.32 +# $*: kconfig=<var_name>
4.33 +# the name of a variable to pass down to kconfig if
4.34 +# the prog/inc/lib was found
4.35 +# optional, defaults to none
4.36 +# eg: kconfig=has_libncurses
4.37 check_for() {
4.38 local val
4.39 local item
4.40 local where
4.41 local status
4.42
4.43 - # Note: prog/inc/lib and var/ver/err are set here,
4.44 + # Note: prog/inc/lib and var/kconfig/ver/err are set here,
4.45 # but declared by the caller (because it needs it)
4.46 for item in "${@}"; do
4.47 case "${item}" in
4.48 - prog=*|inc=*|lib=*|var=*|ver=*|err=*)
4.49 + prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*)
4.50 eval ${item%%=*}="'${item#*=}'"
4.51 ;;
4.52 *) do_error "has_or_abort: incorrect parameters: '$@'";;
4.53 esac
4.54 done
4.55
4.56 + if [ -n "${kconfig}" ]; then
4.57 + add_to_kconfig_list "${kconfig}"
4.58 + fi
4.59 +
4.60 case "${prog}:${inc}:${lib}" in
4.61 ?*::)
4.62 for item in ${prog}; do
4.63 @@ -179,6 +200,9 @@
4.64 eval ${var}='"'"${where}"'"'
4.65 add_to_var_list "${var}"
4.66 fi
4.67 + if [ -n "${kconfig}" ]; then
4.68 + eval ${kconfig}=y
4.69 + fi
4.70 printf "\n"
4.71 }
4.72
4.73 @@ -188,7 +212,7 @@
4.74 # We declare these 6 variables here, although they are
4.75 # set in check_for(), called below
4.76 local prog inc lib
4.77 - local var ver err
4.78 + local var ver err kconfig
4.79
4.80 if ! check_for "$@"; then
4.81 printf "\n${err:-${prog}${inc}${lib}: none found}\n\n"
4.82 @@ -216,7 +240,7 @@
4.83 # We declare these 6 variables here, although they are
4.84 # set in check_for(), called below
4.85 local prog inc lib
4.86 - local var ver err
4.87 + local var ver err kconfig
4.88
4.89 if ! check_for "$@"; then
4.90 printf "${err:+${err}\n}"
4.91 @@ -460,16 +484,23 @@
4.92 printf "Building up Makefile... "
4.93 var_sed="$( for var_name in ${var_list}; do
4.94 eval echo 's,@@${var_name}@@,${'"${var_name}"'},g'
4.95 - done
4.96 + done
4.97 )"
4.98 -"${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g
4.99 - s,@@LIBDIR@@,${LIBDIR},g
4.100 - s,@@DOCDIR@@,${DOCDIR},g
4.101 - s,@@MANDIR@@,${MANDIR},g
4.102 - s,@@VERSION@@,${VERSION},g
4.103 - s,@@DATE@@,${DATE},g
4.104 - ${var_sed}
4.105 - s,@@LOCAL@@,${LOCAL_set},g" Makefile.in >Makefile
4.106 +kconfig_sed="s/@@KCONFIG@@/$( for k_name in ${kconfig_list}; do
4.107 + eval printf \"${k_name}=\${${k_name}} \"
4.108 + done
4.109 + )/"
4.110 +"${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g" \
4.111 + -e "s,@@LIBDIR@@,${LIBDIR},g" \
4.112 + -e "s,@@DOCDIR@@,${DOCDIR},g" \
4.113 + -e "s,@@MANDIR@@,${MANDIR},g" \
4.114 + -e "s,@@VERSION@@,${VERSION},g" \
4.115 + -e "s,@@DATE@@,${DATE},g" \
4.116 + -e "s,@@LOCAL@@,${LOCAL_set},g" \
4.117 + -e "${var_sed}" \
4.118 + -e "${kconfig_sed}" \
4.119 + Makefile.in \
4.120 + >Makefile
4.121 echo "done"
4.122
4.123 cat <<__EOF__