|
Packit Bot |
06c835 |
#!/usr/bin/perl -w
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
# this script patches a config.status file, to use our own perl script
|
|
Packit Bot |
06c835 |
# in the main loop
|
|
Packit Bot |
06c835 |
# we do it this way to circumvent hacking (and thereby including)
|
|
Packit Bot |
06c835 |
# autoconf function (which are GPL) into our LGPL acinclude.m4.in
|
|
Packit Bot |
06c835 |
# written by Michael Matz <matz@kde.org>
|
|
Packit Bot |
06c835 |
# adapted by Dirk Mueller <mueller@kde.org>
|
|
Packit Bot |
06c835 |
#
|
|
Packit Bot |
06c835 |
# This file is free software; you can redistribute it and/or
|
|
Packit Bot |
06c835 |
# modify it under the terms of the GNU Library General Public
|
|
Packit Bot |
06c835 |
# License as published by the Free Software Foundation; either
|
|
Packit Bot |
06c835 |
# version 2 of the License, or (at your option) any later version.
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
# This library is distributed in the hope that it will be useful,
|
|
Packit Bot |
06c835 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Bot |
06c835 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Bot |
06c835 |
# Library General Public License for more details.
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
# You should have received a copy of the GNU Library General Public License
|
|
Packit Bot |
06c835 |
# along with this library; see the file COPYING.LIB. If not, write to
|
|
Packit Bot |
06c835 |
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Packit Bot |
06c835 |
# Boston, MA 02111-1307, USA.
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
# we have to change two places
|
|
Packit Bot |
06c835 |
# 1. the splitting of the substitutions into chunks of 90 (or even 48 in
|
|
Packit Bot |
06c835 |
# later autoconf's
|
|
Packit Bot |
06c835 |
# 2. the big main loop which patches all Makefile.in's
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
use File::Basename;
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
my $ac_aux_dir = dirname($0);
|
|
Packit Bot |
06c835 |
my ($flag);
|
|
Packit Bot |
06c835 |
local $ac_version = 0;
|
|
Packit Bot |
06c835 |
my $vpath_seen = 0;
|
|
Packit Bot |
06c835 |
$flag = 0;
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
while (<>) {
|
|
Packit Bot |
06c835 |
# usage of $flag: 0 -- we have seen nothing yet
|
|
Packit Bot |
06c835 |
# 1 -- we are in (1)
|
|
Packit Bot |
06c835 |
# 2 -- we have ended (1)
|
|
Packit Bot |
06c835 |
# 3 -- we are in (2)
|
|
Packit Bot |
06c835 |
# 4 -- we ended (2)
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
if ($flag == 4) {
|
|
Packit Bot |
06c835 |
print;
|
|
Packit Bot |
06c835 |
} elsif ($flag == 0) {
|
|
Packit Bot |
06c835 |
# 1. begins with (including): "ac_max_sed_\S+\s*=\s*[0-9]+..."
|
|
Packit Bot |
06c835 |
# ends with (excluding) "CONFIG_FILE=..."
|
|
Packit Bot |
06c835 |
# in later autoconf (2.14.1) there is no CONFIG_FILES= line,
|
|
Packit Bot |
06c835 |
# but instead the (2) directly follow (1)
|
|
Packit Bot |
06c835 |
if (/^\s*ac_max_sed_([a-z]+).*=\s*([0-9]+)/ ) {
|
|
Packit Bot |
06c835 |
$flag = 1;
|
|
Packit Bot |
06c835 |
if ($1 eq 'lines') {
|
|
Packit Bot |
06c835 |
# lets hope its different with 2141,
|
|
Packit Bot |
06c835 |
# wasn't able to verify that
|
|
Packit Bot |
06c835 |
if ($2 eq '48') {
|
|
Packit Bot |
06c835 |
$ac_version = 250;
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
else {
|
|
Packit Bot |
06c835 |
$ac_version = 2141;
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
} elsif ($1 eq 'cmds') {
|
|
Packit Bot |
06c835 |
$ac_version = 213;
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
# hmm, we don't know the autoconf version, but we try anyway
|
|
Packit Bot |
06c835 |
} else {
|
|
Packit Bot |
06c835 |
print;
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
} elsif ($flag == 1) {
|
|
Packit Bot |
06c835 |
if (/^\s*CONFIG_FILES=/ && ($ac_version != 250)) {
|
|
Packit Bot |
06c835 |
print;
|
|
Packit Bot |
06c835 |
$flag = 2;
|
|
Packit Bot |
06c835 |
} elsif (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) {
|
|
Packit Bot |
06c835 |
$flag = 3;
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
} elsif ($flag == 2) {
|
|
Packit Bot |
06c835 |
# 2. begins with: "for ac_file in.*CONFIG_FILES" (the next 'for' after (1))
|
|
Packit Bot |
06c835 |
# end with: "rm -f conftest.s\*"
|
|
Packit Bot |
06c835 |
# on autoconf 250, it ends with '# CONFIG_HEADER section'
|
|
Packit Bot |
06c835 |
if (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) {
|
|
Packit Bot |
06c835 |
$flag = 3;
|
|
Packit Bot |
06c835 |
} else {
|
|
Packit Bot |
06c835 |
print;
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
} elsif ($flag == 3) {
|
|
Packit Bot |
06c835 |
if (/^\s*rm\s+-f\s+conftest/ ) {
|
|
Packit Bot |
06c835 |
$flag = 4;
|
|
Packit Bot |
06c835 |
&insert_main_loop();
|
|
Packit Bot |
06c835 |
} elsif (/^\s*rm\s+-f\s+.*ac_cs_root/ ) {
|
|
Packit Bot |
06c835 |
$flag = 4;
|
|
Packit Bot |
06c835 |
&insert_main_loop();
|
|
Packit Bot |
06c835 |
#die "hhhhhhh";
|
|
Packit Bot |
06c835 |
if ($ac_version != 2141) {
|
|
Packit Bot |
06c835 |
print STDERR "hmm, don't know autoconf version\n";
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
} elsif (/^\#\s*CONFIG_HEADER section.*/) {
|
|
Packit Bot |
06c835 |
$flag = 4;
|
|
Packit Bot |
06c835 |
&insert_main_loop();
|
|
Packit Bot |
06c835 |
if($ac_version != 250) {
|
|
Packit Bot |
06c835 |
print STDERR "hmm, something went wrong :-(\n";
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
} elsif (/VPATH/ ) {
|
|
Packit Bot |
06c835 |
$vpath_seen = 1;
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
die "wrong input (flag != 4)" unless $flag == 4;
|
|
Packit Bot |
06c835 |
print STDERR "hmm, don't know autoconf version\n" unless $ac_version;
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
sub insert_main_loop {
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
if ($ac_version == 250) {
|
|
Packit Bot |
06c835 |
&insert_main_loop_250();
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
else {
|
|
Packit Bot |
06c835 |
&insert_main_loop_213();
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
sub insert_main_loop_250 {
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
print <
|
|
Packit Bot |
06c835 |
#echo Doing the fast build of Makefiles -- autoconf $ac_version
|
|
Packit Bot |
06c835 |
EOF
|
|
Packit Bot |
06c835 |
if ($vpath_seen) {
|
|
Packit Bot |
06c835 |
print <
|
|
Packit Bot |
06c835 |
# VPATH subst was seen in original config.status main loop
|
|
Packit Bot |
06c835 |
echo '/^[ ]*VPATH[ ]*=[^:]*\$/d' >>\$tmp/subs.sed
|
|
Packit Bot |
06c835 |
EOF
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
print <
|
|
Packit Bot |
06c835 |
rm -f \$tmp/subs.files
|
|
Packit Bot |
06c835 |
for ac_file in .. \$CONFIG_FILES ; do
|
|
Packit Bot |
06c835 |
if test "x\$ac_file" != x..; then
|
|
Packit Bot |
06c835 |
echo \$ac_file >> \$tmp/subs.files
|
|
Packit Bot |
06c835 |
fi
|
|
Packit Bot |
06c835 |
done
|
|
Packit Bot |
06c835 |
if test -f \$tmp/subs.files ; then
|
|
Packit Bot |
06c835 |
perl $ac_aux_dir/config.pl "\$tmp/subs.sed" "\$tmp/subs.files" "\$srcdir" "\$INSTALL"
|
|
Packit Bot |
06c835 |
fi
|
|
Packit Bot |
06c835 |
rm -f \$tmp/subs.files
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
fi
|
|
Packit Bot |
06c835 |
EOF
|
|
Packit Bot |
06c835 |
return;
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
sub insert_main_loop_213 {
|
|
Packit Bot |
06c835 |
print <
|
|
Packit Bot |
06c835 |
#echo Doing the fast build of Makefiles -- autoconf $ac_version
|
|
Packit Bot |
06c835 |
if test "x\$ac_cs_root" = "x" ; then
|
|
Packit Bot |
06c835 |
ac_cs_root=conftest
|
|
Packit Bot |
06c835 |
fi
|
|
Packit Bot |
06c835 |
EOF
|
|
Packit Bot |
06c835 |
if ($vpath_seen) {
|
|
Packit Bot |
06c835 |
print <
|
|
Packit Bot |
06c835 |
# VPATH subst was seen in original config.status main loop
|
|
Packit Bot |
06c835 |
echo '/^[ ]*VPATH[ ]*=[^:]*\$/d' >> \$ac_cs_root.subs
|
|
Packit Bot |
06c835 |
EOF
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
print <
|
|
Packit Bot |
06c835 |
rm -f \$ac_cs_root.sacfiles
|
|
Packit Bot |
06c835 |
for ac_file in .. \$CONFIG_FILES ; do
|
|
Packit Bot |
06c835 |
if test "x\$ac_file" != x..; then
|
|
Packit Bot |
06c835 |
echo \$ac_file >> \$ac_cs_root.sacfiles
|
|
Packit Bot |
06c835 |
fi
|
|
Packit Bot |
06c835 |
done
|
|
Packit Bot |
06c835 |
if test -f \$ac_cs_root.sacfiles ; then
|
|
Packit Bot |
06c835 |
perl $ac_aux_dir/config.pl "\$ac_cs_root.subs" "\$ac_cs_root.sacfiles" "\$ac_given_srcdir" "\$ac_given_INSTALL"
|
|
Packit Bot |
06c835 |
fi
|
|
Packit Bot |
06c835 |
rm -f \$ac_cs_root.s*
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
EOF
|
|
Packit Bot |
06c835 |
return;
|
|
Packit Bot |
06c835 |
}
|