-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure
executable file
·199 lines (153 loc) · 5.72 KB
/
configure
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
#!/bin/bash
# Define all functions
# Sets the variable to the one specified by the user.
# Parameters
# 1 - Variable Name
# 2 - Default Value
# 3 - Description
function set_param {
echo "Variable Name: $1"
echo $3
echo "Current Value: $2"
echo -n "New Value (Enter to keep current value): "
read return_value
if [ -z "$return_value" ]; then
return_value=$2
fi
echo "Variable Is Set To : $return_value"
echo ""
}
# Tests whether the specified file exists in the directory.
# Used to verify whether the locations of the packages are accurate.
# Parameters
# 1 - Package name
# 2 - Directory
# 3 - File
function check_package_terminate {
echo -n "Checking whether $1 is configured properly... "
if [ -f $2/$3 ]; then
echo "Success!"
else
echo ""
echo ""
echo "ERROR: $1 does not contain $3."
echo " Package does not exist at this location : \"$2\"."
echo " Terminating configure. No files created."
exit 1
fi
}
# This is the "main function"
echo "Starting configure script for SNOGoggles..."
echo " "
echo -n "Would you like to set snocave libraries individually? [No]: "
read SET_NOT_SNOCAVE
echo " "
GLEWROOT=/usr
if [ "$SET_NOT_SNOCAVE" = "Yes" ]; then
set_param GEANT4ROOT "" "The home directory of Geant4."
GEANT4ROOT=$return_value
set_param ROOTSYS "" "The home directory of ROOT."
ROOTSYS=$return_value
set_param SCONSROOT "" "The home directory of SCons."
SCONSROOT=$return_value
set_param RATROOT "" "The home directory of RAT."
RATROOT=$return_value
set_param AVALANCHEROOT "" "The home directory of avalanche."
AVALANCHEROOT=$return_value
set_param SFMLROOT "" "Path to the SFML directory."
SFMLROOT=$return_value
set_param XERCESCROOT "" "Path to the Xerces-C++ home directory."
XERCESCROOT=$return_value
set_param BZIPROOT "/usr" "Path to the bzip2 install directory."
BZIPROOT=$return_value
set_param CURLROOT "/usr" "Path to the curl install directory."
CURLROOT=$return_value
else
set_param SNOCAVE_DIR "" "Path to the snocave directory."
SNOCAVE_DIR=$return_value
RATROOT=$SNOCAVE_DIR/rat
GEANT4ROOT=$SNOCAVE_DIR/libraries/geant4.9.4.p01
ROOTSYS=$SNOCAVE_DIR/libraries/root-5.32.00
SCONSROOT=$SNOCAVE_DIR/libraries/scons-2.1.0
AVALANCHEROOT=$SNOCAVE_DIR/libraries/avalanche
SFMLROOT=$SNOCAVE_DIR/libraries/sfml-2.0
XERCESCROOT=$SNOCAVE_DIR/libraries/xerces-c-3.1.1
# bzip2 and curl do not come in the snocave - assume they are installed
# globally on the machine
BZIPROOT=/usr
CURLROOT=/usr
fi
echo "Testing to ensure that all packages exist at specified directories..."
check_package_terminate RAT $RATROOT include/RAT/DS/EV.hh
check_package_terminate Geant4 $GEANT4ROOT include/G4Event.hh
# Checks whether Geant4 has GDML_BUILD_ENABLED
if [ -f $GEANT4ROOT/include/G4GDMLParser.hh ]; then
echo " Geant4 also has the GDML parser built!"
else
echo " WARNING: Geant4 does not have the GDML parser built!"
echo " May cause compilation failure."
fi
check_package_terminate ROOT $ROOTSYS include/TVector3.h
check_package_terminate SCons $SCONSROOT scons.1
check_package_terminate SFML $SFMLROOT include/SFML/OpenGL.hpp
check_package_terminate Xerces-C++ $XERCESCROOT include/xercesc/dom/DOM.hpp
check_package_terminate GLEW $GLEWROOT include/GL/glew.h
check_package_terminate avalanche $AVALANCHEROOT lib/libavalanche.so
check_package_terminate bzip2 $BZIPROOT include/bzlib.h
check_package_terminate cURL $CURLROOT include/curl/curl.h
echo ""
# env.ssh
echo -n "Creating env.sh... "
rm -f env.sh
echo '####### SNOGoggles environment #######' > env.sh
echo ' ' >> env.sh
echo 'export VIEWERROOT='$PWD >> env.sh
echo ' ' >> env.sh
echo 'source '$GEANT4ROOT'/env.sh' >> env.sh
echo ' ' >> env.sh
echo 'export RATROOT='$RATROOT >> env.sh
echo 'export ROOTSYS='$ROOTSYS >> env.sh
echo 'export SFMLROOT='$SFMLROOT >> env.sh
echo 'export XERCESCROOT='$XERCESCROOT >> env.sh
echo 'export AVALANCHEROOT='$AVALANCHEROOT >> env.sh
echo 'export GLEWROOT='$GLEWROOT >> env.sh
echo 'export BZIPROOT='$BZIPROOT >> env.sh
echo 'export CURLROOT='$CURLROOT >> env.sh
echo ' ' >> env.sh
echo 'export PATH=$PATH:'$SCONSROOT'/script:$VIEWERROOT/bin' >> env.sh
echo 'export PYTHONPATH='$SCONSROOT'/engine:$VIEWERROOT/python' >> env.sh
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib:$SFMLROOT/lib:$XERCESCROOT/lib:$GLEWROOT/lib:$AVALANCHEROOT/lib/cpp:$RATROOT/lib:$BZIPROOT/lib:$CURLROOT/lib' >> env.sh
echo ' ' >> env.sh
echo "Done."
# env.csh
echo -n "Creating env.csh... "
rm -f env.csh
echo '####### SNOGoggles environment #######' > env.csh
echo ' ' >> env.csh
echo 'setenv VIEWERROOT {$PWD}' >> env.csh
echo ' ' >> env.csh
echo 'source '$GEANT4ROOT'/env.csh' >> env.csh
echo ' ' >> env.csh
echo 'unsetenv RATROOT' >> env.csh
echo 'unsetenv ROOTSYS' >> env.csh
echo 'unsetenv SFMLROOT' >> env.csh
echo 'unsetenv XERCESCROOT' >> env.csh
echo 'unsetenv GLEWROOT' >> env.csh
echo 'unsetenv PYTHONPATH' >> env.csh
echo ' ' >> env.csh
echo 'setenv RATROOT '$RATROOT >> env.csh
echo 'setenv ROOTSYS '$ROOTSYS >> env.csh
echo 'setenv SFMLROOT '$SFMLROOT >> env.csh
echo 'setenv XERCESCROOT '$XERCESCROOT >> env.csh
echo 'setenv AVALANCHEROOT '$AVALANCHEROOT >> env.csh
echo 'setenv GLEWROOT '$GLEWROOT >> env.csh
echo 'setenv BZIPROOT '$BZIPROOT >> env.csh
echo 'setenv CURLROOT '$CURLROOT >> env.csh
echo ' ' >> env.csh
echo 'setenv PATH {$PATH}:'$SCONSROOT'/script:{$VIEWERROOT}/bin' >> env.csh
echo 'setenv PYTHONPATH '$SCONSROOT'/engine:{$VIEWERROOT}/python' >> env.csh
echo 'setenv LD_LIBRARY_PATH {$LD_LIBRARY_PATH}:{$ROOTSYS}/lib:{$SFMLROOT}/lib:{$XERCESCROOT}/lib:{$GLEWROOT}/lib:{$AVALANCHEROOT}/lib/cpp:{$RATROOT}/lib:{$BZIPROOT}/lib:{$CURLROOT}/lib' >> env.csh
echo ' ' >> env.csh
echo "Done."
echo ""
echo "Configure complete!"