2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([psensor], [0.0.x],[jeanfi@gmail.com],[psensor],[http://wpitchoune.net/gtask])
7 AM_INIT_AUTOMAKE([-Wall -Werror gnu])
9 AC_CONFIG_SRCDIR([src/main.c])
11 # Checks for programs.
18 # Checks for header files.
20 AC_CHECK_HEADERS([stdbool.h])
22 # Checks for typedefs, structures, and compiler characteristics.
26 # Checks for library functions.
29 AC_CHECK_FUNCS([gettimeofday memmove socket strdup strtol])
31 AM_GNU_GETTEXT_VERSION([0.16])
32 AM_GNU_GETTEXT([external])
35 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
37 if test x"$GCONFTOOL" = xno; then
38 AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
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)
64 PKG_CHECK_MODULES(XEXT, xext)
69 PKG_CHECK_MODULES(GTK, gtk+-3.0)
70 # ensure that only allowed headers are included
71 GTK_CFLAGS+=" -DGTK_DISABLE_SINGLE_INCLUDES "
72 # ensure that no gtk deprecated symbols are used
73 GTK_CFLAGS+=" -DGDK_DISABLE_DEPRECATED "
74 GTK_CFLAGS+=" -DGTK_DISABLE_DEPRECATED "
75 # ensure use of accessors
76 GTK_CFLAGS+=" -DGSEAL_ENABLE "
81 PKG_CHECK_MODULES(GCONF, gconf-2.0)
82 AC_SUBST(GCONF_CFLAGS)
88 PKG_CHECK_MODULES(ATASMART, libatasmart,
89 [AC_DEFINE([HAVE_ATASMART],[1],[Use libatasmart])],
90 [AC_MSG_WARN("Library atasmart not present")])
92 AM_CONDITIONAL(ATASMART, test -n "$ATASMART_LIBS")
93 AC_SUBST(ATASMART_CFLAGS)
94 AC_SUBST(ATASMART_LIBS)
98 PKG_CHECK_MODULES(LIBNOTIFY,
100 [AC_DEFINE([HAVE_LIBNOTIFY],[1],[Use desktop notification])],
101 [AC_MSG_WARN("Desktop notification disabled")])
102 AM_CONDITIONAL(LIBNOTIFY, test -n "$LIBNOTIFY_LIBS")
103 AC_SUBST(LIBNOTIFY_CFLAGS)
104 AC_SUBST(LIBNOTIFY_LIBS)
106 # Checks AppIndicator
109 PKG_CHECK_MODULES(APPINDICATOR, appindicator3-0.1,
110 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator3-0.1])],
111 [AC_MSG_WARN(AppIndicator 3-0.1 not present")])
113 if test "$APPINDICATOR_LIBS" == ""; then
114 PKG_CHECK_MODULES(APPINDICATOR,
115 appindicator-0.1 <= 0.2.9 ,
116 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator 0.2.9])
117 AC_DEFINE([HAVE_APPINDICATOR_029],[1],[Use AppIndicator 0.2.9])
119 [AC_MSG_WARN(AppIndicator 0.2.9 not present")])
122 if test "$APPINDICATOR_LIBS" == ""; then
123 PKG_CHECK_MODULES(APPINDICATOR,
124 appindicator-0.1 > 0.2.9,
125 [AC_DEFINE([HAVE_APPINDICATOR],[1],[Use AppIndicator > 0.2.9])],
126 [AC_MSG_WARN("AppIndicator > 0.2.9 not present")])
128 AM_CONDITIONAL(APPINDICATOR, test -n "$APPINDICATOR_LIBS")
129 AC_SUBST(APPINDICATOR_CFLAGS)
130 AC_SUBST(APPINDICATOR_LIBS)
132 # Check CURL, needed for remote monitoring
134 PKG_CHECK_MODULES(CURL,
136 [AC_DEFINE([HAVE_CURL],[1],[Use CURL])],
137 [AC_MSG_WARN("Remote monitoring disabled, curl missing")])
138 AM_CONDITIONAL(CURL, test -n "$CURL_LIBS")
139 AC_SUBST(CURL_CFLAGS)
142 # Check JSON, needed for remote monitoring
144 PKG_CHECK_MODULES(JSON,
146 [AC_DEFINE([HAVE_JSON],[1],[Use JSON])],
147 [AC_MSG_WARN("Remote monitoring disabled, json missing")])
148 AM_CONDITIONAL(JSON, test -n "$JSON_LIBS")
149 AC_SUBST(JSON_CFLAGS)
152 # Enables remote monitoring if JSON and CURL is present
153 if test -n "$JSON_LIBS"; then
154 if test -n "$CURL_LIBS"; then
155 AC_DEFINE([HAVE_REMOTE_SUPPORT],[1],[Remote monitoring enabled])
160 # following code from sensors-applet
161 # sensors-applet.sourceforge.net/
162 AC_CHECK_HEADERS(NVCtrl/NVCtrl.h NVCtrl/NVCtrlLib.h,
163 [ HAVE_NVIDIA=true ], [],
165 #include <X11/Xlib.h>
167 if test -n "${X11_LIBS}"; then
168 LIBS="${LIBS} -lX11 -lXext"
170 if test "${HAVE_NVIDIA}" = "true"; then
171 AC_CHECK_LIB(XNVCtrl,XNVCTRLQueryExtension,
172 [NVIDIA_LIBS="-lXNVCtrl -lX11 -lXext"
173 AC_DEFINE(HAVE_NVIDIA,1,[NVidia support enabled])
177 AM_CONDITIONAL(NVIDIA, test -n "$NVIDIA_LIBS")
178 AC_SUBST(NVIDIA_CFLAGS)
179 AC_SUBST(NVIDIA_LIBS)
182 PKG_CHECK_MODULES(UNITY,
184 [AC_DEFINE([HAVE_UNITY],[1],[Use Unity])],
185 [AC_MSG_WARN(Unity not present)])
186 AC_SUBST(UNITY_CFLAGS)
188 AM_CONDITIONAL(UNITY, test -n "$UNITY_LIBS")
191 AC_ARG_WITH(libatiadl,
192 [ --with-libatiadl[=DIR] use libatiadlxx in DIR],[
193 ATIADL_DIR=${withval}
194 CPPFLAGS="${CPPFLAGS} -I${ATIADL_DIR}/include"
195 LIBS="$LIBS -L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst"
199 AC_CHECK_HEADERS(adl_defines.h,
200 AC_CHECK_LIB(atiadlxx,ADL_Main_Control_Refresh,
202 AC_DEFINE(HAVE_LIBATIADL,1,[libatiadl is available])
203 LIBATIADL_CFLAGS="-I${ATIADL_DIR}/include"
204 LIBATIADL_LIBS="-L/usr/lib/fglrx -L/usr/lib64/fglrx -L/usr/lib/catalyst -L/usr/lib64/catalyst -latiadlxx -ldl"
207 AM_CONDITIONAL(LIBATIADL, test -n "$LIBATIADL_LIBS")
208 AC_SUBST(LIBATIADL_CFLAGS)
209 AC_SUBST(LIBATIADL_LIBS)
211 ############### psensor-server
213 # libmicrohttpd, mandatory for psensor-server
215 PKG_CHECK_MODULES(LIBMICROHTTPD,
217 [AC_DEFINE([HAVE_LIBMICROHTTPD],[1],[Use libmicrohttpd])],
218 [AC_MSG_WARN("libmicrohttpd not present, psensor-server will NOT be built")])
219 AM_CONDITIONAL(LIBMICROHTTPD, test -n "$LIBMICROHTTPD_LIBS")
220 AC_SUBST(LIBMICROHTTPD_CFLAGS)
221 AC_SUBST(LIBMICROHTTPD_LIBS)
226 [ --with-gtop[=yes|no] use gtop],[
227 with_gtop=$withval],[
232 if test "$with_gtop" = "yes"; then
233 PKG_CHECK_MODULES(GTOP,
235 [AC_DEFINE([HAVE_GTOP],[1],[Use GTOP])],
236 [AC_MSG_WARN("gtop not present, CPU/Memory information will NOT be available")])
238 AM_CONDITIONAL(GTOP, test -n "$GTOP_LIBS")
239 AC_SUBST(GTOP_CFLAGS)
248 AC_CHECK_PROGS([HELP2MAN], [help2man])
250 AC_CHECK_PROG(HAVE_CPPCHECK, cppcheck, yes)
251 AM_CONDITIONAL(CPPCHECK, test -n "$HAVE_CPPCHECK")