File: autoconf.pm

package info (click to toggle)
libio-aio-perl 2.4-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 356 kB
  • ctags: 76
  • sloc: perl: 413; ansic: 97; makefile: 50
file content (33 lines) | stat: -rw-r--r-- 790 bytes parent folder | download
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
package autoconf;

# I plan to improve this and make it a standalone ExtUtils::Autoconf module,
# but right now it just runs an external configure script.

use Config;

sub run_script(;$$) {
    my ($wd, $file) = @_;
    $wd     ||= "autoconf";
    $script ||= "./configure";

    local %ENV = %ENV;

    while (my ($k, $v) = each %Config) {
        $ENV{$k} = $v;
    }

    $ENV{MAKE}     = $Config{make};
    $ENV{SHELL}    = $Config{sh};
    $ENV{CC}       = $Config{cc};
    $ENV{CPPFLAGS} = $Config{cppflags};
    $ENV{CFLAGS}   = $Config{ccflags};
    $ENV{LDFLAGS}  = $Config{ldflags};
    $ENV{LIBS}     = "";
    $ENV{LINKER}   = $Config{ld}; # nonstandard

    my $status = system $ENV{SHELL}, -c => "cd \Q$wd\E && \Q$script\E --prefix \Q$Config{prefixexp}\E";

    $status
}

1