File: configure

package info (click to toggle)
magnus 20060324-5.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 19,436 kB
  • ctags: 20,462
  • sloc: cpp: 130,217; ansic: 37,090; tcl: 10,970; perl: 1,109; makefile: 966; sh: 403; yacc: 372; csh: 57; awk: 33; asm: 10
file content (224 lines) | stat: -rwxr-xr-x 5,192 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#!/bin/sh
##
##

## Copyright (C) 1994-2005 The New York Group Theory Cooperative
## See magnus/doc/COPYRIGHT for the full notice.

## Contents: Configuration script for Magnus
##
## Principal Author: Jon Lennox, Dmitry Bormotov
##
## Status: Useable.
##
## Revision History:
##

#echo "Setting up default Magnus paths..."
#echo

DEFAULT_MAGNUSHOME=/usr/share/magnus
DEFAULT_MAGNUSCURRENTHOME=`pwd`
DEFAULT_WISH=/usr/bin/wish
DEFAULT_MAGNUSTMP=/tmp
MAGNUSTMP=/tmp
echo "Which operation system are you going to use ? "
echo "(Enter 0 for LINUX, 1 for System V, 2 for BSD 4.11+/Mac OS X; LINUX is default)"
# read OS
OS=0

if [ "$OS" = "1" ]
then
  	OS='SYSV'

elif [ "$OS" = "2" ]
then 
        OS='BSD'

else 
	OS='LINUX'
fi
echo "You chose $OS."
echo


echo "Enter the path to the Magnus source tree (the directory where"
echo "the Magnus source is currently located):"
echo "[$DEFAULT_MAGNUSCURRENTHOME]"
# read MAGNUSCURRENTHOME
MAGNUSCURRENTHOME=
if [ "$MAGNUSCURRENTHOME" = "" ]
then
	MAGNUSCURRENTHOME=$DEFAULT_MAGNUSCURRENTHOME
fi

echo "Checking existence of $MAGNUSCURRENTHOME ... "
if [ -d $MAGNUSCURRENTHOME ]
then
	echo "ok"
else
	echo
	echo "Uh-oh ... $MAGNUSCURRENTHOME doesn't seem to exist!"
	echo "Continue? [n]"
	read YN
	if [ "`echo $YN | sed 's/\(.\).*/\1/'`" != "y" ]
	then
		exit 1
	fi
fi

# this section should wait until we have a real install script

#echo
#echo "Enter the path to the Magnus root directory (the directory where "
#echo "Magnus will eventually be installed):"
#echo [$DEFAULT_MAGNUSHOME]"
#read MAGNUSHOME
#if [ "$MAGNUSHOME" = "" ]
#then
#	MAGNUSHOME=$DEFAULT_MAGNUSHOME
#fi
#
#echo "Checking existence of $MAGNUSHOME ... "
#if [ -d $MAGNUSHOME ]
#then
#	echo "ok"
#else
#	echo
#	echo "Uh-oh ... $MAGNUSHOME doesn't seem to exist!"
#	echo "Continue? [y]"
#	read YN
#	if [ "`echo $YN | sed 's/\(.\).*/\1/'`" = "n" ]
#	then
#		exit 1
#	fi
#fi

# in the meantime, just do this

# MAGNUSHOME=$MAGNUSCURRENTHOME
MAGNUSHOME=$DEFAULT_MAGNUSHOME

echo
echo "Enter the path to the Wish executable (with the addinput extensions):"
echo "[$DEFAULT_WISH]"
# read WISH
WISH=
if [ "$WISH" = "" ]
then
	WISH=$DEFAULT_WISH
fi

echo  "Checking existence of $WISH ... "
if [ -x $WISH ]
then
	echo "ok"
else
	echo
	echo "Uh-oh ... $WISH doesn't seem to exist!"
	echo "Continue? [n]"
	read YN
	if [ "`echo $YN | sed 's/\(.\).*/\1/'`" != "y" ]
	then
		exit 1
	fi
fi

echo "Enter the path to the Magnus temporary directory:"
echo -n  "[$DEFAULT_MAGNUSTMP]"
# read MAGNUSTMP
MAGNUSTMP=
if [ "$MAGNUSTMP" = "" ]
then
	MAGNUSTMP=$DEFAULT_MAGNUSTMP
fi

echo -n "Checking existence of $MAGNUSTMP ... "
if [ -d $MAGNUSTMP ]
then
	echo "ok"
else
	echo
	echo "Uh-oh ... $MAGNUSTMP doesn't seem to exist!"
	echo -n "Continue? [n]"
	read YN
	if [ "`echo $YN | sed 's/\(.\).*/\1/'`" != "y" ]
	then
		exit 1
	fi
fi

SEDSCRIPT="s,%MAGNUSHOME%,$MAGNUSHOME,;s,%WISH%,$WISH,;s,%OS%,$OS,;s,%MAGNUSTMP%,$MAGNUSTMP,"



echo
echo "Creating $MAGNUSCURRENTHOME/back_end/global/config.h ..."
if [ ! -f $MAGNUSCURRENTHOME/back_end/global/config.h.in ]
then
	echo "$MAGNUSCURRENTHOME/back_end/global/config.h.in is missing!"
	exit 1
fi

if [ -f $MAGNUSCURRENTHOME/back_end/global/config.h ]
then
	echo "	$MAGNUSCURRENTHOME/back_end/global/config.h already exists!"
	echo "	Copying it to $MAGNUSCURRENTHOME/back_end/global/config.h.old"
	cp $MAGNUSCURRENTHOME/back_end/global/config.h $MAGNUSCURRENTHOME/back_end/global/config.h.old
fi

sed $SEDSCRIPT < $MAGNUSCURRENTHOME/back_end/global/config.h.in > $MAGNUSCURRENTHOME/back_end/global/config.h

echo "$MAGNUSCURRENTHOME/back_end/global/config.h created."


#@njz
echo
echo "Creating $MAGNUSCURRENTHOME/back_end/black_boxes/TietzeTrek/Makefile ..."
if [ ! -f $MAGNUSCURRENTHOME/back_end/black_boxes/TietzeTrek/Makefile.in ]
then
	echo "$MAGNUSCURRENTHOME/back_end/black_boxes/TietzeTrek/Makefile.in is missing!"
	exit 1
fi

if [ -f $MAGNUSCURRENTHOME/back_end/black_boxes/TietzeTrek/Makefile ]
then
	echo "	$MAGNUSCURRENTHOME/back_end/black_boxes/TietzeTrek/Makefile already exists!"
	echo "	Copying it to $MAGNUSCURRENTHOME/back_end/black_boxes/TietzeTrek/Makefile.old"
	cp $MAGNUSCURRENTHOME/back_end/black_boxes/TietzeTrek/Makefile $MAGNUSCURRENTHOME/back_end/black_boxes/TietzeTrek/Makefile.old
fi

sed $SEDSCRIPT < $MAGNUSCURRENTHOME/back_end/black_boxes/TietzeTrek/Makefile.in > $MAGNUSCURRENTHOME/back_end/black_boxes/TietzeTrek/Makefile

echo "$MAGNUSCURRENTHOME/back_end/black_boxes/TietzeTrek/Makefile created."
#

echo
echo "Creating $MAGNUSCURRENTHOME/front_end/magnus ..."
if [ ! -f $MAGNUSCURRENTHOME/front_end/magnus.in ]
then
	echo "$MAGNUSCURRENTHOME/front_end/magnus.in is missing!"
	exit 1
fi

if [ -f $MAGNUSCURRENTHOME/front_end/magnus ]
then
	echo "	$MAGNUSCURRENTHOME/front_end/magnus already exists!"
	echo "	Copying it to $MAGNUSCURRENTHOME/front_end/magnus.old"
	cp $MAGNUSCURRENTHOME/front_end/magnus $MAGNUSCURRENTHOME/front_end/magnus.old
fi

sed $SEDSCRIPT < $MAGNUSCURRENTHOME/front_end/magnus.in > $MAGNUSCURRENTHOME/front_end/magnus



chmod ug+x $MAGNUSCURRENTHOME/front_end/magnus

echo "$MAGNUSCURRENTHOME/front_end/magnus created."
chmod 755 $MAGNUSCURRENTHOME

echo

echo "Configuration complete."

exit 0