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 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372
|
#! /bin/sh
# ----------------------------------------------------------
# (C) 1994, 1995 Institute for New Generation Computer Technology
# (Read COPYRIGHT for detailed information.)
# (C)1996, 1997, 1998, 1999 Japan Information Processing Development Center
# (Read COPYRIGHT-JIPDEC for detailed information.)
# ----------------------------------------------------------
if test $# -ge 1 -a "$1" = '-d';
then shift; def_ask=false;
else def_ask=true
fi
def_setting=./config.sh
CROSS=false
DEFCROSS="#undef"
if test $# -eq 1; then
if test "$1" = builddist; then
BUILDDIST=true
elif test "$1" = cross; then
BUILDDIST=false
CROSS=true
DEFCROSS="#define"
fi
else
BUILDDIST=false
fi
if [ x$PWD = x ]; then
PWD=`pwd`
export PWD
fi
cat <<GAZONK
#
# WELCOME TO KLIC SYSTEM CONFIGURATION SCRIPT
#
# Copyright 1994 Institute for New Generation Computer Technology
# Read COPYRIGHT for detailed information
#
# In this script, I'll ask you for several options you can make.
# Default values are presented in brackets as in [default].
# If the default is OK, simply hit CR.
# Otherwise, type in whatever is your option.
# When you want to specify nothing, type in "none".
#
GAZONK
: ::::::::::::::::::: HELPER FUNCTIONS ::::::::::::::::::::
: Find how to suppress newline after echo
if ( echo "test line\c"; echo " ") | grep c >/dev/null 2>/dev/null ; then
n='-n'
c=''
else
n=''
c='\c'
fi
: Define some handy functions
clean_up_config () {
rm -f nmout.tmp nmout.list nmout.all 2>/dev/null
}
give_up_config () {
echo " "
for message do
echo "!!! $message !!!"
done
clean_up_config
echo "Aborting KLIC configuration script"
echo ' '
exit 1
}
ask_yes_or_no () {
set_var=$2;
do_ask=true;
if [ -n "$set_var" ]; then eval "default=\$$set_var"; do_ask=$def_ask;
else default=""; fi
if [ -z "$default" ]; then default=$1; do_ask=true; fi
if [ "$set_var" = USE_DEFAULT ]; then set_var=''; do_ask=$def_ask; fi
echo $n " (yes or no)"$c
while true ; do
echo $n " [$default] "$c
if $do_ask ; then read ans; else echo $default; ans=$default; fi
if test -z "$ans" ; then ans=$default; fi
if [ -n "$set_var" ]; then echo "$set_var='$ans'" >> config.tmp; fi
case $ans in
yes) return 0;;
no) return 1;;
*) echo $n "Please input yes or no"$c;;
esac
do_ask=true
done
}
ask_with_default () {
message=$1
macroname=$2
do_ask=true;
eval def_value=\$"DEF_$2"
if [ -n "$def_value" ]; then
eval "$macroname='$def_value'"; do_ask=$def_ask
fi
eval default=\$$macroname
echo $n "Which $message to use? [$default] "$c
if $do_ask ; then read ans; else echo $default; ans=$default; fi
case $ans in
none) ans='';;
'') {
if test "$default" = "none"; then
ans=''
else
ans=$default
fi
} ;;
esac
eval $macroname=\$ans
if [ -z "$ans" ]; then ans=none; fi
echo "DEF_$macroname='$ans'" >>config.tmp
}
locate_file () {
file=$1
shift
kind=$1
shift
for dir in $*; do
if test -$kind $dir/$file; then
where=$dir/$file
return 0
fi
done
return 1
}
locate_executable () {
file=$1
shift
user_path=$*
locate_file "$file" x $user_path
return
}
locate_directory () {
located_dir=$1
test -d $located_dir ||
{
echo $n "Cannot find $located_dir; Create it now? "$c
if ask_yes_or_no yes; then
if mkdir $located_dir ; then
return 0
else
echo "!!! Couldn't create $located_dir !!!"
return 1
fi
else
return 1
fi
}
}
ask_additional () {
message=$1
macroname=$2
do_ask=true;
eval def_value=\$"DEF_$2"
if [ -n "$def_value" ]; then
eval "$macroname='$def_value'"; do_ask=$def_ask
fi
eval default=\$$macroname
case $default in
'') default="none" ;;
esac
echo "# Default $message are: $default"
echo ' '
echo $n "Do you want to change the default? "$c
eval retval="\$DEF_$macroname";
use_default=''
if [ $def_ask="false" -a -n "$retval" ];
then
ask_or_not=no
use_default=USE_DEFAULT
else
ask_or_not=no
fi
if ask_yes_or_no $ask_or_not $use_default; then
echo ' '
if test '$default'!=none; then
echo $n "Do you want to delete any of them? "$c
if ask_yes_or_no no; then
echo ' '
echo "# OK, then I'll clear the default."
eval $macroname=\"\"
default=
echo "# Now there are no default $message."
echo ' '
fi
fi
echo $n "Specify additions if any: "$c
while true; do
if $do_ask ; then read ans; else echo $default; ans=$default; fi
case $ans in
'') eval retval="\$$macroname"
echo "DEF_$macroname='$retval'" >>config.tmp
return 0;;
*) eval $macroname=\"\$$macroname \$ans\"
esac
echo $n "More? "$c
do_ask=true
done
else
eval retval="\$$macroname"
echo "DEF_$macroname='$retval'" >>config.tmp
fi
}
ask_executable () {
what=$1
macroname=$2
do_ask=true
eval "def_value=\$DEF_$2"
if [ -n "$def_value" ];
then eval "$macroname='$def_value'"; do_ask=$def_ask;
fi
while true; do
eval default=\$$macroname
echo $n "Which $what to use? [$default] "$c
if $do_ask ; then read ans; else echo $default; ans=$default; fi
case $ans in
'') eval result=\$$macroname;;
*) result=$ans;;
esac
case $result in
/*) {
if test -x $result; then
eval $macroname=\$result
echo "DEF_$macroname='$result'" >>config.tmp
return 0
else
echo !!! Can\'t find an executable file \"$result\" !!!
fi
};;
*) {
if locate_executable $result $user_path; then
eval $macroname=\$result
echo "DEF_$macroname='$result'" >>config.tmp
return 0
else
echo !!! Can\'t find \"$result\" along your path !!!
echo ' '
fi
} ;;
esac
do_ask=true
done
}
ask_directory () {
what=$1
macroname=$2
do_ask=true;
eval "def_value=\$DEF_$2"
if [ -n "$def_value" ]; then eval $macroname="$def_value"; do_ask=$def_ask; fi
while true; do
eval default=\$$macroname
echo $n "Which $what directory to use? [$default] "$c
if $do_ask ; then read ans; else echo $default; ans=$default; fi
case $ans in
'') eval result=\$$macroname;;
*) result=$ans;;
esac
if locate_directory "$result"; then
result=`cd $result; pwd`
eval $macroname=\$result
echo "DEF_$macroname='$result'" >> config.tmp
return 0
fi
done
}
check_writable () {
what=$1
macroname=$2
eval filename=\$$macroname
if test -d $filename; then
if test -w $filename; then
return
else
echo "!!! You do not have write access to $filename !!!"
fi
elif test -f $filename; then
echo "!!! $filename is not a directory"
else
echo "!!! Directory $filename does not exist !!!"
fi
ask_directory "$what" $macroname
}
guess_arch () {
if ( uname -m ) | grep "sun4d" >/dev/null 2>/dev/null ; then
CPU="SPARC"
elif ( uname -m ) | grep "sun4m" >/dev/null 2>/dev/null ; then
CPU="SPARC"
elif ( uname -m ) | grep "sun4u" >/dev/null 2>/dev/null ; then
CPU="SPARC"
elif ( uname -m ) | grep "alpha" >/dev/null 2>/dev/null ; then
CPU="ALPHA"
elif ( uname -m ) | grep "i[3456]86" >/dev/null 2>/dev/null ; then
: :: CAUTION: INTEL version has been not tested on parallel computers yet.
: :: DO NOT USE IT!!
CPU="INTEL"
else
CPU="Unknown_cpu"
fi
}
: ::::::::::::::::::: HELPER FUNCTIONS ::::::::::::::::::::
if [ -f $def_setting ]; then
echo "Previous configuration setting '$def_setting' exists."
echo $n "Do I read default setting from it?"$c
if ask_yes_or_no no;
then . $def_setting
else def_ask=true
fi
echo ' '
else def_ask=true
fi
rm -f config.tmp
: ::::::::::::::::::: CLEARING UP ::::::::::::::::::::
echo ' '
if test -f Makefile; then
cat <<GAZONK
# I found Makefile in this directory. This might mean that you already
# have installed the KLIC system before.
GAZONK
echo $n "May I clean-up the directory by \"make clean\" first? "$c
if ask_yes_or_no yes; then
echo ' '
make clean ||
give_up_config "Make clean ends with non-zero return code"
echo ' '
else
give_up_config "OK, then I'll stop reconfiguration."
fi
fi
: ::::::::::::::::::: END CLEARING UP ::::::::::::::::::::
if $CROSS; then
ARCHIVES="libklicd.a"
cat <<GAZONK
# You specified to build the cross system. To build the cross system,
# an already working KL1 to C compiler (kl1cmp) is required.
GAZONK
OLDLIBDIR="/usr/local/lib/klic"
ask_directory "KLIC Library Directory" "OLDLIBDIR" || exit 1
echo ' '
KLIC_CROSS_COMPILER="$OLDLIBDIR/kl1cmp"
ask_executable "KL1 to C compiler (kl1cmp)" "KLIC_CROSS_COMPILER" || exit 1
echo ' '
else
KLIC_CROSS_COMPILER=false
cat <<GAZONK
# This is version of KLIC contains its sequential core,
# a distributed parallel implementation and a shared memory parallel
# implementation that works either on Sparc-based system with Solaris
# 2.X or Alpha-based system with DEC OSF/1 with gcc.
#
# The sequential core is mandatory.
# Installation of parallel implementations is optional.
GAZONK
ARCHIVES="libklic.a libklict.a"
fi
: ::: CPU Type
CPU="Unknown_cpu"
if $CROSS ; then
PARALLEL=true
DISTSYSTEM=true
else
: :: NORMAL CASE
echo $n "Configure also for parallel implementations? "$c
if ask_yes_or_no no DEF_PARALLEL; then
PARALELL=true
echo $n "Configure for distributed memory parallel KLIC? "$c
if ask_yes_or_no no DEF_DISTSYSTEM; then
DISTSYSTEM=true
ARCHIVES="$ARCHIVES libklicd.a"
else
disttype=pvm
#INCLUDESH=runtime/config/$disttype/config.h.sh
DISTSYSTEM=false
ROOTMAKE=root.mk.sh
INCLUDESH="config.h.sh"
fi
else
PARALLEL=false
disttype=pvm
#INCLUDESH=runtime/config/$disttype/config.h.sh
DISTSYSTEM=false
ROOTMAKE=root.mk.sh
INCLUDESH="config.h.sh"
fi
fi
if $PARALLEL ; then
if $DISTSYSTEM ; then
disttypes=`cd runtime/config; ls`
disttypes=`echo $disttypes | sed -e 's/Makefile//' | sed -e 's/backup//'`
distloop=true
while $distloop; do
cat <<GAZONK
# KLIC distributed memory implementation can be installed
# on the following types of systems:
$disttypes.
GAZONK
echo $n "Which type should be installed? "$c
read disttype
for i in $disttypes; do
if test "$i" = "$disttype"; then
distloop=false
fi
done
done
: :: BEGIN EACH CONFIGURATION ::
. runtime/config/$disttype/configure
ROOTMAKE=runtime/config/$disttype/root.mk.sh
INCLUDESH=runtime/config/$disttype/config.h.sh
fi
if [ "$CROSS" = "false" ]; then
: ::::::::::::::::::: SHARED Memory SETTING ::::::::::::::::::::
echo ' '
echo $n "Configure for shared memory parallel KLIC? "$c
if ask_yes_or_no no DEF_SHMSYSTEM; then
guess_arch
if [ $CPU != "Unknown_cpu" ]; then
ARCHIVES="$ARCHIVES libklics.a"
else
cat <<GAZONK
# I do not know this machine.
# Sorry I cannot install Shared-memory parallel KLIC.
GAZONK
fi
fi
fi
fi
user_path=`echo $PATH | sed -e 's/:/ /g'`
export user_path
if $BUILDDIST; then
cat <<GAZONK
# You specified to rebuild the distribution. To rebuild the distribution,
# an already working KL1 to C compiler (kl1cmp) is required.
GAZONK
OLDLIBDIR="/usr/local/lib/klic"
ask_directory "KLIC Library Directory" "OLDLIBDIR" || exit 1
echo ' '
KL1CMP="$OLDLIBDIR/kl1cmp"
ask_executable "KL1 to C compiler (kl1cmp)" "KL1CMP" || exit 1
echo ' '
else
KL1CMP="false"
fi
if locate_executable "gcc" $user_path; then
CC="gcc"
cat <<GAZONK
# Found gcc in $where.
# I'd recommend using gcc for installing KLIC, as it's been tested
# mainly with gcc.
GAZONK
else
CC=cc
fi
ask_executable "C compiler" "CC" || exit 1
echo ' '
case $CC in
gcc)
OPTLEVEL="2"
DEBUGFLAGS="-g"
UOPTFLAGS="-fomit-frame-pointer";;
cc) OPTLEVEL=none
DEBUGFLAGS="-g"
UOPTFLAGS=none;;
*) OPTLEVEL=none
DEBUGFLAGS=none
UOPTFLAGS=none;;
esac
cat <<GAZONK
# During the installation procedure, the runtime library for the KLIC system
# will be compiled using $CC.
#
# You can choose optimization and debug flags for this compilation now
# (I'll ask you about setting for compiling user programs later).
GAZONK
ask_with_default "optimization level" OPTLEVEL
ask_with_default "debug flags" DEBUGFLAGS
rm -f Configure.ln
LN="ln -s"
if $LN Configure Configure.ln 2>/dev/null
then true
else LN=ln
fi
rm -f Configure.ln
echo ' '
cat <<GAZONK
# When KL1 programs are compiled, they are compiled into C code and then
# compiled into executable using $CC. You can specify optimization level
# and debug flag for $CC in the command line argument for the KLIC compiler.
#
# You can here select flags that'll be only set for optimized compilation,
# that is, flags that'll be supplied only when you specified -O# when you
# run the KLIC compiler.
GAZONK
ask_with_default "additional optimization flags" UOPTFLAGS
echo " "
case $OPTLEVEL in
"none" | "" | 0)
OPTFLAGS=""
KLICOPT="";;
1|2|3|4|5|6|7|8|9)
OPTFLAGS="-O$OPTLEVEL $UOPTFLAGS"
KLICOPT="-O$OPTLEVEL";;
*) OPTFLAGS=""
KLICOPT=""
OPTLEVEL=0
echo "Illegal optimization level ($OPTLEVEL); set to 0";;
esac
KLICCFLAGS=none
cat <<GAZONK
# You can specify addtional flags for $CC.
# If "-pipe" is available, specify it here.
GAZONK
ask_with_default "C compiler flags" KLICCFLAGS
echo ' '
#################
FORT=none
cat <<GAZONK
# If you want to link Fortran code w/ KLIC code, please reply
# to the following questions.
GAZONK
ask_with_default "Fortran compiler" FORT
echo ' '
#####
if locate_executable $FORT $user_path; then
#####
case $FORT in
g77) FFLAGS=none;;
f77) FFLAGS=none;;
*) FFLAGS=none;;
esac
cat <<GAZONK
# You can specify addtional flags for $FORT.
#
GAZONK
ask_with_default "additional flags for $FORT" FFLAGS
echo " "
else
FORT=""
FFLAGS=""
fi
#################
cat <<GAZONK
# KLIC will normally use $CC for linkage also,
# but you can specify a different linker.
GAZONK
echo $n "May I use $CC for linkage also? "$c
if ask_yes_or_no yes DEF_USECC_AS_LD; then
LD=$CC
KLICLDFLAGS=""
else
LD=ld
ask_executable "link editor" "LD" || exit 1
echo ' '
cat <<GAZONK
# You can specify additional flags for $LD.
GAZONK
KLICLDFLAGS=none
ask_with_default "linker flags" KLICLDFLAGS
fi
echo ' '
if [ ! -z "$FORT" ]; then
echo "May I use $FORT for linkage also "
echo $n "when linking with Fortran code? "$c
if ask_yes_or_no yes DEF_USEFORT_AS_LD; then
FORTLD=$FORT
KLICLDOPTIONS=""
else
FORTLD=ld
echo ' '
cat <<GAZONK
# You can specify additional flags for $FORTLD.
GAZONK
KLICLDFLAGS=none
ask_with_default "linker flags" KLICFORTLDFLAGS
fi
echo ' '
fi
if locate_executable "ranlib" $user_path; then
RANLIB=ranlib
else
RANLIB=true
cat <<GAZONK
# I couldn't find "ranlib" along your path.
# Use "true" instead if your system doesn't need running ranlib.
GAZONK
ask_executable "library indexer" "RANLIB" || exit 1
echo ' '
fi
cat <<GAZONK
# link command is used during the system compilation.
# I'd recommend to use sumbolic link if your system supports.
GAZONK
ask_with_default "link command" LN
echo ' '
if locate_executable "make" $user_path; then
MAKE=make
else
MAKE=""
cat <<GAZONK
# I couldn't find "make" along your path.
GAZONK
ask_executable "make" "MAKE" || exit 1
echo ' '
fi
INSTALL="/bin/cp -p"
INSTDIR="/bin/mkdir -p"
cat <<GAZONK
# For KLIC to support asynchronous stream I/O, the system should
# deliver signals such as SIGIO or SIGPOLL when I/O becomes possible.
# However, some systems (such as Linux 1.0) does not support this.
GAZONK
echo $n "Does your system support I/O ready signals?"$c
if ask_yes_or_no yes DEF_ASYNCIO; then
ASYNCIO="#define"
else
ASYNCIO="#undef"
fi
echo ' '
cat <<GAZONK
# The KLIC system will be installed under certain directories.
# You have to be able to write into that directory for installation.
# Also, the installed files under the directory should be visible from
# all the KLIC users (only yourself for a private installation).
#
# First, the root of the installation directory tree.
GAZONK
DIRPREFIX="/usr/local"
ask_directory "installation root" DIRPREFIX ||
give_up_config "Coudn't determine installation root directory"
cat <<GAZONK
# By default, KLIC system will be installed in the subdirectories of
# the directory you specified ($DIRPREFIX).
# In the default setting, subdirectories used are:
# $DIRPREFIX/bin: for user command (klic)
# $DIRPREFIX/lib: for subprograms and libraries
# $DIRPREFIX/include: for header files
GAZONK
KLICBIN=$DIRPREFIX/bin
KLICLIB=$DIRPREFIX/lib
KLICINCLUDE=$DIRPREFIX/include
echo $n "May I use the default setting?"$c
ask_yes_or_no yes DEF_USE_DEFAULT_SETTING ||
{
ask_directory "user command" KLICBIN
ask_directory "library" KLICLIB
ask_directory "include file" KLICINCLUDE
}
check_writable "user command" KLICBIN
check_writable "library" KLICLIB
check_writable "include file" KLICINCLUDE
echo " "
LIBPATH=""
for dir in /lib /usr/lib /usr/local/lib; do
if test -d $dir; then
LIBPATH="$LIBPATH $dir"
fi
done
# for NEC EWS4800 Rev 8.1
case $HOSTTYPE in
mips|ews_mips)
for dir in /usr/necccs/lib ; do
if test -d $dir; then
LIBPATH="$dir $LIBPATH"
fi
done ;;
*)
esac
echo "# Specify directories for library archives."
ask_additional "library directories" LIBPATH
echo ' '
INCLUDEDIR=/usr/include
ask_directory "default include file directory" INCLUDEDIR
while test ! -d $INCLUDEDIR; do
echo "# I couldn't find $INCLUDEDIR"
ask_directory "default include file directory" INCLUDEDIR
done
echo ' '
LIBNAMES=""
locate_file libc_s.a f $LIBPATH && LIBNAMES="$LIBNAMES libc_s"
( locate_file libm.a f $LIBPATH || locate_file libm.so f $LIBPATH ) \
&& LIBNAMES="$LIBNAMES libm"
( locate_file libelf.a f $LIBPATH || locate_file libelf.so f $LIBPATH ) \
&& LIBNAMES="$LIBNAMES libelf"
( locate_file libsocket.a f $LIBPATH || locate_file libsocket.so f $LIBPATH ) \
&& LIBNAMES="$LIBNAMES libsocket"
( locate_file libnsl.a f $LIBPATH || locate_file libnsl.so f $LIBPATH ) \
&& LIBNAMES="$LIBNAMES libnsl"
locate_file libmld.a f $LIBPATH && LIBNAMES="$LIBNAMES libmld"
echo "# Specify library archive files."
ask_additional "library archives" LIBNAMES
echo ' '
locate_file libc.a f $LIBPATH ||
locate_file libc_s.a f $LIBPATH ||
locate_file libc.so f $LIBPATH ||
give_up_config "Couldn't locate libc.a in directories $LIBPATH"
LIBFILES="$where"
echo $n "# Using library file(s):"$c
for lib in $LIBNAMES; do
if locate_file $lib.a f $LIBPATH; then
LIBFILES="$LIBFILES $where"
echo $n " $where"$c
elif locate_file $lib.so f $LIBPATH; then
# for SGI IRIS IRIX 5.2
LIBFILES="$LIBFILES $where"
echo $n " $where"$c
else
give_up_config "Couldn't find $lib.a in $LIBPATH"
fi
done
echo ' '
echo ' '
LIBSWITCHES=`echo " " $LIBNAMES | sed -n -e "s/ lib/ -l/gp"`
for dir in $LIBPATH ; do
LIBSWITCHES="-L$dir $LIBSWITCHES"
done
echo "# Specify directories for header files at KL1 program compilation."
ask_additional "include directory for compiling KLIC" KLICINCLUDE
echo ' '
XTERM=""
if locate_executable "kterm" $user_path; then
XTERM=$where
elif locate_executable "xterm" $user_path; then
XTERM=$where
fi
echo "# KLIC has a multi-window tracer using X window."
echo ' '
echo $n "Do you want to use X-based multi-window tracer?" $c
if ask_yes_or_no no; then
ask_executable "Terminal program for X" "XTERM"
if test "$XTERM" = ""; then
echo "Given up to install the multi-window tracer"
fi
else
XTERM=""
fi
echo ' '
USER=${USER:-unknown}
case $USER in
unknown)
if locate_executable "whoami" $user_path; then
USER=`$where`
fi
esac
locate_executable "nm" $user_path ||
give_up_config "Couldn't find "nm" along your path"
echo "# I'll make a summary of libraries for later use in analysis."
echo $n "# It may take a while."$c
rm -f nmout.all 2>/dev/null
#for NEC EWS4800 /bin/sh
case $HOSTTYPE in
mips|ews_mips)
touch nmout.all;;
*)
esac
for libfile in $LIBFILES; do
echo $n .$c
nm $libfile 2>/dev/null >>nmout.all
done
grep printf <nmout.all >nmout.tmp
try_sed()
{
echo $n .$c
sedargs=''
for arg do
sedargs="$sedargs -e '$arg'"
done
eval sed -n $sedargs <nmout.tmp >nmout.list
grep '^printf$' nmout.list >/dev/null 2>/dev/null
return
}
try_sed 's/^.* [ATDSIW] *[_.]*//p' 's/^.* [ATDSIW] //p' ||
try_sed 's/^__*//' 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' ||
try_sed '/|UNDEF/d' '/FUNC..GL/s/^.*|__*//p' ||
try_sed 's/^.* D __*//p' 's/^.* D //p' ||
try_sed 's/^_//' 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' ||
try_sed '/|COMMON/d' '/|DATA/d' '/ file/d' 's/^\([^ ]*\).*/\1/p' ||
try_sed '/|UNDEF/d' 's/^.*|FUNC |GLOB .*|//p' 's/^.*|FUNC |WEAK .*|//p' ||
try_sed 's/^.*|FUNC |GLOB .*|//p' 's/^.*|FUNC |WEAK .*|//p' ||
try_sed 's/^[ ]*[0-9][0-9a-f]*[ ]*Def. Text[ ]*//p' ||
try_sed 's/^.* [AT] *_[_.]*//p' 's/^.* [AT] //p' ||
try_sed 's/^.*|Proc.*| //p' ||
give_up_config "nm didn't seem to work right or libraries are clobbered "
eval sed -n $sedargs <nmout.all >nmout.list
cat <<GAZONK
done
#
# I now start testing availability of features I might use...
GAZONK
find_label ()
{
grep "^$1\$" nmout.list >/dev/null 2>/dev/null
}
define="#define"
undef="#undef"
test_label()
{
testedlabel=$1
macroname=$2
if find_label $testedlabel; then
echo " found \"$testedlabel\""
eval $macroname=\$define
return 0
else
echo " cannot find \"$testedlabel\"; I'll try without it."
eval $macroname=\$undef
return 1
fi
}
test_either()
{
onelabel=$1
anotherlabel=$2
macroname=$3
test_label $onelabel $macroname ||
test_label $anotherlabel DUMMY ||
give_up_config "Can't find either $onelabel or $anotherlabel"
}
test_include()
{
file=$1
macro=$2
shift
if locate_file "$file" f $INCLUDEDIR; then
echo " found \"$file\""
eval $macro=\$define
return 0
else
echo " cannot find \"$file\"; I'll try without it."
eval $macro=\$undef
return 1
fi
}
test_include string.h STRINGH
test_include stddef.h STDDEFH
test_label setlinebuf SETLINEBUF
test_label lockf USELOCKF
test_label sigaction USESIG
test_label getrusage GETRUSAGE
test_label ulimit USEULIMIT
test_label getdtablesize USEGETDTABLESIZE
test_label setitimer USETIMER
test_label nrand48 USENRAND48
test_label isastream USEISASTREAM
test_either bcmp memcmp USEBCMP
test_either bcopy memcpy USEBCOPY
test_either bzero memset USEBZERO
test_either strchr index USESTRCHR
test_either usleep sleep USEUSLEEP
# sys_errlist
cat <<EOF >/tmp/_syserr.c
#include <stdio.h>
extern char *sys_errlist[];
main() {
char *str = sys_errlist[0];
}
EOF
if ${CC} -o /tmp/_syserr /tmp/_syserr.c >/dev/null 2>&1; then
DECL_SYS_ERRLIST="#define"
else
DECL_SYS_ERRLIST="#undef"
fi
rm -f /tmp/_syserr /tmp/_syserr.c
# fprintf
cat <<EOF >/tmp/_fprintf.c
#include <stdio.h>
main() {
#ifdef __STDC__
void (*fprintf_func)(FILE *out, char *format, ...) =
(void (*)(FILE *, char *, ...))(fprintf);
#else
void (*fprintf_func)() = (void (*)())(fprintf);
#endif
}
EOF
if ${CC} -o /tmp/_fprintf /tmp/_fprintf.c >/dev/null 2>&1; then
DECL_FPRINTF="#undef"
else
DECL_FPRINTF="#define"
fi
rm -f /tmp/_fprintf /tmp/_fprintf.c
if test "$XTERM" = ""; then
USEXTERM="#undef XTERM"
else
USEXTERM="#define XTERM \"$XTERM\""
fi
if locate_file stropts.h f $INCLUDEDIR; then
USESTREAMINCLUDEDIR=$undef
else
USESTREAMINCLUDEDIR=$define
fi
if locate_file procset.h f $INCLUDEDIR; then
test_include processor.h USEPROCBIND
else
USEPROCBIND=$undef
fi
test_include sys/select.h USESELECT
if $KLIC_CROSS_COMPILER; then
KLIC_COMPILER="$KLIC_CROSS_COMPILER"
else
KLIC_COMPILER="$KLICLIB/klic/kl1cmp"
fi
cat <<GAZONK
# KLIC can run C compilers and other programs used for program compilation
# in parallel. Maximum parallelism (maximum number of processes forked by
# the compiler driver) can be specified by -P option at compilation time.
#
# You can also use this feature during the installation procedure.
# Note that, too much parallelism may slow down the installation.
# I'd recommend using no parallelism on uniprocessor systems.
GAZONK
INSTPARALLEL=0
ask_with_default "default parallelism in installation" "INSTPARALLEL" || exit 1
echo ""
NODES=16
if $PARALLEL; then
cat <<GAZONK
# KLIC provide test suites for the sequential/parallel implementation.
# You can indicate the max. number of processors to use for this
# testing of the parallel implementation.
GAZONK
ask_with_default "maximum number of processors for testing" NODES
fi
echo ""
echo "# Writing out config.h file."
cat <<GAZONK >config.h
/*
Copyright 1994, 1995 Institute for New Generation Computer Technology
Read COPYRIGHT for detailed information
Copyright 1996, 1997, 1998 Japan Information Processing Development Center
Read COPYRIGHT-JIPDEC for detailed information
KLIC System Configuration Setting
This file was created by KLIC configuration script.
Date of Confuguration: `date`
Configured by: ${USER:-unknown}
*/
/* CPU name for locking shared-memory parallel */
#define $CPU
/* Directories for installation */
#define KLICBIN "$KLICBIN"
#define KLICLIB "$KLICLIB"
#define KLICINCLUDE "$KLICINCLUDE"
#define KLIC_COMPILER "$KLIC_COMPILER"
#define KLIC_DBMAKER "$KLICLIB/klic/klicdb"
/* Laguage and program processing systems */
#define CC "$CC"
#define LD "$LD"
#define RANLIB "$RANLIB"
/* Additional CC flags for optimized compilation of KL1 programs */
#define UOPTFLAGS "$UOPTFLAGS"
/* Additional flags for LD */
#define LIBRARIES "-lklic $LIBSWITCHES"
#define LIBRARIES_T "-lklict $LIBSWITCHES"
#define LIBRARIES_D "-lklicd $LIBSWITCHES"
#define LIBRARIES_S "-lklics $LIBSWITCHES"
#define KLIC_CC_OPTIONS "$KLICCFLAGS"
#define KLIC_LD_OPTIONS "$KLICLDFLAGS"
/* Usual C macros depending on availability */
$ASYNCIO ASYNCIO
$STRINGH STRINGH
$STDDEFH STDDEFH
$SETLINEBUF SETLINEBUF
$USELOCKF USELOCKF
$USESIG USESIG
$GETRUSAGE GETRUSAGE
$USEBCMP USEBCMP
$USEBCOPY USEBCOPY
$USEBZERO USEBZERO
$USESTRCHR USESTRCHR
$USEUSLEEP USEUSLEEP
$USEULIMIT USEULIMIT
$USEGETDTABLESIZE USEGETDTABLESIZE
$USETIMER USETIMER
$USENRAND48 NRAND48
$USEISASTREAM ISASTREAM
$USESTREAMINCLUDEDIR USESTREAMINCLUDEDIR
$USEPROCBIND USEPROCBIND
$USESELECT USESELECT
$USEXTERM
$DECL_SYS_ERRLIST DECL_SYS_ERRLIST
$DECL_FPRINTF DECL_FPRINTF
#ifdef USEBCMP
#define BCMP(x,y,len) bcmp(x,y,len)
#else
#define BCMP(x,y,len) memcmp(x,y,len)
#endif
#ifdef USEBCOPY
#define BCOPY(from,to,len) bcopy(from,to,len)
#else
#define BCOPY(from,to,len) memcpy(to,from,len)
#endif
#ifdef USEBZERO
#define BZERO(from,len) bzero(from,len)
#else
#define BZERO(from,len) memset(from,0,len)
#endif
#ifdef USESTRCHR
#define STRCHR strchr
#else
#define STRCHR index
#endif
$DEFCROSS CROSS
GAZONK
if [ -n "$TRANSFER_CNT" ]; then
cat <<GAZONK >>config.h
#define TRANSFER_CNT $TRANSFER_CNT
GAZONK
fi
if [ ! -z "$FORT" ]; then
cat <<GAZONK >>config.h
/* Fortran options */
#define KLIC_FORT "$FORT"
#define KLIC_FORT_OPTIONS "$FFLAGS"
#define KLIC_FORT_LD "$FORTLD"
#define KLIC_FORT_LD_OPTIONS "$KLICLDOPTIONS"
GAZONK
fi
#echo ' '
if [ -n "$INCLUDESH" ] ; then
. ./$INCLUDESH
fi
echo "# Writing out Makefile"
cat <<GAZONK >Makefile
# Copyright 1993, 1994, 1995 Institute for New Generation Computer Technology
# Read COPYRIGHT for detailed information
#
# Top-level Makefile for KLIC system
# This file was created by KLIC configuration script.
# Date of Confuguration: `date`
# Configured by: ${USER:-unknown}
########################################
# Shell
########################################
SHELL = /bin/sh
########################################
# Directory Names
########################################
# Include file directory
KLICINCLUDE = $KLICINCLUDE
# Library directory
KLICLIB = $KLICLIB
# Executable directory
KLICBIN = $KLICBIN
########################################
# Libraries to build
########################################
ARCHIVES = $ARCHIVES
########################################
# System-dependent switches
########################################
# LN: link command to use for system compilation.
LN = $LN
# KL1CMP: KL1 to C compiler used for compiling the self compiler.
# Only for system developers and not for normal users.
KL1CMP = $KL1CMP
# C compiler
CC = $CC
LD = $LD
# Optimization flags for compiling the runtime system by CC.
OPTLEVEL = $OPTLEVEL
OPTFLAGS = $OPTFLAGS
KLICOPT = $KLICOPT $DEBUGFLAGS
DEBUGFLAGS = $DEBUGFLAGS
# Additional CC flags for optimized compilation of KL1 programs.
UOPTFLAGS = $UOPTFLAGS
# Library search flags
LIBSWITCHES = $LIBSWITCHES
# Library archive indexer
RANLIB = $RANLIB
# Make program
MAKE = $MAKE
# Installer
INSTALL = $INSTALL
INSTDIR = $INSTDIR
INSTALLHDR = /bin/cp -p
# Maximum parallelism in compilation
PARALLEL = $INSTPARALLEL
GAZONK
if $DISTSYSTEM ; then
cat <<GAZONK >>Makefile
DISTSYSTEM = $disttype
GAZONK
fi
if $PARALLEL; then
cat <<GAZONK >>Makefile
NODES = $NODES
GAZONK
fi
. ./$ROOTMAKE
cat <Makefile.tail >>Makefile ||
give_up_config "Can't create makefile properly"
echo ' '
echo "# Writing out runtime/Makefile"
cat <runtime/Makefile.head >runtime/Makefile ||
give_up_config "Can't create runtime/makefile properly"
echo ' '
if $DISTSYSTEM ; then
. runtime/config/$disttype/runtime.mk.sh >> runtime/Makefile
else
cat <<GAZONK >>runtime/Makefile
DISTCFLAGS = \$(CFLAGS) -DDEBUGLIB -DDIST -I../include
EXT_OTHER_HEADERS =
DIST_OTHER_SRCS =
DIST_OTHER_OBJS =
GAZONK
fi
cat <runtime/Makefile.tail >>runtime/Makefile ||
give_up_config "Can't create runtime/makefile properly"
echo ' '
cat <runtime/config/$disttype/runtimedep.mk >>runtime/Makefile ||
give_up_config "Can't create runtime/makefile properly"
echo ' '
echo "# Writing out include/Makefile"
if $DISTSYSTEM ; then
. runtime/config/$disttype/include.mk.sh > include/Makefile
cat <include/Makefile.tail >>include/Makefile ||
give_up_config "Can't create include/makefile properly"
echo ' '
else
cat <<GAZONK >include/Makefile
DIST_OTHER_HEADERS =
GAZONK
cat < include/Makefile.tail >>include/Makefile ||
give_up_config "Can't create include/makefile properly"
echo ' '
fi
mv config.h include/klic ||
give_up_config "Can't move config.h to an appropriate place"
clean_up_config
echo "# Writing out $def_setting"
rm -f $def_setting;mv config.tmp $def_setting
echo ' '
if $DISTSYSTEM; then
(cd runtime; LN=$LN ./setupcomm $disttype)
fi
cat <<GAZONK
# All set! Now you can compile the KLIC system by typing in "make all".
# If compilation is OK, I'd recommend testing it by running "make tests".
GAZONK
if $DISTSYSTEM; then
cat <<GAZONK
# And you can check distributed memory implemetation
# by runnning "make disttests".
GAZONK
fi
cat <<GAZONK
# After checking(s), you can inform us your installation information
# via e-mail just by running "make mail". We hope that you send us your
# report.
#
# You can then install the system by "make install".
#
# Good Luck! Please report problems to "klic-bugs@icot.or.jp".
GAZONK
|