[177e4ea] | 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 | #
|
---|
[3c80f2b] | 29 |
|
---|
[177e4ea] | 30 | """
|
---|
| 31 | Detect important prerequisites and parameters for building HelenOS
|
---|
| 32 | """
|
---|
| 33 |
|
---|
| 34 | import sys
|
---|
| 35 | import os
|
---|
[4e9aaf5] | 36 | import shutil
|
---|
[177e4ea] | 37 | import re
|
---|
| 38 | import time
|
---|
| 39 | import subprocess
|
---|
| 40 |
|
---|
[4e9aaf5] | 41 | SANDBOX = 'autotool'
|
---|
| 42 | CONFIG = 'Makefile.config'
|
---|
| 43 | MAKEFILE = 'Makefile.common'
|
---|
| 44 | HEADER = 'common.h'
|
---|
| 45 | GUARD = 'AUTOTOOL_COMMON_H_'
|
---|
| 46 |
|
---|
| 47 | PROBE_SOURCE = 'probe.c'
|
---|
| 48 | PROBE_OUTPUT = 'probe.s'
|
---|
[177e4ea] | 49 |
|
---|
| 50 | PACKAGE_BINUTILS = "usually part of binutils"
|
---|
| 51 | PACKAGE_GCC = "preferably version 4.4.3 or newer"
|
---|
| 52 | PACKAGE_CROSS = "use tools/toolchain.sh to build the cross-compiler toolchain"
|
---|
| 53 |
|
---|
[4e9aaf5] | 54 | COMPILER_FAIL = "The compiler is probably not capable to compile HelenOS."
|
---|
| 55 |
|
---|
| 56 | PROBE_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, name, value) \\
|
---|
| 57 | asm volatile ( \\
|
---|
| 58 | "AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" name "\\t%[val]\\n" \\
|
---|
| 59 | : \\
|
---|
| 60 | : [val] "n" (value) \\
|
---|
| 61 | )
|
---|
| 62 |
|
---|
| 63 | #define DECLARE_INTSIZE(type) \\
|
---|
| 64 | AUTOTOOL_DECLARE("intsize", "unsigned", #type, sizeof(unsigned type)); \\
|
---|
| 65 | AUTOTOOL_DECLARE("intsize", "signed", #type, sizeof(signed type))
|
---|
| 66 |
|
---|
| 67 | int main(int argc, char *argv[])
|
---|
| 68 | {
|
---|
| 69 | """
|
---|
| 70 |
|
---|
| 71 | PROBE_TAIL = """}
|
---|
| 72 | """
|
---|
| 73 |
|
---|
[177e4ea] | 74 | def read_config(fname, config):
|
---|
| 75 | "Read HelenOS build configuration"
|
---|
| 76 |
|
---|
| 77 | inf = file(fname, 'r')
|
---|
| 78 |
|
---|
| 79 | for line in inf:
|
---|
| 80 | res = re.match(r'^(?:#!# )?([^#]\w*)\s*=\s*(.*?)\s*$', line)
|
---|
| 81 | if (res):
|
---|
| 82 | config[res.group(1)] = res.group(2)
|
---|
| 83 |
|
---|
| 84 | inf.close()
|
---|
| 85 |
|
---|
| 86 | def print_error(msg):
|
---|
| 87 | "Print a bold error message"
|
---|
| 88 |
|
---|
| 89 | sys.stderr.write("\n")
|
---|
| 90 | sys.stderr.write("######################################################################\n")
|
---|
| 91 | sys.stderr.write("HelenOS build sanity check error:\n")
|
---|
| 92 | sys.stderr.write("\n")
|
---|
| 93 | sys.stderr.write("%s\n" % "\n".join(msg))
|
---|
| 94 | sys.stderr.write("######################################################################\n")
|
---|
| 95 | sys.stderr.write("\n")
|
---|
| 96 |
|
---|
| 97 | sys.exit(1)
|
---|
| 98 |
|
---|
[4e9aaf5] | 99 | def sandbox_enter():
|
---|
| 100 | "Create a temporal sandbox directory for running tests"
|
---|
| 101 |
|
---|
| 102 | if (os.path.exists(SANDBOX)):
|
---|
| 103 | if (os.path.isdir(SANDBOX)):
|
---|
| 104 | try:
|
---|
| 105 | shutil.rmtree(SANDBOX)
|
---|
| 106 | except:
|
---|
| 107 | print_error(["Unable to cleanup the directory \"%s\"." % SANDBOX])
|
---|
| 108 | else:
|
---|
| 109 | print_error(["Please inspect and remove unexpected directory,",
|
---|
| 110 | "entry \"%s\"." % SANDBOX])
|
---|
| 111 |
|
---|
| 112 | try:
|
---|
| 113 | os.mkdir(SANDBOX)
|
---|
| 114 | except:
|
---|
| 115 | print_error(["Unable to create sandbox directory \"%s\"." % SANDBOX])
|
---|
| 116 |
|
---|
| 117 | owd = os.getcwd()
|
---|
| 118 | os.chdir(SANDBOX)
|
---|
| 119 |
|
---|
| 120 | return owd
|
---|
| 121 |
|
---|
| 122 | def sandbox_leave(owd):
|
---|
| 123 | "Leave the temporal sandbox directory"
|
---|
| 124 |
|
---|
| 125 | os.chdir(owd)
|
---|
| 126 |
|
---|
[177e4ea] | 127 | def check_config(config, key):
|
---|
| 128 | "Check whether the configuration key exists"
|
---|
| 129 |
|
---|
| 130 | if (not key in config):
|
---|
| 131 | print_error(["Build configuration of HelenOS does not contain %s." % key,
|
---|
| 132 | "Try running \"make config\" again.",
|
---|
| 133 | "If the problem persists, please contact the developers of HelenOS."])
|
---|
| 134 |
|
---|
[4e9aaf5] | 135 | def check_common(common, key):
|
---|
| 136 | "Check whether the common key exists"
|
---|
| 137 |
|
---|
| 138 | if (not key in common):
|
---|
| 139 | print_error(["Failed to determine the value %s." % key,
|
---|
| 140 | "Please contact the developers of HelenOS."])
|
---|
| 141 |
|
---|
[177e4ea] | 142 | def check_app(args, name, details):
|
---|
| 143 | "Check whether an application can be executed"
|
---|
| 144 |
|
---|
| 145 | try:
|
---|
| 146 | sys.stderr.write("Checking for %s ... " % args[0])
|
---|
| 147 | subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).wait()
|
---|
| 148 | except:
|
---|
| 149 | sys.stderr.write("failed\n")
|
---|
| 150 | print_error(["%s is missing." % name,
|
---|
| 151 | "",
|
---|
| 152 | "Execution of \"%s\" has failed. Please make sure that it" % " ".join(args),
|
---|
| 153 | "is installed in your system (%s)." % details])
|
---|
| 154 |
|
---|
| 155 | sys.stderr.write("ok\n")
|
---|
| 156 |
|
---|
| 157 | def check_gcc(path, prefix, common, details):
|
---|
| 158 | "Check for GCC"
|
---|
| 159 |
|
---|
| 160 | common['GCC'] = "%sgcc" % prefix
|
---|
| 161 |
|
---|
| 162 | if (not path is None):
|
---|
| 163 | common['GCC'] = "%s/%s" % (path, common['GCC'])
|
---|
| 164 |
|
---|
| 165 | check_app([common['GCC'], "--version"], "GNU GCC", details)
|
---|
| 166 |
|
---|
| 167 | def check_binutils(path, prefix, common, details):
|
---|
| 168 | "Check for binutils toolchain"
|
---|
| 169 |
|
---|
| 170 | common['AS'] = "%sas" % prefix
|
---|
| 171 | common['LD'] = "%sld" % prefix
|
---|
| 172 | common['AR'] = "%sar" % prefix
|
---|
| 173 | common['OBJCOPY'] = "%sobjcopy" % prefix
|
---|
| 174 | common['OBJDUMP'] = "%sobjdump" % prefix
|
---|
[a4125fb1] | 175 | common['STRIP'] = "%sstrip" % prefix
|
---|
[177e4ea] | 176 |
|
---|
| 177 | if (not path is None):
|
---|
[a4125fb1] | 178 | for key in ["AS", "LD", "AR", "OBJCOPY", "OBJDUMP", "STRIP"]:
|
---|
[177e4ea] | 179 | common[key] = "%s/%s" % (path, common[key])
|
---|
| 180 |
|
---|
| 181 | check_app([common['AS'], "--version"], "GNU Assembler", details)
|
---|
| 182 | check_app([common['LD'], "--version"], "GNU Linker", details)
|
---|
| 183 | check_app([common['AR'], "--version"], "GNU Archiver", details)
|
---|
| 184 | check_app([common['OBJCOPY'], "--version"], "GNU Objcopy utility", details)
|
---|
| 185 | check_app([common['OBJDUMP'], "--version"], "GNU Objdump utility", details)
|
---|
[a4125fb1] | 186 | check_app([common['STRIP'], "--version"], "GNU strip", details)
|
---|
[177e4ea] | 187 |
|
---|
[4e9aaf5] | 188 | def probe_compiler(common, sizes):
|
---|
| 189 | "Generate, compile and parse probing source"
|
---|
| 190 |
|
---|
| 191 | check_common(common, "CC")
|
---|
| 192 |
|
---|
| 193 | outf = file(PROBE_SOURCE, 'w')
|
---|
| 194 | outf.write(PROBE_HEAD)
|
---|
| 195 |
|
---|
| 196 | for typedef in sizes:
|
---|
| 197 | outf.write("\tDECLARE_INTSIZE(%s);\n" % typedef)
|
---|
| 198 |
|
---|
| 199 | outf.write(PROBE_TAIL)
|
---|
| 200 | outf.close()
|
---|
| 201 |
|
---|
| 202 | args = [common['CC'], "-S", "-o", PROBE_OUTPUT, PROBE_SOURCE]
|
---|
| 203 |
|
---|
| 204 | try:
|
---|
| 205 | sys.stderr.write("Checking compiler properties ... ")
|
---|
| 206 | output = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate()
|
---|
| 207 | except:
|
---|
| 208 | sys.stderr.write("failed\n")
|
---|
| 209 | print_error(["Error executing \"%s\"." % " ".join(args),
|
---|
| 210 | "Make sure that the compiler works properly."])
|
---|
| 211 |
|
---|
| 212 | if (not os.path.isfile(PROBE_OUTPUT)):
|
---|
| 213 | sys.stderr.write("failed\n")
|
---|
| 214 | print output[1]
|
---|
| 215 | print_error(["Error executing \"%s\"." % " ".join(args),
|
---|
| 216 | "The compiler did not produce the output file \"%s\"." % PROBE_OUTPUT,
|
---|
| 217 | "",
|
---|
| 218 | output[0],
|
---|
| 219 | output[1]])
|
---|
| 220 |
|
---|
| 221 | sys.stderr.write("ok\n")
|
---|
| 222 |
|
---|
| 223 | inf = file(PROBE_OUTPUT, 'r')
|
---|
| 224 | lines = inf.readlines()
|
---|
| 225 | inf.close()
|
---|
| 226 |
|
---|
| 227 | unsigned_sizes = {}
|
---|
| 228 | signed_sizes = {}
|
---|
| 229 |
|
---|
| 230 | for j in range(len(lines)):
|
---|
| 231 | tokens = lines[j].strip().split("\t")
|
---|
| 232 |
|
---|
| 233 | if (len(tokens) > 0):
|
---|
| 234 | if (tokens[0] == "AUTOTOOL_DECLARE"):
|
---|
| 235 | if (len(tokens) < 5):
|
---|
| 236 | print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
|
---|
| 237 |
|
---|
| 238 | category = tokens[1]
|
---|
| 239 | subcategory = tokens[2]
|
---|
| 240 | name = tokens[3]
|
---|
| 241 | value = tokens[4]
|
---|
| 242 |
|
---|
| 243 | if (category == "intsize"):
|
---|
| 244 | base = 10
|
---|
| 245 |
|
---|
| 246 | if ((value.startswith('$')) or (value.startswith('#'))):
|
---|
| 247 | value = value[1:]
|
---|
| 248 |
|
---|
| 249 | if (value.startswith('0x')):
|
---|
| 250 | value = value[2:]
|
---|
| 251 | base = 16
|
---|
| 252 |
|
---|
| 253 | try:
|
---|
| 254 | value_int = int(value, base)
|
---|
| 255 | except:
|
---|
| 256 | print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
|
---|
| 257 |
|
---|
| 258 | if (subcategory == "unsigned"):
|
---|
| 259 | unsigned_sizes[name] = value_int
|
---|
| 260 | elif (subcategory == "signed"):
|
---|
| 261 | signed_sizes[name] = value_int
|
---|
| 262 | else:
|
---|
| 263 | print_error(["Unexpected keyword \"%s\" in \"%s\" on line %s." % (subcategory, PROBE_OUTPUT, j), COMPILER_FAIL])
|
---|
| 264 |
|
---|
| 265 | return {'unsigned_sizes' : unsigned_sizes, 'signed_sizes' : signed_sizes}
|
---|
| 266 |
|
---|
| 267 | def detect_uints(unsigned_sizes, signed_sizes, bytes):
|
---|
| 268 | "Detect correct types for fixed-size integer types"
|
---|
| 269 |
|
---|
| 270 | typedefs = []
|
---|
| 271 |
|
---|
| 272 | for b in bytes:
|
---|
| 273 | fnd = False
|
---|
| 274 | newtype = "uint%s_t" % (b * 8)
|
---|
| 275 |
|
---|
| 276 | for name, value in unsigned_sizes.items():
|
---|
| 277 | if (value == b):
|
---|
| 278 | oldtype = "unsigned %s" % name
|
---|
| 279 | typedefs.append({'oldtype' : oldtype, 'newtype' : newtype})
|
---|
| 280 | fnd = True
|
---|
| 281 | break
|
---|
| 282 |
|
---|
| 283 | if (not fnd):
|
---|
| 284 | print_error(['Unable to find appropriate integer type for %s' % newtype,
|
---|
| 285 | COMPILER_FAIL])
|
---|
| 286 |
|
---|
| 287 |
|
---|
| 288 | fnd = False
|
---|
| 289 | newtype = "int%s_t" % (b * 8)
|
---|
| 290 |
|
---|
| 291 | for name, value in signed_sizes.items():
|
---|
| 292 | if (value == b):
|
---|
| 293 | oldtype = "signed %s" % name
|
---|
| 294 | typedefs.append({'oldtype' : oldtype, 'newtype' : newtype})
|
---|
| 295 | fnd = True
|
---|
| 296 | break
|
---|
| 297 |
|
---|
| 298 | if (not fnd):
|
---|
| 299 | print_error(['Unable to find appropriate integer type for %s' % newtype,
|
---|
| 300 | COMPILER_FAIL])
|
---|
| 301 |
|
---|
| 302 | return typedefs
|
---|
| 303 |
|
---|
| 304 | def create_makefile(mkname, common):
|
---|
| 305 | "Create makefile output"
|
---|
[177e4ea] | 306 |
|
---|
[4e9aaf5] | 307 | outmk = file(mkname, 'w')
|
---|
[177e4ea] | 308 |
|
---|
[4e9aaf5] | 309 | outmk.write('#########################################\n')
|
---|
| 310 | outmk.write('## AUTO-GENERATED FILE, DO NOT EDIT!!! ##\n')
|
---|
| 311 | outmk.write('#########################################\n\n')
|
---|
[177e4ea] | 312 |
|
---|
| 313 | for key, value in common.items():
|
---|
[4e9aaf5] | 314 | outmk.write('%s = %s\n' % (key, value))
|
---|
| 315 |
|
---|
| 316 | outmk.close()
|
---|
| 317 |
|
---|
| 318 | def create_header(hdname, typedefs):
|
---|
| 319 | "Create header output"
|
---|
| 320 |
|
---|
| 321 | outhd = file(hdname, 'w')
|
---|
| 322 |
|
---|
| 323 | outhd.write('/***************************************\n')
|
---|
| 324 | outhd.write(' * AUTO-GENERATED FILE, DO NOT EDIT!!! *\n')
|
---|
| 325 | outhd.write(' ***************************************/\n\n')
|
---|
[177e4ea] | 326 |
|
---|
[4e9aaf5] | 327 | outhd.write('#ifndef %s\n' % GUARD)
|
---|
| 328 | outhd.write('#define %s\n\n' % GUARD)
|
---|
| 329 |
|
---|
| 330 | for typedef in typedefs:
|
---|
| 331 | outhd.write('typedef %s %s;\n' % (typedef['oldtype'], typedef['newtype']))
|
---|
| 332 |
|
---|
| 333 | outhd.write('\n#endif\n')
|
---|
| 334 | outhd.close()
|
---|
[177e4ea] | 335 |
|
---|
| 336 | def main():
|
---|
| 337 | config = {}
|
---|
| 338 | common = {}
|
---|
| 339 |
|
---|
| 340 | # Read and check configuration
|
---|
[4e9aaf5] | 341 | if os.path.exists(CONFIG):
|
---|
| 342 | read_config(CONFIG, config)
|
---|
[177e4ea] | 343 | else:
|
---|
[4e9aaf5] | 344 | print_error(["Configuration file %s not found! Make sure that the" % CONFIG,
|
---|
[177e4ea] | 345 | "configuration phase of HelenOS build went OK. Try running",
|
---|
| 346 | "\"make config\" again."])
|
---|
| 347 |
|
---|
| 348 | check_config(config, "PLATFORM")
|
---|
| 349 | check_config(config, "COMPILER")
|
---|
| 350 | check_config(config, "BARCH")
|
---|
| 351 |
|
---|
| 352 | # Cross-compiler prefix
|
---|
| 353 | if ('CROSS_PREFIX' in os.environ):
|
---|
| 354 | cross_prefix = os.environ['CROSS_PREFIX']
|
---|
| 355 | else:
|
---|
| 356 | cross_prefix = "/usr/local"
|
---|
| 357 |
|
---|
| 358 | # Prefix binutils tools on Solaris
|
---|
| 359 | if (os.uname()[0] == "SunOS"):
|
---|
| 360 | binutils_prefix = "g"
|
---|
| 361 | else:
|
---|
| 362 | binutils_prefix = ""
|
---|
| 363 |
|
---|
[4e9aaf5] | 364 | owd = sandbox_enter()
|
---|
| 365 |
|
---|
| 366 | try:
|
---|
| 367 | # Common utilities
|
---|
| 368 | check_app(["ln", "--version"], "Symlink utility", "usually part of coreutils")
|
---|
| 369 | check_app(["rm", "--version"], "File remove utility", "usually part of coreutils")
|
---|
| 370 | check_app(["mkdir", "--version"], "Directory creation utility", "usually part of coreutils")
|
---|
| 371 | check_app(["cp", "--version"], "Copy utility", "usually part of coreutils")
|
---|
| 372 | check_app(["find", "--version"], "Find utility", "usually part of findutils")
|
---|
| 373 | check_app(["diff", "--version"], "Diff utility", "usually part of diffutils")
|
---|
| 374 | check_app(["make", "--version"], "Make utility", "preferably GNU Make")
|
---|
| 375 | check_app(["makedepend", "-f", "-"], "Makedepend utility", "usually part of imake or xutils")
|
---|
| 376 |
|
---|
| 377 | # Compiler
|
---|
| 378 | if (config['COMPILER'] == "gcc_cross"):
|
---|
| 379 | if (config['PLATFORM'] == "abs32le"):
|
---|
| 380 | check_config(config, "CROSS_TARGET")
|
---|
| 381 | target = config['CROSS_TARGET']
|
---|
| 382 |
|
---|
| 383 | if (config['CROSS_TARGET'] == "arm32"):
|
---|
| 384 | gnu_target = "arm-linux-gnu"
|
---|
| 385 |
|
---|
| 386 | if (config['CROSS_TARGET'] == "ia32"):
|
---|
| 387 | gnu_target = "i686-pc-linux-gnu"
|
---|
| 388 |
|
---|
| 389 | if (config['CROSS_TARGET'] == "mips32"):
|
---|
| 390 | gnu_target = "mipsel-linux-gnu"
|
---|
[177e4ea] | 391 |
|
---|
[4e9aaf5] | 392 | if (config['PLATFORM'] == "amd64"):
|
---|
| 393 | target = config['PLATFORM']
|
---|
| 394 | gnu_target = "amd64-linux-gnu"
|
---|
| 395 |
|
---|
| 396 | if (config['PLATFORM'] == "arm32"):
|
---|
| 397 | target = config['PLATFORM']
|
---|
[177e4ea] | 398 | gnu_target = "arm-linux-gnu"
|
---|
| 399 |
|
---|
[4e9aaf5] | 400 | if (config['PLATFORM'] == "ia32"):
|
---|
| 401 | target = config['PLATFORM']
|
---|
[177e4ea] | 402 | gnu_target = "i686-pc-linux-gnu"
|
---|
| 403 |
|
---|
[4e9aaf5] | 404 | if (config['PLATFORM'] == "ia64"):
|
---|
| 405 | target = config['PLATFORM']
|
---|
| 406 | gnu_target = "ia64-pc-linux-gnu"
|
---|
| 407 |
|
---|
| 408 | if (config['PLATFORM'] == "mips32"):
|
---|
| 409 | check_config(config, "MACHINE")
|
---|
| 410 |
|
---|
| 411 | if ((config['MACHINE'] == "lgxemul") or (config['MACHINE'] == "msim")):
|
---|
| 412 | target = config['PLATFORM']
|
---|
| 413 | gnu_target = "mipsel-linux-gnu"
|
---|
| 414 |
|
---|
| 415 | if (config['MACHINE'] == "bgxemul"):
|
---|
| 416 | target = "mips32eb"
|
---|
| 417 | gnu_target = "mips-linux-gnu"
|
---|
| 418 |
|
---|
| 419 | if (config['PLATFORM'] == "ppc32"):
|
---|
| 420 | target = config['PLATFORM']
|
---|
| 421 | gnu_target = "ppc-linux-gnu"
|
---|
| 422 |
|
---|
| 423 | if (config['PLATFORM'] == "sparc64"):
|
---|
| 424 | target = config['PLATFORM']
|
---|
| 425 | gnu_target = "sparc64-linux-gnu"
|
---|
| 426 |
|
---|
| 427 | path = "%s/%s/bin" % (cross_prefix, target)
|
---|
| 428 | prefix = "%s-" % gnu_target
|
---|
| 429 |
|
---|
| 430 | check_gcc(path, prefix, common, PACKAGE_CROSS)
|
---|
| 431 | check_binutils(path, prefix, common, PACKAGE_CROSS)
|
---|
| 432 |
|
---|
| 433 | check_common(common, "GCC")
|
---|
| 434 | common['CC'] = common['GCC']
|
---|
[177e4ea] | 435 |
|
---|
[4e9aaf5] | 436 | if (config['COMPILER'] == "gcc_native"):
|
---|
| 437 | check_gcc(None, "", common, PACKAGE_GCC)
|
---|
| 438 | check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
|
---|
| 439 |
|
---|
| 440 | check_common(common, "GCC")
|
---|
| 441 | common['CC'] = common['GCC']
|
---|
[177e4ea] | 442 |
|
---|
[4e9aaf5] | 443 | if (config['COMPILER'] == "icc"):
|
---|
| 444 | common['CC'] = "icc"
|
---|
| 445 | check_app([common['CC'], "-V"], "Intel C++ Compiler", "support is experimental")
|
---|
| 446 | check_gcc(None, "", common, PACKAGE_GCC)
|
---|
| 447 | check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
|
---|
[177e4ea] | 448 |
|
---|
[4e9aaf5] | 449 | if (config['COMPILER'] == "suncc"):
|
---|
| 450 | common['CC'] = "suncc"
|
---|
| 451 | check_app([common['CC'], "-V"], "Sun Studio Compiler", "support is experimental")
|
---|
| 452 | check_gcc(None, "", common, PACKAGE_GCC)
|
---|
| 453 | check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
|
---|
[177e4ea] | 454 |
|
---|
[4e9aaf5] | 455 | if (config['COMPILER'] == "clang"):
|
---|
| 456 | common['CC'] = "clang"
|
---|
| 457 | check_app([common['CC'], "--version"], "Clang compiler", "preferably version 1.0 or newer")
|
---|
| 458 | check_gcc(None, "", common, PACKAGE_GCC)
|
---|
| 459 | check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
|
---|
[177e4ea] | 460 |
|
---|
[4e9aaf5] | 461 | # Platform-specific utilities
|
---|
| 462 | if ((config['BARCH'] == "amd64") or (config['BARCH'] == "ia32") or (config['BARCH'] == "ppc32") or (config['BARCH'] == "sparc64")):
|
---|
| 463 | check_app(["mkisofs", "--version"], "ISO 9660 creation utility", "usually part of genisoimage")
|
---|
[177e4ea] | 464 |
|
---|
[4e9aaf5] | 465 | probe = probe_compiler(common,
|
---|
| 466 | [
|
---|
| 467 | "char",
|
---|
| 468 | "short int",
|
---|
| 469 | "int",
|
---|
| 470 | "long int",
|
---|
| 471 | "long long int",
|
---|
| 472 | ]
|
---|
| 473 | )
|
---|
[177e4ea] | 474 |
|
---|
[4e9aaf5] | 475 | typedefs = detect_uints(probe['unsigned_sizes'], probe['signed_sizes'], [1, 2, 4, 8])
|
---|
[177e4ea] | 476 |
|
---|
[4e9aaf5] | 477 | finally:
|
---|
| 478 | sandbox_leave(owd)
|
---|
| 479 |
|
---|
| 480 | create_makefile(MAKEFILE, common)
|
---|
| 481 | create_header(HEADER, typedefs)
|
---|
[177e4ea] | 482 |
|
---|
| 483 | return 0
|
---|
| 484 |
|
---|
| 485 | if __name__ == '__main__':
|
---|
| 486 | sys.exit(main())
|
---|