1.1 --- a/configure Thu May 26 18:33:53 2011 +0200
1.2 +++ b/configure Tue May 31 16:27:39 2011 +0200
1.3 @@ -69,12 +69,24 @@
1.4 # var_list is a list of variables, each one holding a path to a
1.5 # tool, either detected by ./configure, or specified by the user.
1.6 var_list=""
1.7 +kconfig_list=""
1.8
1.9 # This function adds a variable name to the above list of variable names.
1.10 # $1: the name of the variable to add to the list
1.11 add_to_var_list() {
1.12 + local v
1.13 + for v in ${var_list}; do
1.14 + [ "${v}" = "${1}" ] && return 0
1.15 + done
1.16 var_list="${var_list} ${1}"
1.17 }
1.18 +add_to_kconfig_list() {
1.19 + local k
1.20 + for k in ${kconfig_list}; do
1.21 + [ "${k}" = "${1}" ] && return 0
1.22 + done
1.23 + kconfig_list="${kconfig_list} ${1}"
1.24 +}
1.25
1.26 # A function to test for required tools/headers/libraries
1.27 # Return 0 (true) if found, !0 (false) if not found
1.28 @@ -97,23 +109,32 @@
1.29 # optional, defaults to: '${prog}: none found'
1.30 # eg: err="'bash' 3.x or above was not found"
1.31 # Note: err may be printed by caller, not us
1.32 +# $*: kconfig=<var_name>
1.33 +# the name of a variable to pass down to kconfig if
1.34 +# the prog/inc/lib was found
1.35 +# optional, defaults to none
1.36 +# eg: kconfig=has_libncurses
1.37 check_for() {
1.38 local val
1.39 local item
1.40 local where
1.41 local status
1.42
1.43 - # Note: prog/inc/lib and var/ver/err are set here,
1.44 + # Note: prog/inc/lib and var/kconfig/ver/err are set here,
1.45 # but declared by the caller (because it needs it)
1.46 for item in "${@}"; do
1.47 case "${item}" in
1.48 - prog=*|inc=*|lib=*|var=*|ver=*|err=*)
1.49 + prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*)
1.50 eval ${item%%=*}="'${item#*=}'"
1.51 ;;
1.52 *) do_error "has_or_abort: incorrect parameters: '$@'";;
1.53 esac
1.54 done
1.55
1.56 + if [ -n "${kconfig}" ]; then
1.57 + add_to_kconfig_list "${kconfig}"
1.58 + fi
1.59 +
1.60 case "${prog}:${inc}:${lib}" in
1.61 ?*::)
1.62 for item in ${prog}; do
1.63 @@ -179,6 +200,9 @@
1.64 eval ${var}='"'"${where}"'"'
1.65 add_to_var_list "${var}"
1.66 fi
1.67 + if [ -n "${kconfig}" ]; then
1.68 + eval ${kconfig}=y
1.69 + fi
1.70 printf "\n"
1.71 }
1.72
1.73 @@ -188,7 +212,7 @@
1.74 # We declare these 6 variables here, although they are
1.75 # set in check_for(), called below
1.76 local prog inc lib
1.77 - local var ver err
1.78 + local var ver err kconfig
1.79
1.80 if ! check_for "$@"; then
1.81 printf "\n${err:-${prog}${inc}${lib}: none found}\n\n"
1.82 @@ -216,7 +240,7 @@
1.83 # We declare these 6 variables here, although they are
1.84 # set in check_for(), called below
1.85 local prog inc lib
1.86 - local var ver err
1.87 + local var ver err kconfig
1.88
1.89 if ! check_for "$@"; then
1.90 printf "${err:+${err}\n}"
1.91 @@ -460,16 +484,23 @@
1.92 printf "Building up Makefile... "
1.93 var_sed="$( for var_name in ${var_list}; do
1.94 eval echo 's,@@${var_name}@@,${'"${var_name}"'},g'
1.95 - done
1.96 + done
1.97 )"
1.98 -"${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g
1.99 - s,@@LIBDIR@@,${LIBDIR},g
1.100 - s,@@DOCDIR@@,${DOCDIR},g
1.101 - s,@@MANDIR@@,${MANDIR},g
1.102 - s,@@VERSION@@,${VERSION},g
1.103 - s,@@DATE@@,${DATE},g
1.104 - ${var_sed}
1.105 - s,@@LOCAL@@,${LOCAL_set},g" Makefile.in >Makefile
1.106 +kconfig_sed="s/@@KCONFIG@@/$( for k_name in ${kconfig_list}; do
1.107 + eval printf \"${k_name}=\${${k_name}} \"
1.108 + done
1.109 + )/"
1.110 +"${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g" \
1.111 + -e "s,@@LIBDIR@@,${LIBDIR},g" \
1.112 + -e "s,@@DOCDIR@@,${DOCDIR},g" \
1.113 + -e "s,@@MANDIR@@,${MANDIR},g" \
1.114 + -e "s,@@VERSION@@,${VERSION},g" \
1.115 + -e "s,@@DATE@@,${DATE},g" \
1.116 + -e "s,@@LOCAL@@,${LOCAL_set},g" \
1.117 + -e "${var_sed}" \
1.118 + -e "${kconfig_sed}" \
1.119 + Makefile.in \
1.120 + >Makefile
1.121 echo "done"
1.122
1.123 cat <<__EOF__