source: trunk/MagicSoft/AMC/activemirrorcontrol/admin/conf.change.pl@ 9492

Last change on this file since 9492 was 3403, checked in by merck, 21 years ago
initial check-in of AMC software
File size: 2.9 KB
Line 
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@ifh.de>
8
9# we have to change two places
10# 1. the splitting of the substitutions into chunks of 90 (or even 48 in
11# later autoconf's
12# 2. the big main loop which patches all Makefile.in's
13use File::Basename;
14
15my $ac_aux_dir = dirname($0);
16my ($flag);
17my $ac_version = 0;
18my $vpath_seen = 0;
19$flag = 0;
20
21while (<>) {
22# usage of $flag: 0 -- we have seen nothing yet
23# 1 -- we are in (1)
24# 2 -- we have ended (1)
25# 3 -- we are in (2)
26# 4 -- we ended (2)
27
28 if ($flag == 4) {
29 print;
30 } elsif ($flag == 0) {
31# 1. begins with (including): "ac_max_sed_\S+\s*=\s*[0-9]+..."
32# ends with (excluding) "CONFIG_FILE=..."
33# in later autoconf (2.14.1) there is no CONFIG_FILES= line,
34# but instead the (2) directly follow (1)
35 if (/^\s*ac_max_sed_([a-z]+).*=\s*[0-9]+/ ) {
36 $flag = 1;
37 if ($1 eq 'lines') {
38 $ac_version = 2141;
39 } elsif ($1 eq 'cmds') {
40 $ac_version = 213;
41 }
42 # hmm, we don't know the autoconf version, but we try anyway
43 } else {
44 print;
45 }
46 } elsif ($flag == 1) {
47 if (/^\s*CONFIG_FILES=/ ) {
48 print;
49 $flag = 2;
50 } elsif (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) {
51 $flag = 3;
52 if ($ac_version != 2141) {
53 $ac_version = 2141;
54 }
55 }
56 } elsif ($flag == 2) {
57# 2. begins with: "for ac_file in.*CONFIG_FILES" (the next 'for' after (1))
58# end with: "rm -f conftest.s\*"
59 if (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) {
60 $flag = 3;
61 } else {
62 print;
63 }
64 } elsif ($flag == 3) {
65 if (/^\s*rm\s+-f\s+conftest/ ) {
66 $flag = 4;
67 insert_main_loop();
68 } elsif (/^\s*rm\s+-f\s+.*ac_cs_root/ ) {
69 $flag = 4;
70 insert_main_loop();
71 #die "hhhhhhh";
72 if ($ac_version != 2141) {
73 print STDERR "hmm, don't know autoconf version\n";
74 }
75 } elsif (/VPATH/ ) {
76 $vpath_seen = 1;
77 }
78 }
79}
80
81die "wrong input (flag != 4)" unless $flag == 4;
82print STDERR "hmm, don't know autoconf version\n" unless $ac_version;
83
84sub insert_main_loop {
85 print <<EOF;
86#echo Doing the fast build of Makefiles -- autoconf $ac_version
87if test "x\$ac_cs_root" = "x" ; then
88 ac_cs_root=conftest
89fi
90EOF
91 if ($vpath_seen) {
92 print <<EOF;
93# VPATH subst was seen in original config.status main loop
94echo '/^[ ]*VPATH[ ]*=[^:]*\$/d' >> \$ac_cs_root.subs
95EOF
96 }
97 print <<EOF;
98rm -f \$ac_cs_root.sacfiles
99for ac_file in .. \$CONFIG_FILES ; do
100 if test "x\$ac_file" != x..; then
101 echo \$ac_file >> \$ac_cs_root.sacfiles
102 fi
103done
104if test -f \$ac_cs_root.sacfiles ; then
105 perl $ac_aux_dir/config.pl "\$ac_cs_root" "\$ac_given_srcdir" "\$ac_given_INSTALL"
106fi
107rm -f \$ac_cs_root.s*
108
109EOF
110 return;
111}
Note: See TracBrowser for help on using the repository browser.