infopipe improvements
[monky] / configure.in
1 AC_INIT([Conky],[1.3.6_CVS_20060105],[brenden1@users.sourceforge.net])
2
3 AM_INIT_AUTOMAKE(conky, 1.3.6_CVS_20060105)
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=yes]]],
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=yes]]],
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_CHECK_HEADERS([bmpx/dbus.h], [], [BMPX_MISSING=yes])
96         if test "x$BMPX_MISSING" = xyes; then
97                 AC_MSG_ERROR([bmpx doesn't seem to be installed, or the headers aren't available])
98         fi
99         AC_DEFINE(BMPX, 1, [Define if you want BMPx support])
100 fi
101
102 dnl
103 dnl Seti@Home
104 dnl
105
106 want_seti=yes
107 AC_ARG_ENABLE(seti,
108 [  --enable-seti           enable if you want SETI at Home stats [[default=yes]]],
109   [want_seti="$enableval"])
110
111 AM_CONDITIONAL(BUILD_SETI, test x$want_seti = xyes)
112 if test x$want_seti = xyes; then
113   AC_DEFINE(SETI, 1, [Define if you want SETI at Home stats])
114 fi
115
116 dnl
117 dnl MPD
118 dnl
119
120 want_mpd=yes
121 AC_ARG_ENABLE(mpd,
122 [  --enable-mpd            enable if you want MPD support [[default=yes]]],
123   [want_mpd="$enableval"])
124
125 AM_CONDITIONAL(BUILD_MPD, test x$want_mpd = xyes)
126 if test x$want_mpd = xyes; then
127   AC_DEFINE(MPD, 1, [Define if you want MPD support])
128 fi
129
130 dnl
131 dnl INFOPIPE
132 dnl
133
134 want_infopipe=yes
135 AC_ARG_ENABLE(infopipe,
136 [  --enable-infopipe       enable if you want XMMS/BMP InfoPipe support [[default=no]]],
137   [want_infopipe="$enableval"])
138
139 AM_CONDITIONAL(BUILD_INFOPIPE, test x$want_infopipe = xyes)
140 if test x$want_infopipe = xyes; then
141   AC_DEFINE(INFOPIPE, 1, [Define if you want XMMS/BMP InfoPipe support])
142 fi
143
144 dnl
145 dnl PORT_MONITORS
146 dnl
147
148 want_portmon=yes
149 AC_ARG_ENABLE(portmon,
150 [  --enable-portmon        enable if you want tcp (ip4) port monitoring [[default=yes]]],
151   [want_portmon="$enableval"])
152
153 AM_CONDITIONAL(BUILD_PORT_MONITORS, test x$want_portmon = xyes)
154 if test x$want_portmon = xyes; then
155   AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h sys/socket.h arpa/inet.h], [], [PORT_MONITORS_MISSING=yes])
156   if test "x$PORT_MONITORS_MISSING" = xyes; then
157          AC_MSG_ERROR([missing a needed network header for port monitoring])
158   fi
159   AC_DEFINE(TCP_PORT_MONITOR, 1, [Define if you want tcp port monitoring support])
160 fi
161
162 dnl
163 dnl Cairo
164 dnl
165
166 dnl
167 dnl MLDonkey
168 dnl
169
170 want_mldonkey=no
171 AC_ARG_ENABLE(mldonkey,
172 [  --enable-mldonkey       enable if you want MLDonkey support [[default=no]]],
173   [want_mldonkey="$enableval"])
174
175 AM_CONDITIONAL(BUILD_MLDONKEY, test x$want_mldonkey = xyes)
176 if test x$want_mldonkey = xyes; then
177   AC_DEFINE(MLDONKEY, 1, [Define if you want MLDonkey support])
178 fi
179
180 dnl
181 dnl C Compiler
182 dnl
183
184 AC_PROG_CC
185
186 dnl
187 dnl X
188 dnl
189
190 dah=yes
191 AC_ARG_ENABLE(double_buffer,
192 [  --enable-double-buffer  enable if you want to support flicker-free operation [[default=yes]]],
193   [dah="$enableval"])
194
195 want_x11=yes
196 AC_ARG_ENABLE(x11,
197 [  --enable-x11            enable if you want X11 support [[default=yes]]],
198  [want_x11="$enableval"])
199
200
201 if test "x$want_x11" = "xyes"; then
202         AC_PATH_X
203         AC_PATH_XTRA
204         CFLAGS="$CFLAGS $X_CFLAGS"
205         LIBS="$LIBS $X_LIBS $X11_LIBS"
206         LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
207         if test "x$X_DISPLAY_MISSING" = xyes; then
208                 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])
209         fi
210         AC_DEFINE(X11, 1, [Define if you want to use X11])
211         AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
212         AM_CONDITIONAL(BUILD_X11, true)
213         if test $dah != "no"; then
214                 AC_DEFINE(DOUBLE_BUFFER, 1, [Define if you want support for the DBE extension])
215                 AC_CHECK_LIB(Xext, XdbeQueryExtension, [AC_DEFINE([HAVE_XDBE], 1, [Xdbe]) LIBS="$LIBS -lXext"],
216                      [AC_MSG_ERROR([something went wrong when checking for Xdbe (double buffer extension)])])
217         fi
218 else
219         AM_CONDITIONAL(BUILD_X11, false)
220 fi
221
222 dnl
223 dnl Xft
224 dnl
225
226 if test x$want_xft && test x$want_x11; then
227   AC_PATH_PROG(XFTCONFIG, xft-config)
228   if test x$XFTCONFIG != x; then
229     dnl TODO: needs more checks
230   
231 dnl This won't work for some reason
232 dnl  AC_CHECK_HEADERS([X11/Xft/Xft.h], [], [XFT_MISSING=yes])
233     if test "x$XFT_MISSING" = xyes; then
234       AC_MSG_ERROR([something went wrong when checking for Xft, you're probably missing headers or it's not installed])
235   fi
236
237     AC_DEFINE(XFT, 1, [Define if you are using Xft])
238     CFLAGS="$CFLAGS `$XFTCONFIG --cflags`"
239     XFT_LIBS=`$XFTCONFIG --libs`
240   else
241     want_xft=no
242   fi
243 fi
244
245 dnl
246 dnl KVM
247 dnl
248
249 if test x$WANT_KVM = xyes; then
250   AC_CHECK_LIB(kvm, kvm_open,
251         LIBS="$LIBS -lkvm",
252         AC_MSG_ERROR([Could not find kvm_open in -lkvm.])
253   )
254 fi
255
256 dnl
257 dnl devstat
258 dnl
259
260 if test x$WANT_DEVSTAT = xyes; then
261         AC_CHECK_LIB(devstat, devstat_getversion,
262                      LIBS="$LIBS -ldevstat",
263                      AC_MSG_ERROR([Cound not find devstat_getversion in -ldevstat.])
264         )
265 fi
266
267 dnl
268 dnl OSSLIB for NetBSD
269 dnl
270
271 if test x$WANT_OSSLIB = xyes; then
272     AC_CHECK_LIB(ossaudio, _oss_ioctl,
273         LIBS="$LIBS -lossaudio",
274         AC_MSG_ERROR([Could not find oss_ioctl in -lossaudio.])
275     )
276 fi
277
278 dnl
279 dnl Some random headers
280 dnl
281
282
283 AC_CHECK_HEADERS([signal.h unistd.h sys/utsname.h sys/stat.h linux/soundcard.h dirent.h mcheck.h])
284 AC_CHECK_HEADERS([sys/statfs.h sys/param.h])
285 AC_CHECK_HEADERS([sys/mount.h], [], [],
286                  [#ifdef HAVE_SYS_PARAM_H
287                   #include <sys/param.h>
288                   #endif
289 ])
290
291 dnl
292 dnl Check doc stuff
293 dnl
294
295 AC_CHECK_PROGS(db2x_xsltproc_cmd, db2x_xsltproc)
296 AC_CHECK_PROGS(db2x_manxml_cmd, db2x_manxml)
297 AC_CHECK_PROGS(xsltproc_cmd, xsltproc)
298 if test x$db2x_xsltproc_cmd = "x" -o x$xsltproc_cmd = "x"; then
299         AM_CONDITIONAL(HAVE_DOCSTUFF, false)
300 else
301         AM_CONDITIONAL(HAVE_DOCSTUFF, true)
302 fi
303
304 dnl
305 dnl Check sysinfo()
306 dnl
307
308 if test x$WANT_SYSINFO = xyes; then
309   dah=no
310   AC_MSG_CHECKING(for sysinfo)
311   AC_TRY_COMPILE(
312     [#include <sys/types.h>
313      #include <sys/sysinfo.h>],
314     [struct sysinfo s; sysinfo(&s); (void) s.uptime; ],
315     [AC_MSG_RESULT(yes); dah=yes],
316     [AC_MSG_RESULT(not usable); dah=no])
317
318   if test x$dah = xyes; then
319     AC_DEFINE(HAVE_SYSINFO, 1, [Define if you have sysinfo (Linux)])
320   fi
321 fi
322
323 dnl
324 dnl kstat in Solaris
325 dnl
326
327 if test x$WANT_KSTAT = xyes; then
328   dah=no
329   AC_CHECK_LIB([kstat], [kstat_open], [dah=yes], [])
330
331   if test x$dah = xyes; then
332     AC_DEFINE(HAVE_KSTAT, 1, [Define if you have kstat (Solaris)])
333     LDFLAGS="$LDFLAGS -lkstat"
334   fi
335 fi
336
337 AC_DEFUN([AM_LANGINFO_CODESET],
338 [
339   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
340     [AC_TRY_LINK([#include <langinfo.h>],
341       [char* cs = nl_langinfo(CODESET);],
342       am_cv_langinfo_codeset=yes,
343       am_cv_langinfo_codeset=no)
344     ])
345   if test $am_cv_langinfo_codeset = yes; then
346     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
347       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
348   fi
349 ])
350
351 dnl
352 dnl Check getloadavg
353 dnl
354
355 AC_MSG_CHECKING(for getloadavg)
356 AC_TRY_COMPILE(
357   [#include <stdlib.h>],
358   [double v[3]; getloadavg(v, 3);],
359   [AC_MSG_RESULT(yes)
360    AC_DEFINE(HAVE_GETLOADAVG, 1, [Define if you have getloadavg])],
361   [AC_MSG_RESULT(no)])
362
363 dnl
364 dnl Check popen
365 dnl
366
367 AC_CHECK_FUNCS(popen)
368
369 dnl
370 dnl Da.
371 dnl
372
373 CFLAGS="$CFLAGS -Wall -W"
374
375 AC_SUBST(CFLAGS)
376 AC_SUBST(X11_LIBS)
377 AC_SUBST(XFT_LIBS)
378
379 AC_OUTPUT