configure
author Titus von Boxberg <titus@v9g.de>
Mon Aug 22 09:41:35 2011 +0200 (2011-08-22)
branch1.12
changeset 2636 d53c6d529923
parent 2598 0ef8c2469c8f
child 2637 97cc0c987a1a
permissions -rwxr-xr-x
configure: fix --with-prog=[...]

check_for didn't set variable 'where' when the path to a prog
was passed manually "(cached)".

Signed-off-by: "Titus von Boxberg" <titus@v9g.de>
(transplanted from b1be254591e7b524a0b06a2247a9331ebe0faf1d)
     1 #!/bin/sh
     2 
     3 myname="${0##*/}"
     4 
     5 VERSION=$( cat .version )
     6 DATE=$( date +%Y%m%d )
     7 
     8 PREFIX_DEFAULT=/usr/local
     9 
    10 BINDIR_set=
    11 LIBDIR_set=
    12 DOCDIR_set=
    13 MANDIR_set=
    14 LOCAL_set=
    15 FORCE=
    16 
    17 do_quit=
    18 
    19 # Simply print the error message, and exit. Obvious, he?
    20 do_error() {
    21     printf "${myname}: ${@}\n"
    22     exit 1
    23 }
    24 
    25 # Given an option string and the following argument,
    26 # echoes the value of the option.
    27 # If --var=val => echoes val and returns 0, meaning second arg was not consumed
    28 # If --var val => echoes val and returns non null, meaning second arg was used
    29 get_optval(){
    30     case "$1" in
    31         --*=?*)
    32             printf "${1#*=}"
    33             return 0
    34             ;;
    35         *)
    36             printf "${2}"
    37             return 1
    38             ;;
    39     esac
    40 }
    41 
    42 # The set_xxx functions will set the corresponding configuration variable
    43 # They return 0 if second arg was not consumed, and non-zero if it was consumed.
    44 set_prefix() {
    45     PREFIX="$( get_optval "$1" "$2" )"
    46 }
    47 set_bindir() {
    48     BINDIR_set=1
    49     BINDIR="$( get_optval "$1" "$2" )"
    50 }
    51 set_libdir() {
    52     LIBDIR_set=1
    53     LIBDIR="$( get_optval "$1" "$2" )"
    54 }
    55 set_docdir() {
    56     DOCDIR_set=1
    57     DOCDIR="$( get_optval "$1" "$2" )"
    58 }
    59 set_mandir() {
    60     MANDIR_set=1
    61     MANDIR="$( get_optval "$1" "$2" )"
    62 }
    63 set_tool() {
    64     local var_name="${1%%=*}"
    65     var_name="${var_name#--with-}"
    66     eval ${var_name}="\$( get_optval "$1" "$2" )"
    67 }
    68 
    69 # var_list is a list of variables, each one holding a path to a
    70 # tool, either detected by ./configure, or specified by the user.
    71 var_list=""
    72 kconfig_list=""
    73 
    74 # This function adds a variable name to the above list of variable names.
    75 # $1: the name of the variable to add to the list
    76 add_to_var_list() {
    77     local v
    78     for v in ${var_list}; do
    79         [ "${v}" = "${1}" ] && return 0
    80     done
    81     var_list="${var_list} ${1}"
    82 }
    83 add_to_kconfig_list() {
    84     local k
    85     for k in ${kconfig_list}; do
    86         [ "${k}" = "${1}" ] && return 0
    87     done
    88     kconfig_list="${kconfig_list} ${1}"
    89 }
    90 
    91 # A function to test for required tools/headers/libraries
    92 # Return 0 (true) if found, !0 (false) if not found
    93 #
    94 # $*: [prog|inc|lib]=<name[ name...]>
    95 #     the name(s) of tool(s) to test for
    96 #     mandatory
    97 #       eg: prog=bash   prog="curl wget"
    98 # $*: var=<var_name>
    99 #     the name of the variable to test and set
   100 #     optional
   101 #       eg: var=bash    if ${bash} is set and non-null, use that,
   102 #                       else check for bash and set bash=$(which bash)
   103 # $*: ver=<regexp>
   104 #     for each 'prog', test if $(prog --version) matches 'regexp'
   105 #     optional
   106 #       eg: ver='^GNU bash, version [34]\.'
   107 # $*: lib_exts=<extension[ extension...]>
   108 #     the list of allowed library extension
   109 #     mandatory
   110 #       eg: lib_exts="so dylib"     lib_exts="so dylib a"
   111 # $*: err=<error_message>
   112 #     the error message to print if tool is missing
   113 #     optional, defaults to: '${prog}: none found'
   114 #       eg: err="'bash' 3.x or above was not found"
   115 #     Note: err may be printed by caller, not us
   116 # $*: kconfig=<var_name>
   117 #     the name of a variable to pass down to kconfig if
   118 #     the prog/inc/lib was found
   119 #     optional, defaults to none
   120 #       eg: kconfig=has_libncurses
   121 # $*: skip=[y|n|]
   122 #     if set to 'y', skip the test, but still register the
   123 #     kconfig and var variables; if 'n' or empty, do the
   124 #     test.
   125 #     optional, default to 'n'
   126 #       eg: skip="${static_link_ko}"
   127 check_for() {
   128     local lib_exts
   129     local skip
   130     local val
   131     local item
   132     local where
   133     local status
   134     local ext
   135 
   136     # Note: prog/inc/lib and var/kconfig/ver/err are set here,
   137     # but declared by the caller (because it needs it)
   138     for item in "${@}"; do
   139         case "${item}" in
   140             prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*|lib_exts=*|skip=*)
   141                 eval ${item%%=*}=\"${item#*=}\"
   142                 ;;
   143             *)  do_error "check_for: incorrect parameters: '${item}'";;
   144         esac
   145     done
   146 
   147     case "${prog}:${inc}:${lib}" in
   148         ?*:?*:|?*::?*|:?*:?*|?*:?*:?*)
   149             if [ -n "${var}" ]; then
   150                 do_error "check_for: the use of var is not compatible with passing several of [prog|inc|lib] at once"
   151             fi
   152             ;;
   153         ::) do_error "check_for: [prog|inc|lib] is mandatory";;
   154     esac
   155 
   156     if [ -n "${var}" ]; then
   157         add_to_var_list "${var}"
   158     fi
   159     if [ -n "${kconfig}" ]; then
   160         add_to_kconfig_list "${kconfig}"
   161     fi
   162 
   163     if [ "${skip}" = "y" ]; then
   164         return 0
   165     fi
   166 
   167     if [ -n "${prog}" ]; then
   168         for item in ${prog}; do
   169             printf "Checking for '${item}'... "
   170             if [ -n "${var}" ]; then
   171                 eval val="\${${var}}"
   172                 if [ -n "${val}" ]; then
   173                     status="${val} (cached)\n"
   174                     where="${val}"
   175                     break
   176                 fi
   177             fi
   178             where="$( which "${item}" 2>/dev/null )"
   179             if [ -z "${where}" ]; then
   180                 printf "no\n"
   181                 continue
   182             elif [ -n "${ver}" ]; then
   183                 str=$( LC_ALL=C "${where}" --version 2>&1   \
   184                        |grep -E "${ver}"                    \
   185                        |head -n 1
   186                      )
   187                 if [ -z "${str}" ]; then
   188                     printf "no\n"
   189                     unset where
   190                     continue
   191                 fi
   192             fi
   193             status="${where}"
   194             break
   195         done
   196         if [ -z "${status}" ]; then
   197             return 1
   198         fi
   199         printf "${status}\n"
   200         unset status
   201     fi
   202 
   203     if [ -n "${inc}" ]; then
   204         for item in ${inc}; do
   205             printf "Checking for '${item}'... "
   206             if printf "#include \"${item}\"" |gcc -x c -c - -o /dev/null >/dev/null 2>&1; then
   207                 where="${item}"
   208                 status=yes
   209                 break;
   210             fi
   211             printf "no\n"
   212         done
   213         if [ -z "${status}" ]; then
   214             return 1
   215         fi
   216         printf "${status}\n"
   217         unset status
   218     fi
   219 
   220     if [ -n "${lib}" ]; then
   221         if [ -z "${lib_exts}" ]; then
   222             do_error "check_for: no library extension specified for '${lib}'"
   223         fi
   224         for item in ${lib}; do
   225             for ext in ${lib_exts}; do
   226                 printf "Checking for '${item}.${ext}'... "
   227                 where="$( gcc -print-file-name="${item}.${ext}" )"
   228                 if [ "${where}" != "${item}.${ext}" ]; then
   229                     where="$( readlink "${where}" )"
   230                     status=yes
   231                     break 2;
   232                 fi
   233                 printf "no\n"
   234             done
   235         done
   236         if [ -z "${status}" ]; then
   237             return 1
   238         fi
   239         printf "${status}\n"
   240         unset status
   241     fi
   242 
   243     if [ -n "${var}" ]; then
   244         eval ${var}='"'"${where}"'"'
   245     fi
   246     if [ -n "${kconfig}" ]; then
   247         eval ${kconfig}=y
   248     fi
   249 }
   250 
   251 # This function checks for a tool, and aborts if not found
   252 # See check_for(), above, for how to call has_or_abort
   253 has_or_abort() {
   254     # We declare these 6 variables here, although they are
   255     # set in check_for(), called below
   256     local prog inc lib
   257     local var ver err kconfig
   258 
   259     if ! check_for "$@"; then
   260         printf " * A mandatory dependency is missing, or version mis-match:\n"
   261         printf " * - ${err:-${prog}${inc}${lib}: none found}\n"
   262         if [ -n "${var}" ]; then
   263             printf " * --> You can give the path to this tool using: --with-${var}=PATH\n"
   264         fi
   265         printf "\n"
   266         # Bail out if --force is not specified
   267         [ -z "${FORCE}" ] && do_error "Bailing out..."
   268         printf "<*                                          *>\n"
   269         printf "<*            FORCE in action:              *>\n"
   270         printf "<* Continuing despite missing pre-requisite *>\n"
   271         printf "<*          Prepare for breakage            *>\n"
   272         printf "<*                                          *>\n"
   273         printf "\n"
   274     fi
   275 }
   276 
   277 # This function checks for a tool, and warns if not found
   278 # See check_for(), above, for how to call has_or_abort
   279 # Note: if err is not set, then no error message is printed
   280 has_or_warn() {
   281     # We declare these 6 variables here, although they are
   282     # set in check_for(), called below
   283     local prog inc lib
   284     local var ver err kconfig
   285 
   286     if ! check_for "$@"; then
   287         printf " * An optional dependency is missing, some features will be disabled"
   288         printf "${err:+:\n * - ${err}}\n"
   289         if [ -n "${var}" ]; then
   290             printf " * --> You can give the path to this tool using: --with-${var}=PATH\n"
   291         fi
   292     fi
   293 }
   294 
   295 do_help() {
   296     cat <<__EOF__
   297 \`configure' configures crosstool-NG-${VERSION} to adapt to many kind of systems.
   298 
   299 USAGE: ./configure [OPTION]...
   300 
   301 Defaults for the options are specified in brackets.
   302 
   303 Configuration:
   304   -h, --help              display this help and exit
   305       --force             force configure to continue, even in case
   306                           some pre-requisites are missing
   307 
   308 Installation directories:
   309   --prefix=PREFIX         install files in PREFIX [${PREFIX_DEFAULT}]
   310   --local                 don't install, and use current directory
   311 
   312 By default, \`make install' will install all the files in
   313 \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc.  You can specify
   314 an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
   315 for instance \`--prefix=\${HOME}'.
   316 
   317 For better control, use the options below.
   318 
   319 Fine tuning of the installation directories:
   320   --bindir=DIR            user executables [PREFIX/bin]
   321   --libdir=DIR            object code libraries [PREFIX/lib]
   322   --docdir=DIR            info documentation [PREFIX/share/doc]
   323   --mandir=DIR            man documentation [PREFIX/share/man]
   324 
   325 Optional Features:
   326   --with-install=PATH     Specify the full PATH to GNU install
   327   --with-make=PATH        Specify the full PATH to GNU make >= 3.80
   328   --with-grep=PATH        Specify the full PATH to GNU grep
   329   --with-sed=PATH         Specify the full PATH to GNU sed
   330   --with-bash=PATH        Specify the full PATH to bash >= 3.0
   331 __EOF__
   332 }
   333 
   334 #---------------------------------------------------------------------
   335 # Set user's options
   336 
   337 while [ $# -ne 0 ]; do
   338     case "$1" in
   339         --local)    LOCAL_set="y"; shift;;
   340         --prefix*)  set_prefix "$1" "$2" && shift || shift 2;;
   341         --bindir*)  set_bindir "$1" "$2" && shift || shift 2;;
   342         --libdir*)  set_libdir "$1" "$2" && shift || shift 2;;
   343         --docdir*)  set_docdir "$1" "$2" && shift || shift 2;;
   344         --mandir*)  set_mandir "$1" "$2" && shift || shift 2;;
   345         --with-*)   set_tool   "$1" "$2" && shift || shift 2;;
   346         --force)    FORCE=1; shift;;
   347         --help|-h)  do_help; exit 0;;
   348         # Skip, auto-stuff compatibility
   349         --build=*|--host=*|--infodir=*|--datadir=*|--sysconfdir=*|--localstatedir=*) shift;;
   350         --build|--host|--infodir|--datadir|--sysconfdir|--localstatedir)             shift 2;;
   351         --enable-shared|--disable-shared|--enable-static|--disable-static)           shift;;
   352         --program-prefix=*)                                                          shift;;
   353         --program-prefix)                                                            shift 2;;
   354         *)          printf "Unrecognised option: '${1}'\n"; do_help; exit 1;;
   355     esac
   356 done
   357 
   358 # Use defaults
   359 [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
   360 
   361 # Special case when installing locally
   362 if [ "${LOCAL_set}" = "y" ]; then
   363     set_prefix "" "$( pwd )"
   364     set_bindir "" "$( pwd )"
   365     set_libdir "" "$( pwd )"
   366     set_docdir "" "$( pwd )/docs"
   367     set_mandir "" "$( pwd )/docs"
   368 fi
   369 
   370 #---------------------------------------------------------------------
   371 # Some sanity checks, now
   372 
   373 # We check for grep and sed manually, because they are used in check_for()
   374 printf "Checking for 'grep'... "
   375 if [ -n "${grep}" ]; then
   376     printf "${grep} (cached)\n"
   377 else
   378     grep="$( which grep 2>/dev/null )"
   379     if [ -z "${grep}" ]; then
   380         printf "not found\n"
   381     else
   382         printf "${grep}\n"
   383         printf "Checking whether '${grep}' supports -E... "
   384         if echo 'foo' |"${grep}" -E 'foo' >/dev/null 2>&1; then
   385             printf "yes\n"
   386         else
   387             printf "no\n"
   388             grep=
   389         fi
   390     fi
   391 fi
   392 if [ -z "${grep}" ]; then
   393     printf "Either you are missing entirely the needed tool,\n"
   394     printf "or the version you have is too old.\n"
   395     printf "You can give the path to this tool using: --with-grep=PATH\n"
   396     do_error "Bailing out..."
   397 fi
   398 add_to_var_list grep
   399 
   400 printf "Checking for 'sed'... "
   401 if [ -n "${sed}" ]; then
   402     printf "${sed} (cached)\n"
   403 else
   404     sed="$( which sed 2>/dev/null )"
   405     if [ -z "${sed}" ]; then
   406         printf "not found\n"
   407     else
   408         printf "${sed}\n"
   409         printf "Checking whether '${sed}' supports -i and -e... "
   410         touch .ct-ng.sed.test
   411         if "${sed}" -r -i -e 's/foo/bar/' .ct-ng.sed.test >/dev/null 2>&1; then
   412             printf "yes\n"
   413         else
   414             printf "no\n"
   415             sed=
   416         fi
   417         rm -f .ct-ng.sed.test
   418     fi
   419 fi
   420 if [ -z "${sed}" ]; then
   421     printf "Either you are missing entirely the needed tool,\n"
   422     printf "or the version you have is too old.\n"
   423     printf "You can give the path to this tool using: --with-sed=PATH\n"
   424     do_error "Bailing out..."
   425 fi
   426 add_to_var_list sed
   427 
   428 # The regular list of tools we can now easily check for
   429 has_or_abort prog=bash                              \
   430              var=bash                               \
   431              ver='^GNU bash, version (3\.[1-9]|4)'  \
   432              err="'bash' 3.1 or above was not found"
   433 has_or_abort prog=cut
   434 has_or_abort prog=install var=install
   435 has_or_abort prog=make                                  \
   436              var=make                                   \
   437              ver='^GNU Make (3.[89][[:digit:]]|[4-9])'  \
   438              err="GNU 'make' 3.80 or above was not found"
   439 has_or_abort prog=gcc
   440 has_or_abort prog="awk gawk" ver='^GNU Awk' err="GNU 'awk' was not found"
   441 has_or_abort prog=bison
   442 has_or_abort prog=flex
   443 has_or_abort prog=makeinfo
   444 has_or_abort prog=automake                                                      \
   445              ver='\(GNU automake\) (1\.[[:digit:]]{2,}|[2-9][[:digit:]]*\.)'    \
   446              err="'automake' 1.10 or above was not found"
   447 has_or_abort prog=libtool                                                                           \
   448              var=libtool                                                                            \
   449              ver='\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)'   \
   450              err="'libtool' 1.5.26 or above was not found"
   451 has_or_abort prog=stat
   452 has_or_abort prog="curl wget"
   453 has_or_abort prog=patch
   454 has_or_abort prog=tar
   455 has_or_abort prog=gzip
   456 has_or_abort prog=bzip2
   457 has_or_abort prog=lzma
   458 has_or_abort prog=readlink
   459 has_or_abort prog=objcopy var=objcopy
   460 has_or_abort prog=objdump var=objdump
   461 has_or_abort prog=readelf var=readelf
   462 has_or_abort prog=patch var=patch
   463 has_or_warn  prog=cvs                                                   \
   464              kconfig=has_cvs                                            \
   465              err="it will not be possible to use newlib cvs snapshots"
   466 has_or_abort prog=svn                               \
   467              kconfig=has_svn                        \
   468              err="subversion is required to download eglibc"
   469 
   470 # Host system checks
   471 
   472 printf "Checking for host system... "
   473 host="$( uname -s )"
   474 printf "%s\n" "${host}"
   475 case "${host}" in
   476     Linux)  ;;
   477     Cygwin) ;;
   478     *)
   479         printf " * Runing under %s is not fully tested\n" "${host}"
   480         printf " * You may encounter some weird behavior\n"
   481         ;;
   482 esac
   483 
   484 printf "Checking if static linking is possible... "
   485 static_link_ok=""
   486 case "${host}" in
   487     Darwin) ;;
   488     *)  tmp=.static.tmp
   489         if gcc -xc - -static -o "${tmp}" >/dev/null 2>&1 <<-_EOF_
   490 				int main() { return 0; }
   491 			_EOF_
   492         then
   493             static_link_ok="y"
   494         fi
   495         rm -f "${tmp}"
   496         ;;
   497 esac
   498 if [ "${static_link_ok}" = "y" ]; then
   499     static_link_ko=""
   500     printf "yes\n"
   501 else
   502     static_link_ko="y"
   503     printf "no\n"
   504     printf " * An optional host feature is missing, some features will be disabled:\n"
   505     printf " * - It will not be possible to statically link toolchain's binaries\n"
   506 fi
   507 add_to_kconfig_list static_link_ok
   508 
   509 # Library checks
   510 libs_exts="so dylib"
   511 if [ "${static_link_ok}" = "y" ]; then
   512     libs_exts="${libs_exts} a"
   513 fi
   514 
   515 ncurses_hdrs="ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h"
   516 ncurses_libs="libncursesw libncurses libcurses"
   517 has_or_abort lib="${ncurses_libs}"                                          \
   518              lib_exts="${libs_exts}"                                        \
   519              inc="${ncurses_hdrs}"                                          \
   520              err="The 'ncurses' library is needed fo the menuconfig frontend"
   521 
   522 has_or_abort lib="libstdc++"            \
   523              lib_exts="${libs_exts}"    \
   524              err="The 'libstdc++' library is needed to build gcc"
   525 
   526 # Yes, we may be checking twice for libstdc++.a
   527 # The first is because we need one instance of libstdc++ (shared or static)
   528 # because it is needed for PPL; the second is because the static version is
   529 # required for static-linking, and if missing, the option is removed.
   530 has_or_warn  lib="libstdc++"                \
   531              lib_exts="a"                   \
   532              err="static 'libstdc++' is needed to statically link the toolchain's executables" \
   533              kconfig=has_static_libstdcxx   \
   534              skip="${static_link_ko}"
   535 
   536 has_or_warn  inc="expat.h"              \
   537              lib="libexpat"             \
   538              lib_exts="${libs_exts}"    \
   539              err="The 'expat' header file and library are needed to link cross-gdb's executables" \
   540              kconfig=has_expat
   541 
   542 # Yes, we may be checking twice for libexpat.a
   543 # The first is because we need one instance of libexpat (shared or static)
   544 # because it is needed for cross-gdb; the second is because the static version
   545 # is required for static-linking, and if missing, the option is removed.
   546 has_or_warn  lib="libexpat"             \
   547              lib_exts="a"               \
   548              err="static 'expat' is needed to statically link cross-gdb's executables" \
   549              kconfig=has_static_expat   \
   550              skip="${static_link_ko}"
   551 
   552 for v in 7 6 5 4; do
   553     python_incs="${python_incs} python2.${v}/Python.h"
   554     python_libs="${python_libs} libpython2.${v}"
   555 done
   556 has_or_warn  inc="${python_incs}"       \
   557              lib="${python_libs}"       \
   558              lib_exts="${libs_exts}"    \
   559              err="The 'python' header file and library are needed for some features of cross-gdb"
   560 
   561 #---------------------------------------------------------------------
   562 # Compute the version string
   563 
   564 # If this version is n hg clone, try to get the revision number
   565 # If we can't get the revision number, use date
   566 printf "\nComputing version string... "
   567 case "${VERSION}" in
   568     *+hg|hg)
   569         REVISION="$( hg id -n 2>/dev/null || true )"
   570         case "${REVISION}" in
   571             "")
   572                 VERSION="${VERSION}_unknown@$( date +%Y%m%d.%H%M%S )";;
   573             *)
   574                 VERSION="${VERSION}_$( hg id -b )@${REVISION%%+}_$( hg id -i )"
   575                 ;;
   576         esac
   577         # Arrange to have no / in the directory name, no need to create an
   578         # arbitrarily deep directory structure
   579         VERSION="$( printf "${VERSION}\n" |"${sed}" -r -e 's|/+|_|g;' )"
   580         ;;
   581 esac
   582 printf "${VERSION}\n"
   583 
   584 #---------------------------------------------------------------------
   585 # Compute and check install paths
   586 
   587 # Now we have the version string, we can build up the paths
   588 [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
   589 [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib"
   590 [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc"
   591 [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man"
   592 
   593 # Install support files in our own sub-dir, so as not to mangle (system)
   594 # files and dirs, but only if not --local
   595 if [ -z "${LOCAL_set}" ]; then
   596     LIBDIR="${LIBDIR}/ct-ng-${VERSION}"
   597     DOCDIR="${DOCDIR}/ct-ng-${VERSION}"
   598 fi
   599 
   600 # Check that install PATHs are absolute
   601 for p in BIN LIB DOC MAN; do
   602     var="${p}DIR"
   603     eval v='"${'"${var}"'}"'
   604     case "${v}" in
   605         /*) ;;
   606         *)  do_error "'${var}' is not an absolute path: '${v}'"
   607     esac
   608 done
   609 
   610 #---------------------------------------------------------------------
   611 # That's all, folks!
   612 
   613 printf "Building up Makefile... "
   614 var_sed="$( for var_name in ${var_list}; do
   615                 eval echo 's,@@${var_name}@@,${'"${var_name}"'},g'
   616             done
   617           )"
   618 kconfig_sed="s/@@KCONFIG@@/$( for k_name in ${kconfig_list}; do
   619                                   eval printf \"${k_name}=\${${k_name}} \"
   620                               done
   621                             )/"
   622 "${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g"       \
   623             -e "s,@@LIBDIR@@,${LIBDIR},g"       \
   624             -e "s,@@DOCDIR@@,${DOCDIR},g"       \
   625             -e "s,@@MANDIR@@,${MANDIR},g"       \
   626             -e "s,@@VERSION@@,${VERSION},g"     \
   627             -e "s,@@DATE@@,${DATE},g"           \
   628             -e "s,@@LOCAL@@,${LOCAL_set},g"     \
   629             -e "${var_sed}"                     \
   630             -e "${kconfig_sed}"                 \
   631          Makefile.in                            \
   632          >Makefile
   633 echo "done"
   634 
   635 cat <<__EOF__
   636 
   637 crosstool-NG configured as follows:
   638   PREFIX='${PREFIX}'
   639   BINDIR='${BINDIR}'
   640   LIBDIR='${LIBDIR}'
   641   DOCDIR='${DOCDIR}'
   642   MANDIR='${MANDIR}'
   643 
   644 Now run:
   645   make
   646 __EOF__
   647 if [ "${LOCAL_set}" != "y" ]; then
   648     printf "  make install\n"
   649 fi