File: dbgnub-config.pl

package info (click to toggle)
llvm-toolchain-3.5 1%3A3.5-10
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 282,028 kB
  • ctags: 310,872
  • sloc: cpp: 1,883,926; ansic: 310,731; objc: 86,612; python: 79,565; asm: 65,844; sh: 9,829; makefile: 6,057; perl: 5,589; ml: 5,254; pascal: 3,285; lisp: 1,640; xml: 686; cs: 239; csh: 117
file content (72 lines) | stat: -rw-r--r-- 2,163 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/perl

use strict;
my $config_file = "$ENV{SCRIPT_OUTPUT_FILE_0}";

# Define the tests we need to run during this configuration
my @config_tests = (
	{
		NAME => "HAVE_64_BIT_MACH_EXCEPTIONS",
		TEST => "-e '$ENV{SDKROOT}/usr/include/mach/mach_exc.defs'",
		COMMENT => "// Defined if we can use 64 bit mach exceptions",
		FAIL => "#undef HAVE_64_BIT_MACH_EXCEPTIONS\
#define mach_exception_data_t exception_data_t\
#define mach_exception_data_type_t exception_data_type_t\
#define mach_exc_server exc_server\
#define MACH_EXCEPTION_CODES 0\n",
		SUCCESS => "#define HAVE_64_BIT_MACH_EXCEPTIONS 1\n",
	}
);

#----------------------------------------------------------------------
# Open the config file
#----------------------------------------------------------------------
open(CONFIG, "> $config_file") || die "Couldn't open '$config_file' for writing: $!\n";
print CONFIG "//" . "-" x 72 . "\n";
print CONFIG "// This file is auto generated by a dbgnub-config.pl, do not edit by hand!\n";
print CONFIG "//" . "-" x 72 . "\n";
print CONFIG "// COMMAND LINE\n";
print CONFIG "//	" . join(' ', @ARGV) . "\n";
print CONFIG "//" . "-" x 72 . "\n";
print CONFIG "// ENVIRONMENT\n";
my $key;
my $val;
while (($key, $val) = each %ENV) 
{
	$val =~ s/\n/\n\/\/	/g;
	printf CONFIG "//	%s = %s\n", $key, $val;
}
print CONFIG "//" . "-" x 72 . "\n";
print CONFIG "// SETTINGS\n";
print CONFIG "//	config_file: '$config_file'\n";
print CONFIG "//" . "-" x 72 . "\n";
print CONFIG "\n\n";
print CONFIG "#ifndef __DBGNUB_CONFIG__\n";
print CONFIG "#define __DBGNUB_CONFIG__\n";


#----------------------------------------------------------------------
# Run the tests
#----------------------------------------------------------------------
foreach my $test_href (@config_tests)
{
	if (exists $test_href->{COMMENT}) {
		print CONFIG "\n$test_href->{COMMENT}\n";
	} else {
		print CONFIG "\n// $test_href->{NAME}\n";
	}
	
	my $test_result = eval "$test_href->{TEST}";
	if ($test_result != 0)
	{
		print CONFIG "$test_href->{SUCCESS}\n";		
	}
	else
	{
		print CONFIG "$test_href->{FAIL}\n";		
	}
}

print CONFIG "#endif // #ifndef __DBGNUB_CONFIG__\n";
close(CONFIG);