Add BMPx (http://beep-media-player.org/) support. Bugs and memleaks are here
[monky] / configure.in
1 AC_INIT([Conky],[1.3.5dev3.1],[brenden1@users.sourceforge.net])
2
3 AM_INIT_AUTOMAKE(conky, 1.3.5dev3.1)
4 AM_CONFIG_HEADER(src/config.h)
5 AC_PROG_LIBTOOL
6
7
8 AC_CONFIG_FILES(
9         Makefile
10         doc/Makefile
11         src/Makefile
12         )
13
14 uname=`uname`
15
16 case $uname in
17   Linux*)
18     WANT_SYSINFO=yes
19     ;;
20   FreeBSD*)
21     WANT_KVM=yes
22     WANT_DEVSTAT=yes
23     ;;
24 #  NetBSD*)
25 #    WANT_KVM=yes
26 #    WANT_OSSLIB=yes
27 #    ;;
28
29 # Solaris doesn't work at all right now
30 #  SunOS*)
31 #    WANT_KSTAT=yes
32 #    ;;
33
34   *)
35     echo "Your operating system $uname isn't supported"
36     echo "Feel free to help. :P"
37     exit 1
38     ;;
39 esac
40
41 AM_CONDITIONAL(BUILD_LINUX, test x$uname = xLinux)
42 AM_CONDITIONAL(BUILD_SOLARIS, test x$uname = xSunOS)
43 AM_CONDITIONAL(BUILD_FREEBSD, test x$uname = xFreeBSD)
44 AM_CONDITIONAL(BUILD_NETBSD, test x$uname = xNetBSD)
45
46 dnl
47 dnl XFT option
48 dnl
49
50 want_xft=yes
51 AC_ARG_ENABLE(xft,
52 [  --enable-xft            enable if you want to use Xft [[default=no]]],
53   [want_xft="$enableval"])
54
55 dnl
56 dnl OWN_WINDOW option
57 dnl
58
59 dah=yes
60 AC_ARG_ENABLE(own_window,
61 [  --enable-own-window     enable if you want support for creating own window [[default=yes]]],
62   [dah="$enableval"])
63
64 if test $dah != "no"; then
65   AC_DEFINE(OWN_WINDOW, 1, [Define if you want support for window creating])
66 fi
67
68 dnl
69 dnl PROC_UPTIME option
70 dnl
71
72 dah=yes
73 AC_ARG_ENABLE(proc_uptime,
74 [  --enable-proc-uptime    enable using /proc/uptime for uptime [[default=no]]],
75   [dah="$enableval"])
76
77 if test $dah = "yes"; then
78   AC_DEFINE(PROC_UPTIME, 1, [Define if you want to use /proc/uptime for uptime])
79 fi
80
81 dnl
82 dnl BMPx
83 dnl
84
85 want_bmpx=no
86 AC_ARG_ENABLE(bmpx,
87               [ --enable-bmpx           enable if you want BMPx support [[default=no]]],
88               [want_bmpx="$enableval"])
89
90 AM_CONDITIONAL(BUILD_BMPX, test x$want_bmpx = xyes)
91 if test x$want_bmpx = xyes; then
92         PKG_CHECK_MODULES([DBUS], [dbus-1 >= 0.35 dbus-glib-1 >= 0.35])
93         CFLAGS="$CFLAGS $DBUS_CFLAGS"
94         LIBS="$LIBS $DBUS_LIBS"
95         AC_DEFINE(BMPX, 1, [Define if you want BMPx support])
96 fi
97
98 dnl
99 dnl Seti@Home
100 dnl
101
102 want_seti=yes
103 AC_ARG_ENABLE(seti,
104 [  --enable-seti           enable if you want SETI at Home stats [[default=no]]],
105   [want_seti="$enableval"])
106
107 AM_CONDITIONAL(BUILD_SETI, test x$want_seti = xyes)
108 if test x$want_seti = xyes; then
109   AC_DEFINE(SETI, 1, [Define if you want SETI at Home stats])
110 fi
111
112 dnl
113 dnl MPD
114 dnl
115
116 want_mpd=yes
117 AC_ARG_ENABLE(mpd,
118 [  --enable-mpd            enable if you want MPD support [[default=no]]],
119   [want_mpd="$enableval"])
120
121 AM_CONDITIONAL(BUILD_MPD, test x$want_mpd = xyes)
122 if test x$want_mpd = xyes; then
123   AC_DEFINE(MPD, 1, [Define if you want MPD support])
124 fi
125
126 dnl
127 dnl PORT_MONITORS
128 dnl
129
130 want_portmon=yes
131 AC_ARG_ENABLE(portmon,
132 [  --enable-portmon        enable if you want tcp (ip4) port monitoring [[default=no]]],
133   [want_portmon="$enableval"])
134
135 AM_CONDITIONAL(BUILD_PORT_MONITORS, test x$want_portmon = xyes)
136 if test x$want_portmon = xyes; then
137   AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h sys/socket.h arpa/inet.h], [], [PORT_MONITORS_MISSING=yes])
138   if test "x$PORT_MONITORS_MISSING" = xyes; then
139          AC_MSG_ERROR([missing a needed network header for port monitoring])
140   fi
141   AC_DEFINE(TCP_PORT_MONITOR, 1, [Define if you want tcp port monitoring support])
142 fi
143
144 dnl
145 dnl Cairo
146 dnl
147
148 dnl
149 dnl MLDonkey
150 dnl
151
152 want_mldonkey=no
153 AC_ARG_ENABLE(mldonkey,
154 [  --enable-mldonkey       enable if you want MLDonkey support [[default=no]]],
155   [want_mldonkey="$enableval"])
156
157 AM_CONDITIONAL(BUILD_MLDONKEY, test x$want_mldonkey = xyes)
158 if test x$want_mldonkey = xyes; then
159   AC_DEFINE(MLDONKEY, 1, [Define if you want MLDonkey support])
160 fi
161
162 dnl
163 dnl C Compiler
164 dnl
165
166 AC_PROG_CC
167
168 dnl
169 dnl X
170 dnl
171
172 dah=yes
173 AC_ARG_ENABLE(double_buffer,
174 [  --enable-double-buffer  enable if you want to support flicker-free operation [[default=yes]]],
175   [dah="$enableval"])
176
177 want_x11=yes
178 AC_ARG_ENABLE(x11,
179 [  --enable-x11            enable if you want X11 support [[default=yes]]],
180  [want_x11="$enableval"])
181
182
183 if test "x$want_x11" = "xyes"; then
184         AC_PATH_X
185         AC_PATH_XTRA
186         CFLAGS="$CFLAGS $X_CFLAGS"
187         LIBS="$LIBS $X_LIBS $X11_LIBS"
188         LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
189         if test "x$X_DISPLAY_MISSING" = xyes; then
190                 AC_MSG_ERROR([something went wrong when checking for X11, you're probably missing headers or it's not installed, either re-run configure with --disable-x11, or fix this])
191         fi
192         AC_DEFINE(X11, 1, [Define if you want to use X11])
193         AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
194         AM_CONDITIONAL(BUILD_X11, true)
195         if test $dah != "no"; then
196                 AC_DEFINE(DOUBLE_BUFFER, 1, [Define if you want support for the DBE extension])
197                 AC_CHECK_LIB(Xext, XdbeQueryExtension, [AC_DEFINE([HAVE_XDBE], 1, [Xdbe]) LIBS="$LIBS -lXext"],
198                      [AC_MSG_ERROR([something went wrong when checking for Xdbe (double buffer extension)])])
199         fi
200 else
201         AM_CONDITIONAL(BUILD_X11, false)
202 fi
203
204 dnl
205 dnl Xft
206 dnl
207
208 if test x$want_xft && test x$want_x11; then
209   AC_PATH_PROG(XFTCONFIG, xft-config)
210   if test x$XFTCONFIG != x; then
211     dnl TODO: needs more checks
212   
213 dnl This won't work for some reason
214 dnl  AC_CHECK_HEADERS([X11/Xft/Xft.h], [], [XFT_MISSING=yes])
215     if test "x$XFT_MISSING" = xyes; then
216       AC_MSG_ERROR([something went wrong when checking for Xft, you're probably missing headers or it's not installed])
217   fi
218
219     AC_DEFINE(XFT, 1, [Define if you are using Xft])
220     CFLAGS="$CFLAGS `$XFTCONFIG --cflags`"
221     XFT_LIBS=`$XFTCONFIG --libs`
222   else
223     want_xft=no
224   fi
225 fi
226
227 dnl
228 dnl KVM
229 dnl
230
231 if test x$WANT_KVM = xyes; then
232   AC_CHECK_LIB(kvm, kvm_open,
233         LIBS="$LIBS -lkvm",
234         AC_MSG_ERROR([Could not find kvm_open in -lkvm.])
235   )
236 fi
237
238 dnl
239 dnl devstat
240 dnl
241
242 if test x$WANT_DEVSTAT = xyes; then
243         AC_CHECK_LIB(devstat, devstat_getversion,
244                      LIBS="$LIBS -ldevstat",
245                      AC_MSG_ERROR([Cound not find devstat_getversion in -ldevstat.])
246         )
247 fi
248
249 dnl
250 dnl OSSLIB for NetBSD
251 dnl
252
253 if test x$WANT_OSSLIB = xyes; then
254     AC_CHECK_LIB(ossaudio, _oss_ioctl,
255         LIBS="$LIBS -lossaudio",
256         AC_MSG_ERROR([Could not find oss_ioctl in -lossaudio.])
257     )
258 fi
259
260 dnl
261 dnl Some random headers
262 dnl
263
264
265 AC_CHECK_HEADERS([signal.h unistd.h sys/utsname.h sys/stat.h linux/soundcard.h dirent.h mcheck.h])
266 AC_CHECK_HEADERS([sys/statfs.h sys/param.h])
267 AC_CHECK_HEADERS([sys/mount.h], [], [],
268                  [#ifdef HAVE_SYS_PARAM_H
269                   #include <sys/param.h>
270                   #endif
271 ])
272
273 dnl
274 dnl Check doc stuff
275 dnl
276
277 AC_CHECK_PROGS(db2x_xsltproc_cmd, db2x_xsltproc)
278 AC_CHECK_PROGS(db2x_manxml_cmd, db2x_manxml)
279 AC_CHECK_PROGS(xsltproc_cmd, xsltproc)
280 if test x$db2x_xsltproc_cmd = "x" -o x$xsltproc_cmd = "x"; then
281         AM_CONDITIONAL(HAVE_DOCSTUFF, false)
282 else
283         AM_CONDITIONAL(HAVE_DOCSTUFF, true)
284 fi
285
286 dnl
287 dnl Check sysinfo()
288 dnl
289
290 if test x$WANT_SYSINFO = xyes; then
291   dah=no
292   AC_MSG_CHECKING(for sysinfo)
293   AC_TRY_COMPILE(
294     [#include <sys/types.h>
295      #include <sys/sysinfo.h>],
296     [struct sysinfo s; sysinfo(&s); (void) s.uptime; ],
297     [AC_MSG_RESULT(yes); dah=yes],
298     [AC_MSG_RESULT(not usable); dah=no])
299
300   if test x$dah = xyes; then
301     AC_DEFINE(HAVE_SYSINFO, 1, [Define if you have sysinfo (Linux)])
302   fi
303 fi
304
305 dnl
306 dnl kstat in Solaris
307 dnl
308
309 if test x$WANT_KSTAT = xyes; then
310   dah=no
311   AC_CHECK_LIB([kstat], [kstat_open], [dah=yes], [])
312
313   if test x$dah = xyes; then
314     AC_DEFINE(HAVE_KSTAT, 1, [Define if you have kstat (Solaris)])
315     LDFLAGS="$LDFLAGS -lkstat"
316   fi
317 fi
318
319 AC_DEFUN([AM_LANGINFO_CODESET],
320 [
321   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
322     [AC_TRY_LINK([#include <langinfo.h>],
323       [char* cs = nl_langinfo(CODESET);],
324       am_cv_langinfo_codeset=yes,
325       am_cv_langinfo_codeset=no)
326     ])
327   if test $am_cv_langinfo_codeset = yes; then
328     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
329       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
330   fi
331 ])
332
333 dnl
334 dnl Check getloadavg
335 dnl
336
337 AC_MSG_CHECKING(for getloadavg)
338 AC_TRY_COMPILE(
339   [#include <stdlib.h>],
340   [double v[3]; getloadavg(v, 3);],
341   [AC_MSG_RESULT(yes)
342    AC_DEFINE(HAVE_GETLOADAVG, 1, [Define if you have getloadavg])],
343   [AC_MSG_RESULT(no)])
344
345 dnl
346 dnl Check popen
347 dnl
348
349 AC_CHECK_FUNCS(popen)
350
351 dnl
352 dnl Da.
353 dnl
354
355 CFLAGS="$CFLAGS -Wall -W"
356
357 AC_SUBST(CFLAGS)
358 AC_SUBST(X11_LIBS)
359 AC_SUBST(XFT_LIBS)
360
361 AC_OUTPUT