#!/bin/sh

usage() {
	cat <<EOF
Usage:
  @@HOMEBREW_CELLAR@@/chapel/2.8.0/libexec/third-party/jemalloc/install/host/linux64-aarch64-gnu/bin/jemalloc-config <option>
Options:
  --help | -h  : Print usage.
  --version    : Print jemalloc version.
  --revision   : Print shared library revision number.
  --config     : Print configure options used to build jemalloc.
  --prefix     : Print installation directory prefix.
  --bindir     : Print binary installation directory.
  --datadir    : Print data installation directory.
  --includedir : Print include installation directory.
  --libdir     : Print library installation directory.
  --mandir     : Print manual page installation directory.
  --cc         : Print compiler used to build jemalloc.
  --cflags     : Print compiler flags used to build jemalloc.
  --cppflags   : Print preprocessor flags used to build jemalloc.
  --ldflags    : Print library flags used to build jemalloc.
  --libs       : Print libraries jemalloc was linked against.
EOF
}

prefix="@@HOMEBREW_CELLAR@@/chapel/2.8.0/libexec/third-party/jemalloc/install/host/linux64-aarch64-gnu"
exec_prefix="@@HOMEBREW_CELLAR@@/chapel/2.8.0/libexec/third-party/jemalloc/install/host/linux64-aarch64-gnu"

case "$1" in
--help | -h)
	usage
	exit 0
	;;
--version)
	echo "4.5.0-0-g04380e79f1e2428bd0ad000bbc6e3d2dfc6b66a5"
	;;
--revision)
	echo "2"
	;;
--config)
	echo "'CC=gcc-12 ' 'CFLAGS=-O3 -Wno-switch-outside-range' --prefix=@@HOMEBREW_CELLAR@@/chapel/2.8.0/libexec/third-party/jemalloc/install/host/linux64-aarch64-gnu --with-jemalloc-prefix= --with-private-namespace=chpl_ --disable-stats --with-malloc-conf=purge:decay --with-version=4.5.0-0-g04380e79f1e2428bd0ad000bbc6e3d2dfc6b66a5"
	;;
--prefix)
	echo "@@HOMEBREW_CELLAR@@/chapel/2.8.0/libexec/third-party/jemalloc/install/host/linux64-aarch64-gnu"
	;;
--bindir)
	echo "@@HOMEBREW_CELLAR@@/chapel/2.8.0/libexec/third-party/jemalloc/install/host/linux64-aarch64-gnu/bin"
	;;
--datadir)
	echo "@@HOMEBREW_CELLAR@@/chapel/2.8.0/libexec/third-party/jemalloc/install/host/linux64-aarch64-gnu/share"
	;;
--includedir)
	echo "@@HOMEBREW_CELLAR@@/chapel/2.8.0/libexec/third-party/jemalloc/install/host/linux64-aarch64-gnu/include"
	;;
--libdir)
	echo "@@HOMEBREW_CELLAR@@/chapel/2.8.0/libexec/third-party/jemalloc/install/host/linux64-aarch64-gnu/lib"
	;;
--mandir)
	echo "@@HOMEBREW_CELLAR@@/chapel/2.8.0/libexec/third-party/jemalloc/install/host/linux64-aarch64-gnu/share/man"
	;;
--cc)
	echo "gcc-12    "
	;;
--cflags)
	echo "-std=gnu11 -Wall -Werror=declaration-after-statement -Wsign-compare -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -O3   -Wno-switch-outside-range"
	;;
--cppflags)
	echo "-D_GNU_SOURCE -D_REENTRANT"
	;;
--ldflags)
	echo " "
	;;
--libs)
	echo "-lm  -lpthread"
	;;
*)
	usage
	exit 1
esac
