~ubuntu-branches/ubuntu/raring/qgo/raring

« back to all changes in this revision

Viewing changes to admin/conf.change.pl

  • Committer: Bazaar Package Importer
  • Author(s): Martin A. Godisch
  • Date: 2005-01-01 23:07:10 UTC
  • Revision ID: james.westby@ubuntu.com-20050101230710-fhng6yidm47xlb2i
Tags: upstream-1.0.0-r2
ImportĀ upstreamĀ versionĀ 1.0.0-r2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
 
 
3
# this script patches a config.status file, to use our own perl script
 
4
# in the main loop
 
5
# we do it this way to circumvent hacking (and thereby including)
 
6
# autoconf function (which are GPL) into our LGPL acinclude.m4.in
 
7
# written by Michael Matz <matz@kde.org>
 
8
# adapted by Dirk Mueller <mueller@kde.org>
 
9
#
 
10
#   This file is free software; you can redistribute it and/or
 
11
#   modify it under the terms of the GNU Library General Public
 
12
#   License as published by the Free Software Foundation; either
 
13
#   version 2 of the License, or (at your option) any later version.
 
14
 
 
15
#   This library is distributed in the hope that it will be useful,
 
16
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
18
#   Library General Public License for more details.
 
19
 
 
20
#   You should have received a copy of the GNU Library General Public License
 
21
#   along with this library; see the file COPYING.LIB.  If not, write to
 
22
#   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
23
#   Boston, MA 02111-1307, USA.
 
24
 
 
25
# we have to change two places
 
26
# 1. the splitting of the substitutions into chunks of 90 (or even 48 in
 
27
#    later autoconf's
 
28
# 2. the big main loop which patches all Makefile.in's
 
29
 
 
30
use File::Basename;
 
31
 
 
32
my $ac_aux_dir = dirname($0);
 
33
my ($flag);
 
34
local $ac_version = 0;
 
35
my $vpath_seen = 0;
 
36
$flag = 0;
 
37
 
 
38
while (<>) {
 
39
# usage of $flag: 0 -- we have seen nothing yet
 
40
#   1 -- we are in (1)
 
41
#   2 -- we have ended (1)
 
42
#   3 -- we are in (2)
 
43
#   4 -- we ended (2)
 
44
 
 
45
    if ($flag == 4) {
 
46
        print;
 
47
    } elsif ($flag == 0) {
 
48
# 1. begins with (including): "ac_max_sed_\S+\s*=\s*[0-9]+..."
 
49
#    ends with (excluding) "CONFIG_FILE=..."
 
50
#    in later autoconf (2.14.1) there is no CONFIG_FILES= line,
 
51
#    but instead the (2) directly follow (1)
 
52
        if (/^\s*ac_max_sed_([a-z]+).*=\s*([0-9]+)/ ) {
 
53
            $flag = 1;
 
54
            if ($1 eq 'lines') {
 
55
                # lets hope its different with 2141, 
 
56
                # wasn't able to verify that
 
57
              if ($2 eq '48') {
 
58
                $ac_version = 250;
 
59
              }
 
60
              else {
 
61
                $ac_version = 2141;
 
62
              }
 
63
            } elsif ($1 eq 'cmds') {
 
64
                $ac_version = 213;
 
65
            }
 
66
            # hmm, we don't know the autoconf version, but we try anyway
 
67
        } else {
 
68
            print;
 
69
        }
 
70
    } elsif ($flag == 1) {
 
71
        if (/^\s*CONFIG_FILES=/ && ($ac_version != 250)) {
 
72
             print;
 
73
             $flag = 2;
 
74
        } elsif (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) {
 
75
             $flag = 3;
 
76
        }
 
77
    } elsif ($flag == 2) {
 
78
# 2. begins with: "for ac_file in.*CONFIG_FILES"  (the next 'for' after (1))
 
79
#    end with: "rm -f conftest.s\*"
 
80
# on autoconf 250, it ends with '# CONFIG_HEADER section'
 
81
        if (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) {
 
82
            $flag = 3;
 
83
        } else {
 
84
            print;
 
85
        }
 
86
    } elsif ($flag == 3) {
 
87
        if (/^\s*rm\s+-f\s+conftest/ ) {
 
88
            $flag = 4;
 
89
            &insert_main_loop();
 
90
        } elsif (/^\s*rm\s+-f\s+.*ac_cs_root/ ) {
 
91
            $flag = 4;
 
92
            &insert_main_loop();
 
93
            #die "hhhhhhh";
 
94
            if ($ac_version != 2141) {
 
95
                print STDERR "hmm, don't know autoconf version\n";
 
96
            }
 
97
        } elsif (/^\#\s*CONFIG_HEADER section.*/) {
 
98
          $flag = 4;
 
99
          &insert_main_loop();
 
100
          if($ac_version != 250) {
 
101
            print STDERR "hmm, something went wrong :-(\n";
 
102
          }
 
103
        } elsif (/VPATH/ ) {
 
104
            $vpath_seen = 1;
 
105
        }
 
106
    }
 
107
}
 
108
 
 
109
die "wrong input (flag != 4)" unless $flag == 4;
 
110
print STDERR "hmm, don't know autoconf version\n" unless $ac_version;
 
111
 
 
112
sub insert_main_loop {
 
113
 
 
114
  if ($ac_version == 250) {
 
115
    &insert_main_loop_250();
 
116
  }
 
117
  else {
 
118
    &insert_main_loop_213();
 
119
  }
 
120
}
 
121
 
 
122
sub insert_main_loop_250 {
 
123
 
 
124
  print <<EOF;
 
125
  #echo Doing the fast build of Makefiles -- autoconf $ac_version
 
126
EOF
 
127
    if ($vpath_seen) {
 
128
        print <<EOF;
 
129
        # VPATH subst was seen in original config.status main loop
 
130
  echo '/^[     ]*VPATH[        ]*=[^:]*\$/d' >>\$tmp/subs.sed
 
131
EOF
 
132
      }
 
133
  print <<EOF;
 
134
  rm -f \$tmp/subs.files
 
135
  for ac_file in .. \$CONFIG_FILES ; do
 
136
      if test "x\$ac_file" != x..; then
 
137
          echo \$ac_file >> \$tmp/subs.files
 
138
      fi
 
139
  done
 
140
  if test -f \$tmp/subs.files ; then
 
141
      perl $ac_aux_dir/config.pl "\$tmp/subs.sed" "\$tmp/subs.files" "\$srcdir" "\$INSTALL"
 
142
  fi
 
143
  rm -f \$tmp/subs.files
 
144
 
 
145
fi
 
146
EOF
 
147
  return;
 
148
}
 
149
 
 
150
sub insert_main_loop_213 {
 
151
    print <<EOF;
 
152
#echo Doing the fast build of Makefiles -- autoconf $ac_version
 
153
if test "x\$ac_cs_root" = "x" ; then
 
154
    ac_cs_root=conftest
 
155
fi
 
156
EOF
 
157
    if ($vpath_seen) {
 
158
      print <<EOF;
 
159
# VPATH subst was seen in original config.status main loop
 
160
echo '/^[       ]*VPATH[        ]*=[^:]*\$/d' >> \$ac_cs_root.subs
 
161
EOF
 
162
    }
 
163
    print <<EOF;
 
164
rm -f \$ac_cs_root.sacfiles
 
165
for ac_file in .. \$CONFIG_FILES ; do
 
166
    if test "x\$ac_file" != x..; then
 
167
        echo \$ac_file >> \$ac_cs_root.sacfiles
 
168
    fi
 
169
done
 
170
if test -f \$ac_cs_root.sacfiles ; then
 
171
    perl $ac_aux_dir/config.pl "\$ac_cs_root.subs" "\$ac_cs_root.sacfiles" "\$ac_given_srcdir" "\$ac_given_INSTALL"
 
172
fi
 
173
rm -f \$ac_cs_root.s*
 
174
 
 
175
EOF
 
176
    return;
 
177
}