1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_PREREQ(2.61) 5AC_INIT(pnp, 0.6.26, pnp4nagios-devel@lists.sourceforge.net) 6AC_CONFIG_SRCDIR(src/) 7AC_CONFIG_HEADERS(include/config.h:include/config.h.in) 8AC_PREFIX_DEFAULT(/usr/local/pnp4nagios) 9 10AC_DEFINE([DEFAULT_NAGIOS_USER], [nagios], [Default Nagios User]) 11AC_DEFINE([DEFAULT_NAGIOS_GROUP], [nagios], [Default Nagios Group]) 12 13PKG_NAME=pnp4nagios 14PKG_VERSION="0.6.26" 15PKG_HOME_URL="http://www.pnp4nagios.org/pnp/start" 16PKG_REL_DATE="08-21-2017" 17AC_SUBST(PKG_NAME) 18AC_SUBST(PKG_VERSION) 19AC_SUBST(PKG_HOME_URL) 20AC_SUBST(PKG_REL_DATE) 21AC_SUBST(ac_configure_args) 22XML_STRUCTURE_VERSION="4" 23AC_SUBST(XML_STRUCTURE_VERSION) 24 25dnl Figure out how to invoke "install" and what install options to use. 26 27AC_PROG_INSTALL 28AC_SUBST(INSTALL) 29 30#dnl What OS are we running? 31AC_CANONICAL_HOST 32 33dnl Checks for programs. 34AC_PROG_CC 35AC_PROG_MAKE_SET 36AC_PATH_PROG([STRIP],[strip],[true]) 37 38 39 40AC_PATH_PROG(CP,cp) 41 42# Checks for libraries. 43 44# Checks for header files. 45AC_HEADER_STDC 46AC_HEADER_DIRENT 47AC_HEADER_SYS_WAIT 48#AC_CHECK_HEADERS(netinet/in.h string.h sys/socket.h unistd.h stdio.h stdlib.h getopt.h signal.h) 49AC_CHECK_HEADERS(dirent.h stdio.h errno.h unistd.h syslog.h signal.h stdlib.h dirent.h string.h pthread.h getopt.h grp.h pwd.h sys/mman.h sys/types.h sys/wait.h sys/stat.h sys/socket.h sys/loadavg.h netinet/in.h fcntl.h limits.h) 50 51# Checks for typedefs, structures, and compiler characteristics. 52AC_TYPE_PID_T 53AC_TYPE_SIGNAL 54AC_TYPE_UID_T 55 56# Checks for structure members 57#AC_CHECK_MEMBER([struct dirent.d_type], [AC_MSG_RESULT([We successfully have a `dirent_d_type'!])], 58# [AC_MSG_ERROR([We need `dirent.d_type'!])], 59# [#include <dirent.h>]) 60 61AC_STRUCT_DIRENT_D_TYPE 62 63# Checks for library functions. 64AC_FUNC_FORK 65AC_CHECK_FUNCS([bzero socket alarm strerror strspn getloadavg]) 66 67AC_FUNC_MALLOC 68AC_FUNC_STAT 69 70AC_C_CONST 71 72dnl Layout Methods 73layout="default" 74AC_ARG_WITH(layout,[ --with-layout=\[default,debian\] sets directory layout],layout=$withval) 75 76case $layout in 77 debian) 78 prefix="/" 79 sysconfdir="/etc/${PKG_NAME}" 80 localstatedir="/var/log/${PKG_NAME}" 81 libexecdir="/usr/lib/${PKG_NAME}/libexec" 82 libdir="/usr/lib/${PKG_NAME}" 83 datarootdir="/usr/share/${PKG_NAME}/html" 84 PERFDATA_LOG="/var/log/${PKG_NAME}/perfdata.log" 85 PERFDATA_DIR="/var/lib/${PKG_NAME}/perfdata" 86 PERFDATA_SPOOL_DIR="/var/spool/${PKG_NAME}" 87 bindir="/usr/bin" 88 sbindir="/usr/sbin" 89 ;; 90 default-0.4) 91 prefix="/usr/local/nagios" 92 sysconfdir="\${prefix}/etc/pnp" 93 localstatedir="\${prefix}/var" 94 libexecdir="\${prefix}/libexec" 95 datarootdir="\${prefix}/share/pnp" 96 libdir="\${prefix}/lib/pnp" 97 PERFDATA_LOG="\${prefix}/var/perfdata.log" 98 PERFDATA_DIR="\${prefix}/share/perfdata" 99 PERFDATA_SPOOL_DIR="\${prefix}/var/spool/perfdata" 100 ;; 101 default) 102 PERFDATA_LOG="${localstatedir}/perfdata.log" 103 PERFDATA_DIR="${localstatedir}/perfdata" 104 PERFDATA_SPOOL_DIR="${localstatedir}/spool" 105 mandir="\${prefix}/man" 106 ;; 107esac 108 109AC_ARG_WITH(kohana,[ --without-kohana does not install the kohana framework],KOHANA=no,KOHANA=yes) 110AC_SUBST(KOHANA) 111AC_ARG_WITH(kohana_system,[ --with-kohana_system=<existing kohana system dir> Points to an already installed kohana framework],KOHANA_SYSTEM=$withval,KOHANA_SYSTEM=$libdir/kohana/system) 112AC_SUBST(KOHANA_SYSTEM) 113AC_ARG_WITH(nagios_user,[ --with-nagios-user=<user> sets user name to run nagios],nagios_user=$withval,nagios_user=nagios) 114AC_ARG_WITH(nagios_group,[ --with-nagios-group=<grp> sets group name to run nagios],nagios_grp=$withval,nagios_grp=nagios) 115AC_SUBST(nagios_user) 116AC_SUBST(nagios_grp) 117AC_DEFINE_UNQUOTED(DEFAULT_NAGIOS_USER,"$nagios_user") 118AC_DEFINE_UNQUOTED(DEFAULT_NAGIOS_GROUP,"$nagios_grp") 119INSTALL_OPTS="-o $nagios_user -g $nagios_grp" 120AC_SUBST(INSTALL_OPTS) 121 122# Checks for programs. 123AC_PATH_PROG(PERL,perl) 124# Check for Perl lib path 125PERL_LIB_PATH=no 126AC_ARG_WITH(perl_lib_path,[ --with-perl_lib_path=<path_to_perl_libs> sets path to rrdtool RRDs perl modules.],PERL_LIB_PATH=$withval,PERL_LIB_PATH=no) 127AC_SUBST(PERL_LIB_PATH) 128# Check for rrdtool 129RRDTOOL=no 130AC_ARG_WITH(rrdtool,[ --with-rrdtool=<path_to_rrdtool> sets path to rrdtool],RRDTOOL=$withval,RRDTOOL=no) 131if test RRDTOOL=no; then 132 AC_PATH_PROG(RRDTOOL,rrdtool) 133fi 134 135AC_MSG_CHECKING(rrdtool path $RRDTOOL) 136if [ test -d $RRDTOOL ];then 137 AC_MSG_RESULT(no) 138 AC_MSG_ERROR([$RRDTOOL is a directory! PNP needs the Path to the rrdtool binary!]) 139fi 140AC_MSG_RESULT(yes) 141AC_MSG_CHECKING(for executable Bit on $RRDTOOL) 142if [ ! test -x $RRDTOOL] ;then 143 AC_MSG_RESULT(no) 144 AC_MSG_ERROR([$RRDTOOL is not executable!]) 145fi 146AC_MSG_RESULT(yes) 147 148AC_SUBST(RRDTOOL) 149 150 151AC_ARG_WITH(perfdata-logfile,[ --with-perfdata-logfile=<perfdata_logfile> Tell me where I should store the 'process_perfdata.pl' Logfile], 152 PERFDATA_LOG=$withval 153 ) 154AC_SUBST(PERFDATA_LOG) 155 156 157AC_ARG_WITH(perfdata-dir,[ --with-perfdata-dir=<path_to_perfdata> Tell me where I should store the RRD Database Files], 158 PERFDATA_DIR=$withval 159 ) 160AC_SUBST(PERFDATA_DIR) 161 162AC_ARG_WITH(perfdata-spool-dir,[ --with-perfdata-spool-dir=<path_to_perfdata_spool_dir> Tell me where I should store perfdata files for bulk mode with npcd], 163 PERFDATA_SPOOL_DIR=$withval 164 ) 165AC_SUBST(PERFDATA_SPOOL_DIR) 166 167AC_ARG_WITH(debug,[ --with-debug Enable debuging for process_perfdata.pl], 168 DEBUG="2", 169 DEBUG="0" 170 ) 171AC_SUBST(DEBUG) 172 173dnl Check for location of Apache conf.d directory 174HTTP_CONF=no 175AC_ARG_WITH(httpd_conf,[ --with-httpd-conf=<path_to_conf> sets path to Apache conf.d directory],HTTPD_CONF=$withval,HTTPD_CONF=no) 176if test x$HTTPD_CONF = xno; then 177 if test -d /etc/httpd/conf.d; then 178 HTTPD_CONF="/etc/httpd/conf.d" 179 elif test -d /etc/apache2/conf.d; then 180 HTTPD_CONF="/etc/apache2/conf.d" 181 elif test -d /etc/apache/conf.d; then 182 HTTPD_CONF="/etc/apache/conf.d" 183 else 184 HTTPD_CONF="/etc/httpd/conf.d" 185 fi 186fi 187AC_SUBST(HTTPD_CONF) 188 189dnl Check for location of init scripts 190init_dir=/etc/rc.d/init.d 191if test -d /etc/rc.d/init.d; then 192 init_dir="/etc/rc.d/init.d" 193elif test -d /usr/local/etc/rc.d; then 194 init_dir="/usr/local/etc/rc.d" 195elif test -d /etc/rc.d; then 196 init_dir="/etc/rc.d" 197elif test -d /etc/init.d; then 198 init_dir="/etc/init.d" 199elif test -d /sbin/init.d; then 200 init_dir="/sbin/init.d" 201fi 202 203BASE_URL=${PKG_NAME} 204AC_ARG_WITH(base-url,[ --with-base-url=/${PKG_NAME} ],BASE_URL=$withval,BASE_URL=/${PKG_NAME}) 205AC_SUBST(BASE_URL) 206 207dnl User can override init script location 208AC_ARG_WITH(init_dir,[ --with-init-dir=<path> sets directory to place init script into],init_dir=$withval) 209AC_SUBST(init_dir) 210 211pnpsender_name=pnpsender 212AC_SUBST(pnpsender_name) 213 214npcd_name=npcd 215AC_SUBST(npcd_name) 216 217pp_pl_name=process_perfdata.pl 218AC_SUBST(pp_pl_name) 219 220dnl - Modified version from www.erlang.org 221dnl - Some 12/15/05 mods made after reading http://xaxxon.slackworks.com/phuku/dl.html 222AC_MSG_CHECKING(for linker flags for loadable modules) 223case $host_os in 224 solaris2*|sysv4*) 225 MOD_LDFLAGS="-G" 226 ;; 227 aix4*|aix5*|aix6*|aix7*) 228 #MOD_LDFLAGS="-G -bnoentry -bexpall" 229 MOD_LDFLAGS="-shared -Wl,-G -Wl,-bM:SRE -Wl,-bnoentry -Wl,-bexpall" 230 ;; 231 freebsd2*) 232 # Non-ELF GNU linker 233 MOD_LDFLAGS="-Bshareable" 234 ;; 235 darwin*) 236 # Mach-O linker, a shared lib and a loadable 237 # object file is not the same thing. 238 MOD_LDFLAGS="-bundle -flat_namespace -undefined suppress" 239 MOD_CFLAGS="$MOD_CFLAGS -fno-common" 240 ;; 241 linux* | k*bsd*-gnu*) 242 # assume GNU linker and ELF 243 MOD_LDFLAGS="-shared" 244 MOD_CFLAGS="-fPIC" 245 ;; 246 *) 247 # assume GNU linker and ELF 248 MOD_LDFLAGS="-shared" 249 ;; 250esac 251AC_MSG_RESULT([$MOD_LDFLAGS]) 252AC_SUBST(MOD_CFLAGS) 253AC_SUBST(MOD_LDFLAGS) 254 255# 256# Checking for Perl Modules 257# 258AC_MSG_CHECKING(for Perl Module Time::HiRes) 259$PERL -MTime::HiRes -e exit >/dev/null 2>&1 260if test $? -ne 0; then 261 AC_MSG_RESULT(no) 262 AC_MSG_ERROR(Perl Module Time::HiRes not available) 263else 264 AC_MSG_RESULT(yes) 265fi 266 267AC_MSG_CHECKING(for Perl Module Getopt::Long) 268$PERL -MGetopt::Long -e exit >/dev/null 2>&1 269if test $? -ne 0; then 270 AC_MSG_RESULT(no) 271 AC_MSG_ERROR(Perl Module Getopt::Long not available) 272else 273 AC_MSG_RESULT(yes) 274fi 275 276RRDS=0 277AC_MSG_CHECKING(for optional Perl Module RRDs) 278$PERL -I${PERL_LIB_PATH} -MRRDs -e exit >/dev/null 2>&1 279if test $? -ne 0; then 280 AC_MSG_RESULT(no) 281 AC_MSG_WARN(Perl Module RRDs not available) 282 RRDS=0 283else 284 AC_MSG_RESULT(yes) 285 RRDS=1 286fi 287AC_SUBST(RRDS) 288 289AC_CONFIG_FILES( subst Makefile share/Makefile lib/Makefile scripts/Makefile src/Makefile sample-config/Makefile man/Makefile ) 290AC_OUTPUT() 291 292$PERL subst summary 293$PERL subst scripts/process_perfdata.pl 294$PERL subst scripts/rrd_convert.pl 295$PERL subst scripts/rrd_modify.pl 296$PERL subst scripts/rc.npcd 297$PERL subst scripts/rc.pnp_gearman_worker 298$PERL subst scripts/check_pnp_rrds.pl 299$PERL subst share/pnp/index.php 300$PERL subst share/pnp/install.php 301$PERL subst sample-config/httpd.conf 302$PERL subst sample-config/lighttpd.pnp4nagios.conf 303$PERL subst sample-config/nginx.pnp4nagios.conf 304$PERL subst sample-config/nagios.cfg-sample 305$PERL subst sample-config/misccommands.cfg-sample 306$PERL subst sample-config/pnp/config.php 307$PERL subst sample-config/pnp/npcd.cfg-sample 308$PERL subst sample-config/pnp/process_perfdata.cfg-sample 309$PERL subst sample-config/pnp/pnp4nagios_release 310$PERL subst contrib/ssi/status-header.ssi 311$PERL subst man/npcd.8 312 313$PERL summary 314