Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 49 lines (38 sloc) 1.08 KB
#!/usr/bin/perl -w
use strict;
my ${prefix} = "@prefix@";
my ${exec_prefix} = "@exec_prefix@";
my ${datarootdir} = "@datarootdir@";
while (my $f = shift @ARGV) {
my $TEMP = '';
if (-x "/bin/mktemp") {
$TEMP = `/bin/mktemp $f.$$.XXXXXX`;
die "Cannot make temporary file $TEMP" if($?);
chomp $TEMP;
} else {
my $XXXXXX = rand;
$TEMP = "$f.$$.$XXXXXX";
}
open IN, "<$f" || die "Cannot open $f for reading";
open OUT, ">$TEMP" || die "Cannot make temporary file $TEMP";
while (<IN>) {
s|\@libexecdir\@|@libexecdir@|g; # put all --with-vars before directories
s|\@localstatedir\@|@localstatedir@|g;
s|\@sysconfdir\@|@sysconfdir@|g;
s|\@datarootdir\@|@datarootdir@|g;
s|\@datadir\@|@datadir@|g;
s|\@sbindir\@|@sbindir@|g;
s|\@bindir\@|@bindir@|g;
s|define PACKAGE|define NETMRG_PACKAGE|; # work around autoconf stupidity
s|\$\{exec_prefix\}|@exec_prefix@|g; # must be next to last
s|\$\{prefix\}|@prefix@|g; # must be last
print OUT $_;
}
close OUT;
close IN;
if ((! -e $f) || (`diff $f $TEMP`)) {
rename $TEMP, $f;
} else {
unlink $TEMP;
}
}