1#!/usr/bin/perl 2 3use strict; 4my $config_file = "$ENV{SCRIPT_OUTPUT_FILE_0}"; 5 6# Define the tests we need to run during this configuration 7my @config_tests = ( 8 { 9 NAME => "HAVE_64_BIT_MACH_EXCEPTIONS", 10 TEST => "-e '$ENV{SDKROOT}/usr/include/mach/mach_exc.defs'", 11 COMMENT => "// Defined if we can use 64 bit mach exceptions", 12 FAIL => "#undef HAVE_64_BIT_MACH_EXCEPTIONS\ 13#define mach_exception_data_t exception_data_t\ 14#define mach_exception_data_type_t exception_data_type_t\ 15#define mach_exc_server exc_server\ 16#define MACH_EXCEPTION_CODES 0\n", 17 SUCCESS => "#define HAVE_64_BIT_MACH_EXCEPTIONS 1\n", 18 } 19); 20 21#---------------------------------------------------------------------- 22# Open the config file 23#---------------------------------------------------------------------- 24open(CONFIG, "> $config_file") || die "Couldn't open '$config_file' for writing: $!\n"; 25print CONFIG "//" . "-" x 72 . "\n"; 26print CONFIG "// This file is auto generated by a dbgnub-config.pl, do not edit by hand!\n"; 27print CONFIG "//" . "-" x 72 . "\n"; 28print CONFIG "// COMMAND LINE\n"; 29print CONFIG "// " . join(' ', @ARGV) . "\n"; 30print CONFIG "//" . "-" x 72 . "\n"; 31print CONFIG "// ENVIRONMENT\n"; 32my $key; 33my $val; 34while (($key, $val) = each %ENV) 35{ 36 $val =~ s/\n/\n\/\/ /; 37 printf CONFIG "// %s = %s\n", $key, $val; 38} 39print CONFIG "//" . "-" x 72 . "\n"; 40print CONFIG "// SETTINGS\n"; 41print CONFIG "// config_file: '$config_file'\n"; 42print CONFIG "//" . "-" x 72 . "\n"; 43print CONFIG "\n\n"; 44print CONFIG "#ifndef __DBGNUB_CONFIG__\n"; 45print CONFIG "#define __DBGNUB_CONFIG__\n"; 46 47 48#---------------------------------------------------------------------- 49# Run the tests 50#---------------------------------------------------------------------- 51foreach my $test_href (@config_tests) 52{ 53 if (exists $test_href->{COMMENT}) { 54 print CONFIG "\n$test_href->{COMMENT}\n"; 55 } else { 56 print CONFIG "\n// $test_href->{NAME}\n"; 57 } 58 59 my $test_result = eval "$test_href->{TEST}"; 60 if ($test_result != 0) 61 { 62 print CONFIG "$test_href->{SUCCESS}\n"; 63 } 64 else 65 { 66 print CONFIG "$test_href->{FAIL}\n"; 67 } 68} 69 70print CONFIG "#endif // #ifndef __DBGNUB_CONFIG__\n"; 71close(CONFIG); 72 73