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.
22 # Checks for header files.
24 AC_CHECK_HEADERS([stdbool.h])
26 # Checks for typedefs, structures, and compiler characteristics.
30 # Checks for library functions.
33 AC_CHECK_FUNCS([gettimeofday memmove socket strdup strtol])
35 AM_GNU_GETTEXT_VERSION([0.16])
36 AM_GNU_GETTEXT([external])
39 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
42 ############### common
45 AC_CHECK_LIB(pthread, pthread_create)
47 AC_SUBST(PTHREAD_LIBS)
49 # Checks sensors, required by psensor and psensor-server
50 AC_CHECK_LIB(sensors, sensors_init)
51 AC_CHECK_HEADERS([sensors/sensors.h sensors/errors.h])
52 SENSORS_LIBS=-lsensors
53 AC_SUBST(SENSORS_LIBS)
55 ############### psensor
59 PKG_CHECK_MODULES(X11, x11,,[AC_MSG_WARN("x11 missing psensor will not be built")])
60 AM_CONDITIONAL(X11, test -n "$X11_LIBS")
64 PKG_CHECK_MODULES(XEXT, xext,,[AC_MSG_WARN("xext missing psensor will not be built")])
65 AM_CONDITIONAL(XEXT, test -n "$XEXT_LIBS")
70 PKG_CHECK_MODULES(GTK, gtk+-3.0,,[AC_MSG_WARN("gtk missing psensor will not be built")])
71 AM_CONDITIONAL(GTK, test -n "$GTK_LIBS")
72 # ensure that only allowed headers are included
73 GTK_CFLAGS+=" -DGTK_DISABLE_SINGLE_INCLUDES "
74 # ensure that no gtk deprecated symbols are used
75 GTK_CFLAGS+=" -DGDK_DISABLE_DEPRECATED "
76 GTK_CFLAGS+=" -DGTK_DISABLE_DEPRECATED "
77 # ensure use of accessors
78 GTK_CFLAGS+=" -DGSEAL_ENABLE "
83 PKG_CHECK_MODULES(GCONF, gconf-2.0,
84 [AC_DEFINE([HAVE_GCONF2],[1],[Use gconf2])],
85 [AC_MSG_WARN("gconf2 missing psensor will not be built")])
86 AM_CONDITIONAL(GCONF, test -n "$GCONF_LIBS")
87 AC_SUBST(GCONF_CFLAGS)
93 PKG_CHECK_MODULES(ATASMART, libatasmart,
94 [AC_DEFINE([HAVE_ATASMART],[1],[Use libatasmart])],
95 [AC_MSG_WARN("Library atasmart not present")])
97 AM_CONDITIONAL(ATASMART, test -n "$ATASMART_LIBS")
98 AC_SUBST(ATASMART_CFLAGS)
99 AC_SUBST(ATASMART_LIBS)
103 PKG_CHECK_MODULES(LIBNOTIFY,
105 [AC_DEFINE([HAVE_LIBNOTIFY],[1],[Use desktop notification])],
106 [AC_MSG_WARN("Desktop notification disabled")])
107 AM_CONDITIONAL(LIBNOTIFY, test -n "$LIBNOTIFY_LIBS")
108 AC_SUBST(LIBNOTIFY_CFLAGS)
109 AC_SUBST(LIBNOTIFY_LIBS)
111 # Checks AppIndicator
114 PKG_CHECK_MODULES(APPINDICATOR, appindicator3-0.1,
115 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator3-0.1])],
116 [AC_MSG_WARN(AppIndicator 3-0.1 not present")])
118 if test "$APPINDICATOR_LIBS" == ""; then
119 PKG_CHECK_MODULES(APPINDICATOR,
120 appindicator-0.1 <= 0.2.9 ,
121 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator 0.2.9])
122 AC_DEFINE([HAVE_APPINDICATOR_029],[1],[Use AppIndicator 0.2.9])
124 [AC_MSG_WARN(AppIndicator 0.2.9 not present")])
127 if test "$APPINDICATOR_LIBS" == ""; then
128 PKG_CHECK_MODULES(APPINDICATOR,
129 appindicator-0.1 > 0.2.9,
130 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator > 0.2.9])],
131 [AC_MSG_WARN("AppIndicator > 0.2.9 not present")])
133 AM_CONDITIONAL(APPINDICATOR, test -n "$APPINDICATOR_LIBS")
134 AC_SUBST(APPINDICATOR_CFLAGS)
135 AC_SUBST(APPINDICATOR_LIBS)
137 # Check CURL, needed for remote monitoring
139 PKG_CHECK_MODULES(CURL,
141 [AC_DEFINE([HAVE_CURL],[1],[Use CURL])],
142 [AC_MSG_WARN("Remote monitoring disabled, curl missing")])
143 AM_CONDITIONAL(CURL, test -n "$CURL_LIBS")
144 AC_SUBST(CURL_CFLAGS)
147 # Check JSON, needed for remote monitoring
149 PKG_CHECK_MODULES(JSON,
151 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])],
152 [AC_MSG_WARN("json-c missing")])
154 if test "$JSON_LIBS" == ""; then
155 PKG_CHECK_MODULES(JSON,
157 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])
158 AC_DEFINE([HAVE_JSON_0],[1],[Use JSON0])],
159 [AC_MSG_WARN("json0 missing")])
162 AM_CONDITIONAL(JSON, test -n "$JSON_LIBS")
163 AC_SUBST(JSON_CFLAGS)
166 # Enables remote monitoring if JSON and CURL is present
167 if test -n "$JSON_LIBS"; then
168 if test -n "$CURL_LIBS"; then
169 AC_DEFINE([HAVE_REMOTE_SUPPORT],[1],[Remote monitoring enabled])
174 # following code from sensors-applet
175 # sensors-applet.sourceforge.net/
176 AC_CHECK_HEADERS(NVCtrl/NVCtrl.h NVCtrl/NVCtrlLib.h,
177 [ HAVE_NVIDIA=true ], [],
179 #include <X11/Xlib.h>
181 if test -n "${X11_LIBS}"; then
182 LIBS="${LIBS} -lX11 -lXext"
184 if test "${HAVE_NVIDIA}" = "true"; then
185 AC_CHECK_LIB(XNVCtrl,XNVCTRLQueryExtension,
186 [NVIDIA_LIBS="-lXNVCtrl -lX11 -lXext"
187 AC_DEFINE(HAVE_NVIDIA,1,[NVidia support enabled])
191 AM_CONDITIONAL(NVIDIA, test -n "$NVIDIA_LIBS")
192 AC_SUBST(NVIDIA_CFLAGS)
193 AC_SUBST(NVIDIA_LIBS)
196 PKG_CHECK_MODULES(UNITY,
198 [AC_DEFINE([HAVE_UNITY],[1],[Use Unity])],
199 [AC_MSG_WARN(Unity not present)])
200 AC_SUBST(UNITY_CFLAGS)
202 AM_CONDITIONAL(UNITY, test -n "$UNITY_LIBS")
205 AC_ARG_WITH(libatiadl,
206 [ --with-libatiadl[=DIR] use libatiadlxx in DIR],[
207 ATIADL_DIR=${withval}
208 CPPFLAGS="${CPPFLAGS} -I${ATIADL_DIR}/include"
209 LIBS="$LIBS -L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst"
213 AC_CHECK_HEADERS(adl_defines.h,
214 AC_CHECK_LIB(atiadlxx,ADL_Main_Control_Refresh,
216 AC_DEFINE(HAVE_LIBATIADL,1,[libatiadl is available])
217 LIBATIADL_CFLAGS="-I${ATIADL_DIR}/include"
218 LIBATIADL_LIBS="-L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst -latiadlxx -ldl"
221 AM_CONDITIONAL(LIBATIADL, test -n "$LIBATIADL_LIBS")
222 AC_SUBST(LIBATIADL_CFLAGS)
223 AC_SUBST(LIBATIADL_LIBS)
225 ############### psensor-server
227 # libmicrohttpd, mandatory for psensor-server
229 PKG_CHECK_MODULES(LIBMICROHTTPD,
231 [AC_DEFINE([HAVE_LIBMICROHTTPD],[1],[Use libmicrohttpd])],
232 [AC_MSG_WARN("libmicrohttpd not present, psensor-server will NOT be built")])
233 AM_CONDITIONAL(LIBMICROHTTPD, test -n "$LIBMICROHTTPD_LIBS")
234 AC_SUBST(LIBMICROHTTPD_CFLAGS)
235 AC_SUBST(LIBMICROHTTPD_LIBS)
240 [ --with-gtop[=yes|no] use gtop],[
241 with_gtop=$withval],[
246 if test "$with_gtop" = "yes"; then
247 PKG_CHECK_MODULES(GTOP,
249 [AC_DEFINE([HAVE_GTOP],[1],[Use GTOP])],
250 [AC_MSG_WARN("gtop not present, CPU/Memory information will NOT be available")])
252 AM_CONDITIONAL(GTOP, test -n "$GTOP_LIBS")
253 AC_SUBST(GTOP_CFLAGS)
263 icons/hicolor/scalable/Makefile
264 icons/hicolor/14x14/Makefile
265 icons/hicolor/16x16/Makefile
266 icons/hicolor/22x22/Makefile
267 icons/hicolor/24x24/Makefile
268 icons/hicolor/32x32/Makefile
269 icons/hicolor/48x48/Makefile
270 icons/hicolor/64x64/Makefile
271 icons/ubuntu-mono-dark/status/22/Makefile
272 icons/ubuntu-mono-light/status/22/Makefile
273 icons/ubuntu-mono-dark/apps/22/Makefile
279 AC_CHECK_PROGS([HELP2MAN], [help2man])
281 AC_CHECK_PROG(HAVE_CPPCHECK, cppcheck, yes)
282 AM_CONDITIONAL(CPPCHECK, test -n "$HAVE_CPPCHECK")