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])
12 # Checks for programs.
19 # Checks for header files.
21 AC_CHECK_HEADERS([stdbool.h])
23 # Checks for typedefs, structures, and compiler characteristics.
27 # Checks for library functions.
30 AC_CHECK_FUNCS([gettimeofday memmove socket strdup strtol])
32 AM_GNU_GETTEXT_VERSION([0.16])
33 AM_GNU_GETTEXT([external])
36 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
39 ############### common
42 AC_CHECK_LIB(pthread, pthread_create)
44 AC_SUBST(PTHREAD_LIBS)
46 # Checks sensors, required by psensor and psensor-server
47 AC_CHECK_LIB(sensors, sensors_init)
48 AC_CHECK_HEADERS([sensors/sensors.h sensors/errors.h])
49 SENSORS_LIBS=-lsensors
50 AC_SUBST(SENSORS_LIBS)
52 ############### psensor
56 PKG_CHECK_MODULES(X11, x11,,[AC_MSG_WARN("x11 missing psensor will not be built")])
57 AM_CONDITIONAL(X11, test -n "$X11_LIBS")
61 PKG_CHECK_MODULES(XEXT, xext,,[AC_MSG_WARN("xext missing psensor will not be built")])
62 AM_CONDITIONAL(XEXT, test -n "$XEXT_LIBS")
67 PKG_CHECK_MODULES(GTK, gtk+-3.0,,[AC_MSG_WARN("gtk missing psensor will not be built")])
68 AM_CONDITIONAL(GTK, test -n "$GTK_LIBS")
69 # ensure that only allowed headers are included
70 GTK_CFLAGS+=" -DGTK_DISABLE_SINGLE_INCLUDES "
71 # ensure that no gtk deprecated symbols are used
72 GTK_CFLAGS+=" -DGDK_DISABLE_DEPRECATED "
73 GTK_CFLAGS+=" -DGTK_DISABLE_DEPRECATED "
74 # ensure use of accessors
75 GTK_CFLAGS+=" -DGSEAL_ENABLE "
80 PKG_CHECK_MODULES(GCONF, gconf-2.0,
81 [AC_DEFINE([HAVE_GCONF2],[1],[Use gconf2])],
82 [AC_MSG_WARN("gconf2 missing psensor will not be built")])
83 AM_CONDITIONAL(GCONF, test -n "$GCONF_LIBS")
84 AC_SUBST(GCONF_CFLAGS)
90 PKG_CHECK_MODULES(ATASMART, libatasmart,
91 [AC_DEFINE([HAVE_ATASMART],[1],[Use libatasmart])],
92 [AC_MSG_WARN("Library atasmart not present")])
94 AM_CONDITIONAL(ATASMART, test -n "$ATASMART_LIBS")
95 AC_SUBST(ATASMART_CFLAGS)
96 AC_SUBST(ATASMART_LIBS)
100 PKG_CHECK_MODULES(LIBNOTIFY,
102 [AC_DEFINE([HAVE_LIBNOTIFY],[1],[Use desktop notification])],
103 [AC_MSG_WARN("Desktop notification disabled")])
104 AM_CONDITIONAL(LIBNOTIFY, test -n "$LIBNOTIFY_LIBS")
105 AC_SUBST(LIBNOTIFY_CFLAGS)
106 AC_SUBST(LIBNOTIFY_LIBS)
108 # Checks AppIndicator
111 PKG_CHECK_MODULES(APPINDICATOR, appindicator3-0.1,
112 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator3-0.1])],
113 [AC_MSG_WARN(AppIndicator 3-0.1 not present")])
115 if test "$APPINDICATOR_LIBS" == ""; then
116 PKG_CHECK_MODULES(APPINDICATOR,
117 appindicator-0.1 <= 0.2.9 ,
118 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator 0.2.9])
119 AC_DEFINE([HAVE_APPINDICATOR_029],[1],[Use AppIndicator 0.2.9])
121 [AC_MSG_WARN(AppIndicator 0.2.9 not present")])
124 if test "$APPINDICATOR_LIBS" == ""; then
125 PKG_CHECK_MODULES(APPINDICATOR,
126 appindicator-0.1 > 0.2.9,
127 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator > 0.2.9])],
128 [AC_MSG_WARN("AppIndicator > 0.2.9 not present")])
130 AM_CONDITIONAL(APPINDICATOR, test -n "$APPINDICATOR_LIBS")
131 AC_SUBST(APPINDICATOR_CFLAGS)
132 AC_SUBST(APPINDICATOR_LIBS)
134 # Check CURL, needed for remote monitoring
136 PKG_CHECK_MODULES(CURL,
138 [AC_DEFINE([HAVE_CURL],[1],[Use CURL])],
139 [AC_MSG_WARN("Remote monitoring disabled, curl missing")])
140 AM_CONDITIONAL(CURL, test -n "$CURL_LIBS")
141 AC_SUBST(CURL_CFLAGS)
144 # Check JSON, needed for remote monitoring
146 PKG_CHECK_MODULES(JSON,
148 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])],
149 [AC_MSG_WARN("json-c missing")])
151 if test "$JSON_LIBS" == ""; then
152 PKG_CHECK_MODULES(JSON,
154 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])
155 AC_DEFINE([HAVE_JSON_0],[1],[Use JSON0])],
156 [AC_MSG_WARN("json0 missing")])
159 AM_CONDITIONAL(JSON, test -n "$JSON_LIBS")
160 AC_SUBST(JSON_CFLAGS)
163 # Enables remote monitoring if JSON and CURL is present
164 if test -n "$JSON_LIBS"; then
165 if test -n "$CURL_LIBS"; then
166 AC_DEFINE([HAVE_REMOTE_SUPPORT],[1],[Remote monitoring enabled])
171 # following code from sensors-applet
172 # sensors-applet.sourceforge.net/
173 AC_CHECK_HEADERS(NVCtrl/NVCtrl.h NVCtrl/NVCtrlLib.h,
174 [ HAVE_NVIDIA=true ], [],
176 #include <X11/Xlib.h>
178 if test -n "${X11_LIBS}"; then
179 LIBS="${LIBS} -lX11 -lXext"
181 if test "${HAVE_NVIDIA}" = "true"; then
182 AC_CHECK_LIB(XNVCtrl,XNVCTRLQueryExtension,
183 [NVIDIA_LIBS="-lXNVCtrl -lX11 -lXext"
184 AC_DEFINE(HAVE_NVIDIA,1,[NVidia support enabled])
188 AM_CONDITIONAL(NVIDIA, test -n "$NVIDIA_LIBS")
189 AC_SUBST(NVIDIA_CFLAGS)
190 AC_SUBST(NVIDIA_LIBS)
193 PKG_CHECK_MODULES(UNITY,
195 [AC_DEFINE([HAVE_UNITY],[1],[Use Unity])],
196 [AC_MSG_WARN(Unity not present)])
197 AC_SUBST(UNITY_CFLAGS)
199 AM_CONDITIONAL(UNITY, test -n "$UNITY_LIBS")
202 AC_ARG_WITH(libatiadl,
203 [ --with-libatiadl[=DIR] use libatiadlxx in DIR],[
204 ATIADL_DIR=${withval}
205 CPPFLAGS="${CPPFLAGS} -I${ATIADL_DIR}/include"
206 LIBS="$LIBS -L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst"
210 AC_CHECK_HEADERS(adl_defines.h,
211 AC_CHECK_LIB(atiadlxx,ADL_Main_Control_Refresh,
213 AC_DEFINE(HAVE_LIBATIADL,1,[libatiadl is available])
214 LIBATIADL_CFLAGS="-I${ATIADL_DIR}/include"
215 LIBATIADL_LIBS="-L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst -latiadlxx -ldl"
218 AM_CONDITIONAL(LIBATIADL, test -n "$LIBATIADL_LIBS")
219 AC_SUBST(LIBATIADL_CFLAGS)
220 AC_SUBST(LIBATIADL_LIBS)
222 ############### psensor-server
224 # libmicrohttpd, mandatory for psensor-server
226 PKG_CHECK_MODULES(LIBMICROHTTPD,
228 [AC_DEFINE([HAVE_LIBMICROHTTPD],[1],[Use libmicrohttpd])],
229 [AC_MSG_WARN("libmicrohttpd not present, psensor-server will NOT be built")])
230 AM_CONDITIONAL(LIBMICROHTTPD, test -n "$LIBMICROHTTPD_LIBS")
231 AC_SUBST(LIBMICROHTTPD_CFLAGS)
232 AC_SUBST(LIBMICROHTTPD_LIBS)
237 [ --with-gtop[=yes|no] use gtop],[
238 with_gtop=$withval],[
243 if test "$with_gtop" = "yes"; then
244 PKG_CHECK_MODULES(GTOP,
246 [AC_DEFINE([HAVE_GTOP],[1],[Use GTOP])],
247 [AC_MSG_WARN("gtop not present, CPU/Memory information will NOT be available")])
249 AM_CONDITIONAL(GTOP, test -n "$GTOP_LIBS")
250 AC_SUBST(GTOP_CFLAGS)
260 icons/hicolor/scalable/Makefile
261 icons/hicolor/14x14/Makefile
262 icons/hicolor/16x16/Makefile
263 icons/hicolor/22x22/Makefile
264 icons/hicolor/24x24/Makefile
265 icons/hicolor/32x32/Makefile
266 icons/hicolor/48x48/Makefile
267 icons/hicolor/64x64/Makefile
268 icons/ubuntu-mono-dark/status/22/Makefile
269 icons/ubuntu-mono-light/status/22/Makefile
270 icons/ubuntu-mono-dark/apps/22/Makefile
276 AC_CHECK_PROGS([HELP2MAN], [help2man])
278 AC_CHECK_PROG(HAVE_CPPCHECK, cppcheck, yes)
279 AM_CONDITIONAL(CPPCHECK, test -n "$HAVE_CPPCHECK")