Remove the check for absolutely needed tools now ./configure checks for them.
Move the check for 'lynx' to where it is needed (that is when sstrip from buildroot is selected).
/trunk/scripts/build/tools/200-sstrip.sh | 1 1 0 0 +
/trunk/scripts/crosstool.sh | 5 0 5 0 -----
2 files changed, 1 insertion(+), 5 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... :-/
26 PREFIX_DEFAULT=/usr/local
37 # Simply print the error message, and exit. Obvious, he?
43 # A small function to test for existence of various tools
44 # Usage: has_or_abort foobar
45 # -> foobar must exist in PATH
46 # Usage: has_or_abort foobar/string
47 # -> foobar must exist in PATH, and $(foobar --version) must contain 'string'
49 tool=$(echo "${1}/" |cut -d / -f 1)
50 regexp=$(echo "${1}/" |cut -d / -f 2)
51 printf "Checking for '${tool}'... "
52 where=$(which "${tool}" 2>/dev/null || true)
53 if [ -z "${where}" ]; then
57 if [ -n "${regexp}" ]; then
58 str=$(${tool} --version 2>&1 |egrep "${regexp}" |head -n 1)
59 if [ -z "${str}" ]; then
60 do_error " failed: '${tool} --version' does not match regexp '${regexp}'"
68 # Given an option string and the following argument,
69 # echoes the value of the option.
70 # If --var=val => echoes val and returns 0, meaning second arg was not consumed
71 # If --var val => echoes val and returns non null, meaning second arg was used
76 echo "${1}" |cut -d '=' -f 2-
87 # The set_xxx functions will set the corresponding configuration variable
88 # They return 0 if second arg was not consumed, and non-zero if it was consumed.
90 PREFIX=$(get_optval "$1" "$2")
95 BINDIR=$(get_optval "$1" "$2")
100 LIBDIR=$(get_optval "$1" "$2")
105 DOCDIR=$(get_optval "$1" "$2")
110 MANDIR=$(get_optval "$1" "$2")
114 # The set_contrib function is different in that it will work like the others,
115 # except in two cases:
116 # If all => replaces all with the list of all available contribs
117 # If list => just echoes the list of all available contribs, and instructs
118 # caller to quit immediately by setting do_quit to non null.
119 # (can't use the return code, see above).
121 opt_val=$(get_optval "$1" "$2")
125 CONTRIB_list=$(LC_ALL=C ls -1 contrib/*.patch.lzma \
126 |xargs -I {} basename {} .patch.lzma \
127 |sed -r -e ':a; /$/N; s/\n/,/; ta;'
132 echo "Available contributions:"
133 LC_ALL=C ls -1 contrib/*.patch.lzma \
134 |xargs -I {} basename {} .patch.lzma \
137 *) CONTRIB_list="${CONTRIB_list},${opt_val}";;
144 \`configure' configures crosstool-NG ${VERSION} to adapt to many kind of systems.
146 USAGE: ./configure [OPTION]...
148 Defaults for the options are specified in brackets.
151 -h, --help display this help and exit
153 Installation directories:
154 --prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}]
155 --local don't install, and use current directory
157 By default, \`make install' will install all the files in
158 \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify
159 an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
160 for instance \`--prefix=\${HOME}'.
162 For better control, use the options below.
164 Fine tuning of the installation directories:
165 --bindir=DIR user executables [PREFIX/bin]
166 --libdir=DIR object code libraries [PREFIX/lib]
167 --docdir=DIR info documentation [PREFIX/share/doc]
168 --mandir=DIR man documentation [PREFIX/share/man]
171 --with-contrib=XXX Include externally contributed features found in the
172 contrib/ sub-directory. Set to a comma-separated list
173 of features. Use 'all' to use all contributions, and
174 'list' to see which are available.
178 #---------------------------------------------------------------------
181 while [ $# -ne 0 ]; do
183 --prefix*) set_prefix "$1" "$2" && shift || shift 2;;
184 --bindir*) set_bindir "$1" "$2" && shift || shift 2;;
185 --libdir*) set_libdir "$1" "$2" && shift || shift 2;;
186 --docdir*) set_docdir "$1" "$2" && shift || shift 2;;
187 --mandir*) set_mandir "$1" "$2" && shift || shift 2;;
188 --local) LOCAL_set=1; shift;;
190 set_contrib "$1" "$2" && shift || shift 2
191 [ "${do_quit}" = "1" ] && exit 0
193 --help|-h) do_help; exit 0;;
199 [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
201 # Special case when installing locally
202 if [ "${LOCAL_set}" = "1" ]; then
206 set_docdir "" $(pwd)/docs
207 set_mandir "" $(pwd)/docs
210 #---------------------------------------------------------------------
211 # Some sanity checks, now
213 # If this version is a svn snapshot, try to get the revision number
214 # If we can't get the revision number, use date
215 printf "Computing version string... "
218 REVISION=$(LC_ALL=C svnversion)
219 case "${REVISION}" in
221 VERSION="${VERSION}unknown@$(date +%Y%m%d.%H%M%S)";;
223 URL=$(LC_ALL=C svn info 2>/dev/null |egrep 'URL: ' |cut -d ' ' -f 2-)
224 ROOT=$(LC_ALL=C svn info 2>/dev/null |egrep 'Repository Root: ' |cut -d ' ' -f 3-)
225 VERSION="${VERSION}${URL#${ROOT}}@${REVISION}"
228 # Arrange to have no / in the directory name, no need to create an
229 # arbitrarily deep directory structure
230 VERSION=$(echo "${VERSION}" |sed -r -e 's|/+|_|g;')
235 # Now we have the version string, we can build up the paths
236 [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
237 [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib/ct-ng-${VERSION}"
238 [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}"
239 [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man/man1"
241 # Check bash is present, and at least version 3.0
242 printf "Checking '/bin/bash' is at least bash-3.0... "
243 [ -x /bin/bash ] || do_error "bash 3.0 or above was not found in '/bin/bash'"
244 bash_version=$(/bin/bash -c 'echo ${BASH_VERSION}')
245 bash_major=$(/bin/bash -c 'echo ${BASH_VERSINFO[0]}')
246 [ ${bash_major} -ge 3 ] || do_error "bash 3.0 or above is needed ('/bin/bash' is '${bash_version}')"
247 echo "${bash_version}"
249 # Check the existence of absolutely required tools
250 for tool in ${TOOLS_TO_CHECK}; do
251 has_or_abort "${tool}"
254 # It's safer to change all ',' to spaces rather than setting IFS
255 CONTRIB_list=$(echo "${CONTRIB_list}" |sed -r -e 's/,+/ /g;')
256 if [ -n "${CONTRIB_list}" ]; then
258 printf "Applying contributed code: "
259 for c in ${CONTRIB_list}; do
261 if [ ! -f "contrib/${c}.patch.lzma" ]; then
262 do_error "Contribution '${c}' does not exist"
264 lzcat "contrib/${c}.patch.lzma" |patch -p1 >/dev/null 2>&1
269 printf "Building up Makefile... "
270 sed -r -e "s,@@BINDIR@@,${BINDIR},g;" \
271 -e "s,@@LIBDIR@@,${LIBDIR},g;" \
272 -e "s,@@DOCDIR@@,${DOCDIR},g;" \
273 -e "s,@@MANDIR@@,${MANDIR},g;" \
274 -e "s,@@VERSION@@,${VERSION},g;" \
275 -e "s,@@DATE@@,${DATE},g;" \
276 -e "s,@@LOCAL@@,${LOCAL_set},g;" \
277 Makefile.in >Makefile
282 crosstool-NG configured as follows:
288 CONTRIB='${CONTRIB_list}'