#! /usr/bin/env bash ## -*- sh -*- ## lhapdf-config for MadGraph use in Athena ## this custom config is required to find both the lhapdf installation dir and the actual pdf set data from LHAPDF_DATA_PATH ## in the default configuration the installation dir is hardcoded prefix= datapath= # to find the prefix we searh LHAPATH before LHAPDF_DATA_PATH because the latter is more likely to change for p in $(echo "${LHAPATH}:${LHAPDF_DATA_PATH}" | tr ":" "\n") do # if LHAPDF libraries can be found from this dir and prefix is not yet defined if [[ -d "${p}/../../lib" ]] && [[ -z $prefix ]] then # we assume this is the lhapdf installation dir (and not the data dir) prefix=${p}/../.. fi done # data is first searched in LHAPDF_DATA_PATH for p in $(echo "${LHAPDF_DATA_PATH}:${LHAPATH}" | tr ":" "\n") do # if this directory exists and datapath is not yet defined and its not the prefix dir if [[ -d ${p} ]] && [[ -z $datapath ]] && [[ ${p}/../.. != ${prefix} ]] then datapath=$p fi done # if no datapath is found we try the prefix path if [[ -z $datapath ]] && [ -d $prefix/share/LHAPDF ] then datapath=$prefix/share/LHAPDF fi if [ -z $prefix ] then echo "WARNING: lhapdf-config could not get valid lhapdf prefix from LHAPDF_DATA_PATH" fi exec_prefix=${prefix} version=$LHAPDFVER if [ -z $version ] then version=$(echo "$prefix" | awk '{split($1,a,"lhapdf/"); split(a[2],b,"/");print b[1];}') fi #find boost boost=@Boost_INCLUDE_PATH@ if [ -z $boost ] then echo "WARNING: lhapdf-config could not find boost headers" fi if [[ $# -eq 0 || -n $( echo $* | egrep -- "--help|-h" ) ]]; then echo "lhapdf-config: configuration tool for the LHAPDF" echo " parton density function evolution library" echo " http://projects.hepforge.org/lhapdf/" echo echo "Usage: lhapdf-config [options]" echo "Options:" echo " --help | -h : show this help message" echo " --prefix : show the installation prefix (cf. autoconf)" echo " --incdir : show the path to the LHAPDF C++ header directory" echo " --libdir : show the path to the LHAPDF library directory" echo " --datadir : show the path to the LHAPDF data directory" echo echo " --cflags : get compiler flags (aka --cppflags|--cxxflags)" echo " --libs : get linker flags (aka --ldflags)" echo echo " --version : return LHAPDF release version number" fi OUT="" tmp=$( echo "$*" | egrep -- '--\') test -n "$tmp" && OUT="$OUT $prefix" tmp=$( echo "$*" | egrep -- '--\') test -n "$tmp" && OUT="$OUT ${prefix}/include" tmp=$( echo "$*" | egrep -- '--\') test -n "$tmp" && OUT="$OUT -I${prefix}/include -I$boost" tmp=$( echo "$*" | egrep -- '--\') test -n "$tmp" && OUT="$OUT ${exec_prefix}/lib" tmp=$( echo "$*" | egrep -- '--\') test -n "$tmp" && OUT="$OUT -L${exec_prefix}/lib -lLHAPDF" tmp=$( echo "$*" | egrep -- '--\|--\') test -n "$tmp" && OUT="$OUT $datapath" tmp=$( echo "$*" | egrep -- '--\') test -n "$tmp" && OUT="$OUT $version" echo $OUT