summaryrefslogtreecommitdiff
path: root/ACE-install.sh
blob: 76c1e8064f7f6ed67ef14caf57135945ce1deeed (plain)
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
#!/bin/sh
########################## Begin Install Script ##########################
#
# NAME:         ACE-install.sh
#
# PURPOSE:      Bourne shell script to install ACE for UNIX platforms
#
# AUTHOR:       Ajit Sagar <asagar@spdmail.spd.dsccc.com>
#
# HISTORY:      5/20/96     Ajit Sagar          Created
#               x/xx/xx     xxxxxxxxxxxxxx      Modified
#               x/xx/xx     xxxxxxxxxxxxxx      Modified
#
# DESCRIPTION:  This script installs the ACE toolkit for a Unix system.
#               Before using this script, you must do the following:
#
# NOTES:        1) Download the gzipped version of ACE from
#                  http://www.cs.wustl.edu/~schmidt/ (Select "Obtaining ACE")
#		  			OR
#               ftp from wuarchive.wustl.edu in the /languages/c++/ACE directory
#
#                  The local directory to which this will be downloaded is
#                  refered to as the "MY_ACEDIR" in this script.
#
#		2) Make sure there is only one file that matches "ACE*tar*".
#                  This should be the one you just downloaded.
#		   remove older versions of tar files downloaded earlier.
#
#               3) At the end of this script, you should have:
#
#                  a) A compiled toolkit in the $ACE_ROOT directory
#                  b) If you selected to save the existing installation,
#                     a file oldACE.tar.gz will be created in MY_ACEDIR
#                  c) The gzipped ACE source file that was initially downloaded.
#
#               4) This script may be executed without user interaction
#                  by using the "auto" option (see USAGE section below).
#                  It is advisable to execute it without the "auto"  option the
#                  first time to make sure everything works.
#
#               THE FOLLOWING NEED TO BE DONE ONLY THE FIRST TIME THIS
#               SCRIPT IS RUN:
#
#               5) Read the README file in
#                  http://www.cs.wustl.edu/~schmidt/ACE.html directory
#
#               6) Define an environment variable ACE_ROOT the
#                  defines which directory your ACE toolkit is to be
#                  installed in.
#
#                  DO NOT MAKE "ACE_ROOT" THE SAME AS "MY_ACEDIR".
#
#               7) Redefine "MY_ACEDIR" in this script to default
#                  to the directory in which you have downloaded the ACE source.
#
#               8) This script has been tested on Solaris 2.x for the
#                  Sun C++4.0 compiler. To use this on some other UNIX
#                  platform, uncomment and redefine the following
#                  in this script:
#
#                  MY_ACE_CONFIG
#                  MY_ACE_GNU_MACROS
#
#		   Check the README file to define these variables. If
#                  these are not defined, the script will prompt you
#                  help you to change these variables. But in that case
#                  you cannot run with the "auto" option.
#
#
# USAGE:        myacemaker [ auto ]
#
#               auto       automatic make (no user interaction)
#
#                          Under this option, the source will be
#                          extracted and compiled without any user interaction,
#                          i.e., you can kick off this script, go home,
#                          and check it in the morning. The following
#                          assumptions are made:
#
#                            1) MY_ACE_DIR is properly defined in this script.
#                            2) MY_ACE_CONFIG is properlly defined
#                               in this script.
#                            3) MY_ACE_GNU_MACROS is properly defined in this
#                               script.
#                            4) A backup of existing installation
#                               is to be made.
#
# COPYRIGHT INFORMATION:
#
# You are free to do anything you like with this script such as
# including it in commercial software. You may modify it and freely redistribute
# it. The author accepts no responsibility for any bugs or problems that
# arise as a consequence of using this code.
#
# -- Ajit Sagar
#
#########################################################################
#
ACE_ERRFILE=/tmp/myacemaker.err
OLD_ACE_TAR_FILE=oldACE.tar
OLD_ACE_GZIPPED_TAR_FILE=oldACE.tar.gz
USAGE="<Usage> : myacemaker [ auto ]"
#
##############################################################
#
# Platform-specific definitions
#
##############################################################

# Directory where ACE-x.x.xx.tar.gz is located

MY_ACEDIR=${HOME}/aceconfig

#######################################################
# Platform specific config file in ${ACE_ROOT}/ace/
# Uncomment and redefine this
#######################################################

# MY_ACE_CONFIG=config-sunos5.4-sunc++-4.x.h

#######################################################
# Platform specific GNU macros file in
# ${ACE_ROOT}/include/makeinclude/
# Uncomment and redefine this
#######################################################

# MY_ACE_GNU_MACROS=platform_sunos5_sunc++.GNU


##############################################################
#
# Main Script For Installing ACE
#
##############################################################

AUTO="$#"

ACE_ROOT=${ACE_ROOT:?"ERROR: Environment variable ACE_ROOT not set"} 
if [ ${AUTO} -gt 1 ]
then
  echo "$USAGE"
  exit 1
fi

if [ ${AUTO} -eq 1 ]
then
  if [ $1 != "auto" ]
  then
    if [ $1 = "nounzip" ] ; then
      UNZIP=0
      AUTO=0
    else
      echo "$USAGE"
      exit 2
    fi
  fi
fi

echo ""
echo "ACE source in `ls ${MY_ACEDIR}/ACE*tar.gz`"
echo "ACE will be installed in ${ACE_ROOT}"
echo ""

if [ $AUTO -eq 0 ]
then
  echo "OK to continue? [Y/N] : \c"
  read choice
else
  choice='Y'
fi

if [ ${choice} != 'Y' -a ${choice} != 'y' ]
then
  echo ""
  echo "ACE installation aborted"
  echo ""
  exit 11
fi

cd ${MY_ACEDIR}

echo "Uncomressing ACE archive and extracting ACE files"
echo "into `pwd`/ACE_wrappers directory ..."
echo ""

gunzip -c ACE*tar.gz | tar xvf - || \
{
  echo ""
  echo "gunzip or tar failed. Aborting script !!"
  echo ""
  exit 33
}

if [ -d ${ACE_ROOT} ]
then

  if [ $AUTO -eq 0 ]
  then
    echo "Save a copy of existing ACE installation? [Y/N] : \c"
    read choice
    echo ""
  else
    choice='Y'
  fi

  if [ ${choice} = 'Y' -o ${choice} = 'y' ]
  then

   echo "Archiving ${ACE_ROOT} to `pwd`/${OLD_ACE_TAR_FILE} using <tar> ..."
    tar cvpf ${OLD_ACE_TAR_FILE} ${ACE_ROOT}
    echo ""

    if [ -f ${OLD_ACE_GZIPPED_TAR_FILE} ]
    then
      echo "Removing ${OLD_ACE_GZIPPED_TAR_FILE} ..."
      rm ${OLD_ACE_GZIPPED_TAR_FILE}
      echo ""
    fi

    echo "Compressing ${OLD_ACE_TAR_FILE} using <gzip -9> ..."
    gzip  -9 ${OLD_ACE_TAR_FILE}
    echo ""

  fi

  echo "Removing ${ACE_ROOT} ..."
  rm -r ${ACE_ROOT}
  echo ""
fi

echo "Moving `pwd`/ACE_wrappers to ${ACE_ROOT} ..."
mv ./ACE_wrappers ${ACE_ROOT}
echo ""

cd ${ACE_ROOT}/ace

if [ ${MY_ACE_CONFIG:-undefined} = undefined ]
then

  if [ $AUTO -eq 1 ]
  then
    if [ ! -f ${MY_ACE_CONFIG} ]
    then
      echo ""
      echo "${MY_ACE_CONFIG} does not exist. Aborting script ..."
      echo ""
      exit 44
    fi
  fi

  echo "Select one of the following files for linking to config.h"
  echo ""
  echo "`ls config*h`"
  echo ""

  echo "Type the filename for your compiler:  \c"
  read MY_ACE_CONFIG
  echo ""

  if [ ! -f ${MY_ACE_CONFIG} ]
  then
    echo ""
    echo "${MY_ACE_CONFIG} does not exist. Aborting script ..."
    echo ""
    exit 55
  fi

fi


echo "Creating link config.h for ${MY_ACE_CONFIG} in directory `pwd` ..."

rm ./config.h
ln -s ${MY_ACE_CONFIG} config.h

echo ""

cd ${ACE_ROOT}/include/makeinclude

if [ ${MY_ACE_GNU_MACROS:-undefined} = undefined ]
then

  if [ $AUTO -eq 1 ]
  then
    if [ ! -f ${MY_ACE_GNU_MACROS} ]
    then
      echo ""
      echo "${MY_ACE_GNU_MACROS} does not exist. Aborting script ..."
      echo ""
      exit 66
    fi
  fi

  echo "Select one of the following files for linking to config.h"
  echo ""
  echo "`ls platform*GNU`"
  echo ""
  echo "Type the filename for your compiler:  \c"

  read MY_ACE_GNU_MACROS
  echo ""

  if [ ! -f ${MY_ACE_GNU_MACROS} ]
  then
    echo ""
    echo "${MY_ACE_GNU_MACROS} does not exist. Aborting script ..."
    echo ""
    exit 77
  fi

fi

echo "Creating link platform_macros.GNU for ${MY_ACE_GNU_MACROS}"
echo "in directory `pwd` ..."

rm ./platform_macros.GNU 
ln -s ${MY_ACE_GNU_MACROS} platform_macros.GNU 

echo ""

if [ ${AUTO} -eq 0 ]
then
  echo "Make ACE now with default setup? [Y/N] : \c"
  read choice
  echo ""
else
  choice='Y'
fi

if [ ${choice} != 'Y' -a ${choice} != 'y' ]
then
  echo ""
  echo "ACE make skipped. You can use <gmake> to make ACE later"
  echo ""
  exit 0
fi

echo ""
echo "Making ACE now. Examine file ${ACE_ERRFILE} for errors ..."
echo ""

cd ${ACE_ROOT}

echo ""
echo "Executing <gmake> ..."
echo ""
gmake | tee ${ACE_ERRFILE} 2>&1

echo ""
echo "Examine file ${ACE_ERRFILE} for possible errors ..."
echo ""
echo "********** End of myacemaker script !!! ***********"
echo ""

#
#########################################################################