#!/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.1.0-0-g61efbda7098de6fe64c362d309824864308c36d4"
	;;
--revision)
	echo "2"
	;;
--config)
	echo "--prefix=/usr --build=armv7a-hardfloat-linux-gnueabi --host=armv7a-hardfloat-linux-gnueabi --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --docdir=/usr/share/doc/jemalloc-5.1.0 --htmldir=/usr/share/doc/jemalloc-5.1.0/html --libdir=/usr/lib --disable-debug --disable-lazy-lock --disable-stats --disable-xmalloc build_alias=armv7a-hardfloat-linux-gnueabi host_alias=armv7a-hardfloat-linux-gnueabi 'CFLAGS=-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed' 'CXXFLAGS=-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard'"
	;;
--prefix)
	echo "/usr"
	;;
--bindir)
	echo "/usr/bin"
	;;
--datadir)
	echo "/usr/share"
	;;
--includedir)
	echo "/usr/include"
	;;
--libdir)
	echo "/usr/lib"
	;;
--mandir)
	echo "/usr/share/man"
	;;
--cc)
	echo "armv7a-hardfloat-linux-gnueabi-gcc"
	;;
--cflags)
	echo "-std=gnu11 -Wall -Wsign-compare -Wundef -Wno-format-zero-length -pipe -g3 -fvisibility=hidden -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
	;;
--cppflags)
	echo "-D_GNU_SOURCE -D_REENTRANT"
	;;
--cxxflags)
	echo "-Wall -g3 -fvisibility=hidden -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
	;;
--ldflags)
	echo "-Wl,-O1 -Wl,--as-needed "
	;;
--libs)
	echo "-lm -lstdc++ -lpthread -ldl"
	;;
*)
	usage
	exit 1
esac
