Make it clear that, if the second argument of CT_GetFile starts with a dot, it is considered to be the preferred extension.
/trunk/scripts/functions | 2 1 1 0 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 := tool_test OR pattern|tool_test
15 # tool_test := tool/regexp
16 # tool := name of the tool OR absolute pathname to the tool
17 # regexp := valid grep(1) extended regular expression OR empty
19 # In case a pattern list is given (eg foo|bar|buz), then tests are performed
20 # from left to right, stopping at the first matching test (like the shell
21 # would parse 'foo || bar || buz' ).
24 # /bin/bash/^GNU bash, version 3\.
25 # will ensure that /bin/bash exists, and that $(/bin/bash --version)
26 # matches the regexp '^GNU bash, version 3\.'
27 # autoconf/(GNU Autoconf)|autoconf2.50/
29 # - 'autoconf' is to be found in the PATH, and that $(autoconf
30 # --version) matches the regexp '(GNU Autoconf)' (which btw is
31 # the signature of autoconf >= 2.50),
33 # - 'autoconf2.50' is to be found in the PATH
36 /bin/bash/^GNU bash, version 3\.
44 automake/\(GNU automake\) [[:digit:]]+\.[[:digit:]]{2,}|automake/\(GNU automake\) [2-9][[:digit:]]*\.
53 PREFIX_DEFAULT=/usr/local
66 # Simply print the error message, and exit. Obvious, he?
72 # A small function to test for existence of various tools
73 # Usage: has_or_abort test_pattern (see top of file, TOOLS_TO_CHECK, for
74 # complete pattern format)
76 { IFS="|"; for item in ${1}; do
79 printf "Checking for '${tool}'... "
80 where=$(which "${tool}" 2>/dev/null || true)
81 if [ -z "${where}" ]; then
86 if [ -n "${regexp}" ]; then
87 tool_version=$(${tool} --version 2>&1)
88 str=$(echo "${tool_version}" |grep -E "${regexp}" |head -n 1)
89 if [ -z "${str}" ]; then
90 echo "${where}: wrong version string: expecting regexp '${regexp}'"
100 [ ${FORCE} -eq 0 ] && do_error "Bailing out..."
104 # Given an option string and the following argument,
105 # echoes the value of the option.
106 # If --var=val => echoes val and returns 0, meaning second arg was not consumed
107 # If --var val => echoes val and returns non null, meaning second arg was used
112 echo "${1}" |cut -d '=' -f 2-
123 # The set_xxx functions will set the corresponding configuration variable
124 # They return 0 if second arg was not consumed, and non-zero if it was consumed.
126 PREFIX=$(get_optval "$1" "$2")
131 BINDIR=$(get_optval "$1" "$2")
136 LIBDIR=$(get_optval "$1" "$2")
141 DOCDIR=$(get_optval "$1" "$2")
146 MANDIR=$(get_optval "$1" "$2")
150 # The set_contrib function is different in that it will work like the others,
151 # except in two cases:
152 # If all => replaces all with the list of all available contribs
153 # If list => just echoes the list of all available contribs, and instructs
154 # caller to quit immediately by setting do_quit to non null.
155 # (can't use the return code, see above).
157 opt_val=$(get_optval "$1" "$2")
161 CONTRIB_list=$(LC_ALL=C ls -1 contrib/*.patch.lzma \
162 |xargs -I {} basename {} .patch.lzma \
163 |sed -r -e ':a; /$/N; s/\n/,/; ta;'
168 echo "Available contributions:"
169 LC_ALL=C ls -1 contrib/*.patch.lzma \
170 |xargs -I {} basename {} .patch.lzma \
173 *) CONTRIB_list="${CONTRIB_list},${opt_val}";;
180 \`configure' configures crosstool-NG ${VERSION} to adapt to many kind of systems.
182 USAGE: ./configure [OPTION]...
184 Defaults for the options are specified in brackets.
187 -h, --help display this help and exit
188 --force force ./configure to complete, even if one or more
189 tools were not found. Use at your own risk, only if
190 you know what you are doing!
192 Installation directories:
193 --prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}]
194 --local don't install, and use current directory
196 By default, \`make install' will install all the files in
197 \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify
198 an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
199 for instance \`--prefix=\${HOME}'.
201 For better control, use the options below.
203 Fine tuning of the installation directories:
204 --bindir=DIR user executables [PREFIX/bin]
205 --libdir=DIR object code libraries [PREFIX/lib]
206 --docdir=DIR info documentation [PREFIX/share/doc]
207 --mandir=DIR man documentation [PREFIX/share/man]
210 --with-contrib=XXX Include externally contributed features found in the
211 contrib/ sub-directory. Set to a comma-separated list
212 of features. Use 'all' to use all contributions, and
213 'list' to see which are available.
217 #---------------------------------------------------------------------
220 while [ $# -ne 0 ]; do
222 --prefix*) set_prefix "$1" "$2" && shift || shift 2;;
223 --bindir*) set_bindir "$1" "$2" && shift || shift 2;;
224 --libdir*) set_libdir "$1" "$2" && shift || shift 2;;
225 --docdir*) set_docdir "$1" "$2" && shift || shift 2;;
226 --mandir*) set_mandir "$1" "$2" && shift || shift 2;;
227 --local) LOCAL_set=1; shift;;
228 --force) FORCE=1; shift;;
230 set_contrib "$1" "$2" && shift || shift 2
231 [ "${do_quit}" = "1" ] && exit 0
233 --help|-h) do_help; exit 0;;
239 [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
241 # Special case when installing locally
242 if [ "${LOCAL_set}" = "1" ]; then
246 set_docdir "" $(pwd)/docs
247 set_mandir "" $(pwd)/docs
250 #---------------------------------------------------------------------
251 # Some sanity checks, now
253 # If this version is a svn snapshot, try to get the revision number
254 # If we can't get the revision number, use date
255 printf "Computing version string... "
258 REVISION=$(LC_ALL=C svnversion)
259 case "${REVISION}" in
261 VERSION="${VERSION}_unknown@$(date +%Y%m%d.%H%M%S)";;
263 URL=$(LC_ALL=C svn info 2>/dev/null |egrep 'URL: ' |cut -d ' ' -f 2-)
264 ROOT=$(LC_ALL=C svn info 2>/dev/null |egrep 'Repository Root: ' |cut -d ' ' -f 3-)
265 VERSION="${VERSION}${URL#${ROOT}}@${REVISION}"
268 # Arrange to have no / in the directory name, no need to create an
269 # arbitrarily deep directory structure
270 VERSION=$(echo "${VERSION}" |sed -r -e 's|/+|_|g;')
275 # Now we have the version string, we can build up the paths
276 [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
277 [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib/ct-ng-${VERSION}"
278 [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}"
279 [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man/man1"
281 # Check that install PATHs are absolute
282 for p in BIN LIB DOC MAN; do
287 *) do_error "'${var}' is not an absolute path: '${v}'"
291 # Check the existence of absolutely required tools
294 for tool in ${TOOLS_TO_CHECK}; do
295 has_or_abort "${tool}"
299 # It's safer to change all ',' to spaces rather than setting IFS
300 CONTRIB_list=$(echo "${CONTRIB_list}" |sed -r -e 's/,+/ /g; s/ +/ /g; s/^ //g; s/ $//g;')
301 if [ -n "${CONTRIB_list}" ]; then
302 has_or_abort 'lzcat/'
303 printf "Applying contributed code: "
304 for c in ${CONTRIB_list}; do
306 if [ ! -f "contrib/${c}.patch.lzma" ]; then
307 do_error "Contribution '${c}' does not exist"
309 lzcat "contrib/${c}.patch.lzma" |patch -p1 >/dev/null 2>&1
314 printf "Building up Makefile... "
315 sed -r -e "s,@@BINDIR@@,${BINDIR},g;" \
316 -e "s,@@LIBDIR@@,${LIBDIR},g;" \
317 -e "s,@@DOCDIR@@,${DOCDIR},g;" \
318 -e "s,@@MANDIR@@,${MANDIR},g;" \
319 -e "s,@@VERSION@@,${VERSION},g;" \
320 -e "s,@@DATE@@,${DATE},g;" \
321 -e "s,@@LOCAL@@,${LOCAL_set},g;" \
322 Makefile.in >Makefile
327 crosstool-NG configured as follows:
333 CONTRIB='${CONTRIB_list}'