yann@182: #!/bin/sh yann@182: yann@1311: myname="${0##*/}" yann@1311: yann@1105: VERSION=$( cat .version ) yann@1105: DATE=$( date +%Y%m%d ) yann@182: yann@183: PREFIX_DEFAULT=/usr/local yann@182: yann@182: BINDIR_set= yann@182: LIBDIR_set= yann@182: DOCDIR_set= yann@182: MANDIR_set= yann@2621: PROG_PFX= yann@2622: PROG_SFX= yann@2623: PROG_SED= yann@285: LOCAL_set= yann@1311: FORCE= yann@182: yann@641: do_quit= yann@614: yann@673: # Simply print the error message, and exit. Obvious, he? yann@673: do_error() { yann@1333: printf "${myname}: ${@}\n" yann@673: exit 1 yann@673: } yann@673: yann@641: # Given an option string and the following argument, yann@641: # echoes the value of the option. yann@641: # If --var=val => echoes val and returns 0, meaning second arg was not consumed yann@641: # If --var val => echoes val and returns non null, meaning second arg was used yann@182: get_optval(){ yann@182: case "$1" in yann@182: --*=?*) yann@1333: printf "${1#*=}" yann@1105: return 0 yann@182: ;; yann@182: *) yann@1333: printf "${2}" yann@1105: return 1 yann@182: ;; yann@182: esac yann@182: } yann@182: yann@641: # The set_xxx functions will set the corresponding configuration variable yann@641: # They return 0 if second arg was not consumed, and non-zero if it was consumed. yann@182: set_prefix() { yann@1105: PREFIX="$( get_optval "$1" "$2" )" yann@182: } yann@182: set_bindir() { yann@376: BINDIR_set=1 yann@1105: BINDIR="$( get_optval "$1" "$2" )" yann@182: } yann@182: set_libdir() { yann@376: LIBDIR_set=1 yann@1105: LIBDIR="$( get_optval "$1" "$2" )" yann@182: } yann@182: set_docdir() { yann@376: DOCDIR_set=1 yann@1105: DOCDIR="$( get_optval "$1" "$2" )" yann@182: } yann@182: set_mandir() { yann@376: MANDIR_set=1 yann@1105: MANDIR="$( get_optval "$1" "$2" )" yann@182: } yann@2621: set_program_prefix() { yann@2621: PROG_PFX="$( get_optval "$1" "$2" )" yann@2621: } yann@2622: set_program_suffix() { yann@2622: PROG_SFX="$( get_optval "$1" "$2" )" yann@2622: } yann@2623: set_program_transform_name() { yann@2623: PROG_SED="$( get_optval "$1" "$2" )" yann@2623: } yann@1140: set_tool() { yann@1140: local var_name="${1%%=*}" yann@1140: var_name="${var_name#--with-}" yann@1140: eval ${var_name}="\$( get_optval "$1" "$2" )" yann@614: } yann@614: yann@1311: # var_list is a list of variables, each one holding a path to a yann@1311: # tool, either detected by ./configure, or specified by the user. yann@1311: var_list="" yann@2481: kconfig_list="" yann@1311: yann@1311: # This function adds a variable name to the above list of variable names. yann@1311: # $1: the name of the variable to add to the list yann@1311: add_to_var_list() { yann@2481: local v yann@2481: for v in ${var_list}; do yann@2481: [ "${v}" = "${1}" ] && return 0 yann@2481: done yann@1311: var_list="${var_list} ${1}" yann@1311: } yann@2481: add_to_kconfig_list() { yann@2481: local k yann@2481: for k in ${kconfig_list}; do yann@2481: [ "${k}" = "${1}" ] && return 0 yann@2481: done yann@2481: kconfig_list="${kconfig_list} ${1}" yann@2481: } yann@1311: yann@1311: # A function to test for required tools/headers/libraries yann@1560: # Return 0 (true) if found, !0 (false) if not found yann@1560: # yann@1311: # $*: [prog|inc|lib]= yann@1311: # the name(s) of tool(s) to test for yann@1311: # mandatory yann@1311: # eg: prog=bash prog="curl wget" yann@1311: # $*: var= yann@1311: # the name of the variable to test and set yann@1311: # optional yann@1311: # eg: var=bash if ${bash} is set and non-null, use that, yann@1311: # else check for bash and set bash=$(which bash) yann@1311: # $*: ver= yann@1311: # for each 'prog', test if $(prog --version) matches 'regexp' yann@1311: # optional yann@1311: # eg: ver='^GNU bash, version [34]\.' yann@2527: # $*: lib_exts= yann@2527: # the list of allowed library extension yann@2527: # mandatory yann@2527: # eg: lib_exts="so dylib" lib_exts="so dylib a" yann@1311: # $*: err= yann@1311: # the error message to print if tool is missing yann@1311: # optional, defaults to: '${prog}: none found' yann@1311: # eg: err="'bash' 3.x or above was not found" yann@2480: # Note: err may be printed by caller, not us yann@2481: # $*: kconfig= yann@2481: # the name of a variable to pass down to kconfig if yann@2481: # the prog/inc/lib was found yann@2481: # optional, defaults to none yann@2481: # eg: kconfig=has_libncurses yann@2528: # $*: skip=[y|n|] yann@2528: # if set to 'y', skip the test, but still register the yann@2528: # kconfig and var variables; if 'n' or empty, do the yann@2528: # test. yann@2528: # optional, default to 'n' yann@2528: # eg: skip="${static_link_ko}" yann@1560: check_for() { yann@2527: local lib_exts yann@2528: local skip yann@1311: local val yann@1311: local item yann@1311: local where yann@1312: local status yann@2527: local ext yann@1311: yann@2481: # Note: prog/inc/lib and var/kconfig/ver/err are set here, yann@2479: # but declared by the caller (because it needs it) yann@1311: for item in "${@}"; do yann@1311: case "${item}" in yann@2528: prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*|lib_exts=*|skip=*) yann@2497: eval ${item%%=*}=\"${item#*=}\" yann@1311: ;; yann@2527: *) do_error "check_for: incorrect parameters: '${item}'";; yann@1311: esac yann@1311: done yann@1311: benoit@2507: case "${prog}:${inc}:${lib}" in benoit@2507: ?*:?*:|?*::?*|:?*:?*|?*:?*:?*) benoit@2507: if [ -n "${var}" ]; then benoit@2507: do_error "check_for: the use of var is not compatible with passing several of [prog|inc|lib] at once" benoit@2507: fi benoit@2507: ;; benoit@2507: ::) do_error "check_for: [prog|inc|lib] is mandatory";; benoit@2507: esac benoit@2507: yann@2528: if [ -n "${var}" ]; then yann@2528: add_to_var_list "${var}" yann@2528: fi yann@2481: if [ -n "${kconfig}" ]; then yann@2481: add_to_kconfig_list "${kconfig}" yann@2481: fi yann@2481: yann@2528: if [ "${skip}" = "y" ]; then yann@2528: return 0 yann@2528: fi yann@2528: benoit@2507: if [ -n "${prog}" ]; then benoit@2507: for item in ${prog}; do benoit@2507: printf "Checking for '${item}'... " benoit@2507: if [ -n "${var}" ]; then benoit@2507: eval val="\${${var}}" benoit@2507: if [ -n "${val}" ]; then yann@2528: status="${val} (cached)\n" titus@2625: where="${val}" yann@2528: break yann@1311: fi benoit@2507: fi benoit@2507: where="$( which "${item}" 2>/dev/null )" benoit@2507: if [ -z "${where}" ]; then benoit@2507: printf "no\n" benoit@2507: continue benoit@2507: elif [ -n "${ver}" ]; then benoit@2507: str=$( LC_ALL=C "${where}" --version 2>&1 \ benoit@2507: |grep -E "${ver}" \ benoit@2507: |head -n 1 benoit@2507: ) benoit@2507: if [ -z "${str}" ]; then yann@1312: printf "no\n" benoit@2507: unset where yann@1311: continue yann@1311: fi benoit@2507: fi benoit@2507: status="${where}" benoit@2507: break benoit@2507: done benoit@2507: if [ -z "${status}" ]; then benoit@2507: return 1 benoit@2507: fi benoit@2507: printf "${status}\n" benoit@2507: unset status yann@1560: fi yann@1560: benoit@2507: if [ -n "${inc}" ]; then benoit@2507: for item in ${inc}; do benoit@2507: printf "Checking for '${item}'... " benoit@2507: if printf "#include \"${item}\"" |gcc -x c -c - -o /dev/null >/dev/null 2>&1; then benoit@2507: where="${item}" benoit@2507: status=yes benoit@2507: break; benoit@2507: fi benoit@2507: printf "no\n" benoit@2507: done benoit@2507: if [ -z "${status}" ]; then benoit@2507: return 1 benoit@2507: fi benoit@2507: printf "${status}\n" benoit@2507: unset status benoit@2507: fi benoit@2507: benoit@2507: if [ -n "${lib}" ]; then yann@2527: if [ -z "${lib_exts}" ]; then yann@2527: do_error "check_for: no library extension specified for '${lib}'" yann@2527: fi benoit@2507: for item in ${lib}; do yann@2527: for ext in ${lib_exts}; do yann@2527: printf "Checking for '${item}.${ext}'... " yann@2527: where="$( gcc -print-file-name="${item}.${ext}" )" yann@2527: if [ "${where}" != "${item}.${ext}" ]; then yann@2527: where="$( readlink "${where}" )" yann@2527: status=yes yann@2527: break 2; yann@2527: fi yann@2527: printf "no\n" yann@2527: done benoit@2507: done benoit@2507: if [ -z "${status}" ]; then benoit@2507: return 1 benoit@2507: fi benoit@2507: printf "${status}\n" benoit@2507: unset status benoit@2507: fi benoit@2507: yann@1560: if [ -n "${var}" ]; then yann@1560: eval ${var}='"'"${where}"'"' yann@1560: fi yann@2481: if [ -n "${kconfig}" ]; then yann@2481: eval ${kconfig}=y yann@2481: fi yann@1560: } yann@1560: yann@1560: # This function checks for a tool, and aborts if not found yann@1560: # See check_for(), above, for how to call has_or_abort yann@1560: has_or_abort() { yann@2479: # We declare these 6 variables here, although they are yann@2479: # set in check_for(), called below yann@2479: local prog inc lib yann@2481: local var ver err kconfig yann@2479: yann@1560: if ! check_for "$@"; then yann@2524: printf " * A mandatory dependency is missing, or version mis-match:\n" yann@2524: printf " * - ${err:-${prog}${inc}${lib}: none found}\n" yann@2479: if [ -n "${var}" ]; then yann@2498: printf " * --> You can give the path to this tool using: --with-${var}=PATH\n" yann@2479: fi yann@2479: printf "\n" yann@2479: # Bail out if --force is not specified yann@1312: [ -z "${FORCE}" ] && do_error "Bailing out..." yann@1312: printf "<* *>\n" yann@1312: printf "<* FORCE in action: *>\n" yann@1312: printf "<* Continuing despite missing pre-requisite *>\n" yann@1312: printf "<* Prepare for breakage *>\n" yann@1312: printf "<* *>\n" yann@1312: printf "\n" yann@1312: fi yann@1311: } yann@1311: yann@2480: # This function checks for a tool, and warns if not found yann@2480: # See check_for(), above, for how to call has_or_abort yann@2480: # Note: if err is not set, then no error message is printed yann@2480: has_or_warn() { yann@2480: # We declare these 6 variables here, although they are yann@2480: # set in check_for(), called below yann@2480: local prog inc lib yann@2481: local var ver err kconfig yann@2480: yann@2480: if ! check_for "$@"; then yann@2524: printf " * An optional dependency is missing, some features will be disabled" yann@2524: printf "${err:+:\n * - ${err}}\n" yann@2480: if [ -n "${var}" ]; then yann@2498: printf " * --> You can give the path to this tool using: --with-${var}=PATH\n" yann@2480: fi yann@2480: fi yann@2480: } yann@2480: yann@183: do_help() { yann@183: cat <<__EOF__ yann@1140: \`configure' configures crosstool-NG-${VERSION} to adapt to many kind of systems. yann@183: yann@183: USAGE: ./configure [OPTION]... yann@183: yann@183: Defaults for the options are specified in brackets. yann@183: yann@183: Configuration: yann@1105: -h, --help display this help and exit yann@1311: --force force configure to continue, even in case yann@1311: some pre-requisites are missing yann@615: yann@615: Installation directories: yann@185: --prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}] yann@285: --local don't install, and use current directory yann@183: yann@183: By default, \`make install' will install all the files in yann@183: \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify yann@183: an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix', yann@183: for instance \`--prefix=\${HOME}'. yann@183: yann@183: For better control, use the options below. yann@2619: Note: options marked as \`ignored' are recognised, but not acted upon, as yann@2619: they make no sense for crosstool-NG, or they are not implemented yet. yann@183: yann@183: Fine tuning of the installation directories: yann@683: --bindir=DIR user executables [PREFIX/bin] yann@683: --libdir=DIR object code libraries [PREFIX/lib] yann@683: --docdir=DIR info documentation [PREFIX/share/doc] yann@683: --mandir=DIR man documentation [PREFIX/share/man] yann@2619: --infodir=DIR info documentation [DATAROOTDIR/info] (ignored) yann@2619: --datadir=DIR read-only architecture-independent data [DATAROOTDIR] yann@2619: (ignored) yann@2619: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] (ignored) yann@2619: --localstatedir=DIR modifiable single-machine data [PREFIX/var] (ignored) yann@2619: yann@2619: Program names: yann@2619: --program-prefix=PREFIX prepend PREFIX to installed program names yann@2622: --program-suffix=SUFFIX append SUFFIX to installed program names yann@2623: --program-transform-name=PROGRAM run sed PROGRAM on installed program names yann@2619: yann@2619: System types: yann@2619: --build=BUILD configure for building on BUILD [guessed] (ignored) yann@2619: --host=HOST cross-compile to build programs to run on HOST [BUILD] yann@2619: (ignored) yann@614: yann@614: Optional Features: yann@2619: --enable-shared[=PKGS] build shared libraries [default=yes] (ignored) yann@2619: --enable-static[=PKGS] build static libraries [default=yes] (ignored) yann@2619: yann@2619: Optional Packages: yann@1140: --with-install=PATH Specify the full PATH to GNU install yann@1311: --with-make=PATH Specify the full PATH to GNU make >= 3.80 yann@1140: --with-grep=PATH Specify the full PATH to GNU grep yann@1140: --with-sed=PATH Specify the full PATH to GNU sed yann@1140: --with-bash=PATH Specify the full PATH to bash >= 3.0 yann@183: __EOF__ yann@183: } yann@183: yann@376: #--------------------------------------------------------------------- yann@376: # Set user's options yann@376: yann@182: while [ $# -ne 0 ]; do yann@182: case "$1" in yann@1297: --local) LOCAL_set="y"; shift;; yann@182: --prefix*) set_prefix "$1" "$2" && shift || shift 2;; yann@182: --bindir*) set_bindir "$1" "$2" && shift || shift 2;; yann@182: --libdir*) set_libdir "$1" "$2" && shift || shift 2;; yann@182: --docdir*) set_docdir "$1" "$2" && shift || shift 2;; yann@182: --mandir*) set_mandir "$1" "$2" && shift || shift 2;; yann@1140: --with-*) set_tool "$1" "$2" && shift || shift 2;; yann@2621: --program-prefix=*|--program-prefix) yann@2621: set_program_prefix "$1" "$2" && shift || shift 2 yann@2621: ;; yann@2622: --program-suffix=*|--program-suffix) yann@2622: set_program_suffix "$1" "$2" && shift || shift 2 yann@2622: ;; yann@2623: --program-transform-name=*|--program-transform-name) yann@2623: set_program_transform_name "$1" "$2" && shift || shift 2 yann@2623: ;; yann@1311: --force) FORCE=1; shift;; yann@183: --help|-h) do_help; exit 0;; blueness@1739: # Skip, auto-stuff compatibility blueness@1739: --build=*|--host=*|--infodir=*|--datadir=*|--sysconfdir=*|--localstatedir=*) shift;; blueness@1739: --build|--host|--infodir|--datadir|--sysconfdir|--localstatedir) shift 2;; yann@2551: --enable-shared|--disable-shared|--enable-static|--disable-static) shift;; yann@1333: *) printf "Unrecognised option: '${1}'\n"; do_help; exit 1;; yann@182: esac yann@182: done yann@182: yann@641: # Use defaults yann@185: [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}" yann@641: yann@641: # Special case when installing locally yann@1297: if [ "${LOCAL_set}" = "y" ]; then yann@1105: set_prefix "" "$( pwd )" yann@1105: set_bindir "" "$( pwd )" yann@1105: set_libdir "" "$( pwd )" yann@1105: set_docdir "" "$( pwd )/docs" yann@1105: set_mandir "" "$( pwd )/docs" yann@2621: set_program_prefix "" "" yann@2622: set_program_suffix "" "" yann@2623: set_program_transform_name "" "" yann@285: fi yann@183: yann@376: #--------------------------------------------------------------------- yann@1140: # Some sanity checks, now yann@1106: yann@1560: # We check for grep and sed manually, because they are used in check_for() yann@1140: printf "Checking for 'grep'... " yann@1140: if [ -n "${grep}" ]; then yann@1333: printf "${grep} (cached)\n" yann@1140: else yann@1140: grep="$( which grep 2>/dev/null )" yann@1187: if [ -z "${grep}" ]; then yann@1333: printf "not found\n" yann@1187: else yann@1333: printf "${grep}\n" yann@1187: printf "Checking whether '${grep}' supports -E... " yann@1187: if echo 'foo' |"${grep}" -E 'foo' >/dev/null 2>&1; then yann@1333: printf "yes\n" yann@1187: else yann@1333: printf "no\n" yann@1187: grep= yann@1187: fi yann@1187: fi yann@1106: fi yann@1187: if [ -z "${grep}" ]; then yann@1333: printf "Either you are missing entirely the needed tool,\n" yann@1333: printf "or the version you have is too old.\n" yann@1333: printf "You can give the path to this tool using: --with-grep=PATH\n" yann@1187: do_error "Bailing out..." yann@1140: fi yann@1311: add_to_var_list grep yann@1140: yann@1140: printf "Checking for 'sed'... " yann@1140: if [ -n "${sed}" ]; then yann@1333: printf "${sed} (cached)\n" yann@1140: else yann@1140: sed="$( which sed 2>/dev/null )" yann@1187: if [ -z "${sed}" ]; then yann@1333: printf "not found\n" yann@1187: else yann@1333: printf "${sed}\n" rpjday@1288: printf "Checking whether '${sed}' supports -i and -e... " yann@1187: touch .ct-ng.sed.test yann@1187: if "${sed}" -r -i -e 's/foo/bar/' .ct-ng.sed.test >/dev/null 2>&1; then yann@1333: printf "yes\n" yann@1187: else yann@1333: printf "no\n" yann@1187: sed= yann@1187: fi yann@1187: rm -f .ct-ng.sed.test yann@1187: fi yann@1140: fi yann@1187: if [ -z "${sed}" ]; then yann@1333: printf "Either you are missing entirely the needed tool,\n" yann@1333: printf "or the version you have is too old.\n" yann@1333: printf "You can give the path to this tool using: --with-sed=PATH\n" yann@1187: do_error "Bailing out..." yann@1140: fi yann@1311: add_to_var_list sed yann@1140: yann@1311: # The regular list of tools we can now easily check for yann@1311: has_or_abort prog=bash \ yann@1311: var=bash \ yann@1477: ver='^GNU bash, version (3\.[1-9]|4)' \ yann@1477: err="'bash' 3.1 or above was not found" yann@1311: has_or_abort prog=cut yann@1311: has_or_abort prog=install var=install yann@1311: has_or_abort prog=make \ yann@1311: var=make \ yann@1311: ver='^GNU Make (3.[89][[:digit:]]|[4-9])' \ yann@1311: err="GNU 'make' 3.80 or above was not found" yann@1311: has_or_abort prog=gcc yann@1431: has_or_abort prog="awk gawk" ver='^GNU Awk' err="GNU 'awk' was not found" yann@1311: has_or_abort prog=bison yann@1311: has_or_abort prog=flex yann@1311: has_or_abort prog=makeinfo yann@1311: has_or_abort prog=automake \ oron@1432: ver='\(GNU automake\) (1\.[[:digit:]]{2,}|[2-9][[:digit:]]*\.)' \ yann@1311: err="'automake' 1.10 or above was not found" yann@1311: has_or_abort prog=libtool \ titus@1969: var=libtool \ yann@1311: ver='\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)' \ yann@1311: err="'libtool' 1.5.26 or above was not found" titus@2626: has_or_abort prog=libtoolize \ titus@2626: var=libtoolize \ titus@2626: ver='\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)' \ titus@2626: err="'libtoolize' 1.5.26 or above was not found" titus@1957: has_or_abort prog=stat yann@2660: has_or_abort prog="curl" yann@1311: has_or_abort prog=patch yann@1311: has_or_abort prog=tar yann@1311: has_or_abort prog=gzip yann@1311: has_or_abort prog=bzip2 yann@2607: has_or_warn prog=xz \ yann@2607: kconfig=has_xzutils \ yann@2644: err="xz-compressed tarballs will not be used" yann@2645: has_or_warn prog=lzma \ yann@2645: kconfig=has_lzma \ yann@2646: skip="${has_xzutils}" \ yann@2645: err="lzma-compressed tarballs will not be used" yann@1313: has_or_abort prog=readlink titus@1962: has_or_abort prog=objcopy var=objcopy titus@1962: has_or_abort prog=objdump var=objdump titus@1962: has_or_abort prog=readelf var=readelf titus@1962: has_or_abort prog=patch var=patch yann@2535: has_or_warn prog=cvs \ yann@2535: kconfig=has_cvs \ yann@2535: err="it will not be possible to use newlib cvs snapshots" yann@2591: has_or_warn prog=svn \ yann@2540: kconfig=has_svn \ yann@2540: err="subversion is required to download eglibc" yann@1311: yann@2526: # Library checks yann@2717: libs_exts="so dylib a" yann@2527: yann@2509: ncurses_hdrs="ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h" yann@2527: ncurses_libs="libncursesw libncurses libcurses" yann@2509: has_or_abort lib="${ncurses_libs}" \ yann@2527: lib_exts="${libs_exts}" \ yann@2509: inc="${ncurses_hdrs}" \ yann@2506: err="The 'ncurses' library is needed fo the menuconfig frontend" yann@1106: yann@1106: #--------------------------------------------------------------------- yann@1106: # Compute the version string yann@376: yann@1576: # If this version is n hg clone, try to get the revision number yann@435: # If we can't get the revision number, use date yann@2498: printf "\nComputing version string... " yann@435: case "${VERSION}" in Yann@1409: *+hg|hg) yann@1740: REVISION="$( hg id -n 2>/dev/null || true )" yann@1105: case "${REVISION}" in Yann@1409: "") yann@1105: VERSION="${VERSION}_unknown@$( date +%Y%m%d.%H%M%S )";; yann@1105: *) yann@1430: VERSION="${VERSION}_$( hg id -b )@${REVISION%%+}_$( hg id -i )" yann@1105: ;; yann@1105: esac yann@1105: # Arrange to have no / in the directory name, no need to create an yann@1105: # arbitrarily deep directory structure yann@1333: VERSION="$( printf "${VERSION}\n" |"${sed}" -r -e 's|/+|_|g;' )" yann@444: ;; yann@435: esac yann@1740: printf "${VERSION}\n" yann@435: yann@1106: #--------------------------------------------------------------------- yann@1106: # Compute and check install paths yann@1106: yann@614: # Now we have the version string, we can build up the paths yann@554: [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin" yann@1660: [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib" yann@1660: [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc" yann@2026: [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man" yann@554: yann@1660: # Install support files in our own sub-dir, so as not to mangle (system) yann@1660: # files and dirs, but only if not --local yann@1660: if [ -z "${LOCAL_set}" ]; then yann@1660: LIBDIR="${LIBDIR}/ct-ng-${VERSION}" yann@1660: DOCDIR="${DOCDIR}/ct-ng-${VERSION}" yann@1660: fi yann@1660: yann@1047: # Check that install PATHs are absolute yann@1047: for p in BIN LIB DOC MAN; do yann@1105: var="${p}DIR" yann@1105: eval v='"${'"${var}"'}"' yann@1105: case "${v}" in yann@1105: /*) ;; yann@2621: *) do_error "'${var}' is not an absolute path: '${v}'";; yann@1105: esac yann@1047: done yann@2621: case "${PROG_PFX}" in yann@2621: */*) do_error "program prefix '${PROG_PFX}' contains a '/'";; yann@2621: esac yann@2622: case "${PROG_SFX}" in yann@2622: */*) do_error "program suffix '${PROG_SFX}' contains a '/'";; yann@2622: esac yann@1047: yann@1106: #--------------------------------------------------------------------- yann@1106: # That's all, folks! yann@614: yann@641: printf "Building up Makefile... " yann@1140: var_sed="$( for var_name in ${var_list}; do yann@1140: eval echo 's,@@${var_name}@@,${'"${var_name}"'},g' yann@2481: done yann@1140: )" yann@2481: kconfig_sed="s/@@KCONFIG@@/$( for k_name in ${kconfig_list}; do yann@2481: eval printf \"${k_name}=\${${k_name}} \" yann@2481: done yann@2481: )/" yann@2481: "${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g" \ yann@2481: -e "s,@@LIBDIR@@,${LIBDIR},g" \ yann@2481: -e "s,@@DOCDIR@@,${DOCDIR},g" \ yann@2481: -e "s,@@MANDIR@@,${MANDIR},g" \ yann@2621: -e "s,@@PROG_PFX@@,${PROG_PFX},g" \ yann@2622: -e "s,@@PROG_SFX@@,${PROG_SFX},g" \ yann@2623: -e "s,@@PROG_SED@@,${PROG_SED},g" \ yann@2481: -e "s,@@VERSION@@,${VERSION},g" \ yann@2481: -e "s,@@DATE@@,${DATE},g" \ yann@2481: -e "s,@@LOCAL@@,${LOCAL_set},g" \ yann@2481: -e "${var_sed}" \ yann@2481: -e "${kconfig_sed}" \ yann@2481: Makefile.in \ yann@2481: >Makefile yann@673: echo "done" yann@185: yann@185: cat <<__EOF__ yann@673: yann@197: crosstool-NG configured as follows: yann@554: PREFIX='${PREFIX}' yann@554: BINDIR='${BINDIR}' yann@554: LIBDIR='${LIBDIR}' yann@554: DOCDIR='${DOCDIR}' yann@554: MANDIR='${MANDIR}' yann@2621: PROG_PFX='${PROG_PFX}' yann@2622: PROG_SFX='${PROG_SFX}' yann@2623: PROG_SED='${PROG_SED}' yann@1106: yann@1106: Now run: yann@1106: make yann@185: __EOF__ yann@1298: if [ "${LOCAL_set}" != "y" ]; then yann@1297: printf " make install\n" yann@1297: fi