]>
Commit | Line | Data |
---|---|---|
f97ec6ec | 1 | # -*- Autoconf -*- |
2 | # Process this file with autoconf to produce a configure script. | |
3 | AC_PREREQ(2.59) | |
4 | AC_INIT( [Photos C++ Interface - examples], [1.0.0], [tomasz.przedzinski@uj.edu.pl] ) | |
5 | AC_LANG_CPLUSPLUS | |
6 | ||
7 | ############################################################################## | |
8 | # This must be done before we load paths from configure.paths.sh! | |
9 | env_mc_tester=$MCTESTERLOCATION | |
10 | env_pythia8data=$PYTHIA8DATA | |
11 | ||
12 | hepmclocation=$HEPMCLOCATION | |
13 | photoslocation=$PHOTOSLOCATION | |
14 | tauolalocation=$TAUOLALOCATION | |
15 | mctesterlocation=$MCTESTERLOCATION | |
16 | pythialocation=$PYTHIALOCATION | |
17 | ############################################################################## | |
18 | # Find Photos source code location and load paths | |
19 | ||
20 | echo "" | |
21 | ||
22 | AC_MSG_CHECKING([if Photos location defined]) | |
23 | AC_ARG_WITH( | |
24 | [photos], | |
25 | [AS_HELP_STRING([--with-photos], [Path to Photos installation (needed if examples are separated from Photos source code)] )], | |
26 | [AC_MSG_RESULT($with_photos)], | |
27 | [ | |
28 | with_photos=`(cd ..; pwd)` | |
29 | AC_MSG_RESULT($with_photos (automatic)) | |
30 | ] | |
31 | ) | |
32 | ||
33 | ### Load configure.paths.sh | |
34 | ||
35 | if test -e "$with_photos/configure.paths.sh"; then | |
36 | source $with_photos/configure.paths.sh | |
37 | elif test -e "$photoslocation/configure.paths.sh"; then | |
38 | source $photoslocation/configure.paths.sh | |
39 | with_photos=$photoslocation | |
40 | fi | |
41 | ||
42 | ############################################################################## | |
43 | ### Check if other locations are defined | |
44 | ||
45 | ### Prefer configure.paths.sh than environment paths | |
46 | ||
47 | if test ! -z "$HEPMCLOCATION"; then | |
48 | hepmclocation=$HEPMCLOCATION | |
49 | fi | |
50 | ||
51 | if test ! -z "$TAUOLALOCATION"; then | |
52 | tauolalocation=$TAUOLALOCATION | |
53 | fi | |
54 | ||
55 | if test ! -z "$MCTESTERLOCATION"; then | |
56 | mctesterlocation=$MCTESTERLOCATION | |
57 | fi | |
58 | ||
59 | if test ! -z "$PYTHIALOCATION"; then | |
60 | pythialocation=$PYTHIALOCATION | |
61 | fi | |
62 | ||
63 | ### Force all paths if AFS_PATHS was defined | |
64 | ||
65 | if test "$AFS_PATHS" == "yes"; then | |
66 | with_hepmc=$HEPMCLOCATION | |
67 | with_mc_tester=$MCTESTERLOCATION | |
68 | with_pythia8=$PYTHIALOCATION | |
69 | fi | |
70 | ||
71 | ############################################################################## | |
72 | # Process command line options | |
73 | ||
74 | echo "" | |
75 | ||
76 | AC_MSG_CHECKING([if Tauola location defined]) | |
77 | AC_ARG_WITH( | |
78 | [tauola], | |
79 | [AS_HELP_STRING([--with-tauola], [Path to Tauola C++ v1.0.5 or later] )],, | |
80 | [with_tauola=$tauolalocation] | |
81 | ) | |
82 | AC_MSG_RESULT([$with_tauola]) | |
83 | ||
84 | AC_MSG_CHECKING([if MC-TESTER location defined]) | |
85 | AC_ARG_WITH( | |
86 | [mc-tester], | |
87 | [AS_HELP_STRING([--with-mc-tester], [Path to MC-TESTER 1.23 or later] )],, | |
88 | [with_mc_tester=$mctesterlocation] | |
89 | ) | |
90 | AC_MSG_RESULT([$with_mc_tester]) | |
91 | ||
92 | AC_MSG_CHECKING([if Pythia 8 location defined]) | |
93 | AC_ARG_WITH( | |
94 | [pythia8], | |
95 | [AS_HELP_STRING([--with-pythia8], [Path to Pythia 8.1 or later] )],, | |
96 | [with_pythia8=$pythialocation] | |
97 | ) | |
98 | AC_MSG_RESULT([$with_pythia8]) | |
99 | ||
100 | ||
101 | AC_MSG_CHECKING([if HepMC location is defined]) | |
102 | AC_ARG_WITH( | |
103 | [hepmc], | |
104 | [AS_HELP_STRING([--with-hepmc], [Path to HepMC 2.xx] )],, | |
105 | [with_hepmc=$hepmclocation] | |
106 | ) | |
107 | AC_MSG_RESULT([$with_hepmc]) | |
108 | ||
109 | echo "" | |
110 | ############################################################################## | |
111 | # Check for HepMC header files | |
112 | CPPFLAGS="-I$with_hepmc/include $CPPFLAGS" | |
113 | ||
114 | AC_CHECK_HEADERS([HepMC/Version.h], | |
115 | HAS_HEPMC=1, | |
116 | [ HAS_HEPMC=0 && | |
117 | echo "" && | |
118 | echo "INFO: HepMC not found. To provide location use:" && | |
119 | echo " './configure --with-hepmc=<path_to_HepMC>' " | |
120 | echo " (Consider using 'source platform/afs.paths.sh' (or .csh) )" | |
121 | echo "" | |
122 | ]) | |
123 | ||
124 | ############################################################################## | |
125 | # Check for Photos | |
126 | CPPFLAGS="-I$with_photos/include $CPPFLAGS" | |
127 | ||
128 | AC_CHECK_HEADER([Photos/Photos.h], , | |
129 | [ echo "" && | |
130 | echo "ERROR: Photos not found. To provide location use:" && | |
131 | echo " './configure --with-photos=<path_to_Photos>' " | |
132 | echo "" | |
133 | exit 0 | |
134 | ]) | |
135 | ||
136 | ############################################################################## | |
137 | # Check for Tauola | |
138 | CPPFLAGS="-I$with_tauola/include $CPPFLAGS" | |
139 | ||
140 | AC_CHECK_HEADER([Tauola/Tauola.h], | |
141 | HAS_TAUOLA=1, | |
142 | [ HAS_TAUOLA=0 && | |
143 | echo "" && | |
144 | echo "INFO: Tauola not found. To provide location use:" && | |
145 | echo " './configure --with-tauola=<path_to_Tauola>' " | |
146 | echo "" | |
147 | ]) | |
148 | ||
149 | ############################################################################## | |
150 | # Check for ROOT | |
151 | ||
152 | AC_CHECK_PROG(HAS_ROOT_CONFIG,root-config,[yes],[no]) | |
153 | ||
154 | if test "$HAS_ROOT_CONFIG" == "no"; then | |
155 | HAS_ROOT=0 | |
156 | echo "" | |
157 | echo "INFO: root-config not found. ROOT is not installed or path" | |
158 | echo " to ROOT bin folder not provied via \$PATH variable. Use:" | |
159 | echo " export PATH=\$PATH:<path_to_root>/bin" | |
160 | echo " export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\`root-config --libdir\`" | |
161 | echo " (consider using 'source platform/afs.paths.sh' (or .csh) )" | |
162 | echo "" | |
163 | else | |
164 | AC_CHECK_PROG(HAS_ROOT_EXE,root,[yes],[no]) | |
165 | if test "$HAS_ROOT_EXE" == "no"; then | |
166 | HAS_ROOT=0; | |
167 | echo "" | |
168 | echo "INFO: root-config exists but root not found." | |
169 | else | |
170 | ROOTLIB=`root-config --glibs` | |
171 | ROOTINC=`root-config --cflags` | |
172 | CPPFLAGS="$ROOTLIB $ROOTINC $CPPFLAGS" | |
173 | AC_CHECK_HEADER([TROOT.h], | |
174 | HAS_ROOT=1, | |
175 | [ HAS_ROOT=0 && | |
176 | echo "" && | |
177 | echo "INFO: ROOT header file cannot be compiled." | |
178 | ]) | |
179 | fi | |
180 | if test $HAS_ROOT = 0; then | |
181 | echo " This indicates faulty or unusual ROOT installation." | |
182 | echo " Verify that location of both 'root' and 'root-config' " | |
183 | echo " is provided via \$PATH." | |
184 | echo " MC-Tester will not be used." | |
185 | echo "" | |
186 | fi | |
187 | fi | |
188 | ||
189 | ############################################################################## | |
190 | # Check for MC-Tester | |
191 | CPPFLAGS="-I$with_mc_tester/include $CPPFLAGS" | |
192 | ||
193 | if test $HAS_ROOT = 1; then | |
194 | AC_CHECK_HEADER([Generate.h], | |
195 | HAS_MC_TESTER=1, | |
196 | [ HAS_MC_TESTER=0 && | |
197 | echo "" && | |
198 | echo "INFO: MC-Tester not found. To provide location use:" && | |
199 | echo " './configure --with-mc-tester=<path_to_MC_Tester>' " | |
200 | echo "" | |
201 | ]) | |
202 | if test $HAS_MC_TESTER = 1; then | |
203 | AC_CHECK_HEADER([HepMCParticle.H], , | |
204 | [ HAS_MC_TESTER=0 && | |
205 | echo "" && | |
206 | echo "INFO: MC-Tester has been compiled without the required" && | |
207 | echo " library 'libHepMCEvent'. MC-Tester will not be used." && | |
208 | echo "" | |
209 | ]) | |
210 | fi | |
211 | echo "checking for MCTESTERLOCATION: $env_mc_tester" | |
212 | if test $HAS_MC_TESTER = 1 && test -z "$env_mc_tester"; then | |
213 | echo "" | |
214 | echo "WARNING: MC-Tester location is valid, however MCTESTERLOCATION" | |
215 | echo " variable required by MC-Tester scripts is not set." | |
216 | echo " Without it, examples will compile and execute correctly," | |
217 | echo " but scripts in examples/testing/* won't work. " | |
218 | echo " Use 'source $with_photos/configure.paths.sh' (or .csh) to set this variable." | |
219 | echo "" | |
220 | fi | |
221 | else | |
222 | HAS_MC_TESTER=0 | |
223 | fi | |
224 | ||
225 | ############################################################################## | |
226 | # Check for Pythia | |
227 | CPPFLAGS="-I$with_pythia8/include $CPPFLAGS" | |
228 | ||
229 | AC_CHECK_HEADER([Pythia.h], | |
230 | HAS_PYTHIA=1, | |
231 | [ HAS_PYTHIA=0 && | |
232 | echo "" && | |
233 | echo "INFO: Pythia8 not found. To provide location use:" && | |
234 | echo " './configure --with-pythia8=<path_to_Pythia8>' " | |
235 | echo "" | |
236 | ]) | |
237 | ||
238 | if test $HAS_PYTHIA = 1; then | |
239 | AC_CHECK_HEADER([HepMCInterface.h], , | |
240 | [ HAS_PYTHIA=0 && | |
241 | echo "" && | |
242 | echo "WARNING: Pythia8 has been compiled without the required" && | |
243 | echo " library 'libhepmcinterface'. Pythia8 will not be used." && | |
244 | echo "" | |
245 | ]) | |
246 | echo "checking for PYTHIA8DATA: $env_pythia8data" | |
247 | if test $HAS_PYTHIA = 1 && test -z "$env_pythia8data"; then | |
248 | pythia8data=$with_pythia8/xmldoc | |
249 | echo "" | |
250 | echo "WARNING: Pythia8 location is valid, however PYTHIA8DATA" | |
251 | echo " variable required by Pythia is not set." | |
252 | echo " Without it, examples will compile, but Pythia cannot" | |
253 | echo " work properly. Refer to Pythia documentation." | |
254 | echo " Use 'source $with_photos/configure.paths.sh' (or .csh) to set this variable." | |
255 | echo "" | |
256 | fi | |
257 | fi | |
258 | ||
259 | if test $HAS_HEPMC = 0; then unset with_hepmc; fi | |
260 | if test $HAS_TAUOLA = 0; then unset with_tauola; fi | |
261 | if test $HAS_PYTHIA = 0; then unset with_pythia8; fi | |
262 | if test $HAS_MC_TESTER = 0; then unset with_mc_tester; fi | |
263 | ||
264 | ############################################################################## | |
265 | AC_SUBST(with_photos) | |
266 | AC_SUBST(with_hepmc) | |
267 | AC_SUBST(with_tauola) | |
268 | AC_SUBST(with_hepmc) | |
269 | AC_SUBST(pythia8data) | |
270 | AC_SUBST(with_pythia8) | |
271 | AC_SUBST(with_mc_tester) | |
272 | ||
273 | AC_CONFIG_FILES([make.inc]) | |
274 | ||
275 | ### Save paths (only if configure.paths.sh exists and is writable) | |
276 | if test -e "$with_photos/configure.paths.sh" && test -w "$with_photos/configure.paths.sh"; then | |
277 | AC_CONFIG_FILES([$with_photos/configure.paths.sh $with_photos/configure.paths.csh]) | |
278 | fi | |
279 | ||
280 | AC_OUTPUT | |
281 | ||
282 | ############################################################################## | |
283 | echo "Finished!" | |
284 | echo "---------" | |
285 | echo "" | |
286 | ||
287 | if test -e "$with_photos/configure.paths.sh"; then | |
288 | echo "Consider using 'source $with_photos/configure.paths.sh'" | |
289 | echo "(or .csh) for setting up several paths used by examples." | |
290 | fi | |
291 | ||
292 | if test $HAS_TAUOLA = 0 || test $HAS_PYTHIA = 0 || test $HAS_MC_TESTER = 0; then | |
293 | echo "" | |
294 | echo "Not all examples will be available." | |
295 | fi | |
296 | ||
297 | if test $HAS_TAUOLA = 0; then | |
298 | echo "Consider './configure --with-tauola=<path_to_Tauola>' " | |
299 | fi | |
300 | ||
301 | if test $HAS_PYTHIA = 0; then | |
302 | echo "Consider './configure --with-pythia8=<path_to_Pythia8>' " | |
303 | fi | |
304 | ||
305 | if test $HAS_MC_TESTER = 0; then | |
306 | unset with_mc_tester | |
307 | echo "Consider './configure --with-mc-tester=<path_to_MC_Tester>' " | |
308 | fi | |
309 | ||
310 | echo "" |