#
# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later
#
AC_PREREQ(2.60)
# We do not use m4_esyscmd_s to support older autoconf.
define([VERSION_STRING], m4_esyscmd([git describe 2>/dev/null | tr -d '\n']))
define([VERSION_FROM_FILE], m4_esyscmd([cat packaging/version | tr -d '\n']))
m4_ifval(VERSION_STRING, [], [define([VERSION_STRING], VERSION_FROM_FILE)])
AC_INIT([netdata], VERSION_STRING[])
AM_MAINTAINER_MODE([disable])
if test x"$USE_MAINTAINER_MODE" = xyes; then
AC_MSG_NOTICE(***************** MAINTAINER MODE *****************)
fi
PACKAGE_RPM_VERSION="VERSION_STRING"
AC_SUBST([PACKAGE_RPM_VERSION])
# -----------------------------------------------------------------------------
# autoconf initialization
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([build/m4])
AC_CONFIG_SRCDIR([daemon/main.c])
define([AUTOMATE_INIT_OPTIONS], [tar-pax subdir-objects])
m4_ifdef([AM_SILENT_RULES], [
define([AUTOMATE_INIT_OPTIONS], [tar-pax silent-rules subdir-objects])
])
AM_INIT_AUTOMAKE(AUTOMATE_INIT_OPTIONS)
m4_ifdef([AM_SILENT_RULES], [
AM_SILENT_RULES([yes])
])
AC_CANONICAL_HOST
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_INSTALL
PKG_PROG_PKG_CONFIG
AC_USE_SYSTEM_EXTENSIONS
# -----------------------------------------------------------------------------
# configurable options
AC_ARG_ENABLE(
[plugin-nfacct],
[AS_HELP_STRING([--enable-plugin-nfacct], [enable nfacct plugin @<:@default autodetect@:>@])],
,
[enable_plugin_nfacct="detect"]
)
AC_ARG_ENABLE(
[plugin-freeipmi],
[AS_HELP_STRING([--enable-plugin-freeipmi], [enable freeipmi plugin @<:@default autodetect@:>@])],
,
[enable_plugin_freeipmi="detect"]
)
AC_ARG_ENABLE(
[plugin-cups],
[AS_HELP_STRING([--enable-plugin-cups], [enable cups plugin @<:@default autodetect@:>@])],
,
[enable_plugin_cups="detect"]
)
AC_ARG_ENABLE(
[plugin-xenstat],
[AS_HELP_STRING([--enable-plugin-xenstat], [enable xenstat plugin @<:@default autodetect@:>@])],
,
[enable_plugin_xenstat="detect"]
)
AC_ARG_ENABLE(
[backend-kinesis],
[AS_HELP_STRING([--enable-backend-kinesis], [enable kinesis backend @<:@default autodetect@:>@])],
,
[enable_backend_kinesis="detect"]
)
AC_ARG_ENABLE(
[backend-prometheus-remote-write],
[AS_HELP_STRING([--enable-backend-prometheus-remote-write], [enable prometheus remote write backend @<:@default autodetect@:>@])],
,
[enable_backend_prometheus_remote_write="detect"]
)
AC_ARG_ENABLE(
[backend-mongodb],
[AS_HELP_STRING([--enable-backend-mongodb], [enable mongodb backend @<:@default autodetect@:>@])],
,
[enable_backend_mongodb="detect"]
)
AC_ARG_ENABLE(
[pedantic],
[AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings @<:@default disabled@:>@])],
,
[enable_pedantic="no"]
)
AC_ARG_ENABLE(
[accept4],
[AS_HELP_STRING([--disable-accept4], [System does not have accept4 @<:@default autodetect@:>@])],
,
[enable_accept4="detect"]
)
AC_ARG_WITH(
[webdir],
[AS_HELP_STRING([--with-webdir], [location of webdir @<:@PKGDATADIR/web@:>@])],
[webdir="${withval}"],
[webdir="\$(pkgdatadir)/web"]
)
AC_ARG_WITH(
[libcap],
[AS_HELP_STRING([--with-libcap], [build with libcap @<:@default autodetect@:>@])],
,
[with_libcap="detect"]
)
AC_ARG_WITH(
[zlib],
[AS_HELP_STRING([--without-zlib], [build without zlib @<:@default enabled@:>@])],
,
[with_zlib="yes"]
)
AC_ARG_WITH(
[math],
[AS_HELP_STRING([--without-math], [build without math @<:@default enabled@:>@])],
,
[with_math="yes"]
)
AC_ARG_WITH(
[user],
[AS_HELP_STRING([--with-user], [use this user to drop privilege @<:@default nobody@:>@])],
,
[with_user="nobody"]
)
AC_ARG_ENABLE(
[x86-sse],
[AS_HELP_STRING([--disable-x86-sse], [SSE/SS2 optimizations on x86 @<:@default enabled@:>@])],
,
[enable_x86_sse="yes"]
)
AC_ARG_ENABLE(
[lto],
[AS_HELP_STRING([--disable-lto], [Link Time Optimizations @<:@default autodetect@:>@])],
,
[enable_lto="detect"]
)
AC_ARG_ENABLE(
[https],
[AS_HELP_STRING([--enable-https], [Enable SSL support @<:@default autodetect@:>@])],
,
[enable_https="detect"]
)
AC_ARG_ENABLE(
[dbengine],
[AS_HELP_STRING([--disable-dbengine], [disable netdata dbengine @<:@default autodetect@:>@])],
,
[enable_dbengine="detect"]
)
AC_ARG_ENABLE(
[jsonc],
[AS_HELP_STRING([--enable-jsonc], [Enable JSON-C support @<:@default autodetect@:>@])],
,
[enable_jsonc="detect"]
)
if test "${ACLK}" = "yes"; then
AC_ARG_ENABLE(
[aclk],
,
[aclk_required="${enableval}"],
[aclk_required="detect"]
)
fi
# -----------------------------------------------------------------------------
# netdata required checks
# fails on centos6
#AX_CHECK_ENABLE_DEBUG()
AX_GCC_FUNC_ATTRIBUTE([returns_nonnull])
AX_GCC_FUNC_ATTRIBUTE([malloc])
AX_GCC_FUNC_ATTRIBUTE([noreturn])
AX_GCC_FUNC_ATTRIBUTE([noinline])
AX_GCC_FUNC_ATTRIBUTE([format])
AX_GCC_FUNC_ATTRIBUTE([warn_unused_result])
AC_CHECK_TYPES([struct timespec, clockid_t], [], [], [[#include <time.h>]])
AC_SEARCH_LIBS([clock_gettime], [rt posix4])
AC_CHECK_FUNCS([clock_gettime])
AC_CHECK_FUNCS([sched_setscheduler sched_getscheduler sched_getparam sched_get_priority_min sched_get_priority_max getpriority setpriority nice])
AC_CHECK_FUNCS([recvmmsg])
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_IN