History

Make build CPU detection a tad more flexible

Thomas Preud'homme committed 12 years ago

Commit 0e3d2e01 parent 6e56bb31 file · +59 −50Browse files

Unified · Split

configure+59−50
@@ -71,46 +71,52 @@ if test -z "$source_path" -o "$source_path" = "." ; then · 70 unmodified lines
7171 source_path_used="no"
7272 fi
7373
74−case "$cpu" in
75− i386|i486|i586|i686|i86pc|BePC|i686-AT386)
76− cpu="x86"
77− ;;
78− x86_64|amd64)
79− cpu="x86-64"
80− ;;
81− arm*)
82− case "$cpu" in
83− arm|armv4l)
84− cpuver=4
85− ;;
86− armv5tel|armv5tejl)
87− cpuver=5
88− ;;
89− armv6j|armv6l)
90− cpuver=6
91− ;;
92− armv7a|armv7l)
93− cpuver=7
94− ;;
95− esac
96− cpu="armv4l"
97− ;;
98− alpha)
99− cpu="alpha"
100− ;;
101− "Power Macintosh"|ppc|ppc64)
102− cpu="powerpc"
103− ;;
104− mips)
105− cpu="mips"
106− ;;
107− s390)
108− cpu="s390"
109− ;;
110− *)
111− cpu="unknown"
112− ;;
113−esac
74+classify_cpu ()
75+{
76+ cpu="$1"
77+
78+ case "$cpu" in
79+ x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
80+ cpu="x86"
81+ ;;
82+ x86_64|amd64)
83+ cpu="x86-64"
84+ ;;
85+ arm*)
86+ case "$cpu" in
87+ arm|armv4l)
88+ cpuver=4
89+ ;;
90+ armv5tel|armv5tejl)
91+ cpuver=5
92+ ;;
93+ armv6j|armv6l)
94+ cpuver=6
95+ ;;
96+ armv7a|armv7l)
97+ cpuver=7
98+ ;;
99+ esac
100+ cpu="armv4l"
101+ ;;
102+ alpha)
103+ cpu="alpha"
104+ ;;
105+ "Power Macintosh"|ppc|ppc64)
106+ cpu="powerpc"
107+ ;;
108+ mips)
109+ cpu="mips"
110+ ;;
111+ s390)
112+ cpu="s390"
113+ ;;
114+ *)
115+ echo "Unsupported CPU: $cpu"
116+ exit 1
117+ ;;
118+ esac
119+}
114120
115121 for opt do
116122 eval opt=\"$opt\"
@@ -141,14 +147,6 @@ for opt do · 24 unmodified lines
141147 ;;
142148 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
143149 ;;
144− --cc=*) cc=`echo $opt | cut -d '=' -f 2`
145− ;;
146− --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
147− ;;
148− --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
149− ;;
150− --extra-libs=*) extralibs=${opt#--extra-libs=}
151− ;;
152150 --sysincludepaths=*) tcc_sysincludepaths=`echo $opt | cut -d '=' -f 2`
153151 ;;
154152 --libpaths=*) tcc_libpaths=`echo $opt | cut -d '=' -f 2`
@@ -157,7 +155,15 @@ for opt do · 2 unmodified lines
157155 ;;
158156 --elfinterp=*) tcc_elfinterp=`echo $opt | cut -d '=' -f 2`
159157 ;;
160− --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
158+ --cc=*) cc=`echo $opt | cut -d '=' -f 2`
159+ ;;
160+ --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
161+ ;;
162+ --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
163+ ;;
164+ --extra-libs=*) extralibs=${opt#--extra-libs=}
165+ ;;
166+ --cpu=*) build_cpu=`echo $opt | cut -d '=' -f 2`
161167 ;;
162168 --enable-gprof) gprof="yes"
163169 ;;
@@ -186,6 +192,8 @@ for opt do · 22 unmodified lines
186192 esac
187193 done
188194
195+classify_cpu "$cpu"
196+
189197 # Checking for CFLAGS
190198 if test -z "$CFLAGS"; then
191199 CFLAGS="-Wall -g -O2"
@@ -271,6 +279,7 @@ Advanced options (experts only): · 79 unmodified lines
271279 --cc=CC use C compiler CC [$cc]
272280 --extra-cflags= specify compiler flags [$CFLAGS]
273281 --extra-ldflags= specify linker options []
282+ --cpu=CPU CPU [$cpu]
274283 --strip-binaries strip symbol tables from resulting binaries
275284 --disable-static make libtcc.so instead of libtcc.a
276285 --disable-rpath disable use of -rpath with the above
@@ -356,8 +365,8 @@ Doc directory $docdir · 79 unmodified lines
356365 Target root prefix $sysroot
357366 Source path $source_path
358367 C compiler $cc
368+Build CPU $cpu
359369 Target OS $targetos
360−CPU $cpu
361370 Big Endian $bigendian
362371 gprof enabled $gprof
363372 cross compilers $build_cross

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t