#!/bin/sh

usage() {
	cat <<EOF
Usage:
  /opt/fluent/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="/opt/fluent"
exec_prefix="/opt/fluent"

case "$1" in
--help | -h)
	usage
	exit 0
	;;
--version)
	echo "5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8"
	;;
--revision)
	echo "2"
	;;
--config)
	echo "--prefix=/opt/fluent --disable-cxx 'CFLAGS=-g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/fluent-package-6.1.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection' LDFLAGS=-Wl,-z,relro 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -ffile-prefix-map=/build/fluent-package-6.1.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection'"
	;;
--prefix)
	echo "/opt/fluent"
	;;
--bindir)
	echo "/opt/fluent/bin"
	;;
--datadir)
	echo "/opt/fluent/share"
	;;
--includedir)
	echo "/opt/fluent/include"
	;;
--libdir)
	echo "/opt/fluent/lib"
	;;
--mandir)
	echo "/opt/fluent/share/man"
	;;
--cc)
	echo "gcc"
	;;
--cflags)
	echo "-std=gnu11 -Wall -Wextra -Wsign-compare -Wundef -Wno-format-zero-length -Wpointer-arith -Wno-missing-braces -Wno-missing-field-initializers -Wno-missing-attributes -pipe -g3 -fvisibility=hidden -Wimplicit-fallthrough -Wdeprecated-declarations -O3 -funroll-loops -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/fluent-package-6.1.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection"
	;;
--cppflags)
	echo "-Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_REENTRANT"
	;;
--cxxflags)
	echo "-g -O2 -ffile-prefix-map=/build/fluent-package-6.1.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection"
	;;
--ldflags)
	echo "-Wl,-z,relro "
	;;
--libs)
	echo "-lm  -pthread"
	;;
*)
	usage
	exit 1
esac
