#!/usr/bin/sh

usage() {
	cat <<EOF
Usage:
  /usr/lib/chapel/2.10/third-party/jemalloc/install/target/linux64-aarch64-none-llvm-none/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="/usr/lib/chapel/2.10/third-party/jemalloc/install/target/linux64-aarch64-none-llvm-none"
exec_prefix="/usr/lib/chapel/2.10/third-party/jemalloc/install/target/linux64-aarch64-none-llvm-none"

case "$1" in
--help | -h)
	usage
	exit 0
	;;
--version)
	echo "4.5.0-0-g04380e79f1e2428bd0ad000bbc6e3d2dfc6b66a5"
	;;
--revision)
	echo "2"
	;;
--config)
	echo "'CC=/usr/lib64/llvm22/bin/clang-22 --gcc-install-dir=/usr/lib/gcc/aarch64-redhat-linux/16 ' 'CFLAGS=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS --config=/usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' --prefix=/usr/lib/chapel/2.10/third-party/jemalloc/install/target/linux64-aarch64-none-llvm-none --with-jemalloc-prefix=chpl_je_ --with-private-namespace=chpl_ --disable-stats --with-malloc-conf=purge:decay --with-version=4.5.0-0-g04380e79f1e2428bd0ad000bbc6e3d2dfc6b66a5 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now --config=/usr/lib/rpm/redhat/redhat-hardened-clang-ld.cfg -Wl,--build-id=sha1 '"
	;;
--prefix)
	echo "/usr/lib/chapel/2.10/third-party/jemalloc/install/target/linux64-aarch64-none-llvm-none"
	;;
--bindir)
	echo "/usr/lib/chapel/2.10/third-party/jemalloc/install/target/linux64-aarch64-none-llvm-none/bin"
	;;
--datadir)
	echo "/usr/lib/chapel/2.10/third-party/jemalloc/install/target/linux64-aarch64-none-llvm-none/share"
	;;
--includedir)
	echo "/usr/lib/chapel/2.10/third-party/jemalloc/install/target/linux64-aarch64-none-llvm-none/include"
	;;
--libdir)
	echo "/usr/lib/chapel/2.10/third-party/jemalloc/install/target/linux64-aarch64-none-llvm-none/lib"
	;;
--mandir)
	echo "/usr/lib/chapel/2.10/third-party/jemalloc/install/target/linux64-aarch64-none-llvm-none/share/man"
	;;
--cc)
	echo "/usr/lib64/llvm22/bin/clang-22 --gcc-install-dir=/usr/lib/gcc/aarch64-redhat-linux/16   "
	;;
--cflags)
	echo "-std=gnu11 -Wall -Werror=declaration-after-statement -Wshorten-64-to-32 -Wsign-compare -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS --config=/usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong   -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer      "
	;;
--cppflags)
	echo "-D_GNU_SOURCE -D_REENTRANT"
	;;
--ldflags)
	echo "-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now --config=/usr/lib/rpm/redhat/redhat-hardened-clang-ld.cfg   -Wl,--build-id=sha1       "
	;;
--libs)
	echo "-lm  -lpthread"
	;;
*)
	usage
	exit 1
esac
