2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([psensor], [1.0.3],[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 # Checks for typedefs, structures, and compiler characteristics.
33 # Checks for library functions.
36 AC_CHECK_FUNCS([gettimeofday memmove socket strdup strtol])
38 AM_GNU_GETTEXT_VERSION([0.16])
39 AM_GNU_GETTEXT([external])
42 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
45 ############### common
48 AC_CHECK_LIB(pthread, pthread_create)
50 AC_SUBST(PTHREAD_LIBS)
52 # Checks sensors, required by psensor and psensor-server
53 AC_CHECK_LIB(sensors, sensors_init)
54 AC_CHECK_HEADERS([sensors/sensors.h sensors/errors.h])
55 SENSORS_LIBS=-lsensors
56 AC_SUBST(SENSORS_LIBS)
58 ############### psensor
62 PKG_CHECK_MODULES(X11, x11,,[AC_MSG_WARN("x11 missing psensor will not be built")])
63 AM_CONDITIONAL(X11, test -n "$X11_LIBS")
67 PKG_CHECK_MODULES(XEXT, xext,,[AC_MSG_WARN("xext missing psensor will not be built")])
68 AM_CONDITIONAL(XEXT, test -n "$XEXT_LIBS")
73 PKG_CHECK_MODULES(GTK, gtk+-3.0,,[AC_MSG_WARN("gtk missing psensor will not be built")])
74 AM_CONDITIONAL(GTK, test -n "$GTK_LIBS")
75 # ensure that only allowed headers are included
76 GTK_CFLAGS+=" -DGTK_DISABLE_SINGLE_INCLUDES "
77 # ensure that no gtk deprecated symbols are used
78 GTK_CFLAGS+=" -DGDK_DISABLE_DEPRECATED "
79 GTK_CFLAGS+=" -DGTK_DISABLE_DEPRECATED "
80 # ensure use of accessors
81 GTK_CFLAGS+=" -DGSEAL_ENABLE "
86 PKG_CHECK_MODULES(GCONF, gconf-2.0,
87 [AC_DEFINE([HAVE_GCONF2],[1],[Use gconf2])],
88 [AC_MSG_WARN("gconf2 missing psensor will not be built")])
89 AM_CONDITIONAL(GCONF, test -n "$GCONF_LIBS")
90 AC_SUBST(GCONF_CFLAGS)
96 PKG_CHECK_MODULES(ATASMART, libatasmart,
97 [AC_DEFINE([HAVE_ATASMART],[1],[Use libatasmart])],
98 [AC_MSG_WARN("Library atasmart not present")])
100 AM_CONDITIONAL(ATASMART, test -n "$ATASMART_LIBS")
101 AC_SUBST(ATASMART_CFLAGS)
102 AC_SUBST(ATASMART_LIBS)
106 PKG_CHECK_MODULES(LIBNOTIFY,
108 [AC_DEFINE([HAVE_LIBNOTIFY],[1],[Use desktop notification])],
109 [AC_MSG_WARN("Desktop notification disabled")])
110 AM_CONDITIONAL(LIBNOTIFY, test -n "$LIBNOTIFY_LIBS")
111 AC_SUBST(LIBNOTIFY_CFLAGS)
112 AC_SUBST(LIBNOTIFY_LIBS)
114 # Checks AppIndicator
117 PKG_CHECK_MODULES(APPINDICATOR, appindicator3-0.1,
118 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator3-0.1])],
119 [AC_MSG_WARN(AppIndicator 3-0.1 not present")])
121 if test "$APPINDICATOR_LIBS" == ""; then
122 PKG_CHECK_MODULES(APPINDICATOR,
123 appindicator-0.1 <= 0.2.9 ,
124 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator 0.2.9])
125 AC_DEFINE([HAVE_APPINDICATOR_029],[1],[Use AppIndicator 0.2.9])
127 [AC_MSG_WARN(AppIndicator 0.2.9 not present")])
130 if test "$APPINDICATOR_LIBS" == ""; then
131 PKG_CHECK_MODULES(APPINDICATOR,
132 appindicator-0.1 > 0.2.9,
133 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator > 0.2.9])],
134 [AC_MSG_WARN("AppIndicator > 0.2.9 not present")])
136 AM_CONDITIONAL(APPINDICATOR, test -n "$APPINDICATOR_LIBS")
137 AC_SUBST(APPINDICATOR_CFLAGS)
138 AC_SUBST(APPINDICATOR_LIBS)
140 # Check CURL, needed for remote monitoring
142 PKG_CHECK_MODULES(CURL,
144 [AC_DEFINE([HAVE_CURL],[1],[Use CURL])],
145 [AC_MSG_WARN("Remote monitoring disabled, curl missing")])
146 AM_CONDITIONAL(CURL, test -n "$CURL_LIBS")
147 AC_SUBST(CURL_CFLAGS)
150 # Check JSON, needed for remote monitoring
152 PKG_CHECK_MODULES(JSON,
154 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])],
155 [AC_MSG_WARN("json-c missing")])
157 if test "$JSON_LIBS" == ""; then
158 PKG_CHECK_MODULES(JSON,
160 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])
161 AC_DEFINE([HAVE_JSON_0],[1],[Use JSON0])],
162 [AC_MSG_WARN("json0 missing")])
165 AM_CONDITIONAL(JSON, test -n "$JSON_LIBS")
166 AC_SUBST(JSON_CFLAGS)
169 # Enables remote monitoring if JSON and CURL is present
170 if test -n "$JSON_LIBS"; then
171 if test -n "$CURL_LIBS"; then
172 AC_DEFINE([HAVE_REMOTE_SUPPORT],[1],[Remote monitoring enabled])
177 # following code from sensors-applet
178 # sensors-applet.sourceforge.net/
179 AC_CHECK_HEADERS(NVCtrl/NVCtrl.h NVCtrl/NVCtrlLib.h,
180 [ HAVE_NVIDIA=true ], [],
182 #include <X11/Xlib.h>
184 if test -n "${X11_LIBS}"; then
185 LIBS="${LIBS} -lX11 -lXext"
187 if test "${HAVE_NVIDIA}" = "true"; then
188 AC_CHECK_LIB(XNVCtrl,XNVCTRLQueryExtension,
189 [NVIDIA_LIBS="-lXNVCtrl -lX11 -lXext"
190 AC_DEFINE(HAVE_NVIDIA,1,[NVidia support enabled])
194 AM_CONDITIONAL(NVIDIA, test -n "$NVIDIA_LIBS")
195 AC_SUBST(NVIDIA_CFLAGS)
196 AC_SUBST(NVIDIA_LIBS)
199 PKG_CHECK_MODULES(UNITY,
201 [AC_DEFINE([HAVE_UNITY],[1],[Use Unity])],
202 [AC_MSG_WARN(Unity not present)])
203 AC_SUBST(UNITY_CFLAGS)
205 AM_CONDITIONAL(UNITY, test -n "$UNITY_LIBS")
208 AC_ARG_WITH(libatiadl,
209 [ --with-libatiadl[=DIR] use libatiadlxx in DIR],[
210 ATIADL_DIR=${withval}
211 CPPFLAGS="${CPPFLAGS} -I${ATIADL_DIR}/include"
212 LIBS="$LIBS -L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst"
216 AC_CHECK_HEADERS(adl_defines.h,
217 AC_CHECK_LIB(atiadlxx,ADL_Main_Control_Refresh,
219 AC_DEFINE(HAVE_LIBATIADL,1,[libatiadl is available])
220 LIBATIADL_CFLAGS="-I${ATIADL_DIR}/include"
221 LIBATIADL_LIBS="-L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst -latiadlxx -ldl"
224 AM_CONDITIONAL(LIBATIADL, test -n "$LIBATIADL_LIBS")
225 AC_SUBST(LIBATIADL_CFLAGS)
226 AC_SUBST(LIBATIADL_LIBS)
228 ############### psensor-server
230 # libmicrohttpd, mandatory for psensor-server
232 PKG_CHECK_MODULES(LIBMICROHTTPD,
234 [AC_DEFINE([HAVE_LIBMICROHTTPD],[1],[Use libmicrohttpd])],
235 [AC_MSG_WARN("libmicrohttpd not present, psensor-server will NOT be built")])
236 AM_CONDITIONAL(LIBMICROHTTPD, test -n "$LIBMICROHTTPD_LIBS")
237 AC_SUBST(LIBMICROHTTPD_CFLAGS)
238 AC_SUBST(LIBMICROHTTPD_LIBS)
243 [ --with-gtop[=yes|no] use gtop],[
244 with_gtop=$withval],[
249 if test "$with_gtop" = "yes"; then
250 PKG_CHECK_MODULES(GTOP,
252 [AC_DEFINE([HAVE_GTOP],[1],[Use GTOP])],
253 [AC_MSG_WARN("gtop not present, CPU/Memory information will NOT be available")])
255 AM_CONDITIONAL(GTOP, test -n "$GTOP_LIBS")
256 AC_SUBST(GTOP_CFLAGS)
266 icons/hicolor/scalable/Makefile
267 icons/hicolor/14x14/Makefile
268 icons/hicolor/16x16/Makefile
269 icons/hicolor/22x22/Makefile
270 icons/hicolor/24x24/Makefile
271 icons/hicolor/32x32/Makefile
272 icons/hicolor/48x48/Makefile
273 icons/hicolor/64x64/Makefile
274 icons/ubuntu-mono-dark/status/22/Makefile
275 icons/ubuntu-mono-light/status/22/Makefile
276 icons/ubuntu-mono-dark/apps/22/Makefile
282 AC_CHECK_PROGS([HELP2MAN], [help2man])
284 AC_CHECK_PROG(HAVE_CPPCHECK, cppcheck, yes)
285 AM_CONDITIONAL(CPPCHECK, test -n "$HAVE_CPPCHECK")