configure
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Aug 17 22:23:21 2011 +0200 (2011-08-17)
changeset 2619 628192dbf847
parent 2607 dda4742972e2
child 2621 00853d565edf
permissions -rwxr-xr-x
configure: document ignored switches

Autostuff tradiotionnally have some switches to set host, build and
target systems, static or shared libs, and a bunch of others...

In the crosstool-NG case, they do not matter, as crosstool-NG is
just a set of scripts (there are C files, but they are compiled
after installation, at runtime, so it does not count).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     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                     break
   175                 fi
   176             fi
   177             where="$( which "${item}" 2>/dev/null )"
   178             if [ -z "${where}" ]; then
   179                 printf "no\n"
   180                 continue
   181             elif [ -n "${ver}" ]; then
   182                 str=$( LC_ALL=C "${where}" --version 2>&1   \
   183                        |grep -E "${ver}"                    \
   184                        |head -n 1
   185                      )
   186                 if [ -z "${str}" ]; then
   187                     printf "no\n"
   188                     unset where
   189                     continue
   190                 fi
   191             fi
   192             status="${where}"
   193             break
   194         done
   195         if [ -z "${status}" ]; then
   196             return 1
   197         fi
   198         printf "${status}\n"
   199         unset status
   200     fi
   201 
   202     if [ -n "${inc}" ]; then
   203         for item in ${inc}; do
   204             printf "Checking for '${item}'... "
   205             if printf "#include \"${item}\"" |gcc -x c -c - -o /dev/null >/dev/null 2>&1; then
   206                 where="${item}"
   207                 status=yes
   208                 break;
   209             fi
   210             printf "no\n"
   211         done
   212         if [ -z "${status}" ]; then
   213             return 1
   214         fi
   215         printf "${status}\n"
   216         unset status
   217     fi
   218 
   219     if [ -n "${lib}" ]; then
   220         if [ -z "${lib_exts}" ]; then
   221             do_error "check_for: no library extension specified for '${lib}'"
   222         fi
   223         for item in ${lib}; do
   224             for ext in ${lib_exts}; do
   225                 printf "Checking for '${item}.${ext}'... "
   226                 where="$( gcc -print-file-name="${item}.${ext}" )"
   227                 if [ "${where}" != "${item}.${ext}" ]; then
   228                     where="$( readlink "${where}" )"
   229                     status=yes
   230                     break 2;
   231                 fi
   232                 printf "no\n"
   233             done
   234         done
   235         if [ -z "${status}" ]; then
   236             return 1
   237         fi
   238         printf "${status}\n"
   239         unset status
   240     fi
   241 
   242     if [ -n "${var}" ]; then
   243         eval ${var}='"'"${where}"'"'
   244     fi
   245     if [ -n "${kconfig}" ]; then
   246         eval ${kconfig}=y
   247     fi
   248 }
   249 
   250 # This function checks for a tool, and aborts if not found
   251 # See check_for(), above, for how to call has_or_abort
   252 has_or_abort() {
   253     # We declare these 6 variables here, although they are
   254     # set in check_for(), called below
   255     local prog inc lib
   256     local var ver err kconfig
   257 
   258     if ! check_for "$@"; then
   259         printf " * A mandatory dependency is missing, or version mis-match:\n"
   260         printf " * - ${err:-${prog}${inc}${lib}: none found}\n"
   261         if [ -n "${var}" ]; then
   262             printf " * --> You can give the path to this tool using: --with-${var}=PATH\n"
   263         fi
   264         printf "\n"
   265         # Bail out if --force is not specified
   266         [ -z "${FORCE}" ] && do_error "Bailing out..."
   267         printf "<*                                          *>\n"
   268         printf "<*            FORCE in action:              *>\n"
   269         printf "<* Continuing despite missing pre-requisite *>\n"
   270         printf "<*          Prepare for breakage            *>\n"
   271         printf "<*                                          *>\n"
   272         printf "\n"
   273     fi
   274 }
   275 
   276 # This function checks for a tool, and warns if not found
   277 # See check_for(), above, for how to call has_or_abort
   278 # Note: if err is not set, then no error message is printed
   279 has_or_warn() {
   280     # We declare these 6 variables here, although they are
   281     # set in check_for(), called below
   282     local prog inc lib
   283     local var ver err kconfig
   284 
   285     if ! check_for "$@"; then
   286         printf " * An optional dependency is missing, some features will be disabled"
   287         printf "${err:+:\n * - ${err}}\n"
   288         if [ -n "${var}" ]; then
   289             printf " * --> You can give the path to this tool using: --with-${var}=PATH\n"
   290         fi
   291     fi
   292 }
   293 
   294 do_help() {
   295     cat <<__EOF__
   296 \`configure' configures crosstool-NG-${VERSION} to adapt to many kind of systems.
   297 
   298 USAGE: ./configure [OPTION]...
   299 
   300 Defaults for the options are specified in brackets.
   301 
   302 Configuration:
   303   -h, --help              display this help and exit
   304       --force             force configure to continue, even in case
   305                           some pre-requisites are missing
   306 
   307 Installation directories:
   308   --prefix=PREFIX         install files in PREFIX [${PREFIX_DEFAULT}]
   309   --local                 don't install, and use current directory
   310 
   311 By default, \`make install' will install all the files in
   312 \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc.  You can specify
   313 an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
   314 for instance \`--prefix=\${HOME}'.
   315 
   316 For better control, use the options below.
   317 Note: options marked as \`ignored' are recognised, but not acted upon, as
   318 they make no sense for crosstool-NG, or they are not implemented yet.
   319 
   320 Fine tuning of the installation directories:
   321   --bindir=DIR            user executables [PREFIX/bin]
   322   --libdir=DIR            object code libraries [PREFIX/lib]
   323   --docdir=DIR            info documentation [PREFIX/share/doc]
   324   --mandir=DIR            man documentation [PREFIX/share/man]
   325   --infodir=DIR           info documentation [DATAROOTDIR/info] (ignored)
   326   --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
   327                           (ignored)
   328   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc] (ignored)
   329   --localstatedir=DIR     modifiable single-machine data [PREFIX/var] (ignored)
   330 
   331 Program names:
   332   --program-prefix=PREFIX            prepend PREFIX to installed program names
   333                                      (ignored)
   334 
   335 System types:
   336   --build=BUILD     configure for building on BUILD [guessed] (ignored)
   337   --host=HOST       cross-compile to build programs to run on HOST [BUILD]
   338                     (ignored)
   339 
   340 Optional Features:
   341   --enable-shared[=PKGS]  build shared libraries [default=yes] (ignored)
   342   --enable-static[=PKGS]  build static libraries [default=yes] (ignored)
   343 
   344 Optional Packages:
   345   --with-install=PATH     Specify the full PATH to GNU install
   346   --with-make=PATH        Specify the full PATH to GNU make >= 3.80
   347   --with-grep=PATH        Specify the full PATH to GNU grep
   348   --with-sed=PATH         Specify the full PATH to GNU sed
   349   --with-bash=PATH        Specify the full PATH to bash >= 3.0
   350 __EOF__
   351 }
   352 
   353 #---------------------------------------------------------------------
   354 # Set user's options
   355 
   356 while [ $# -ne 0 ]; do
   357     case "$1" in
   358         --local)    LOCAL_set="y"; shift;;
   359         --prefix*)  set_prefix "$1" "$2" && shift || shift 2;;
   360         --bindir*)  set_bindir "$1" "$2" && shift || shift 2;;
   361         --libdir*)  set_libdir "$1" "$2" && shift || shift 2;;
   362         --docdir*)  set_docdir "$1" "$2" && shift || shift 2;;
   363         --mandir*)  set_mandir "$1" "$2" && shift || shift 2;;
   364         --with-*)   set_tool   "$1" "$2" && shift || shift 2;;
   365         --force)    FORCE=1; shift;;
   366         --help|-h)  do_help; exit 0;;
   367         # Skip, auto-stuff compatibility
   368         --build=*|--host=*|--infodir=*|--datadir=*|--sysconfdir=*|--localstatedir=*) shift;;
   369         --build|--host|--infodir|--datadir|--sysconfdir|--localstatedir)             shift 2;;
   370         --enable-shared|--disable-shared|--enable-static|--disable-static)           shift;;
   371         --program-prefix=*)                                                          shift;;
   372         --program-prefix)                                                            shift 2;;
   373         *)          printf "Unrecognised option: '${1}'\n"; do_help; exit 1;;
   374     esac
   375 done
   376 
   377 # Use defaults
   378 [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
   379 
   380 # Special case when installing locally
   381 if [ "${LOCAL_set}" = "y" ]; then
   382     set_prefix "" "$( pwd )"
   383     set_bindir "" "$( pwd )"
   384     set_libdir "" "$( pwd )"
   385     set_docdir "" "$( pwd )/docs"
   386     set_mandir "" "$( pwd )/docs"
   387 fi
   388 
   389 #---------------------------------------------------------------------
   390 # Some sanity checks, now
   391 
   392 # We check for grep and sed manually, because they are used in check_for()
   393 printf "Checking for 'grep'... "
   394 if [ -n "${grep}" ]; then
   395     printf "${grep} (cached)\n"
   396 else
   397     grep="$( which grep 2>/dev/null )"
   398     if [ -z "${grep}" ]; then
   399         printf "not found\n"
   400     else
   401         printf "${grep}\n"
   402         printf "Checking whether '${grep}' supports -E... "
   403         if echo 'foo' |"${grep}" -E 'foo' >/dev/null 2>&1; then
   404             printf "yes\n"
   405         else
   406             printf "no\n"
   407             grep=
   408         fi
   409     fi
   410 fi
   411 if [ -z "${grep}" ]; then
   412     printf "Either you are missing entirely the needed tool,\n"
   413     printf "or the version you have is too old.\n"
   414     printf "You can give the path to this tool using: --with-grep=PATH\n"
   415     do_error "Bailing out..."
   416 fi
   417 add_to_var_list grep
   418 
   419 printf "Checking for 'sed'... "
   420 if [ -n "${sed}" ]; then
   421     printf "${sed} (cached)\n"
   422 else
   423     sed="$( which sed 2>/dev/null )"
   424     if [ -z "${sed}" ]; then
   425         printf "not found\n"
   426     else
   427         printf "${sed}\n"
   428         printf "Checking whether '${sed}' supports -i and -e... "
   429         touch .ct-ng.sed.test
   430         if "${sed}" -r -i -e 's/foo/bar/' .ct-ng.sed.test >/dev/null 2>&1; then
   431             printf "yes\n"
   432         else
   433             printf "no\n"
   434             sed=
   435         fi
   436         rm -f .ct-ng.sed.test
   437     fi
   438 fi
   439 if [ -z "${sed}" ]; then
   440     printf "Either you are missing entirely the needed tool,\n"
   441     printf "or the version you have is too old.\n"
   442     printf "You can give the path to this tool using: --with-sed=PATH\n"
   443     do_error "Bailing out..."
   444 fi
   445 add_to_var_list sed
   446 
   447 # The regular list of tools we can now easily check for
   448 has_or_abort prog=bash                              \
   449              var=bash                               \
   450              ver='^GNU bash, version (3\.[1-9]|4)'  \
   451              err="'bash' 3.1 or above was not found"
   452 has_or_abort prog=cut
   453 has_or_abort prog=install var=install
   454 has_or_abort prog=make                                  \
   455              var=make                                   \
   456              ver='^GNU Make (3.[89][[:digit:]]|[4-9])'  \
   457              err="GNU 'make' 3.80 or above was not found"
   458 has_or_abort prog=gcc
   459 has_or_abort prog="awk gawk" ver='^GNU Awk' err="GNU 'awk' was not found"
   460 has_or_abort prog=bison
   461 has_or_abort prog=flex
   462 has_or_abort prog=makeinfo
   463 has_or_abort prog=automake                                                      \
   464              ver='\(GNU automake\) (1\.[[:digit:]]{2,}|[2-9][[:digit:]]*\.)'    \
   465              err="'automake' 1.10 or above was not found"
   466 has_or_abort prog=libtool                                                                           \
   467              var=libtool                                                                            \
   468              ver='\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)'   \
   469              err="'libtool' 1.5.26 or above was not found"
   470 has_or_abort prog=stat
   471 has_or_abort prog="curl wget"
   472 has_or_abort prog=patch
   473 has_or_abort prog=tar
   474 has_or_abort prog=gzip
   475 has_or_abort prog=bzip2
   476 has_or_warn  prog=xz                                        \
   477              kconfig=has_xzutils                            \
   478              err="xz-comoressed tarballs will not be used"
   479 has_or_abort prog=readlink
   480 has_or_abort prog=objcopy var=objcopy
   481 has_or_abort prog=objdump var=objdump
   482 has_or_abort prog=readelf var=readelf
   483 has_or_abort prog=patch var=patch
   484 has_or_warn  prog=cvs                                                   \
   485              kconfig=has_cvs                                            \
   486              err="it will not be possible to use newlib cvs snapshots"
   487 has_or_warn  prog=svn                               \
   488              kconfig=has_svn                        \
   489              err="subversion is required to download eglibc"
   490 
   491 # Host system checks
   492 
   493 printf "Checking for host system... "
   494 host="$( uname -s )"
   495 printf "%s\n" "${host}"
   496 case "${host}" in
   497     Linux)  ;;
   498     Cygwin) ;;
   499     *)
   500         printf " * Runing under %s is not fully tested\n" "${host}"
   501         printf " * You may encounter some weird behavior\n"
   502         ;;
   503 esac
   504 
   505 printf "Checking if static linking is possible... "
   506 static_link_ok=""
   507 case "${host}" in
   508     Darwin) ;;
   509     *)  tmp=.static.tmp
   510         if gcc -xc - -static -o "${tmp}" >/dev/null 2>&1 <<-_EOF_
   511 				int main() { return 0; }
   512 			_EOF_
   513         then
   514             static_link_ok="y"
   515         fi
   516         rm -f "${tmp}"
   517         ;;
   518 esac
   519 if [ "${static_link_ok}" = "y" ]; then
   520     static_link_ko=""
   521     printf "yes\n"
   522 else
   523     static_link_ko="y"
   524     printf "no\n"
   525     printf " * An optional host feature is missing, some features will be disabled:\n"
   526     printf " * - It will not be possible to statically link toolchain's binaries\n"
   527 fi
   528 add_to_kconfig_list static_link_ok
   529 
   530 # Library checks
   531 libs_exts="so dylib"
   532 if [ "${static_link_ok}" = "y" ]; then
   533     libs_exts="${libs_exts} a"
   534 fi
   535 
   536 ncurses_hdrs="ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h"
   537 ncurses_libs="libncursesw libncurses libcurses"
   538 has_or_abort lib="${ncurses_libs}"                                          \
   539              lib_exts="${libs_exts}"                                        \
   540              inc="${ncurses_hdrs}"                                          \
   541              err="The 'ncurses' library is needed fo the menuconfig frontend"
   542 
   543 has_or_abort lib="libstdc++"            \
   544              lib_exts="${libs_exts}"    \
   545              err="The 'libstdc++' library is needed to build gcc"
   546 
   547 # Yes, we may be checking twice for libstdc++.a
   548 # The first is because we need one instance of libstdc++ (shared or static)
   549 # because it is needed for PPL; the second is because the static version is
   550 # required for static-linking, and if missing, the option is removed.
   551 has_or_warn  lib="libstdc++"                \
   552              lib_exts="a"                   \
   553              err="static 'libstdc++' is needed to statically link the toolchain's executables" \
   554              kconfig=has_static_libstdcxx   \
   555              skip="${static_link_ko}"
   556 
   557 has_or_warn  inc="expat.h"              \
   558              lib="libexpat"             \
   559              lib_exts="${libs_exts}"    \
   560              err="The 'expat' header file and library are needed to link cross-gdb's executables" \
   561              kconfig=has_expat
   562 
   563 # Yes, we may be checking twice for libexpat.a
   564 # The first is because we need one instance of libexpat (shared or static)
   565 # because it is needed for cross-gdb; the second is because the static version
   566 # is required for static-linking, and if missing, the option is removed.
   567 has_or_warn  lib="libexpat"             \
   568              lib_exts="a"               \
   569              err="static 'expat' is needed to statically link cross-gdb's executables" \
   570              kconfig=has_static_expat   \
   571              skip="${static_link_ko}"
   572 
   573 for v in 7 6 5 4; do
   574     python_incs="${python_incs} python2.${v}/Python.h"
   575     python_libs="${python_libs} libpython2.${v}"
   576 done
   577 has_or_warn  inc="${python_incs}"       \
   578              lib="${python_libs}"       \
   579              lib_exts="${libs_exts}"    \
   580              err="The 'python' header file and library are needed for some features of cross-gdb"
   581 
   582 #---------------------------------------------------------------------
   583 # Compute the version string
   584 
   585 # If this version is n hg clone, try to get the revision number
   586 # If we can't get the revision number, use date
   587 printf "\nComputing version string... "
   588 case "${VERSION}" in
   589     *+hg|hg)
   590         REVISION="$( hg id -n 2>/dev/null || true )"
   591         case "${REVISION}" in
   592             "")
   593                 VERSION="${VERSION}_unknown@$( date +%Y%m%d.%H%M%S )";;
   594             *)
   595                 VERSION="${VERSION}_$( hg id -b )@${REVISION%%+}_$( hg id -i )"
   596                 ;;
   597         esac
   598         # Arrange to have no / in the directory name, no need to create an
   599         # arbitrarily deep directory structure
   600         VERSION="$( printf "${VERSION}\n" |"${sed}" -r -e 's|/+|_|g;' )"
   601         ;;
   602 esac
   603 printf "${VERSION}\n"
   604 
   605 #---------------------------------------------------------------------
   606 # Compute and check install paths
   607 
   608 # Now we have the version string, we can build up the paths
   609 [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
   610 [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib"
   611 [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc"
   612 [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man"
   613 
   614 # Install support files in our own sub-dir, so as not to mangle (system)
   615 # files and dirs, but only if not --local
   616 if [ -z "${LOCAL_set}" ]; then
   617     LIBDIR="${LIBDIR}/ct-ng-${VERSION}"
   618     DOCDIR="${DOCDIR}/ct-ng-${VERSION}"
   619 fi
   620 
   621 # Check that install PATHs are absolute
   622 for p in BIN LIB DOC MAN; do
   623     var="${p}DIR"
   624     eval v='"${'"${var}"'}"'
   625     case "${v}" in
   626         /*) ;;
   627         *)  do_error "'${var}' is not an absolute path: '${v}'"
   628     esac
   629 done
   630 
   631 #---------------------------------------------------------------------
   632 # That's all, folks!
   633 
   634 printf "Building up Makefile... "
   635 var_sed="$( for var_name in ${var_list}; do
   636                 eval echo 's,@@${var_name}@@,${'"${var_name}"'},g'
   637             done
   638           )"
   639 kconfig_sed="s/@@KCONFIG@@/$( for k_name in ${kconfig_list}; do
   640                                   eval printf \"${k_name}=\${${k_name}} \"
   641                               done
   642                             )/"
   643 "${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g"       \
   644             -e "s,@@LIBDIR@@,${LIBDIR},g"       \
   645             -e "s,@@DOCDIR@@,${DOCDIR},g"       \
   646             -e "s,@@MANDIR@@,${MANDIR},g"       \
   647             -e "s,@@VERSION@@,${VERSION},g"     \
   648             -e "s,@@DATE@@,${DATE},g"           \
   649             -e "s,@@LOCAL@@,${LOCAL_set},g"     \
   650             -e "${var_sed}"                     \
   651             -e "${kconfig_sed}"                 \
   652          Makefile.in                            \
   653          >Makefile
   654 echo "done"
   655 
   656 cat <<__EOF__
   657 
   658 crosstool-NG configured as follows:
   659   PREFIX='${PREFIX}'
   660   BINDIR='${BINDIR}'
   661   LIBDIR='${LIBDIR}'
   662   DOCDIR='${DOCDIR}'
   663   MANDIR='${MANDIR}'
   664 
   665 Now run:
   666   make
   667 __EOF__
   668 if [ "${LOCAL_set}" != "y" ]; then
   669     printf "  make install\n"
   670 fi