1#! /bin/csh
2#
3# installation script for the LASPack library
4#
5# written by Tomas Skalicky, August 1995
6# with some changes by Eric van der Maarel
7#
8# This script builds and installs the libraries liblaspack.a and libxc.a
9# in the directory $HOME/lib$ARCH_EXT.
10# It also builds the test programs and installs them in the directory
11# $HOME/bin$ARCH_EXT.
12#
13# The (enviroment) variable $ARCH_EXT can be used in order
14# to install libraries and programs in different directories
15# depending on computer the architecture,
16# it could be set e.g. to ARCH_EXT = '/sunos' for Sun workstations,
17# '/hp-ux' for HP workstations...
18#
19
20set dir = `pwd`
21set env_var = `env | grep ARCH_EXT`
22
23#
24# fitting of the makefiles
25#
26
27rm -f install.sed
28
29cat << EOT > install.sed
30/sources/ s/INCROOT/# INCROOT/
31/sources/ a\
32INCROOT		= $dir
33EOT
34
35if ( $env_var == "" ) echo '/\$ARCH_EXT/ s/\$ARCH_EXT//g' >> install.sed
36
37if ( ! -x /usr/bin/ranlib ) echo "/ranlib/ s/^#*/#/" >> install.sed
38
39foreach f ( */makefile */*/*/makefile )
40    rm -f $f~
41    sed -f install.sed $f > $f~
42    cp $f~ $f
43end
44
45rm -f install.sed
46
47#
48# generation of binaries
49#
50
51if ( $1 == "local" ) then
52    if ( ! -d /usr/local/lib ) mkdir /usr/local/lib
53    if ( ! -d /usr/local/include ) mkdir /usr/local/include
54    if ( ! -d /usr/local/bin ) mkdir /usr/local/bin
55else
56    if ( ! -d $HOME/lib ) mkdir $HOME/lib
57    if ( ! -d $HOME/include ) mkdir $HOME/include
58    if ( ! -d $HOME/bin ) mkdir $HOME/bin
59    if ( $env_var != "" ) then
60        if ( ! -d $HOME/lib$ARCH_EXT ) mkdir $HOME/lib$ARCH_EXT
61        if ( ! -d $HOME/bin$ARCH_EXT ) mkdir $HOME/bin$ARCH_EXT
62    endif
63endif
64
65foreach d ( \
66	xc \
67	laspack \
68	laspack/examples/mlstest \
69	laspack/examples/lastest \
70	laspack/examples/vectopt \
71	laspack/examples/matropt \
72)
73	echo ''
74	echo "directory: $d"
75	echo ''
76        if ( $1 == "local" ) then
77 	    csh -c "cd $d; make clean; make install-local"
78        else
79	    csh -c "cd $d; make clean; make install"
80	endif
81end
82
83rehash
84echo ""
85echo "LASPack installed."
86
87sleep 5
88
89#
90# check
91#
92
93echo ""
94cd laspack/check
95echo ""
96check
97echo ""
98cd ../..
99