From: Martin Mares Date: Thu, 22 Jul 2010 13:39:44 +0000 (+0200) Subject: Configure: Improved TestCompile, so that the temporary files can be kept X-Git-Tag: v5.0~152 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=dbc26858f166d07fa895901d4ffe5121826c84ad;p=libucw.git Configure: Improved TestCompile, so that the temporary files can be kept --- diff --git a/ucw/perl/UCW/Configure/C.pm b/ucw/perl/UCW/Configure/C.pm index 5346fb1a..c0d6b8c7 100644 --- a/ucw/perl/UCW/Configure/C.pm +++ b/ucw/perl/UCW/Configure/C.pm @@ -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 ### diff --git a/ucw/perl/UCW/Configure/LibUCW.pm b/ucw/perl/UCW/Configure/LibUCW.pm index bd2ef5d1..5969e383 100644 --- a/ucw/perl/UCW/Configure/LibUCW.pm +++ b/ucw/perl/UCW/Configure/LibUCW.pm @@ -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;