summaryrefslogtreecommitdiff
path: root/build-0.3/c/gnu/configure
diff options
context:
space:
mode:
Diffstat (limited to 'build-0.3/c/gnu/configure')
-rwxr-xr-xbuild-0.3/c/gnu/configure40
1 files changed, 35 insertions, 5 deletions
diff --git a/build-0.3/c/gnu/configure b/build-0.3/c/gnu/configure
index 5695ba4..713f091 100755
--- a/build-0.3/c/gnu/configure
+++ b/build-0.3/c/gnu/configure
@@ -1,12 +1,13 @@
#! /usr/bin/env bash
# file : build/c/gnu/configure
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# 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
@@ -27,8 +28,32 @@ $echo "'/usr/local/bin/gcc' or 'distcc gcc'."
$echo
c_gnu=`read_path --command gcc`
-c_gnu_libraries=`$c_gnu -print-search-dirs | sed -e 's/libraries: =//p' -e d`
+# 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=
@@ -50,6 +75,11 @@ if [ "$2" == "y" ]; then
fi
-echo "c_gnu := $c_gnu" > $1
-echo "c_gnu_libraries := $c_gnu_libraries" >> $1
+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