~ubuntu-branches/ubuntu/hardy/avidemux/hardy

« back to all changes in this revision

Viewing changes to admin/config.pl

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2006-12-15 17:13:20 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061215171320-w79pvpehxx2fr217
Tags: 1:2.3.0-0.0ubuntu1
* Merge from debian-multimedia.org, remaining Ubuntu change:
  - desktop file,
  - no support for ccache and make -j.
* Closes Ubuntu: #69614.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
 
1
#!/usr/bin/env perl
2
2
# a script for use by autoconf to make the Makefiles
3
3
# from the Makefile.in's
4
4
#
28
28
#   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
29
29
#   Boston, MA 02111-1307, USA.
30
30
 
 
31
use strict;
 
32
 
 
33
use File::Path;
 
34
 
31
35
my $ac_subs=$ARGV[0];
32
36
my $ac_sacfiles = $ARGV[1];
33
37
my $ac_given_srcdir=$ARGV[2];
34
38
my $ac_given_INSTALL=$ARGV[3];
35
39
 
 
40
my @comp_match;
 
41
my @comp_subs;
 
42
 
36
43
#print "ac_subs=$ac_subs\n";
37
44
#print "ac_sacfiles=$ac_sacfiles\n";
38
45
#print "ac_given_srcdir=$ac_given_srcdir\n";
39
46
#print "ac_given_INSTALL=$ac_given_INSTALL\n";
40
47
 
 
48
my $configure_input;
41
49
my ($srcdir, $top_srcdir);
42
50
my $INSTALL;
43
51
my $bad_perl = ($] < 5.005);
 
52
my $created_file_count = 0;
44
53
 
45
54
open(CF, "< $ac_subs") || die "can't open $ac_subs: $!";
46
55
my @subs = <CF>;
52
61
if ($bad_perl) {
53
62
    print "Using perl older than version 5.005\n";
54
63
    foreach my $pat (@subs) {
55
 
        if (  ($pat =~ /s%([^%]*)%([^%]*)%g/ )
56
 
           || ($pat =~ m%/([^/]*)/([^/]*)/g% )
57
 
           || ($pat =~ /s%([^%]*)%([^%]*)%;t/ )
58
 
           || ($pat =~ m%/([^/]*)/([^/]*)/;t% )
59
 
           || ($pat =~ /s,([^,]*),(.*),;t/)
 
64
        if (  ($pat =~ m/s%([^%]*)%([^%]*)%g/ )
 
65
           || ($pat =~ m/s%([^%]*)%([^%]*)%;t/ )
 
66
           || ($pat =~ m/s,([^,]*),(.*),;t/)
 
67
           || ($pat =~ m%s/([^/]*)/([^/]*)/g% )
 
68
           || ($pat =~ m%s/([^/]*)/([^/]*)/;t% )
60
69
           ) {
61
70
            # form : s%bla%blubb%g
62
71
            # or     s%bla%blubb%;t t   (autoconf > 2.13 and < 2.52 ?)
94
103
        push @comp_match, eval "qr/\Q$1\E/";
95
104
        push @comp_subs, "";
96
105
      } else {
97
 
          die "Uhh. Malformed pattern in $ac_cs_root.subs ($pat)"
 
106
          die "Uhh. Malformed pattern in $ac_subs ($pat)"
98
107
          unless ( $pat =~ /^\s*$/ );   # ignore white lines
99
108
      }
100
109
    }
130
139
    ($ac_dir = $ac_file) =~ s%/[^/][^/]*$%%;
131
140
    if ( ($ac_dir ne $ac_file) && ($ac_dir ne ".")) {
132
141
# The file is in a subdirectory.
133
 
        if (! -d "$ac_dir") { mkdir "$ac_dir", 0777; }
 
142
        if (! -d "$ac_dir") { mkpath "$ac_dir", 0, 0777; }
134
143
        ($ac_dir_suffix = $ac_dir) =~ s%^./%%;
135
144
        $ac_dir_suffix="/".$ac_dir_suffix;
136
145
# A "../" for each directory in $ac_dir_suffix.
166
175
    my $ac_comsub="";
167
176
    my $fname=$ac_file_in;
168
177
    $fname =~ s%.*/%%;
169
 
    my $configure_input="Generated automatically from $fname by config.pl.";
170
 
    if ($ac_file =~ /.*[Mm]akefile.*/) {
171
 
        $ac_comsub="# ".$configure_input."\n";  # for the first line in $ac_file
172
 
    }
 
178
    $configure_input="$ac_file.  Generated from $fname by config.pl.";
173
179
 
174
180
    my $ac_file_inputs;
175
181
    ($ac_file_inputs = $ac_file_in) =~ s%^%$ac_given_srcdir/%;
176
182
    $ac_file_inputs =~ s%:% $ac_given_srcdir/%g;
177
183
 
178
 
    patch_file($ac_file, $ac_file_inputs, $ac_comsub);
 
184
    patch_file($ac_file, $ac_file_inputs);
 
185
    ++$created_file_count;
179
186
}
180
187
 
 
188
print "config.pl: fast created $created_file_count file(s).\n";
 
189
 
181
190
sub patch_file {
182
 
    my ($outf, $infiles, $identline) = @_;
 
191
    my ($outf, $infiles) = @_;
183
192
    my $filedata;
184
193
    my @infiles=split(' ', $infiles);
185
194
    my $i=0;
194
203
            print STDERR "can't open $name: $!"."\n";
195
204
        }
196
205
    }
197
 
    if ($identline) {
198
 
        # Put the ident in the second line.  For shitty automake 1.6x.
199
 
        $filedata =~ s%\n%\n$identline%;
200
 
    }
201
206
 
202
207
    $filedata =~ s%\@configure_input\@%$configure_input%g;
203
208
    $filedata =~ s%\@srcdir\@%$srcdir%g;
223
228
 
224
229
sub make_closure {
225
230
    my ($pat, $sub) = @_;
226
 
    $pat =~ s/\@/\\@/g;   # @bla@ -> \@bla\@
227
 
    $pat =~ s/\$/\\\$/g;  # $bla -> \$bla
228
 
    $sub =~ s/\@/\\@/g;
229
 
    $sub =~ s/\$/\\\$/g;
230
 
    my $ret = eval "return sub { my \$ref=shift; \$\$ref =~ s%$pat%$sub%g; }";
 
231
    my $ret = eval "return sub { my \$ref=shift; \$\$ref =~ s%\Q$pat\E%\Q$sub\E%g; }";
231
232
    if ($@) {
232
233
        print "can't create CODE: $@\n";
233
234
    }