source: mainline/tools/autotool.py@ f787c8e

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

remove extra space

  • Property mode set to 100755
File size: 21.8 KB
Line 
1#!/usr/bin/env python2
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.new'
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.7.0 or newer"
52PACKAGE_CROSS = "use tools/toolchain.sh to build the cross-compiler toolchain"
53PACKAGE_CLANG = "reasonably recent version of clang needs to be installed"
54
55TOOLCHAIN_FAIL = [
56 "Compiler toolchain for target is not installed, or CROSS_PREFIX",
57 "environment variable is not set correctly. Use tools/toolchain.sh",
58 "to (re)build the cross-compiler toolchain."]
59COMPILER_FAIL = "The compiler is probably not capable to compile HelenOS."
60COMPILER_WARNING = "The compilation of HelenOS might fail."
61
62PROBE_HEAD = """#define AUTOTOOL_DECLARE(category, tag, name, signedness, base, size, compatible) \\
63 asm volatile ( \\
64 "AUTOTOOL_DECLARE\\t" category "\\t" tag "\\t" name "\\t" signedness "\\t" base "\\t%[size_val]\\t%[cmp_val]\\n" \\
65 : \\
66 : [size_val] "n" (size), [cmp_val] "n" (compatible) \\
67 )
68
69#define STRING(arg) STRING_ARG(arg)
70#define STRING_ARG(arg) #arg
71
72#define DECLARE_BUILTIN_TYPE(tag, type) \\
73 AUTOTOOL_DECLARE("unsigned long long int", tag, STRING(type), "unsigned", "long long", sizeof(type), __builtin_types_compatible_p(type, unsigned long long int)); \\
74 AUTOTOOL_DECLARE("unsigned long int", tag, STRING(type), "unsigned", "long", sizeof(type), __builtin_types_compatible_p(type, unsigned long int)); \\
75 AUTOTOOL_DECLARE("unsigned int", tag, STRING(type), "unsigned", "int", sizeof(type), __builtin_types_compatible_p(type, unsigned int)); \\
76 AUTOTOOL_DECLARE("unsigned short int", tag, STRING(type), "unsigned", "short", sizeof(type), __builtin_types_compatible_p(type, unsigned short int)); \\
77 AUTOTOOL_DECLARE("unsigned char", tag, STRING(type), "unsigned", "char", sizeof(type), __builtin_types_compatible_p(type, unsigned char)); \\
78 AUTOTOOL_DECLARE("signed long long int", tag, STRING(type), "signed", "long long", sizeof(type), __builtin_types_compatible_p(type, signed long long int)); \\
79 AUTOTOOL_DECLARE("signed long int", tag, STRING(type), "signed", "long", sizeof(type), __builtin_types_compatible_p(type, signed long int)); \\
80 AUTOTOOL_DECLARE("signed int", tag, STRING(type), "signed", "int", sizeof(type), __builtin_types_compatible_p(type, signed int)); \\
81 AUTOTOOL_DECLARE("signed short int", tag, STRING(type), "signed", "short", sizeof(type), __builtin_types_compatible_p(type, signed short int)); \\
82 AUTOTOOL_DECLARE("signed char", tag, STRING(type), "signed", "char", sizeof(type), __builtin_types_compatible_p(type, signed char)); \\
83 AUTOTOOL_DECLARE("pointer", tag, STRING(type), "N/A", "pointer", sizeof(type), __builtin_types_compatible_p(type, void*)); \\
84 AUTOTOOL_DECLARE("long double", tag, STRING(type), "signed", "long double", sizeof(type), __builtin_types_compatible_p(type, long double)); \\
85 AUTOTOOL_DECLARE("double", tag, STRING(type), "signed", "double", sizeof(type), __builtin_types_compatible_p(type, double)); \\
86 AUTOTOOL_DECLARE("float", tag, STRING(type), "signed", "float", sizeof(type), __builtin_types_compatible_p(type, float));
87
88extern int main(int, char *[]);
89
90int main(int argc, char *argv[])
91{
92"""
93
94PROBE_TAIL = """}
95"""
96
97def read_config(fname, config):
98 "Read HelenOS build configuration"
99
100 inf = open(fname, 'r')
101
102 for line in inf:
103 res = re.match(r'^(?:#!# )?([^#]\w*)\s*=\s*(.*?)\s*$', line)
104 if (res):
105 config[res.group(1)] = res.group(2)
106
107 inf.close()
108
109def print_error(msg):
110 "Print a bold error message"
111
112 sys.stderr.write("\n")
113 sys.stderr.write("######################################################################\n")
114 sys.stderr.write("HelenOS build sanity check error:\n")
115 sys.stderr.write("\n")
116 sys.stderr.write("%s\n" % "\n".join(msg))
117 sys.stderr.write("######################################################################\n")
118 sys.stderr.write("\n")
119
120 sys.exit(1)
121
122def print_warning(msg):
123 "Print a bold error message"
124
125 sys.stderr.write("\n")
126 sys.stderr.write("######################################################################\n")
127 sys.stderr.write("HelenOS build sanity check warning:\n")
128 sys.stderr.write("\n")
129 sys.stderr.write("%s\n" % "\n".join(msg))
130 sys.stderr.write("######################################################################\n")
131 sys.stderr.write("\n")
132
133 time.sleep(5)
134
135def sandbox_enter():
136 "Create a temporal sandbox directory for running tests"
137
138 if (os.path.exists(SANDBOX)):
139 if (os.path.isdir(SANDBOX)):
140 try:
141 shutil.rmtree(SANDBOX)
142 except:
143 print_error(["Unable to cleanup the directory \"%s\"." % SANDBOX])
144 else:
145 print_error(["Please inspect and remove unexpected directory,",
146 "entry \"%s\"." % SANDBOX])
147
148 try:
149 os.mkdir(SANDBOX)
150 except:
151 print_error(["Unable to create sandbox directory \"%s\"." % SANDBOX])
152
153 owd = os.getcwd()
154 os.chdir(SANDBOX)
155
156 return owd
157
158def sandbox_leave(owd):
159 "Leave the temporal sandbox directory"
160
161 os.chdir(owd)
162
163def check_config(config, key):
164 "Check whether the configuration key exists"
165
166 if (not key in config):
167 print_error(["Build configuration of HelenOS does not contain %s." % key,
168 "Try running \"make config\" again.",
169 "If the problem persists, please contact the developers of HelenOS."])
170
171def check_common(common, key):
172 "Check whether the common key exists"
173
174 if (not key in common):
175 print_error(["Failed to determine the value %s." % key,
176 "Please contact the developers of HelenOS."])
177
178def get_target(config):
179 platform = None
180 gnu_target = None
181 helenos_target = None
182 target = None
183 cc_args = []
184
185 if (config['PLATFORM'] == "abs32le"):
186 check_config(config, "CROSS_TARGET")
187 platform = config['CROSS_TARGET']
188
189 if (config['CROSS_TARGET'] == "arm32"):
190 gnu_target = "arm-linux-gnueabi"
191 helenos_target = "arm-helenos"
192
193 if (config['CROSS_TARGET'] == "ia32"):
194 gnu_target = "i686-pc-linux-gnu"
195 helenos_target = "i686-helenos"
196
197 if (config['CROSS_TARGET'] == "mips32"):
198 cc_args.append("-mabi=32")
199 gnu_target = "mipsel-linux-gnu"
200 helenos_target = "mipsel-helenos"
201
202 if (config['PLATFORM'] == "amd64"):
203 platform = config['PLATFORM']
204 gnu_target = "amd64-unknown-elf"
205 helenos_target = "amd64-helenos"
206
207 if (config['PLATFORM'] == "arm32"):
208 platform = config['PLATFORM']
209 gnu_target = "arm-linux-gnueabi"
210 helenos_target = "arm-helenos"
211
212 if (config['PLATFORM'] == "ia32"):
213 platform = config['PLATFORM']
214 gnu_target = "i686-pc-linux-gnu"
215 helenos_target = "i686-helenos"
216
217 if (config['PLATFORM'] == "ia64"):
218 platform = config['PLATFORM']
219 gnu_target = "ia64-pc-linux-gnu"
220 helenos_target = "ia64-helenos"
221
222 if (config['PLATFORM'] == "mips32"):
223 check_config(config, "MACHINE")
224 cc_args.append("-mabi=32")
225
226 if ((config['MACHINE'] == "msim") or (config['MACHINE'] == "lmalta")):
227 platform = config['PLATFORM']
228 gnu_target = "mipsel-linux-gnu"
229 helenos_target = "mipsel-helenos"
230
231 if ((config['MACHINE'] == "bmalta")):
232 platform = "mips32eb"
233 gnu_target = "mips-linux-gnu"
234 helenos_target = "mips-helenos"
235
236 if (config['PLATFORM'] == "mips64"):
237 check_config(config, "MACHINE")
238 cc_args.append("-mabi=64")
239
240 if (config['MACHINE'] == "msim"):
241 platform = config['PLATFORM']
242 gnu_target = "mips64el-linux-gnu"
243 helenos_target = "mips64el-helenos"
244
245 if (config['PLATFORM'] == "ppc32"):
246 platform = config['PLATFORM']
247 gnu_target = "ppc-linux-gnu"
248 helenos_target = "ppc-helenos"
249
250 if (config['PLATFORM'] == "riscv64"):
251 platform = config['PLATFORM']
252 gnu_target = "riscv64-unknown-linux-gnu"
253 helenos_target = "riscv64-helenos"
254
255 if (config['PLATFORM'] == "sparc64"):
256 platform = config['PLATFORM']
257 gnu_target = "sparc64-linux-gnu"
258 helenos_target = "sparc64-helenos"
259
260 if (config['COMPILER'] == "gcc_helenos"):
261 target = helenos_target
262 else:
263 target = gnu_target
264
265 return (platform, cc_args, target)
266
267def check_app(args, name, details):
268 "Check whether an application can be executed"
269
270 try:
271 sys.stderr.write("Checking for %s ... " % args[0])
272 subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).wait()
273 except:
274 sys.stderr.write("failed\n")
275 print_error(["%s is missing." % name,
276 "",
277 "Execution of \"%s\" has failed. Please make sure that it" % " ".join(args),
278 "is installed in your system (%s)." % details])
279
280 sys.stderr.write("ok\n")
281
282def check_app_alternatives(alts, args, name, details):
283 "Check whether an application can be executed (use several alternatives)"
284
285 tried = []
286 found = None
287
288 for alt in alts:
289 working = True
290 cmdline = [alt] + args
291 tried.append(" ".join(cmdline))
292
293 try:
294 sys.stderr.write("Checking for %s ... " % alt)
295 subprocess.Popen(cmdline, stdout = subprocess.PIPE, stderr = subprocess.PIPE).wait()
296 except:
297 sys.stderr.write("failed\n")
298 working = False
299
300 if (working):
301 sys.stderr.write("ok\n")
302 found = alt
303 break
304
305 if (found is None):
306 print_error(["%s is missing." % name,
307 "",
308 "Please make sure that it is installed in your",
309 "system (%s)." % details,
310 "",
311 "The following alternatives were tried:"] + tried)
312
313 return found
314
315def check_clang(path, prefix, common, details):
316 "Check for clang"
317
318 common['CLANG'] = "%sclang" % prefix
319
320 if (not path is None):
321 common['CLANG'] = "%s/%s" % (path, common['CLANG'])
322
323 check_app([common['CLANG'], "--version"], "clang", details)
324
325def check_gcc(path, prefix, common, details):
326 "Check for GCC"
327
328 common['GCC'] = "%sgcc" % prefix
329 common['GXX'] = "%sg++" % prefix
330
331 if (not path is None):
332 common['GCC'] = "%s/%s" % (path, common['GCC'])
333 common['GXX'] = "%s/%s" % (path, common['GXX'])
334
335 check_app([common['GCC'], "--version"], "GNU GCC", details)
336
337def check_binutils(path, prefix, common, details):
338 "Check for binutils toolchain"
339
340 common['AS'] = "%sas" % prefix
341 common['LD'] = "%sld" % prefix
342 common['AR'] = "%sar" % prefix
343 common['OBJCOPY'] = "%sobjcopy" % prefix
344 common['OBJDUMP'] = "%sobjdump" % prefix
345 common['STRIP'] = "%sstrip" % prefix
346
347 if (not path is None):
348 for key in ["AS", "LD", "AR", "OBJCOPY", "OBJDUMP", "STRIP"]:
349 common[key] = "%s/%s" % (path, common[key])
350
351 check_app([common['AS'], "--version"], "GNU Assembler", details)
352 check_app([common['LD'], "--version"], "GNU Linker", details)
353 check_app([common['AR'], "--version"], "GNU Archiver", details)
354 check_app([common['OBJCOPY'], "--version"], "GNU Objcopy utility", details)
355 check_app([common['OBJDUMP'], "--version"], "GNU Objdump utility", details)
356 check_app([common['STRIP'], "--version"], "GNU strip", details)
357
358def decode_value(value):
359 "Decode integer value"
360
361 base = 10
362
363 if ((value.startswith('$')) or (value.startswith('#'))):
364 value = value[1:]
365
366 if (value.startswith('0x')):
367 value = value[2:]
368 base = 16
369
370 return int(value, base)
371
372def probe_compiler(common, typesizes):
373 "Generate, compile and parse probing source"
374
375 check_common(common, "CC")
376
377 outf = open(PROBE_SOURCE, 'w')
378 outf.write(PROBE_HEAD)
379
380 for typedef in typesizes:
381 if 'def' in typedef:
382 outf.write("#ifdef %s\n" % typedef['def'])
383 outf.write("\tDECLARE_BUILTIN_TYPE(\"%s\", %s);\n" % (typedef['tag'], typedef['type']))
384 if 'def' in typedef:
385 outf.write("#endif\n")
386
387 outf.write(PROBE_TAIL)
388 outf.close()
389
390 args = common['CC_AUTOGEN'].split(' ')
391 args.extend(["-S", "-o", PROBE_OUTPUT, PROBE_SOURCE])
392
393 try:
394 sys.stderr.write("Checking compiler properties ... ")
395 output = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate()
396 except:
397 sys.stderr.write("failed\n")
398 print_error(["Error executing \"%s\"." % " ".join(args),
399 "Make sure that the compiler works properly."])
400
401 if (not os.path.isfile(PROBE_OUTPUT)):
402 sys.stderr.write("failed\n")
403 print(output[1])
404 print_error(["Error executing \"%s\"." % " ".join(args),
405 "The compiler did not produce the output file \"%s\"." % PROBE_OUTPUT,
406 "",
407 output[0],
408 output[1]])
409
410 sys.stderr.write("ok\n")
411
412 inf = open(PROBE_OUTPUT, 'r')
413 lines = inf.readlines()
414 inf.close()
415
416 builtins = {}
417
418 for j in range(len(lines)):
419 tokens = lines[j].strip().split("\t")
420
421 if (len(tokens) > 0):
422 if (tokens[0] == "AUTOTOOL_DECLARE"):
423 if (len(tokens) < 8):
424 print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
425
426 category = tokens[1]
427 tag = tokens[2]
428 name = tokens[3]
429 signedness = tokens[4]
430 base = tokens[5]
431 size = tokens[6]
432 compatible = tokens[7]
433
434 try:
435 compatible_int = decode_value(compatible)
436 size_int = decode_value(size)
437 except:
438 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
439
440 if (compatible_int == 1):
441 builtins[tag] = {
442 'tag': tag,
443 'name': name,
444 'sign': signedness,
445 'base': base,
446 'size': size_int,
447 }
448
449 for typedef in typesizes:
450 if not typedef['tag'] in builtins:
451 print_error(['Unable to determine the properties of type %s.' % typedef['tag'],
452 COMPILER_FAIL])
453 if 'sname' in typedef:
454 builtins[typedef['tag']]['sname'] = typedef['sname']
455
456 return builtins
457
458def get_suffix(type):
459 if type['sign'] == 'unsigned':
460 return {
461 "char": "",
462 "short": "",
463 "int": "U",
464 "long": "UL",
465 "long long": "ULL",
466 }[type['base']]
467 else:
468 return {
469 "char": "",
470 "short": "",
471 "int": "",
472 "long": "L",
473 "long long": "LL",
474 }[type['base']]
475
476def get_max(type):
477 val = (1 << (type['size']*8 - 1))
478 if type['sign'] == 'unsigned':
479 val *= 2
480 return val - 1
481
482def detect_sizes(probe):
483 "Detect properties of builtin types"
484
485 macros = {}
486
487 for type in probe.values():
488 macros['__SIZEOF_%s__' % type['tag']] = type['size']
489
490 if ('sname' in type):
491 macros['__%s_TYPE__' % type['sname']] = type['name']
492 macros['__%s_WIDTH__' % type['sname']] = type['size']*8
493 macros['__%s_%s__' % (type['sname'], type['sign'].upper())] = "1"
494 macros['__%s_C_SUFFIX__' % type['sname']] = get_suffix(type)
495 macros['__%s_MAX__' % type['sname']] = "%d%s" % (get_max(type), get_suffix(type))
496
497 if (probe['SIZE_T']['sign'] != 'unsigned'):
498 print_error(['The type size_t is not unsigned.', COMPILER_FAIL])
499
500 return macros
501
502def create_makefile(mkname, common):
503 "Create makefile output"
504
505 outmk = open(mkname, 'w')
506
507 outmk.write('#########################################\n')
508 outmk.write('## AUTO-GENERATED FILE, DO NOT EDIT!!! ##\n')
509 outmk.write('## Generated by: tools/autotool.py ##\n')
510 outmk.write('#########################################\n\n')
511
512 for key, value in common.items():
513 if (type(value) is list):
514 outmk.write('%s = %s\n' % (key, " ".join(value)))
515 else:
516 outmk.write('%s = %s\n' % (key, value))
517
518 outmk.close()
519
520def create_header(hdname, macros):
521 "Create header output"
522
523 outhd = open(hdname, 'w')
524
525 outhd.write('/***************************************\n')
526 outhd.write(' * AUTO-GENERATED FILE, DO NOT EDIT!!! *\n')
527 outhd.write(' * Generated by: tools/autotool.py *\n')
528 outhd.write(' ***************************************/\n\n')
529
530 outhd.write('#ifndef %s\n' % GUARD)
531 outhd.write('#define %s\n\n' % GUARD)
532
533 for macro in sorted(macros):
534 outhd.write('#ifndef %s\n' % macro)
535 outhd.write('#define %s %s\n' % (macro, macros[macro]))
536 outhd.write('#endif\n\n')
537
538 outhd.write('\n#endif\n')
539 outhd.close()
540
541def main():
542 config = {}
543 common = {}
544
545 # Read and check configuration
546 if os.path.exists(CONFIG):
547 read_config(CONFIG, config)
548 else:
549 print_error(["Configuration file %s not found! Make sure that the" % CONFIG,
550 "configuration phase of HelenOS build went OK. Try running",
551 "\"make config\" again."])
552
553 check_config(config, "PLATFORM")
554 check_config(config, "COMPILER")
555 check_config(config, "BARCH")
556
557 # Cross-compiler prefix
558 if ('CROSS_PREFIX' in os.environ):
559 cross_prefix = os.environ['CROSS_PREFIX']
560 else:
561 cross_prefix = "/usr/local/cross"
562
563 # HelenOS cross-compiler prefix
564 if ('CROSS_HELENOS_PREFIX' in os.environ):
565 cross_helenos_prefix = os.environ['CROSS_HELENOS_PREFIX']
566 else:
567 cross_helenos_prefix = "/usr/local/cross-helenos"
568
569 # Prefix binutils tools on Solaris
570 if (os.uname()[0] == "SunOS"):
571 binutils_prefix = "g"
572 else:
573 binutils_prefix = ""
574
575 owd = sandbox_enter()
576
577 try:
578 # Common utilities
579 check_app(["ln", "--version"], "Symlink utility", "usually part of coreutils")
580 check_app(["rm", "--version"], "File remove utility", "usually part of coreutils")
581 check_app(["mkdir", "--version"], "Directory creation utility", "usually part of coreutils")
582 check_app(["cp", "--version"], "Copy utility", "usually part of coreutils")
583 check_app(["find", "--version"], "Find utility", "usually part of findutils")
584 check_app(["diff", "--version"], "Diff utility", "usually part of diffutils")
585 check_app(["make", "--version"], "Make utility", "preferably GNU Make")
586 check_app(["unzip"], "unzip utility", "usually part of zip/unzip utilities")
587 check_app(["tar", "--version"], "tar utility", "usually part of tar")
588
589 platform, cc_args, target = get_target(config)
590
591 if (platform is None) or (target is None):
592 print_error(["Unsupported compiler target.",
593 "Please contact the developers of HelenOS."])
594
595 path = "%s/%s/bin" % (cross_prefix, target)
596
597 # Compatibility with earlier toolchain paths.
598 if not os.path.exists(path):
599 if (config['COMPILER'] == "gcc_helenos"):
600 check_path = "%s/%s/%s" % (cross_helenos_prefix, platform, target)
601 if not os.path.exists(check_path):
602 print_error(TOOLCHAIN_FAIL)
603 path = "%s/%s/bin" % (cross_helenos_prefix, platform)
604 else:
605 check_path = "%s/%s/%s" % (cross_prefix, platform, target)
606 if not os.path.exists(check_path):
607 print_error(TOOLCHAIN_FAIL)
608 path = "%s/%s/bin" % (cross_prefix, platform)
609
610 common['TARGET'] = target
611 prefix = "%s-" % target
612
613 # Compiler
614 if (config['COMPILER'] == "gcc_cross" or config['COMPILER'] == "gcc_helenos"):
615 check_gcc(path, prefix, common, PACKAGE_CROSS)
616 check_binutils(path, prefix, common, PACKAGE_CROSS)
617
618 check_common(common, "GCC")
619 common['CC'] = " ".join([common['GCC']] + cc_args)
620 common['CC_AUTOGEN'] = common['CC']
621
622 check_common(common, "GXX")
623 common['CXX'] = common['GXX']
624
625 if (config['COMPILER'] == "gcc_native"):
626 check_gcc(None, "", common, PACKAGE_GCC)
627 check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
628
629 check_common(common, "GCC")
630 common['CC'] = common['GCC']
631 common['CC_AUTOGEN'] = common['CC']
632
633 if (config['COMPILER'] == "clang"):
634 check_binutils(path, prefix, common, PACKAGE_CROSS)
635 check_clang(path, prefix, common, PACKAGE_CLANG)
636
637 check_common(common, "CLANG")
638 common['CC'] = " ".join([common['CLANG']] + cc_args)
639 common['CC_AUTOGEN'] = common['CC'] + " -no-integrated-as"
640
641 if (config['INTEGRATED_AS'] == "yes"):
642 common['CC'] += " -integrated-as"
643
644 if (config['INTEGRATED_AS'] == "no"):
645 common['CC'] += " -no-integrated-as"
646
647 # Platform-specific utilities
648 if ((config['BARCH'] == "amd64") or (config['BARCH'] == "ia32") or (config['BARCH'] == "ppc32") or (config['BARCH'] == "sparc64")):
649 common['GENISOIMAGE'] = check_app_alternatives(["genisoimage", "mkisofs", "xorriso"], ["--version"], "ISO 9660 creation utility", "usually part of genisoimage")
650 if common['GENISOIMAGE'] == 'xorriso':
651 common['GENISOIMAGE'] += ' -as genisoimage'
652
653 probe = probe_compiler(common,
654 [
655 {'type': 'long long int', 'tag': 'LONG_LONG', 'sname': 'LLONG' },
656 {'type': 'long int', 'tag': 'LONG', 'sname': 'LONG' },
657 {'type': 'int', 'tag': 'INT', 'sname': 'INT' },
658 {'type': 'short int', 'tag': 'SHORT', 'sname': 'SHRT'},
659 {'type': 'void*', 'tag': 'POINTER'},
660 {'type': 'long double', 'tag': 'LONG_DOUBLE'},
661 {'type': 'double', 'tag': 'DOUBLE'},
662 {'type': 'float', 'tag': 'FLOAT'},
663 {'type': '__SIZE_TYPE__', 'tag': 'SIZE_T', 'def': '__SIZE_TYPE__', 'sname': 'SIZE' },
664 {'type': '__PTRDIFF_TYPE__', 'tag': 'PTRDIFF_T', 'def': '__PTRDIFF_TYPE__', 'sname': 'PTRDIFF' },
665 {'type': '__WINT_TYPE__', 'tag': 'WINT_T', 'def': '__WINT_TYPE__', 'sname': 'WINT' },
666 {'type': '__WCHAR_TYPE__', 'tag': 'WCHAR_T', 'def': '__WCHAR_TYPE__', 'sname': 'WCHAR' },
667 {'type': '__INTMAX_TYPE__', 'tag': 'INTMAX_T', 'def': '__INTMAX_TYPE__', 'sname': 'INTMAX' },
668 {'type': 'unsigned __INTMAX_TYPE__', 'tag': 'UINTMAX_T', 'def': '__INTMAX_TYPE__', 'sname': 'UINTMAX' },
669 ]
670 )
671
672 macros = detect_sizes(probe)
673
674 finally:
675 sandbox_leave(owd)
676
677 create_makefile(MAKEFILE, common)
678 create_header(HEADER, macros)
679
680 return 0
681
682if __name__ == '__main__':
683 sys.exit(main())
Note: See TracBrowser for help on using the repository browser.