#!/usr/bin/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=/usr
datarootdir=${prefix}/share

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 "  --pythonpath  : show the path(s) to the directory containing YODA's Python package"
    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"
    if [[ $# -eq 0 ]]; then exit 1; else exit 0; fi
fi

OUT=""

## "Atomic" build info
tmp=$( echo "$*" | grep -E -- '--\<prefix\>')
test -n "$tmp" && OUT="$OUT /usr"

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

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

tmp=$( echo "$*" | grep -E -- '--\<libdir\>')
test -n "$tmp" && OUT="$OUT /usr/lib64"

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

tmp=$( echo "$*" | grep -E -- '--\<pythonpath|pydir\>')
test -n "$tmp" && OUT="$OUT /usr/lib64/python3.14/site-packages"


## "Pre-rolled" build info
tmp=$( echo "$*" | grep -E -- '--\<cflags|cppflags|cxxflags\>')
test -n "$tmp" && OUT="$OUT -I/usr/include -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -I/usr/include"

tmp=$( echo "$*" | grep -E -- '--\<libs|ldflags\>')
test -n "$tmp" && OUT="$OUT -L/usr/lib -L/usr/lib64 -lyaml-cpp -L/usr/lib64 -lLHAPDF"


## Version
tmp=$( echo "$*" | grep -E -- '--\<version\>')
test -n "$tmp" && echo 6.5.5 && exit 0


echo $OUT
