source: trunk/environments/g4py/configure@ 1358

Last change on this file since 1358 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

  • Property svn:executable set to *
File size: 15.1 KB
Line 
1#! /bin/sh -
2#$Id: configure,v 1.17 2009/11/20 03:36:51 kmura Exp $
3# ======================================================================
4# A configure script for Geant4Py
5# ======================================================================
6export LANG=C
7
8IFS='
9 '
10PATH=/bin:/usr/bin
11export PATH
12
13# ======================================================================
14# testing the echo features
15# ======================================================================
16if `(echo "testing\c"; echo 1,2,3) | grep c > /dev/null` ; then
17 if `(echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn > /dev/null`; then
18 ac_n= ac_c='
19' ac_t=' '
20 else
21 ac_n=-n ac_c= ac_t=
22 fi
23else
24 ac_n= ac_c='\c' ac_t=
25fi
26
27# ======================================================================
28# help message
29# ======================================================================
30show_help() {
31cat <<EOF
32\`configure' configures Geant4Py to adapt to many kinds of systems.
33
34Usage: ./configure SYSTEM [OPTION]... [VAR=VALUE]...
35
36SYSTEM: System type (see Supported Arhitectures)
37
38Options:
39 -h, --help Display this help and exit
40
41Installation directories:
42 --prefix=PREFIX Installation prefix [./]
43 --libdir=DIR Python modules dir [PREFIX/lib]
44
45Fine tuning of the library path:
46 --with-g4-incdir=DIR Geant4 header dir [\$G4INSTALL/include]
47 --with-g4-libdir=DIR Geant4 library dir [\$G4INSTALL/lib/\$G4SYSTEM]
48 --with-clhep-incdir=DIR CLHEP header dir [\$CLHEP_BASE_DIR/include]
49 --with-clhep-libdir=DIR CLHEP library dir [\$CLHEP_BASE_DIR/lib]
50 --with-clhep-lib=LIB library name of libCLHEP.so [CLHEP|\$CLHEP_LIB]
51
52 --with-python-incdir=DIR Python header dir [/usr/include/python(2.#)],
53 (location of pyconfig.h)
54 --with-python-libdir=DIR Python library dir [/usr/lib(64)]
55
56 --with-boost-incdir=DIR BOOST-C++ header dir [/usr/include],
57 (location of boost/)
58 --with-boost-libdir=DIR BOOST-C++ library dir [/usr/lib]
59 --with-boost-python-lib=LIB library name of libboost_python.so [boost_python]
60
61 --with-package-dir=DIR Geant4 Package dir
62
63 --with-extra-dir=DIR Install path for extra packages [/usr/local]
64
65 --with-xercesc-incdir=DIR Xerces-C header dir [/usr/include]
66 --with-xercesc-libdir=DIR Xerces-C library dir [/usr/lib(64)]
67
68Enable/disable options: prefix with either --enable- or --disable-
69 openglx OpenGLX support [auto]
70 openglxm OpenGLXm support [disable, \$G4VIS_USE_OPENGLXM]
71 raytracerx RayTracerX support [disable, \$G4VIS_USE_RAYTRACERX]
72
73Supported Architectures:
74 linux for Linux gcc 3.x and 4.x (32bit)
75 linux64 for Linux gcc 3.x and 4.x (64bit, alias to linuxx8664gcc)
76 linuxx8664gcc for AMD Opteron and Intel EM64T Linux gcc 3.x and 4.x
77 macosx for MacOSX with gcc (Tiger/Leopard and Xcode)
78
79EOF
80}
81
82# ======================================================================
83# main
84# ======================================================================
85# input
86arguments="$@"
87
88# default values
89prefix=`pwd`
90current_dir=`pwd`
91
92g4_incdir=/zzz
93g4_libdir=/zzz
94
95clhep_incdir=/zzz
96clhep_libdir=/zzz
97clhep_lib=${CLHEP_LIB:-CLHEP}
98
99python_incdir=/zzz
100boost_incdir=/usr/include
101boost_python_lib=boost_python
102
103enable_openglx=1
104enable_openglxm=${G4VIS_USE_OPENGLXM:+1}
105enable_openglxm=${enable_openglxm:-0}
106enable_raytracerx=${G4VIS_USE_RAYTRACERX:+1}
107enable_raytracerx=${enable_raytracerx:-0}
108enable_gl2ps=0
109
110enable_physicslist=0
111
112enable_gdml=0
113
114xercesc_incdir=/usr/include
115
116extra_dir=/usr/local
117
118# checking system
119case $1 in
120 linux|linux64|linuxx8664gcc|macosx)
121 system=$1
122 if [ $system = linux64 ]; then
123 system=linuxx8664gcc
124 fi
125 echo $ac_n "Checking for system type ... $ac_c"
126 if [ ! -e "config/sys/$system.gmk" ]; then
127 echo "no"
128 echo $ac_n "### Invalid system type. $ac_c"
129 echo "Please taka a look in config/sys/."
130 exit -1
131 fi
132 echo "$system"
133 ;;
134 --help|-h)
135 show_help
136 exit 0
137 ;;
138 *)
139 echo "Error: System type is not specified or more than one system type. "
140 echo ""
141 echo "Usage: ./configure SYSTEM [OPTION]... [VAR=VALUE]..."
142 echo ""
143 exit -1
144 ;;
145esac
146shift
147
148# parsing options
149while test $# -gt 0
150do
151 case $1 in
152 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
153 *) optarg= ;;
154 esac
155
156 case $1 in
157 --help|-h) show_help; exit 0 ;;
158 # ---------------------------------------------------------------
159 --prefix=*) prefix=$optarg ;;
160 --libdir=*) libdir=$optarg ;;
161 --with-package-dir=*) g4_incdir=$optarg/include/Geant4
162 g4_libdir=$optarg/lib
163 clhep_incdir=$optarg/include
164 clhep_libdir=$optarg/lib ;;
165 --with-g4-incdir=*) g4_incdir=$optarg ;;
166 --with-g4-libdir=*) g4_libdir=$optarg ;;
167 --with-clhep-incdir=*) clhep_incdir=$optarg ;;
168 --with-clhep-libdir=*) clhep_libdir=$optarg ;;
169 --with-clhep-lib=*) clhep_lib=$optarg ;;
170 --with-extra-dir=*) extra_dir=$optarg ;;
171 --with-python-incdir=*) python_incdir=$optarg ;;
172 --with-python-libdir=*) python_libdir=$optarg ;;
173 --with-boost-incdir=*) boost_incdir=$optarg ;;
174 --with-boost-libdir=*) boost_libdir=$optarg ;;
175 --with-boost-python-lib=*) boost_python_lib=$optarg ;;
176 --with-xercesc-incdir=*) xercesc_incdir=$optarg ;;
177 --with-xercesc-libdir=*) xercesc_libdir=$optarg ;;
178 # ---------------------------------------------------------------
179 --enable-openglx ) enable_openglx=1 ;;
180 --disable-openglx ) enable_openglx=0 ;;
181 --enable-openglxm ) enable_openglxm=1 ;;
182 --disable-openglxm ) enable_openglxm=0 ;;
183 --enable-raytracerx ) enable_raytracerx=1 ;;
184 --disable-raytracerx ) enable_raytracerx=0 ;;
185 # ---------------------------------------------------------------
186 -*)
187 echo "Unrecognized option: $1"
188 exit -1
189 ;;
190 *)
191 echo "Invalid argument: $1"
192 exit -1
193 ;;
194 esac
195 shift
196done
197
198# check variables
199arch=32
200if [ $system = linuxx8664gcc ]; then
201 arch=64
202fi
203
204shlib=so
205if [ $system = macosx ]; then
206shlib=dylib
207fi
208
209extra_incdir=$extra_dir/include
210if [ $arch = 64 ];then
211 extra_libdir=$extra_dir/lib64
212else
213 extra_libdir=$extra_dir/lib
214fi
215
216echo $ac_n "Checking for prefix ... $ac_c"
217echo $prefix
218
219echo $ac_n "Checking for lib dir ... $ac_c"
220libdir=${libdir:-$prefix/lib}
221echo $libdir
222
223echo $ac_n "Checking for G4 include dir ... $ac_c"
224g4_incdir1=${G4INSTALL:+$G4INSTALL/include}
225g4_incdir2=${G4INCLUDE:+$G4INCLUDE}
226set $g4_incdir $g4_incdir1 $g4_incdir2
227for adir in $*
228do
229 if [ -d "$adir" ]; then
230 g4_incdir=$adir
231 break
232 fi
233done
234
235if [ ! -d "$g4_incdir" ]; then
236 echo "no"
237 echo $ac_n "### $g4_incdir (g4-incdir) does not exist. $ac_c"
238 echo "Try --with-g4-incdir option."
239 exit -1
240fi
241echo "$g4_incdir"
242
243# ---
244echo $ac_n "Checking for G4 lib dir ... $ac_c"
245g4_libdir1=${G4INSTALL:+$G4INSTALL/lib/$G4SYSTEM}
246g4_libdir2=${G4LIB:+$G4LIB/$G4SYSTEM}
247set $g4_libdir/$G4SYSTEM $g4_libdir $g4_libdir1 $g4_libdir2
248for adir in $*
249do
250 if [ -d "$adir" ]; then
251 g4_libdir=$adir
252 break
253 fi
254done
255
256if [ ! -d "$g4_libdir" ]; then
257 echo "no"
258 echo $ac_n "### $g4_libdir (g4-libdir) does not exist. $ac_c"
259 echo "Try --with-g4-libdir option."
260 exit -1
261fi
262echo "$g4_libdir"
263
264echo $ac_n "Checking for G4 libs are shared libraray ... $ac_c"
265if [ ! -f ${g4_libdir}/libG4run.${shlib} ]; then
266 echo "no"
267 echo $ac_n "### G4 libray must be global and shared. $ac_c"
268 echo "Recompile with global and shared mode."
269 exit -1
270fi
271echo "ok"
272
273# ---
274clhep_incdir1=${CLHEP_INCLUDE_DIR:-/zzz}
275clhep_incdir2=${CLHEP_BASE_DIR:+$CLHEP_BASE_DIR/include}
276set $clhep_incdir $clhep_incdir1 $clhep_incdir2
277for adir in $*
278do
279 if [ -d "$adir" ]; then
280 clhep_incdir=$adir
281 break
282 fi
283done
284
285echo $ac_n "Checking for CLHEP include dir ... $ac_c"
286if [ ! -d "$clhep_incdir" ]; then
287 echo "no"
288 echo $ac_n "### $clhep_incdir (clhep-incdir) does not exist. $ac_c"
289 echo "Try --with-clhep-incdir option."
290 exit -1
291fi
292echo "$clhep_incdir"
293
294# ---
295clhep_libdir1=${CLHEP_LIB_DIR:-/zzz}
296clhep_libdir2=${CLHEP_BASE_DIR:+$CLHEP_BASE_DIR/lib}
297set $clhep_libdir $clhep_libdir1 $clhep_libdir2
298for adir in $*
299do
300 if [ -d "$adir" ]; then
301 clhep_libdir=$adir
302 break
303 fi
304done
305
306echo $ac_n "Checking for CLHEP lib dir ... $ac_c"
307if [ ! -d "$clhep_libdir" ]; then
308 echo "no"
309 echo $ac_n "### $clhep_libdir (clhep-libdir) does not exist. $ac_c"
310 echo "Try --with-clhep-libdir option."
311 exit -1
312fi
313echo "$clhep_libdir"
314
315echo $ac_n "Checking for CLHEP lib name ... $ac_c"
316if [ ! -f "$clhep_libdir"/lib${clhep_lib}.${shlib} ]; then
317 echo "no"
318 echo $ac_n "### lib${clhep_lib}.${shlib} (clhep-lib) does not exist. $ac_c"
319 echo "Try --with-clhep-lib option."
320 exit -1
321fi
322echo "lib${clhep_lib}.${shlib}"
323
324# ---
325echo $ac_n "Checking for Python include dir (pyconfig.h) ... $ac_c"
326# check version
327set python python2.6 python2.5 python2.4 python2.3 python2.2
328for aincdir in $*
329do
330 if [ -d /usr/include/"$aincdir" ]; then
331 python_incdir=/usr/include/$aincdir
332 break
333 fi
334done
335
336if [ ! -f "$python_incdir"/pyconfig.h ]; then
337 echo "no"
338 echo $ac_n "### $python_incdir (python-incdir) is invalid. $ac_c"
339 echo "Try --with-python-incdir option."
340 exit -1
341fi
342echo "$python_incdir"
343
344echo $ac_n "Checking for Python lib dir ... $ac_c"
345if [ ! $python_libdir ]; then
346 if [ $arch = 64 ]; then
347 python_libdir=/usr/lib64
348 else
349 python_libdir=/usr/lib
350 fi
351fi
352if [ ! -d "$python_libdir" ]; then
353 echo "no"
354 echo $ac_n "### $python_libdir (python-libdir) does not exist. $ac_c"
355 echo "Try --with-python-libdir option."
356 exit -1
357fi
358echo "$python_libdir"
359
360# ---
361echo $ac_n "Checking for Boost include dir (boost/python.hpp) ... $ac_c"
362set $boost_incdir $extra_incdir
363for adir in $*
364do
365 if [ -f "$adir"/boost/python.hpp ]; then
366 boost_incdir=$adir
367 break
368 fi
369done
370if [ ! -f "$boost_incdir"/boost/python.hpp ]; then
371 echo "no"
372 echo $ac_n "### $boost_incdir (boost-incdir) is invalid. $ac_c"
373 echo "Try --with-boost-incdir option."
374 exit -1
375fi
376echo "$boost_incdir"
377
378echo $ac_n "Checking for Boost version ... $ac_c"
379cat > conftest.cc <<EOF
380#include <boost/version.hpp>
381
382int main() {
383 if (BOOST_VERSION >= 103200)
384 return 0;
385 else
386 return 1;
387}
388EOF
389g++ -I$boost_incdir -o conftest conftest.cc > /dev/null 2>&1
390./conftest
391q_boost_version=$?
392rm conftest.cc conftest
393if [ $q_boost_version = 0 ]; then
394 echo "ok"
395else
396 echo "boost version >= 1.32.00 is required."
397 exit -1
398fi
399
400echo $ac_n "Checking for Boost lib dir ... $ac_c"
401if [ ! $boost_libdir ]; then
402 if [ $arch = 64 ]; then
403 boost_libdir=/usr/lib64
404 else
405 boost_libdir=/usr/lib
406 fi
407fi
408set $boost_libdir $extra_libdir
409for adir in $*
410do
411 if [ -f "$adir"/lib${boost_python_lib}.${shlib} ]; then
412 boost_libdir=$adir
413 break
414 fi
415done
416
417if [ ! -d "$boost_libdir" ]; then
418 echo "no"
419 echo $ac_n "### $boost_libdir (boost-libdir) does not exist. $ac_c"
420 echo "Try --with-boost-libdir option."
421 exit -1
422fi
423echo "$boost_libdir"
424
425echo $ac_n "Checking for Boost Python lib name ... $ac_c"
426if [ ! -f "$boost_libdir"/lib${boost_python_lib}.${shlib} ]; then
427 echo "no"
428 echo $ac_n "### lib${boost_python_lib}.${shlib} (boost-python-lib) does not exist. $ac_c"
429 echo "Try --with-boost-python-lib option."
430 exit -1
431fi
432echo "lib${boost_python_lib}.${shlib}"
433
434# ---
435echo $ac_n "Checking for OpenGL support ...$ac_c"
436if [ -f "$g4_libdir"/libG4OpenGL.${shlib} ]; then
437 if [ $enable_openglx = 0 ]; then
438 echo "disabled"
439 else
440 echo "yes"
441 fi
442else
443 echo "no"
444 enable_openglx=0
445fi
446
447# ---
448echo $ac_n "Checking for GL2PS support ...$ac_c"
449if [ -f "$g4_libdir"/libG4gl2ps.${shlib} ]; then
450 echo "yes"
451 enable_gl2ps=1
452else
453 echo "no"
454fi
455
456# ---
457echo $ac_n "Checking for physics list support ...$ac_c"
458if [ -f "$g4_incdir"/QGSP.hh ]; then
459 enable_physicslist=1
460fi
461if [ $enable_physicslist = 0 ]; then
462 echo "no"
463else
464 echo "yes"
465fi
466
467# ---
468echo $ac_n "Checking for GDML support ...$ac_c"
469if [ -f "$g4_incdir"/G4GDMLParser.hh ]; then
470 echo "yes"
471 enable_gdml=1
472else
473 echo "no"
474 enable_gdml=0
475fi
476
477# ---
478if [ $enable_gdml = 1 ]; then
479 echo $ac_n "Checking for Xerces-C include dir ...$ac_c"
480 set $xercesc_incdir $extra_incdir
481 for adir in $*
482 do
483 if [ -d "$adir/xercesc" ]; then
484 xercesc_incdir=$adir
485 break
486 fi
487 done
488 if [ -d "$xercesc_incdir/xercesc" ]; then
489 echo "yes"
490 else
491 echo "no"
492 echo "### $xercesc_incdir/xercesc does not exist. "
493 echo "Try --with-xercesc-incdir option."
494 exit -1
495 fi
496
497 echo $ac_n "Checking for Xerces-C lib dir ...$ac_c"
498 if [ ! $xercesc_libdir ]; then
499 if [ $arch = 64 ]; then
500 xercesc_libdir=/usr/lib64
501 else
502 xercesc_libdir=/usr/lib
503 fi
504 fi
505 set $xerces_libdir $extra_libdir
506 for adir in $*
507 do
508 if [ -f "$adir"/libxerces-c.${shlib} ]; then
509 xercesc_libdir=$adir
510 break
511 fi
512 done
513
514 if [ -f "$xercesc_libdir"/libxerces-c.${shlib} ]; then
515 echo "yes"
516 else
517 echo "no"
518 echo "### $xercesc_libdir/libxerces-c.${shlib} does not exist. "
519 echo "Try --with-xercesc-libdir option."
520 exit -1
521 fi
522fi
523
524# ---
525echo $ac_n "Writing config.gmk ... $ac_c"
526
527make_config=config/config.gmk
528
529cat > $make_config <<EOF
530# config.gmk
531#
532# Automatically generated by configure script
533#
534# Makefile definitions included by the top Makefile
535
536G4PY_INSTALL := $current_dir
537
538Q_SYSTEM := $system
539
540Q_PREFIX := $prefix
541Q_LIBDIR := $libdir
542
543Q_G4_INCDIR := $g4_incdir
544Q_G4_LIBDIR := $g4_libdir
545EOF
546
547
548cat >> $make_config <<EOF
549
550Q_CLHEP_INCDIR := $clhep_incdir
551Q_CLHEP_LIBDIR := $clhep_libdir
552Q_CLHEP_LIB := $clhep_lib
553
554Q_PYTHON_INCDIR := $python_incdir
555Q_PYTHON_LIBDIR := $python_libdir
556Q_BOOST_INCDIR := $boost_incdir
557Q_BOOST_LIBDIR := $boost_libdir
558Q_BOOST_PYTHON_LIB := $boost_python_lib
559
560Q_ENABLE_OPENGLX := $enable_openglx
561Q_ENABLE_OPENGLXM := $enable_openglxm
562Q_ENABLE_RAYTRACERX := $enable_raytracerx
563Q_ENABLE_GL2PS := $enable_gl2ps
564
565Q_ENABLE_PHYSICSLIST := $enable_physicslist
566
567Q_ENABLE_GDML := $enable_gdml
568EOF
569
570if [ $enable_gdml = 1 ]; then
571cat >> $make_config <<EOF
572Q_XERCESC_INCDIR := $xercesc_incdir
573Q_XERCESC_LIBDIR := $xercesc_libdir
574EOF
575fi
576
577echo "done"
578echo $ac_n "Writing config.status ... $ac_c"
579echo $arguments > config.status
580echo "done"
581
582# ---
583echo ""
584echo $ac_n "Enabled support for$ac_c"
585if [ $enable_openglx = 1 ]; then
586 echo $ac_n " openglx$ac_c"
587fi
588
589if [ $enable_openglxm = 1 ]; then
590 echo $ac_n " openglxm$ac_c"
591fi
592
593if [ $enable_raytracerx = 1 ]; then
594 echo $ac_n " raytracerx$ac_c"
595fi
596
597if [ $enable_gl2ps = 1 ]; then
598 echo $ac_n " gl2ps$ac_c"
599fi
600
601if [ $enable_physicslist = 1 ]; then
602 echo $ac_n " physicslist$ac_c"
603fi
604
605if [ $enable_gdml = 1 ]; then
606 echo $ac_n " gdml$ac_c"
607fi
608
609echo "."
610
611# ---
612echo ""
613echo "To build Geant4Py type:"
614echo ""
615echo " make"
616echo " make install"
617echo ""
618
619exit 0
620
Note: See TracBrowser for help on using the repository browser.