#!/bin/sh

# This file is generated by the configure script.

# use debugging code:                         false
# MPI (Message Passing Interface) support:    yes
# HDF5 (Hierarchical Data Format) support:    yes
# CGNS (CFD General Notation System) support: yes
# MED (Model for Exchange of Data) support:   yes


# C compiler used for build: FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
# --------------------------
# FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
# Target: x86_64-unknown-freebsd10.0
# Thread model: posix

cc=cc


# Package Version
#----------------

version="0.15.3"


# Installation directories
#-------------------------

prefix="/usr/local"
exec_prefix="${prefix}"
includedir="${prefix}/include"
libdir="${exec_prefix}/lib"

cppflags=""
cflags=""
ldflags=""
libs=" -lm"

build_cppflags=""
build_cflags="-O2 -pipe -fno-strict-aliasing"
build_ldflags=" -O"
build_libs=" -lm"

bft_cppflags="-I/usr/local/include "
bft_cflags=""
bft_ldflags="-L/usr/local/lib "
bft_libs="-lbft -lz"

mpi_cppflags="-I/usr/local/include"
mpi_cflags=""
mpi_ldflags="-L/usr/local/lib"
mpi_libs="-lmpich -lmpl -pthread"

hdf5_cppflags="-I/usr/local/include"
hdf5_cflags=""
hdf5_ldflags="-L/usr/local/lib"
hdf5_libs="-lhdf5 -pthread"

cgns_cppflags="-I/usr/local/include"
cgns_cflags=""
cgns_ldflags="-L/usr/local/lib"
cgns_libs="-lcgns"

med_cppflags="-I/usr/local/include"
med_cflags=""
med_ldflags="-L/usr/local/lib"
med_libs="-lmedC"


# Output info depending on command-line options
#----------------------------------------------

if test $# -eq 0; then
  show_help=yes

else
  for opt in $*
  do
    case $opt in
      --prefix)
        output="${output} $prefix"
        ;;
      --exec-prefix)
        if test "$exec_prefix" != "" ; then
          output="${output} $exec_prefix"
        else
          output="${output} $prefix/bin"
        fi
        ;;
      --includedir)
        if test "$includedir" != "" ; then
          output="${output} $includedir"
        else
          output="${output} $prefix/include"
        fi
        ;;
      --version)
        output="${output} $version"
        ;;
      --cppflags)
        echo_cppflags=yes
        ;;
      --cflags)
        echo_cflags=yes
        ;;
      --ldflags)
        echo_ldflags=yes
        ;;
      --libs)
        echo_libs=yes
        ;;
      --cc)
        output="${output} $cc"
        ;;
      -*)
        show_help=yes
        ;;
      *)
        scope=$opt
        ;;
    esac
  done
fi

if test "$show_help" = "yes"; then
  cat <<EOF
Usage: fvm-config options scope

Options:
        --prefix            installation path prefix
        --exec-prefix       system-dependent path prefix
        --includedir        C header files path
        --version           library version

        --cppflags          C preprocessor flags (e.g. -D<macro>, ...)
        --cflags            C flags (e.g. -O, -g, ...)
        --ldflags           linker flags (e.g. -g, -L<path>, ...)
        --libs              librairies used (e.g. -l<libname>)

        --cc                C compiler used for build

Scope:
        use (default)       Options required for user code
        build               Options used for build
        bft
        mpi
        hdf5
        cgns
        med
EOF
  exit 1
fi

case "$scope" in
  build)
    cppflags=$build_cppflags
    cflags=$build_cflags
    ldflags=$build_ldflags
    libs=$build_libs
    ;;
  bft)
    cppflags=$bft_cppflags
    cflags=$bft_cflags
    ldflags=$bft_ldflags
    libs=$bft_libs
    ;;
  mpi)
    cppflags=$mpi_cppflags
    cflags=$mpi_cflags
    ldflags=$mpi_ldflags
    libs=$mpi_libs
    ;;
  hdf5)
    cppflags=$hdf5_cppflags
    cflags=$hdf5_cflags
    ldflags=$hdf5_ldflags
    libs=$hdf5_libs
    ;;
  cgns)
    cppflags=$cgns_cppflags
    cflags=$cgns_cflags
    ldflags=$cgns_ldflags
    libs=$cgns_libs
    ;;
  med)
    cppflags=$med_cppflags
    cflags=$med_cflags
    ldflags=$med_ldflags
    libs=$med_libs
    ;;
esac

if test "$echo_cppflags" = "yes" ; then
  output="${output} $cppflags"
fi
if test "$echo_cflags" = "yes" ; then
  output="${output} $cflags"
fi
if test "$echo_ldflags" = "yes" ; then
  output="${output} $ldflags"
fi
if test "$echo_libs" = "yes" ; then
  output="${output} $libs"
fi

if test "$output" != "" ; then
  echo $output
fi

