source: mainline/tools/autotool.py@ 5044114

Last change on this file since 5044114 was 9fb280c, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 6 years ago

Make clang slightly less broken

  • Property mode set to 100755
File size: 21.1 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.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 target = None
181
182 if (config['PLATFORM'] == "abs32le"):
183 check_config(config, "CROSS_TARGET")
184 platform = config['CROSS_TARGET']
185
186 if (config['CROSS_TARGET'] == "arm32"):
187 target = "arm-helenos"
188
189 if (config['CROSS_TARGET'] == "ia32"):
190 target = "i686-helenos"
191
192 if (config['CROSS_TARGET'] == "mips32"):
193 target = "mipsel-helenos"
194
195 if (config['PLATFORM'] == "amd64"):
196 platform = config['PLATFORM']
197 target = "amd64-helenos"
198
199 if (config['PLATFORM'] == "arm32"):
200 platform = config['PLATFORM']
201 target = "arm-helenos"
202
203 if (config['PLATFORM'] == "arm64"):
204 platform = config['PLATFORM']
205 target = "aarch64-helenos"
206
207 if (config['PLATFORM'] == "ia32"):
208 platform = config['PLATFORM']
209 target = "i686-helenos"
210
211 if (config['PLATFORM'] == "ia64"):
212 platform = config['PLATFORM']
213 target = "ia64-helenos"
214
215 if (config['PLATFORM'] == "mips32"):
216 check_config(config, "MACHINE")
217
218 if ((config['MACHINE'] == "msim") or (config['MACHINE'] == "lmalta")):
219 platform = config['PLATFORM']
220 target = "mipsel-helenos"
221
222 if ((config['MACHINE'] == "bmalta")):
223 platform = "mips32eb"
224 target = "mips-helenos"
225
226 if (config['PLATFORM'] == "mips64"):
227 check_config(config, "MACHINE")
228
229 if (config['MACHINE'] == "msim"):
230 platform = config['PLATFORM']
231 target = "mips64el-helenos"
232
233 if (config['PLATFORM'] == "ppc32"):
234 platform = config['PLATFORM']
235 target = "ppc-helenos"
236
237 if (config['PLATFORM'] == "riscv64"):
238 platform = config['PLATFORM']
239 target = "riscv64-helenos"
240
241 if (config['PLATFORM'] == "sparc64"):
242 platform = config['PLATFORM']
243 target = "sparc64-helenos"
244
245 return (platform, target)
246
247def check_app(args, name, details):
248 "Check whether an application can be executed"
249
250 try:
251 sys.stderr.write("Checking for %s ... " % args[0])
252 subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).wait()
253 except:
254 sys.stderr.write("failed\n")
255 print_error(["%s is missing." % name,
256 "",
257 "Execution of \"%s\" has failed. Please make sure that it" % " ".join(args),
258 "is installed in your system (%s)." % details])
259
260 sys.stderr.write("ok\n")
261
262def check_path_gcc(target):
263 "Check whether GCC for a given target is present in $PATH."
264
265 try:
266 subprocess.Popen([ "%s-gcc" % target, "--version" ], stdout = subprocess.PIPE, stderr = subprocess.PIPE).wait()
267 return True
268 except:
269 return False
270
271def check_app_alternatives(alts, args, name, details):
272 "Check whether an application can be executed (use several alternatives)"
273
274 tried = []
275 found = None
276
277 for alt in alts:
278 working = True
279 cmdline = [alt] + args
280 tried.append(" ".join(cmdline))
281
282 try:
283 sys.stderr.write("Checking for %s ... " % alt)
284 subprocess.Popen(cmdline, stdout = subprocess.PIPE, stderr = subprocess.PIPE).wait()
285 except:
286 sys.stderr.write("failed\n")
287 working = False
288
289 if (working):
290 sys.stderr.write("ok\n")
291 found = alt
292 break
293
294 if (found is None):
295 print_error(["%s is missing." % name,
296 "",
297 "Please make sure that it is installed in your",
298 "system (%s)." % details,
299 "",
300 "The following alternatives were tried:"] + tried)
301
302 return found
303
304def check_clang(path, prefix, common, details):
305 "Check for clang"
306
307 common['CLANG'] = "%sclang" % prefix
308 common['CLANGXX'] = "%sclang++" % prefix
309
310 if (not path is None):
311 common['CLANG'] = "%s/%s" % (path, common['CLANG'])
312 common['CLANGXX'] = "%s/%s" % (path, common['CLANGXX'])
313
314 check_app([common['CLANG'], "--version"], "clang", details)
315
316def check_gcc(path, prefix, common, details):
317 "Check for GCC"
318
319 common['GCC'] = "%sgcc" % prefix
320 common['GXX'] = "%sg++" % prefix
321
322 if (not path is None):
323 common['GCC'] = "%s/%s" % (path, common['GCC'])
324 common['GXX'] = "%s/%s" % (path, common['GXX'])
325
326 check_app([common['GCC'], "--version"], "GNU GCC", details)
327
328def check_libgcc(common):
329 sys.stderr.write("Checking for libgcc.a ... ")
330 libgcc_path = None
331 proc = subprocess.Popen([ common['GCC'], "-print-search-dirs" ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
332 for line in proc.stdout:
333 line = line.decode('utf-8').strip('\n')
334 parts = line.split()
335 if parts[0] == "install:":
336 p = parts[1] + "libgcc.a"
337 if os.path.isfile(p):
338 libgcc_path = p
339 proc.wait()
340
341 if libgcc_path is None:
342 sys.stderr.write("failed\n")
343 print_error(["Unable to find gcc library (libgcc.a).",
344 "",
345 "Please ensure that you have installed the",
346 "toolchain properly."])
347
348 sys.stderr.write("ok\n")
349 common['LIBGCC_PATH'] = libgcc_path
350
351
352def check_binutils(path, prefix, common, details):
353 "Check for binutils toolchain"
354
355 common['AS'] = "%sas" % prefix
356 common['LD'] = "%sld" % prefix
357 common['AR'] = "%sar" % prefix
358 common['OBJCOPY'] = "%sobjcopy" % prefix
359 common['OBJDUMP'] = "%sobjdump" % prefix
360 common['STRIP'] = "%sstrip" % prefix
361
362 if (not path is None):
363 for key in ["AS", "LD", "AR", "OBJCOPY", "OBJDUMP", "STRIP"]:
364 common[key] = "%s/%s" % (path, common[key])
365
366 check_app([common['AS'], "--version"], "GNU Assembler", details)
367 check_app([common['LD'], "--version"], "GNU Linker", details)
368 check_app([common['AR'], "--version"], "GNU Archiver", details)
369 check_app([common['OBJCOPY'], "--version"], "GNU Objcopy utility", details)
370 check_app([common['OBJDUMP'], "--version"], "GNU Objdump utility", details)
371 check_app([common['STRIP'], "--version"], "GNU strip", details)
372
373def decode_value(value):
374 "Decode integer value"
375
376 base = 10
377
378 if ((value.startswith('$')) or (value.startswith('#'))):
379 value = value[1:]
380
381 if (value.startswith('0x')):
382 value = value[2:]
383 base = 16
384
385 return int(value, base)
386
387def probe_compiler(cc, common, typesizes):
388 "Generate, compile and parse probing source"
389
390 check_common(common, "CC")
391
392 outf = open(PROBE_SOURCE, 'w')
393 outf.write(PROBE_HEAD)
394
395 for typedef in typesizes:
396 if 'def' in typedef:
397 outf.write("#ifdef %s\n" % typedef['def'])
398 outf.write("\tDECLARE_BUILTIN_TYPE(\"%s\", %s);\n" % (typedef['tag'], typedef['type']))
399 if 'def' in typedef:
400 outf.write("#endif\n")
401
402 outf.write(PROBE_TAIL)
403 outf.close()
404
405 args = cc.split(' ')
406 args.extend(["-S", "-o", PROBE_OUTPUT, PROBE_SOURCE])
407
408 try:
409 sys.stderr.write("Checking compiler properties ... ")
410 output = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate()
411 except:
412 sys.stderr.write("failed\n")
413 print_error(["Error executing \"%s\"." % " ".join(args),
414 "Make sure that the compiler works properly."])
415
416 if (not os.path.isfile(PROBE_OUTPUT)):
417 sys.stderr.write("failed\n")
418 print(output[1])
419 print_error(["Error executing \"%s\"." % " ".join(args),
420 "The compiler did not produce the output file \"%s\"." % PROBE_OUTPUT,
421 "",
422 output[0],
423 output[1]])
424
425 sys.stderr.write("ok\n")
426
427 inf = open(PROBE_OUTPUT, 'r')
428 lines = inf.readlines()
429 inf.close()
430
431 builtins = {}
432
433 for j in range(len(lines)):
434 tokens = lines[j].strip().split("\t")
435
436 if (len(tokens) > 0):
437 if (tokens[0] == "AUTOTOOL_DECLARE"):
438 if (len(tokens) < 8):
439 print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
440
441 category = tokens[1]
442 tag = tokens[2]
443 name = tokens[3]
444 signedness = tokens[4]
445 base = tokens[5]
446 size = tokens[6]
447 compatible = tokens[7]
448
449 try:
450 compatible_int = decode_value(compatible)
451 size_int = decode_value(size)
452 except:
453 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
454
455 if (compatible_int == 1):
456 builtins[tag] = {
457 'tag': tag,
458 'name': name,
459 'sign': signedness,
460 'base': base,
461 'size': size_int,
462 }
463
464 for typedef in typesizes:
465 if not typedef['tag'] in builtins:
466 print_error(['Unable to determine the properties of type %s.' % typedef['tag'],
467 COMPILER_FAIL])
468 if 'sname' in typedef:
469 builtins[typedef['tag']]['sname'] = typedef['sname']
470
471 return builtins
472
473def get_suffix(type):
474 if type['sign'] == 'unsigned':
475 return {
476 "char": "",
477 "short": "",
478 "int": "U",
479 "long": "UL",
480 "long long": "ULL",
481 }[type['base']]
482 else:
483 return {
484 "char": "",
485 "short": "",
486 "int": "",
487 "long": "L",
488 "long long": "LL",
489 }[type['base']]
490
491def get_max(type):
492 val = (1 << (type['size']*8 - 1))
493 if type['sign'] == 'unsigned':
494 val *= 2
495 return val - 1
496
497def detect_sizes(probe):
498 "Detect properties of builtin types"
499
500 macros = {}
501
502 for type in probe.values():
503 macros['__SIZEOF_%s__' % type['tag']] = type['size']
504
505 if ('sname' in type):
506 macros['__%s_TYPE__' % type['sname']] = type['name']
507 macros['__%s_WIDTH__' % type['sname']] = type['size']*8
508 macros['__%s_%s__' % (type['sname'], type['sign'].upper())] = "1"
509 macros['__%s_C_SUFFIX__' % type['sname']] = get_suffix(type)
510 macros['__%s_MAX__' % type['sname']] = "%d%s" % (get_max(type), get_suffix(type))
511
512 if (probe['SIZE_T']['sign'] != 'unsigned'):
513 print_error(['The type size_t is not unsigned.', COMPILER_FAIL])
514
515 return macros
516
517def create_makefile(mkname, common):
518 "Create makefile output"
519
520 outmk = open(mkname, 'w')
521
522 outmk.write('#########################################\n')
523 outmk.write('## AUTO-GENERATED FILE, DO NOT EDIT!!! ##\n')
524 outmk.write('## Generated by: tools/autotool.py ##\n')
525 outmk.write('#########################################\n\n')
526
527 for key, value in common.items():
528 if (type(value) is list):
529 outmk.write('%s = %s\n' % (key, " ".join(value)))
530 else:
531 outmk.write('%s = %s\n' % (key, value))
532
533 outmk.close()
534
535def create_header(hdname, macros):
536 "Create header output"
537
538 outhd = open(hdname, 'w')
539
540 outhd.write('/***************************************\n')
541 outhd.write(' * AUTO-GENERATED FILE, DO NOT EDIT!!! *\n')
542 outhd.write(' * Generated by: tools/autotool.py *\n')
543 outhd.write(' ***************************************/\n\n')
544
545 outhd.write('#ifndef %s\n' % GUARD)
546 outhd.write('#define %s\n\n' % GUARD)
547
548 for macro in sorted(macros):
549 outhd.write('#ifndef %s\n' % macro)
550 outhd.write('#define %s %s\n' % (macro, macros[macro]))
551 outhd.write('#endif\n\n')
552
553 outhd.write('\n#endif\n')
554 outhd.close()
555
556def main():
557 config = {}
558 common = {}
559
560 # Read and check configuration
561 if os.path.exists(CONFIG):
562 read_config(CONFIG, config)
563 else:
564 print_error(["Configuration file %s not found! Make sure that the" % CONFIG,
565 "configuration phase of HelenOS build went OK. Try running",
566 "\"make config\" again."])
567
568 check_config(config, "PLATFORM")
569 check_config(config, "COMPILER")
570 check_config(config, "BARCH")
571
572 # Cross-compiler prefix
573 if ('CROSS_PREFIX' in os.environ):
574 cross_prefix = os.environ['CROSS_PREFIX']
575 else:
576 cross_prefix = "/usr/local/cross"
577
578 owd = sandbox_enter()
579
580 try:
581 # Common utilities
582 check_app(["ln", "--version"], "Symlink utility", "usually part of coreutils")
583 check_app(["rm", "--version"], "File remove utility", "usually part of coreutils")
584 check_app(["mkdir", "--version"], "Directory creation utility", "usually part of coreutils")
585 check_app(["cp", "--version"], "Copy utility", "usually part of coreutils")
586 check_app(["find", "--version"], "Find utility", "usually part of findutils")
587 check_app(["diff", "--version"], "Diff utility", "usually part of diffutils")
588 check_app(["make", "--version"], "Make utility", "preferably GNU Make")
589 check_app(["unzip"], "unzip utility", "usually part of zip/unzip utilities")
590 check_app(["tar", "--version"], "tar utility", "usually part of tar")
591
592 platform, target = get_target(config)
593
594 if (platform is None) or (target is None):
595 print_error(["Unsupported compiler target.",
596 "Please contact the developers of HelenOS."])
597
598 path = None
599
600 if not check_path_gcc(target):
601 path = "%s/bin" % cross_prefix
602
603 common['TARGET'] = target
604 prefix = "%s-" % target
605
606 cc_autogen = None
607
608 # We always need to check for GCC as we
609 # need libgcc
610 check_gcc(path, prefix, common, PACKAGE_CROSS)
611
612 # Compiler
613 if (config['COMPILER'] == "gcc_cross"):
614 check_binutils(path, prefix, common, PACKAGE_CROSS)
615
616 check_common(common, "GCC")
617 common['CC'] = common['GCC']
618 cc_autogen = common['CC']
619
620 check_common(common, "GXX")
621 common['CXX'] = common['GXX']
622
623 if (config['COMPILER'] == "clang"):
624 check_binutils(path, prefix, common, PACKAGE_CROSS)
625 check_clang(path, prefix, common, PACKAGE_CLANG)
626
627 check_common(common, "CLANG")
628 common['CC'] = common['CLANG']
629 common['CXX'] = common['CLANGXX']
630 cc_autogen = common['CC'] + " -no-integrated-as"
631
632 if (config['INTEGRATED_AS'] == "yes"):
633 common['CC'] += " -integrated-as"
634 common['CXX'] += " -integrated-as"
635
636 if (config['INTEGRATED_AS'] == "no"):
637 common['CC'] += " -no-integrated-as"
638 common['CXX'] += " -no-integrated-as"
639
640 # Find full path to libgcc
641 check_libgcc(common)
642
643 # Platform-specific utilities
644 if (config['BARCH'] in ('amd64', 'arm64', 'ia32', 'ppc32', 'sparc64')):
645 common['GENISOIMAGE'] = check_app_alternatives(["genisoimage", "mkisofs", "xorriso"], ["--version"], "ISO 9660 creation utility", "usually part of genisoimage")
646 if common['GENISOIMAGE'] == 'xorriso':
647 common['GENISOIMAGE'] += ' -as genisoimage'
648
649 probe = probe_compiler(cc_autogen, common,
650 [
651 {'type': 'long long int', 'tag': 'LONG_LONG', 'sname': 'LLONG' },
652 {'type': 'long int', 'tag': 'LONG', 'sname': 'LONG' },
653 {'type': 'int', 'tag': 'INT', 'sname': 'INT' },
654 {'type': 'short int', 'tag': 'SHORT', 'sname': 'SHRT'},
655 {'type': 'void*', 'tag': 'POINTER'},
656 {'type': 'long double', 'tag': 'LONG_DOUBLE'},
657 {'type': 'double', 'tag': 'DOUBLE'},
658 {'type': 'float', 'tag': 'FLOAT'},
659 {'type': '__SIZE_TYPE__', 'tag': 'SIZE_T', 'def': '__SIZE_TYPE__', 'sname': 'SIZE' },
660 {'type': '__PTRDIFF_TYPE__', 'tag': 'PTRDIFF_T', 'def': '__PTRDIFF_TYPE__', 'sname': 'PTRDIFF' },
661 {'type': '__WINT_TYPE__', 'tag': 'WINT_T', 'def': '__WINT_TYPE__', 'sname': 'WINT' },
662 {'type': '__WCHAR_TYPE__', 'tag': 'WCHAR_T', 'def': '__WCHAR_TYPE__', 'sname': 'WCHAR' },
663 {'type': '__INTMAX_TYPE__', 'tag': 'INTMAX_T', 'def': '__INTMAX_TYPE__', 'sname': 'INTMAX' },
664 {'type': 'unsigned __INTMAX_TYPE__', 'tag': 'UINTMAX_T', 'def': '__INTMAX_TYPE__', 'sname': 'UINTMAX' },
665 ]
666 )
667
668 macros = detect_sizes(probe)
669
670 finally:
671 sandbox_leave(owd)
672
673 create_makefile(MAKEFILE, common)
674 create_header(HEADER, macros)
675
676 return 0
677
678if __name__ == '__main__':
679 sys.exit(main())
Note: See TracBrowser for help on using the repository browser.