forked from netdata/netdata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
170 lines (152 loc) · 4.63 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
#
# Copyright (C) 2015 Alon Bar-Lev <[email protected]>
#
AC_PREREQ(2.60)
define([VERSION_MAJOR], [1])
define([VERSION_MINOR], [0])
define([VERSION_FIX], [1])
define([VERSION_NUMBER], VERSION_MAJOR[.]VERSION_MINOR[.]VERSION_FIX)
define([VERSION_SUFFIX], [_master])
dnl Set to "1" for a first RPM release of a new version
PACKAGE_RPM_RELEASE="0.0.$(echo VERSION_SUFFIX | sed 's/^_//')"
AC_INIT([netdata], VERSION_NUMBER[]VERSION_SUFFIX)
AM_MAINTAINER_MODE([disable])
if test x"$USE_MAINTAINER_MODE" = xyes; then
AC_MSG_NOTICE(***************** MAINTAINER MODE *****************)
PACKAGE_BUILT_DATE=$(date '+%d %b %Y')
fi
PACKAGE_RPM_VERSION="VERSION_NUMBER"
AC_SUBST([PACKAGE_RPM_VERSION])
AC_SUBST([PACKAGE_RPM_RELEASE])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/main.c])
AM_INIT_AUTOMAKE
AC_CANONICAL_HOST
AC_PROG_CC
AC_PROG_INSTALL
PKG_PROG_PKG_CONFIG
AC_USE_SYSTEM_EXTENSIONS
AC_ARG_ENABLE(
[plugin-nfacct],
[AS_HELP_STRING([--enable-plugin-nfacct], [enable nfacct plugin, requires root])],
,
[enable_plugin_nfacct="no"]
)
AC_ARG_ENABLE(
[pedantic],
[AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings])],
,
[enable_pedantic="no"]
)
AC_ARG_WITH(
[webdir],
[AS_HELP_STRING([--with-webdir], [location of webdir @<:@PKGDATADIR/web@:>@])],
[webdir="${withval}"],
[webdir="\$(pkgdatadir)/web"]
)
AC_ARG_WITH(
[zlib],
[AS_HELP_STRING([--with-zlib], [build with zlib])],
,
[with_zlib="yes"]
)
AC_ARG_WITH(
[math],
[AS_HELP_STRING([--with-math], [build with math])],
,
[with_math="yes"]
)
AC_ARG_WITH(
[user],
[AS_HELP_STRING([--with-user], [use this user to drop privilege])],
,
[with_user="nobody"]
)
ACX_PTHREAD(, [AC_MSG_ERROR([Cannot initialize pthread environment])])
LIBS="${PTHREAD_LIBS} ${LIBS}"
CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
CC="${PTHREAD_CC}"
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_C_INLINE
AC_ARG_VAR([MATH_CFLAGS], [C compiler flags for math])
AC_ARG_VAR([MATH_LIBS], [linker flags for math])
if test -z "${MATH_LIBS}"; then
AC_CHECK_LIB(
[m],
[sin],
[MATH_LIBS="-lm"]
)
fi
if test "${enable_plugin_nfacct}" = "yes"; then
PKG_CHECK_MODULES(
[NFACCT],
[libnetfilter_acct],
)
PKG_CHECK_MODULES(
[LIBMNL],
[libmnl],
)
test -z "${NFACCT_LIBS}" && AC_MSG_ERROR([netfilter_acct required but not found])
test -z "${LIBMNL_LIBS}" && AC_MSG_ERROR([libmnl required but not found])
AC_DEFINE([INTERNAL_PLUGIN_NFACCT], [1], [nfacct plugin settings])
OPTIONAL_NFACCT_CLFAGS="${NFACCT_CFLAGS} ${LIBMNL_CFLAGS}"
OPTIONAL_NFACCT_LIBS="${NFACCT_LIBS} ${LIBMNL_LIBS}"
fi
if test "${with_zlib}" = "yes"; then
PKG_CHECK_MODULES(
[ZLIB],
[zlib],
)
test -z "${ZLIB_LIBS}" && AC_MSG_ERROR([zlib required but not found])
AC_DEFINE([NETDATA_WITH_ZLIB], [1], [zlib settings])
OPTIONAL_ZLIB_CLFAGS="${ZLIB_CFLAGS}"
OPTIONAL_ZLIB_LIBS="${ZLIB_LIBS}"
fi
if test "${with_math}" = "yes"; then
test -z "${MATH_LIBS}" && AC_MSG_ERROR([math required but not found])
AC_DEFINE([STORAGE_WITH_MATH], [1], [math settings])
OPTIONAL_MATH_CFLAGS="${MATH_CFLAGS}"
OPTIONAL_MATH_LIBS="${MATH_LIBS}"
fi
if test "${GCC}" = "yes"; then
AC_DEFINE_UNQUOTED([likely(x)], [__builtin_expect(!!(x), 1)], [gcc branch optimization])
AC_DEFINE_UNQUOTED([unlikely(x)], [__builtin_expect(!!(x), 0)], [gcc branch optimization])
else
AC_DEFINE_UNQUOTED([likely(x)], [(x)], [gcc branch optimization])
AC_DEFINE_UNQUOTED([unlikely(x)], [(x)], [gcc branch optimization])
fi
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes"
CFLAGS="${CFLAGS} -pedantic -Wall -Wextra -Wno-long-long"
fi
AC_DEFINE_UNQUOTED([NETDATA_USER], ["${with_user}"], [use this user to drop privileged])
AC_SUBST([cachedir], ["\$(localstatedir)/cache/netdata"])
AC_SUBST([chartsdir], ["\$(libexecdir)/netdata/charts.d"])
AC_SUBST([nodedir], ["\$(libexecdir)/netdata/node.d"])
AC_SUBST([configdir], ["\$(sysconfdir)/netdata"])
AC_SUBST([logdir], ["\$(localstatedir)/log/netdata"])
AC_SUBST([pluginsdir], ["\$(libexecdir)/netdata/plugins.d"])
AC_SUBST([webdir])
AC_SUBST([OPTIONAL_MATH_CLFAGS])
AC_SUBST([OPTIONAL_MATH_LIBS])
AC_SUBST([OPTIONAL_NFACCT_CLFAGS])
AC_SUBST([OPTIONAL_NFACCT_LIBS])
AC_SUBST([OPTIONAL_ZLIB_CLFAGS])
AC_SUBST([OPTIONAL_ZLIB_LIBS])
AC_CONFIG_FILES([
Makefile
charts.d/Makefile
node.d/Makefile
conf.d/Makefile
netdata.spec
plugins.d/Makefile
src/Makefile
web/Makefile
])
AC_OUTPUT
test "${with_math}" != "yes" && AC_MSG_WARN([You are building without math. math allows accurate calculations. It should be enabled.]) || :
test "${with_zlib}" != "yes" && AC_MSG_WARN([You are building without zlib. zlib allows netdata to trasnfer a lot less data with web clients. It should be enabled.]) || :