#!/bin/sh

#
# values substituted from configure
#
host=x86_64-apple-darwin13.4.0
prefix=/opt/civet0/build/_env/conda-bld/moose-libmesh_1778446155890/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
legacyinclude=@enablelegacyincludepaths@
builddir=/opt/civet0/build/_env/conda-bld/moose-libmesh_1778446155890/work/build/contrib/timpi
has_been_installed=yes

#
# Define the usage() function
#
usage ()
{
  echo "usage: $0 --cppflags --cxxflags --include --libs"
  echo "       $0 --cxx"
  echo "       $0 --cc"
  echo "       $0 --fc"
  echo "       $0 --fflags"
  echo "       $0 --version"
  echo "       $0 --host"
  echo "       $0 --ldflags"
  exit
}

#
# Need at least one command-line argument
#
if [ "$#" = "0" ] ; then
    usage $0
fi

#
# Need a valid METHOD
#
if (test "x$METHOD" = x); then
    #echo "No METHOD specified - defaulting to opt"
    METHOD=opt
fi

case "$METHOD" in
    optimized|opt)
	CXXFLAGS="-O2 -Qunused-arguments -Wunused -fno-assume-unique-vtables -ftrapping-math -Wno-unsupported-floating-point-opt   "
	CPPFLAGS="-DNDEBUG "
	CFLAGS="   "
	libext="_opt"
	;;
    debug|dbg)
	CXXFLAGS="-g -Wimplicit -Qunused-arguments -fno-limit-debug-info -Wunused -fno-assume-unique-vtables -ftrapping-math -Wno-unsupported-floating-point-opt   "
	CPPFLAGS="-DDEBUG "
	CFLAGS="   "
	libext="_dbg"
	;;
    devel)
	CXXFLAGS="-O2 -Qunused-arguments -Wunused -g -Wimplicit -fno-limit-debug-info -Wunused -fno-assume-unique-vtables -ftrapping-math -Wno-unsupported-floating-point-opt   "
	CPPFLAGS=" "
	CFLAGS="   "
	libext="_devel"
	;;
    profiling|pro|prof)
	CXXFLAGS="-O2 -Qunused-arguments -Wunused -fno-assume-unique-vtables -ftrapping-math -Wno-unsupported-floating-point-opt   -pg "
	CPPFLAGS="-DNDEBUG "
	CFLAGS="   -pg "
	libext="_prof"
	;;
    oprofile|oprof)
	CXXFLAGS="-O2 -Qunused-arguments -Wunused -fno-assume-unique-vtables -ftrapping-math -Wno-unsupported-floating-point-opt   -g -fno-omit-frame-pointer "
	CPPFLAGS="-DNDEBUG "
	CFLAGS="   -g -fno-omit-frame-pointer "
	libext="_oprof"
	;;
    *)
	echo "ERROR: Unknown \$METHOD: $METHOD"
	echo "  should be one of: <opt,dbg,devel,prof,oprof>"
	exit 1
	;;
esac

#
# Process the command-line arguments, build up
# return_val
#
return_val=""

while [ "x$1" != "x" ]; do
    case "$1" in
	"--cxx")
	    return_val="mpicxx $return_val"
	    ;;

	"--cc")
	    return_val="mpicc $return_val"
	    ;;

	"--f77")
	    return_val="@F77@ $return_val"
	    ;;

	"--fc")
	    return_val="mpifort $return_val"
	    ;;

	"--cppflags")
	    return_val="${CPPFLAGS} $return_val"
	    ;;

	"--cxxflags")
	    return_val="${CXXFLAGS} $return_val"
	    ;;

	"--cflags")
	    return_val="${CFLAGS} $return_val"
	    ;;

	"--fflags")
	    return_val="@FFLAGS@ $return_val"
	    ;;

	"--include")
	    # handle legacy include paths when needed.
	    if (test "x$legacyinclude" = "xyes"); then
		return_val="-I${includedir}/timpi $return_val"
	    fi
	    return_val="-I${includedir}
 	                
                        $return_val"
	    ;;

	"--libs")
	    return_val="-Wl,-rpath,${libdir} -L${libdir} -ltimpi${libext}  $return_val"
	    ;;

	"--ldflags")
	    return_val="@timpi_LDFLAGS@ $return_val"
	    ;;

	"--version")
	    return_val="1.9.0"
	    ;;

	"--host")
	    return_val="$host"
	    ;;

	*)
	    echo "Unknown argument: $1"
	    usage $0
    esac
    shift
done

echo $return_val

# Local Variables:
# mode: shell-script
# End:
