| 1 |
dnl Process this file with autoconf to produce a configure script. |
| 2 |
|
| 3 |
AC_PREREQ([2.59]) |
| 4 |
|
| 5 |
AC_INIT(nagios-plugins-linux, |
| 6 |
m4_normalize(m4_include([VERSION])), |
| 7 |
[[email protected]]) |
| 8 |
|
| 9 |
AC_MSG_CHECKING([for $PACKAGE_NAME version]) |
| 10 |
AC_MSG_RESULT([$PACKAGE_VERSION]) |
| 11 |
|
| 12 |
AC_CANONICAL_TARGET |
| 13 |
|
| 14 |
AM_INIT_AUTOMAKE([ |
| 15 |
check-news |
| 16 |
gnu |
| 17 |
1.11 |
| 18 |
silent-rules |
| 19 |
tar-pax |
| 20 |
no-dist-gzip |
| 21 |
dist-bzip2 |
| 22 |
dist-xz |
| 23 |
subdir-objects |
| 24 |
-Wno-portability |
| 25 |
]) |
| 26 |
|
| 27 |
AC_CONFIG_SRCDIR([plugins/check_cpu.c]) |
| 28 |
AC_CONFIG_HEADERS(config.h:config.hin) |
| 29 |
AC_CONFIG_LIBOBJ_DIR([lib]) |
| 30 |
AC_CONFIG_MACRO_DIR([m4]) |
| 31 |
|
| 32 |
AM_MAINTAINER_MODE |
| 33 |
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 34 |
|
| 35 |
#AC_USE_SYSTEM_EXTENSIONS(_GNU_SOURCE) |
| 36 |
|
| 37 |
dnl Checks for the compiler features |
| 38 |
|
| 39 |
AC_C_CONST |
| 40 |
AC_C_PROTOTYPES |
| 41 |
AC_C_INLINE |
| 42 |
|
| 43 |
m4_ifndef([LT_INIT], [ |
| 44 |
AM_PROG_LIBTOOL |
| 45 |
], [ |
| 46 |
LT_INIT([shared disable-static]) |
| 47 |
]) |
| 48 |
|
| 49 |
# 'AC_PROG_CC_C99' unfortunately requires autoconf 2.60+ |
| 50 |
#AC_PROG_CC_C99 |
| 51 |
AM_PROG_CC_C_O |
| 52 |
AC_PROG_CC |
| 53 |
|
| 54 |
if test "$cross_compiling" = no; then |
| 55 |
if test "x$ac_cv_prog_cc_c99" = "xno" || test "x$ac_cv_prog_cc_c99" = "x"; then |
| 56 |
# Check if CC is gcc and if it bails when given -std=gnu99. |
| 57 |
# If not, use that. Yuck. |
| 58 |
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then |
| 59 |
CC="$CC -std=gnu99" |
| 60 |
AC_RUN_IFELSE( |
| 61 |
[AC_LANG_PROGRAM([],[[return 0;]])], |
| 62 |
[], |
| 63 |
[AC_MSG_ERROR([Could not find a C99 compatible compiler])], |
| 64 |
[AC_MSG_ERROR([Internal error: not reached in cross-compile])]) |
| 65 |
else |
| 66 |
AC_MSG_ERROR([Could not find a C99 compatible compiler]) |
| 67 |
fi |
| 68 |
fi |
| 69 |
fi |
| 70 |
|
| 71 |
# Linux Alpine shipis with musl libc |
| 72 |
AC_MSG_CHECKING(for musl libc) |
| 73 |
dumpmachine=`$CC -dumpmachine` |
| 74 |
case "$dumpmachine" in |
| 75 |
*-musl) |
| 76 |
AC_MSG_RESULT([yes]) |
| 77 |
AC_DEFINE([LIBC_MUSL], [1], [Define to 1 if libc is musl]) |
| 78 |
;; |
| 79 |
*) |
| 80 |
AC_MSG_RESULT([no]) ;; |
| 81 |
esac |
| 82 |
|
| 83 |
dnl Check for variable-length arrays support |
| 84 |
AC_MSG_CHECKING(for variable-lenght arrays) |
| 85 |
AC_COMPILE_IFELSE( |
| 86 |
[AC_LANG_PROGRAM([[]],[[ |
| 87 |
int foo; |
| 88 |
foo = 10; |
| 89 |
int array[foo];]])], |
| 90 |
[AC_MSG_RESULT([yes]) |
| 91 |
AC_DEFINE([VARIABLE_LENGTH_ARRAYS], [], |
| 92 |
[Define this if the compiler supports variable-length arrays])], |
| 93 |
[AC_MSG_RESULT([no]) |
| 94 |
AC_MSG_ERROR([The compiler does not support variable-length arrays]) |
| 95 |
]) |
| 96 |
|
| 97 |
dnl Add the option '--disable-hardening' |
| 98 |
AC_ARG_ENABLE([hardening], |
| 99 |
[AS_HELP_STRING([--disable-hardening], |
| 100 |
[do not attempt to harden the resulting executables (default is to harden)])], |
| 101 |
[use_hardening=$enableval], |
| 102 |
[use_hardening=yes]) |
| 103 |
|
| 104 |
dnl Turn warnings into errors: '--enable-werror' |
| 105 |
AC_ARG_ENABLE([werror], |
| 106 |
AS_HELP_STRING([--enable-werror], |
| 107 |
[make all warnings as errors (default is no)]), |
| 108 |
[enable_werror=$enableval], |
| 109 |
[enable_werror=no]) |
| 110 |
AS_IF([test "x$enable_werror" = "xyes"], [ |
| 111 |
cc_TRY_CFLAGS([-Werror]) |
| 112 |
case "$SUPPORTED_CFLAGS" in |
| 113 |
*-Werror*) ;; |
| 114 |
*) |
| 115 |
AC_MSG_ERROR([enable-werror set but -Werror is not usable]) |
| 116 |
;; |
| 117 |
esac]) |
| 118 |
|
| 119 |
dnl Checks for some compiler warning flags |
| 120 |
|
| 121 |
cc_TRY_CFLAGS([-Wall]) |
| 122 |
cc_TRY_CFLAGS([-Wformat]) |
| 123 |
cc_TRY_CFLAGS([-Wformat -Wformat-security]) |
| 124 |
cc_TRY_CFLAGS([-Wformat-signedness]) |
| 125 |
cc_TRY_CFLAGS([-Wimplicit-fallthrough=2]) |
| 126 |
cc_TRY_CFLAGS([-Wmissing-noreturn]) |
| 127 |
cc_TRY_CFLAGS([-Wmissing-format-attribute]) |
| 128 |
cc_TRY_CFLAGS([-Wredundant-decls]) |
| 129 |
cc_TRY_CFLAGS([-Wshadow]) |
| 130 |
cc_TRY_CFLAGS([-Wsign-compare]) |
| 131 |
cc_TRY_CFLAGS([-Wstrict-aliasing=2]) |
| 132 |
cc_TRY_CFLAGS([-Wstringop-truncation]) |
| 133 |
cc_TRY_CFLAGS([-Wunused]) |
| 134 |
# The gcc compiler shipped by RHEL5 (gcc-4.1.2) does not recognize it |
| 135 |
#cc_TRY_CFLAGS([-Warray-bounds]) |
| 136 |
|
| 137 |
if test x$use_hardening != xno; then |
| 138 |
cc_TRY_CFLAGS([-Wstack-protector]) |
| 139 |
cc_TRY_CFLAGS([-D_FORTIFY_SOURCE=2]) |
| 140 |
cc_TRY_CFLAGS([-fstack-protector-strong]) |
| 141 |
cc_TRY_CFLAGS([-fpie -fPIE]) |
| 142 |
case "$SUPPORTED_CFLAGS" in |
| 143 |
*-fstack-protector-strong*) ;; |
| 144 |
*) |
| 145 |
cc_TRY_CFLAGS([-fstack-protector-all]) |
| 146 |
;; |
| 147 |
esac |
| 148 |
cc_TRY_LDFLAGS([-Wl,-z,relro]) |
| 149 |
cc_TRY_LDFLAGS([-Wl,-z,now]) |
| 150 |
fi |
| 151 |
|
| 152 |
dnl Checks whether the compiler supports the |
| 153 |
dnl __attribute__((__malloc__)) feature |
| 154 |
ac_save_CFLAGS="$CFLAGS" |
| 155 |
CFLAGS="$CFLAGS -Werror" |
| 156 |
AC_CACHE_CHECK( |
| 157 |
[whether compiler supports __attribute__((__malloc__))], |
| 158 |
[cc_cv_attribute_malloc], |
| 159 |
[AC_COMPILE_IFELSE( |
| 160 |
[AC_LANG_PROGRAM([[]],[[ |
| 161 |
void *fooalloc(int size) __attribute__((__malloc__));]])], |
| 162 |
[cc_cv_attribute_malloc=yes], |
| 163 |
[cc_cv_attribute_malloc=no]) |
| 164 |
]) |
| 165 |
CFLAGS="$ac_save_CFLAGS" |
| 166 |
if test "x$cc_cv_attribute_malloc" = "xyes"; then |
| 167 |
ac_cc_attribute_malloc='__attribute__((__malloc__))' |
| 168 |
fi |
| 169 |
AC_DEFINE_UNQUOTED( |
| 170 |
[_attribute_malloc_], [$ac_cc_attribute_malloc], |
| 171 |
[Define this if the compiler supports the malloc attribute]) |
| 172 |
|
| 173 |
dnl Check whether the compiler supports the |
| 174 |
dnl __attribute__((__noreturn__)) feature |
| 175 |
ac_cc_attribute_noreturn= |
| 176 |
ac_save_CFLAGS="$CFLAGS" |
| 177 |
CFLAGS="$CFLAGS -Werror" |
| 178 |
AC_CACHE_CHECK( |
| 179 |
[whether compiler supports the noreturn feature], |
| 180 |
[cc_cv_attribute_noreturn], |
| 181 |
[AC_COMPILE_IFELSE( |
| 182 |
[AC_LANG_PROGRAM([[]],[[ |
| 183 |
void _Noreturn f(void *foo);]])], |
| 184 |
[cc_cv_attribute_noreturn="_Noreturn"], |
| 185 |
[AC_COMPILE_IFELSE( |
| 186 |
[AC_LANG_PROGRAM([[]],[[ |
| 187 |
void f(void *foo) __attribute__((__noreturn__));]])], |
| 188 |
[cc_cv_attribute_noreturn="using __attribute__"], |
| 189 |
[cc_cv_attribute_noreturn=no]) |
| 190 |
]) |
| 191 |
]) |
| 192 |
CFLAGS="$ac_save_CFLAGS" |
| 193 |
case "$cc_cv_attribute_noreturn" in |
| 194 |
"using __attribute__") |
| 195 |
AC_DEFINE_UNQUOTED( |
| 196 |
[_Noreturn], [__attribute__((__noreturn__))], |
| 197 |
[Define this if the compiler supports the noreturn __attribute__]) |
| 198 |
;; |
| 199 |
"no") |
| 200 |
AC_DEFINE_UNQUOTED([_Noreturn], [], |
| 201 |
[Define this if the compiler does not supports any noreturn attribute]) |
| 202 |
;; |
| 203 |
esac |
| 204 |
|
| 205 |
dnl Check whether the compiler supports the |
| 206 |
dnl __attribute__((__format__ (__printf__, x,y))) feature |
| 207 |
ac_cc_attribute_format_printf= |
| 208 |
ac_save_CFLAGS="$CFLAGS" |
| 209 |
CFLAGS="$CFLAGS -Werror" |
| 210 |
AC_CACHE_CHECK( |
| 211 |
[whether compiler supports __attribute__((__format__ (__printf__, x,y))], |
| 212 |
[cc_cv_attribute_format_printf], |
| 213 |
[AC_COMPILE_IFELSE( |
| 214 |
[AC_LANG_PROGRAM([[]],[[ |
| 215 |
void f(const char *fmt, ...) |
| 216 |
__attribute__((__format__ (__printf__, 1,2)));]])], |
| 217 |
[cc_cv_attribute_format_printf=yes], |
| 218 |
[cc_cv_attribute_format_printf=no]) |
| 219 |
]) |
| 220 |
CFLAGS="$ac_save_CFLAGS" |
| 221 |
if test "x$cc_cv_attribute_format_printf" = "xyes"; then |
| 222 |
ac_cc_attribute_format_printf='__attribute__((__format__ (__printf__, X,Y)))' |
| 223 |
fi |
| 224 |
AC_DEFINE_UNQUOTED( |
| 225 |
[_attribute_format_printf_(X,Y)], [$ac_cc_attribute_format_printf], |
| 226 |
[Define this if the compiler supports the format printf attribute]) |
| 227 |
|
| 228 |
dnl Checks for header files |
| 229 |
AC_HEADER_STDBOOL |
| 230 |
AC_CHECK_HEADERS([ \ |
| 231 |
arpa/inet.h \ |
| 232 |
fcntl.h \ |
| 233 |
limits.h \ |
| 234 |
mntent.h \ |
| 235 |
netinet/in.h \ |
| 236 |
sys/mount.h \ |
| 237 |
sys/param.h \ |
| 238 |
sys/resource.h \ |
| 239 |
sys/socket.h \ |
| 240 |
sys/sysctl.h \ |
| 241 |
sys/sysinfo.h \ |
| 242 |
sys/types.h \ |
| 243 |
sys/time.h \ |
| 244 |
sys/swap.h \ |
| 245 |
utmpx.h]) |
| 246 |
|
| 247 |
AC_CHECK_HEADERS([ \ |
| 248 |
linux/if_link.h \ |
| 249 |
linux/if.h \ |
| 250 |
linux/wireless.h], [], [], |
| 251 |
[ |
| 252 |
#if HAVE_SYS_TYPES_H |
| 253 |
# include <sys/types.h> |
| 254 |
#endif |
| 255 |
#if HAVE_SYS_SOCKET_H |
| 256 |
# include <sys/socket.h> |
| 257 |
#endif |
| 258 |
]) |
| 259 |
|
| 260 |
dnl check for headers required by the netinfo* libraries |
| 261 |
AC_CHECK_HEADERS([ \ |
| 262 |
linux/ethtool.h \ |
| 263 |
linux/netlink.h \ |
| 264 |
linux/rtnetlink.h \ |
| 265 |
linux/sockios.h], [], |
| 266 |
[AC_MSG_ERROR([please install linux network headers])]) |
| 267 |
|
| 268 |
dnl Checks for functions and libraries |
| 269 |
|
| 270 |
AC_CHECK_FUNCS([asprintf]) |
| 271 |
|
| 272 |
AC_CHECK_FUNCS([ \ |
| 273 |
__secure_getenv \ |
| 274 |
secure_getenv\ |
| 275 |
]) |
| 276 |
|
| 277 |
dnl Check for ceil (some platforms use libm for the math functions |
| 278 |
dnl instead of the C library |
| 279 |
dnl wanted by lib/netinfo.c |
| 280 |
|
| 281 |
LIBS_SAVE="$LIBS" |
| 282 |
AC_SEARCH_LIBS([ceil], [m], [], [ |
| 283 |
AC_MSG_ERROR([unable to find the ceil() function]) |
| 284 |
]) |
| 285 |
CEIL_LIBS="$LIBS" |
| 286 |
AC_SUBST([CEIL_LIBS]) |
| 287 |
LIBS="$LIBS_SAVE" |
| 288 |
|
| 289 |
dnl Check for clock_gettime CLOCK_MONOTONIC |
| 290 |
dnl wanted by: plugins/check_uptime.c |
| 291 |
LIBS_SAVE="$LIBS" |
| 292 |
AC_CHECK_LIB([rt], [clock_gettime]) |
| 293 |
AC_MSG_CHECKING([for clock_gettime with clock CLOCK_MONOTONIC]) |
| 294 |
AC_COMPILE_IFELSE( |
| 295 |
[AC_LANG_PROGRAM([[#include <time.h>]], |
| 296 |
[[struct timespec ts; |
| 297 |
clock_gettime (CLOCK_MONOTONIC, &ts);]])], |
| 298 |
[ac_cv_clock_gettime_monotonic=yes |
| 299 |
AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1, |
| 300 |
[Define to 1 if you have clock_gettime(CLOCK_MONOTONIC).]) |
| 301 |
], |
| 302 |
[ac_cv_clock_gettime_monotonic=no]) |
| 303 |
AC_MSG_RESULT([$ac_cv_clock_gettime_monotonic]) |
| 304 |
CLOCK_LIBS="$LIBS" |
| 305 |
AC_SUBST([CLOCK_LIBS]) |
| 306 |
LIBS="$LIBS_SAVE" |
| 307 |
|
| 308 |
dnl suggestions from autoscan |
| 309 |
AC_CHECK_FUNCS([getmntent]) dnl wanted by: lib/mountlist.c |
| 310 |
AC_CHECK_FUNCS([hasmntopt]) dnl wanted by: lib/mountlist.c |
| 311 |
AC_CHECK_FUNCS([memset]) dnl wanted by: lib/cpustats.c |
| 312 |
AC_CHECK_FUNCS([regcomp]) dnl wanted by: plugins/check_multipath.c |
| 313 |
AC_CHECK_FUNCS([socket]) dnl wanted by: plugins/check_multipath.c |
| 314 |
AC_CHECK_FUNCS([strchr]) dnl wanted by: lib/interrupts.c |
| 315 |
AC_CHECK_FUNCS([strerror]) dnl wanted by: lib/thresholds.c |
| 316 |
AC_CHECK_FUNCS([strrchr]) dnl wanted by: lib/progname.c |
| 317 |
AC_CHECK_FUNCS([strstr]) dnl wanted by: lib/cpudesc.c |
| 318 |
AC_CHECK_FUNCS([strtol]) dnl wanted by: lib/processes.c |
| 319 |
AC_CHECK_FUNCS([strtoul]) dnl wanted by: lib/interrupts.c |
| 320 |
AC_CHECK_FUNCS([strtoull]) dnl wanted by: lib/procparser.c |
| 321 |
AC_CHECK_FUNCS([sysinfo]) dnl wanted by: plugins/check_uptime.c |
| 322 |
AC_CHECK_FUNCS([uname]) dnl wanted by: lib/cpudesc.c |
| 323 |
AC_CHECK_FUNCS([realpath]) dnl wanted by: plugins/check_fc.c |
| 324 |
AC_CHECK_FUNCS([strtoull]) dnl wanted by: plugins/check_fc.c |
| 325 |
|
| 326 |
AC_FUNC_GETMNTENT |
| 327 |
AC_FUNC_MALLOC |
| 328 |
AC_FUNC_REALLOC |
| 329 |
AC_FUNC_STRTOD |
| 330 |
|
| 331 |
dnl sched.h: check for the macros CPU_* |
| 332 |
AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[#include <sched.h>]]) |
| 333 |
AM_CONDITIONAL([HAVE_CPU_SET_T], [test "x$have_cpu_set_t" = xyes]) |
| 334 |
AC_CHECK_DECLS([CPU_ALLOC], [], [], |
| 335 |
[[#define _GNU_SOURCE |
| 336 |
#include <sched.h>]]) |
| 337 |
|
| 338 |
dnl Check for libcurl |
| 339 |
AC_ARG_ENABLE([libcurl], |
| 340 |
AS_HELP_STRING([--enable-libcurl], [enable libcurl])) |
| 341 |
AS_IF([test "x$enable_libcurl" = "xyes"], [ |
| 342 |
LIBCURL_CHECK_CONFIG([], [7.40.0], [], |
| 343 |
[AC_MSG_ERROR([Missing required libcurl >= 7.40.0])]) |
| 344 |
AC_SUBST([LIBCURL_CPPFLAGS]) |
| 345 |
AC_SUBST([LIBCURL]) |
| 346 |
AM_CONDITIONAL(HAVE_LIBCURL, [test "$libcurl_cv_lib_curl_usable" = "yes"]) |
| 347 |
], [AM_CONDITIONAL(HAVE_LIBCURL, false)]) |
| 348 |
|
| 349 |
dnl Check for the procps newlib |
| 350 |
have_libprocps=no |
| 351 |
AC_ARG_ENABLE([libprocps], |
| 352 |
AS_HELP_STRING([--enable-libprocps], [enable optional LIBPROC2 support]), |
| 353 |
[enable_libprocps=$enableval],[enable_libprocps=no]) |
| 354 |
AS_IF([test "x$enable_libprocps" = "xyes"], [ |
| 355 |
PKG_CHECK_EXISTS([libproc2], |
| 356 |
[PKG_CHECK_MODULES(LIBPROCPS, [libproc2 >= 4.0.0], |
| 357 |
[AC_DEFINE(HAVE_LIBPROCPS, 1, [Define if libproc2 (procps) is available]) |
| 358 |
have_libprocps=yes], |
| 359 |
AC_MSG_ERROR([*** libproc2 (procps) version >= 4.0.0 not found]))]) |
| 360 |
AC_SUBST(LIBPROCPS_LIBS) |
| 361 |
AC_SUBST(LIBPROCPS_CFLAGS) |
| 362 |
AS_IF([test "x$have_libprocps" = "xno" -a "x$enable_libprocps" = "xyes"], |
| 363 |
[AC_MSG_ERROR([*** libproc2 (procps) >= 4.0.0 support requested, but libraries not found])]) |
| 364 |
]) |
| 365 |
AM_CONDITIONAL(HAVE_LIBPROCPS, [test "$have_libprocps" = "yes"]) |
| 366 |
|
| 367 |
dnl Check for systemd-login libraries |
| 368 |
AC_ARG_ENABLE([systemd], |
| 369 |
AS_HELP_STRING([--enable-systemd], [enable systemd related features]), |
| 370 |
[], [enable_systemd=check] |
| 371 |
) |
| 372 |
have_systemd=no |
| 373 |
AS_IF([test "x$enable_systemd" != "xno"], [ |
| 374 |
PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [have_systemd=yes], [have_systemd=no]) |
| 375 |
AS_CASE([$enable_systemd:$have_systemd], |
| 376 |
[yes:no], |
| 377 |
[AC_MSG_ERROR([systemd expected but libsystemd not found])], |
| 378 |
[*:yes], |
| 379 |
AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Define if libsystemd is available]) |
| 380 |
AC_DEFINE([USE_SYSTEMD], [1], [Define if systemd support is wanted]) |
| 381 |
) |
| 382 |
]) |
| 383 |
AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$have_systemd" = "xyes"]) |
| 384 |
|
| 385 |
dnl Add the option '--with-proc-meminfo=PATH' |
| 386 |
AC_ARG_WITH(proc-meminfo, |
| 387 |
AS_HELP_STRING([--with-proc-meminfo=PATH], |
| 388 |
[path to /proc/meminfo or equivalent]), |
| 389 |
[] |
| 390 |
[with_procmeminfo=$withval]) |
| 391 |
AC_MSG_CHECKING([for /proc/meminfo]) |
| 392 |
if test x${with_procmeminfo+set} = xset; then |
| 393 |
AC_MSG_RESULT([(command line) $with_procmeminfo]) |
| 394 |
elif [cat /proc/meminfo > /dev/null 2>&1]; then |
| 395 |
AC_MSG_RESULT([found /proc/meminfo]) |
| 396 |
with_procmeminfo="/proc/meminfo" |
| 397 |
else |
| 398 |
AC_MSG_RESULT([no]) |
| 399 |
fi |
| 400 |
if test x${with_procmeminfo+set} = xset; then |
| 401 |
AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$with_procmeminfo",[path to /proc/meminfo if name changes]) |
| 402 |
fi |
| 403 |
AM_CONDITIONAL([HAVE_PROC_MEMINFO], [test x${with_procmeminfo+set} = xset]) |
| 404 |
|
| 405 |
dnl Add the option: '--enable-debug' |
| 406 |
AC_ARG_ENABLE([debug], |
| 407 |
AS_HELP_STRING([--enable-debug], |
| 408 |
[enable debug messages @<:@default=disabled@:>@]), |
| 409 |
[], [enable_debug=no]) |
| 410 |
AS_IF([test "x$enable_debug" = "xyes"], [ |
| 411 |
AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])]) |
| 412 |
|
| 413 |
dnl Add the option: '--with-docker-socket' |
| 414 |
DOCKER_SOCKET="/var/run/docker.sock" |
| 415 |
AC_ARG_WITH( |
| 416 |
[dockersocket], |
| 417 |
[AS_HELP_STRING( |
| 418 |
[--with-docker-socket], |
| 419 |
[use a different socket file for docker |
| 420 |
(default is /var/run/docker.sock)])], |
| 421 |
[DOCKER_SOCKET="$with_dockersocket"]) |
| 422 |
AC_SUBST(DOCKER_SOCKET) |
| 423 |
|
| 424 |
dnl Add the option: '--with-podman-socket' |
| 425 |
PODMAN_SOCKET="/run/podman/podman.sock" |
| 426 |
AC_ARG_WITH( |
| 427 |
[podmansocket], |
| 428 |
[AS_HELP_STRING( |
| 429 |
[--with-podman-socket], |
| 430 |
[use a different podman socket |
| 431 |
(default is /run/podman/podman.sock)])], |
| 432 |
[PODMAN_SOCKET="$with_podmansocket"]) |
| 433 |
AC_SUBST(PODMAN_SOCKET) |
| 434 |
|
| 435 |
dnl Add the option: '--with-socketfile' |
| 436 |
MULTIPATHD_SOCKET="@/org/kernel/linux/storage/multipathd" |
| 437 |
AC_ARG_WITH( |
| 438 |
[socketfile], |
| 439 |
[AS_HELP_STRING( |
| 440 |
[--with-socketfile], |
| 441 |
[use a different socket file |
| 442 |
(default is @/org/kernel/linux/storage/multipathd)])], |
| 443 |
[MULTIPATHD_SOCKET="$with_socketfile"]) |
| 444 |
AC_SUBST(MULTIPATHD_SOCKET) |
| 445 |
|
| 446 |
dnl Add the option: '--with-tests' |
| 447 |
AC_ARG_WITH( |
| 448 |
[test-suite], |
| 449 |
[AS_HELP_STRING( |
| 450 |
[--with-test-suite], |
| 451 |
[build test suite by default @<:@default=check@:>@])], |
| 452 |
[case "${with_test_suite}" in |
| 453 |
yes|no|check) ;; |
| 454 |
*) AC_MSG_ERROR([bad value ${with_test_suite} for tests option]) ;; |
| 455 |
esac], |
| 456 |
[with_test_suite=check]) |
| 457 |
AC_MSG_CHECKING([Whether to build test suite by default]) |
| 458 |
if test "$with_test_suite" = "check" ; then |
| 459 |
if test -d $srcdir/.git ; then |
| 460 |
with_test_suite=yes |
| 461 |
else |
| 462 |
with_test_suite=no |
| 463 |
fi |
| 464 |
fi |
| 465 |
AC_MSG_RESULT([$with_test_suite]) |
| 466 |
AM_CONDITIONAL([WITH_TESTS], [test "$with_test_suite" = "yes"]) |
| 467 |
|
| 468 |
dnl Check whether we can get the number of CPU |
| 469 |
AC_CHECK_FUNCS([get_nprocs_conf get_nprocs], [], |
| 470 |
[AC_MSG_CHECKING([for number of online cpus]) |
| 471 |
AC_COMPILE_IFELSE( |
| 472 |
[AC_LANG_PROGRAM([[#include <unistd.h>]],[[ |
| 473 |
sysconf(_SC_NPROCESSORS_ONLN) > 0;]])], |
| 474 |
[AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_ONLN)]) |
| 475 |
AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_ONLN, 1, |
| 476 |
[Define if sysconf returns number of online cpus])], |
| 477 |
[AC_MSG_RESULT([not available])]) |
| 478 |
AC_MSG_CHECKING([for number of available cpus]) |
| 479 |
AC_COMPILE_IFELSE( |
| 480 |
[AC_LANG_PROGRAM([[#include <unistd.h>]],[[ |
| 481 |
sysconf(_SC_NPROCESSORS_CONF) > 0;]])], |
| 482 |
[AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]) |
| 483 |
AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF, 1, |
| 484 |
[Define if sysconf returns number of available cpus])], |
| 485 |
[AC_MSG_RESULT([not available])] |
| 486 |
)]) |
| 487 |
|
| 488 |
dnl Checks for the function getloadavg |
| 489 |
have_func_getloadavg=false |
| 490 |
AC_CHECK_FUNC([getloadavg], [have_func_getloadavg=true]) |
| 491 |
AM_CONDITIONAL([HAVE_GETLOADAVG], [test x$have_func_getloadavg = xtrue]) |
| 492 |
|
| 493 |
dnl Checks for struct sockaddr_in6 |
| 494 |
AC_CHECK_TYPES([struct sockaddr_in6], |
| 495 |
[AC_DEFINE(HAVE_AFINET6, 1, |
| 496 |
[Define to 1 if struct sockaddr_in6 is available])], |
| 497 |
[working_ipv6=no], |
| 498 |
[#include <sys/types.h> |
| 499 |
#include <netinet/in.h>]) |
| 500 |
|
| 501 |
dnl Check for some Linux types |
| 502 |
AC_TYPE_SIZE_T |
| 503 |
# 'AC_TYPE_SSIZE_T' unfortunately requires autoconf 2.60+ |
| 504 |
#AC_TYPE_SSIZE_T |
| 505 |
# Define to `int' if <sys/types.h> does not define |
| 506 |
AC_CHECK_TYPES([ssize_t]) |
| 507 |
AC_TYPE_UID_T |
| 508 |
AC_TYPE_UINT64_T |
| 509 |
|
| 510 |
dnl Checks for programs |
| 511 |
LT_INIT |
| 512 |
|
| 513 |
dnl Check the support for soft links |
| 514 |
AC_PROG_LN_S |
| 515 |
|
| 516 |
dnl Set the default --prefix |
| 517 |
AC_PREFIX_DEFAULT(/usr/local/nagios) |
| 518 |
|
| 519 |
dnl Checks whether the compiler supports the |
| 520 |
dnl __attribute__((__alloc_size__ args)) feature |
| 521 |
ac_save_CFLAGS="$CFLAGS" |
| 522 |
CFLAGS="$CFLAGS -Werror" |
| 523 |
AC_CACHE_CHECK( |
| 524 |
[whether compiler supports __attribute__((__alloc_size__ args))], |
| 525 |
[cc_cv_attribute_alloc_size], |
| 526 |
[AC_COMPILE_IFELSE( |
| 527 |
[AC_LANG_PROGRAM([[]],[[ |
| 528 |
void *fooalloc(int n, int s) __attribute__((__alloc_size__(1, 2)));]])], |
| 529 |
[cc_cv_attribute_alloc_size=yes], |
| 530 |
[cc_cv_attribute_alloc_size=no]) |
| 531 |
]) |
| 532 |
CFLAGS="$ac_save_CFLAGS" |
| 533 |
if test "x$cc_cv_attribute_alloc_size" = "xyes"; then |
| 534 |
ac_cc_attribute_alloc_size='__attribute__((__alloc_size__ args))' |
| 535 |
fi |
| 536 |
AC_DEFINE_UNQUOTED( |
| 537 |
[_attribute_alloc_size_(args)], [$ac_cc_attribute_alloc_size], |
| 538 |
[Define this if the compiler supports the alloc_size attribute]) |
| 539 |
|
| 540 |
AC_SUBST([CFLAGS], ["$SUPPORTED_CFLAGS $CFLAGS"]) |
| 541 |
AC_SUBST([LDFLAGS], ["$SUPPORTED_LDFLAGS $LDFLAGS"]) |
| 542 |
AC_SUBST([LIBTOOL_DEPS]) |
| 543 |
|
| 544 |
AC_CONFIG_FILES([\ |
| 545 |
Makefile \ |
| 546 |
debian/Makefile \ |
| 547 |
include/Makefile \ |
| 548 |
lib/Makefile \ |
| 549 |
packages/Makefile \ |
| 550 |
packages/specs/Makefile \ |
| 551 |
plugins/Makefile \ |
| 552 |
tests/Makefile]) |
| 553 |
|
| 554 |
AC_OUTPUT |
| 555 |
|
| 556 |
echo |
| 557 |
echo "Options used to compile and link:" |
| 558 |
echo " debug enabled = $enable_debug" |
| 559 |
echo " hardening enabled = $use_hardening" |
| 560 |
echo " werror enabled = $enable_werror" |
| 561 |
echo " with docker socket = $DOCKER_SOCKET" |
| 562 |
echo " with libprocps = $enable_libprocps" |
| 563 |
echo " with podman socket = $PODMAN_SOCKET" |
| 564 |
echo " with socketfile = $MULTIPATHD_SOCKET" |
| 565 |
echo " with test suite = $with_test_suite" |
| 566 |
echo |
| 567 |
echo " target os = $target_os" |
| 568 |
echo " build os = $build_os" |
| 569 |
echo |
| 570 |
echo " CC = $CC" |
| 571 |
echo " CFLAGS = $CFLAGS" |
| 572 |
echo " LDFLAGS = $LDFLAGS" |
| 573 |
echo |
| 574 |
|
| 575 |
if test "$have_libprocps" = "yes"; then |
| 576 |
echo "Optional procps-ng library support is enabled:" |
| 577 |
echo " LIBPROCPS_CFLAGS = $LIBPROCPS_CFLAGS" |
| 578 |
echo " LIBPROCPS_LIBS = $LIBPROCPS_LIBS" |
| 579 |
echo |
| 580 |
fi |
| 581 |
|
| 582 |
if test "$libcurl_cv_lib_curl_usable" = "yes"; then |
| 583 |
echo "Optional curl library support is enabled (required by check_container):" |
| 584 |
echo " LIBCURL_CPPFLAGS = $LIBCURL_CPPFLAGS" |
| 585 |
echo " LIBCURL = $LIBCURL" |
| 586 |
echo |
| 587 |
fi |
| 588 |
|
| 589 |
if test "$have_systemd" = "yes"; then |
| 590 |
echo "Optional systemd library support is enabled:" |
| 591 |
echo " SYSTEMD_CFLAGS = $SYSTEMD_CFLAGS" |
| 592 |
echo " SYSTEMD_LIBS = $SYSTEMD_LIBS" |
| 593 |
fi |