#! /bin/sh

prefix="/usr"
exec_prefix=${prefix}

usage()
{
    cat <<EOF
Usage: nest-config [OPTION]

Known values for OPTION are:

  --prefix              NEST install prefix for architecture-independent files
  --exec-prefix         NEST install prefix for architecture-dependent files
  --libs                print library linking information
  --cflags              print pre-processor and compiler flags
  --includes            print includes
  --compiler            print the compiler used to compile NEST
  --python-executable   print full path to Python interpreter used
  --python-version      print Python version string for interpreter
  --static-libraries    print "ON" if configured for static libraries, "OFF" otherwise
  --docdir              print the relative path (to prefix) to the installed documentation
  --datadir             print the relative path (to prefix) to the installed data
  --libdir              print the relative path (to prefix) to the installed libraries
  --help                display this help and exit
  --version             output version information

EOF

    exit $1
}

if test $# -eq 0; then
    usage 1
fi

cflags=false
libs=false

while test $# -gt 0; do
    case "$1" in
    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
    *) optarg= ;;
    esac

    case "$1" in
    --prefix=*)
        prefix=$optarg
        ;;
    --prefix)
        echo $prefix
        ;;
    --exec-prefix)
        echo $exec_prefix
        ;;
    --version)
        echo "UNKNOWN"
        ;;
    --help)
        usage 0
        ;;
    --includes)
        echo " -I/usr/include/nest -I/usr/include -I/usr/include -I/usr/include "
        ;;
    --cflags)
        echo "-g -O2 -ffile-prefix-map=/usr/src/packages/BUILD=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++11 -O2 -Wall -fopenmp -fdiagnostics-color=auto"
        ;;
    --libs)
        echo "-L$prefix/lib/nest -lnestutil -lnest -lrandom -lsli -lnestkernel -fopenmp /usr/lib/x86_64-linux-gnu/libltdl.so /usr/lib/x86_64-linux-gnu/libreadline.so /usr/lib/x86_64-linux-gnu/libncurses.so /usr/lib/x86_64-linux-gnu/libgsl.so /usr/lib/x86_64-linux-gnu/libgslcblas.so     "
        ;;
    --compiler)
        echo "/usr/bin/c++"
        ;;
    --python-executable)
        echo "/usr/bin/python3"
        ;;
    --python-version)
        echo "3.10.4"
        ;;

    --static-libraries)
        echo "OFF"
        ;;
    --docdir)
        echo "share/doc/nest"
        ;;
    --datadir)
        echo "share/nest"
        ;;
    --libdir)
        echo "lib"
        ;;
    *)
        usage
        exit 1
        ;;
    esac
    shift
done

exit 0
