source: mainline/tools/autotool.py@ 2429e4a

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

add initial support for mips64
(it does not do anything useful so far and there are probably severe bugs and ABI violations, but it compiles)

  • Property mode set to 100755
File size: 21.3 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_gcc(path, prefix, common, details):
187 "Check for GCC"
188
189 common['GCC'] = "%sgcc" % prefix
190
191 if (not path is None):
192 common['GCC'] = "%s/%s" % (path, common['GCC'])
193
194 check_app([common['GCC'], "--version"], "GNU GCC", details)
195
196def check_binutils(path, prefix, common, details):
197 "Check for binutils toolchain"
198
199 common['AS'] = "%sas" % prefix
200 common['LD'] = "%sld" % prefix
201 common['AR'] = "%sar" % prefix
202 common['OBJCOPY'] = "%sobjcopy" % prefix
203 common['OBJDUMP'] = "%sobjdump" % prefix
204 common['STRIP'] = "%sstrip" % prefix
205
206 if (not path is None):
207 for key in ["AS", "LD", "AR", "OBJCOPY", "OBJDUMP", "STRIP"]:
208 common[key] = "%s/%s" % (path, common[key])
209
210 check_app([common['AS'], "--version"], "GNU Assembler", details)
211 check_app([common['LD'], "--version"], "GNU Linker", details)
212 check_app([common['AR'], "--version"], "GNU Archiver", details)
213 check_app([common['OBJCOPY'], "--version"], "GNU Objcopy utility", details)
214 check_app([common['OBJDUMP'], "--version"], "GNU Objdump utility", details)
215 check_app([common['STRIP'], "--version"], "GNU strip", details)
216
217def decode_value(value):
218 "Decode integer value"
219
220 base = 10
221
222 if ((value.startswith('$')) or (value.startswith('#'))):
223 value = value[1:]
224
225 if (value.startswith('0x')):
226 value = value[2:]
227 base = 16
228
229 return int(value, base)
230
231def probe_compiler(common, sizes):
232 "Generate, compile and parse probing source"
233
234 check_common(common, "CC")
235
236 outf = open(PROBE_SOURCE, 'w')
237 outf.write(PROBE_HEAD)
238
239 for typedef in sizes:
240 outf.write("\tDECLARE_INTSIZE(\"%s\", %s, %s, %s);\n" % (typedef['tag'], typedef['type'], typedef['strc'], typedef['conc']))
241
242 outf.write(PROBE_TAIL)
243 outf.close()
244
245 args = [common['CC']]
246 args.extend(common['CC_ARGS'])
247 args.extend(["-S", "-o", PROBE_OUTPUT, PROBE_SOURCE])
248
249 try:
250 sys.stderr.write("Checking compiler properties ... ")
251 output = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate()
252 except:
253 sys.stderr.write("failed\n")
254 print_error(["Error executing \"%s\"." % " ".join(args),
255 "Make sure that the compiler works properly."])
256
257 if (not os.path.isfile(PROBE_OUTPUT)):
258 sys.stderr.write("failed\n")
259 print(output[1])
260 print_error(["Error executing \"%s\"." % " ".join(args),
261 "The compiler did not produce the output file \"%s\"." % PROBE_OUTPUT,
262 "",
263 output[0],
264 output[1]])
265
266 sys.stderr.write("ok\n")
267
268 inf = open(PROBE_OUTPUT, 'r')
269 lines = inf.readlines()
270 inf.close()
271
272 unsigned_sizes = {}
273 signed_sizes = {}
274
275 unsigned_tags = {}
276 signed_tags = {}
277
278 unsigned_strcs = {}
279 signed_strcs = {}
280
281 unsigned_concs = {}
282 signed_concs = {}
283
284 builtins = {}
285
286 for j in range(len(lines)):
287 tokens = lines[j].strip().split("\t")
288
289 if (len(tokens) > 0):
290 if (tokens[0] == "AUTOTOOL_DECLARE"):
291 if (len(tokens) < 7):
292 print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
293
294 category = tokens[1]
295 subcategory = tokens[2]
296 tag = tokens[3]
297 name = tokens[4]
298 strc = tokens[5]
299 conc = tokens[6]
300 value = tokens[7]
301
302 if (category == "intsize"):
303 try:
304 value_int = decode_value(value)
305 except:
306 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
307
308 if (subcategory == "unsigned"):
309 unsigned_sizes[value_int] = name
310 unsigned_tags[tag] = value_int
311 unsigned_strcs[value_int] = strc
312 unsigned_concs[value_int] = conc
313 elif (subcategory == "signed"):
314 signed_sizes[value_int] = name
315 signed_tags[tag] = value_int
316 signed_strcs[value_int] = strc
317 signed_concs[value_int] = conc
318 else:
319 print_error(["Unexpected keyword \"%s\" in \"%s\" on line %s." % (subcategory, PROBE_OUTPUT, j), COMPILER_FAIL])
320
321 if (category == "builtin"):
322 try:
323 value_int = decode_value(value)
324 except:
325 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
326
327 builtins[tag] = {'name': name, 'value': value_int}
328
329 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}
330
331def detect_uints(probe, bytes, tags):
332 "Detect correct types for fixed-size integer types"
333
334 macros = []
335 typedefs = []
336
337 for b in bytes:
338 if (not b in probe['unsigned_sizes']):
339 print_error(['Unable to find appropriate unsigned integer type for %u bytes' % b,
340 COMPILER_FAIL])
341
342 if (not b in probe['signed_sizes']):
343 print_error(['Unable to find appropriate signed integer type for %u bytes' % b,
344 COMPILER_FAIL])
345
346 if (not b in probe['unsigned_strcs']):
347 print_error(['Unable to find appropriate unsigned printf formatter for %u bytes' % b,
348 COMPILER_FAIL])
349
350 if (not b in probe['signed_strcs']):
351 print_error(['Unable to find appropriate signed printf formatter for %u bytes' % b,
352 COMPILER_FAIL])
353
354 if (not b in probe['unsigned_concs']):
355 print_error(['Unable to find appropriate unsigned literal macro for %u bytes' % b,
356 COMPILER_FAIL])
357
358 if (not b in probe['signed_concs']):
359 print_error(['Unable to find appropriate signed literal macro for %u bytes' % b,
360 COMPILER_FAIL])
361
362 typedefs.append({'oldtype': "unsigned %s" % probe['unsigned_sizes'][b], 'newtype': "uint%u_t" % (b * 8)})
363 typedefs.append({'oldtype': "signed %s" % probe['signed_sizes'][b], 'newtype': "int%u_t" % (b * 8)})
364
365 macros.append({'oldmacro': "unsigned %s" % probe['unsigned_sizes'][b], 'newmacro': "UINT%u_T" % (b * 8)})
366 macros.append({'oldmacro': "signed %s" % probe['signed_sizes'][b], 'newmacro': "INT%u_T" % (b * 8)})
367
368 macros.append({'oldmacro': "\"%so\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIo%u" % (b * 8)})
369 macros.append({'oldmacro': "\"%su\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIu%u" % (b * 8)})
370 macros.append({'oldmacro': "\"%sx\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIx%u" % (b * 8)})
371 macros.append({'oldmacro': "\"%sX\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIX%u" % (b * 8)})
372 macros.append({'oldmacro': "\"%sd\"" % probe['signed_strcs'][b], 'newmacro': "PRId%u" % (b * 8)})
373
374 name = probe['unsigned_concs'][b]
375 if ((name.startswith('@')) or (name == "")):
376 macros.append({'oldmacro': "c ## U", 'newmacro': "UINT%u_C(c)" % (b * 8)})
377 else:
378 macros.append({'oldmacro': "c ## U%s" % name, 'newmacro': "UINT%u_C(c)" % (b * 8)})
379
380 name = probe['unsigned_concs'][b]
381 if ((name.startswith('@')) or (name == "")):
382 macros.append({'oldmacro': "c", 'newmacro': "INT%u_C(c)" % (b * 8)})
383 else:
384 macros.append({'oldmacro': "c ## %s" % name, 'newmacro': "INT%u_C(c)" % (b * 8)})
385
386 for tag in tags:
387 newmacro = "U%s" % tag
388 if (not tag in probe['unsigned_tags']):
389 print_error(['Unable to find appropriate size macro for %s' % newmacro,
390 COMPILER_FAIL])
391
392 oldmacro = "UINT%s" % (probe['unsigned_tags'][tag] * 8)
393 macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
394 macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
395
396 newmacro = tag
397 if (not tag in probe['unsigned_tags']):
398 print_error(['Unable to find appropriate size macro for %s' % newmacro,
399 COMPILER_FAIL])
400
401 oldmacro = "INT%s" % (probe['signed_tags'][tag] * 8)
402 macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
403 macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
404
405 fnd = True
406
407 if (not 'wchar' in probe['builtins']):
408 print_warning(['The compiler does not provide the macro __WCHAR_TYPE__',
409 'for defining the compiler-native type wchar_t. We are',
410 'forced to define wchar_t as a hardwired type int32_t.',
411 COMPILER_WARNING])
412 fnd = False
413
414 if (probe['builtins']['wchar']['value'] != 4):
415 print_warning(['The compiler provided macro __WCHAR_TYPE__ for defining',
416 'the compiler-native type wchar_t is not compliant with',
417 'HelenOS. We are forced to define wchar_t as a hardwired',
418 'type int32_t.',
419 COMPILER_WARNING])
420 fnd = False
421
422 if (not fnd):
423 macros.append({'oldmacro': "int32_t", 'newmacro': "wchar_t"})
424 else:
425 macros.append({'oldmacro': "__WCHAR_TYPE__", 'newmacro': "wchar_t"})
426
427 fnd = True
428
429 if (not 'wint' in probe['builtins']):
430 print_warning(['The compiler does not provide the macro __WINT_TYPE__',
431 'for defining the compiler-native type wint_t. We are',
432 'forced to define wint_t as a hardwired type int32_t.',
433 COMPILER_WARNING])
434 fnd = False
435
436 if (probe['builtins']['wint']['value'] != 4):
437 print_warning(['The compiler provided macro __WINT_TYPE__ for defining',
438 'the compiler-native type wint_t is not compliant with',
439 'HelenOS. We are forced to define wint_t as a hardwired',
440 'type int32_t.',
441 COMPILER_WARNING])
442 fnd = False
443
444 if (not fnd):
445 macros.append({'oldmacro': "int32_t", 'newmacro': "wint_t"})
446 else:
447 macros.append({'oldmacro': "__WINT_TYPE__", 'newmacro': "wint_t"})
448
449 return {'macros': macros, 'typedefs': typedefs}
450
451def create_makefile(mkname, common):
452 "Create makefile output"
453
454 outmk = open(mkname, 'w')
455
456 outmk.write('#########################################\n')
457 outmk.write('## AUTO-GENERATED FILE, DO NOT EDIT!!! ##\n')
458 outmk.write('#########################################\n\n')
459
460 for key, value in common.items():
461 outmk.write('%s = %s\n' % (key, value))
462
463 outmk.close()
464
465def create_header(hdname, maps):
466 "Create header output"
467
468 outhd = open(hdname, 'w')
469
470 outhd.write('/***************************************\n')
471 outhd.write(' * AUTO-GENERATED FILE, DO NOT EDIT!!! *\n')
472 outhd.write(' ***************************************/\n\n')
473
474 outhd.write('#ifndef %s\n' % GUARD)
475 outhd.write('#define %s\n\n' % GUARD)
476
477 for macro in maps['macros']:
478 outhd.write('#define %s %s\n' % (macro['newmacro'], macro['oldmacro']))
479
480 outhd.write('\n')
481
482 for typedef in maps['typedefs']:
483 outhd.write('typedef %s %s;\n' % (typedef['oldtype'], typedef['newtype']))
484
485 outhd.write('\n#endif\n')
486 outhd.close()
487
488def main():
489 config = {}
490 common = {}
491
492 # Read and check configuration
493 if os.path.exists(CONFIG):
494 read_config(CONFIG, config)
495 else:
496 print_error(["Configuration file %s not found! Make sure that the" % CONFIG,
497 "configuration phase of HelenOS build went OK. Try running",
498 "\"make config\" again."])
499
500 check_config(config, "PLATFORM")
501 check_config(config, "COMPILER")
502 check_config(config, "BARCH")
503
504 # Cross-compiler prefix
505 if ('CROSS_PREFIX' in os.environ):
506 cross_prefix = os.environ['CROSS_PREFIX']
507 else:
508 cross_prefix = "/usr/local/cross"
509
510 # Prefix binutils tools on Solaris
511 if (os.uname()[0] == "SunOS"):
512 binutils_prefix = "g"
513 else:
514 binutils_prefix = ""
515
516 owd = sandbox_enter()
517
518 try:
519 # Common utilities
520 check_app(["ln", "--version"], "Symlink utility", "usually part of coreutils")
521 check_app(["rm", "--version"], "File remove utility", "usually part of coreutils")
522 check_app(["mkdir", "--version"], "Directory creation utility", "usually part of coreutils")
523 check_app(["cp", "--version"], "Copy utility", "usually part of coreutils")
524 check_app(["find", "--version"], "Find utility", "usually part of findutils")
525 check_app(["diff", "--version"], "Diff utility", "usually part of diffutils")
526 check_app(["make", "--version"], "Make utility", "preferably GNU Make")
527 check_app(["makedepend", "-f", "-"], "Makedepend utility", "usually part of imake or xutils")
528
529 # Compiler
530 common['CC_ARGS'] = []
531 if (config['COMPILER'] == "gcc_cross"):
532 if (config['PLATFORM'] == "abs32le"):
533 check_config(config, "CROSS_TARGET")
534 target = config['CROSS_TARGET']
535
536 if (config['CROSS_TARGET'] == "arm32"):
537 gnu_target = "arm-linux-gnu"
538
539 if (config['CROSS_TARGET'] == "ia32"):
540 gnu_target = "i686-pc-linux-gnu"
541
542 if (config['CROSS_TARGET'] == "mips32"):
543 gnu_target = "mipsel-linux-gnu"
544 common['CC_ARGS'].append("-mabi=32")
545
546 if (config['PLATFORM'] == "amd64"):
547 target = config['PLATFORM']
548 gnu_target = "amd64-linux-gnu"
549
550 if (config['PLATFORM'] == "arm32"):
551 target = config['PLATFORM']
552 gnu_target = "arm-linux-gnu"
553
554 if (config['PLATFORM'] == "ia32"):
555 target = config['PLATFORM']
556 gnu_target = "i686-pc-linux-gnu"
557
558 if (config['PLATFORM'] == "ia64"):
559 target = config['PLATFORM']
560 gnu_target = "ia64-pc-linux-gnu"
561
562 if (config['PLATFORM'] == "mips32"):
563 check_config(config, "MACHINE")
564 common['CC_ARGS'].append("-mabi=32")
565
566 if ((config['MACHINE'] == "lgxemul") or (config['MACHINE'] == "msim")):
567 target = config['PLATFORM']
568 gnu_target = "mipsel-linux-gnu"
569
570 if (config['MACHINE'] == "bgxemul"):
571 target = "mips32eb"
572 gnu_target = "mips-linux-gnu"
573
574 if (config['PLATFORM'] == "mips64"):
575 check_config(config, "MACHINE")
576 common['CC_ARGS'].append("-mabi=64")
577
578 if (config['MACHINE'] == "msim"):
579 target = config['PLATFORM']
580 gnu_target = "mips64el-linux-gnu"
581
582 if (config['PLATFORM'] == "ppc32"):
583 target = config['PLATFORM']
584 gnu_target = "ppc-linux-gnu"
585
586 if (config['PLATFORM'] == "sparc64"):
587 target = config['PLATFORM']
588 gnu_target = "sparc64-linux-gnu"
589
590 path = "%s/%s/bin" % (cross_prefix, target)
591 prefix = "%s-" % gnu_target
592
593 check_gcc(path, prefix, common, PACKAGE_CROSS)
594 check_binutils(path, prefix, common, PACKAGE_CROSS)
595
596 check_common(common, "GCC")
597 common['CC'] = common['GCC']
598
599 if (config['COMPILER'] == "gcc_native"):
600 check_gcc(None, "", common, PACKAGE_GCC)
601 check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
602
603 check_common(common, "GCC")
604 common['CC'] = common['GCC']
605
606 if (config['COMPILER'] == "icc"):
607 common['CC'] = "icc"
608 check_app([common['CC'], "-V"], "Intel C++ Compiler", "support is experimental")
609 check_gcc(None, "", common, PACKAGE_GCC)
610 check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
611
612 if (config['COMPILER'] == "suncc"):
613 common['CC'] = "suncc"
614 check_app([common['CC'], "-V"], "Sun Studio Compiler", "support is experimental")
615 check_gcc(None, "", common, PACKAGE_GCC)
616 check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
617
618 if (config['COMPILER'] == "clang"):
619 common['CC'] = "clang"
620 check_app([common['CC'], "--version"], "Clang compiler", "preferably version 1.0 or newer")
621 check_gcc(None, "", common, PACKAGE_GCC)
622 check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
623
624 # Platform-specific utilities
625 if ((config['BARCH'] == "amd64") or (config['BARCH'] == "ia32") or (config['BARCH'] == "ppc32") or (config['BARCH'] == "sparc64")):
626 check_app(["mkisofs", "--version"], "ISO 9660 creation utility", "usually part of genisoimage")
627
628 probe = probe_compiler(common,
629 [
630 {'type': 'long long int', 'tag': 'LLONG', 'strc': '"ll"', 'conc': '"LL"'},
631 {'type': 'long int', 'tag': 'LONG', 'strc': '"l"', 'conc': '"L"'},
632 {'type': 'int', 'tag': 'INT', 'strc': '""', 'conc': '""'},
633 {'type': 'short int', 'tag': 'SHORT', 'strc': '"h"', 'conc': '"@"'},
634 {'type': 'char', 'tag': 'CHAR', 'strc': '"hh"', 'conc': '"@@"'}
635 ]
636 )
637
638 maps = detect_uints(probe, [1, 2, 4, 8], ['CHAR', 'SHORT', 'INT', 'LONG', 'LLONG'])
639
640 finally:
641 sandbox_leave(owd)
642
643 create_makefile(MAKEFILE, common)
644 create_header(HEADER, maps)
645
646 return 0
647
648if __name__ == '__main__':
649 sys.exit(main())
Note: See TracBrowser for help on using the repository browser.