diff options
Diffstat (limited to 'build-0.3/c/gnu/configure')
-rwxr-xr-x | build-0.3/c/gnu/configure | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/build-0.3/c/gnu/configure b/build-0.3/c/gnu/configure new file mode 100755 index 0000000..713f091 --- /dev/null +++ b/build-0.3/c/gnu/configure @@ -0,0 +1,85 @@ +#! /usr/bin/env bash + +# file : build/c/gnu/configure +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# $1 out file +# $2 optimize (y/n) +# $3 c_extra_options +# $4 c_ld_extra_options +# +# bld_root - build root +# project_name - project name +# + + +source $bld_root/dialog.bash + +$echo +$echo +$echo "configuring '$project_name'" +$echo +$echo + +$echo +$echo "Please enter the gcc binary you would like to use, for example 'gcc-3.4'," +$echo "'/usr/local/bin/gcc' or 'distcc gcc'." +$echo + +c_gnu=`read_path --command gcc` + +# Pass c_extra_options and c_ld_extra_options since those can affect the +# search paths (e.g., -m32) and target. +# +c_gnu_libraries=`$c_gnu $3 $4 -print-search-dirs | sed -e 's/libraries: =//p' -e d` + +c_gnu_target=`$c_gnu $3 $4 -dumpmachine` +c_gnu_target=`$bld_root/system/config.sub "$c_gnu_target"` + +if [ $? != 0 ]; then + $echo "unable to canonicalize target system '$c_gnu_target'" + exit 1 +fi + +c_gnu_target_cpu=`echo $c_gnu_target | cut -f 1 -d -` +c_gnu_target_mf=`echo $c_gnu_target | cut -f 2 -d -` +c_gnu_target_kernel=`echo $c_gnu_target | cut -f 3 -d -` +c_gnu_target_os=`echo $c_gnu_target | cut -f 4 -d -` + +if [ -z "$c_gnu_target_os" ]; then + + # Old format: cpu-mf-os + # + c_gnu_target_os=$c_gnu_target_kernel + c_gnu_target_kernel= +fi + +optimization= + +if [ "$2" == "y" ]; then + + $echo + $echo "Please select the optimization level you would like to use:" + $echo + $echo "(1) -O1 [Tries to reduce code size and execution time, without" + $echo " performing any optimizations that take a great deal of" + $echo " compilation time.]" + $echo "(2) -O2 [Performs nearly all supported optimizations that do not" + $echo " involve a space-speed tradeoff.]" + $echo "(3) -O3 [Optimize even more.]" + $echo "(4) -Os [Optimize for size.]" + $echo + + optimization=`read_option "-O1 -O2 -O3 -Os" "-O2"` + +fi + +echo "c_gnu := $c_gnu" > $1 +echo "c_gnu_libraries := $c_gnu_libraries" >> $1 +echo "c_gnu_optimization_options := $optimization" >> $1 +echo "c_gnu_target := $c_gnu_target" >> $1 +echo "c_gnu_target_cpu := $c_gnu_target_cpu" >> $1 +echo "c_gnu_target_mf := $c_gnu_target_mf" >> $1 +echo "c_gnu_target_kernel := $c_gnu_target_kernel" >> $1 +echo "c_gnu_target_os := $c_gnu_target_os" >> $1 |