| 1 |
package autoconf; |
| 2 |
|
| 3 |
# I plan to improve this and make it a standalone ExtUtils::Autoconf module, |
| 4 |
# but right now it just runs an external configure script. |
| 5 |
|
| 6 |
use Config; |
| 7 |
|
| 8 |
sub run_script(;$$) { |
| 9 |
my ($wd, $file) = @_; |
| 10 |
$wd ||= "autoconf"; |
| 11 |
$script ||= "./configure"; |
| 12 |
|
| 13 |
local %ENV = %ENV; |
| 14 |
|
| 15 |
while (my ($k, $v) = each %Config) { |
| 16 |
$ENV{$k} = $v; |
| 17 |
} |
| 18 |
|
| 19 |
$ENV{MAKE} = $Config{make}; |
| 20 |
$ENV{SHELL} = $Config{sh}; |
| 21 |
$ENV{CC} = $Config{cc}; |
| 22 |
$ENV{CPPFLAGS} = $Config{cppflags}; |
| 23 |
$ENV{CFLAGS} = $Config{ccflags}; |
| 24 |
$ENV{LDFLAGS} = $Config{ldflags}; |
| 25 |
$ENV{LIBS} = ""; |
| 26 |
$ENV{LINKER} = $Config{ld}; # nonstandard |
| 27 |
|
| 28 |
my $status = system $ENV{SHELL}, -c => "cd \Q$wd\E && \Q$script\E --prefix \Q$Config{prefixexp}\E"; |
| 29 |
|
| 30 |
$status |
| 31 |
} |
| 32 |
|
| 33 |
1 |