#!/bin/bash
# install build essential packages
apt-get install --no-install-recommends build-essential fakeroot
# install build dependencies
apt-get install --no-install-recommends perl autotools-dev libdbi-dev libldap2-dev libpq-dev libmysqlclient-dev libfreeradius-client-dev libkrb5-dev libnet-snmp-perl procps
# install tools to create dist files
apt-get install --no-install-recommends autoconf automake
# create dist files
tools/setup
# configure the build
PGINCLUDE="-I`pg_config --includedir`" PGLIBS="-lpq -lcrypt" \
CFLAGS="-Wall -g -O2" \
./configure \
	--host=x86_64-linux-gnu \
	--build=x86_64-linux-gnu \
	--prefix=/usr \
	--mandir=/usr/share/man \
	--infodir=/usr/share/info \
	--libexecdir=/usr/lib/nagios/plugins \
	--with-perl=/usr/bin/perl \
	--with-openssl=/usr \
	--with-pgsql=/usr \
	--with-mysql=/usr \
	--with-proc-loadavg=/proc/loadavg \
	--with-ps-command="/bin/ps axwwo 'stat uid pid ppid vsz rss pcpu etime comm args'" \
	--with-ps-format="%s %d %d %d %d %d %f %s %s %n" \
	--with-ps-cols=10 \
	--with-ps-varlist="procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos" \
	--with-ping-command="/bin/ping -n -U -w %d -c %d %s" --with-ping6-command="/bin/ping6 -n -U -w %d -c %d %s" \
	--with-nslookup-command="/usr/bin/nslookup -sil" \
	--with-uptime-command="/usr/bin/uptime" \
	--with-rpcinfo-command="/usr/sbin/rpcinfo" \
	--with-smbclient-command="/usr/bin/smbclient" \
	--with-snmpget-command="/usr/bin/snmpget" \
	--with-snmpgetnext-command="/usr/bin/snmpgetnext" \
	--with-qstat-command="/usr/bin/quakestat" \
	--with-fping-command="/usr/bin/fping" \
	--with-fping6-command="/usr/bin/fping6" \
	--with-ssh-command="/usr/bin/ssh" \
	--with-mailq-command="/usr/bin/mailq" \
	--with-proc-meminfo="/proc/meminfo" \
	--with-dig-command="/usr/bin/dig" \
	--with-apt-get-command="/usr/bin/apt-get" \
	--enable-extra-opts \
	--disable-rpath