Rename cpu plugin to 'processor'
[collecty.git] / configure.ac
1 ###############################################################################
2 #                                                                             #
3 # collecty - The IPFire statictics collection daemon                          #
4 # Copyright (C) 2015 collecty development team                                #
5 #                                                                             #
6 # This program is free software: you can redistribute it and/or modify        #
7 # it under the terms of the GNU General Public License as published by        #
8 # the Free Software Foundation, either version 3 of the License, or           #
9 # (at your option) any later version.                                         #
10 #                                                                             #
11 # This program is distributed in the hope that it will be useful,             #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of              #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
14 # GNU General Public License for more details.                                #
15 #                                                                             #
16 # You should have received a copy of the GNU General Public License           #
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
18 #                                                                             #
19 ###############################################################################
20
21 AC_PREREQ([2.64])
22
23 AC_INIT([collecty],
24         [003],
25         [info@ipfire.org],
26         [collecty],
27         [http://git.ipfire.org/?p=oddments/collecty.git;a=summary])
28
29 AC_CONFIG_MACRO_DIR([m4])
30 AC_CONFIG_AUX_DIR([build-aux])
31
32 AC_PREFIX_DEFAULT([/usr])
33
34 AM_INIT_AUTOMAKE([
35         foreign
36         1.11
37         -Wall
38         -Wno-portability
39         silent-rules
40         tar-pax
41         subdir-objects
42 ])
43 AM_SILENT_RULES([yes])
44 LT_PREREQ(2.2)
45 LT_INIT([disable-static])
46
47 IT_PROG_INTLTOOL([0.40.0])
48
49 GETTEXT_PACKAGE=collecty
50 AC_SUBST(GETTEXT_PACKAGE)
51
52 AC_PROG_LN_S
53 AC_PROG_MKDIR_P
54 AC_PROG_SED
55
56 # C Compiler
57 AC_PROG_CC
58 AC_PROG_CC_C99
59 AC_PROG_CC_C_O
60 AC_PROG_GCC_TRADITIONAL
61
62 AC_PATH_PROG([XSLTPROC], [xsltproc])
63
64 PKG_CHECK_MODULES([OPING], [liboping])
65
66 # Python
67 AM_PATH_PYTHON([3.2])
68 PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}])
69
70 # libatasmart
71 PKG_CHECK_MODULES([LIBATASMART], [libatasmart >= 0.19])
72
73 save_LIBS="$LIBS"
74
75 # lm-sensors
76 AC_CHECK_HEADERS([sensors/sensors.h sensors/errors.h])
77
78 LIBS=
79 AC_CHECK_LIB(sensors, sensors_init, [], [AC_MSG_ERROR([*** sensors library not found])])
80 SENSORS_LIBS="$LIBS"
81 AC_SUBST(SENSORS_LIBS)
82
83 LIBS="$save_LIBS"
84
85 # pkg-config
86 PKG_PROG_PKG_CONFIG
87 # This makes sure pkg.m4 is available.
88 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
89
90 # ------------------------------------------------------------------------------
91 have_manpages=no
92 AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-man-pages],
93         [do not install man pages]))
94 AS_IF([test "x$enable_manpages" != xno], [have_manpages=yes])
95 AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"])
96
97 # ------------------------------------------------------------------------------
98
99 AC_ARG_WITH([systemd],
100         AS_HELP_STRING([--with-systemd], [Enable systemd support.])
101 )
102
103 AC_ARG_WITH([dbuspolicydir],
104         AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
105         [],
106         [with_dbuspolicydir=${sysconfdir}/dbus-1/system.d]
107 )
108
109 AC_ARG_WITH([dbussystemservicedir],
110         AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
111         [],
112         [with_dbussystemservicedir=${datadir}/dbus-1/system-services]
113 )
114
115 AS_IF([test "x$with_systemd" != "xno"],
116       [PKG_CHECK_MODULES(systemd, [libsystemd],
117       [have_systemd=yes], [have_systemd=no])],
118       [have_systemd=no]
119 )
120
121 AS_IF([test "x$have_systemd" = "xyes"],
122       [AC_MSG_CHECKING([for systemd system unit directory])
123         AC_ARG_WITH([systemdsystemunitdir],
124                 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
125                 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]
126         )
127
128         AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
129
130         if test -n "$systemdsystemunitdir" -a "x$systemdsystemunitdir" != xno; then
131                 AC_MSG_RESULT([$systemdsystemunitdir])
132         else
133                 AC_MSG_ERROR([not found (try --with-systemdsystemunitdir)])
134         fi
135       ],
136       [AS_IF([test "x$with_systemd" = "xyes"],
137              [AC_MSG_ERROR([Systemd support is enabled but no systemd has been found.])
138       ])
139 ])
140
141 AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$have_systemd" = "xyes"])
142
143 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
144 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
145
146 # ------------------------------------------------------------------------------
147
148 AC_CONFIG_FILES([
149         Makefile
150         po/Makefile.in
151         src/collecty/__version__.py
152 ])
153
154 AC_OUTPUT
155 AC_MSG_RESULT([
156         ${PACKAGE_NAME} ${VERSION}
157
158         prefix:                 ${prefix}
159         D-Bus policy dir:       ${with_dbuspolicydir}
160         D-Bus system dir:       ${with_dbussystemservicedir}
161
162         Systemd support         ${have_systemd}
163         Generate man-pages:     ${have_manpages}
164 ])