When running ./configure, check for the {n,}curses headers.
-------- diffstat follows --------
/trunk/configure | 66 39 27 0 +++++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 39 insertions(+), 27 deletions(-)
5 VERSION=$( cat .version )
8 PREFIX_DEFAULT=/usr/local
19 # Simply print the error message, and exit. Obvious, he?
21 echo "${myname}: ${@}"
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
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.
45 PREFIX="$( get_optval "$1" "$2" )"
49 BINDIR="$( get_optval "$1" "$2" )"
53 LIBDIR="$( get_optval "$1" "$2" )"
57 DOCDIR="$( get_optval "$1" "$2" )"
61 MANDIR="$( get_optval "$1" "$2" )"
64 local var_name="${1%%=*}"
65 var_name="${var_name#--with-}"
66 eval ${var_name}="\$( get_optval "$1" "$2" )"
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.
73 # This function adds a variable name to the above list of variable names.
74 # $1: the name of the variable to add to the list
76 var_list="${var_list} ${1}"
79 # A function to test for required tools/headers/libraries
80 # $*: [prog|inc|lib]=<name[ name...]>
81 # the name(s) of tool(s) to test for
83 # eg: prog=bash prog="curl wget"
85 # the name of the variable to test and set
87 # eg: var=bash if ${bash} is set and non-null, use that,
88 # else check for bash and set bash=$(which bash)
90 # for each 'prog', test if $(prog --version) matches 'regexp'
92 # eg: ver='^GNU bash, version [34]\.'
93 # $*: err=<error_message>
94 # the error message to print if tool is missing
95 # optional, defaults to: '${prog}: none found'
96 # eg: err="'bash' 3.x or above was not found"
106 for item in "${@}"; do
108 prog=*|inc=*|lib=*|var=*|ver=*|err=*)
109 eval ${item%%=*}="'${item#*=}'"
111 *) do_error "has_or_abort: incorrect parameters: '$@'";;
115 case "${prog}:${inc}:${lib}" in
117 for item in ${prog}; do
118 printf "Checking for '${item}'... "
119 if [ -n "${var}" ]; then
120 eval val="\${${var}}"
121 if [ -n "${val}" ]; then
122 printf "${val} (cached)\n"
126 where="$( which "${item}" 2>/dev/null )"
127 if [ -z "${where}" ]; then
130 elif [ -n "${ver}" ]; then
131 version=$( ${where} --version 2>&1 )
132 str=$( echo "${version}" |grep -E "${ver}" |head -n 1 )
133 if [ -z "${str}" ]; then
144 for item in ${inc}; do
145 printf "Checking for '${item}'... "
146 if printf "#include \"${item}\"" |gcc -x c -c - -o /dev/null >/dev/null 2>&1; then
157 if [ -z "${status}" ]; then
158 printf "\n${err:-${prog}${inc}${lib}: none found}\n\n"
159 printf "Either you are missing entirely the needed tool,\n"
160 printf "or the version you have is too old.\n"
161 if [ -n "${var}" ]; then
162 printf "You can give the path to this tool using: --with-${var}=PATH\n"
164 # FORCE can be set in the environment
165 [ -z "${FORCE}" ] && do_error "Bailing out..."
168 printf "<* FORCE in action: *>\n"
169 printf "<* Continuing despite missing pre-requisite *>\n"
170 printf "<* Prepare for breakage *>\n"
175 if [ -n "${var}" ]; then
176 eval ${var}='"'"${where}"'"'
177 add_to_var_list "${var}"
185 \`configure' configures crosstool-NG-${VERSION} to adapt to many kind of systems.
187 USAGE: ./configure [OPTION]...
189 Defaults for the options are specified in brackets.
192 -h, --help display this help and exit
193 --force force configure to continue, even in case
194 some pre-requisites are missing
196 Installation directories:
197 --prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}]
198 --local don't install, and use current directory
200 By default, \`make install' will install all the files in
201 \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify
202 an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
203 for instance \`--prefix=\${HOME}'.
205 For better control, use the options below.
207 Fine tuning of the installation directories:
208 --bindir=DIR user executables [PREFIX/bin]
209 --libdir=DIR object code libraries [PREFIX/lib]
210 --docdir=DIR info documentation [PREFIX/share/doc]
211 --mandir=DIR man documentation [PREFIX/share/man]
214 --with-install=PATH Specify the full PATH to GNU install
215 --with-make=PATH Specify the full PATH to GNU make >= 3.80
216 --with-grep=PATH Specify the full PATH to GNU grep
217 --with-sed=PATH Specify the full PATH to GNU sed
218 --with-bash=PATH Specify the full PATH to bash >= 3.0
222 #---------------------------------------------------------------------
225 while [ $# -ne 0 ]; do
227 --local) LOCAL_set="y"; shift;;
228 --prefix*) set_prefix "$1" "$2" && shift || shift 2;;
229 --bindir*) set_bindir "$1" "$2" && shift || shift 2;;
230 --libdir*) set_libdir "$1" "$2" && shift || shift 2;;
231 --docdir*) set_docdir "$1" "$2" && shift || shift 2;;
232 --mandir*) set_mandir "$1" "$2" && shift || shift 2;;
233 --with-*) set_tool "$1" "$2" && shift || shift 2;;
234 --force) FORCE=1; shift;;
235 --help|-h) do_help; exit 0;;
236 *) echo "Unrecognised option: '${1}'"; do_help; exit 1;;
241 [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
243 # Special case when installing locally
244 if [ "${LOCAL_set}" = "y" ]; then
245 set_prefix "" "$( pwd )"
246 set_bindir "" "$( pwd )"
247 set_libdir "" "$( pwd )"
248 set_docdir "" "$( pwd )/docs"
249 set_mandir "" "$( pwd )/docs"
252 #---------------------------------------------------------------------
253 # Some sanity checks, now
255 # We check for grep and sed manually, because they are used in has_or_abort
256 printf "Checking for 'grep'... "
257 if [ -n "${grep}" ]; then
258 echo "${grep} (cached)"
260 grep="$( which grep 2>/dev/null )"
261 if [ -z "${grep}" ]; then
265 printf "Checking whether '${grep}' supports -E... "
266 if echo 'foo' |"${grep}" -E 'foo' >/dev/null 2>&1; then
274 if [ -z "${grep}" ]; then
275 echo "Either you are missing entirely the needed tool,"
276 echo "or the version you have is too old."
277 echo "You can give the path to this tool using: --with-grep=PATH"
278 do_error "Bailing out..."
282 printf "Checking for 'sed'... "
283 if [ -n "${sed}" ]; then
284 echo "${sed} (cached)"
286 sed="$( which sed 2>/dev/null )"
287 if [ -z "${sed}" ]; then
291 printf "Checking whether '${sed}' supports -i and -e... "
292 touch .ct-ng.sed.test
293 if "${sed}" -r -i -e 's/foo/bar/' .ct-ng.sed.test >/dev/null 2>&1; then
299 rm -f .ct-ng.sed.test
302 if [ -z "${sed}" ]; then
303 echo "Either you are missing entirely the needed tool,"
304 echo "or the version you have is too old."
305 echo "You can give the path to this tool using: --with-sed=PATH"
306 do_error "Bailing out..."
310 # The regular list of tools we can now easily check for
311 has_or_abort prog=bash \
313 ver='^GNU bash, version [34]\.' \
314 err="'bash' 3.x or above was not found"
315 has_or_abort prog=cut
316 has_or_abort prog=install var=install
317 has_or_abort prog=make \
319 ver='^GNU Make (3.[89][[:digit:]]|[4-9])' \
320 err="GNU 'make' 3.80 or above was not found"
321 has_or_abort prog=gcc
322 has_or_abort prog=awk
323 has_or_abort prog=bison
324 has_or_abort prog=flex
325 has_or_abort prog=makeinfo
326 has_or_abort prog=automake \
327 ver='\(GNU automake\) (1\.[[:digit:]]{2,}\.|[2-9][[:digit:]]*\.)' \
328 err="'automake' 1.10 or above was not found"
329 has_or_abort prog=libtool \
330 ver='\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)' \
331 err="'libtool' 1.5.26 or above was not found"
332 has_or_abort prog="curl wget"
333 has_or_abort prog=patch
334 has_or_abort prog=tar
335 has_or_abort prog=gzip
336 has_or_abort prog=bzip2
337 has_or_abort prog=lzma
339 has_or_abort inc="ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h" \
340 err="'ncurses' headers files were not found"
341 #has_or_abort lib="ncursesw ncurses curses" err="'ncurses' library was not found"
343 #---------------------------------------------------------------------
344 # Compute the version string
346 # If this version is a svn snapshot, try to get the revision number
347 # If we can't get the revision number, use date
350 has_or_abort prog=svnversion
351 printf "Computing version string... "
352 REVISION="$( LC_ALL=C svnversion )"
353 case "${REVISION}" in
355 VERSION="${VERSION}_unknown@$( date +%Y%m%d.%H%M%S )";;
357 URL="$( LC_ALL=C svn info 2>/dev/null \
361 ROOT="$( LC_ALL=C svn info 2>/dev/null \
362 |"${grep}" '^Repository Root: ' \
365 VERSION="${VERSION}${URL#${ROOT}}@${REVISION}"
368 # Arrange to have no / in the directory name, no need to create an
369 # arbitrarily deep directory structure
370 VERSION="$( echo "${VERSION}" |"${sed}" -r -e 's|/+|_|g;' )"
375 #---------------------------------------------------------------------
376 # Compute and check install paths
378 # Now we have the version string, we can build up the paths
379 [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
380 [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib/ct-ng-${VERSION}"
381 [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}"
382 [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man/man1"
384 # Check that install PATHs are absolute
385 for p in BIN LIB DOC MAN; do
387 eval v='"${'"${var}"'}"'
390 *) do_error "'${var}' is not an absolute path: '${v}'"
394 #---------------------------------------------------------------------
397 printf "Building up Makefile... "
398 var_sed="$( for var_name in ${var_list}; do
399 eval echo 's,@@${var_name}@@,${'"${var_name}"'},g'
402 "${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g
403 s,@@LIBDIR@@,${LIBDIR},g
404 s,@@DOCDIR@@,${DOCDIR},g
405 s,@@MANDIR@@,${MANDIR},g
406 s,@@VERSION@@,${VERSION},g
409 s,@@LOCAL@@,${LOCAL_set},g" Makefile.in >Makefile
414 crosstool-NG configured as follows:
424 if [ "${LOCAL_set}" != "y" ]; then
425 printf " make install\n"