SimDist/build
diff -N clhep.gmk.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ clhep.gmk.in 25 May 2006 00:30:45 -0000 1.1
@@ -0,0 +1,38 @@
+ifndef CLHEP_INCLUDED
+
+CLHEP_INCLUDED := 1
+
+ifdef REQUIRE_CLHEP
+
+CLHEP_SET := 1
+
+CLHEP_BASEDIR := @CLHEP_BASEDIR@
+
+ifdef HAVE_CLHEP_CONFIG
+ export CLHEP_CONFIG := @CLHEP_CONFIG@
+endif
+
+CLHEP_INCLUDEDIR := @CLHEP_INCLUDEDIR@
+CLHEP_LIBDIR := @CLHEP_LIBDIR@
+CLHEP_LIBNAME := @CLHEP_LIBNAME@
+
+# Loader flags.
+#LDFLAGS += -L$(CLHEP_LIBDIR) -l$(CLHEP_LIBNAME)
+
+# Compilation flags.
+#CXXFLAGS += -I$(CLHEP_INCLUDEDIR)
+
+# Update run-time library path
+#ifeq ($(strip $(LD_LIBRARY_PATH)),)
+# LD_LIBRARY_PATH := $(CLHEP_LIBDIR)
+#else
+# LD_LIBRARY_PATH := $(CLHEP_LIBDIR):$(LD_LIBRARY_PATH)
+#endif
+
+endif
+
+endif
+
+.PHONY: clhep
+clhep:
+ echo "CLHEP SET: $(CLHEP_SET)"
SimDist/build
diff -N clhep.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ clhep.m4 25 May 2006 00:30:45 -0000 1.1
@@ -0,0 +1,363 @@
+dnl $Id: clhep.m4,v 1.1 2006/05/25 00:30:45 jeremy Exp $
+
+dnl /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
+dnl
+dnl CLHEP utility macros for Autoconf builds.
+dnl
+dnl AC_CLHEP_BASEDIR - Set CLHEP_BASEDIR
+dnl AC_CLHEP_CONFIG - Find clhep-config
+dnl AC_CLHEP_INCLUDEDIR - Set CLHEP_INCLUDEDIR (for -I)
+dnl AC_CLHEP_LIBDIR - Set CLHEP_LIBDIR (for -L)
+dnl AC_CLHEP_LIBNAME - Set name of CLHEP library (for -l)
+dnl AC_CLHEP_COMPILE - Test compile.
+dnl
+dnl /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
+
+dnl
+dnl Macro for top-level CLHEP configuration.
+dnl Defines HAVE_CLHEP if runs successfully.
+dnl
+AC_DEFUN([AC_CLHEP],
+[
+ AC_REQUIRE([AC_CLHEP_BASEDIR])
+ AC_REQUIRE([AC_CLHEP_CONFIG])
+ AC_REQUIRE([AC_CLHEP_INCLUDEDIR])
+ AC_REQUIRE([AC_CLHEP_LIBDIR])
+ AC_REQUIRE([AC_CLHEP_LIBNAME])
+ AC_REQUIRE([AC_CLHEP_COMPILE])
+ AC_REQUIRE([AC_CLHEP_VERSION])
+ AC_DEFINE(HAVE_CLHEP)
+])
+
+dnl
+dnl Macro to set CLHEP_BASEDIR from environment or user argument.
+dnl
+dnl Precedence:
+dnl
+dnl 1) CLHEP_BASEDIR from environment.
+dnl 2) --with-clhep-basedir argument.
+dnl 3) CLHEP_BASE_DIR from environment (Geant4 setup).
+dnl
+AC_DEFUN([AC_CLHEP_BASEDIR],
+[
+ AC_ARG_VAR([CLHEP_BASEDIR],[base installation directory of CLHEP package, containing directories bin, lib, include, etc.])
+
+ AC_MSG_CHECKING(for CLHEP_BASEDIR)
+
+ dnl Check for user argument if env var not set.
+ if test -z "$CLHEP_BASEDIR"
+ then
+ AC_ARG_WITH(clhep-basedir,
+ AC_HELP_STRING([--with-clhep-basedir=<path>],
+ [absolute path to CLHEP base install directory]),
+ [
+ if test "$withval" != "yes"
+ then
+ CLHEP_BASEDIR="$withval"
+ fi
+ ]
+ )
+ fi
+
+ dnl If wasn not set, maybe can get from CLHEP env var.
+ if test -n "$CLHEP_BASE_DIR"
+ then
+ CLHEP_BASEDIR=$CLHEP_BASE_DIR
+ fi
+
+ dnl If still not found, then exit with error.
+ if test -z "$CLHEP_BASEDIR"
+ then
+ AC_MSG_ERROR(CLHEP_BASEDIR could not be set from args or environment)
+ fi
+
+ dnl Is it a directory?
+ if ! test -d "$CLHEP_BASEDIR"
+ then
+ AC_MSG_ERROR($CLHEP_BASEDIR does not exist or is not a directory)
+ fi
+
+ AC_MSG_RESULT($CLHEP_BASEDIR)
+
+ dnl Substitute to output.
+ AC_SUBST(CLHEP_BASEDIR)
+])
+
+dnl
+dnl Sets CLHEP_CONFIG to relative or absolute path of clhep-config script, depending on how it is found.
+dnl Defines HAVE_CLHEP_CONFIG if clhep-config is found.
+dnl
+dnl Precedence:
+dnl
+dnl 1) Relative path with AC_CHECK_PROG.
+dnl 2) Absolute path based on CLHEP_BASEDIR.
+dnl
+AC_DEFUN([AC_CLHEP_CONFIG],
+[
+ AC_CHECK_PROG(CLHEP_CONFIG, clhep-config)
+
+ if test -z "$CLHEP_CONFIG"
+ then
+ if test -n "$CLHEP_BASEDIR"
+ then
+ AC_CHECK_FILE($CLHEP_BASEDIR/bin/clhep-config,
+ [
+ CLHEP_CONFIG=$CLHEP_BASEDIR/bin/clhep-config
+ AC_SUBST(CLHEP_CONFIG)
+ ]
+ )
+ fi
+ fi
+
+ if test -n "$CLHEP_CONFIG"
+ then
+ AC_DEFINE(HAVE_CLHEP_CONFIG)
+ fi
+
+ AC_SUBST(CLHEP_CONFIG)
+])
+
+dnl
+dnl Macro to set CLHEP_INCLUDEDIR from environment or user argument.
+dnl
+dnl Precedence:
+dnl
+dnl 1) CLHEP_INCLUDEDIR from environment.
+dnl 2) --with-clhep-includedir argument.
+dnl 3) CLHEP_INCLUDE_DIR from environment (which is set with Geant4 setup).
+dnl 4) Value grepped from command `clhep-config --include`.
+dnl 5) CLHEP_BASEDIR/include directory.
+dnl
+AC_DEFUN([AC_CLHEP_INCLUDEDIR],
+[
+
+ dnl Use CLHEP_INCLUDEDIR as precious input var.
+ dnl Deliberately avoid using CLHEP_INCLUDE_DIR used by Geant4.
+ AC_ARG_VAR([CLHEP_INCLUDEDIR],[directory containing the CLHEP headers, which should itself contain a directory called CLHEP])
+
+ AC_MSG_CHECKING([for CLHEP_INCLUDEDIR])
+
+ dnl Only for args if CLHEP_INCLUDEDIR is not set.
+ if test -z "$CLHEP_INCLUDEDIR"
+ then
+ dnl User argument for CLHEP_INCLUDEDIR
+ AC_ARG_WITH(clhep-includedir,
+ AC_HELP_STRING([--with-clhep-includedir=<path>],
+ [absolute path to CLHEP include directory]),
+ [ if test "$withval" != "yes"
+ then
+ CLHEP_INCLUDEDIR="$withval"
+ fi
+ ]
+ )
+ fi
+
+ dnl Set from environment variable CLHEP_INCLUDE_DIR.
+ if test -n "$CLHEP_INCLUDE_DIR"
+ then
+ CLHEP_INCLUDEDIR=$CLHEP_INCLUDE_DIR
+ fi
+
+ dnl Set using clhep-config
+ if test -z "$CLHEP_INCLUDEDIR"
+ then
+ if test -n "$CLHEP_CONFIG"
+ then
+ CLHEP_INCLUDEDIR=$(${CLHEP_CONFIG} --include | sed 's/-I//g')
+ fi
+ fi
+
+ dnl Set using CLHEP_BASEDIR.
+ if test -z "$CLHEP_INCLUDEDIR"
+ then
+ if test -z "$CLHEP_INCLUDEDIR"
+ then
+ CLHEP_INCLUDEDIR=$CLHEP_BASEDIR/include
+ fi
+ fi
+
+ dnl If not set by now then there is a problem.
+ if test -z "$CLHEP_INCLUDEDIR"
+ then
+ AC_MSG_ERROR(CLHEP_INCLUDEDIR could not be set)
+ fi
+
+ dnl Test for directory.
+ if ! test -d "$CLHEP_INCLUDEDIR"
+ then
+ AC_MSG_ERROR($CLHEP_INCLUDEDIR does not exist, or it is not a directory)
+ fi
+
+ AC_MSG_RESULT($CLHEP_INCLUDEDIR)
+
+ dnl Test for header generated during build.
+ AC_CHECK_FILE(${CLHEP_INCLUDEDIR}/CLHEP/config/CLHEP.h,,AC_MSG_ERROR([CLHEP include directory does not contain CLHEP/config/CLHEP.h]))
+
+ dnl Substitute to output.
+ AC_SUBST(CLHEP_INCLUDEDIR)
+
+])
+
+dnl
+dnl Macro to set CLHEP_LIBDIR.
+dnl
+dnl Precedence:
+dnl
+dnl 1) CLHEP_LIBDIR from environment.
+dnl 2) --with-clhep-libdir argument.
+dnl 3) CLHEP_LIB_DIR from environment.
+dnl 4) Value grepped from `clhep-config --lib` (the -L arg).
+dnl 5) CLHEP_BASEDIR/lib directory.
+dnl
+AC_DEFUN([AC_CLHEP_LIBDIR],
+[
+
+ AC_ARG_VAR([CLHEP_LIBDIR],[directory containing the CLHEP library])
+
+ AC_MSG_CHECKING([for CLHEP_LIBDIR directory])
+
+ dnl User argument.
+ if test -z "$CLHEP_LIBDIR"
+ then
+ dnl User argument for CLHEP_INCLUDEDIR
+ AC_ARG_WITH(clhep-libdir,
+ AC_HELP_STRING([--with-clhep-libdir=<path>],
+ [absolute path to CLHEP lib directory]),
+ [ if test "$withval" != "yes"
+ then
+ CLHEP_LIBDIR="$withval"
+ fi
+ ]
+ )
+ fi
+
+ dnl Set from CLHEP_LIB_DIR
+ if test -z "$CLHEP_LIBDIR"
+ then
+ if test -n "$CLHEP_LIB_DIR"
+ then
+ CLHEP_LIBDIR=$CLHEP_LIB_DIR
+ fi
+ fi
+
+ dnl Use clhep-config.
+ if test -z "$CLHEP_LIBDIR"
+ then
+ if test -n "$CLHEP_CONFIG"
+ then
+ CLHEP_LIBDIR=$(${CLHEP_CONFIG} --libs | grep -o "\-L[[a-zA-Z0-9/-]]*" | sed 's/-L//g')
+ fi
+ fi
+
+ dnl Set from CLHEP_BASEDIR.
+ if test -z "$CLHEP_LIBDIR"
+ then
+ if test -n "$CLHEP_LIBDIR"
+ then
+ CLHEP_LIBDIR=$CLHEP_BASEDIR/lib
+ fi
+ fi
+
+ AC_MSG_RESULT($CLHEP_LIBDIR)
+
+ AC_SUBST(CLHEP_LIBDIR)
+])
+
+dnl
+dnl Macro to set the name of the CLHEP library.
+dnl
+dnl Precendence:
+dnl
+dnl 1) CLHEP_LIBNAME from environment.
+dnl 2) --with-clhep-libname argument.
+dnl 3) Value grepped from `clhep-config --lib` (-l arg).
+dnl
+AC_DEFUN([AC_CLHEP_LIBNAME],
+[
+
+ AC_ARG_VAR([CLHEP_LIBNAME],[name of the CLHEP library, without library prefix or static, shared extension])
+
+ AC_MSG_CHECKING([for CLHEP_LIBNAME])
+
+ dnl Check for user argument if env var not set.
+ if test -z "$CLHEP_LIBNAME"
+ then
+ AC_ARG_WITH(clhep-libname,
+ AC_HELP_STRING([--with-clhep-libname=<path>],
+ [name of CLHEP library with (NO prefix or file extension)]),
+ [
+ if test "$withval" != "yes"
+ then
+ CLHEP_LIBNAME="$withval"
+ fi
+ ]
+ )
+ fi
+
+ dnl Use clhep-config --libs to find versioned lib
+ if test -z "$CLHEP_LIBNAME"
+ then
+ if test -n "$CLHEP_CONFIG"
+ then
+ CLHEP_LIBNAME=$(${CLHEP_CONFIG} --libs | grep -o "\-l[[a-zA-Z0-9-]].*" | sed 's/-l//g')
+ fi
+ fi
+
+ dnl Problem setting lib name.
+ if test -z "$CLHEP_LIBNAME"
+ then
+ AC_MSG_ERROR(CLHEP_LIBNAME could not be set)
+ fi
+
+ AC_MSG_RESULT($CLHEP_LIBNAME)
+
+ AC_SUBST(CLHEP_LIBNAME)
+])
+
+
+dnl
+dnl Simple CLHEP compile test.
+dnl
+AC_DEFUN([AC_CLHEP_COMPILE],
+[
+ AC_MSG_CHECKING(whether CLHEP test compile works)
+
+ AC_LANG([C++])
+
+ # Store current CPPFLAGS settings.
+ OLDCPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$OLDCPPFLAGS -I${CLHEP_INCLUDEDIR} -L${CLHEP_LIBDIR} -l${CLHEP_LIBNAME}"
+
+ AC_TRY_COMPILE([
+ #include <CLHEP/Random/Random.h>
+ ],
+ [
+ class _clhepcheck
+ {
+ _clhepcheck()
+ {
+ HepRandom* r = new HepRandom();
+ }
+ };
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ ],
+ [
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(CLHEP test compile failed)
+ ]
+ )
+
+ # Restore CPPFLAGS.
+ CPPFLAGS=$OLDCPPFLAGS
+])
+
+dnl
+dnl Macro to set defines of CLHEP version components.
+dnl
+AC_DEFUN([AC_CLHEP_VERSION],
+[
+
+
+])