2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([psensor], [1.1.0],[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)
48 ############### common
51 AC_CHECK_LIB(pthread, pthread_create)
53 AC_SUBST(PTHREAD_LIBS)
55 # Checks sensors, required by psensor and psensor-server
56 AC_CHECK_LIB(sensors, sensors_init)
57 AC_CHECK_HEADERS([sensors/sensors.h sensors/errors.h])
58 SENSORS_LIBS=-lsensors
59 AC_SUBST(SENSORS_LIBS)
61 ############### psensor
65 PKG_CHECK_MODULES(X11, x11,,[AC_MSG_WARN("x11 missing psensor will not be built")])
66 AM_CONDITIONAL(X11, test -n "$X11_LIBS")
70 PKG_CHECK_MODULES(XEXT, xext,,[AC_MSG_WARN("xext missing psensor will not be built")])
71 AM_CONDITIONAL(XEXT, test -n "$XEXT_LIBS")
76 PKG_CHECK_MODULES(GTK, gtk+-3.0,,[AC_MSG_WARN("gtk missing psensor will not be built")])
77 AM_CONDITIONAL(GTK, test -n "$GTK_LIBS")
78 # ensure that only allowed headers are included
79 GTK_CFLAGS+=" -DGTK_DISABLE_SINGLE_INCLUDES "
80 # ensure that no gtk deprecated symbols are used
81 GTK_CFLAGS+=" -DGDK_DISABLE_DEPRECATED "
82 GTK_CFLAGS+=" -DGTK_DISABLE_DEPRECATED "
83 # ensure use of accessors
84 GTK_CFLAGS+=" -DGSEAL_ENABLE "
89 PKG_CHECK_MODULES(GCONF, gconf-2.0,
90 [AC_DEFINE([HAVE_GCONF2],[1],[Use gconf2])],
91 [AC_MSG_WARN("gconf2 missing psensor will not be built")])
92 AM_CONDITIONAL(GCONF, test -n "$GCONF_LIBS")
93 AC_SUBST(GCONF_CFLAGS)
99 PKG_CHECK_MODULES(ATASMART, libatasmart,
100 [AC_DEFINE([HAVE_ATASMART],[1],[Use libatasmart])],
101 [AC_MSG_WARN("Library atasmart not present")])
103 AM_CONDITIONAL(ATASMART, test -n "$ATASMART_LIBS")
104 AC_SUBST(ATASMART_CFLAGS)
105 AC_SUBST(ATASMART_LIBS)
109 PKG_CHECK_MODULES(LIBNOTIFY,
111 [AC_DEFINE([HAVE_LIBNOTIFY],[1],[Use desktop notification])],
112 [AC_MSG_WARN("Desktop notification disabled")])
113 AM_CONDITIONAL(LIBNOTIFY, test -n "$LIBNOTIFY_LIBS")
114 AC_SUBST(LIBNOTIFY_CFLAGS)
115 AC_SUBST(LIBNOTIFY_LIBS)
117 # Checks AppIndicator
120 PKG_CHECK_MODULES(APPINDICATOR, appindicator3-0.1,
121 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator3-0.1])],
122 [AC_MSG_WARN(AppIndicator 3-0.1 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_DEFINE([HAVE_APPINDICATOR_029],[1],[Use AppIndicator 0.2.9])
130 [AC_MSG_WARN(AppIndicator 0.2.9 not present")])
133 if test "$APPINDICATOR_LIBS" == ""; then
134 PKG_CHECK_MODULES(APPINDICATOR,
135 appindicator-0.1 > 0.2.9,
136 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator > 0.2.9])],
137 [AC_MSG_WARN("AppIndicator > 0.2.9 not present")])
139 AM_CONDITIONAL(APPINDICATOR, test -n "$APPINDICATOR_LIBS")
140 AC_SUBST(APPINDICATOR_CFLAGS)
141 AC_SUBST(APPINDICATOR_LIBS)
143 # Check CURL, needed for remote monitoring
145 PKG_CHECK_MODULES(CURL,
147 [AC_DEFINE([HAVE_CURL],[1],[Use CURL])],
148 [AC_MSG_WARN("Remote monitoring disabled, curl missing")])
149 AM_CONDITIONAL(CURL, test -n "$CURL_LIBS")
150 AC_SUBST(CURL_CFLAGS)
153 # Check JSON, needed for remote monitoring
155 PKG_CHECK_MODULES(JSON,
157 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])],
158 [AC_MSG_WARN("json-c missing")])
160 if test "$JSON_LIBS" == ""; then
161 PKG_CHECK_MODULES(JSON,
163 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])
164 AC_DEFINE([HAVE_JSON_0],[1],[Use JSON0])],
165 [AC_MSG_WARN("json0 missing")])
168 AM_CONDITIONAL(JSON, test -n "$JSON_LIBS")
169 AC_SUBST(JSON_CFLAGS)
172 # Enables remote monitoring if JSON and CURL is present
173 if test -n "$JSON_LIBS"; then
174 if test -n "$CURL_LIBS"; then
175 AC_DEFINE([HAVE_REMOTE_SUPPORT],[1],[Remote monitoring enabled])
180 # following code from sensors-applet
181 # sensors-applet.sourceforge.net/
182 AC_CHECK_HEADERS(NVCtrl/NVCtrl.h NVCtrl/NVCtrlLib.h,
183 [ HAVE_NVIDIA=true ], [],
185 #include <X11/Xlib.h>
187 if test -n "${X11_LIBS}"; then
188 LIBS="${LIBS} -lX11 -lXext"
190 if test "${HAVE_NVIDIA}" = "true"; then
191 AC_CHECK_LIB(XNVCtrl,XNVCTRLQueryExtension,
192 [NVIDIA_LIBS="-lXNVCtrl -lX11 -lXext"
193 AC_DEFINE(HAVE_NVIDIA,1,[NVidia support enabled])
197 AM_CONDITIONAL(NVIDIA, test -n "$NVIDIA_LIBS")
198 AC_SUBST(NVIDIA_CFLAGS)
199 AC_SUBST(NVIDIA_LIBS)
202 PKG_CHECK_MODULES(UNITY,
204 [AC_DEFINE([HAVE_UNITY],[1],[Use Unity])],
205 [AC_MSG_WARN(Unity not present)])
206 AC_SUBST(UNITY_CFLAGS)
208 AM_CONDITIONAL(UNITY, test -n "$UNITY_LIBS")
211 AC_ARG_WITH(libatiadl,
212 [ --with-libatiadl[=DIR] use libatiadlxx in DIR],[
213 ATIADL_DIR=${withval}
214 CPPFLAGS="${CPPFLAGS} -I${ATIADL_DIR}/include"
215 LIBS="$LIBS -L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst"
219 AC_CHECK_HEADERS(adl_defines.h,
220 AC_CHECK_LIB(atiadlxx,ADL_Main_Control_Refresh,
222 AC_DEFINE(HAVE_LIBATIADL,1,[libatiadl is available])
223 LIBATIADL_CFLAGS="-I${ATIADL_DIR}/include"
224 LIBATIADL_LIBS="-L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst -latiadlxx -ldl"
227 AM_CONDITIONAL(LIBATIADL, test -n "$LIBATIADL_LIBS")
228 AC_SUBST(LIBATIADL_CFLAGS)
229 AC_SUBST(LIBATIADL_LIBS)
231 ############### psensor-server
233 # libmicrohttpd, mandatory for psensor-server
235 PKG_CHECK_MODULES(LIBMICROHTTPD,
237 [AC_DEFINE([HAVE_LIBMICROHTTPD],[1],[Use libmicrohttpd])],
238 [AC_MSG_WARN("libmicrohttpd not present, psensor-server will NOT be built")])
239 AM_CONDITIONAL(LIBMICROHTTPD, test -n "$LIBMICROHTTPD_LIBS")
240 AC_SUBST(LIBMICROHTTPD_CFLAGS)
241 AC_SUBST(LIBMICROHTTPD_LIBS)
246 [ --with-gtop[=yes|no] use gtop],[
247 with_gtop=$withval],[
252 if test "$with_gtop" = "yes"; then
253 PKG_CHECK_MODULES(GTOP,
255 [AC_DEFINE([HAVE_GTOP],[1],[Use GTOP])],
256 [AC_MSG_WARN("gtop not present, CPU/Memory information will NOT be available")])
258 AM_CONDITIONAL(GTOP, test -n "$GTOP_LIBS")
259 AC_SUBST(GTOP_CFLAGS)
269 icons/hicolor/scalable/Makefile
270 icons/hicolor/14x14/Makefile
271 icons/hicolor/16x16/Makefile
272 icons/hicolor/22x22/Makefile
273 icons/hicolor/24x24/Makefile
274 icons/hicolor/32x32/Makefile
275 icons/hicolor/48x48/Makefile
276 icons/hicolor/64x64/Makefile
277 icons/ubuntu-mono-dark/status/22/Makefile
278 icons/ubuntu-mono-light/status/22/Makefile
279 icons/ubuntu-mono-dark/apps/22/Makefile
285 AC_CHECK_PROGS([HELP2MAN], [help2man])
287 AC_CHECK_PROG(HAVE_CPPCHECK, cppcheck, yes)
288 AM_CONDITIONAL(CPPCHECK, test -n "$HAVE_CPPCHECK")