1#!/bin/sh
2#
3# Reconfigure
4# Extract .SH files using values in config.sh
5#
6# Useful in environments in which the source tree
7# is used to build executables for more than one kind of machine.
8# After running Configure on a particular machine, copy the
9# resulting config.sh to, for example, config.sh.SPARC.
10# When you have to recompile for some reason, running
11# "Reconfigure config.sh.SPARC" should produce the correct Makefiles
12# and the like.
13#
14# If you need to run "make depend" for a machine other than the one
15# that the Configure script was last run for, you will need to remake
16# the "mkdep" script by removing it, copying the appropriate
17# config.sh.MACHINE file to config.sh, and running "Configure -d".
18#
19
20case "$1" in
21'')
22	configfile="./config.sh"
23	;;
24*)
25	if test -f "$1" ; then
26		configfile="$1"
27	else
28		echo "$1 does not exist."
29		exit
30	fi
31esac
32
33echo "Reconfiguring using $configfile."
34. $configfile
35
36echo " "
37echo "Doing variable substitutions on .SH files..."
38set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
39shift
40case $# in
410) set x *.SH; shift;;
42esac
43if test ! -f $1; then
44    shift
45fi
46for file in $*; do
47    case "$file" in
48    */*)
49	dir=`$expr X$file : 'X\(.*\)/'`
50	file=`$expr X$file : 'X.*/\(.*\)'`
51	(cd $dir && . $file)
52	;;
53    *)
54	. $file
55	;;
56    esac
57done
58if test -f config.h.SH; then
59    if test ! -f config.h; then
60	: oops, they left it out of MANIFEST, probably, so do it anyway.
61	. config.h.SH
62    fi
63fi
64
65echo "You must run 'make depend' then 'make'."
66