-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·185 lines (165 loc) · 5.23 KB
/
configure
File metadata and controls
executable file
·185 lines (165 loc) · 5.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/sh
# $Id: configure 890 2009-04-21 17:14:44Z hoenicke $
#
# Generator for brickOS host-OS-dependend Makefile variables
#
# 15.10.02 - Version 1.0 M. Obenland
# obenland@t-online.de
#
# 21.10.02 - Version 1.0 Updates S. Moraco
# stephen@debian.org
#
# 31.10.02 - Version 1.0a Changed name separation routine
# to use dirname / basename to handle
# 'gcc' in pathname M. Obenland
# obenland@t-online.de
#
# 01.06.03 - Version 1.10 Changed array of search paths to a list
# for compatibility with POSIX /bin/sh
# F. Gifford fgiff@users.sourceforge.net
#
echo ""
echo "Welcome to the brickOS-bibo Makefile configurator."
echo "Attempting to find the gcc compiler for the h8300. (This might take some time.)"
echo ""
TOOL_BASE_NAME=gcc
if [ -z ${CROSSTOOLPREFIX+x} ] ; then
# Check for known files in known locations, first,
# so can avoid expensive search
#
# Known directories in which the h8300 toolchain might be found
TOOL_DIR="\"\"
/usr/local/bin
/usr/bin
/usr/local/brickbot/bin
/usr/local/brickos/bin
/usr/local/lego/bin
/usr/local/rcx/bin
/usr/local/h8300-hms/bin
/usr/h8300-hitachi-hms/bin
/usr/local/crossgcc/h8300-hitachi-hms/bin
"
# Known PREFIXs of the h8300 toolchain
TOOL_PREFIX="
h8300-hitachi-coff-
h8300-hitachi-hms-
h8300-hms-
h8300hms-
"
TOOL_SUFFIX="\"\"
-3
-4.4
"
# for each path, do...
for TOOL_DIR_CANDIDATE in $TOOL_DIR
do
# Handle the empty string ("")
TOOL_DIR_CANDIDATE=${TOOL_DIR_CANDIDATE%\"\"}
# Append a trailing slash only if non-empty
TOOL_DIR_CANDIDATE=${TOOL_DIR_CANDIDATE}${TOOL_DIR_CANDIDATE:+/}
# for each basename prefix. do...
for TOOL_PREFIX_CANDIDATE in $TOOL_PREFIX
do
TOOL_PATH_PREFIX_CANDIDATE="${TOOL_DIR_CANDIDATE}${TOOL_PREFIX_CANDIDATE}"
# for each suffix (empty string, -3, and -4.4)
for TOOL_SUFFIX_CANDIDATE in ${CROSSTOOLSUFFIX:-$TOOL_SUFFIX}
do
TOOL_SUFFIX_CANDIDATE="${TOOL_SUFFIX_CANDIDATE%\"\"}"
# for each suffix (.exe and empty str), do...
for TOOL_EXT_CANDIDATE in ".exe" ""
do
TOOL_FULL_PATH_TEST="${TOOL_PATH_PREFIX_CANDIDATE}${TOOL_BASE_NAME}${TOOL_SUFFIX_CANDIDATE}${TOOL_EXT_CANDIDATE}"
#echo "Testing \"${TOOL_FULL_PATH_TEST}\""
if which "${TOOL_FULL_PATH_TEST}" > /dev/null
then
CROSSTOOLPREFIX="$TOOL_PATH_PREFIX_CANDIDATE"
CROSSTOOLSUFFIX="$TOOL_SUFFIX_CANDIDATE"
CROSSTOOLEXT="$TOOL_EXT_CANDIDATE"
break # have answer, exit extension loop
fi
done
if test -n "$CROSSTOOLPREFIX"
then
break # have answer, exit filename suffix loop
fi
done
if test -n "$CROSSTOOLPREFIX"
then
break # have answer, exit filename prefix loop
fi
done
if test -n "$CROSSTOOLPREFIX"
then
break # have answer, exit directory loop
fi
done
#
# if didn't find in expected location...
# search filesystem for full name of hitachi gcc compiler and path
#
# This can be quite harmful. Uncomment if you really want it.
#if test -z "$H8FULL"
#then
# H8FULL=`find / -type f \( -name 'h8*gcc' -o -name 'h8*gcc.exe' \) -print`
#fi
#
# if no compiler is found, exit
#
if test -z "$CROSSTOOLPREFIX"
then
echo "No gcc compiler found for the h8300, please install compiler or edit" \
"the configure script and try again."
exit 1
fi
else
if which "${CROSSTOOLPREFIX}${TOOL_BASE_NAME}${CROSSTOOLSUFFIX}${CROSSTOOLEXT}" > /dev/null
then
echo "No gcc compiler found using the specified CROSSTOOL variables."
echo "Please install compiler or edit the supplied CROSSTOOL variables and try again."
echo "Supplied values were:"
echo " - CROSSTOOLPREFIX = \"$CROSSTOOLPREFIX\""
echo " - CROSSTOOLSUFFIX = \"$CROSSTOOLSUFFIX\""
echo " - CROSSTOOLEXT = \"$CROSSTOOLEXT\""
exit 1
fi
fi
echo " - CROSSTOOLPREFIX = \"$CROSSTOOLPREFIX\""
echo " - CROSSTOOLSUFFIX = \"$CROSSTOOLSUFFIX\""
echo " - CROSSTOOLEXT = \"$CROSSTOOLEXT\""
# Common CFLAGS for standard (non-cross) compilation
CFLAGS="-O2 -Wall"
CC=gcc
#
# look for .exe in the compiler name. This indicates Windows environment
# which means that CYGWIN or DJGPP toolset is being used
#
case "$CROSSTOOLEXT" in
*.exe)
echo " - Found Cygwin/DJGPP system"
SED_SFLAG=1
EXT=.exe
CFLAGS="-D_WIN32 ${CFLAGS}"
CFLG_PE='+'
;;
*)
echo " - Found Linux/Unix system"
SED_SFLAG=""
EXT=""
CFLAGS="-g ${CFLAGS}"
CFLG_PE=""
;;
esac
echo ""
MAKEDEPEND="\$(CC) -M"
BRICKOS_ROOT=`pwd`
cat > Makefile.config <<EOF
# DO NOT EDIT: This file is auto-generated by configure
CROSSTOOLPREFIX?=$CROSSTOOLPREFIX
CROSSTOOLSUFFIX?=$CROSSTOOLSUFFIX
CROSSTOOLEXT?=$CROSSTOOLEXT
CC=$CC
CFLAGS+=$CFLAGS
SED_SFLAG=$SED_SFLAG
EXT=$EXT
EOF
exit 0