3
# this script patches a config.status file, to use our own perl script
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>
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.
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.
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.
25
# we have to change two places
26
# 1. the splitting of the substitutions into chunks of 90 (or even 48 in
28
# 2. the big main loop which patches all Makefile.in's
32
my $ac_aux_dir = dirname($0);
34
local $ac_version = 0;
39
# usage of $flag: 0 -- we have seen nothing yet
41
# 2 -- we have ended (1)
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]+)/ ) {
55
# lets hope its different with 2141,
56
# wasn't able to verify that
63
} elsif ($1 eq 'cmds') {
66
# hmm, we don't know the autoconf version, but we try anyway
70
} elsif ($flag == 1) {
71
if (/^\s*CONFIG_FILES=/ && ($ac_version != 250)) {
74
} elsif (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) {
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/ ) {
86
} elsif ($flag == 3) {
87
if (/^\s*rm\s+-f\s+conftest/ ) {
90
} elsif (/^\s*rm\s+-f\s+.*ac_cs_root/ ) {
94
if ($ac_version != 2141) {
95
print STDERR "hmm, don't know autoconf version\n";
97
} elsif (/^\#\s*CONFIG_HEADER section.*/) {
100
if($ac_version != 250) {
101
print STDERR "hmm, something went wrong :-(\n";
109
die "wrong input (flag != 4)" unless $flag == 4;
110
print STDERR "hmm, don't know autoconf version\n" unless $ac_version;
112
sub insert_main_loop {
114
if ($ac_version == 250) {
115
&insert_main_loop_250();
118
&insert_main_loop_213();
122
sub insert_main_loop_250 {
125
#echo Doing the fast build of Makefiles -- autoconf $ac_version
129
# VPATH subst was seen in original config.status main loop
130
echo '/^[ ]*VPATH[ ]*=[^:]*\$/d' >>\$tmp/subs.sed
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
140
if test -f \$tmp/subs.files ; then
141
perl $ac_aux_dir/config.pl "\$tmp/subs.sed" "\$tmp/subs.files" "\$srcdir" "\$INSTALL"
143
rm -f \$tmp/subs.files
150
sub insert_main_loop_213 {
152
#echo Doing the fast build of Makefiles -- autoconf $ac_version
153
if test "x\$ac_cs_root" = "x" ; then
159
# VPATH subst was seen in original config.status main loop
160
echo '/^[ ]*VPATH[ ]*=[^:]*\$/d' >> \$ac_cs_root.subs
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
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"
173
rm -f \$ac_cs_root.s*