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