2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([psensor], [0.8.0.x],[jeanfi@gmail.com],[psensor],[http://wpitchoune.net/psensor])
7 AM_INIT_AUTOMAKE([-Wall -Werror gnu])
9 AC_CONFIG_SRCDIR([src/ui.c])
10 AC_CONFIG_HEADERS([config.h])
13 AC_CONFIG_MACRO_DIR([m4])
15 # Checks for programs.
23 # Checks for header files.
25 AC_CHECK_HEADERS([stdbool.h])
27 # Checks for typedefs, structures, and compiler characteristics.
31 # Checks for library functions.
34 AC_CHECK_FUNCS([gettimeofday memmove socket strdup strtol])
36 AM_GNU_GETTEXT_VERSION([0.16])
37 AM_GNU_GETTEXT([external])
40 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
43 ############### common
46 AC_CHECK_LIB(pthread, pthread_create)
48 AC_SUBST(PTHREAD_LIBS)
50 # Checks sensors, required by psensor and psensor-server
51 AC_CHECK_LIB(sensors, sensors_init)
52 AC_CHECK_HEADERS([sensors/sensors.h sensors/errors.h])
53 SENSORS_LIBS=-lsensors
54 AC_SUBST(SENSORS_LIBS)
56 ############### psensor
60 PKG_CHECK_MODULES(X11, x11,,[AC_MSG_WARN("x11 missing psensor will not be built")])
61 AM_CONDITIONAL(X11, test -n "$X11_LIBS")
65 PKG_CHECK_MODULES(XEXT, xext,,[AC_MSG_WARN("xext missing psensor will not be built")])
66 AM_CONDITIONAL(XEXT, test -n "$XEXT_LIBS")
71 PKG_CHECK_MODULES(GTK, gtk+-3.0,,[AC_MSG_WARN("gtk missing psensor will not be built")])
72 AM_CONDITIONAL(GTK, test -n "$GTK_LIBS")
73 # ensure that only allowed headers are included
74 GTK_CFLAGS+=" -DGTK_DISABLE_SINGLE_INCLUDES "
75 # ensure that no gtk deprecated symbols are used
76 GTK_CFLAGS+=" -DGDK_DISABLE_DEPRECATED "
77 GTK_CFLAGS+=" -DGTK_DISABLE_DEPRECATED "
78 # ensure use of accessors
79 GTK_CFLAGS+=" -DGSEAL_ENABLE "
84 PKG_CHECK_MODULES(GCONF, gconf-2.0,
85 [AC_DEFINE([HAVE_GCONF2],[1],[Use gconf2])],
86 [AC_MSG_WARN("gconf2 missing psensor will not be built")])
87 AM_CONDITIONAL(GCONF, test -n "$GCONF_LIBS")
88 AC_SUBST(GCONF_CFLAGS)
94 PKG_CHECK_MODULES(ATASMART, libatasmart,
95 [AC_DEFINE([HAVE_ATASMART],[1],[Use libatasmart])],
96 [AC_MSG_WARN("Library atasmart not present")])
98 AM_CONDITIONAL(ATASMART, test -n "$ATASMART_LIBS")
99 AC_SUBST(ATASMART_CFLAGS)
100 AC_SUBST(ATASMART_LIBS)
104 PKG_CHECK_MODULES(LIBNOTIFY,
106 [AC_DEFINE([HAVE_LIBNOTIFY],[1],[Use desktop notification])],
107 [AC_MSG_WARN("Desktop notification disabled")])
108 AM_CONDITIONAL(LIBNOTIFY, test -n "$LIBNOTIFY_LIBS")
109 AC_SUBST(LIBNOTIFY_CFLAGS)
110 AC_SUBST(LIBNOTIFY_LIBS)
112 # Checks AppIndicator
115 PKG_CHECK_MODULES(APPINDICATOR, appindicator3-0.1,
116 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator3-0.1])],
117 [AC_MSG_WARN(AppIndicator 3-0.1 not present")])
119 if test "$APPINDICATOR_LIBS" == ""; then
120 PKG_CHECK_MODULES(APPINDICATOR,
121 appindicator-0.1 <= 0.2.9 ,
122 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator 0.2.9])
123 AC_DEFINE([HAVE_APPINDICATOR_029],[1],[Use AppIndicator 0.2.9])
125 [AC_MSG_WARN(AppIndicator 0.2.9 not present")])
128 if test "$APPINDICATOR_LIBS" == ""; then
129 PKG_CHECK_MODULES(APPINDICATOR,
130 appindicator-0.1 > 0.2.9,
131 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator > 0.2.9])],
132 [AC_MSG_WARN("AppIndicator > 0.2.9 not present")])
134 AM_CONDITIONAL(APPINDICATOR, test -n "$APPINDICATOR_LIBS")
135 AC_SUBST(APPINDICATOR_CFLAGS)
136 AC_SUBST(APPINDICATOR_LIBS)
138 # Check CURL, needed for remote monitoring
140 PKG_CHECK_MODULES(CURL,
142 [AC_DEFINE([HAVE_CURL],[1],[Use CURL])],
143 [AC_MSG_WARN("Remote monitoring disabled, curl missing")])
144 AM_CONDITIONAL(CURL, test -n "$CURL_LIBS")
145 AC_SUBST(CURL_CFLAGS)
148 # Check JSON, needed for remote monitoring
150 PKG_CHECK_MODULES(JSON,
152 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])],
153 [AC_MSG_WARN("json-c missing")])
155 if test "$JSON_LIBS" == ""; then
156 PKG_CHECK_MODULES(JSON,
158 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])
159 AC_DEFINE([HAVE_JSON_0],[1],[Use JSON0])],
160 [AC_MSG_WARN("json0 missing")])
163 AM_CONDITIONAL(JSON, test -n "$JSON_LIBS")
164 AC_SUBST(JSON_CFLAGS)
167 # Enables remote monitoring if JSON and CURL is present
168 if test -n "$JSON_LIBS"; then
169 if test -n "$CURL_LIBS"; then
170 AC_DEFINE([HAVE_REMOTE_SUPPORT],[1],[Remote monitoring enabled])
175 # following code from sensors-applet
176 # sensors-applet.sourceforge.net/
177 AC_CHECK_HEADERS(NVCtrl/NVCtrl.h NVCtrl/NVCtrlLib.h,
178 [ HAVE_NVIDIA=true ], [],
180 #include <X11/Xlib.h>
182 if test -n "${X11_LIBS}"; then
183 LIBS="${LIBS} -lX11 -lXext"
185 if test "${HAVE_NVIDIA}" = "true"; then
186 AC_CHECK_LIB(XNVCtrl,XNVCTRLQueryExtension,
187 [NVIDIA_LIBS="-lXNVCtrl -lX11 -lXext"
188 AC_DEFINE(HAVE_NVIDIA,1,[NVidia support enabled])
192 AM_CONDITIONAL(NVIDIA, test -n "$NVIDIA_LIBS")
193 AC_SUBST(NVIDIA_CFLAGS)
194 AC_SUBST(NVIDIA_LIBS)
197 PKG_CHECK_MODULES(UNITY,
199 [AC_DEFINE([HAVE_UNITY],[1],[Use Unity])],
200 [AC_MSG_WARN(Unity not present)])
201 AC_SUBST(UNITY_CFLAGS)
203 AM_CONDITIONAL(UNITY, test -n "$UNITY_LIBS")
206 AC_ARG_WITH(libatiadl,
207 [ --with-libatiadl[=DIR] use libatiadlxx in DIR],[
208 ATIADL_DIR=${withval}
209 CPPFLAGS="${CPPFLAGS} -I${ATIADL_DIR}/include"
210 LIBS="$LIBS -L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst"
214 AC_CHECK_HEADERS(adl_defines.h,
215 AC_CHECK_LIB(atiadlxx,ADL_Main_Control_Refresh,
217 AC_DEFINE(HAVE_LIBATIADL,1,[libatiadl is available])
218 LIBATIADL_CFLAGS="-I${ATIADL_DIR}/include"
219 LIBATIADL_LIBS="-L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst -latiadlxx -ldl"
222 AM_CONDITIONAL(LIBATIADL, test -n "$LIBATIADL_LIBS")
223 AC_SUBST(LIBATIADL_CFLAGS)
224 AC_SUBST(LIBATIADL_LIBS)
226 ############### psensor-server
228 # libmicrohttpd, mandatory for psensor-server
230 PKG_CHECK_MODULES(LIBMICROHTTPD,
232 [AC_DEFINE([HAVE_LIBMICROHTTPD],[1],[Use libmicrohttpd])],
233 [AC_MSG_WARN("libmicrohttpd not present, psensor-server will NOT be built")])
234 AM_CONDITIONAL(LIBMICROHTTPD, test -n "$LIBMICROHTTPD_LIBS")
235 AC_SUBST(LIBMICROHTTPD_CFLAGS)
236 AC_SUBST(LIBMICROHTTPD_LIBS)
241 [ --with-gtop[=yes|no] use gtop],[
242 with_gtop=$withval],[
247 if test "$with_gtop" = "yes"; then
248 PKG_CHECK_MODULES(GTOP,
250 [AC_DEFINE([HAVE_GTOP],[1],[Use GTOP])],
251 [AC_MSG_WARN("gtop not present, CPU/Memory information will NOT be available")])
253 AM_CONDITIONAL(GTOP, test -n "$GTOP_LIBS")
254 AC_SUBST(GTOP_CFLAGS)
264 icons/hicolor/scalable/Makefile
265 icons/hicolor/14x14/Makefile
266 icons/hicolor/16x16/Makefile
267 icons/hicolor/22x22/Makefile
268 icons/hicolor/24x24/Makefile
269 icons/hicolor/32x32/Makefile
270 icons/hicolor/48x48/Makefile
271 icons/hicolor/64x64/Makefile
272 icons/ubuntu-mono-dark/status/22/Makefile
273 icons/ubuntu-mono-light/status/22/Makefile
274 icons/ubuntu-mono-dark/apps/22/Makefile
280 AC_CHECK_PROGS([HELP2MAN], [help2man])
282 AC_CHECK_PROG(HAVE_CPPCHECK, cppcheck, yes)
283 AM_CONDITIONAL(CPPCHECK, test -n "$HAVE_CPPCHECK")