source: mainline/tools/autotool.py@ 7174403

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 7174403 was 7174403, checked in by Martin Decky <martin@…>, 13 years ago

the "mkisofs" is being gradually phased out in distros
be ready for that

  • Property mode set to 100755
File size: 22.2 KB
Line 
1#!/usr/bin/env python
2#
3# Copyright (c) 2010 Martin Decky
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9#
10# - Redistributions of source code must retain the above copyright
11# notice, this list of conditions and the following disclaimer.
12# - Redistributions in binary form must reproduce the above copyright
13# notice, this list of conditions and the following disclaimer in the
14# documentation and/or other materials provided with the distribution.
15# - The name of the author may not be used to endorse or promote products
16# derived from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29
30"""
31Detect important prerequisites and parameters for building HelenOS
32"""
33
34import sys
35import os
36import shutil
37import re
38import time
39import subprocess
40
41SANDBOX = 'autotool'
42CONFIG = 'Makefile.config'
43MAKEFILE = 'Makefile.common'
44HEADER = 'common.h'
45GUARD = 'AUTOTOOL_COMMON_H_'
46
47PROBE_SOURCE = 'probe.c'
48PROBE_OUTPUT = 'probe.s'
49
50PACKAGE_BINUTILS = "usually part of binutils"
51PACKAGE_GCC = "preferably version 4.5.1 or newer"
52PACKAGE_CROSS = "use tools/toolchain.sh to build the cross-compiler toolchain"
53
54COMPILER_FAIL = "The compiler is probably not capable to compile HelenOS."
55COMPILER_WARNING = "The compilation of HelenOS might fail."
56
57PROBE_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, tag, name, strc, conc, value) \\
58 asm volatile ( \\
59 "AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" tag "\\t" name "\\t" strc "\\t" conc "\\t%[val]\\n" \\
60 : \\
61 : [val] "n" (value) \\
62 )
63
64#define STRING(arg) STRING_ARG(arg)
65#define STRING_ARG(arg) #arg
66
67#define DECLARE_BUILTIN_TYPE(tag, type) \\
68 AUTOTOOL_DECLARE("builtin", "", tag, STRING(type), "", "", sizeof(type));
69
70#define DECLARE_INTSIZE(tag, type, strc, conc) \\
71 AUTOTOOL_DECLARE("intsize", "unsigned", tag, #type, strc, conc, sizeof(unsigned type)); \\
72 AUTOTOOL_DECLARE("intsize", "signed", tag, #type, strc, conc, sizeof(signed type));
73
74int main(int argc, char *argv[])
75{
76#ifdef __SIZE_TYPE__
77 DECLARE_BUILTIN_TYPE("size", __SIZE_TYPE__);
78#endif
79#ifdef __WCHAR_TYPE__
80 DECLARE_BUILTIN_TYPE("wchar", __WCHAR_TYPE__);
81#endif
82#ifdef __WINT_TYPE__
83 DECLARE_BUILTIN_TYPE("wint", __WINT_TYPE__);
84#endif
85"""
86
87PROBE_TAIL = """}
88"""
89
90def read_config(fname, config):
91 "Read HelenOS build configuration"
92
93 inf = open(fname, 'r')
94
95 for line in inf:
96 res = re.match(r'^(?:#!# )?([^#]\w*)\s*=\s*(.*?)\s*$', line)
97 if (res):
98 config[res.group(1)] = res.group(2)
99
100 inf.close()
101
102def print_error(msg):
103 "Print a bold error message"
104
105 sys.stderr.write("\n")
106 sys.stderr.write("######################################################################\n")
107 sys.stderr.write("HelenOS build sanity check error:\n")
108 sys.stderr.write("\n")
109 sys.stderr.write("%s\n" % "\n".join(msg))
110 sys.stderr.write("######################################################################\n")
111 sys.stderr.write("\n")
112
113 sys.exit(1)
114
115def print_warning(msg):
116 "Print a bold error message"
117
118 sys.stderr.write("\n")
119 sys.stderr.write("######################################################################\n")
120 sys.stderr.write("HelenOS build sanity check warning:\n")
121 sys.stderr.write("\n")
122 sys.stderr.write("%s\n" % "\n".join(msg))
123 sys.stderr.write("######################################################################\n")
124 sys.stderr.write("\n")
125
126 time.sleep(5)
127
128def sandbox_enter():
129 "Create a temporal sandbox directory for running tests"
130
131 if (os.path.exists(SANDBOX)):
132 if (os.path.isdir(SANDBOX)):
133 try:
134 shutil.rmtree(SANDBOX)
135 except:
136 print_error(["Unable to cleanup the directory \"%s\"." % SANDBOX])
137 else:
138 print_error(["Please inspect and remove unexpected directory,",
139 "entry \"%s\"." % SANDBOX])
140
141 try:
142 os.mkdir(SANDBOX)
143 except:
144 print_error(["Unable to create sandbox directory \"%s\"." % SANDBOX])
145
146 owd = os.getcwd()
147 os.chdir(SANDBOX)
148
149 return owd
150
151def sandbox_leave(owd):
152 "Leave the temporal sandbox directory"
153
154 os.chdir(owd)
155
156def check_config(config, key):
157 "Check whether the configuration key exists"
158
159 if (not key in config):
160 print_error(["Build configuration of HelenOS does not contain %s." % key,
161 "Try running \"make config\" again.",
162 "If the problem persists, please contact the developers of HelenOS."])
163
164def check_common(common, key):
165 "Check whether the common key exists"
166
167 if (not key in common):
168 print_error(["Failed to determine the value %s." % key,
169 "Please contact the developers of HelenOS."])
170
171def check_app(args, name, details):
172 "Check whether an application can be executed"
173
174 try:
175 sys.stderr.write("Checking for %s ... " % args[0])
176 subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).wait()
177 except:
178 sys.stderr.write("failed\n")
179 print_error(["%s is missing." % name,
180 "",
181 "Execution of \"%s\" has failed. Please make sure that it" % " ".join(args),
182 "is installed in your system (%s)." % details])
183
184 sys.stderr.write("ok\n")
185
186def check_app_alternatives(alts, args, name, details):
187 "Check whether an application can be executed (use several alternatives)"
188
189 tried = []
190 found = None
191
192 for alt in alts:
193 working = True
194 cmdline = [alt] + args
195 tried.append(" ".join(cmdline))
196
197 try:
198 sys.stderr.write("Checking for %s ... " % alt)
199 subprocess.Popen(cmdline, stdout = subprocess.PIPE, stderr = subprocess.PIPE).wait()
200 except:
201 sys.stderr.write("failed\n")
202 working = False
203
204 if (working):
205 sys.stderr.write("ok\n")
206 found = alt
207 break
208
209 if (found is None):
210 print_error(["%s is missing." % name,
211 "",
212 "Please make sure that it is installed in your",
213 "system (%s)." % details,
214 "",
215 "The following alternatives were tried:"] + tried)
216
217 return found
218
219def check_gcc(path, prefix, common, details):
220 "Check for GCC"
221
222 common['GCC'] = "%sgcc" % prefix
223
224 if (not path is None):
225 common['GCC'] = "%s/%s" % (path, common['GCC'])
226
227 check_app([common['GCC'], "--version"], "GNU GCC", details)
228
229def check_binutils(path, prefix, common, details):
230 "Check for binutils toolchain"
231
232 common['AS'] = "%sas" % prefix
233 common['LD'] = "%sld" % prefix
234 common['AR'] = "%sar" % prefix
235 common['OBJCOPY'] = "%sobjcopy" % prefix
236 common['OBJDUMP'] = "%sobjdump" % prefix
237 common['STRIP'] = "%sstrip" % prefix
238
239 if (not path is None):
240 for key in ["AS", "LD", "AR", "OBJCOPY", "OBJDUMP", "STRIP"]:
241 common[key] = "%s/%s" % (path, common[key])
242
243 check_app([common['AS'], "--version"], "GNU Assembler", details)
244 check_app([common['LD'], "--version"], "GNU Linker", details)
245 check_app([common['AR'], "--version"], "GNU Archiver", details)
246 check_app([common['OBJCOPY'], "--version"], "GNU Objcopy utility", details)
247 check_app([common['OBJDUMP'], "--version"], "GNU Objdump utility", details)
248 check_app([common['STRIP'], "--version"], "GNU strip", details)
249
250def decode_value(value):
251 "Decode integer value"
252
253 base = 10
254
255 if ((value.startswith('$')) or (value.startswith('#'))):
256 value = value[1:]
257
258 if (value.startswith('0x')):
259 value = value[2:]
260 base = 16
261
262 return int(value, base)
263
264def probe_compiler(common, sizes):
265 "Generate, compile and parse probing source"
266
267 check_common(common, "CC")
268
269 outf = open(PROBE_SOURCE, 'w')
270 outf.write(PROBE_HEAD)
271
272 for typedef in sizes:
273 outf.write("\tDECLARE_INTSIZE(\"%s\", %s, %s, %s);\n" % (typedef['tag'], typedef['type'], typedef['strc'], typedef['conc']))
274
275 outf.write(PROBE_TAIL)
276 outf.close()
277
278 args = [common['CC']]
279 args.extend(common['CC_ARGS'])
280 args.extend(["-S", "-o", PROBE_OUTPUT, PROBE_SOURCE])
281
282 try:
283 sys.stderr.write("Checking compiler properties ... ")
284 output = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate()
285 except:
286 sys.stderr.write("failed\n")
287 print_error(["Error executing \"%s\"." % " ".join(args),
288 "Make sure that the compiler works properly."])
289
290 if (not os.path.isfile(PROBE_OUTPUT)):
291 sys.stderr.write("failed\n")
292 print(output[1])
293 print_error(["Error executing \"%s\"." % " ".join(args),
294 "The compiler did not produce the output file \"%s\"." % PROBE_OUTPUT,
295 "",
296 output[0],
297 output[1]])
298
299 sys.stderr.write("ok\n")
300
301 inf = open(PROBE_OUTPUT, 'r')
302 lines = inf.readlines()
303 inf.close()
304
305 unsigned_sizes = {}
306 signed_sizes = {}
307
308 unsigned_tags = {}
309 signed_tags = {}
310
311 unsigned_strcs = {}
312 signed_strcs = {}
313
314 unsigned_concs = {}
315 signed_concs = {}
316
317 builtins = {}
318
319 for j in range(len(lines)):
320 tokens = lines[j].strip().split("\t")
321
322 if (len(tokens) > 0):
323 if (tokens[0] == "AUTOTOOL_DECLARE"):
324 if (len(tokens) < 7):
325 print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
326
327 category = tokens[1]
328 subcategory = tokens[2]
329 tag = tokens[3]
330 name = tokens[4]
331 strc = tokens[5]
332 conc = tokens[6]
333 value = tokens[7]
334
335 if (category == "intsize"):
336 try:
337 value_int = decode_value(value)
338 except:
339 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
340
341 if (subcategory == "unsigned"):
342 unsigned_sizes[value_int] = name
343 unsigned_tags[tag] = value_int
344 unsigned_strcs[value_int] = strc
345 unsigned_concs[value_int] = conc
346 elif (subcategory == "signed"):
347 signed_sizes[value_int] = name
348 signed_tags[tag] = value_int
349 signed_strcs[value_int] = strc
350 signed_concs[value_int] = conc
351 else:
352 print_error(["Unexpected keyword \"%s\" in \"%s\" on line %s." % (subcategory, PROBE_OUTPUT, j), COMPILER_FAIL])
353
354 if (category == "builtin"):
355 try:
356 value_int = decode_value(value)
357 except:
358 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
359
360 builtins[tag] = {'name': name, 'value': value_int}
361
362 return {'unsigned_sizes': unsigned_sizes, 'signed_sizes': signed_sizes, 'unsigned_tags': unsigned_tags, 'signed_tags': signed_tags, 'unsigned_strcs': unsigned_strcs, 'signed_strcs': signed_strcs, 'unsigned_concs': unsigned_concs, 'signed_concs': signed_concs, 'builtins': builtins}
363
364def detect_uints(probe, bytes, tags):
365 "Detect correct types for fixed-size integer types"
366
367 macros = []
368 typedefs = []
369
370 for b in bytes:
371 if (not b in probe['unsigned_sizes']):
372 print_error(['Unable to find appropriate unsigned integer type for %u bytes' % b,
373 COMPILER_FAIL])
374
375 if (not b in probe['signed_sizes']):
376 print_error(['Unable to find appropriate signed integer type for %u bytes' % b,
377 COMPILER_FAIL])
378
379 if (not b in probe['unsigned_strcs']):
380 print_error(['Unable to find appropriate unsigned printf formatter for %u bytes' % b,
381 COMPILER_FAIL])
382
383 if (not b in probe['signed_strcs']):
384 print_error(['Unable to find appropriate signed printf formatter for %u bytes' % b,
385 COMPILER_FAIL])
386
387 if (not b in probe['unsigned_concs']):
388 print_error(['Unable to find appropriate unsigned literal macro for %u bytes' % b,
389 COMPILER_FAIL])
390
391 if (not b in probe['signed_concs']):
392 print_error(['Unable to find appropriate signed literal macro for %u bytes' % b,
393 COMPILER_FAIL])
394
395 typedefs.append({'oldtype': "unsigned %s" % probe['unsigned_sizes'][b], 'newtype': "uint%u_t" % (b * 8)})
396 typedefs.append({'oldtype': "signed %s" % probe['signed_sizes'][b], 'newtype': "int%u_t" % (b * 8)})
397
398 macros.append({'oldmacro': "unsigned %s" % probe['unsigned_sizes'][b], 'newmacro': "UINT%u_T" % (b * 8)})
399 macros.append({'oldmacro': "signed %s" % probe['signed_sizes'][b], 'newmacro': "INT%u_T" % (b * 8)})
400
401 macros.append({'oldmacro': "\"%so\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIo%u" % (b * 8)})
402 macros.append({'oldmacro': "\"%su\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIu%u" % (b * 8)})
403 macros.append({'oldmacro': "\"%sx\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIx%u" % (b * 8)})
404 macros.append({'oldmacro': "\"%sX\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIX%u" % (b * 8)})
405 macros.append({'oldmacro': "\"%sd\"" % probe['signed_strcs'][b], 'newmacro': "PRId%u" % (b * 8)})
406
407 name = probe['unsigned_concs'][b]
408 if ((name.startswith('@')) or (name == "")):
409 macros.append({'oldmacro': "c ## U", 'newmacro': "UINT%u_C(c)" % (b * 8)})
410 else:
411 macros.append({'oldmacro': "c ## U%s" % name, 'newmacro': "UINT%u_C(c)" % (b * 8)})
412
413 name = probe['unsigned_concs'][b]
414 if ((name.startswith('@')) or (name == "")):
415 macros.append({'oldmacro': "c", 'newmacro': "INT%u_C(c)" % (b * 8)})
416 else:
417 macros.append({'oldmacro': "c ## %s" % name, 'newmacro': "INT%u_C(c)" % (b * 8)})
418
419 for tag in tags:
420 newmacro = "U%s" % tag
421 if (not tag in probe['unsigned_tags']):
422 print_error(['Unable to find appropriate size macro for %s' % newmacro,
423 COMPILER_FAIL])
424
425 oldmacro = "UINT%s" % (probe['unsigned_tags'][tag] * 8)
426 macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
427 macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
428
429 newmacro = tag
430 if (not tag in probe['unsigned_tags']):
431 print_error(['Unable to find appropriate size macro for %s' % newmacro,
432 COMPILER_FAIL])
433
434 oldmacro = "INT%s" % (probe['signed_tags'][tag] * 8)
435 macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
436 macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
437
438 fnd = True
439
440 if (not 'wchar' in probe['builtins']):
441 print_warning(['The compiler does not provide the macro __WCHAR_TYPE__',
442 'for defining the compiler-native type wchar_t. We are',
443 'forced to define wchar_t as a hardwired type int32_t.',
444 COMPILER_WARNING])
445 fnd = False
446
447 if (probe['builtins']['wchar']['value'] != 4):
448 print_warning(['The compiler provided macro __WCHAR_TYPE__ for defining',
449 'the compiler-native type wchar_t is not compliant with',
450 'HelenOS. We are forced to define wchar_t as a hardwired',
451 'type int32_t.',
452 COMPILER_WARNING])
453 fnd = False
454
455 if (not fnd):
456 macros.append({'oldmacro': "int32_t", 'newmacro': "wchar_t"})
457 else:
458 macros.append({'oldmacro': "__WCHAR_TYPE__", 'newmacro': "wchar_t"})
459
460 fnd = True
461
462 if (not 'wint' in probe['builtins']):
463 print_warning(['The compiler does not provide the macro __WINT_TYPE__',
464 'for defining the compiler-native type wint_t. We are',
465 'forced to define wint_t as a hardwired type int32_t.',
466 COMPILER_WARNING])
467 fnd = False
468
469 if (probe['builtins']['wint']['value'] != 4):
470 print_warning(['The compiler provided macro __WINT_TYPE__ for defining',
471 'the compiler-native type wint_t is not compliant with',
472 'HelenOS. We are forced to define wint_t as a hardwired',
473 'type int32_t.',
474 COMPILER_WARNING])
475 fnd = False
476
477 if (not fnd):
478 macros.append({'oldmacro': "int32_t", 'newmacro': "wint_t"})
479 else:
480 macros.append({'oldmacro': "__WINT_TYPE__", 'newmacro': "wint_t"})
481
482 return {'macros': macros, 'typedefs': typedefs}
483
484def create_makefile(mkname, common):
485 "Create makefile output"
486
487 outmk = open(mkname, 'w')
488
489 outmk.write('#########################################\n')
490 outmk.write('## AUTO-GENERATED FILE, DO NOT EDIT!!! ##\n')
491 outmk.write('#########################################\n\n')
492
493 for key, value in common.items():
494 if (type(value) is list):
495 outmk.write('%s = %s\n' % (key, " ".join(value)))
496 else:
497 outmk.write('%s = %s\n' % (key, value))
498
499 outmk.close()
500
501def create_header(hdname, maps):
502 "Create header output"
503
504 outhd = open(hdname, 'w')
505
506 outhd.write('/***************************************\n')
507 outhd.write(' * AUTO-GENERATED FILE, DO NOT EDIT!!! *\n')
508 outhd.write(' ***************************************/\n\n')
509
510 outhd.write('#ifndef %s\n' % GUARD)
511 outhd.write('#define %s\n\n' % GUARD)
512
513 for macro in maps['macros']:
514 outhd.write('#define %s %s\n' % (macro['newmacro'], macro['oldmacro']))
515
516 outhd.write('\n')
517
518 for typedef in maps['typedefs']:
519 outhd.write('typedef %s %s;\n' % (typedef['oldtype'], typedef['newtype']))
520
521 outhd.write('\n#endif\n')
522 outhd.close()
523
524def main():
525 config = {}
526 common = {}
527
528 # Read and check configuration
529 if os.path.exists(CONFIG):
530 read_config(CONFIG, config)
531 else:
532 print_error(["Configuration file %s not found! Make sure that the" % CONFIG,
533 "configuration phase of HelenOS build went OK. Try running",
534 "\"make config\" again."])
535
536 check_config(config, "PLATFORM")
537 check_config(config, "COMPILER")
538 check_config(config, "BARCH")
539
540 # Cross-compiler prefix
541 if ('CROSS_PREFIX' in os.environ):
542 cross_prefix = os.environ['CROSS_PREFIX']
543 else:
544 cross_prefix = "/usr/local/cross"
545
546 # Prefix binutils tools on Solaris
547 if (os.uname()[0] == "SunOS"):
548 binutils_prefix = "g"
549 else:
550 binutils_prefix = ""
551
552 owd = sandbox_enter()
553
554 try:
555 # Common utilities
556 check_app(["ln", "--version"], "Symlink utility", "usually part of coreutils")
557 check_app(["rm", "--version"], "File remove utility", "usually part of coreutils")
558 check_app(["mkdir", "--version"], "Directory creation utility", "usually part of coreutils")
559 check_app(["cp", "--version"], "Copy utility", "usually part of coreutils")
560 check_app(["find", "--version"], "Find utility", "usually part of findutils")
561 check_app(["diff", "--version"], "Diff utility", "usually part of diffutils")
562 check_app(["make", "--version"], "Make utility", "preferably GNU Make")
563 check_app(["makedepend", "-f", "-"], "Makedepend utility", "usually part of imake or xutils")
564
565 # Compiler
566 common['CC_ARGS'] = []
567 if (config['COMPILER'] == "gcc_cross"):
568 if (config['PLATFORM'] == "abs32le"):
569 check_config(config, "CROSS_TARGET")
570 target = config['CROSS_TARGET']
571
572 if (config['CROSS_TARGET'] == "arm32"):
573 gnu_target = "arm-linux-gnu"
574
575 if (config['CROSS_TARGET'] == "ia32"):
576 gnu_target = "i686-pc-linux-gnu"
577
578 if (config['CROSS_TARGET'] == "mips32"):
579 gnu_target = "mipsel-linux-gnu"
580 common['CC_ARGS'].append("-mabi=32")
581
582 if (config['PLATFORM'] == "amd64"):
583 target = config['PLATFORM']
584 gnu_target = "amd64-linux-gnu"
585
586 if (config['PLATFORM'] == "arm32"):
587 target = config['PLATFORM']
588 gnu_target = "arm-linux-gnu"
589
590 if (config['PLATFORM'] == "ia32"):
591 target = config['PLATFORM']
592 gnu_target = "i686-pc-linux-gnu"
593
594 if (config['PLATFORM'] == "ia64"):
595 target = config['PLATFORM']
596 gnu_target = "ia64-pc-linux-gnu"
597
598 if (config['PLATFORM'] == "mips32"):
599 check_config(config, "MACHINE")
600 common['CC_ARGS'].append("-mabi=32")
601
602 if ((config['MACHINE'] == "lgxemul") or (config['MACHINE'] == "msim")):
603 target = config['PLATFORM']
604 gnu_target = "mipsel-linux-gnu"
605
606 if (config['MACHINE'] == "bgxemul"):
607 target = "mips32eb"
608 gnu_target = "mips-linux-gnu"
609
610 if (config['PLATFORM'] == "mips64"):
611 check_config(config, "MACHINE")
612 common['CC_ARGS'].append("-mabi=64")
613
614 if (config['MACHINE'] == "msim"):
615 target = config['PLATFORM']
616 gnu_target = "mips64el-linux-gnu"
617
618 if (config['PLATFORM'] == "ppc32"):
619 target = config['PLATFORM']
620 gnu_target = "ppc-linux-gnu"
621
622 if (config['PLATFORM'] == "sparc64"):
623 target = config['PLATFORM']
624 gnu_target = "sparc64-linux-gnu"
625
626 path = "%s/%s/bin" % (cross_prefix, target)
627 prefix = "%s-" % gnu_target
628
629 check_gcc(path, prefix, common, PACKAGE_CROSS)
630 check_binutils(path, prefix, common, PACKAGE_CROSS)
631
632 check_common(common, "GCC")
633 common['CC'] = common['GCC']
634
635 if (config['COMPILER'] == "gcc_native"):
636 check_gcc(None, "", common, PACKAGE_GCC)
637 check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
638
639 check_common(common, "GCC")
640 common['CC'] = common['GCC']
641
642 if (config['COMPILER'] == "icc"):
643 common['CC'] = "icc"
644 check_app([common['CC'], "-V"], "Intel C++ Compiler", "support is experimental")
645 check_gcc(None, "", common, PACKAGE_GCC)
646 check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
647
648 if (config['COMPILER'] == "suncc"):
649 common['CC'] = "suncc"
650 check_app([common['CC'], "-V"], "Sun Studio Compiler", "support is experimental")
651 check_gcc(None, "", common, PACKAGE_GCC)
652 check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
653
654 if (config['COMPILER'] == "clang"):
655 common['CC'] = "clang"
656 check_app([common['CC'], "--version"], "Clang compiler", "preferably version 1.0 or newer")
657 check_gcc(None, "", common, PACKAGE_GCC)
658 check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
659
660 # Platform-specific utilities
661 if ((config['BARCH'] == "amd64") or (config['BARCH'] == "ia32") or (config['BARCH'] == "ppc32") or (config['BARCH'] == "sparc64")):
662 common['GENISOIMAGE'] = check_app_alternatives(["mkisofs", "genisoimage"], ["--version"], "ISO 9660 creation utility", "usually part of genisoimage")
663
664 probe = probe_compiler(common,
665 [
666 {'type': 'long long int', 'tag': 'LLONG', 'strc': '"ll"', 'conc': '"LL"'},
667 {'type': 'long int', 'tag': 'LONG', 'strc': '"l"', 'conc': '"L"'},
668 {'type': 'int', 'tag': 'INT', 'strc': '""', 'conc': '""'},
669 {'type': 'short int', 'tag': 'SHORT', 'strc': '"h"', 'conc': '"@"'},
670 {'type': 'char', 'tag': 'CHAR', 'strc': '"hh"', 'conc': '"@@"'}
671 ]
672 )
673
674 maps = detect_uints(probe, [1, 2, 4, 8], ['CHAR', 'SHORT', 'INT', 'LONG', 'LLONG'])
675
676 finally:
677 sandbox_leave(owd)
678
679 create_makefile(MAKEFILE, common)
680 create_header(HEADER, maps)
681
682 return 0
683
684if __name__ == '__main__':
685 sys.exit(main())
Note: See TracBrowser for help on using the repository browser.