Page MenuHomeHEPForge

No OneTemporary

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1,328 +1,330 @@
## Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([Rivet],[2.6.0-pre],[rivet@projects.hepforge.org],[Rivet])
## Check and block installation into the src/build dir
if test "$prefix" = "$PWD"; then
AC_MSG_ERROR([Installation into the build directory is not supported: use a different --prefix argument])
fi
## Force default prefix to have a path value rather than NONE
if test "$prefix" = "NONE"; then
prefix=/usr/local
fi
AC_CONFIG_SRCDIR([src/Core/Analysis.cc])
AC_CONFIG_HEADERS([include/Rivet/Config/DummyConfig.hh include/Rivet/Config/RivetConfig.hh include/Rivet/Config/BuildOptions.hh])
AM_INIT_AUTOMAKE([dist-bzip2 -Wall 1.10])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST(LT_OBJDIR)
## Package-specific #defines
AC_DEFINE_UNQUOTED(RIVET_VERSION, "$PACKAGE_VERSION", "Rivet version string")
AC_DEFINE_UNQUOTED(RIVET_NAME, "$PACKAGE_NAME", "Rivet name string")
AC_DEFINE_UNQUOTED(RIVET_STRING, "$PACKAGE_STRING", "Rivet name and version string")
AC_DEFINE_UNQUOTED(RIVET_TARNAME, "$PACKAGE_TARNAME", "Rivet short name string")
AC_DEFINE_UNQUOTED(RIVET_BUGREPORT, "$PACKAGE_BUGREPORT", "Rivet contact email address")
## OS X
AC_CEDAR_OSX
## Work out the LCG platform tag
AC_LCG_TAG
## Set default compiler flags
if test "x$CXXFLAGS" == "x"; then CXXFLAGS="-O2"; fi
## Compiler setup
AC_LANG(C++)
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
## Store and propagate the compiler identity and flags
RIVETCXX="$CXX"
AC_SUBST(RIVETCXX)
RIVETCXXFLAGS="$CXXFLAGS"
AC_SUBST(RIVETCXXFLAGS)
## Checks for programs.
AC_PROG_INSTALL
AC_PROG_LN_S
AC_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AC_FUNC_STRERROR_R
## YODA histogramming library
AC_CEDAR_LIBRARYANDHEADERS([YODA], , , [AC_MSG_ERROR([YODA is required])])
YODABINPATH=$YODALIBPATH/../bin
AC_SUBST(YODABINPATH)
AC_PATH_PROG(YODACONFIG, yoda-config, [], [$YODALIBPATH/../bin:$PATH])
YODA_PYTHONPATH=""
if test -f "$YODACONFIG"; then
AC_MSG_CHECKING([YODA version using yoda-config])
YODA_VERSION=`$YODACONFIG --version`
AC_MSG_RESULT([$YODA_VERSION])
YODA_VERSION1=[`echo $YODA_VERSION | cut -d. -f1 | sed -e 's/\([0-9]*\).*/\1/g'`]
YODA_VERSION2=[`echo $YODA_VERSION | cut -d. -f2 | sed -e 's/\([0-9]*\).*/\1/g'`]
YODA_VERSION3=[`echo $YODA_VERSION | cut -d. -f3 | sed -e 's/\([0-9]*\).*/\1/g'`]
let YODA_VERSION_INT=YODA_VERSION1*10000+YODA_VERSION2*100+YODA_VERSION3
if test $YODA_VERSION_INT -lt 10500; then
AC_MSG_ERROR([YODA version isn't sufficient: at least version 1.5.0 required])
fi
AC_MSG_CHECKING([YODA Python path using yoda-config])
YODA_PYTHONPATH=`$YODACONFIG --pythonpath`
AC_MSG_RESULT([$YODA_PYTHONPATH])
fi
AC_SUBST(YODA_PYTHONPATH)
## HepMC event record library
AC_CEDAR_LIBRARYANDHEADERS([HepMC], , , [AC_MSG_ERROR([HepMC is required])])
oldCPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$HEPMCINCPATH"
if test -e "$HEPMCINCPATH/HepMC/HepMCDefs.h"; then
AC_LANG_CONFTEST([AC_LANG_SOURCE([#include <iostream>
#include "HepMC/HepMCDefs.h"
int main() { std::cout << HEPMC_VERSION << std::endl; return 0; }])])
else
AC_LANG_CONFTEST([AC_LANG_SOURCE([#include <iostream>
#include "HepMC/defs.h"
int main() { std::cout << VERSION << std::endl; return 0; }])])
fi
if test -f conftest.cc; then
$CXX $CPPFLAGS conftest.cc -o conftest 2>&1 1>&5
elif test -f conftest.C; then
$CXX $CPPFLAGS conftest.C -o conftest 2>&1 1>&5
else
$CXX $CPPFLAGS conftest.cpp -o conftest 2>&1 1>&5
fi
hepmc_version=`./conftest`
if test x$hepmc_version != x; then
let hepmc_major=`echo "$hepmc_version" | cut -d. -f1`
let hepmc_minor=`echo "$hepmc_version" | cut -d. -f2`
fi
rm -f conftest conftest.cpp conftest.cc conftest.C
HEPMC_VERSION=$hepmc_major$hepmc_minor
AC_MSG_NOTICE([HepMC version is $hepmc_version -> $HEPMC_VERSION])
AC_SUBST(HEPMC_VERSION)
CPPFLAGS=$oldCPPFLAGS
## FastJet clustering library
AC_CEDAR_LIBRARYANDHEADERS([fastjet], , , [AC_MSG_ERROR([FastJet is required])])
AC_PATH_PROG(FJCONFIG, fastjet-config, [], $FASTJETPATH/bin:$PATH)
if test -f "$FJCONFIG"; then
AC_MSG_CHECKING([FastJet version using fastjet-config])
fjversion=`$FJCONFIG --version`
AC_MSG_RESULT([$fjversion])
fjmajor=$(echo $fjversion | cut -f1 -d.)
fjminor=$(echo $fjversion | cut -f2 -d.)
fjmicro=$(echo $fjversion | cut -f3 -d.)
if test "$fjmajor" -lt 3; then
AC_MSG_ERROR([FastJet version 3.0.0 or later is required])
fi
FASTJETCONFIGLIBADD="$($FJCONFIG --plugins --shared --libs)"
else
FASTJETCONFIGLIBADD="-L$FASTJETLIBPATH -l$FASTJETLIBNAME"
FASTJETCONFIGLIBADD="$FASTJETCONFIGLIBADD -lSISConePlugin -lsiscone -lsiscone_spherical"
FASTJETCONFIGLIBADD="$FASTJETCONFIGLIBADD -lCDFConesPlugin -lD0RunIIConePlugin -lNestedDefsPlugin"
FASTJETCONFIGLIBADD="$FASTJETCONFIGLIBADD -lTrackJetPlugin -lATLASConePlugin -lCMSIterativeConePlugin"
FASTJETCONFIGLIBADD="$FASTJETCONFIGLIBADD -lEECambridgePlugin -lJadePlugin"
fi;
AC_MSG_NOTICE([FastJet LIBADD = $FASTJETCONFIGLIBADD])
AC_SUBST(FASTJETCONFIGLIBADD)
# Check for FastJet headers that require the --enable-all(cxx)plugins option
FASTJET_ERRMSG="Required FastJet plugin headers were not found: did you build FastJet with the --enable-allcxxplugins option?"
oldCPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$FASTJETINCPATH"
AC_CHECK_HEADER([fastjet/D0RunIIConePlugin.hh], [], [AC_MSG_ERROR([$FASTJET_ERRMSG])])
AC_CHECK_HEADER([fastjet/TrackJetPlugin.hh], [], [AC_MSG_ERROR([$FASTJET_ERRMSG])])
CPPFLAGS=$oldCPPFLAGS
# ## GNU Scientific Library
# AC_SEARCH_GSL
# AC_CEDAR_HEADERS([gsl], , , [AC_MSG_ERROR([GSL (GNU Scientific Library) is required])])
# oldCPPFLAGS=$CPPFLAGS
# CPPFLAGS="$CPPFLAGS -I$GSLINCPATH"
# AC_CHECK_HEADER([gsl/gsl_vector.h], [], [AC_MSG_ERROR([GSL vectors not found.])])
# CPPFLAGS=$oldCPPFLAGS
## Disable build/install of standard analyses
AC_ARG_ENABLE([analyses],
[AC_HELP_STRING(--disable-analyses, [don't try to build or install standard analyses])],
[], [enable_analyses=yes])
if test x$enable_analyses != xyes; then
AC_MSG_WARN([Not building standard Rivet analyses, by request])
fi
AM_CONDITIONAL(ENABLE_ANALYSES, [test x$enable_analyses = xyes])
## Build LaTeX docs if possible...
AC_PATH_PROG(PDFLATEX, pdflatex)
AM_CONDITIONAL(WITH_PDFLATEX, [test x$PDFLATEX != x])
## ... unless told otherwise!
AC_ARG_ENABLE([pdfmanual],
[AC_HELP_STRING(--enable-pdfmanual, [build and install the manual])],
[], [enable_pdfmanual=no])
if test x$enable_pdfmanual = xyes; then
AC_MSG_WARN([Building Rivet manual, by request])
fi
AM_CONDITIONAL(ENABLE_PDFMANUAL, [test x$enable_pdfmanual = xyes])
## Build Doxygen documentation if possible
AC_ARG_ENABLE([doxygen],
[AC_HELP_STRING(--disable-doxygen, [don't try to make Doxygen documentation])],
[], [enable_doxygen=yes])
if test x$enable_doxygen = xyes; then
AC_PATH_PROG(DOXYGEN, doxygen)
fi
AM_CONDITIONAL(WITH_DOXYGEN, [test x$DOXYGEN != x])
## Build asciidoc docs if possible
AC_PATH_PROG(ASCIIDOC, asciidoc)
AM_CONDITIONAL(WITH_ASCIIDOC, [test x$ASCIIDOC != x])
## Python extension
AC_ARG_ENABLE(pyext, [AC_HELP_STRING(--disable-pyext,
[don't build Python module (default=build)])],
[], [enable_pyext=yes])
## Basic Python checks
if test x$enable_pyext == xyes; then
AX_PYTHON_DEVEL([>= '2.6'])
AC_SUBST(PYTHON_VERSION)
- RIVET_PYTHONPATH=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(prefix='$prefix', plat_specific=True);"`
+ RIVET_PYTHONPATH=`$PYTHON -c "from __future__ import print_function;
+import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(prefix='$prefix', plat_specific=True));"`
AC_SUBST(RIVET_PYTHONPATH)
if test -z "$PYTHON"; then
AC_MSG_ERROR([Can't build Python extension since python can't be found])
enable_pyext=no
fi
if test -z "$PYTHON_CPPFLAGS"; then
AC_MSG_ERROR([Can't build Python extension since Python.h header file cannot be found])
enable_pyext=no
fi
fi
AM_CONDITIONAL(ENABLE_PYEXT, [test x$enable_pyext == xyes])
dnl
dnl setup.py puts its build artifacts into a labelled path
dnl this helps the test scripts to find them locally instead of
dnl having to install first
dnl
-RIVET_SETUP_PY_PATH=$(${PYTHON} -c 'import distutils.util as u, sys; vi=sys.version_info; print "lib.%s-%s.%s" % (u.get_platform(),vi.major, vi.minor)')
+RIVET_SETUP_PY_PATH=$(${PYTHON} -c 'from __future__ import print_function;
+import distutils.util as u, sys; vi=sys.version_info; print("lib.%s-%s.%s" % (u.get_platform(),vi.major, vi.minor))')
AC_SUBST(RIVET_SETUP_PY_PATH)
## Cython checks
if test x$enable_pyext == xyes; then
AM_CHECK_CYTHON([0.24.0], [:], [:])
if test x$CYTHON_FOUND = xyes; then
AC_MSG_NOTICE([Cython >= 0.24 found: Python extension source can be rebuilt (for developers)])
fi
AC_CHECK_FILE([pyext/rivet/core.cpp],
[],
[if test "x$CYTHON_FOUND" != "xyes"; then
AC_MSG_ERROR([Cython is required for --enable-pyext, no pre-built core.cpp was found.])
fi])
cython_compiler=$CXX
## Set extra Python extension build flags (to cope with Cython output code oddities)
PYEXT_CXXFLAGS="$CXXFLAGS"
AC_CEDAR_CHECKCXXFLAG([-Wno-unused-but-set-variable], [PYEXT_CXXFLAGS="$PYEXT_CXXFLAGS -Wno-unused-but-set-variable"])
AC_CEDAR_CHECKCXXFLAG([-Wno-sign-compare], [PYEXT_CXXFLAGS="$PYEXT_CXXFLAGS -Wno-sign-compare"])
AC_SUBST(PYEXT_CXXFLAGS)
AC_MSG_NOTICE([All Python build checks successful: 'rivet' Python extension will be built])
fi
AM_CONDITIONAL(WITH_CYTHON, [test x$CYTHON_FOUND = xyes])
## Set default build flags
AM_CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include"
#AM_CPPFLAGS="$AM_CPPFLAGS -I\$(top_srcdir)/include/eigen3"
#AM_CPPFLAGS="$AM_CPPFLAGS \$(GSL_CPPFLAGS)"
dnl AM_CPPFLAGS="$AM_CPPFLAGS \$(BOOST_CPPFLAGS)"
AM_CPPFLAGS="$AM_CPPFLAGS -I\$(YODAINCPATH)"
AM_CPPFLAGS="$AM_CPPFLAGS -I\$(HEPMCINCPATH)"
AM_CPPFLAGS="$AM_CPPFLAGS -I\$(FASTJETINCPATH)"
AC_CEDAR_CHECKCXXFLAG([-pedantic], [AM_CXXFLAGS="$AM_CXXFLAGS -pedantic"])
AC_CEDAR_CHECKCXXFLAG([-Wall], [AM_CXXFLAGS="$AM_CXXFLAGS -Wall"])
AC_CEDAR_CHECKCXXFLAG([-Wno-long-long], [AM_CXXFLAGS="$AM_CXXFLAGS -Wno-long-long"])
AC_CEDAR_CHECKCXXFLAG([-Wno-format], [AM_CXXFLAGS="$AM_CXXFLAGS -Wno-format"])
dnl AC_CEDAR_CHECKCXXFLAG([-Wno-unused-variable], [AM_CXXFLAGS="$AM_CXXFLAGS -Wno-unused-variable"])
AC_CEDAR_CHECKCXXFLAG([-Werror=uninitialized], [AM_CXXFLAGS="$AM_CXXFLAGS -Werror=uninitialized"])
AC_CEDAR_CHECKCXXFLAG([-Werror=delete-non-virtual-dtor], [AM_CXXFLAGS="$AM_CXXFLAGS -Werror=delete-non-virtual-dtor"])
## Add OpenMP-enabling flags if possible
AX_OPENMP([AM_CXXFLAGS="$AM_CXXFLAGS $OPENMP_CXXFLAGS"])
## Optional zlib support for gzip-compressed data streams/files
AX_CHECK_ZLIB
## Debug flag (default=-DNDEBUG, enabled=-g)
AC_ARG_ENABLE([debug], [AC_HELP_STRING(--enable-debug,
[build with debugging symbols @<:@default=no@:>@])], [], [enable_debug=no])
if test x$enable_debug == xyes; then
AM_CXXFLAGS="$AM_CXXFLAGS -g"
fi
## Extra warnings flag (default=none)
AC_ARG_ENABLE([extra-warnings], [AC_HELP_STRING(--enable-extra-warnings,
[build with extra compiler warnings (recommended for developers) @<:@default=no@:>@])], [], [enable_extra_warnings=no])
if test x$enable_extra_warnings == xyes; then
AC_CEDAR_CHECKCXXFLAG([-Wextra], [AM_CXXFLAGS="$AM_CXXFLAGS -Wextra "])
fi
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CXXFLAGS)
AC_EMPTY_SUBST
AC_CONFIG_FILES(Makefile Doxyfile)
AC_CONFIG_FILES(include/Makefile include/Rivet/Makefile)
AC_CONFIG_FILES(src/Makefile)
AC_CONFIG_FILES(src/Core/Makefile src/Core/yamlcpp/Makefile)
AC_CONFIG_FILES(src/Tools/Makefile)
AC_CONFIG_FILES(src/Projections/Makefile)
AC_CONFIG_FILES(src/AnalysisTools/Makefile)
AC_CONFIG_FILES(analyses/Makefile)
AC_CONFIG_FILES(test/Makefile)
AC_CONFIG_FILES(pyext/Makefile pyext/rivet/Makefile pyext/setup.py)
AC_CONFIG_FILES(data/Makefile data/texmf/Makefile)
AC_CONFIG_FILES(doc/Makefile)
AC_CONFIG_FILES(doc/rivetversion.sty doc/diffanas)
AC_CONFIG_FILES(bin/Makefile bin/rivet-config bin/rivet-buildplugin)
AC_CONFIG_FILES(rivetenv.sh rivetenv.csh rivet.pc)
AC_OUTPUT
if test x$enable_pyrivet == xyes; then
cat <<EOF
************************************************************
RIVET CONFIGURED!
Now build and install (to the $prefix tree) with e.g.
make -j2 && make -j2 install
To use Rivet, we recommend reading HepMC files from a file
or pipe (the latter may be made with mkfifo) using the
'rivet' executable.
For a more pleasant command line experience, you can include
the data/rivet-completion file into your .bashrc file,
or your bash_completion.d directory if you have one.
The rivetenv.*sh files will not be installed, but can help you
to set up a Rivet runtime environment in future.
************************************************************
EOF
fi
diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4
--- a/m4/ax_python_devel.m4
+++ b/m4/ax_python_devel.m4
@@ -1,330 +1,330 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_python_devel.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PYTHON_DEVEL([version])
#
# DESCRIPTION
#
# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
# in your configure.ac.
#
# This macro checks for Python and tries to get the include path to
# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LIBS) output
# variables. It also exports $(PYTHON_EXTRA_LIBS) and
# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
#
# You can search for some particular version of Python by passing a
# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
# note that you *have* to pass also an operator along with the version to
# match, and pay special attention to the single quotes surrounding the
# version number. Don't use "PYTHON_VERSION" for this: that environment
# variable is declared as precious and thus reserved for the end-user.
#
# This macro should work for all versions of Python >= 2.1.0. As an end
# user, you can disable the check for the python version by setting the
# PYTHON_NOVERSIONCHECK environment variable to something else than the
# empty string.
#
# If you need to use this macro for an older Python version, please
# contact the authors. We're always open for feedback.
#
# LICENSE
#
# Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de>
# Copyright (c) 2009 Alan W. Irwin
# Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net>
# Copyright (c) 2009 Andrew Collier
# Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org>
# Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org>
# Copyright (c) 2013 Daniel Mullner <muellner@math.stanford.edu>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 18
AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
AC_DEFUN([AX_PYTHON_DEVEL],[
#
# Allow the use of a (user set) custom python version
#
AC_ARG_VAR([PYTHON_VERSION],[The installed Python
version to use, for example '2.3'. This string
will be appended to the Python interpreter
canonical name.])
AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
if test -z "$PYTHON"; then
AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
PYTHON_VERSION=""
fi
#
# Check for a version of Python >= 2.1.0
#
AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
ac_supports_python_ver=`$PYTHON -c "import sys; \
ver = sys.version.split ()[[0]]; \
print (ver >= '2.1.0')"`
if test "$ac_supports_python_ver" != "True"; then
if test -z "$PYTHON_NOVERSIONCHECK"; then
AC_MSG_RESULT([no])
AC_MSG_FAILURE([
This version of the AC@&t@_PYTHON_DEVEL macro
doesn't work properly with versions of Python before
2.1.0. You may need to re-run configure, setting the
variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG,
PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
to something else than an empty string.
])
else
AC_MSG_RESULT([skip at user request])
fi
else
AC_MSG_RESULT([yes])
fi
#
# if the macro parameter ``version'' is set, honour it
#
if test -n "$1"; then
AC_MSG_CHECKING([for a version of Python $1])
ac_supports_python_ver=`$PYTHON -c "import sys; \
ver = sys.version.split ()[[0]]; \
print (ver $1)"`
if test "$ac_supports_python_ver" = "True"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([this package requires Python $1.
If you have it installed, but it isn't the default Python
interpreter in your system path, please pass the PYTHON_VERSION
variable to configure. See ``configure --help'' for reference.
])
PYTHON_VERSION=""
fi
fi
#
# Check if you have distutils, else fail
#
AC_MSG_CHECKING([for the distutils Python package])
ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
if test -z "$ac_distutils_result"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([cannot import Python module "distutils".
Please check your Python installation. The error was:
$ac_distutils_result])
PYTHON_VERSION=""
fi
#
# Check for Python include path
#
AC_MSG_CHECKING([for Python include path])
if test -z "$PYTHON_CPPFLAGS"; then
python_path=`$PYTHON -c "import distutils.sysconfig; \
print (distutils.sysconfig.get_python_inc ());"`
plat_python_path=`$PYTHON -c "import distutils.sysconfig; \
print (distutils.sysconfig.get_python_inc (plat_specific=1));"`
if test -n "${python_path}"; then
if test "${plat_python_path}" != "${python_path}"; then
python_path="-I$python_path -I$plat_python_path"
else
python_path="-I$python_path"
fi
fi
PYTHON_CPPFLAGS=$python_path
fi
AC_MSG_RESULT([$PYTHON_CPPFLAGS])
AC_SUBST([PYTHON_CPPFLAGS])
#
# Check for Python library path
#
AC_MSG_CHECKING([for Python library path])
if test -z "$PYTHON_LIBS"; then
# (makes two attempts to ensure we've got a version number
# from the interpreter)
ac_python_version=`cat<<EOD | $PYTHON -
# join all versioning strings, on some systems
# major/minor numbers could be in different list elements
from distutils.sysconfig import *
e = get_config_var('VERSION')
if e is not None:
print(e)
EOD`
if test -z "$ac_python_version"; then
if test -n "$PYTHON_VERSION"; then
ac_python_version=$PYTHON_VERSION
else
ac_python_version=`$PYTHON -c "import sys; \
print (sys.version[[:3]])"`
fi
fi
# Make the versioning information available to the compiler
AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
[If available, contains the Python version number currently in use.])
# First, the library directory:
ac_python_libdir=`cat<<EOD | $PYTHON -
# There should be only one
import distutils.sysconfig
e = distutils.sysconfig.get_config_var('LIBDIR')
if e is not None:
print (e)
EOD`
# Now, for the library:
ac_python_library=`cat<<EOD | $PYTHON -
import distutils.sysconfig
c = distutils.sysconfig.get_config_vars()
if 'LDVERSION' in c:
print ('python'+c[['LDVERSION']])
else:
print ('python'+c[['VERSION']])
EOD`
# This small piece shamelessly adapted from PostgreSQL python macro;
# credits goes to momjian, I think. I'd like to put the right name
# in the credits, if someone can point me in the right direction... ?
#
if test -n "$ac_python_libdir" -a -n "$ac_python_library"
then
# use the official shared library
ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`
PYTHON_LIBS="-L$ac_python_libdir -l$ac_python_library"
else
# old way: use libpython from python_configdir
ac_python_libdir=`$PYTHON -c \
"from distutils.sysconfig import get_python_lib as f; \
import os; \
print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version"
fi
if test -z "PYTHON_LIBS"; then
AC_MSG_ERROR([
Cannot determine location of your Python DSO. Please check it was installed with
dynamic libraries enabled, or try setting PYTHON_LIBS by hand.
])
fi
fi
AC_MSG_RESULT([$PYTHON_LIBS])
AC_SUBST([PYTHON_LIBS])
#
# Check for site packages
#
AC_MSG_CHECKING([for Python site-packages path])
if test -z "$PYTHON_SITE_PKG"; then
PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
print (distutils.sysconfig.get_python_lib(0,0));"`
fi
AC_MSG_RESULT([$PYTHON_SITE_PKG])
AC_SUBST([PYTHON_SITE_PKG])
#
# libraries which must be linked in when embedding
#
AC_MSG_CHECKING(python extra libraries)
- if test -z "$PYTHON_EXTRA_LDFLAGS"; then
- PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
- conf = distutils.sysconfig.get_config_var; \
- print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
- fi
+dnl if test -z "$PYTHON_EXTRA_LDFLAGS"; then
+dnl PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
+dnl conf = distutils.sysconfig.get_config_var; \
+dnl print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
+dnl fi
AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
AC_SUBST(PYTHON_EXTRA_LDFLAGS)
#
# linking flags needed when embedding
#
AC_MSG_CHECKING(python extra linking flags)
dnl
dnl removed by dg to try to fix the issue described in https://trac.macports.org/ticket/39223
dnl
dnl if test -z "$PYTHON_EXTRA_LIBS"; then
dnl PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
dnl conf = distutils.sysconfig.get_config_var; \
dnl print (conf('LINKFORSHARED'))"`
dnl fi
AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
AC_SUBST(PYTHON_EXTRA_LIBS)
#
# final check to see if everything compiles alright
#
AC_MSG_CHECKING([consistency of all components of python development environment])
# save current global flags
ac_save_LIBS="$LIBS"
ac_save_LDFLAGS="$LDFLAGS"
ac_save_CPPFLAGS="$CPPFLAGS"
LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS $PYTHON_EXTRA_LIBS"
LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
AC_LANG_PUSH([C])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <Python.h>]],
[[Py_Initialize();]])
],[pythonexists=yes],[pythonexists=no])
AC_LANG_POP([C])
# turn back to default flags
CPPFLAGS="$ac_save_CPPFLAGS"
LIBS="$ac_save_LIBS"
LDFLAGS="$ac_save_LDFLAGS"
AC_MSG_RESULT([$pythonexists])
if test ! "x$pythonexists" = "xyes"; then
AC_MSG_FAILURE([
Could not link test program to Python. Maybe the main Python library has been
installed in some non-standard library path. If so, pass it to configure,
via the LIBS environment variable.
Example: ./configure LIBS="-L/usr/non-standard-path/python/lib"
============================================================================
ERROR!
You probably have to install the development version of the Python package
for your distribution. The exact name of this package varies among them.
============================================================================
])
PYTHON_VERSION=""
fi
#
# all done!
#
])
diff --git a/m4/cython.m4 b/m4/cython.m4
--- a/m4/cython.m4
+++ b/m4/cython.m4
@@ -1,81 +1,81 @@
dnl Taken from the python bindings to the Enlightenment foundation libraries,
dnl and was part of a GPL package. I have included this file to fix the build.
dnl
dnl
dnl AM_CHECK_CYTHON([VERSION [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
dnl Check if a Cython version is installed
dnl Defines CYTHON_VERSION and CYTHON_FOUND
AC_DEFUN([AM_CHECK_CYTHON],
[
AC_REQUIRE([AM_PATH_PYTHON])
ifelse([$1], [], [_msg=""], [_msg=" >= $1"])
AC_MSG_CHECKING(for Cython$_msg)
AC_CACHE_VAL(py_cv_cython, [
-prog="import Cython.Compiler.Version; print Cython.Compiler.Version.version"
+prog="from __future__ import print_function; import Cython.Compiler.Version; print(Cython.Compiler.Version.version)"
CYTHON_VERSION=`$PYTHON -c "$prog" 2>&AC_FD_CC`
py_cv_cython=no
if test "x$CYTHON_VERSION" != "x"; then
py_cv_cython=yes
fi
if test "x$py_cv_cython" = "xyes"; then
ifelse([$1], [], [:],
[AS_VERSION_COMPARE([$CYTHON_VERSION], [$1], [py_cv_cython=no])])
fi
])
AC_MSG_RESULT([$py_cv_cython])
if test "x$py_cv_cython" = "xyes"; then
CYTHON_FOUND=yes
ifelse([$2], [], [:], [$2])
else
CYTHON_FOUND=no
ifelse([$3], [], [AC_MSG_ERROR([Could not find usable Cython$_msg])], [$3])
fi
])
dnl AM_CHECK_CYTHON_PRECOMPILED(FILE-LIST [, ACTION-IF-ALL [, ACTION-IF-NOT-ALL]])
dnl given a list of files ending in .pyx (FILE-LIST), check if their .c
dnl counterpart exists and is not older than the source.
dnl ACTION-IF-ALL is called only if no files failed the check and thus
dnl all pre-generated files are usable.
dnl ACTION-IF-NOT-ALL is called if some or all failed. If not provided,
dnl an error will be issued.
AC_DEFUN([AM_CHECK_CYTHON_PRECOMPILED],
[
_to_check_list="$1"
_failed_list=""
_exists_list=""
for inf in $_to_check_list; do
outf=`echo "$inf" | sed -e 's/^\(.*\)[.]pyx$/\1.c/'`
if test "$outf" = "$inf"; then
AC_MSG_WARN([File to check must end in .pyx, but got: $inf -- Skip])
continue
fi
AC_MSG_CHECKING([for pre-generated $outf for $inf])
if ! test -f "$outf"; then
_res=no
_failed_list="${_failed_list} $outf"
elif ! test "$outf" -nt "$inf"; then
_res="no (older)"
_failed_list="${_failed_list} $outf"
else
_res=yes
_exists_list="${_exists_list} $outf"
fi
AC_MSG_RESULT($_res)
done
if test -z "$_failed_list" -a -n "$_exists_list"; then
ifelse([$2], [], [:], [$2])
else
ifelse([$3], [],
[AC_MSG_ERROR([Missing pre-generated files: $_failed_list])],
[$3])
fi
])
diff --git a/pyext/rivet/util.py b/pyext/rivet/util.py
--- a/pyext/rivet/util.py
+++ b/pyext/rivet/util.py
@@ -1,204 +1,204 @@
"Python utility functions for use by Rivet scripts (and anyone else who wants to)"
def check_python_version(req_version=(2,6,0)):
"Enforce the Rivet scripts' minimal Python version requirement"
import sys
if sys.version_info[:3] < req_version:
sys.stderr.write( "Python version >= %s is required... exiting\n" % ".".join(req_version) )
sys.exit(1)
def set_process_name(name):
"Try to rename the process on Linux so it doesn't appear as 'python <scriptpath>'"
try:
## Try to use this: https://code.google.com/p/py-setproctitle/
import setproctitle
setproctitle.setproctitle(name)
except:
try:
## Fall back to a by-hand thing that doesn't work for me...
import ctypes
libc = ctypes.cdll.LoadLibrary("libc.so.6")
libc.prctl(15, name, 0, 0, 0)
except:
## And then give up ;-)
pass
def import_ET():
"Try to import the ElementTree XML parser, which has many historical import signatures"
ET = None
try:
import xml.etree.cElementTree as ET
except ImportError:
try:
import cElementTree as ET
except ImportError:
try:
import xml.etree.ElementTree as ET
except:
raise ImportError("Can't load the ElementTree XML parser (any of three historical ways)")
return ET
def htmlify(s, para=False):
"""Modify LaTeX text strings from analysis metadata for inclusion
in MathJax-enabled web page source code."""
if not s:
return s
t = s.replace("&", "&amp;")\
.replace("<","&lt;")\
.replace(">","&gt;")\
.replace(r"~", " ")
t = t.replace(r"\pT", r"p_\perp")\
.replace(r"\degree", r"^\circ")\
.replace(r"\MeV", r"\text{MeV}")\
.replace(r"\GeV", r"\text{GeV}")\
.replace(r"\TeV", r"\text{TeV}")
# t = t.replace(r"\;", " ")\
# .replace(r"\,", " ")\
# .replace(r"\!", "")
if para:
t = t.replace("\n\n", "</p><p>")
return t
def texify(s):
"Insert required TeX escapes"
if not s:
return s
t = s \
.replace(r"&", r"\&") \
.replace(r"\\&", r"\&") \
.replace(r"#", r"\#") \
# .replace(r"_", r"\_") \
# .replace(r"^", r"") \
return t
def texpand(s):
"Expand some physics-specific TeX macros."
if not s:
return s
t = s \
.replace(r"\kT", r"\ensuremath{k_\perp}\xspace") \
.replace(r"\kt", r"\ensuremath{k_\mathrm{T}}\xspace") \
.replace(r"\pT", r"\ensuremath{p_\perp}\xspace") \
.replace(r"\pt", r"\ensuremath{p_\mathrm{T}}\xspace") \
.replace(r"\sqrts", r"\ensuremath{\sqrt{s}}\xspace") \
.replace(r"\sqrtS", r"\ensuremath{\sqrt{s}}\xspace") \
.replace(r"\MeV", r"\text{M\eV}\xspace") \
.replace(r"\GeV", r"\text{G\eV}\xspace") \
.replace(r"\TeV", r"\text{T\eV}\xspace") \
.replace(r"\eV", r"\text{e\kern-0.15ex{}V}\xspace")
return t
def detex(tex):
"""Use pandoc (if available) to modify LaTeX text strings from
analysis metadata for use as plain text, e.g. as printed to the terminal.
The argument can either be a string or an iterable of strings.
- TODO: Replace \gamma, \mu, \tau, \Upsilon, \rho, \psi, \pi, \eta, \Delta, \Omega, \omega -> no-\ form?
+ TODO: Replace \gamma, \mu, \tau, \\Upsilon, \rho, \psi, \pi, \eta, \Delta, \Omega, \omega -> no-\ form?
TODO: Replace e^+- -> e+-?
"""
if not tex:
return tex
from distutils.spawn import find_executable
if not find_executable("pandoc"):
return tex
texheader = r"""
\newcommand{\text}[1]{#1}
\newcommand{\ensuremath}[1]{#1}
\newcommand{\emph}[1]{_#1_}
\newcommand{\textrm}[1]{#1}
\newcommand{\textit}[1]{_#1_}
\newcommand{\textbf}[1]{*#1*}
\newcommand{\mathrm}[1]{#1}
\newcommand{\mathit}[1]{_#1_}
\newcommand{\mathbf}[1]{*#1*}
\newcommand{\bm}[1]{*#1*}
\newcommand{\frac}[2]{#1/#2}
\newcommand{\sqrt}[1]{sqrt(#1)}
\newcommand{\hat}[1]{#1hat}
\newcommand{\bar}[1]{#1bar}
\newcommand{\d}[1]{d#1}
\newcommand{\degree}{^\circ }
\newcommand{\infty}{oo }
\newcommand{\exp}{exp }
\newcommand{\log}{log }
\newcommand{\ln}{ln }
\newcommand{\sin}{sin }
\newcommand{\cos}{cos }
\newcommand{\tan}{tan }
\newcommand{\sinh}{sinh }
\newcommand{\cosh}{cosh }
\newcommand{\tanh}{tanh }
\newcommand{\ell}{l}
\newcommand{\varphi}{\phi}
\newcommand{\varepsilon}{\epsilon}
\newcommand{\sim}{~}
\newcommand{\lesssim}{<~ }
\newcommand{\gtrsim}{>~ }
\newcommand{\neq}{!= }
\newcommand{\ge}{>= }
\newcommand{\gg}{>> }
\newcommand{\le}{<= }
\newcommand{\ll}{<< }
\newcommand{\pm}{+- }
\newcommand{\mp}{-+ }
\newcommand{\times}{x }
\newcommand{\cdot}{. }
\newcommand{\dots}{... }
\newcommand{\ldots}{... }
\newcommand{\langle}{<}
\newcommand{\rangle}{>}
\newcommand{\gets}{<- }
\newcommand{\to}{-> }
\newcommand{\leftarrow}{<- }
\newcommand{\rightarrow}{-> }
\newcommand{\leftrightarrow}{<-> }
\newcommand{\Leftarrow}{<= }
\newcommand{\Rightarrow}{=> }
\newcommand{\Leftrightarrow}{ }
\newcommand{\left}{}
\newcommand{\right}{}
\newcommand{\!}{}
\newcommand{\/}{}
\newcommand{\rm}{}
\newcommand{\it}{}
\newcommand{\,}{ }
\newcommand{\;}{ }
\newcommand{\ }{ }
\newcommand{\unit}[2]{#1 #2}
\newcommand{\bar}[1]{#1bar}
\newcommand{\pT}{pT }
\newcommand{\perp}{T}
\newcommand{\ast}{*}
\newcommand{\MeV}{MeV }
\newcommand{\GeV}{GeV }
\newcommand{\TeV}{TeV }
"""
import subprocess, shlex
nowrap_flags = "--wrap=none"
x = subprocess.Popen(["pandoc", nowrap_flags, "/dev/null"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
if x != 0:
nowrap_flags = "--no-wrap"
p = subprocess.Popen(shlex.split("pandoc -f latex -t plain " + nowrap_flags),
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
texbody = tex if type(tex) is str else "@@".join(tex)
# texbody = texbody.replace("$", "")
plain, err = p.communicate((texheader + texbody).replace("\n", ""))
plain = plain.replace("\n", "")
plains = plain.replace(r"\&", "&").split("@@")
if type(tex) is str:
assert len(plains) == 1
return plains[0] if plains[0] else tex
else:
return plains if plains else tex
# print detex(r"Foo \! $\int \text{bar} \d{x} \sim \; \frac{1}{3} \neq \emph{foo}$ \to \gg bar")
# print detex([r"Foo \! $\int \text{bar} \d{x} \sim", r"\frac{1}{3} \neq \emph{foo}$ \to \gg bar"])
diff --git a/pyext/setup.py.in b/pyext/setup.py.in
--- a/pyext/setup.py.in
+++ b/pyext/setup.py.in
@@ -1,65 +1,65 @@
#! /usr/bin/env python
from distutils.core import setup
from distutils.extension import Extension
from glob import glob
## Extension definition
import os.path
incdir1 = os.path.abspath("@abs_top_srcdir@/include")
incdir2 = os.path.abspath("@abs_top_builddir@/include")
incdir3 = os.path.abspath("@abs_srcdir@/rivet")
incdir4 = os.path.abspath("@abs_builddir@/rivet")
srcdir = os.path.abspath("@abs_top_srcdir@/src")
libdir = os.path.abspath("@abs_top_builddir@/src/.libs")
## Assemble the library search dirs
lookupdirs = [
libdir,
"@HEPMCLIBPATH@",
"@FASTJETLIBPATH@",
"@YODALIBPATH@" ]
-if os.environ.has_key("RIVET_LOCAL"):
+if "RIVET_LOCAL" in os.environ:
BASE_LINK_ARGS = ["-L@abs_top_builddir@/src/.libs"]
else:
BASE_LINK_ARGS = ["-L@prefix@/lib"]
## Be careful with extracting the GSL path from the flags string
# import re
# re_libdirflag = re.compile(r".*-L\s*(\S+).*")
# re_match = re_libdirflag.search("@GSL_LDFLAGS@")
# if re_match:
# lookupdirs.append( re_match.group(1) )
## A helper function
def ext(name, depends=[], statics=[]):
fullname = '@abs_builddir@/rivet/%s.cpp' % name
if not os.path.isfile(fullname): # distcheck has it in srcdir
fullname = os.path.relpath("@abs_srcdir@/rivet/%s.cpp" % name)
return Extension(
"rivet.%s" % name,
[fullname] + statics,
language="c++",
# depends=depends,
include_dirs=[incdir1, incdir2, incdir3, incdir4],
# extra_compile_args="-I@prefix@/include @PYEXT_CXXFLAGS@ @HEPMCCPPFLAGS@ @FASTJETCPPFLAGS@ @YODACPPFLAGS@ @GSLCPPFLAGS@".split(),
extra_compile_args="-I@prefix@/include @PYEXT_CXXFLAGS@ @HEPMCCPPFLAGS@ @FASTJETCPPFLAGS@ @YODACPPFLAGS@".split(),
extra_link_args=BASE_LINK_ARGS,
library_dirs=lookupdirs,
runtime_library_dirs=lookupdirs[1:],
libraries=["HepMC", "fastjet", "YODA", "Rivet"])
# libraries=["gsl", "HepMC", "fastjet", "YODA", "Rivet"])
#header_files = glob("../include/Rivet/*.h") + glob("../include/Rivet/Utils/*.h")
extns = [ext("core")]#, header_files)]
setup(name = "rivet",
version="@PACKAGE_VERSION@",
ext_modules = extns,
packages = ["rivet"])
diff --git a/test/Makefile.am b/test/Makefile.am
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,46 +1,46 @@
check_PROGRAMS = testMath testMatVec testCmp testApi testNaN testBeams
AM_LDFLAGS = -L$(top_srcdir)/src $(YAMLCPP_LDFLAGS) -L$(YODALIBPATH)
LIBS = -lm $(GSL_LDFLAGS) -lYODA
TEST_LDADD = $(top_builddir)/src/libRivet.la $(HEPMCLDFLAGS) $(YODALDFLAGS) $(HEPMCLDLIBS) $(YODALDLIBS)
testMath_SOURCES = testMath.cc
testMath_LDADD = $(TEST_LDADD)
testMatVec_SOURCES = testMatVec.cc
testMatVec_LDADD = $(TEST_LDADD)
testCmp_SOURCES = testCmp.cc
testCmp_LDADD = $(TEST_LDADD)
testApi_SOURCES = testApi.cc
testApi_LDADD = $(TEST_LDADD)
testNaN_SOURCES = testNaN.cc
testNaN_LDADD = $(TEST_LDADD)
testBeams_SOURCES = testBeams.cc
testBeams_LDADD = $(TEST_LDADD)
TESTS_ENVIRONMENT = \
RIVET_ANALYSIS_PATH=$(top_builddir)/analyses \
RIVET_DATA_PATH=$(top_builddir)/analyses/data \
RIVET_INFO_PATH=$(top_builddir)/analyses/data \
RIVET_REF_PATH=$(top_builddir)/analyses/data \
- LIBLOCATION=$(top_builddir)/src/.libs:$(HEPMCLIBPATH):$(YODALIBPATH):$(FASTJETLIBPATH) \
+ LIBLOCATION=$(top_builddir)/src/.libs \
LD_LIBRARY_PATH=$$LIBLOCATION:$(LD_LIBRARY_PATH) \
DYLD_LIBRARY_PATH=$$LIBLOCATION:$(DYLD_LIBRARY_PATH) \
PYTHONPATH=$(top_builddir)/pyext/build/$(RIVET_SETUP_PY_PATH):$(PYTHONPATH) \
PATH=$(top_builddir)/bin:$(top_srcdir)/bin:$(PATH) \
PYTHON=$(PYTHON) \
RIVET_TESTS_SRC=$(srcdir)
TESTS = \
testMath testMatVec testCmp testApi testNaN testBeams \
testImport.sh
if ENABLE_ANALYSES
if ! WITH_OSX
TESTS += testCmdLine.sh
endif
endif
EXTRA_DIST = testApi.hepmc testCmdLine.sh testImport.sh
CLEANFILES = log a.out fifo.hepmc file2.hepmc out.yoda NaN.aida Rivet.yoda

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 3:33 PM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3804960
Default Alt Text
(38 KB)

Event Timeline