2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([psensor], [1.1.0.x],[jeanfi@gmail.com],[psensor],[http://wpitchoune.net/psensor])
7 AM_INIT_AUTOMAKE([-Wall gnu])
9 AC_CONFIG_SRCDIR([src/ui.c])
10 AC_CONFIG_HEADERS([config.h])
13 AC_CONFIG_MACRO_DIR([m4])
15 # Checks for programs.
25 # Checks for header files.
27 AC_CHECK_HEADERS([stdbool.h])
29 AM_GNU_GETTEXT_VERSION([0.16])
30 AM_GNU_GETTEXT([external])
35 ############### common
38 AC_CHECK_LIB(pthread, pthread_create)
40 AC_SUBST(PTHREAD_LIBS)
42 # Checks sensors, required by psensor and psensor-server
43 AC_CHECK_LIB(sensors, sensors_init)
44 AC_CHECK_HEADERS([sensors/sensors.h sensors/error.h])
45 SENSORS_LIBS=-lsensors
46 AC_SUBST(SENSORS_LIBS)
48 ############### psensor
52 PKG_CHECK_MODULES(X11, x11,,[AC_MSG_WARN("x11 missing psensor will not be built")])
53 AM_CONDITIONAL(X11, test -n "$X11_LIBS")
57 PKG_CHECK_MODULES(XEXT, xext,,[AC_MSG_WARN("xext missing psensor will not be built")])
58 AM_CONDITIONAL(XEXT, test -n "$XEXT_LIBS")
63 PKG_CHECK_MODULES(GTK,
65 [AC_MSG_WARN("gtk missing psensor will not be built")])
66 AM_CONDITIONAL(GTK, test -n "$GTK_LIBS")
67 # ensure that only allowed headers are included
68 GTK_CFLAGS+=" -DGTK_DISABLE_SINGLE_INCLUDES "
69 # ensure that no gtk deprecated symbols are used
70 GTK_CFLAGS+=" -DGDK_DISABLE_DEPRECATED "
71 GTK_CFLAGS+=" -DGTK_DISABLE_DEPRECATED "
72 # ensure use of accessors
73 GTK_CFLAGS+=" -DGSEAL_ENABLE "
78 PKG_CHECK_MODULES(LIBUDISKS2,
80 [AC_DEFINE([HAVE_LIBUDISKS2],[1],[Use libudisks])],
81 [AC_MSG_WARN("Library udisks2 not present")])
82 AM_CONDITIONAL(LIBUDISKS2, test -n "$LIBUDISKS2_LIBS")
83 AC_SUBST(LIBUDISKS2_CFLAGS)
84 AC_SUBST(LIBUDISKS2_LIBS)
87 PKG_CHECK_MODULES(ATASMART, libatasmart,
88 [AC_DEFINE([HAVE_ATASMART],[1],[Use libatasmart])],
89 [AC_MSG_WARN("Library atasmart not present")])
91 AM_CONDITIONAL(ATASMART, test -n "$ATASMART_LIBS")
92 AC_SUBST(ATASMART_CFLAGS)
93 AC_SUBST(ATASMART_LIBS)
97 PKG_CHECK_MODULES(LIBNOTIFY,
99 [AC_DEFINE([HAVE_LIBNOTIFY],[1],[Use desktop notification])],
100 [AC_MSG_WARN("Desktop notification disabled")])
101 AM_CONDITIONAL(LIBNOTIFY, test -n "$LIBNOTIFY_LIBS")
102 AC_SUBST(LIBNOTIFY_CFLAGS)
103 AC_SUBST(LIBNOTIFY_LIBS)
105 # Checks AppIndicator
107 PKG_CHECK_MODULES(APPINDICATOR, appindicator3-0.1,
108 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator3-0.1])],
109 [AC_MSG_WARN(AppIndicator 3-0.1 not present")])
110 AM_CONDITIONAL(APPINDICATOR, test -n "$APPINDICATOR_LIBS")
111 AC_SUBST(APPINDICATOR_CFLAGS)
112 AC_SUBST(APPINDICATOR_LIBS)
114 # Check CURL, needed for remote monitoring
116 PKG_CHECK_MODULES(CURL,
118 [AC_DEFINE([HAVE_CURL],[1],[Use CURL])],
119 [AC_MSG_WARN("Remote monitoring disabled, curl missing")])
120 AM_CONDITIONAL(CURL, test -n "$CURL_LIBS")
121 AC_SUBST(CURL_CFLAGS)
124 # Check JSON, needed for remote monitoring
126 PKG_CHECK_MODULES(JSON,
128 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])],
129 [AC_MSG_WARN("json-c missing")])
131 if test "$JSON_LIBS" == ""; then
132 PKG_CHECK_MODULES(JSON,
134 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])
135 AC_DEFINE([HAVE_JSON_0],[1],[Use JSON0])],
136 [AC_MSG_WARN("json0 missing")])
139 AM_CONDITIONAL(JSON, test -n "$JSON_LIBS")
140 AC_SUBST(JSON_CFLAGS)
143 # Enables remote monitoring if JSON and CURL is present
144 if test -n "$JSON_LIBS"; then
145 if test -n "$CURL_LIBS"; then
146 AC_DEFINE([HAVE_REMOTE_SUPPORT],[1],[Remote monitoring enabled])
151 # following code from sensors-applet
152 # sensors-applet.sourceforge.net/
153 AC_CHECK_HEADERS(NVCtrl/NVCtrl.h NVCtrl/NVCtrlLib.h,
154 [ HAVE_NVIDIA=true ], [],
156 #include <X11/Xlib.h>
158 if test -n "${X11_LIBS}"; then
159 LIBS="${LIBS} -lX11 -lXext"
161 if test "${HAVE_NVIDIA}" = "true"; then
162 AC_CHECK_LIB(XNVCtrl,XNVCTRLQueryExtension,
163 [NVIDIA_LIBS="-lXNVCtrl -lX11 -lXext"
164 AC_DEFINE(HAVE_NVIDIA,1,[NVidia support enabled])
168 AM_CONDITIONAL(NVIDIA, test -n "$NVIDIA_LIBS")
169 AC_SUBST(NVIDIA_CFLAGS)
170 AC_SUBST(NVIDIA_LIBS)
173 PKG_CHECK_MODULES(UNITY,
175 [AC_DEFINE([HAVE_UNITY],[1],[Use Unity])],
176 [AC_MSG_WARN(Unity not present)])
177 AC_SUBST(UNITY_CFLAGS)
179 AM_CONDITIONAL(UNITY, test -n "$UNITY_LIBS")
182 AC_ARG_WITH(libatiadl,
183 [ --with-libatiadl[=DIR] use libatiadlxx in DIR],[
184 ATIADL_DIR=${withval}
185 CPPFLAGS="${CPPFLAGS} -I${ATIADL_DIR}/include"
186 LIBS="$LIBS -L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst"
190 AC_CHECK_HEADERS(adl_defines.h,
191 AC_CHECK_LIB(atiadlxx,ADL_Main_Control_Refresh,
193 AC_DEFINE(HAVE_LIBATIADL,1,[libatiadl is available])
194 LIBATIADL_CFLAGS="-I${ATIADL_DIR}/include"
195 LIBATIADL_LIBS="-L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst -latiadlxx -ldl"
198 AM_CONDITIONAL(LIBATIADL, test -n "$LIBATIADL_LIBS")
199 AC_SUBST(LIBATIADL_CFLAGS)
200 AC_SUBST(LIBATIADL_LIBS)
202 ############### psensor-server
204 # Check libmicrohttpd, mandatory for psensor-server
206 PKG_CHECK_MODULES(LIBMICROHTTPD,
208 [AC_DEFINE([HAVE_LIBMICROHTTPD],[1],[Use libmicrohttpd])],
209 [AC_MSG_WARN("libmicrohttpd not present, psensor-server will NOT be built")])
210 AM_CONDITIONAL(LIBMICROHTTPD, test -n "$LIBMICROHTTPD_LIBS")
211 AC_SUBST(LIBMICROHTTPD_CFLAGS)
212 AC_SUBST(LIBMICROHTTPD_LIBS)
214 # Check gtop2, optional
216 [ --with-gtop[=yes|no] use gtop],[
217 with_gtop=$withval],[
222 if test "$with_gtop" = "yes"; then
223 PKG_CHECK_MODULES(GTOP,
225 [AC_DEFINE([HAVE_GTOP],[1],[Use GTOP])],
226 [AC_MSG_WARN("gtop not present, CPU/Memory information will NOT be available")])
228 AM_CONDITIONAL(GTOP, test -n "$GTOP_LIBS")
229 AC_SUBST(GTOP_CFLAGS)
239 icons/hicolor/scalable/Makefile
240 icons/hicolor/14x14/Makefile
241 icons/hicolor/16x16/Makefile
242 icons/hicolor/22x22/Makefile
243 icons/hicolor/24x24/Makefile
244 icons/hicolor/32x32/Makefile
245 icons/hicolor/48x48/Makefile
246 icons/hicolor/64x64/Makefile
247 icons/ubuntu-mono-dark/status/22/Makefile
248 icons/ubuntu-mono-light/status/22/Makefile
249 icons/ubuntu-mono-dark/apps/22/Makefile
255 AC_CHECK_PROGS([HELP2MAN], [help2man])
257 AC_CHECK_PROG([ASCIIDOC], [asciidoc], yes)
258 AM_CONDITIONAL(ASCIIDOC, test -n "$ASCIIDOC")
260 AC_CHECK_PROG(HAVE_CPPCHECK, cppcheck, yes)
261 AM_CONDITIONAL(CPPCHECK, test -n "$HAVE_CPPCHECK")