#!/bin/sh
#
ME=$(readlink -f "$0")
MEDIR=${ME%/*}

EXT=rsyslog

. $MEDIR/phase-default-init.sh

DEPS="jemalloc-dev postgresql-9.6-dev
 pcre-dev net-snmp-dev curl-dev libgcrypt-dev
 libestr-dev libfastjson-dev liblognorm-dev liblogging-dev libnet-dev"

test "$KBITS" = "64" && DEPS="$DEPS mariadb-10.1-dev" || DEPS="$DEPS mariadb-dev"

. $MEDIR/phase-default-deps.sh
. $MEDIR/phase-default-cc-opts.sh

echo $PATH | grep -q mysql || export PATH=$PATH:/usr/local/mysql/bin:/usr/local/pgsql96/bin:/usr/local/oracle

sed -i -e 's#"/etc/rsyslog.conf"#"/usr/local/etc/rsyslog.conf"#' tools/rsyslogd.c

./configure \
	--prefix=/usr/local \
	--localstatedir=/var \
	--enable-shared \
	--enable-regexp \
	--enable-klog \
	--enable-kmsg \
	--disable-imjournal \
	--enable-inet \
	--enable-jemalloc \
	--enable-diagtools \
	--enable-usertools \
	--enable-mysql \
	--enable-pgsql \
	--enable-snmp \
	--enable-uuid \
	--enable-elasticsearch \
	--enable-libgcrypt \
	--enable-rsyslogrt \
	--enable-rsyslogd \
	--enable-mmnormalize \
	--enable-mmjsonparse \
	--enable-mmaudit \
	--enable-mmanon \
	--enable-mmutf8fix \
	--enable-mmcount \
	--enable-mmsequence \
	--enable-mmfields \
	--enable-imfile \
	--enable-imptcp \
	--enable-impstats \
	--enable-omprog \
	--enable-omudpspoof \
	--enable-omstdout \
	--disable-omjournal \
	--enable-pmlastmsg \
	--enable-pmcisconames \
	--enable-pmciscoios \
	--enable-omruleset \
	--enable-mmsnmptrapd \
	--enable-omhttpfs \
	--enable-omtcl \
	--disable-generate-man-pages \
	|| exit

. $MEDIR/phase-default-make.sh
. $MEDIR/phase-default-make-install.sh
. $MEDIR/phase-default-strip.sh
. $MEDIR/phase-default-set-perms.sh
. $MEDIR/phase-default-squash-tcz.sh

