(ext, build_dir)
| 438 | cocache = CallOnceOnly() |
| 439 | |
| 440 | def generate_config_h(ext, build_dir): |
| 441 | target = join(build_dir, header_dir, 'config.h') |
| 442 | d = os.path.dirname(target) |
| 443 | if not os.path.exists(d): |
| 444 | os.makedirs(d) |
| 445 | |
| 446 | if newer(__file__, target): |
| 447 | config_cmd = config.get_config_cmd() |
| 448 | log.info('Generating %s', target) |
| 449 | |
| 450 | # Check sizeof |
| 451 | moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir) |
| 452 | |
| 453 | # Check math library and C99 math funcs availability |
| 454 | mathlibs = check_mathlib(config_cmd) |
| 455 | moredefs.append(('MATHLIB', ','.join(mathlibs))) |
| 456 | |
| 457 | check_math_capabilities(config_cmd, ext, moredefs, mathlibs) |
| 458 | moredefs.extend(cocache.check_complex(config_cmd, mathlibs)[0]) |
| 459 | |
| 460 | # Signal check |
| 461 | if is_npy_no_signal(): |
| 462 | moredefs.append('NPY_NO_SIGNAL') |
| 463 | |
| 464 | # Windows checks |
| 465 | if sys.platform == 'win32' or os.name == 'nt': |
| 466 | win32_checks(moredefs) |
| 467 | |
| 468 | # C99 restrict keyword |
| 469 | moredefs.append(('NPY_RESTRICT', config_cmd.check_restrict())) |
| 470 | |
| 471 | # Inline check |
| 472 | inline = config_cmd.check_inline() |
| 473 | |
| 474 | if can_link_svml(): |
| 475 | moredefs.append(('NPY_CAN_LINK_SVML', 1)) |
| 476 | |
| 477 | # Use bogus stride debug aid to flush out bugs where users use |
| 478 | # strides of dimensions with length 1 to index a full contiguous |
| 479 | # array. |
| 480 | if NPY_RELAXED_STRIDES_DEBUG: |
| 481 | moredefs.append(('NPY_RELAXED_STRIDES_DEBUG', 1)) |
| 482 | else: |
| 483 | moredefs.append(('NPY_RELAXED_STRIDES_DEBUG', 0)) |
| 484 | |
| 485 | # Get long double representation |
| 486 | rep = check_long_double_representation(config_cmd) |
| 487 | moredefs.append(('HAVE_LDOUBLE_%s' % rep, 1)) |
| 488 | |
| 489 | if check_for_right_shift_internal_compiler_error(config_cmd): |
| 490 | moredefs.append('NPY_DO_NOT_OPTIMIZE_LONG_right_shift') |
| 491 | moredefs.append('NPY_DO_NOT_OPTIMIZE_ULONG_right_shift') |
| 492 | moredefs.append('NPY_DO_NOT_OPTIMIZE_LONGLONG_right_shift') |
| 493 | moredefs.append('NPY_DO_NOT_OPTIMIZE_ULONGLONG_right_shift') |
| 494 | |
| 495 | # Generate the config.h file from moredefs |
| 496 | with open(target, 'w') as target_f: |
| 497 | if sys.platform == 'darwin': |
nothing calls this directly
no test coverage detected