]> mj.ucw.cz Git - libucw.git/commitdiff
Configure: Improved TestCompile, so that the temporary files can be kept
authorMartin Mares <mj@ucw.cz>
Thu, 22 Jul 2010 13:39:44 +0000 (15:39 +0200)
committerMartin Mares <mj@ucw.cz>
Thu, 22 Jul 2010 13:39:44 +0000 (15:39 +0200)
ucw/perl/UCW/Configure/C.pm
ucw/perl/UCW/Configure/LibUCW.pm

index 5346fb1a3a5f4a46a8deb32192ccb82841faf546..c0d6b8c714ea3fff83e4b46059efb473f40ec2a2 100644 (file)
@@ -269,9 +269,9 @@ if (IsSet("CONFIG_DARWIN")) {
 
 ### Compiling test programs ###
 
-sub TestCompile($) {
-       my ($source) = @_;
-       my $dir = 'conftest';
+sub TestCompile($$) {
+       my ($testname, $source) = @_;
+       my $dir = "conftest-$testname";
        `rm -rf $dir && mkdir $dir`; $? and Fail "Cannot initialize $dir";
 
        open SRC, ">$dir/conftest.c";
@@ -287,6 +287,10 @@ sub TestCompile($) {
                );
        `$cmd`;
        my $result = !$?;
+
+       `rm -rf $dir` unless Get("KEEP_CONFTEST");
+
+       return $result;
 }
 
 ### Writing C headers with configuration ###
index bd2ef5d12ee73de89d2ae4def278816235d16c0d..5969e383fee6b52fcaaa4ede1eb99d55de2e2437 100644 (file)
@@ -46,7 +46,7 @@ if (Get("CPU_ARCH") eq "default" || Get("CPU_ARCH") =~ /^i[345]86$/) {
 # Detect if thread-local storage is supported
 if (Get("CONFIG_UCW_THREADS")) {
        TestBool("CONFIG_UCW_TLS", "Checking if GCC supports thread-local storage", sub {
-               if (UCW::Configure::C::TestCompile("__thread int i;\nint main(void) { return 0; }\n")) {
+               if (UCW::Configure::C::TestCompile("__thread", "__thread int i;\nint main(void) { return 0; }\n")) {
                        return 1;
                } else {
                        return 0;