This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Metaconfig documentation update (part 2)
[metaconfig.git] / dist-3.0at70b / mcon / mconfig.SH
CommitLineData
959f3c4c
JH
1case $CONFIG in
2'')
3 if test -f config.sh; then TOP=.;
4 elif test -f ../config.sh; then TOP=..;
5 elif test -f ../../config.sh; then TOP=../..;
6 elif test -f ../../../config.sh; then TOP=../../..;
7 elif test -f ../../../../config.sh; then TOP=../../../..;
8 else
9 echo "Can't find config.sh."; exit 1
10 fi
11 . $TOP/config.sh
12 ;;
13esac
14case "$0" in
15*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
16esac
17echo "Extracting mcon/mconfig (with variable substitutions)"
18cat >mconfig <<!GROK!THIS!
19$startperl
20 eval "exec perl -S \$0 \$*"
21 if \$running_under_some_shell;
22
23# $Id: mconfig.SH,v 3.0.1.5 1995/07/25 14:19:05 ram Exp $
24#
25# Copyright (c) 1991-1993, Raphael Manfredi
26#
27# You may redistribute only under the terms of the Artistic Licence,
28# as specified in the README file that comes with the distribution.
29# You may reuse parts of this distribution only within the terms of
30# that same Artistic Licence; a copy of which may be found at the root
31# of the source tree for dist 3.0.
32#
33# Original Author: Larry Wall <lwall@netlabs.com>
34# Key Contributor: Harlan Stenn <harlan@mumps.pfcs.com>
35#
36# $Log: mconfig.SH,v $
37# Revision 3.0.1.5 1995/07/25 14:19:05 ram
38# patch56: new -G option
39#
40# Revision 3.0.1.4 1994/06/20 07:11:04 ram
41# patch30: new -L option to override public library path for testing
42#
43# Revision 3.0.1.3 1994/01/24 14:20:53 ram
44# patch16: added ~/.dist_profile awareness
45#
46# Revision 3.0.1.2 1993/10/16 13:53:10 ram
47# patch12: new -M option for magic symbols and confmagic.h production
48#
49# Revision 3.0.1.1 1993/08/19 06:42:26 ram
50# patch1: leading config.sh searching was not aborting properly
51#
52# Revision 3.0 1993/08/18 12:10:17 ram
53# Baseline for dist 3.0 netwide release.
54#
55
56# Perload ON
57
58\$MC = '$privlib';
59\$version = '$VERSION';
60\$patchlevel = '$PATCHLEVEL';
61\$grep = '$grep';
62!GROK!THIS!
63
64$spitshell >>mconfig <<'!NO!SUBS!'
65chop($date = `date`);
66&profile; # Read ~/.dist_profile
67require 'getopts.pl';
68&usage unless &Getopts("dhkmostvwGMVL:");
69
70$MC = $opt_L if $opt_L; # May override public library path
71$MC = &tilda_expand($MC); # ~name expansion
72chop($WD = `pwd`); # Working directory
73chdir $MC || die "Can't chdir to $MC: $!\n";
74chop($MC = `pwd`); # Real metaconfig lib path (no symbolic links)
75chdir $WD || die "Can't chdir back to $WD: $!\n";
76
77++$opt_k if $opt_d;
78++$opt_M if -f 'confmagic.h'; # Force -M if confmagic.h already there
79
80if ($opt_V) {
81 print STDERR "metaconfig $version PL$patchlevel\n";
82 exit 0;
83} elsif ($opt_h) {
84 &usage;
85}
86
87unlink 'Wanted' unless $opt_w; # Wanted rebuilt if no -w
88unlink 'Obsolete' unless $opt_w; # Obsolete file rebuilt if no -w
89&readpackage; # Merely get the package's name
90&init; # Various initializations
91`mkdir .MT 2>&1` unless -d '.MT'; # For private temporary files
92
93&locate_units; # Fill in @ARGV with a unit list
94&extract_dependencies; # Extract dependencies from units
95&extract_filenames; # Extract files to be scanned for
96&build_wanted; # Build a list of wanted symbols in file Wanted
97&build_makefile; # To do the transitive closure of dependencies
98&solve_dependencies; # Now run the makefile to close dependency graph
99&create_configure; # Create the Configure script and related files
100&cosmetic_update; # Update the manifests
101
102if ($opt_k) {
103 print "Leaving subdirectory .MT unremoved so you can peruse it.\n"
104 unless $opt_s;
105} else {
106 `rm -rf .MT 2>&1`;
107}
108print "Done.\n" unless $opt_s;
109
110# General initializations
111sub init {
112 &init_except; # Token which have upper-cased letters
113 &init_keep; # The keep status for built-in interpreter
114 &init_priority; # Priorities for diadic operators
115 &init_constants; # Define global constants
116 &init_depend; # The %Depend array records control line handling
117}
118
119sub init_constants {
120 $NEWMANI = 'MANIFEST.new'; # List of files to be scanned
121 $MANI = 'MANIFEST'; # For manifake
122}
123
124# Record the exceptions -- almost all symbols but these are lower case
125# We also use three symbols from Unix.U for default file suffixes.
126sub init_except {
127 $Except{'Mcc'}++;
128 $Except{'Author'}++;
129 $Except{'Date'}++;
130 $Except{'Header'}++;
131 $Except{'Id'}++;
132 $Except{'Locker'}++;
133 $Except{'Log'}++;
134 $Except{'RCSfile'}++;
135 $Except{'Revision'}++;
136 $Except{'Source'}++;
137 $Except{'State'}++;
138 $Except{'_a'}++;
139 $Except{'_o'}++;
140 $Except{'_exe'}++;
141}
142
143# Print out metaconfig's usage and exits
144sub usage {
145 print STDERR <<'EOH';
146Usage: metaconfig [-dhkmostvwGMV] [-L dir]
147 -d : debug mode.
148 -h : print this help message and exits.
149 -k : keep temporary directory.
150 -m : assume lots of memory and swap space.
151 -o : maps obsolete symbols on new ones.
152 -s : silent mode.
153 -t : trace symbols as they are found.
154 -v : verbose mode.
155 -w : trust Wanted file as being up-to-date.
156 -G : also provide a GNU configure-like front end.
157 -L : specify main units repository.
158 -M : activate production of confmagic.h.
159 -V : print version number and exits.
160EOH
161 exit 1;
162}
163
164!NO!SUBS!
165$grep -v '^;#' pl/locate.pl >>mconfig
166$grep -v '^;#' pl/common.pl >>mconfig
167$grep -v '^;#' pl/depend.pl >>mconfig
168$grep -v '^;#' pl/init.pl >>mconfig
169$grep -v '^;#' pl/extract.pl >>mconfig
170$grep -v '^;#' pl/files.pl >>mconfig
171$grep -v '^;#' pl/wanted.pl >>mconfig
172$grep -v '^;#' pl/obsolete.pl >>mconfig
173$grep -v '^;#' pl/makefile.pl >>mconfig
174$grep -v '^;#' pl/order.pl >>mconfig
175$grep -v '^;#' pl/configure.pl >>mconfig
176$grep -v '^;#' pl/cosmetic.pl >>mconfig
177$grep -v '^;#' pl/eval.pl >>mconfig
178$grep -v '^;#' ../pl/package.pl >>mconfig
179$grep -v '^;#' ../pl/manifake.pl >>mconfig
180$grep -v '^;#' ../pl/tilde.pl >>mconfig
181$grep -v '^;#' ../pl/profile.pl >>mconfig
182chmod +x mconfig
183$eunicefix mconfig