annotate kdiff3/admin/conf.change.pl @ 14:415083d043f3

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