File indexing completed on 2025-01-18 09:16:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 script="$0"
0016 calldir=`pwd`
0017 loopcount=""
0018
0019 while [ "x`readlink $script`" != "x" ] ; do
0020 preloc=`dirname $script`
0021 script=`readlink $script`
0022
0023 if [ ${script
0024
0025 script="$preloc/$script"
0026 fi
0027 loopcount="l$loopcount"
0028
0029 if [ ${
0030 echo "error: more than 10 symbolic links to geant4-config traversed."
0031 exit 1
0032 fi
0033 done
0034
0035
0036
0037
0038 if [ ${script
0039 script="$calldir/$script"
0040 fi
0041
0042
0043
0044
0045 scriptloc=`dirname $script`
0046
0047
0048
0049
0050 prefix=@GEANT4_CONFIG_INSTALL_PREFIX@
0051
0052 prefix=`cd "$prefix" 2>/dev/null; pwd -P`
0053
0054 exec_prefix=@GEANT4_CONFIG_EXECPREFIX@
0055 libdir=@GEANT4_CONFIG_LIBDIR@
0056 includedirs="@GEANT4_CONFIG_INCLUDE_DIRS@"
0057
0058 name="geant4"
0059 description="Geant4 toolkit for the simulation of the passage of particles through matter"
0060 version="@Geant4_VERSION@"
0061
0062
0063
0064 vis_cflags="-DG4UI_USE_TCSH"
0065
0066 vis_libs="-lG4Tree \
0067 -lG4FR \
0068 -lG4GMocren \
0069 -lG4visHepRep \
0070 -lG4RayTracer \
0071 -lG4VRML \
0072 -lG4ToolsSG \
0073 -lG4vis_management \
0074 -lG4modeling"
0075
0076
0077
0078
0079 cflags="@CMAKE_CXX_FLAGS@ @GEANT4_CXXSTD_FLAGS@"
0080 feature_list=""
0081
0082
0083 geant4_cxx_std="@CMAKE_CXX_STANDARD@"
0084
0085
0086 have_staticlibs="@G4_BUILTWITH_STATICLIBS@"
0087 feature_list="${feature_list} staticlibs[${have_staticlibs}]"
0088
0089
0090
0091 have_multithreading="@G4_BUILTWITH_MULTITHREADING@"
0092 feature_list="${feature_list} multithreading[${have_multithreading}]"
0093 if test "x${have_multithreading}" = "xyes" ; then
0094 geant4_tls_model="@GEANT4_BUILD_TLS_MODEL@"
0095 if test "x${geant4_tls_model}" = "xauto" ; then
0096 geant4_tls_model=""
0097 fi
0098 else
0099 geant4_tls_model=""
0100 fi
0101
0102
0103 have_smartstack="@G4_BUILTWITH_SMARTSTACK@"
0104 feature_list="${feature_list} smartstack[${have_smartstack}]"
0105 if test "x${have_smartstack}" = "xyes" ; then
0106 cflags="-DG4_USESMARTSTACK ${cflags}"
0107 fi
0108
0109
0110 have_php_as_hp="@G4_BUILTWITH_PHP_AS_HP@"
0111 feature_list="${feature_list} php_as_hp[${have_php_as_hp}]"
0112
0113
0114 for g4incdir in ${includedirs} ; do
0115 cflags="${cflags} -I${g4incdir}"
0116 done
0117
0118 libs="-lG4interfaces \
0119 -lG4geomtext \
0120 -lG4mctruth \
0121 -lG4analysis \
0122 -lG4error_propagation \
0123 -lG4readout \
0124 -lG4physicslists \
0125 -lG4run \
0126 -lG4event \
0127 -lG4tracking \
0128 -lG4parmodels \
0129 -lG4processes \
0130 -lG4digits_hits \
0131 -lG4track \
0132 -lG4particles \
0133 -lG4geometry \
0134 -lG4materials \
0135 -lG4graphics_reps \
0136 -lG4intercoms \
0137 -lG4global \
0138 @G4_LINK_CXX_FILESYSTEM@"
0139
0140
0141
0142
0143 geant4_uses_opengl="no"
0144 geant4_uses_x11="no"
0145
0146
0147 have_clhep="@G4_BUILTWITH_CLHEP@"
0148 feature_list="${feature_list} clhep[${have_clhep}]"
0149
0150 if test "x${have_clhep}" = "xno" ; then
0151 cflags="${cflags} -I@G4_SYSTEM_CLHEP_INCLUDE_DIR@"
0152 libs="${libs} @G4_SYSTEM_CLHEP_LIBRARIES@"
0153 fi
0154 if test "x${have_clhep}" = "xyes" ; then
0155 libs="${libs} -lG4clhep"
0156 fi
0157
0158
0159 have_expat="@G4_BUILTWITH_EXPAT@"
0160 feature_list="${feature_list} expat[${have_expat}]"
0161
0162 if test "x${have_expat}" = "xyes" ; then
0163 libs="${libs} -lG4expat"
0164 fi
0165
0166
0167 have_zlib="@G4_BUILTWITH_ZLIB@"
0168 feature_list="${feature_list} zlib[${have_zlib}]"
0169
0170 if test "x${have_zlib}" = "xyes" ; then
0171 libs="${libs} -lG4zlib"
0172 fi
0173
0174
0175 have_gdml="@G4_BUILTWITH_GDML@"
0176 feature_list="${feature_list} gdml[${have_gdml}]"
0177
0178 if test "x${have_gdml}" = "xyes" ; then
0179 cflags="${cflags} @G4_XERCESC_CFLAGS@"
0180 libs="-lG4gdml ${libs}"
0181 fi
0182
0183
0184 have_ptl="@G4_BUILTWITH_PTL@"
0185 feature_list="${feature_list} ptl[${have_ptl}]"
0186
0187 if test "x${have_ptl}" = "xyes" ; then
0188 libs="${libs} -lG4ptl"
0189 fi
0190
0191
0192 have_usolids="@G4_BUILTWITH_USOLIDS@"
0193 feature_list="${feature_list} usolids[${have_usolids}]"
0194 if test "x${have_usolids}" = "xyes" ; then
0195 cflags="${cflags} @G4_USOLIDS_CFLAGS@"
0196 fi
0197
0198
0199 have_freetype="@G4_BUILTWITH_FREETYPE@"
0200 feature_list="${feature_list} freetype[${have_freetype}]"
0201
0202
0203 have_hdf5="@G4_BUILTWITH_HDF5@"
0204 feature_list="${feature_list} hdf5[${have_hdf5}]"
0205
0206
0207 have_g3tog4="@G4_BUILTWITH_G3TOG4@"
0208 feature_list="${feature_list} g3tog4[${have_g3tog4}]"
0209
0210 if test "x${have_g3tog4}" = "xyes" ; then
0211 libs="-lG3toG4 ${libs}"
0212 fi
0213
0214
0215 have_qt="@G4_BUILTWITH_QT@"
0216 feature_list="${feature_list} qt[${have_qt}]"
0217
0218 if test "x${have_qt}" = "xyes" ; then
0219 vis_cflags="${vis_cflags} \
0220 -DG4UI_USE_QT -DG4VIS_USE_OPENGLQT -DG4VIS_USE_TOOLSSG_QT_GLES @G4_QT_CFLAGS@"
0221 geant4_uses_opengl="yes"
0222 fi
0223
0224
0225 have_qt3d="@G4_BUILTWITH_QT3D@"
0226 feature_list="${feature_list} qt3d[${have_qt3d}]"
0227
0228 if test "x${have_qt3d}" = "xyes" ; then
0229 vis_libs="-lG4visQt3D ${vis_libs}"
0230 vis_cflags="${vis_cflags} -DG4UI_USE_QT3D"
0231 fi
0232
0233
0234 have_motif="@G4_BUILTWITH_MOTIF@"
0235 feature_list="${feature_list} motif[${have_motif}]"
0236
0237 if test "x${have_motif}" = "xyes" ; then
0238 vis_cflags="${vis_cflags} -DG4UI_USE_XM -DG4VIS_USE_OPENGLXM -DG4VIS_USE_TOOLSSG_XT_GLES"
0239 geant4_uses_x11="yes"
0240 geant4_uses_opengl="yes"
0241 fi
0242
0243
0244 have_raytracerx11="@G4_BUILTWITH_RAYTRACERX11@"
0245 feature_list="${feature_list} raytracer-x11[${have_raytracerx11}]"
0246
0247 if test "x${have_raytracerx11}" = "xyes" ; then
0248 vis_cflags="${vis_cflags} -DG4VIS_USE_RAYTRACERX"
0249 geant4_uses_x11="yes"
0250 fi
0251
0252
0253 have_openglx11="@G4_BUILTWITH_OPENGLX11@"
0254 feature_list="${feature_list} opengl-x11[${have_openglx11}]"
0255
0256 if test "x${have_openglx11}" = "xyes" ; then
0257 vis_cflags="${vis_cflags} -DG4VIS_USE_OPENGLX -DG4VIS_USE_TOOLSSG_X11_GLES"
0258 geant4_uses_opengl="yes"
0259 geant4_uses_x11="yes"
0260 fi
0261
0262
0263
0264
0265 have_openinventor="@G4_BUILTWITH_INVENTOR@"
0266 feature_list="${feature_list} openinventor[${have_openinventor}]"
0267
0268 if test "x${have_openinventor}" = "xyes" ; then
0269 vis_cflags="${vis_cflags} -DG4VIS_USE_OI -DG4VIS_USE_OIX"
0270 vis_libs="-lG4OpenInventor ${vis_libs}"
0271 fi
0272
0273
0274 have_vtk="@G4_BUILTWITH_VTK@"
0275 feature_list="${feature_list} vtk[${have_vtk}]"
0276
0277
0278
0279
0280 if test "x${geant4_uses_opengl}" = "xyes" ; then
0281 vis_cflags="-DG4VIS_USE_OPENGL ${vis_cflags}"
0282 vis_libs="-lG4OpenGL ${vis_libs}"
0283 fi
0284
0285
0286 if test "x${geant4_uses_x11}" = "xyes" ; then
0287 vis_cflags="@G4_X11_CFLAGS@ ${vis_cflags}"
0288 fi
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298 dataset_url="@GEANT4_DATASETS_URL@"
0299 dataset_timeout="@GEANT4_INSTALL_DATA_TIMEOUT@"
0300 dataset_list=$(awk 'BEGIN { n = split( "@GEANT4_CONFIG_DATASET_DESCRIPTIONS@", array, ";"); for (i=1;i<=n;i++) { print array[i]; } }')
0301
0302
0303
0304
0305
0306
0307 print_datasets()
0308 {
0309 for ds in ${dataset_list} ; do
0310 dataset_name=$(echo $ds | cut -d "|" -f1)
0311 dataset_envvar=$(echo $ds | cut -d "|" -f2)
0312 dataset_path=$(echo $ds | cut -d "|" -f3)
0313 echo ${dataset_name} ${dataset_envvar} ${dataset_path}
0314 done
0315 exit 0
0316 }
0317
0318
0319
0320
0321
0322
0323 print_datasets_sh()
0324 {
0325 for ds in ${dataset_list} ; do
0326 dataset_envvar=$(echo $ds | cut -d "|" -f2)
0327 dataset_path=$(echo $ds | cut -d "|" -f3)
0328 echo "export ${dataset_envvar}=\"${dataset_path}\""
0329 done
0330 exit 0
0331 }
0332
0333
0334
0335
0336
0337
0338 print_datasets_csh()
0339 {
0340 for ds in ${dataset_list} ; do
0341 dataset_envvar=$(echo $ds | cut -d "|" -f2)
0342 dataset_path=$(echo $ds | cut -d "|" -f3)
0343 echo "setenv ${dataset_envvar} \"${dataset_path}\";"
0344 done
0345 exit 0
0346 }
0347
0348
0349
0350
0351
0352
0353 check_datasets()
0354 {
0355 for ds in ${dataset_list} ; do
0356 dataset_name=$(echo $ds | cut -d "|" -f1)
0357 dataset_path=$(echo $ds | cut -d "|" -f3)
0358 dataset_status="NOTFOUND"
0359 if test -d ${dataset_path} ; then
0360 dataset_status="INSTALLED"
0361 fi
0362 echo ${dataset_name} ${dataset_status} ${dataset_path}
0363 done
0364 }
0365
0366
0367
0368
0369
0370 install_datasets()
0371 {
0372 G4CURL=$(which curl)
0373 if test "x${G4CURL}" = "x" ; then
0374 echo "- error: no curl executable found"
0375 exit 1
0376 fi
0377
0378 G4OPENSSL=$(which openssl)
0379 if test "x${G4OPENSSL}" = "x" ; then
0380 G4MD5SUM=$(which md5sum)
0381 if test "x${G4MD5SUM}" = "x" ; then
0382 echo "- error: no openssl or md5sum executable found"
0383 exit 1
0384 else
0385 G4MD5CMD="${G4MD5SUM}"
0386 fi
0387 else
0388 G4MD5CMD="${G4OPENSSL} dgst -md5 -r"
0389 fi
0390
0391 G4TAR=$(which tar)
0392 if test "x${G4TAR}" = "x" ; then
0393 echo "- error: no tar executable found"
0394 exit 1
0395 fi
0396
0397 datasets_to_install=''
0398 for ds in ${dataset_list} ; do
0399 dataset_path=$(echo $ds | cut -d "|" -f3)
0400 if test ! -d ${dataset_path} ; then
0401 datasets_to_install="${datasets_to_install} ${ds}"
0402 fi
0403 done
0404
0405 dataset_install="ok"
0406 if test "x${datasets_to_install}" != "x" ; then
0407
0408 g4downloaddir=$(mktemp -d -t g4dlcXXXXXXXXXX)
0409 if test -d ${g4downloaddir} ; then
0410 echo "+ created download cache"
0411 else
0412 echo "- error : failed to create '${g4downloaddir}'"
0413 dataset_install="fail"
0414 break
0415 fi
0416
0417
0418 for ds in ${datasets_to_install} ; do
0419
0420 dataset_path=$(echo $ds | cut -d "|" -f3)
0421 mkdir -p $(dirname ${dataset_path})
0422 if [ "$?" != "0" ] || [ ! -w $(dirname ${dataset_path}) ] ; then
0423 echo "- error : failed to create base directory '$(dirname ${dataset_path})'"
0424 dataset_install="fail"
0425 break
0426 fi
0427
0428
0429 dataset_file=$(echo $ds | cut -d "|" -f4)
0430 echo "+ downloading ${dataset_file}"
0431 ${G4CURL} -L -f -m ${dataset_timeout} -o ${g4downloaddir}/${dataset_file} ${dataset_url}/${dataset_file}
0432 curl_status="$?"
0433 if [ "$curl_status" != "0" ] ; then
0434 echo "- download of '${dataset_file}' failed : CURL error $?"
0435 dataset_install="fail"
0436 break
0437 fi
0438
0439
0440 dataset_md5=$(echo $ds | cut -d "|" -f5)
0441 actual_md5=$(${G4MD5CMD} ${g4downloaddir}/${dataset_file} | cut -d ' ' -f1)
0442 echo "+ checking md5 of ${dataset_file}"
0443 if [ "${actual_md5}" != "${dataset_md5}" ] ; then
0444 echo "- md5 mismatch for '${dataset_file}' : ${actual_md5}(actual) != ${dataset_md5}(expected)"
0445 dataset_install="fail"
0446 break
0447 fi
0448
0449
0450 echo "+ untar ${dataset_file}"
0451 ${G4TAR} -C ${g4downloaddir} -xf ${g4downloaddir}/${dataset_file}
0452 tar_status="$?"
0453 if [ "$tar_status" != "0" ] ; then
0454 echo "- untar of '${dataset_file}' failed : tar error $?"
0455 dataset_install="fail"
0456 break
0457 fi
0458
0459
0460 echo "+ installing $(basename ${dataset_path})"
0461 cp -R ${g4downloaddir}/$(basename ${dataset_path}) $(dirname ${dataset_path})
0462 cp_status="$?"
0463 if [ "$cp_status" != "0" ] ; then
0464 echo "- copy of '$(basename ${dataset_path})' failed : cp error $?"
0465
0466 rm -Rf ${dataset_path}
0467 dataset_install="fail"
0468 break
0469 fi
0470 done
0471
0472
0473 rm -Rf ${g4downloaddir}
0474 if test -d ${g4downloaddir} ; then
0475 echo "- failed to remove '${g4downloaddir}'"
0476 else
0477 echo "+ cleaned download cache"
0478 fi
0479 fi
0480
0481 if [ "${dataset_install}" = "ok" ] ; then
0482 echo "+ all datasets installed"
0483 exit 0
0484 else
0485 echo "- dataset installation failed"
0486 exit 1
0487 fi
0488 exit 1
0489 }
0490
0491
0492
0493
0494
0495 list_features()
0496 {
0497 cat<<EOF
0498 Known Features:
0499 EOF
0500 for f in ${feature_list} ; do
0501 echo " $f"
0502 done
0503 exit 0
0504 }
0505
0506
0507
0508
0509
0510
0511 help()
0512 {
0513 cat<<EOF
0514 Usage: geant4-config [OPTION...]
0515 --prefix output installation prefix of Geant4
0516 --version output version for Geant4
0517 --cxxstd C++ Standard compiled against
0518 --tls-model Thread Local Storage model used
0519 --libs output all linker flags
0520 --cflags output all preprocessor
0521 and compiler flags
0522
0523 --libs-without-gui output linker flags without
0524 GUI components
0525 --cflags-without-gui output preprocessor and compiler
0526 flags without GUI components
0527
0528 --has-feature FEATURE output yes if FEATURE is supported,
0529 or no if not supported
0530
0531 --features print list of features
0532
0533 --sh print shell commands required to set environment
0534 variables for Geant4, which can be evaluated in
0535 the calling shell with "eval \$(geant4-config --sh)"
0536
0537 --csh print C shell commands required to set environment
0538 variables for Geant4, which can be evaluated in
0539 the calling shell with "eval \`geant4-config --csh\`"
0540
0541 --datasets output dataset name, environment variable
0542 and path, with one line per dataset
0543
0544 --check-datasets output dataset name, installation status and
0545 expected installation location, with one line
0546 per dataset
0547
0548 --install-datasets download and install any missing datasets,
0549 requires a network connection and for the dataset
0550 path to be user writable
0551
0552 Known Features:
0553 EOF
0554 for f in ${feature_list} ; do
0555 echo " $f"
0556 done
0557
0558 cat<<EOF
0559
0560 Help options:
0561 -?, --help show this help message
0562 --usage display brief usage message
0563 EOF
0564
0565 exit 1
0566 }
0567
0568
0569
0570
0571
0572 usage()
0573 {
0574 cat<<EOF
0575 Usage: geant4-config [--prefix] [--version] [--libs] [--cflags]
0576 EOF
0577 exit 1
0578 }
0579
0580
0581
0582
0583 if test $
0584 usage
0585 fi
0586
0587 while test $
0588 case "$1" in
0589 -*=*)
0590 optflag=`echo "$1" | sed 's/=[-_a-zA-Z0-9]*//'`
0591 optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
0592 ;;
0593 *)
0594 optflag=$1
0595 optarg=
0596 ;;
0597 esac
0598
0599 case "$optflag" in
0600 --prefix)
0601 echo ${prefix}
0602 ;;
0603
0604 --version)
0605 echo ${version}
0606 ;;
0607
0608 --cxxstd)
0609 echo ${geant4_cxx_std}
0610 ;;
0611
0612 --tls-model)
0613 echo ${geant4_tls_model}
0614 ;;
0615
0616 --libs)
0617 echo "-L${libdir}" ${vis_libs} ${libs}
0618 ;;
0619
0620 --cflags)
0621 echo ${vis_cflags} ${cflags}
0622 ;;
0623
0624 --libs-without-gui)
0625 echo "-L${libdir}" ${libs}
0626 ;;
0627
0628 --cflags-without-gui)
0629 echo ${cflags}
0630 ;;
0631
0632 --has-feature)
0633 if [ x$optarg = x ]; then
0634 if [ $
0635 shift
0636 optarg=$1
0637 else
0638 echo "$optflag - missing parameter"
0639 exit 1
0640 fi
0641 fi
0642
0643 case "$optarg" in
0644 static)
0645 echo ${have_staticlibs}
0646 ;;
0647 multithreading)
0648 echo ${have_multithreading}
0649 ;;
0650 smartstack)
0651 echo ${have_smartstack}
0652 ;;
0653 clhep)
0654 echo ${have_clhep}
0655 ;;
0656 expat)
0657 echo ${have_expat}
0658 ;;
0659 zlib)
0660 echo ${have_zlib}
0661 ;;
0662 gdml)
0663 echo ${have_gdml}
0664 ;;
0665 usolids)
0666 echo ${have_usolids}
0667 ;;
0668 freetype)
0669 echo ${have_freetype}
0670 ;;
0671 hdf5)
0672 echo ${have_hdf5}
0673 ;;
0674 g3tog4)
0675 echo ${have_g3tog4}
0676 ;;
0677 qt)
0678 echo ${have_qt}
0679 ;;
0680 qt3d)
0681 echo ${have_qt3d}
0682 ;;
0683 vtk)
0684 echo ${have_vtk}
0685 ;;
0686 motif)
0687 echo ${have_motif}
0688 ;;
0689 raytracer-x11)
0690 echo ${have_raytracerx11}
0691 ;;
0692 opengl-x11)
0693 echo ${have_openglx11}
0694 ;;
0695 openinventor)
0696 echo ${have_openinventor}
0697 ;;
0698 php_as_hp)
0699 echo ${have_php_as_hp}
0700 ;;
0701 *)
0702 echo "no"
0703 ;;
0704 esac
0705 ;;
0706
0707 --features)
0708 list_features
0709 ;;
0710
0711 --datasets)
0712 print_datasets
0713 ;;
0714
0715 --check-datasets)
0716 check_datasets
0717 ;;
0718
0719 --install-datasets)
0720 install_datasets
0721 ;;
0722
0723 --sh)
0724 print_datasets_sh
0725 ;;
0726
0727 --csh)
0728 print_datasets_csh
0729 ;;
0730
0731 -?)
0732 help
0733 ;;
0734
0735 --help)
0736 help
0737 ;;
0738
0739 --usage)
0740 usage
0741 ;;
0742
0743 *)
0744 usage
0745 ;;
0746 esac
0747
0748 shift
0749 done
0750
0751
0752 exit 0