#!/bin/sh

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

case "$1" in
--help | -h)
	usage
	exit 0
	;;
--version)
	echo "5.4.0-0-g7a34f18502e7b222724097cdcd499b437d189acc"
	;;
--revision)
	echo "2"
	;;
--config)
	echo "--disable-fill --disable-stats --disable-utrace --with-lg-quantum=3 --with-malloc-conf=abort_conf:false --with-jemalloc-prefix=je_ --disable-static --enable-xmalloc --enable-lazy-lock --prefix=/Software/Node --sysconfdir=/Services/Node/etc --localstatedir=/Services/Node/var 'CFLAGS=-pipe -fuse-ld=lld -ferror-limit=1 -fstack-protector -Wformat -Wformat-security -Wl,-z,relro,-z,now -I/Software/Node/include -w -O3 -fvisibility=default -gdwarf-5 -fPIC -fPIE -Wl,-rpath=/Software/Node/lib,--enable-new-dtags -ftrapv -flto=thin -ffat-lto-objects -fuse-linker-plugin -Wl,--thinlto-jobs=4 -Wl,--thinlto-cache-dir=/root/.sofin/lto-cache -Wl,--thinlto-cache-policy,cache_size_bytes=16g --param ssp-buffer-size=4' 'CXXFLAGS=-pipe -fuse-ld=lld -ferror-limit=1 -fstack-protector -Wformat -Wformat-security -Wl,-z,relro,-z,now -I/Software/Node/include -w -O3 -fvisibility=default -gdwarf-5 -fPIC -fPIE -Wl,-rpath=/Software/Node/lib,--enable-new-dtags -ftrapv -flto=thin -ffat-lto-objects -fuse-linker-plugin -Wl,--thinlto-jobs=4 -Wl,--thinlto-cache-dir=/root/.sofin/lto-cache -Wl,--thinlto-cache-policy,cache_size_bytes=16g --param ssp-buffer-size=4 -std=c++11' 'LDFLAGS=-z relro -z now -L/Software/Node/lib -pie' 'CC=/Services/Sofin/exports/ccache /usr/bin/clang' 'CPP=clang -E' 'CXX=/Services/Sofin/exports/ccache /usr/bin/clang++'"
	;;
--prefix)
	echo "/Software/Node"
	;;
--bindir)
	echo "/Software/Node/bin"
	;;
--datadir)
	echo "/Software/Node/share"
	;;
--includedir)
	echo "/Software/Node/include"
	;;
--libdir)
	echo "/Software/Node/lib"
	;;
--mandir)
	echo "/Software/Node/share/man"
	;;
--cc)
	echo "/Services/Sofin/exports/ccache /usr/bin/clang"
	;;
--cflags)
	echo "-std=gnu11 -Werror=unknown-warning-option -Wall -Wextra -Wshorten-64-to-32 -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 -pipe -fuse-ld=lld -ferror-limit=1 -fstack-protector -Wformat -Wformat-security -Wl,-z,relro,-z,now -I/Software/Node/include -w -O3 -fvisibility=default -gdwarf-5 -fPIC -fPIE -Wl,-rpath=/Software/Node/lib,--enable-new-dtags -ftrapv -flto=thin -ffat-lto-objects -fuse-linker-plugin -Wl,--thinlto-jobs=4 -Wl,--thinlto-cache-dir=/root/.sofin/lto-cache -Wl,--thinlto-cache-policy,cache_size_bytes=16g --param ssp-buffer-size=4"
	;;
--cppflags)
	echo "-D_BSD_SOURCE -D_REENTRANT"
	;;
--cxxflags)
	echo "-fvisibility=hidden -Wimplicit-fallthrough -Wdeprecated-declarations -O3 -pipe -fuse-ld=lld -ferror-limit=1 -fstack-protector -Wformat -Wformat-security -Wl,-z,relro,-z,now -I/Software/Node/include -w -O3 -fvisibility=default -gdwarf-5 -fPIC -fPIE -Wl,-rpath=/Software/Node/lib,--enable-new-dtags -ftrapv -flto=thin -ffat-lto-objects -fuse-linker-plugin -Wl,--thinlto-jobs=4 -Wl,--thinlto-cache-dir=/root/.sofin/lto-cache -Wl,--thinlto-cache-policy,cache_size_bytes=16g --param ssp-buffer-size=4 -std=c++11"
	;;
--ldflags)
	echo "-z relro -z now -L/Software/Node/lib  -pie "
	;;
--libs)
	echo "-lm  -pthread"
	;;
*)
	usage
	exit 1
esac
