removal of xmms/bmp / addition of audacious/infopipe
[monky] / configure.ac
1 AC_INIT([Conky],[1.4.3],[brenden1@users.sourceforge.net])
2
3 AM_INIT_AUTOMAKE(conky, 1.4.3)
4 AM_CONFIG_HEADER(src/config.h)
5 dnl
6 dnl C Compiler
7 dnl
8
9 dnl prevent libtool setting LTCFLAGS to default of -g -O2 when CFLAGS unset.
10 dnl libtool must be deleted with make distclean to see this fix.
11 if test x"$CFLAGS" = x""; then
12     AC_SUBST(CFLAGS, [ ])
13 fi
14
15 AC_PROG_CC
16 AC_PROG_LIBTOOL
17 PKG_PROG_PKG_CONFIG([0.17.2])
18
19
20 AC_CONFIG_FILES(
21         Makefile
22         doc/Makefile
23         src/Makefile
24         src/build.h
25         )
26
27 uname=`uname`
28
29 case $uname in
30   Linux*)
31     WANT_SYSINFO=yes
32     ;;
33   FreeBSD*)
34     WANT_KVM=yes
35     WANT_DEVSTAT=yes
36     ;;
37 #  NetBSD*)
38 #    WANT_KVM=yes
39 #    WANT_OSSLIB=yes
40 #    ;;
41
42 #  OpenBSD*)
43 #    WANT_KVM=yes
44 #    WANT_OSSLIB=yes
45 #    ;;
46
47 # Solaris doesn't work at all right now
48 #  SunOS*)
49 #    WANT_KSTAT=yes
50 #    ;;
51
52   *)
53     echo "Your operating system $uname isn't supported"
54     echo "Feel free to help. :P"
55     exit 1
56     ;;
57 esac
58
59 AM_CONDITIONAL(BUILD_LINUX, test x$uname = xLinux)
60 #AM_CONDITIONAL(BUILD_SOLARIS, test x$uname = xSunOS)
61 AM_CONDITIONAL(BUILD_FREEBSD, test x$uname = xFreeBSD)
62 #AM_CONDITIONAL(BUILD_NETBSD, test x$uname = xNetBSD)
63 # AM_CONDITIONAL(BUILD_OPENBSD, test x$uname = xOpenBSD)
64
65 BUILD_DATE=$(LANG=en_US LC_ALL=en_US LOCALE=en_US date)
66 BUILD_ARCH="$(uname -sr) ($(uname -m))"
67 AC_SUBST(BUILD_DATE)
68 AC_SUBST(BUILD_ARCH)
69
70 dnl
71 dnl XFT option
72 dnl
73
74 want_xft=yes
75 AC_ARG_ENABLE(xft,
76 [  --enable-xft            enable if you want to use Xft [[default=yes]]],
77   [want_xft="$enableval"])
78
79 dnl
80 dnl OWN_WINDOW option
81 dnl
82
83 dah=yes
84 AC_ARG_ENABLE(own_window,
85 [  --enable-own-window     enable if you want support for creating own window [[default=yes]]],
86   [dah="$enableval"])
87
88 if test $dah != "no"; then
89   AC_DEFINE(OWN_WINDOW, 1, [Define if you want support for window creating])
90 fi
91
92 dnl
93 dnl PROC_UPTIME option
94 dnl
95
96 dah=yes
97 AC_ARG_ENABLE(proc_uptime,
98 [  --enable-proc-uptime    enable using /proc/uptime for uptime [[default=yes]]],
99   [dah="$enableval"])
100
101 if test $dah = "yes"; then
102   AC_DEFINE(PROC_UPTIME, 1, [Define if you want to use /proc/uptime for uptime])
103 fi
104
105
106 dnl
107 dnl Audacious Media Player
108 dnl
109
110 want_audacious=auto
111 AC_ARG_ENABLE(audacious,
112    [  --enable-audacious      enable audacious player support [[default=auto]]],
113    [want_audacious="$enableval"])
114
115 case x$want_audacious in
116     xauto)
117         want_audacious=yes
118         PKG_CHECK_MODULES([AUDACIOUS], [audacious >= 0.1], [], [want_audacious=no])  
119         if test x$want_audacious = xyes; then
120              CFLAGS="$CFLAGS $AUDACIOUS_CFLAGS"
121              LIBS="$LIBS $AUDACIOUS_LIBS"
122              AC_DEFINE(AUDACIOUS, 1, [Define for Audacious support])
123         fi
124         ;;
125     xyes)
126         PKG_CHECK_MODULES([AUDACIOUS], [audacious >= 0.1], [], 
127                           [AC_MSG_ERROR([Can't find Audacious development files.])])
128         CFLAGS="$CFLAGS $AUDACIOUS_CFLAGS"
129         LIBS="$LIBS $AUDACIOUS_LIBS"
130         AC_DEFINE(AUDACIOUS, 1, [Define for Audacious support])
131         ;;
132     xno)
133         ;;
134     *)
135         echo "Error: invalid audacious parameter specified: $want_audacious"
136         exit -1
137         ;;
138 esac
139 AM_CONDITIONAL(BUILD_AUDACIOUS, test x$want_audacious = xyes)
140
141 dnl
142 dnl InfoPipe (Version 1.3)
143 dnl
144
145 want_infopipe=no
146 AC_ARG_ENABLE(infopipe,
147    [  --enable-infopipe       enable xmms/bmp infopipe support [[default=no]]],
148    [want_infopipe="$enableval"])
149
150 case x$want_infopipe in
151     xyes)
152         AC_DEFINE(INFOPIPE, 1, [Define for InfoPipe support])
153         ;;
154     xno)
155         ;;
156     *)
157         echo "Error: invalid infopipe parameter specified: $want_infopipe"
158         exit -1
159         ;;
160 esac
161 AM_CONDITIONAL(BUILD_INFOPIPE, test x$want_infopipe = xyes)
162
163 dnl
164 dnl BMPx
165 dnl
166
167 want_bmpx=no
168 AC_ARG_ENABLE(bmpx,
169               [  --enable-bmpx           enable if you want BMPx support [[default=no]]],
170               [want_bmpx="$enableval"])
171
172 AM_CONDITIONAL(BUILD_BMPX, test x$want_bmpx = xyes)
173 if test x$want_bmpx = xyes; then
174         PKG_CHECK_MODULES([BMPX], [bmp-2.0 >= 0.14.0])
175         CFLAGS="$CFLAGS $BMPX_CFLAGS"
176         LIBS="$LIBS $BMPX_LIBS"
177         AC_DEFINE(BMPX, 1, [Define if you want BMPx support])
178 fi
179
180 dnl
181 dnl Seti@Home
182 dnl
183
184 want_seti=yes
185 AC_ARG_ENABLE(seti,
186 [  --enable-seti           enable if you want SETI at Home stats [[default=yes]]],
187   [want_seti="$enableval"])
188
189 AM_CONDITIONAL(BUILD_SETI, test x$want_seti = xyes)
190 if test x$want_seti = xyes; then
191   AC_DEFINE(SETI, 1, [Define if you want SETI at Home stats])
192 fi
193
194 dnl
195 dnl Hddtemp
196 dnl
197
198 want_hddtemp=yes
199 AC_ARG_ENABLE(hddtemp,
200 [  --enable-hddtemp        enable if you want hddtemp support [[default=yes]]],
201   [want_hddtemp="$enableval"])
202
203 AM_CONDITIONAL(BUILD_HDDTEMP, test x$want_hddtemp = xyes)
204 if test x$want_hddtemp = xyes; then
205   AC_DEFINE(HDDTEMP, 1, [Define if you want hddtemp support])
206 fi
207
208 dnl
209 dnl MPD
210 dnl
211
212 want_mpd=yes
213 AC_ARG_ENABLE(mpd,
214 [  --enable-mpd            enable if you want MPD support [[default=yes]]],
215   [want_mpd="$enableval"])
216
217 AM_CONDITIONAL(BUILD_MPD, test x$want_mpd = xyes)
218 if test x$want_mpd = xyes; then
219   AC_DEFINE(MPD, 1, [Define if you want MPD support])
220 fi
221
222 dnl
223 dnl XMMS2
224 dnl
225
226 want_xmms2=no
227 AC_ARG_ENABLE(xmms2,
228 [  --enable-xmms2          enable if you want XMMS2 support [[default=no]]],
229   [want_xmms2="$enableval"])
230
231 AM_CONDITIONAL(BUILD_XMMS2, test x$want_xmms2 = xyes)
232 if test x$want_xmms2 = xyes; then
233   CFLAGS="$CFLAGS `pkg-config --cflags xmms2-client`"
234   LIBS="$LIBS `pkg-config --libs xmms2-client`"
235   AC_DEFINE(XMMS2, 1, [Define if you want XMMS2 support])
236 fi
237
238 dnl
239 dnl IMLIB2
240 dnl
241
242 want_imlib2=no
243 AC_ARG_ENABLE(imlib2,
244 [  --enable-imlib2         enable if you want Imlib2 support [[default=no]]],
245   [want_imlib2="$enableval"])
246
247 AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes)
248 if test x$want_imlib2 = xyes; then
249         PKG_CHECK_MODULES([Imlib2], [imlib2])
250         CFLAGS="$CFLAGS $Imlib2_CFLAGS"
251         LIBS="$LIBS $Imlib2_LIBS"
252         AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support])
253 fi
254
255 dnl
256 dnl PORT_MONITORS
257 dnl
258
259 want_portmon=yes
260 AC_ARG_ENABLE(portmon,
261 [  --enable-portmon        enable if you want tcp (ip4) port monitoring [[default=yes]]],
262   [want_portmon="$enableval"])
263
264 AM_CONDITIONAL(BUILD_PORT_MONITORS, test x$want_portmon = xyes)
265 if test x$want_portmon = xyes; then
266   AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h sys/socket.h arpa/inet.h], [], [PORT_MONITORS_MISSING=yes])
267   if test "x$PORT_MONITORS_MISSING" = xyes; then
268          AC_MSG_ERROR([missing a needed network header for port monitoring])
269   fi
270   AC_DEFINE(TCP_PORT_MONITOR, 1, [Define if you want tcp port monitoring support])
271 fi
272
273 dnl
274 dnl Cairo
275 dnl
276
277 dnl
278 dnl MLDonkey
279 dnl
280
281 want_mldonkey=no
282 AC_ARG_ENABLE(mldonkey,
283 [  --enable-mldonkey       enable if you want MLDonkey support [[default=no]]],
284   [want_mldonkey="$enableval"])
285
286 AM_CONDITIONAL(BUILD_MLDONKEY, test x$want_mldonkey = xyes)
287 if test x$want_mldonkey = xyes; then
288   AC_DEFINE(MLDONKEY, 1, [Define if you want MLDonkey support])
289 fi
290
291 dnl
292 dnl ICONV
293 dnl
294
295 AM_ICONV
296 if test "$am_cv_func_iconv" != yes; then
297         AC_MSG_WARN([Could not find libiconv])
298 else
299         LIBS="$LIBS $LIBICONV"
300 fi
301
302 dnl
303 dnl debug
304 dnl
305
306 want_debug=no
307 AC_ARG_ENABLE(debug, 
308         [  --enable-debug       compile with debug symbols [[default=no]]],
309         [want_debug="$enableval"])
310
311 if test "x$want_debug" = "xyes" -a $ac_cv_c_compiler_gnu != no; then
312         CFLAGS="$CFLAGS -g3"
313 fi
314
315 dnl
316 dnl X
317 dnl
318
319 want_double_buffer=yes
320 AC_ARG_ENABLE(double_buffer,
321 [  --enable-double-buffer  enable if you want to support flicker-free operation [[default=yes]]],
322   [want_double_buffer="$enableval"])
323
324 want_xdamage=yes
325 AC_ARG_ENABLE(xdamage,
326 [  --enable-xdamage        enable if you want Xdamage support [[default=yes]]],
327   [want_xdamage="$enableval"])
328
329 want_x11=yes
330 AC_ARG_ENABLE(x11,
331 [  --enable-x11            enable if you want X11 support [[default=yes]]],
332  [want_x11="$enableval"])
333
334
335 if test "x$want_x11" = "xyes"; then
336         AC_PATH_X
337         AC_PATH_XTRA
338         CFLAGS="$CFLAGS $X_CFLAGS"
339         LIBS="$LIBS $X_LIBS $X11_LIBS"
340         LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
341         
342         if test "x$no_x" = xyes; then
343                 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])
344         fi
345         
346         AC_CHECK_LIB(
347                 [X11], [XOpenDisplay],[], 
348                 AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
349         )
350
351         AC_DEFINE(X11, 1, [Define if you want to use X11])
352         AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
353         AM_CONDITIONAL(BUILD_X11, true)
354         
355         if test "x$want_double_buffer" != xno; then
356                 AC_DEFINE(DOUBLE_BUFFER, 1, [Define if you want support for the DBE extension])
357                 AC_CHECK_LIB(Xext, XdbeQueryExtension, [AC_DEFINE([HAVE_XDBE], 1, [Xdbe]) LIBS="$LIBS -lXext"],
358                      [AC_MSG_ERROR([something went wrong when checking for Xdbe (double buffer extension)])])
359         fi
360
361         if test "x$want_xdamage" = "xyes"; then
362                 AC_DEFINE(XDAMAGE, 1, [Define if you want support for the Xdamage extension])
363                 AC_CHECK_LIB(Xdamage, XDamageQueryExtension, 
364                              [AC_DEFINE([HAVE_XDAMAGE], 1, [Xdamage]) LIBS="$LIBS -lXdamage"],
365                               [AC_MSG_ERROR([something went wrong when checking for Xdamage])])
366         fi
367 else
368         AM_CONDITIONAL(BUILD_X11, false)
369 fi
370
371 dnl
372 dnl Xft
373 dnl
374
375 if test x$want_xft && test x$want_x11; then
376   PKG_CHECK_MODULES(XFT, [xft],
377                     [
378                      AC_DEFINE(XFT, 1, [Define if you are using Xft])
379                      CFLAGS="$CFLAGS $XFT_CFLAGS"
380                      AC_SUBST(XFT_LIBS)
381                     ], 
382                     [want_xft=no])
383 fi
384
385 dnl
386 dnl KVM
387 dnl
388
389 if test x$WANT_KVM = xyes; then
390   AC_CHECK_LIB(kvm, kvm_open,
391         LIBS="$LIBS -lkvm",
392         AC_MSG_ERROR([Could not find kvm_open in -lkvm.])
393   )
394 fi
395
396 dnl
397 dnl devstat
398 dnl
399
400 if test x$WANT_DEVSTAT = xyes; then
401         AC_CHECK_LIB(devstat, devstat_getversion,
402                      LIBS="$LIBS -ldevstat",
403                      AC_MSG_ERROR([Cound not find devstat_getversion in -ldevstat.])
404         )
405 fi
406
407 dnl
408 dnl OSSLIB for NetBSD/OpenBSD
409 dnl
410
411 if test x$WANT_OSSLIB = xyes; then
412     AC_CHECK_LIB(ossaudio, _oss_ioctl,
413         LIBS="$LIBS -lossaudio",
414         AC_MSG_ERROR([Could not find oss_ioctl in -lossaudio.])
415     )
416 fi
417
418 dnl
419 dnl Some random headers
420 dnl
421
422
423 AC_CHECK_HEADERS([signal.h unistd.h sys/utsname.h sys/stat.h linux/soundcard.h dirent.h mcheck.h])
424 AC_CHECK_HEADERS([sys/statfs.h sys/param.h])
425 AC_CHECK_HEADERS([sys/mount.h], [], [],
426                  [#ifdef HAVE_SYS_PARAM_H
427                   #include <sys/param.h>
428                   #endif
429 ])
430
431 dnl
432 dnl Check doc stuff
433 dnl
434
435 AC_CHECK_PROGS(db2x_xsltproc_cmd, db2x_xsltproc)
436 AC_CHECK_PROGS(db2x_manxml_cmd, db2x_manxml)
437 AC_CHECK_PROGS(xsltproc_cmd, xsltproc)
438 if test x$db2x_xsltproc_cmd = "x" -o x$xsltproc_cmd = "x"; then
439         AM_CONDITIONAL(HAVE_DOCSTUFF, false)
440 else
441         AM_CONDITIONAL(HAVE_DOCSTUFF, true)
442 fi
443
444 dnl
445 dnl Check sysinfo()
446 dnl
447
448 if test x$WANT_SYSINFO = xyes; then
449   dah=no
450   AC_MSG_CHECKING(for sysinfo)
451   AC_TRY_COMPILE(
452     [#include <sys/types.h>
453      #include <sys/sysinfo.h>],
454     [struct sysinfo s; sysinfo(&s); (void) s.uptime; ],
455     [AC_MSG_RESULT(yes); dah=yes],
456     [AC_MSG_RESULT(not usable); dah=no])
457
458   if test x$dah = xyes; then
459     AC_DEFINE(HAVE_SYSINFO, 1, [Define if you have sysinfo (Linux)])
460   fi
461 fi
462
463 dnl
464 dnl kstat in Solaris
465 dnl
466
467 if test x$WANT_KSTAT = xyes; then
468   dah=no
469   AC_CHECK_LIB([kstat], [kstat_open], [dah=yes], [])
470
471   if test x$dah = xyes; then
472     AC_DEFINE(HAVE_KSTAT, 1, [Define if you have kstat (Solaris)])
473     LDFLAGS="$LDFLAGS -lkstat"
474   fi
475 fi
476
477 AC_DEFUN([AM_LANGINFO_CODESET],
478 [
479   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
480     [AC_TRY_LINK([#include <langinfo.h>],
481       [char* cs = nl_langinfo(CODESET);],
482       am_cv_langinfo_codeset=yes,
483       am_cv_langinfo_codeset=no)
484     ])
485   if test $am_cv_langinfo_codeset = yes; then
486     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
487       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
488   fi
489 ])
490
491 dnl
492 dnl Check getloadavg
493 dnl
494
495 AC_MSG_CHECKING(for getloadavg)
496 AC_TRY_COMPILE(
497   [#include <stdlib.h>],
498   [double v[3]; getloadavg(v, 3);],
499   [AC_MSG_RESULT(yes)
500    AC_DEFINE(HAVE_GETLOADAVG, 1, [Define if you have getloadavg])],
501   [AC_MSG_RESULT(no)])
502
503 dnl
504 dnl Check popen
505 dnl
506
507 AC_CHECK_FUNCS(popen)
508
509 dnl
510 dnl Da.
511 dnl
512
513 CFLAGS="$CFLAGS -Wall -W"
514
515 AC_SUBST(CFLAGS)
516 AC_SUBST(X11_LIBS)
517
518 AC_OUTPUT
519
520 dnl
521 dnl Print summary
522 dnl
523 cat << EOF
524
525 $PACKAGE $VERSION configured successfully:
526
527  Installing into:       $prefix
528  C compiler flags:      $CFLAGS
529  Linker flags:          $LDFLAGS
530  Libraries:             $LIBS
531
532  * x11:
533   x11 support:          $want_x11
534   xft support:          $want_xft
535   xdamage extension:    $want_xdamage  
536
537  * music detection:
538   audacious:            $want_audacious
539   infopipe:             $want_infopipe
540   bmpx:                 $want_bmpx
541   xmms2:                $want_xmms2
542   mpd:                  $want_mpd
543
544  * general:
545   portmon:              $want_portmon  
546   mldonkey:             $want_mldonkey
547   hddtemp:              $want_hddtemp
548
549 EOF