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 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591
|
#!/bin/sh
#
# # Copyright (C) 1993,1994 by the author(s).
#
# This software is published in the hope that it will be useful, but
# WITHOUT ANY WARRANTY for any part of this software to work correctly
# or as described in the manuals. See the ShapeTools Public License
# for details.
#
# Permission is granted to use, copy, modify, or distribute any part of
# this software but only under the conditions described in the ShapeTools
# Public License. A copy of this license is supposed to have been given
# to you along with ShapeTools in a file named LICENSE. Among other
# things, this copyright notice and the Public License must be
# preserved on all copies.
#
# $Header: shape_conf.sh[4.0] Mon Jun 6 13:29:43 1994 andy@cs.tu-berlin.de frozen $
#
base=$1
trap "if [ ! -f Makefile ]; then mv $savename Makefile; fi; rm -f Makefile.new; exit 1" 1 2 13 15
# test if echo command interprets -n option
xxx=`echo -n`
if [ -z "$xxx" ]
then
echolead=-n
echotrail=
else
echolead=
echotrail="""\c"""
fi
echo
echo "Configure the shapeTools-1.4pl6 build/installation procedure ..."
# base path (BASE)
if [ -z "$base" ] # if path is not given as argument
then
base=`pwd`
# check if the current directory is the ShapeTools distribution root directory
if [ ! -f shape_conf.sh ]
then
echo "Where did you place the shapeTools-1.4pl6 distribution (root directory) ?"
echo $echolead "[Default: $base] > " $echotrail
read input
if [ -n "$input" ]
then
base=$input
fi
fi
fi
grep ShapeTools $base/Makefile > /dev/null 2>&1
retval=$?
while [ $retval -ne 0 ]
do
echo "This seems not to be the right directory."
echo "Where did you place the shapeTools-1.4pl6 distribution (root directory) ?"
echo $echolead "[Default: $base] > " $echotrail
read input
base=$input
grep ShapeTools $base/Makefile > /dev/null 2>&1
retval=$?
done
# Operating System type (HOSTSYSTEM)
hostsystem=`grep HOSTSYSTEM $base/Makefile | head -1 | \
sed -e 's/HOSTSYSTEM//' -e 's/[= ]//g' -e 's/s_//'`
echo
echo "Please enter the operating system type. Supported platforms are:"
echo " aix -- (IBM/AIX) hpux -- (HP/UX)"
echo " irix -- (SGI/IRIX) mach -- (NeXT/Mach)"
echo " sunos_4 -- (SunOS 4.x.x) svr_4 -- (SysV R4)"
echo " sol_2 -- (Solaris 2.x.x)"
echo " ultrix -- (DEC/Ultrix) linux -- (Linux 0.99pl14+)"
echo " for others see the README file."
echo $echolead "[Default: $hostsystem] > " $echotrail
read input
if [ -n "$input" ]
then
hostsystem=s_$input
else
hostsystem=s_$hostsystem
fi
# machine architecture (HOSTTYPE)
hosttype=`(aa=\`arch\`; echo $aa) 2> /dev/null`
# Compiler and compile flags (CC, MAKECFLAGS, MAKELDFLAGS)
cc=`grep CC $base/Makefile | head -1 | sed -e 's/CC//' -e 's/[= ]//g' -e 's/=//'`
makecflags=`grep MAKECFLAGS $base/Makefile | head -1 | sed -e 's/MAKECFLAGS//' -e 's/[ ]*=[ ]*//'`
makeldflags=`grep MAKELDFLAGS $base/Makefile | head -1 | sed -e 's/MAKELDFLAGS//' -e 's/[ ]*=[ ]*//'`
case $hostsystem in
s_aix) makecflags="$makecflags -D_POSIX_SOURCE"
;;
s_hpux) makecflags="$makecflags -Aa -D_HPUX_SOURCE"
;;
s_mach) makecflags="$makecflags -DATFS_OWN_LOCKING"
;;
esac
echo
echo "Do you want to change any of the following macro definitions ?"
echo "(Check the 'Important Hints' section in the INSTALL file for details)"
echo " CC = $cc"
echo " CFLAGS = $makecflags"
echo " LDFLAGS = $makeldflags"
echo $echolead "[Default: no] > " $echotrail
read input
if [ "$input" = "yes" -o "$input" = "y" ]
then
echo
echo $echolead "CC = [Default: $cc] " $echotrail
read input
if [ -n "$input" ]
then
cc=$input
fi
echo $echolead "CFLAGS = [Default: $makecflags] " $echotrail
read input
if [ -n "$input" ]
then
makecflags=$input
fi
echo $echolead "LDFLAGS = [Default: $makeldflags] " $echotrail
read input
if [ -n "$input" ]
then
makeldflags=$input
fi
fi
case $hostsystem in
s_aix) syslibs="-lPW"
;;
s_hpux) syslibs="-lPW"
;;
s_irix) syslibs="-lsun"
;;
s_svr_4) syslibs="-lnsl -lgen"
;;
s_sol_2) syslibs="-lnsl -lgen"
;;
esac
# Determine if shared libraries should be built
dosharedlibs=`grep DOSHAREDLIBS $base/Makefile | head -1 | \
sed -e 's/DOSHAREDLIBS//' -e 's/[\= ]//g'`
echo
echo "Do you want ShapeTools to be built with shared library support ?"
echo "This option is not available for all systems; currently support"
echo "only exists for sol_2 (XXX: add systems)"
echo $echolead "[Default: $dosharedlibs] > " $echotrail
read input
if [ "$input" = "no" -o "$input" = "n" ]
then
dosharedlibs=no
fi
if [ "$input" = "yes" -o "$input" = "y" ]
then
dosharedlibs=yes
fi
if [ "$doemacslisp" = "yes" ]
then
case $hostsystem in
s_sol_2) echo "Building shared libraries for $hostsystem"
;;
*) echo "Shared libraries not supported on $hostsystem"
dosharedlibs=no
esac
fi
# Determine subsystems to be included (SUBSYTEMS)
subsystems=`grep SUBSYSTEMS $base/Makefile | head -1 | \
sed -e 's/SUBSYSTEMS//' -e 's/=//'`
subsystems=`echo $subsystems | sed -e 's.src/interface..' \
-e 's.src/patches..' -e 's.tutorial..'`
doemacslisp=`grep DOEMACSLISP $base/Makefile | head -1 | \
sed -e 's/DOEMACSLISP//' -e 's/[\= ]//g'`
echo
echo "Do you use 'GNU-emacs' on your machine ? Do you want the"
echo "ShapeTools emacs lisp code to be compiled and installed too ?"
echo $echolead "[Default: $doemacslisp] > " $echotrail
read input
if [ "$input" = "no" -o "$input" = "n" ]
then
doemacslisp=no
fi
if [ "$input" = "yes" -o "$input" = "y" ]
then
doemacslisp=yes
fi
if [ "$doemacslisp" = "yes" ]
then
subsystems="$subsystems src/interface"
fi
# Determine whether libs and include files shall be installed.
dolibraries=`grep DOLIBRARIES $base/Makefile | head -1 | \
sed -e 's/DOLIBRARIES//' -e 's/[\= ]//g'`
echo
echo "Do you want the ShapeTools internal C-libraries and header files"
echo "to be installed ? You will need these when applying the patches"
echo "for 'gdb' and 'GNU-grep'"
echo $echolead "[Default: $dolibraries] > " $echotrail
read input
if [ "$input" = "no" -o "$input" = "n" ]
then
dolibraries=no
fi
if [ "$input" = "yes" -o "$input" = "y" ]
then
dolibraries=yes
fi
# Installation base (INSTALLBASE)
installbase=`grep INSTALLBASE $base/Makefile | head -1 | \
sed -e 's/INSTALLBASE//' -e 's/[\= ]//g'`
echo
echo "Where shall shapeTools-1.4pl6 be installed ?"
echo "Please specify the installation base directory."
echo $echolead "[Default: $installbase] > " $echotrail
read input
if [ -n "$input" ]
then
if [ "$input" = "." ]
then
input=$base
fi
installbase=$input
fi
# Installation paths (INSTALL*PATH)
installbinpath=`grep INSTALLBINPATH $base/Makefile | head -1 | \
sed -e 's/INSTALLBINPATH//' -e 's/[\= ]//g' -e s,\$\(INSTALLBASE\),$installbase,`
installincpath=`grep INSTALLINCPATH $base/Makefile | head -1 | \
sed -e 's/INSTALLINCPATH//' -e 's/[\= ]//g' -e s,\$\(INSTALLBASE\),$installbase,`
installlibpath=`grep INSTALLLIBPATH $base/Makefile | head -1 | \
sed -e 's/INSTALLLIBPATH//' -e 's/[\= ]//g' -e s,\$\(INSTALLBASE\),$installbase,`
installshapelibpath=`grep INSTALLSHAPELIBPATH $base/Makefile | head -1 | \
sed -e 's/INSTALLSHAPELIBPATH//' -e 's/[\= ]//g' -e s,\$\(INSTALLBASE\),$installbase,`
installemacslisppath=`grep INSTALLEMACSLISPPATH $base/Makefile | head -1 | \
sed -e 's/INSTALLEMACSLISPPATH//' -e 's/[\= ]//g' -e s,\$\(INSTALLBASE\),$installbase,`
installmanpath=`grep INSTALLMANPATH $base/Makefile | head -1 | \
sed -e 's/INSTALLMANPATH//' -e 's/[\= ]//g' -e s,\$\(INSTALLBASE\),$installbase,`
echo
echo "Install"
if [ -d $installbinpath ]
then
echo "...executables in $installbinpath"
else
echo "...executables in $installbinpath (does not exist)"
bindirmissing=true
fi
if [ "$dolibraries" = "yes" ]
then
if [ -d $installincpath ]
then
echo "...header files in $installincpath"
else
echo "...header files in $installincpath (does not exist)"
incdirmissing=true
fi
if [ -d $installlibpath ]
then
echo "...C-libraries in $installlibpath"
else
echo "...C-libraries in $installlibpath (does not exist)"
libdirmissing=true
fi
fi
if [ "$dolibraries" = "no" -a "$dosharedlibs" = "yes" ]
then
if [ -d $installlibpath ]
then
echo "...C-libraries in $installlibpath"
else
echo "...C-libraries in $installlibpath (does not exist)"
libdirmissing=true
fi
fi
if [ -d $installshapelibpath ]
then
echo "...shape libraries in $installshapelibpath"
else
echo "...shape libraries in $installshapelibpath (does not exist)"
shapelibdirmissing=true
fi
if [ "$doemacslisp" = "yes" ]
then
if [ -d $installemacslisppath ]
then
echo "...emacs lisp code in $installemacslisppath"
else
echo "...emacs lisp code in $installemacslisppath (does not exist)"
emacslispdirmissing=true
fi
fi
if [ ! -d "$installmanpath/man1" ]
then
man1dirmissing=true
fi
if [ ! -d "$installmanpath/man7" ]
then
man7dirmissing=true
fi
if [ "$dolibraries" = "yes" ]
then
if [ ! -d "$installmanpath/man3" ]
then
man3dirmissing=true
fi
if [ ! -d "$installmanpath/man5" ]
then
man5dirmissing=true
fi
if [ "$man1dirmissing" = "true" ] || [ "$man3dirmissing" = "true" ] \
|| [ "$man5dirmissing" = "true" ] || [ "$man7dirmissing" = "true" ]
then
echo "...manuals in $installmanpath/man{1,3,5,7} (at least one directory does not exist)"
else
echo "...manuals in $installmanpath/man{1,3,5,7}"
fi
else
if [ "$man1dirmissing" = "true" ] || [ "$man7dirmissing" = "true" ]
then
echo "...manuals in $installmanpath/man{1,7} (at least one directory does not exist)"
else
echo "...manuals in $installmanpath/man{1,7}"
fi
fi
echo $echolead "Is this correct ? [Default: yes] > " $echotrail
read input
if [ "$input" = "no" -o "$input" = "n" ]
then
echo
echo "Install executables in..."
echo $echolead "[Default: $installbinpath] > " $echotrail
read input
if [ -n "$input" ]
then
installbinpath=$input
specialbinpath=true
fi
if [ "$dolibraries" = "yes" ]
then
echo
echo "Install header files in..."
echo $echolead "[Default: $installincpath] > " $echotrail
read input
if [ -n "$input" ]
then
installincpath=$input
specialincpath=true
fi
fi
if [ "$dolibraries" = "yes" -o "$dosharedlibs" = "yes" ]
then
echo
echo "Install C-libraries in..."
echo $echolead "[Default: $installlibpath] > " $echotrail
read input
if [ -n "$input" ]
then
installlibpath=$input
speciallibpath=true
fi
fi
echo
echo "Install shape libraries in..."
echo $echolead "[Default: $installshapelibpath] > " $echotrail
read input
if [ -n "$input" ]
then
installshapelibpath=$input
specialshapelibpath=true
fi
if [ "$doemacslisp" = "yes" ]
then
echo
echo "Install emacs lisp files in..."
echo $echolead "[Default: $installemacslisppath] > " $echotrail
read input
if [ -n "$input" ]
then
installemacslisppath=$input
specialemacslisppath=true
fi
fi
echo
if [ "$dolibraries" = "yes" ]
then
echo "Install manuals in... (You need man{1,3,5,7} subdirectories there)"
else
echo "Install manuals in... (You need man{1,7} subdirectories there)"
fi
echo $echolead "[Default: $installmanpath] > " $echotrail
read input
if [ -n "$input" ]
then
installmanpath=$input
specialmanpath=true
fi
fi
# Create installation directories if necessary
echo
if [ "$bindirmissing" = "true" ] || [ "$specialbinpath" = "true" ] && [ ! -d $installbinpath ]
then
echo $echolead "'$installbinpath' does not exist. Create ? [Default: y] > " $echotrail
read input
if [ "$input" != "no" -a "$input" != "n" ]
then
sh src/rms/mkpdir $installbinpath
fi
fi
if [ "$incdirmissing" = "true" ] || [ "$specialincpath" = "true" ] && [ ! -d $installincpath ]
then
echo $echolead "'$installincpath' does not exist. Create ? [Default: y] > " $echotrail
read input
if [ "$input" != "no" -a "$input" != "n" ]
then
sh src/rms/mkpdir $installincpath
fi
fi
if [ "$libdirmissing" = "true" ] || [ "$speciallibpath" = "true" ] && [ ! -d $installlibpath ]
then
echo $echolead "'$installlibpath' does not exist. Create ? [Default: y] > " $echotrail
read input
if [ "$input" != "no" -a "$input" != "n" ]
then
sh src/rms/mkpdir $installlibpath
fi
fi
if [ "$shapelibdirmissing" = "true" ] || [ "$specialshapelibpath" = "true" ] && [ ! -d $installshapelibpath ]
then
echo $echolead "'$installshapelibpath' does not exist. Create ? [Default: y] > " $echotrail
read input
if [ "$input" != "no" -a "$input" != "n" ]
then
sh src/rms/mkpdir $installshapelibpath
fi
fi
if [ "$emacslispdirmissing" = "true" ] || [ "$specialemacslisppath" = "true" ] && [ ! -d $installemacslisppath ]
then
echo $echolead "'$installemacslisppath' does not exist. Create ? [Default: y] > " $echotrail
read input
if [ "$input" != "no" -a "$input" != "n" ]
then
sh src/rms/mkpdir $installemacslisppath
fi
fi
if [ "$man1dirmissing" = "true" ] || [ "$specialmanpath" = "true" ] && [ ! -d $installmanpath/man1 ]
then
echo $echolead "'$installmanpath/man1' does not exist. Create ? [Default: y] > " $echotrail
read input
if [ "$input" != "no" -a "$input" != "n" ]
then
sh src/rms/mkpdir $installmanpath/man1
fi
fi
if [ "$man3dirmissing" = "true" ] || [ "$specialmanpath" = "true" ] && [ ! -d $installmanpath/man3 ]
then
echo $echolead "'$installmanpath/man3' does not exist. Create ? [Default: y] > " $echotrail
read input
if [ "$input" != "no" -a "$input" != "n" ]
then
sh src/rms/mkpdir $installmanpath/man3
fi
fi
if [ "$man5dirmissing" = "true" ] || [ "$specialmanpath" = "true" ] && [ ! -d $installmanpath/man5 ]
then
echo $echolead "'$installmanpath/man5' does not exist. Create ? [Default: y] > " $echotrail
read input
if [ "$input" != "no" -a "$input" != "n" ]
then
sh src/rms/mkpdir $installmanpath/man5
fi
fi
if [ "$man7dirmissing" = "true" ] || [ "$specialmanpath" = "true" ] && [ ! -d $installmanpath/man7 ]
then
echo $echolead "'$installmanpath/man7' does not exist. Create ? [Default: y] > " $echotrail
read input
if [ "$input" != "no" -a "$input" != "n" ]
then
sh src/rms/mkpdir $installmanpath/man7
fi
fi
awk "{ if ((\$1 == \"BASE\" && \$2 == \"=\") || \$1 == \"BASE=\")
print \"BASE = $base\"
else if ((\$1 == \"HOSTSYSTEM\" && \$2 == \"=\") || \$1 == \"HOSTSYSTEM=\")
print \"HOSTSYSTEM = $hostsystem\"
else if ((\$1 == \"HOSTTYPE\" && \$2 == \"=\") || \$1 == \"HOSTTYPE=\")
print \"HOSTTYPE = $hosttype\"
else if ((\$1 == \"SYSLIBS\" && \$2 == \"=\") || \$1 == \"SYSLIBS=\")
print \"SYSLIBS = $syslibs\"
else if ((\$1 == \"SUBSYSTEMS\" && \$2 == \"=\") || \$1 == \"SUBSYSTEMS=\")
print \"SUBSYSTEMS = $subsystems\"
else if ((\$1 == \"CC\" && \$2 == \"=\") || \$1 == \"CC=\")
print \"CC = $cc\"
else if ((\$1 == \"MAKECFLAGS\" && \$2 == \"=\") || \$1 == \"MAKECFLAGS=\")
print \"MAKECFLAGS = $makecflags\"
else if ((\$1 == \"MAKELDFLAGS\" && \$2 == \"=\") || \$1 == \"MAKELDFLAGS=\")
print \"MAKELDFLAGS = $makeldflags\"
else if ((\$1 == \"INSTALLBASE\" && \$2 == \"=\") || \$1 == \"INSTALLBASE=\")
print \"INSTALLBASE = $installbase\"
else if ((\$1 == \"DOLIBRARIES\" && \$2 == \"=\") || \$1 == \"DOLIBRARIES=\")
print \"DOLIBRARIES = $dolibraries\"
else if ((\$1 == \"DOSHAREDLIBS\" && \$2 == \"=\") || \$1 == \"DOSHAREDLIBS=\")
print \"DOSHAREDLIBS = $dosharedlibs\"
else if ((\$1 == \"DOEMACSLISP\" && \$2 == \"=\") || \$1 == \"DOEMACSLISP=\")
print \"DOEMACSLISP = $doemacslisp\"
else print }" Makefile > Makefile.new
if [ "$specialbinpath" = "true" ]
then
awk "{ if ((\$1 == \"INSTALLBINPATH\" && \$2 == \"=\") || \$1 == \"INSTALLBINPATH=\")
print \"INSTALLBINPATH = $installbinpath\"
else print }" Makefile.new > Makefile.tmp
mv Makefile.tmp Makefile.new
fi
if [ "$specialincpath" = "true" ]
then
awk "{ if ((\$1 == \"INSTALLINCPATH\" && \$2 == \"=\") || \$1 == \"INSTALLINCPATH=\")
print \"INSTALLINCPATH = $installincpath\"
else print }" Makefile.new > Makefile.tmp
mv Makefile.tmp Makefile.new
fi
if [ "$speciallibpath" = "true" ]
then
awk "{ if ((\$1 == \"INSTALLLIBPATH\" && \$2 == \"=\") || \$1 == \"INSTALLLIBPATH=\")
print \"INSTALLLIBPATH = $installlibpath\"
else print }" Makefile.new > Makefile.tmp
mv Makefile.tmp Makefile.new
fi
if [ "$specialshapelibpath" = "true" ]
then
awk "{ if ((\$1 == \"INSTALLSHAPELIBPATH\" && \$2 == \"=\") || \$1 == \"INSTALLSHAPELIBPATH=\")
print \"INSTALLSHAPELIBPATH = $installshapelibpath\"
else print }" Makefile.new > Makefile.tmp
mv Makefile.tmp Makefile.new
fi
if [ "$specialemacslisppath" = "true" ]
then
awk "{ if ((\$1 == \"INSTALLEMACSLISPPATH\" && \$2 == \"=\") || \$1 == \"INSTALLEMACSLISPPATH=\")
print \"INSTALLEMACSLISPPATH = $installemacslisppath\"
else print }" Makefile.new > Makefile.tmp
mv Makefile.tmp Makefile.new
fi
if [ "$specialmanpath" = "true" ]
then
awk "{ if ((\$1 == \"INSTALLMANPATH\" && \$2 == \"=\") || \$1 == \"INSTALLMANPATH=\")
print \"INSTALLMANPATH = $installmanpath\"
else print }" Makefile.new > Makefile.tmp
mv Makefile.tmp Makefile.new
fi
savename=Makefile.orig
echo
echo "Saving original Makefile to $savename."
mv Makefile $savename
mv Makefile.new Makefile
touch .configured
exit 0
|