#! /usr/bin/env bash
## -*- sh -*-
## bin/lhapdf-config.  Generated from lhapdf-config.in by configure.

## These variables need to exist
## Note no use of $DESTDIR... we ignore it so that destdir can be used
## for temp installs later copied to /
prefix=/usr
exec_prefix=${prefix}
datarootdir=/usr/share/lhapdf

if [[ $# -eq 0 || -n $( echo $* | grep -E -- "--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 "  --cxx         : get compiler (including -std=c++11 flag or equiv)"
    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 "$*" | grep -E -- '--\<prefix\>')
test -n "$tmp" && OUT="$OUT /usr"

tmp=$( echo "$*" | grep -E -- '--\<incdir\>')
test -n "$tmp" && OUT="$OUT ${prefix}/include"

tmp=$( echo "$*" | grep -E -- '--\<cxx\>')
test -n "$tmp" && OUT="$OUT g++"

tmp=$( echo "$*" | grep -E -- '--\<cflags|cppflags|cxxflags\>')
test -n "$tmp" && OUT="$OUT -march=pentium4 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection          -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/lhapdf/src=/usr/src/debug/lhapdf -flto=auto -I${prefix}/include"

tmp=$( echo "$*" | grep -E -- '--\<libdir\>')
test -n "$tmp" && OUT="$OUT ${exec_prefix}/lib"

tmp=$( echo "$*" | grep -E -- '--\<libs|ldflags\>')
test -n "$tmp" && OUT="$OUT -L${exec_prefix}/lib -lLHAPDF"

tmp=$( echo "$*" | grep -E -- '--\<datadir\>|--\<datarootdir\>')
test -n "$tmp" && OUT="$OUT /usr/share/lhapdf/LHAPDF"

tmp=$( echo "$*" | grep -E -- '--\<version\>')
test -n "$tmp" && OUT="$OUT 6.5.4"

echo $OUT
