From dbc26858f166d07fa895901d4ffe5121826c84ad Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Thu, 22 Jul 2010 15:39:44 +0200 Subject: [PATCH] Configure: Improved TestCompile, so that the temporary files can be kept --- ucw/perl/UCW/Configure/C.pm | 10 +++++++--- ucw/perl/UCW/Configure/LibUCW.pm | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) 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; -- 2.39.5