update changelog
[debian/splat] / configure
1 #!/bin/bash
2
3 ##############################################################################
4 # Simple script to configure, compile (and if you're 'root', install) SPLAT! #
5 # and associated utilities.  Written by John A. Magliacane, KD2BD May 2002   #
6 #                          Last update: March 2009                           #
7 ##############################################################################
8
9 ans=""
10 whoami=`whoami`
11
12 until [ "$ans" = "2" ] || [ "$ans" = "3" ] || [ "$ans" = "4" ] || [ "$ans" = "5" ] || [ "$ans" = "6" ] || [ "$ans" = "7" ] || [ "$ans" = "8" ]; do
13
14         clear
15         echo
16         echo -e "\t  ******************************************************"
17         echo -e "\t  **   SPLAT! Standard Resolution Mode Configuration  **"
18         echo -e "\t  ******************************************************\n"
19         echo -e "\t   Please select the Maximum Analysis Region capability"
20         echo -e "\t   you would like SPLAT! to possess when operating in"
21         echo -e "\t   3 arc-second (standard) resolution mode based on"
22         echo -e "\t   your available memory resources:\n"
23         echo -e "\t   Maximum Analysis Region       RAM + Swap Requirement"
24         echo -e "\t   ====================================================\n"
25         echo -e "\t   (2)  2 x 2 Degrees  ---------   25 Megabytes minimum"
26         echo -e "\t   (3)  3 x 3 Degrees  ---------   52 Megabytes minimum"
27         echo -e "\t   (4)  4 x 4 Degrees  ---------   95 Megabytes minimum"
28         echo -e "\t   (5)  5 x 5 Degrees  ---------  145 Megabytes minimum"
29         echo -e "\t   (6)  6 x 6 Degrees  ---------  210 Megabytes minimum"
30         echo -e "\t   (7)  7 x 7 Degrees  ---------  285 Megabytes minimum"
31         echo -e "\t   (8)  8 x 8 Degrees  ---------  370 Megabytes minimum\n"
32         echo -n "Your choice: "
33         read ans
34 done
35
36 # Build std-parms.h file that will be copied into splat.h at compilation time
37
38 echo "/*" > std-parms.h
39 echo "  Parameters for 3 arc-second standard resolution mode of operation" >> std-parms.h
40 echo -e "  Generated by $0 by "$whoami" on "`date`"\n*/" >> std-parms.h
41
42 echo "#define HD_MODE 0" >> std-parms.h
43
44 if [ "$ans" = "2" ]; then
45         echo "#define MAXPAGES 4" >> std-parms.h
46 fi
47
48 if [ "$ans" = "3" ]; then
49         echo "#define MAXPAGES 9" >> std-parms.h
50 fi
51
52 if [ "$ans" = "4" ]; then
53         echo "#define MAXPAGES 16" >> std-parms.h
54 fi
55
56 if [ "$ans" = "5" ]; then
57         echo "#define MAXPAGES 25" >> std-parms.h
58 fi
59
60 if [ "$ans" = "6" ]; then
61         echo "#define MAXPAGES 36" >> std-parms.h
62 fi
63
64 if [ "$ans" = "7" ]; then
65         echo "#define MAXPAGES 49" >> std-parms.h
66 fi
67
68 if [ "$ans" = "8" ]; then
69         echo "#define MAXPAGES 64" >> std-parms.h
70 fi
71
72 ans=""
73
74 until [ "$ans" = "0" ] || [ "$ans" = "1" ] || [ "$ans" = "2" ] || [ "$ans" = "3" ] || [ "$ans" = "4" ] || [ "$ans" = "5" ] || [ "$ans" = "6" ] || [ "$ans" = "7" ] || [ "$ans" = "8" ]; do
75
76         clear
77         echo
78         echo -e "\t  ******************************************************"
79         echo -e "\t  **   SPLAT! HD High Resolution Mode Configuration   **"
80         echo -e "\t  ******************************************************\n"
81         echo -e "\t   Please select the Maximum Analysis Region capability"
82         echo -e "\t   you would like SPLAT! to possess when operating in"
83         echo -e "\t   1 arc-second (HD) resolution mode based on your"
84         echo -e "\t   available memory resources (select 8x8 with caution):\n"
85         echo -e "\t   Maximum Analysis Region       RAM + Swap Requirement"
86         echo -e "\t   ====================================================\n"
87         echo -e "\t   (1)  1 x 1 Degrees  ---------   52 Megabytes minimum"
88         echo -e "\t   (2)  2 x 2 Degrees  ---------  225 Megabytes minimum"
89         echo -e "\t   (3)  3 x 3 Degrees  ---------  468 Megabytes minimum"
90         echo -e "\t   (4)  4 x 4 Degrees  ---------  855 Megabytes minimum"
91         echo -e "\t   (5)  5 x 5 Degrees  --------- 1305 Megabytes minimum"
92         echo -e "\t   (6)  6 x 6 Degrees  --------- 1890 Megabytes minimum"
93         echo -e "\t   (7)  7 x 7 Degrees  --------- 2565 Megabytes minimum"
94         echo -e "\t   (8)  8 x 8 Degrees  --------- 3330 Megabytes minimum"
95         echo -e "\t   (0)  None of the above.  Do not build SPLAT! HD.\n"
96         echo -n "Your choice: "
97         read ans
98 done
99
100 if [ "$ans" != "0" ]; then
101
102         # Build hd-parms.h file that will be copied into splat.h at compilation time
103
104         echo "/*" > hd-parms.h
105         echo "  Parameters for 1 arc-second high resolution mode of operation" >> hd-parms.h
106         echo -e "  Generated by $0 by "$whoami" on "`date`"\n*/" >> hd-parms.h
107
108         echo "#define HD_MODE 1" >> hd-parms.h
109
110         if [ "$ans" = "1" ]; then
111                 echo "#define MAXPAGES 1" >> hd-parms.h
112         fi
113
114         if [ "$ans" = "2" ]; then
115                 echo "#define MAXPAGES 4" >> hd-parms.h
116         fi
117
118         if [ "$ans" = "3" ]; then
119                 echo "#define MAXPAGES 9" >> hd-parms.h
120         fi
121
122         if [ "$ans" = "4" ]; then
123                 echo "#define MAXPAGES 16" >> hd-parms.h
124         fi
125
126         if [ "$ans" = "5" ]; then
127                 echo "#define MAXPAGES 25" >> hd-parms.h
128         fi
129
130         if [ "$ans" = "6" ]; then
131                 echo "#define MAXPAGES 36" >> hd-parms.h
132         fi
133
134         if [ "$ans" = "7" ]; then
135                 echo "#define MAXPAGES 49" >> hd-parms.h
136         fi
137
138         if [ "$ans" = "8" ]; then
139                 echo "#define MAXPAGES 64" >> hd-parms.h
140         fi
141
142         else
143                 rm -r hd-parms.h
144 fi
145
146 clear
147 echo -e "\n\n            *****************************************************"
148  
149 echo "            *  Now building SPLAT! and associated utilities...  *"
150 echo "            *****************************************************"
151 echo
152 ./build all
153 if [ "$whoami" = "root" ]; then
154         echo -e "\nNow installing SPLAT! and associated utilities..."
155         echo
156         ./install all
157 else
158         echo
159         echo "To install SPLAT! and its associated utilities, please"
160         echo "su to 'root' and execute the install script as follows:"
161         echo
162         echo -e "\t./install all"
163 fi
164 echo
165 echo "Don't forget to read the documentation under the docs directory"
166 echo "as well as the various README files in the splat and splat/utils"
167 echo -e "directories.  Enjoy the program!  John, KD2BD\n\n"
168