Mercurial > hg > easyhg-kdiff3
comparison kdiff3/admin/conf.change.pl @ 2:53b8ecbce0cb
Initial revision
author | joachim99 |
---|---|
date | Sun, 18 Aug 2002 16:23:32 +0000 |
parents | |
children | 415083d043f3 |
comparison
equal
deleted
inserted
replaced
1:391d4ae068d9 | 2:53b8ecbce0cb |
---|---|
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 # we have to change two places | |
11 # 1. the splitting of the substitutions into chunks of 90 (or even 48 in | |
12 # later autoconf's | |
13 # 2. the big main loop which patches all Makefile.in's | |
14 use File::Basename; | |
15 | |
16 my $ac_aux_dir = dirname($0); | |
17 my ($flag); | |
18 local $ac_version = 0; | |
19 my $vpath_seen = 0; | |
20 $flag = 0; | |
21 | |
22 while (<>) { | |
23 # usage of $flag: 0 -- we have seen nothing yet | |
24 # 1 -- we are in (1) | |
25 # 2 -- we have ended (1) | |
26 # 3 -- we are in (2) | |
27 # 4 -- we ended (2) | |
28 | |
29 if ($flag == 4) { | |
30 print; | |
31 } elsif ($flag == 0) { | |
32 # 1. begins with (including): "ac_max_sed_\S+\s*=\s*[0-9]+..." | |
33 # ends with (excluding) "CONFIG_FILE=..." | |
34 # in later autoconf (2.14.1) there is no CONFIG_FILES= line, | |
35 # but instead the (2) directly follow (1) | |
36 if (/^\s*ac_max_sed_([a-z]+).*=\s*([0-9]+)/ ) { | |
37 $flag = 1; | |
38 if ($1 eq 'lines') { | |
39 # lets hope its different with 2141, | |
40 # wasn't able to verify that | |
41 if ($2 eq '48') { | |
42 $ac_version = 250; | |
43 } | |
44 else { | |
45 $ac_version = 2141; | |
46 } | |
47 } elsif ($1 eq 'cmds') { | |
48 $ac_version = 213; | |
49 } | |
50 # hmm, we don't know the autoconf version, but we try anyway | |
51 } else { | |
52 print; | |
53 } | |
54 } elsif ($flag == 1) { | |
55 if (/^\s*CONFIG_FILES=/ && ($ac_version != 250)) { | |
56 print; | |
57 $flag = 2; | |
58 } elsif (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) { | |
59 $flag = 3; | |
60 } | |
61 } elsif ($flag == 2) { | |
62 # 2. begins with: "for ac_file in.*CONFIG_FILES" (the next 'for' after (1)) | |
63 # end with: "rm -f conftest.s\*" | |
64 # on autoconf 250, it ends with '# CONFIG_HEADER section' | |
65 if (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) { | |
66 $flag = 3; | |
67 } else { | |
68 print; | |
69 } | |
70 } elsif ($flag == 3) { | |
71 if (/^\s*rm\s+-f\s+conftest/ ) { | |
72 $flag = 4; | |
73 &insert_main_loop(); | |
74 } elsif (/^\s*rm\s+-f\s+.*ac_cs_root/ ) { | |
75 $flag = 4; | |
76 &insert_main_loop(); | |
77 #die "hhhhhhh"; | |
78 if ($ac_version != 2141) { | |
79 print STDERR "hmm, don't know autoconf version\n"; | |
80 } | |
81 } elsif (/^\#\s*CONFIG_HEADER section.*/) { | |
82 $flag = 4; | |
83 &insert_main_loop(); | |
84 if($ac_version != 250) { | |
85 print STDERR "hmm, something went wrong :-(\n"; | |
86 } | |
87 } elsif (/VPATH/ ) { | |
88 $vpath_seen = 1; | |
89 } | |
90 } | |
91 } | |
92 | |
93 die "wrong input (flag != 4)" unless $flag == 4; | |
94 print STDERR "hmm, don't know autoconf version\n" unless $ac_version; | |
95 | |
96 sub insert_main_loop { | |
97 | |
98 if ($ac_version == 250) { | |
99 &insert_main_loop_250(); | |
100 } | |
101 else { | |
102 &insert_main_loop_213(); | |
103 } | |
104 } | |
105 | |
106 sub insert_main_loop_250 { | |
107 | |
108 print <<EOF; | |
109 #echo Doing the fast build of Makefiles -- autoconf $ac_version | |
110 EOF | |
111 if ($vpath_seen) { | |
112 print <<EOF; | |
113 # VPATH subst was seen in original config.status main loop | |
114 echo '/^[ ]*VPATH[ ]*=[^:]*\$/d' >>\$tmp/subs.sed | |
115 EOF | |
116 } | |
117 print <<EOF; | |
118 rm -f \$tmp/subs.files | |
119 for ac_file in .. \$CONFIG_FILES ; do | |
120 if test "x\$ac_file" != x..; then | |
121 echo \$ac_file >> \$tmp/subs.files | |
122 fi | |
123 done | |
124 if test -f \$tmp/subs.files ; then | |
125 perl $ac_aux_dir/config.pl "\$tmp/subs.sed" "\$tmp/subs.files" "\$srcdir" "\$INSTALL" | |
126 fi | |
127 rm -f \$tmp/subs.files | |
128 | |
129 fi | |
130 EOF | |
131 return; | |
132 } | |
133 | |
134 sub insert_main_loop_213 { | |
135 print <<EOF; | |
136 #echo Doing the fast build of Makefiles -- autoconf $ac_version | |
137 if test "x\$ac_cs_root" = "x" ; then | |
138 ac_cs_root=conftest | |
139 fi | |
140 EOF | |
141 if ($vpath_seen) { | |
142 print <<EOF; | |
143 # VPATH subst was seen in original config.status main loop | |
144 echo '/^[ ]*VPATH[ ]*=[^:]*\$/d' >> \$ac_cs_root.subs | |
145 EOF | |
146 } | |
147 print <<EOF; | |
148 rm -f \$ac_cs_root.sacfiles | |
149 for ac_file in .. \$CONFIG_FILES ; do | |
150 if test "x\$ac_file" != x..; then | |
151 echo \$ac_file >> \$ac_cs_root.sacfiles | |
152 fi | |
153 done | |
154 if test -f \$ac_cs_root.sacfiles ; then | |
155 perl $ac_aux_dir/config.pl "\$ac_cs_root.subs" "\$ac_cs_root.sacfiles" "\$ac_given_srcdir" "\$ac_given_INSTALL" | |
156 fi | |
157 rm -f \$ac_cs_root.s* | |
158 | |
159 EOF | |
160 return; | |
161 } |