[uLib Geometry]

non working version!

+ adds ProgrammableAccessor
+ renaming of some Image structures ...
This commit is contained in:
Andrea Rigoni
2014-11-03 10:27:52 +00:00
commit 99e771a223
403 changed files with 61684 additions and 0 deletions

1186
m4/boost.m4 Normal file

File diff suppressed because it is too large Load Diff

361
m4/geant4.bkp Normal file
View File

@@ -0,0 +1,361 @@
dnl
dnl m4 macros for setting up Geant4
dnl
# call all the Geant4 macros
AC_DEFUN( [GDML_SETUP_GEANT4], [
GDML_WITH_GEANT4
AC_GEANT4_VERSION
GDML_WITH_G4SYSTEM
GDML_WITH_GEANT4_INCLUDE
GDML_WITH_GEANT4_LIBDIR
GDML_ENABLE_GEANT4_GRANULAR_LIBS
GDML_SUBST_GEANT4
GDML_CHECK_NIST
GDML_ENABLE_NIST
AC_HAVE_G4TESSELLATED
AC_HAVE_G4TET
AC_HAVE_G4TWISTEDBOX
AC_HAVE_G4TWISTEDTRD
AC_HAVE_G4TWISTEDTRAP
AC_HAVE_G4TWISTEDTUBS
AC_HAVE_G4ELLIPSOID
AC_HAVE_G4EXTRUDEDSOLID
])
# macro to set GEANT4 base dir (G4INSTALL)
AC_DEFUN( GDML_WITH_GEANT4, [
AC_MSG_CHECKING(for GEANT4 installation setting)
AC_ARG_WITH(geant4,
AC_HELP_STRING([--with-geant4=<path>],[Geant4 installation base [[G4INSTALL]] ]),
[GEANT4_PREFIX=$with_geant4],
[GEANT4_PREFIX=$G4INSTALL])
AC_MSG_RESULT([$GEANT4_PREFIX])
GDML_CHECK_PKG_DIR( [$GEANT4_PREFIX], [Geant4])
])
# macro to set G4SYSTEM
AC_DEFUN( GDML_WITH_G4SYSTEM, [
AC_MSG_CHECKING(for G4SYSTEM setting)
AC_ARG_WITH(geant4-system,
AC_HELP_STRING([--with-geant4-system=<value>],[Value of G4SYSTEM variable]),
[G4SYSTEM=$with_geant4_g4system])
if test -z "${G4SYSTEM}"; then
G4SYSTEM=`uname`-${CXX}
fi
AC_MSG_RESULT([$G4SYSTEM])
AC_SUBST(G4SYSTEM)
])
# macro to set GEANT4 include dir
AC_DEFUN( GDML_WITH_GEANT4_INCLUDE, [
AC_MSG_CHECKING([for Geant4 include dir setting])
AC_ARG_WITH([geant4-include],
AC_HELP_STRING([--with-geant4-include=<path>],[Geant4 alternate headers dir]),
[GEANT4_INCLUDE=$with_geant4_include],
[GEANT4_INCLUDE=$GEANT4_PREFIX/include])
AC_MSG_RESULT([$GEANT4_INCLUDE])
GDML_CHECK_PKG_DIR( [$GEANT4_INCLUDE],
[GEANT4],
[G4RunManager.hh])
])
AC_MSG_RESULT(yes)
# macro to set GEANT4 lib dir
AC_DEFUN( GDML_WITH_GEANT4_LIBDIR, [
AC_MSG_CHECKING([for Geant4 lib dir])
AC_ARG_WITH([geant4-libdir],
AC_HELP_STRING([--with-geant4-libdir=<path>], [Geant4 alternate library dir]),
[GEANT4_LIBDIR=$with_geant4_libdir],
[GEANT4_LIBDIR=$GEANT4_PREFIX/lib/$G4SYSTEM])
AC_MSG_RESULT([$GEANT4_LIBDIR])
GDML_CHECK_PKG_DIR( [$GEANT4_LIBDIR],
[GEANT4])
])
# macro to substitute GEANT4 vars to output
AC_DEFUN( GDML_SUBST_GEANT4, [
AC_SUBST(GEANT4_PREFIX)
AC_SUBST(GEANT4_INCLUDE)
AC_SUBST(GEANT4_LIBDIR)
])
# macro to select granular libs
AC_DEFUN( GDML_ENABLE_GEANT4_GRANULAR_LIBS, [
AC_MSG_CHECKING(whether to use Geant4 granular libs)
AC_ARG_ENABLE([geant4-granular-libs],
AC_HELP_STRING( [--enable-geant4-granular-libs], [Enable linking against granular rather than global Geant4 libs] ),
[ac_g4_use_granular=$enable_geant4_granular_libs],
[ac_g4_use_granular=no])
# no option?
if test -z "${with_geant4_granular_libs}"; then
# set in env?
if test -n "${G4LIB_USE_GRANULAR}"; then
ac_g4_use_granular=yes
fi
fi
AC_MSG_RESULT([$ac_g4_use_granular])
if test "${ac_g4_use_granular}" = "yes"; then
GEANT4_USE_GRANULAR=1
AC_SUBST(GEANT4_USE_GRANULAR)
else
GEANT4_USE_GLOBAL=1
AC_SUBST(GEANT4_USE_GLOBAL)
fi
])
# macro to check whether NIST is supported by the current Geant4 version
AC_DEFUN(GDML_CHECK_NIST, [
HAVE_NIST=no
AC_CHECK_FILE([$GEANT4_PREFIX/source/materials/include/G4NistManager.hh],HAVE_NIST=yes)
if test "$HAVE_NIST" = "yes"
then
AC_DEFINE(HAVE_NIST)
fi
])
# macro to enable/disable NIST support
AC_DEFUN(GDML_ENABLE_NIST, [
dnl Removed because this is somehow getting put in front of GEANT4_PREFIX setting, which breaks NIST config.
dnl AC_REQUIRE([GDML_CHECK_NIST])
AC_MSG_CHECKING(whether to enable Geant4 NIST support for material lookup)
AC_ARG_ENABLE([nist],
AC_HELP_STRING([--enable-nist=<setting>]., [Turn NIST support on or off.]))
# default to using NIST if not set from the enable-nist option
if test "X$enable_nist" = "X"
then
enable_nist=yes
fi
if test "X$enable_nist" = "Xyes"
then
if test "X$HAVE_NIST" = "Xyes"
then
AC_MSG_RESULT(yes)
AC_DEFINE(GDML_USE_NIST)
else
AC_MSG_RESULT(no)
AC_MSG_WARN(NIST was selected but your version of Geant4 does not support it)
fi
else
AC_MSG_RESULT(no)
fi
])
dnl Macro to extract the Geant4 version from G4Version.hh or G4RunManagerKernel.hh, if the former file does not exist.
AC_DEFUN(AC_GEANT4_VERSION, [
AC_MSG_CHECKING(for Geant4 full version)
if test -n "$GEANT4_PREFIX"
then
if ! test -d $GEANT4_PREFIX; then
AC_MSG_ERROR(G4INSTALL does not point to a directory)
fi
if ! test -e $GEANT4_PREFIX/source/run/include/G4RunManager.hh; then
AC_MSG_ERROR(G4INSTALL does not appear to contain the Geant4 source code)
fi
if test -e "$GEANT4_PREFIX/source/global/management/include/G4Version.hh"
then
GEANT4_FULL_VERSION=$(sed -n -e '/#define G4VERSION_NUMBER/s/#define G4VERSION_NUMBER //p' $GEANT4_PREFIX/source/global/management/include/G4Version.hh | \
awk 'BEGIN { FS="" } ; { print [$]1"."[$]2"."[$]3 }')
elif test -e "$GEANT4_PREFIX/source/run/src/G4RunManagerKernel.cc"
then
GEANT4_FULL_VERSION=$(sed -n -e '/\/\/ GEANT4 tag /s/.*\(geant4-[[0-9]]*-[[0-9]]*[[0-9a-z-]]*\).*/\1/p' \
$GEANT4_PREFIX/source/run/src/G4RunManagerKernel.cc | sed -e 's/geant4-//g' -e 's/patch-//g' -e 's/-/./g')
else
AC_MSG_ERROR(could not determine Geant4 version because G4Version.hh or G4RunManagerKernel.hh was not found in $GEANT4_PREFIX)
fi
else
AC_MSG_ERROR(G4INSTALL is not set in the environment)
fi
GEANT4_MAJOR_VERSION=$(echo "$GEANT4_FULL_VERSION" | awk 'BEGIN{ FS="." } { print [$]1 }' | sed 's/0*//')
GEANT4_MINOR_VERSION=$(echo "$GEANT4_FULL_VERSION" | awk 'BEGIN{ FS="." } { print [$]2 }' | sed 's/0*//')
GEANT4_PATCH_VERSION=$(echo "$GEANT4_FULL_VERSION" | awk 'BEGIN{ FS="." } { print [$]3 }' | sed 's/0*//')
if test -z "$GEANT4_MINOR_VERSION";
then
GEANT4_MINOR_VERSION=0
fi
if test -z "$GEANT4_PATCH_VERSION";
then
GEANT4_PATCH_VERSION=0
fi
GEANT4_FULL_VERSION=$GEANT4_MAJOR_VERSION"."$GEANT4_MINOR_VERSION"."$GEANT4_PATCH_VERSION
AC_MSG_RESULT($GEANT4_FULL_VERSION)
AC_MSG_CHECKING(for Geant4 major version level)
AC_MSG_RESULT($GEANT4_MAJOR_VERSION)
AC_MSG_CHECKING(for Geant4 minor version level)
AC_MSG_RESULT($GEANT4_MINOR_VERSION)
AC_MSG_CHECKING(for Geant4 patch level)
AC_MSG_RESULT($GEANT4_PATCH_VERSION)
AC_SUBST(GEANT4_FULL_VERSION)
AC_SUBST(GEANT4_MAJOR_VERSION)
AC_SUBST(GEANT4_MINOR_VERSION)
AC_SUBST(GEANT4_PATCH_VERSION)
])
# Macro to set HAVE_G4TESSELLATED if G4TessellatedSolid.hh exists.
AC_DEFUN(AC_HAVE_G4TESSELLATED, [
AC_MSG_CHECKING(whether to enable G4TessellatedSolid)
if test -e $GEANT4_PREFIX/source/geometry/solids/specific/include/G4TessellatedSolid.hh; then
AC_DEFINE(HAVE_G4TESSELLATEDSOLID)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
# Macro to set HAVE_G4TET if G4Tet.hh exists.
AC_DEFUN(AC_HAVE_G4TET, [
AC_MSG_CHECKING(whether to enable G4Tet)
if test -e $GEANT4_PREFIX/source/geometry/solids/specific/include/G4Tet.hh; then
AC_DEFINE(HAVE_G4TET)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
# Macro to set HAVE_G4TWISTEDBOX if G4TwistedBox.hh exists.
AC_DEFUN(AC_HAVE_G4TWISTEDBOX, [
AC_MSG_CHECKING(whether to enable G4TwistedBox)
if test -e $GEANT4_PREFIX/source/geometry/solids/specific/include/G4TwistedBox.hh; then
AC_DEFINE(HAVE_G4TWISTEDBOX)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
# Macro to set HAVE_G4TWISTEDTRD if G4TwistedTrd.hh exists.
AC_DEFUN(AC_HAVE_G4TWISTEDTRD, [
AC_MSG_CHECKING(whether to enable G4TwistedTrd)
if test -e $GEANT4_PREFIX/source/geometry/solids/specific/include/G4TwistedTrd.hh; then
AC_DEFINE(HAVE_G4TWISTEDTRD)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
# Macro to set HAVE_G4TWISTEDTRAP if G4TwistedTrap.hh exists.
AC_DEFUN(AC_HAVE_G4TWISTEDTRAP, [
AC_MSG_CHECKING(whether to enable G4TwistedTrap)
if test -e $GEANT4_PREFIX/source/geometry/solids/specific/include/G4TwistedTrap.hh; then
AC_DEFINE(HAVE_G4TWISTEDTRAP)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
# Macro to set HAVE_G4TWISTEDTUBS if G4TwistedTubs.hh exists.
AC_DEFUN(AC_HAVE_G4TWISTEDTUBS, [
AC_MSG_CHECKING(whether to enable G4TwistedTubs)
if test -e $GEANT4_PREFIX/source/geometry/solids/specific/include/G4TwistedTubs.hh; then
AC_DEFINE(HAVE_G4TWISTEDTUBS)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
# Macro to set HAVE_G4ELLIPSOID if G4Ellipsoid.hh exists.
AC_DEFUN(AC_HAVE_G4ELLIPSOID, [
AC_MSG_CHECKING(whether to enable G4Ellipsoid)
if test -e $GEANT4_PREFIX/source/geometry/solids/specific/include/G4Ellipsoid.hh; then
AC_DEFINE(HAVE_G4ELLIPSOID)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
# Macro to set HAVE_G4EXTRUDEDSOLID if G4ExtrudedSolid.hh exists.
AC_DEFUN(AC_HAVE_G4EXTRUDEDSOLID, [
AC_MSG_CHECKING(whether to enable G4ExtrudedSolid)
if test -e $GEANT4_PREFIX/source/geometry/solids/specific/include/G4ExtrudedSolid.hh; then
AC_DEFINE(HAVE_G4EXTRUDEDSOLID)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])

64
m4/geant4.m4 Normal file
View File

@@ -0,0 +1,64 @@
dnl
dnl m4 macros for setting up Geant4
dnl
##
## Geant4 Config
##
AC_DEFUN([GEANT4_PATH],
[
AC_ARG_WITH(gean4sys,
[ --with-geant4sys top of the GEANT4 installation directory],
user_genat4sys=$withval,
user_geant4sys="none")
if test ! x"$user_geant4sys" = xnone; then
geant4bin="$user_geant4sys/bin"
elif test ! x"$GEANT4SYS" = x ; then
geant4bin="$GEANT4SYS/bin"
else
geant4bin=$PATH
fi
AC_PATH_PROG(GEANT4CONF, geant4-config , no, $geant4bin)
if test ! x"$GEANT4CONF" = "xno"; then
# define some variables
GEANT4CFLAGS=`$GEANT4CONF --cflags`
GEANT4LIBS=`$GEANT4CONF --libs`
GEANT4VERSION=`$GEANT4CONF --version`
if test $1 ; then
AC_MSG_CHECKING(wether GEANT4 version >= [$1])
vers=`$GEANT4CONF --version | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
requ=`echo $1 | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
if test $vers -lt $requ ; then
AC_MSG_RESULT(no)
no_geant4="yes"
else
AC_MSG_RESULT(yes)
no_genat4="no"
fi
fi
else
# otherwise, we say no_GEANT4
no_geant4="yes"
fi
AC_SUBST(GEANT4CFLAGS)
AC_SUBST(GEANT4LIBS)
AC_SUBST(GEANT4VERSION)
if test "x$no_geant4" = "x" ; then
ifelse([$2], , :, [$2])
else
ifelse([$3], , :, [$3])
fi
])

98
m4/openmp.m4 Normal file
View File

@@ -0,0 +1,98 @@
# openmp.m4 serial 7
dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file can be removed once we assume autoconf >= 2.62.
dnl Expand to nothing in autoconf >= 2.62. m4_copy has a different
dnl semantic in autoconf > 2.63.
m4_ifdef([AC_OPENMP], [], [
# _AC_LANG_OPENMP
# ---------------
# Expands to some language dependent source code for testing the presence of
# OpenMP.
AC_DEFUN([_AC_LANG_OPENMP],
[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
# _AC_LANG_OPENMP(C)
# ------------------
m4_define([_AC_LANG_OPENMP(C)],
[
#ifndef _OPENMP
choke me
#endif
#include <omp.h>
int main () { return omp_get_num_threads (); }
])
# _AC_LANG_OPENMP(C++)
# --------------------
m4_copy([_AC_LANG_OPENMP(C)], [_AC_LANG_OPENMP(C++)])
# _AC_LANG_OPENMP(Fortran 77)
# ---------------------------
m4_define([_AC_LANG_OPENMP(Fortran 77)],
[AC_LANG_FUNC_LINK_TRY([omp_get_num_threads])])
# _AC_LANG_OPENMP(Fortran)
# ---------------------------
m4_copy([_AC_LANG_OPENMP(Fortran 77)], [_AC_LANG_OPENMP(Fortran)])
# AC_OPENMP
# ---------
# Check which options need to be passed to the C compiler to support OpenMP.
# Set the OPENMP_CFLAGS / OPENMP_CXXFLAGS / OPENMP_FFLAGS variable to these
# options.
# The options are necessary at compile time (so the #pragmas are understood)
# and at link time (so the appropriate library is linked with).
# This macro takes care to not produce redundant options if $CC $CFLAGS already
# supports OpenMP. It also is careful to not pass options to compilers that
# misinterpret them; for example, most compilers accept "-openmp" and create
# an output file called 'penmp' rather than activating OpenMP support.
AC_DEFUN([AC_OPENMP],
[
OPENMP_[]_AC_LANG_PREFIX[]FLAGS=
AC_ARG_ENABLE([openmp],
[AS_HELP_STRING([--disable-openmp], [do not use OpenMP])])
if test "$enable_openmp" != no; then
AC_CACHE_CHECK([for $CC option to support OpenMP],
[ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp],
[AC_LINK_IFELSE([_AC_LANG_OPENMP],
[ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='none needed'],
[ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='unsupported'
dnl Try these flags:
dnl GCC >= 4.2 -fopenmp
dnl SunPRO C -xopenmp
dnl Intel C -openmp
dnl SGI C, PGI C -mp
dnl Tru64 Compaq C -omp
dnl IBM C (AIX, Linux) -qsmp=omp
dnl If in this loop a compiler is passed an option that it doesn't
dnl understand or that it misinterprets, the AC_LINK_IFELSE test
dnl will fail (since we know that it failed without the option),
dnl therefore the loop will continue searching for an option, and
dnl no output file called 'penmp' or 'mp' is created.
for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do
ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
AC_LINK_IFELSE([_AC_LANG_OPENMP],
[ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp=$ac_option])
_AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
if test "$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != unsupported; then
break
fi
done])])
case $ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp in #(
"none needed" | unsupported)
;; #(
*)
OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp ;;
esac
fi
AC_SUBST([OPENMP_]_AC_LANG_PREFIX[FLAGS])
])
])

125
m4/root.m4 Normal file
View File

@@ -0,0 +1,125 @@
dnl -*- mode: autoconf -*-
dnl
dnl $Id: root.m4,v 1.3 2005/03/21 21:42:21 rdm Exp $
dnl $Author: rdm $
dnl $Date: 2005/03/21 21:42:21 $
dnl
dnl Autoconf macro to check for existence or ROOT on the system
dnl Synopsis:
dnl
dnl ROOT_PATH([MINIMUM-VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]])
dnl
dnl Some examples:
dnl
dnl ROOT_PATH(3.03/05, , AC_MSG_ERROR(Your ROOT version is too old))
dnl ROOT_PATH(, AC_DEFINE([HAVE_ROOT]))
dnl
dnl The macro defines the following substitution variables
dnl
dnl ROOTCONF full path to root-config
dnl ROOTEXEC full path to root
dnl ROOTCINT full path to rootcint
dnl ROOTLIBDIR Where the ROOT libraries are
dnl ROOTINCDIR Where the ROOT headers are
dnl ROOTCFLAGS Extra compiler flags
dnl ROOTLIBS ROOT basic libraries
dnl ROOTGLIBS ROOT basic + GUI libraries
dnl ROOTAUXLIBS Auxilary libraries and linker flags for ROOT
dnl ROOTAUXCFLAGS Auxilary compiler flags
dnl ROOTRPATH Same as ROOTLIBDIR
dnl
dnl The macro will fail if root-config and rootcint isn't found.
dnl
dnl Christian Holm Christensen <cholm@nbi.dk>
dnl
AC_DEFUN([ROOT_PATH],
[
AC_ARG_WITH(rootsys,
[ --with-rootsys top of the ROOT installation directory],
user_rootsys=$withval,
user_rootsys="none")
if test ! x"$user_rootsys" = xnone; then
rootbin="$user_rootsys/bin"
elif test ! x"$ROOTSYS" = x ; then
rootbin="$ROOTSYS/bin"
else
rootbin=$PATH
fi
AC_PATH_PROG(ROOTCONF, root-config , no, $rootbin)
AC_PATH_PROG(ROOTEXEC, root , no, $rootbin)
AC_PATH_PROG(ROOTCINT, rootcint , no, $rootbin)
if test ! x"$ROOTCONF" = "xno" && \
test ! x"$ROOTCINT" = "xno" ; then
# define some variables
ROOTLIBDIR=`$ROOTCONF --libdir`
ROOTINCDIR=`$ROOTCONF --incdir`
ROOTCFLAGS=`$ROOTCONF --noauxcflags --cflags`
ROOTLIBS=`$ROOTCONF --noauxlibs --noldflags --libs`
ROOTGLIBS=`$ROOTCONF --noauxlibs --noldflags --glibs`
ROOTAUXCFLAGS=`$ROOTCONF --auxcflags`
ROOTAUXLIBS=`$ROOTCONF --auxlibs`
ROOTRPATH=$ROOTLIBDIR
ROOTVERSION=`$ROOTCONF --version`
ROOTSOVERSION=`dirname $ROOTVERSION`
if test $1 ; then
AC_MSG_CHECKING(wether ROOT version >= [$1])
vers=`$ROOTCONF --version | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
requ=`echo $1 | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
if test $vers -lt $requ ; then
AC_MSG_RESULT(no)
no_root="yes"
else
AC_MSG_RESULT(yes)
no_root="no"
fi
fi
else
# otherwise, we say no_root
no_root="yes"
fi
AC_SUBST(ROOTLIBDIR)
AC_SUBST(ROOTINCDIR)
AC_SUBST(ROOTCFLAGS)
AC_SUBST(ROOTLIBS)
AC_SUBST(ROOTGLIBS)
AC_SUBST(ROOTAUXLIBS)
AC_SUBST(ROOTAUXCFLAGS)
AC_SUBST(ROOTRPATH)
AC_SUBST(ROOTVERSION)
AC_SUBST(ROOTSOVERSION)
if test "x$no_root" = "x" ; then
ifelse([$2], , :, [$2])
else
ifelse([$3], , :, [$3])
fi
])
#
# Macro to check if ROOT has a specific feature:
#
# ROOT_FEATURE(FEATURE,[ACTION_IF_HAVE,[ACTION_IF_NOT]])
#
# For example
#
# ROOT_FEATURE([ldap],[AC_DEFINE([HAVE_ROOT_LDAP])])
#
AC_DEFUN([ROOT_FEATURE],
[
AC_REQUIRE([ROOT_PATH])
feat=$1
res=`$ROOTCONF --has-$feat`
if test "x$res" = "xyes" ; then
ifelse([$2], , :, [$2])
else
ifelse([$3], , :, [$3])
fi
])
#
# EOF
#

166
m4/vtk.m4 Normal file
View File

@@ -0,0 +1,166 @@
dnl ======================================================================================
dnl Author: Francesco Montorsi
dnl RCS-ID: $Id: vtk.m4,v 1.1 2005/11/20 14:47:40 frm Exp $
dnl
dnl Implements the AM_OPTIONS_VTK, to add the --with-vtk=path option, and the
dnl AM_PATH_VTK macro used to detect VTK presence, location and version.
dnl ======================================================================================
dnl
dnl AM_OPTIONS_VTK
dnl ------------------------------------------------------------------------
dnl Adds the --with-vtk=path option to the configure options
dnl
AC_DEFUN([AM_OPTIONS_VTK],
[
AC_ARG_WITH([vtk-path],
[AC_HELP_STRING([--with-vtk-path],
[The prefix where VTK is installed (default is /usr/local)])],
[with_vtk=$withval],
[with_vtk="/usr/local"])
AC_ARG_WITH([vtk-version],
[AC_HELP_STRING([--with-vtk-version],
[VTK's include directory name is vtk-suffix, e.g. vtk-5.0/. What's the suffix? (Default -5.10)])],
[vtk_suffix=$withval],
[vtk_suffix="-5.10"])
])# AM_OPTIONS_VTK
dnl
dnl AM_PATH_VTK([minimum-version], [action-if-found], [action-if-not-found])
dnl ------------------------------------------------------------------------
dnl
dnl NOTE: [minimum-version] must be in the form [X.Y.Z]
dnl
AC_DEFUN([AM_PATH_VTK],
[
dnl do we want to check for VTK ?
if test "$with_vtk" = yes; then
dnl in case user wrote --with-vtk=yes
with_vtk="/usr/local"
fi
if test "$with_vtk" != no; then
dnl
dnl A path was provided in $with_vtk...try hard to find the VTK library {{{
VTK_PREFIX="$with_vtk"
AC_CHECK_FILE([$VTK_PREFIX/include/vtk$vtk_suffix/vtkObject.h], [vtkFound="OK"])
AC_MSG_CHECKING([if VTK is installed in $VTK_PREFIX])
if test -z "$vtkFound"; then
dnl
dnl VTK was not found! ...execute $3 unconditionally {{{
AC_MSG_RESULT([no])
$3
dnl }}}
dnl
else
dnl
dnl VTK was found! ...execute $2 if version matches {{{
AC_MSG_RESULT([yes])
dnl these are the VTK libraries of a default build
VTK_LIBS=""
dnl set VTK c,cpp,ld flags
VTK_CFLAGS="-I$VTK_PREFIX/include/vtk$vtk_suffix"
VTK_CXXFLAGS="$VTK_CFLAGS"
VTK_LDFLAGS="-L$VTK_PREFIX/lib/vtk$vtk_suffix $VTK_LIBS"
AC_SUBST(VTK_LIBS)
AC_SUBST(VTK_CFLAGS)
AC_SUBST(VTK_CXXFLAGS)
AC_SUBST(VTK_LDFLAGS)
dnl now, eventually check version {{{
if test -n "$1"; then
dnl
dnl A version was specified... parse the version string in $1 {{{
dnl The version of VTK that we need: {{{
maj=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
min=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
rel=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
AC_MSG_CHECKING([if VTK version is at least $maj.$min.$rel])
dnl }}}
dnl Compare required version of VTK against installed version: {{{
dnl
dnl Note that in order to be able to compile the following test program,
dnl we need to add to the current flags, the VTK settings...
OLD_CFLAGS=$CFLAGS
OLD_CXXFLAGS=$CXXFLAGS
OLD_LDFLAGS=$LDFLAGS
CFLAGS="$VTK_CFLAGS $CFLAGS"
CXXFLAGS="$VTK_CXXFLAGS $CXXFLAGS"
LDFLAGS="$VTK_LDFLAGS $LDFLAGS"
dnl
dnl check if the installed VTK is greater or not
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[
#include <vtkConfigure.h>
#include <stdio.h>
],
[
printf("VTK version is: %d.%d.%d", VTK_MAJOR_VERSION, VTK_MINOR_VERSION, VTK_BUILD_VERSION);
if VTK_MAJOR_VERSION < $maj
error Installed VTK is too old !
endif
if VTK_MINOR_VERSION < $min
error Installed VTK is too old !
endif
if VTK_BUILD_VERSION < $rel
error Installed VTK is too old !
endif
])
], [vtkVersion="OK"])
dnl
dnl restore all flags without VTK values
CFLAGS=$OLD_CFLAGS
CXXFLAGS=$OLD_CXXFLAGS
LDFLAGS=$OLD_LDFLAGS
dnl }}}
dnl Execute $2 if version is ok, otherwise execute $3 {{{
if test "$vtkVersion" = "OK"; then
AC_MSG_RESULT([yes])
$2
else
AC_MSG_RESULT([no])
$3
fi
dnl }}}
dnl }}}
dnl
else
dnl
dnl A target version number was not provided... execute $2 unconditionally {{{
dnl if we don't have to check for minimum version (because the user did not set that option),
dnl then we can execute here the block action-if-found
CFLAGS="$VTK_CFLAGS $CFLAGS"
CXXFLAGS="$VTK_CXXFLAGS $CXXFLAGS"
LDFLAGS="$VTK_LDFLAGS $LDFLAGS"
$2
dnl }}}
dnl
fi
dnl }}}
dnl }}}
dnl
fi
dnl }}}
dnl
fi
])# AM_PATH_VTK
dnl
dnl vim: foldmethod=marker foldlevel=1 ts=2 sw=2

90
m4/zeromq.m4 Normal file
View File

@@ -0,0 +1,90 @@
#
# Configure paths and flags for the ZeroMQ library.
# Denis Arnaud <denis_arnaud at users dot sourceforge dot net>, May 2011
#
# Variables set by this macro:
# * AM_PATH_ZEROMQ
# * ZEROMQ_VERSION
# * ZEROMQ_CFLAGS
# * ZEROMQ_LIBS
#
AC_DEFUN([AM_PATH_ZEROMQ],
[
AC_LANG_SAVE
AC_LANG([C++])
##
AC_ARG_WITH(zeromq,
[[ --with-zeromq[=PFX] Prefix where ZeroMQ is installed (optional) ]],
zeromq_dir="$withval",
zeromq_dir="")
ac_zeromq_path=""
if test "x${zeromq_dir}" = "xno"
then
without_zeromq=yes
elif test "x${zeromq_dir}" != "xyes"
then
with_arg="${zeromq_dir}/include:-L${zeromq_dir}/lib ${zeromq_dir}/include/zeromq:-L${zeromq_dir}/lib"
fi
##
AC_MSG_CHECKING(for zmq.hpp)
if test "x$without_zeromq" != "xyes"
then
for i in $with_arg /usr/include: /usr/local/include:-L/usr/local/lib \
/usr/pkg/include:-L/usr/pkg/lib
do
ac_zeromq_path=`echo "$i" | sed 's/:.*//'`
lib=`echo "$i" | sed 's/.*://'`
if test -f ${ac_zeromq_path}/zmq.hpp
then
AC_MSG_RESULT(${ac_zeromq_path}/zmq.hpp)
ZEROMQ_LIBS="$lib -lzmq"
AC_DEFINE(HAVE_ZEROMQ, 1, [define if you have ZeroMQ])
have_zeromq=yes
break
fi
done
fi
if test "x$have_zeromq" != "xyes"; then
AC_MSG_ERROR([The ZeroMQ library cannot be found. You may want to install zeromq-devel (RPM-based)/zeromq-dev (Debian-based) package.])
fi
## ZeroMQ version
zeromq_lib_version_req=ifelse([$1], ,2.0,$1)
AC_MSG_CHECKING(for zeromq lib version >= $zeromq_lib_version_req)
succeeded=no
zeromq_lib_version_req_shorten=`expr $zeromq_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
zeromq_lib_version_req_major=`expr $zeromq_lib_version_req : '\([[0-9]]*\)'`
zeromq_lib_version_req_minor=`expr $zeromq_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
WANT_ZEROMQ_VERSION=`expr $zeromq_lib_version_req_major \* 100 \+ $zeromq_lib_version_req_minor`
# The lines specifying the ZeroMQ version are like the following:
#define ZMQ_VERSION_MAJOR 2
#define ZMQ_VERSION_MINOR 1
#define ZMQ_VERSION_PATCH 4
zeromq_version_major=`grep "define ZMQ_VERSION_MAJOR" ${ac_zeromq_path}/zmq.h | cut -d' ' -f3`
zeromq_version_minor=`grep "define ZMQ_VERSION_MINOR" ${ac_zeromq_path}/zmq.h | cut -d' ' -f3`
zeromq_version_computed=`expr $zeromq_version_major \* 100 \+ $zeromq_version_minor`
ZEROMQ_VERSION="${zeromq_version_major}.${zeromq_version_minor}"
if test ${zeromq_version_computed} -ge ${WANT_ZEROMQ_VERSION}
then
AC_MSG_RESULT([yes (${ZEROMQ_VERSION}.)])
else
AC_MSG_ERROR([The version (${ZEROMQ_VERSION}) of the ZeroMQ library is too old. You may want to upgrade your zeromq package.])
fi
##
AC_SUBST([ZEROMQ_VERSION])
AC_SUBST([ZEROMQ_CFLAGS])
AC_SUBST([ZEROMQ_LIBS])
AC_LANG_RESTORE
])