configure
changeset 614 ede871c1fd91
parent 554 be6197b5b33b
child 615 c9d37346d57f
     1.1 --- a/configure	Wed Jun 11 21:45:57 2008 +0000
     1.2 +++ b/configure	Wed Jun 25 08:34:47 2008 +0000
     1.3 @@ -11,6 +11,9 @@
     1.4  MANDIR_set=
     1.5  LOCAL_set=
     1.6  
     1.7 +qo_quit=
     1.8 +CONTRIB_list=
     1.9 +
    1.10  get_optval(){
    1.11      local ret
    1.12      case "$1" in
    1.13 @@ -55,6 +58,23 @@
    1.14      return $?
    1.15  }
    1.16  
    1.17 +set_contrib() {
    1.18 +    opt_val=$(get_optval "$1" "$2")
    1.19 +    local ret=$?
    1.20 +    case "${opt_val}" in
    1.21 +        all)
    1.22 +            CONTRIB_list=$(LC_ALL=C ls -1 contrib/*.patch.lzma |sed -r -e 's|.*/||; s|\.patch\.lzma||;')
    1.23 +            ;;
    1.24 +        list)
    1.25 +            do_quit=1
    1.26 +            echo "Available contributions:"
    1.27 +            LC_ALL=C ls -1 contrib/*.patch.lzma |sed -r -e 's|.*/||; s|\.patch\.lzma||; s|^|  |;'
    1.28 +            ;;
    1.29 +        *)  CONTRIB_list="${CONTRIB_list},${opt_val}";;
    1.30 +    esac
    1.31 +    return $ret
    1.32 +}
    1.33 +
    1.34  do_help() {
    1.35      cat <<__EOF__
    1.36  \`configure' configures crosstool-NG ${VERSION} to adapt to many kind of systems.
    1.37 @@ -80,6 +100,12 @@
    1.38    --libdir=DIR           object code libraries [PREFIX/lib]
    1.39    --docdir=DIR           info documentation [PREFIX/share/doc]
    1.40    --mandir=DIR           man documentation [PREFIX/share/man]
    1.41 +
    1.42 +Optional Features:
    1.43 +  --with-contrib=XXX     Include externally contributed features found in the
    1.44 +                         contrib/ sub-directory. Set to a comma-separated list
    1.45 +                         of features. Use 'all' to use all contributions, and
    1.46 +                         'list' to see which are available.
    1.47  __EOF__
    1.48  }
    1.49  
    1.50 @@ -99,6 +125,10 @@
    1.51          --docdir*)  set_docdir "$1" "$2" && shift || shift 2;;
    1.52          --mandir*)  set_mandir "$1" "$2" && shift || shift 2;;
    1.53          --local)    LOCAL_set=1; shift;;
    1.54 +        --with-contrib*)
    1.55 +                    set_contrib "$1" "$2" && shift || shift 2
    1.56 +                    [ "${do_quit}" = "1" ] && exit 0
    1.57 +                    ;;
    1.58          --help|-h)  do_help; exit 0;;
    1.59          *)          do_help; exit 1;;
    1.60      esac
    1.61 @@ -136,7 +166,7 @@
    1.62  esac
    1.63  echo "${VERSION}"
    1.64  
    1.65 -# Now we have the version string, we can buyild up the paths
    1.66 +# Now we have the version string, we can build up the paths
    1.67  [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
    1.68  [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib/ct-ng-${VERSION}"
    1.69  [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}"
    1.70 @@ -150,6 +180,16 @@
    1.71  [ ${bash_major} -ge 3 ] || do_error "bash 3.0 or above is needed (/bin/bash is ${bash_version})"
    1.72  echo "ok (${bash_version})"
    1.73  
    1.74 +echo -n "Applying contributed code: "
    1.75 +for c in ${CONTRIB_list//,/ }; do
    1.76 +    echo -n "${c}... "
    1.77 +    if [ ! -f "contrib/${c}.patch.lzma" ]; then
    1.78 +        do_error "Contribution '${c}' does not exist"
    1.79 +    fi
    1.80 +    lzcat "contrib/${c}.patch.lzma" |patch -p1 >/dev/null 2>&1
    1.81 +done
    1.82 +echo "done"
    1.83 +
    1.84  echo -n "Building up Makefile... "
    1.85  sed -r -e "s,@@BINDIR@@,${BINDIR},g;"   \
    1.86         -e "s,@@LIBDIR@@,${LIBDIR},g;"   \
    1.87 @@ -168,4 +208,6 @@
    1.88    LIBDIR='${LIBDIR}'
    1.89    DOCDIR='${DOCDIR}'
    1.90    MANDIR='${MANDIR}'
    1.91 +  CONTRIB='${CONTRIB_list//
    1.92 +/,}'
    1.93  __EOF__