#!/bin/sh

usage() {
	cat <<EOF
Usage:
  /usr/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.
  --cxxflags   : Print C++ compiler flags used to build jemalloc.
  --ldflags    : Print library flags used to build jemalloc.
  --libs       : Print libraries jemalloc was linked against.
EOF
}

prefix="/usr"
exec_prefix="/usr"

case "$1" in
--help | -h)
	usage
	exit 0
	;;
--version)
	echo "5.2.1-0-gea6b3e973b477b8061e0076bb257dbd7f3faa756"
	;;
--revision)
	echo "2"
	;;
--config)
	echo "--build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu --libexecdir=${prefix}/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --disable-shared --enable-static --with-version=VERSION --with-lg-page=12 --with-lg-hugepage=21 --enable-prof build_alias=x86_64-linux-gnu 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/jemalloc-UhjiTf/jemalloc-5.2.1=. -fstack-protector-strong -Wformat -Werror=format-security' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2 ' 'CXXFLAGS=-g -O2 -fdebug-prefix-map=/build/jemalloc-UhjiTf/jemalloc-5.2.1=. -fstack-protector-strong -Wformat -Werror=format-security'"
	;;
--prefix)
	echo "/usr"
	;;
--bindir)
	echo "/usr/bin"
	;;
--datadir)
	echo "/usr/share"
	;;
--includedir)
	echo "/usr/include"
	;;
--libdir)
	echo "/usr/lib/x86_64-linux-gnu"
	;;
--mandir)
	echo "/usr/share/man"
	;;
--cc)
	echo "gcc"
	;;
--cflags)
	echo "-std=gnu11 -Wall -Wextra -Wsign-compare -Wundef -Wno-format-zero-length -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -g -O2 -fdebug-prefix-map=/build/jemalloc-UhjiTf/jemalloc-5.2.1=. -fstack-protector-strong -Wformat -Werror=format-security"
	;;
--cppflags)
	echo "-Wdate-time -D_FORTIFY_SOURCE=2  -D_GNU_SOURCE -D_REENTRANT"
	;;
--cxxflags)
	echo "-Wall -Wextra -g3 -fvisibility=hidden -O3 -g -O2 -fdebug-prefix-map=/build/jemalloc-UhjiTf/jemalloc-5.2.1=. -fstack-protector-strong -Wformat -Werror=format-security"
	;;
--ldflags)
	echo "-Wl,-Bsymbolic-functions -Wl,-z,relro "
	;;
--libs)
	echo "-lm -lstdc++ -lgcc -lm -pthread -ldl"
	;;
*)
	usage
	exit 1
esac
