Use the paths found by ./configure in the ct-ng.in makefile script and its fragments.
/trunk/kconfig/kconfig.mk | 2 1 1 0 +-
/trunk/samples/samples.mk | 18 9 9 0 +++++++++---------
/trunk/config/config.mk | 10 5 5 0 +++++-----
/trunk/ct-ng.in | 22 13 9 0 +++++++++++++---------
4 files changed, 28 insertions(+), 24 deletions(-)
3 VERSION=$( cat .version )
6 # All absolutely required tools, one per line to ease diff.
7 # See function 'has_or_abort, below, for syntax
8 # - Hopefully, if gcc is present, then all associated tools will be
9 # - awk must be GNU awk
10 # - makeinfo for building docs, even if discarded later on
11 # - others obvious... :-/
13 # Format of a pattern to check for, one per line:
14 # pattern := var_name : tool_pattern OR tool_pattern
15 # tool_pattern := tool_test OR tool_pattern || tool_test
16 # tool_test := tool=regexp OR tool
17 # tool := basename of the tool OR absolute pathname to the tool
18 # regexp := valid grep(1) extended regular expression, $( tool --version)
19 # will be matched against this regexp.
21 # In case a pattern list is given (eg foo || bar || buz), then tests are performed
22 # from left to right, stopping at the first matching test (like the shell
23 # would parse 'foo || bar || buz' ).
26 # bash:bash=^GNU bash, version 3\.
27 # - if ${bash} is set and non-null, does nothing
28 # - else ensures that bash exists in the PATH, and that
29 # "$( "$( which bash )" --version |head -n 1 )"
30 # matches the regexp '^GNU bash, version 3\.'
31 # - if so, then sets bash="$( which bash )"
32 # autoconf=(GNU Autoconf) || autoconf2.50
33 # - does not look at an existing variable
35 # - 'autoconf' is to be found in the PATH, and that $( autoconf --version |head -n 1 )
36 # matches the regexp '(GNU Autoconf)' (which btw is the signature of
39 # - 'autoconf2.50' is to be found in the PATH
42 bash:bash=^GNU bash, version 3\.
45 install:install=GNU coreutils
48 awk:awk=^GNU Awk || gawk=^GNU Awk
52 automake=\(GNU automake\) (1\.[[:digit:]]{2,}\.|[2-9][[:digit:]]*\.)
53 libtool=\(GNU libtool\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)
61 PREFIX_DEFAULT=/usr/local
71 # Simply print the error message, and exit. Obvious, he?
77 # A small function to test for existence of various tools
78 # Usage: has_or_abort test_pattern (see top of file, TOOLS_TO_CHECK, for
79 # complete pattern format)
87 var_name="$( echo "${1}" |"${sed}" -r -e 's/^(([^=:]+):.+|[^:=]+=.+|[^:=]+)$/\2/;' )"
88 field="${var_name:+2}"
90 tool_pattern="$( echo "${1}" |cut -d : -f ${field}- |"${sed}" -r -e 's/ *\|\| */\n/g;' )"
96 for item in ${tool_pattern}; do
107 printf "Checking for '${tool}'... "
108 if [ -n "${var_name}" ]; then
109 eval var_value='"${'"${var_name}"'}"'
110 if [ -n "${var_value}" ]; then
111 echo "${var_value} (cached)"
115 where=$( which "${tool}" 2>/dev/null )
116 if [ -z "${where}" ]; then
120 elif [ -n "${regexp}" ]; then
121 tool_version=$( ${tool} --version 2>&1 )
122 str=$( echo "${tool_version}" |"${grep}" -E "${regexp}" |head -n 1 )
123 if [ -z "${str}" ]; then
131 if [ -z "${where}" ]; then
132 for item in ${tool_pattern}; do
142 printf " could not find '${tool}'"
143 [ -n "${regexp}" ] && printf " matching regexp '${regexp}'"
146 echo "Either you are missing entirely the needed tool,"
147 echo "or the version you have is tool old."
148 if [ -n "${var_name}" ]; then
149 echo "You can give the path to this tool using: --with-${var_name}=PATH"
151 # FORCE can be set in the environment
152 [ -z "${FORCE}" ] && do_error "Bailing out..."
155 if [ -n "${var_name}" ]; then
156 eval ${var_name}='"'"${where}"'"'
163 # Given an option string and the following argument,
164 # echoes the value of the option.
165 # If --var=val => echoes val and returns 0, meaning second arg was not consumed
166 # If --var val => echoes val and returns non null, meaning second arg was used
180 # The set_xxx functions will set the corresponding configuration variable
181 # They return 0 if second arg was not consumed, and non-zero if it was consumed.
183 PREFIX="$( get_optval "$1" "$2" )"
187 BINDIR="$( get_optval "$1" "$2" )"
191 LIBDIR="$( get_optval "$1" "$2" )"
195 DOCDIR="$( get_optval "$1" "$2" )"
199 MANDIR="$( get_optval "$1" "$2" )"
202 local var_name="${1%%=*}"
203 var_name="${var_name#--with-}"
204 eval ${var_name}="\$( get_optval "$1" "$2" )"
209 \`configure' configures crosstool-NG-${VERSION} to adapt to many kind of systems.
211 USAGE: ./configure [OPTION]...
213 Defaults for the options are specified in brackets.
216 -h, --help display this help and exit
218 Installation directories:
219 --prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}]
220 --local don't install, and use current directory
222 By default, \`make install' will install all the files in
223 \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify
224 an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
225 for instance \`--prefix=\${HOME}'.
227 For better control, use the options below.
229 Fine tuning of the installation directories:
230 --bindir=DIR user executables [PREFIX/bin]
231 --libdir=DIR object code libraries [PREFIX/lib]
232 --docdir=DIR info documentation [PREFIX/share/doc]
233 --mandir=DIR man documentation [PREFIX/share/man]
236 --with-install=PATH Specify the full PATH to GNU install
237 --with-make=PATH Specify the full PATH to GNU make
238 --with-grep=PATH Specify the full PATH to GNU grep
239 --with-sed=PATH Specify the full PATH to GNU sed
240 --with-awk=PATH Specify the full PATH to GNU awk
241 --with-bash=PATH Specify the full PATH to bash >= 3.0
245 #---------------------------------------------------------------------
248 while [ $# -ne 0 ]; do
250 --local) LOCAL_set=1; shift;;
251 --prefix*) set_prefix "$1" "$2" && shift || shift 2;;
252 --bindir*) set_bindir "$1" "$2" && shift || shift 2;;
253 --libdir*) set_libdir "$1" "$2" && shift || shift 2;;
254 --docdir*) set_docdir "$1" "$2" && shift || shift 2;;
255 --mandir*) set_mandir "$1" "$2" && shift || shift 2;;
256 --with-*) set_tool "$1" "$2" && shift || shift 2;;
257 --help|-h) do_help; exit 0;;
258 *) echo "Unrecognised option: '${1}'"; do_help; exit 1;;
263 [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
265 # Special case when installing locally
266 if [ "${LOCAL_set}" = "1" ]; then
267 set_prefix "" "$( pwd )"
268 set_bindir "" "$( pwd )"
269 set_libdir "" "$( pwd )"
270 set_docdir "" "$( pwd )/docs"
271 set_mandir "" "$( pwd )/docs"
274 #---------------------------------------------------------------------
275 # Some sanity checks, now
277 # We check for grep and sed manually, because they are used in has_or_abort
278 printf "Checking for 'grep'... "
279 if [ -n "${grep}" ]; then
280 echo "${grep} (cached)"
282 grep="$( which grep 2>/dev/null )"
283 [ -z "${grep}" ] && do_error "not found"
286 printf "Checking whether '${grep}' supports -E... "
287 if echo 'foo' |"${grep}" -E 'foo' >/dev/null 2>&1; then
293 printf "Checking for 'sed'... "
294 if [ -n "${sed}" ]; then
295 echo "${sed} (cached)"
297 sed="$( which sed 2>/dev/null )"
298 [ -z "${sed}" ] && do_error "not found"
301 printf "Checking wether '${sed}' supports -i and -e... "
302 touch .ct-ng.sed.test
303 if "${sed}" -r -i -e 's/foo/bar/' .ct-ng.sed.test >/dev/null 2>&1; then
304 rm -f .ct-ng.sed.test
307 rm -f .ct-ng.sed.test
311 # Check the existence of absolutely required tools
315 for tool in ${TOOLS_TO_CHECK}; do
316 has_or_abort "${tool}"
320 #---------------------------------------------------------------------
321 # Compute the version string
323 # If this version is a svn snapshot, try to get the revision number
324 # If we can't get the revision number, use date
325 printf "Computing version string... "
328 REVISION="$( LC_ALL=C svnversion )"
329 case "${REVISION}" in
331 VERSION="${VERSION}_unknown@$( date +%Y%m%d.%H%M%S )";;
333 URL="$( LC_ALL=C svn info 2>/dev/null \
337 ROOT="$( LC_ALL=C svn info 2>/dev/null \
338 |"${grep}" '^Repository Root: ' \
341 VERSION="${VERSION}${URL#${ROOT}}@${REVISION}"
344 # Arrange to have no / in the directory name, no need to create an
345 # arbitrarily deep directory structure
346 VERSION="$( echo "${VERSION}" |"${sed}" -r -e 's|/+|_|g;' )"
351 #---------------------------------------------------------------------
352 # Compute and check install paths
354 # Now we have the version string, we can build up the paths
355 [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
356 [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib/ct-ng-${VERSION}"
357 [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}"
358 [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man/man1"
360 # Check that install PATHs are absolute
361 for p in BIN LIB DOC MAN; do
363 eval v='"${'"${var}"'}"'
366 *) do_error "'${var}' is not an absolute path: '${v}'"
370 #---------------------------------------------------------------------
373 printf "Building up Makefile... "
376 $( printf "${TOOLS_TO_CHECK}" \
377 |"${sed}" -r -e 's/^(([^=:]+):.+|[^:=]+=.+|[^:=]+)$/\2/;'
379 var_sed="$( for var_name in ${var_list}; do
380 eval echo 's,@@${var_name}@@,${'"${var_name}"'},g'
383 "${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g
384 s,@@LIBDIR@@,${LIBDIR},g
385 s,@@DOCDIR@@,${DOCDIR},g
386 s,@@MANDIR@@,${MANDIR},g
387 s,@@VERSION@@,${VERSION},g
390 s,@@LOCAL@@,${LOCAL_set},g" Makefile.in >Makefile
395 crosstool-NG configured as follows: