# HG changeset patch # User "Yann E. MORIN" # Date 1214382887 0 # Node ID ede871c1fd919ab383f3a952a01cce1fae2e4381 # Parent 81f456c7bc6867900d271f7eb26e764b3399bffd Enable using contributed code: add a new ./configure option to select which contributions should be applied. /trunk/configure | 44 43 1 0 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff -r 81f456c7bc68 -r ede871c1fd91 configure --- a/configure Wed Jun 25 06:24:51 2008 +0000 +++ b/configure Wed Jun 25 08:34:47 2008 +0000 @@ -11,6 +11,9 @@ MANDIR_set= LOCAL_set= +qo_quit= +CONTRIB_list= + get_optval(){ local ret case "$1" in @@ -55,6 +58,23 @@ return $? } +set_contrib() { + opt_val=$(get_optval "$1" "$2") + local ret=$? + case "${opt_val}" in + all) + CONTRIB_list=$(LC_ALL=C ls -1 contrib/*.patch.lzma |sed -r -e 's|.*/||; s|\.patch\.lzma||;') + ;; + list) + do_quit=1 + echo "Available contributions:" + LC_ALL=C ls -1 contrib/*.patch.lzma |sed -r -e 's|.*/||; s|\.patch\.lzma||; s|^| |;' + ;; + *) CONTRIB_list="${CONTRIB_list},${opt_val}";; + esac + return $ret +} + do_help() { cat <<__EOF__ \`configure' configures crosstool-NG ${VERSION} to adapt to many kind of systems. @@ -80,6 +100,12 @@ --libdir=DIR object code libraries [PREFIX/lib] --docdir=DIR info documentation [PREFIX/share/doc] --mandir=DIR man documentation [PREFIX/share/man] + +Optional Features: + --with-contrib=XXX Include externally contributed features found in the + contrib/ sub-directory. Set to a comma-separated list + of features. Use 'all' to use all contributions, and + 'list' to see which are available. __EOF__ } @@ -99,6 +125,10 @@ --docdir*) set_docdir "$1" "$2" && shift || shift 2;; --mandir*) set_mandir "$1" "$2" && shift || shift 2;; --local) LOCAL_set=1; shift;; + --with-contrib*) + set_contrib "$1" "$2" && shift || shift 2 + [ "${do_quit}" = "1" ] && exit 0 + ;; --help|-h) do_help; exit 0;; *) do_help; exit 1;; esac @@ -136,7 +166,7 @@ esac echo "${VERSION}" -# Now we have the version string, we can buyild up the paths +# Now we have the version string, we can build up the paths [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin" [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib/ct-ng-${VERSION}" [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}" @@ -150,6 +180,16 @@ [ ${bash_major} -ge 3 ] || do_error "bash 3.0 or above is needed (/bin/bash is ${bash_version})" echo "ok (${bash_version})" +echo -n "Applying contributed code: " +for c in ${CONTRIB_list//,/ }; do + echo -n "${c}... " + if [ ! -f "contrib/${c}.patch.lzma" ]; then + do_error "Contribution '${c}' does not exist" + fi + lzcat "contrib/${c}.patch.lzma" |patch -p1 >/dev/null 2>&1 +done +echo "done" + echo -n "Building up Makefile... " sed -r -e "s,@@BINDIR@@,${BINDIR},g;" \ -e "s,@@LIBDIR@@,${LIBDIR},g;" \ @@ -168,4 +208,6 @@ LIBDIR='${LIBDIR}' DOCDIR='${DOCDIR}' MANDIR='${MANDIR}' + CONTRIB='${CONTRIB_list// +/,}' __EOF__