Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 598 → Rev 599

/branches/Version13x/Scribus/admin/config.pl
1,4 → 1,4
#!/usr/bin/perl
#!/usr/bin/env perl
# a script for use by autoconf to make the Makefiles
# from the Makefile.in's
#
28,19 → 28,28
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
 
use strict;
 
use File::Path;
 
my $ac_subs=$ARGV[0];
my $ac_sacfiles = $ARGV[1];
my $ac_given_srcdir=$ARGV[2];
my $ac_given_INSTALL=$ARGV[3];
 
my @comp_match;
my @comp_subs;
 
#print "ac_subs=$ac_subs\n";
#print "ac_sacfiles=$ac_sacfiles\n";
#print "ac_given_srcdir=$ac_given_srcdir\n";
#print "ac_given_INSTALL=$ac_given_INSTALL\n";
 
my $configure_input;
my ($srcdir, $top_srcdir);
my $INSTALL;
my $bad_perl = ($] < 5.005);
my $created_file_count = 0;
 
open(CF, "< $ac_subs") || die "can't open $ac_subs: $!";
my @subs = <CF>;
52,11 → 61,11
if ($bad_perl) {
print "Using perl older than version 5.005\n";
foreach my $pat (@subs) {
if ( ($pat =~ /s%([^%]*)%([^%]*)%g/ )
|| ($pat =~ m%/([^/]*)/([^/]*)/g% )
|| ($pat =~ /s%([^%]*)%([^%]*)%;t/ )
|| ($pat =~ m%/([^/]*)/([^/]*)/;t% )
|| ($pat =~ /s,([^,]*),(.*),;t/)
if ( ($pat =~ m/s%([^%]*)%([^%]*)%g/ )
|| ($pat =~ m/s%([^%]*)%([^%]*)%;t/ )
|| ($pat =~ m/s,([^,]*),(.*),;t/)
|| ($pat =~ m%s/([^/]*)/([^/]*)/g% )
|| ($pat =~ m%s/([^/]*)/([^/]*)/;t% )
) {
# form : s%bla%blubb%g
# or s%bla%blubb%;t t (autoconf > 2.13 and < 2.52 ?)
94,7 → 103,7
push @comp_match, eval "qr/\Q$1\E/";
push @comp_subs, "";
} else {
die "Uhh. Malformed pattern in $ac_cs_root.subs ($pat)"
die "Uhh. Malformed pattern in $ac_subs ($pat)"
unless ( $pat =~ /^\s*$/ ); # ignore white lines
}
}
130,7 → 139,7
($ac_dir = $ac_file) =~ s%/[^/][^/]*$%%;
if ( ($ac_dir ne $ac_file) && ($ac_dir ne ".")) {
# The file is in a subdirectory.
if (! -d "$ac_dir") { mkdir "$ac_dir", 0777; }
if (! -d "$ac_dir") { mkpath "$ac_dir", 0, 0777; }
($ac_dir_suffix = $ac_dir) =~ s%^./%%;
$ac_dir_suffix="/".$ac_dir_suffix;
# A "../" for each directory in $ac_dir_suffix.
166,27 → 175,24
my $ac_comsub="";
my $fname=$ac_file_in;
$fname =~ s%.*/%%;
my $configure_input="Generated automatically from $fname by config.pl.";
if ($ac_file =~ /.*[Mm]akefile.*/) {
$ac_comsub="# ".$configure_input."\n"; # for the first line in $ac_file
}
$configure_input="$ac_file. Generated from $fname by config.pl.";
 
my $ac_file_inputs;
($ac_file_inputs = $ac_file_in) =~ s%^%$ac_given_srcdir/%;
$ac_file_inputs =~ s%:% $ac_given_srcdir/%g;
 
patch_file($ac_file, $ac_file_inputs, $ac_comsub);
patch_file($ac_file, $ac_file_inputs);
++$created_file_count;
}
 
print "config.pl: fast created $created_file_count file(s).\n";
 
sub patch_file {
my ($outf, $infiles, $firstline) = @_;
my ($outf, $infiles) = @_;
my $filedata;
my @infiles=split(' ', $infiles);
my $i=0;
 
if ($firstline) {
$filedata = $firstline;
}
foreach my $name (@infiles) {
if (open(CF, "< $name")) {
while (<CF>) {
222,11 → 228,7
 
sub make_closure {
my ($pat, $sub) = @_;
$pat =~ s/\@/\\@/g; # @bla@ -> \@bla\@
$pat =~ s/\$/\\\$/g; # $bla -> \$bla
$sub =~ s/\@/\\@/g;
$sub =~ s/\$/\\\$/g;
my $ret = eval "return sub { my \$ref=shift; \$\$ref =~ s%$pat%$sub%g; }";
my $ret = eval "return sub { my \$ref=shift; \$\$ref =~ s%\Q$pat\E%\Q$sub\E%g; }";
if ($@) {
print "can't create CODE: $@\n";
}