remove infopipe support
[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
142 dnl
143 dnl BMPx
144 dnl
145
146 want_bmpx=no
147 AC_ARG_ENABLE(bmpx,
148               [  --enable-bmpx           enable if you want BMPx support [[default=no]]],
149               [want_bmpx="$enableval"])
150
151 AM_CONDITIONAL(BUILD_BMPX, test x$want_bmpx = xyes)
152 if test x$want_bmpx = xyes; then
153         PKG_CHECK_MODULES([BMPX], [bmp-2.0 >= 0.14.0])
154         CFLAGS="$CFLAGS $BMPX_CFLAGS"
155         LIBS="$LIBS $BMPX_LIBS"
156         AC_DEFINE(BMPX, 1, [Define if you want BMPx support])
157 fi
158
159 dnl
160 dnl Seti@Home
161 dnl
162
163 want_seti=yes
164 AC_ARG_ENABLE(seti,
165 [  --enable-seti           enable if you want SETI at Home stats [[default=yes]]],
166   [want_seti="$enableval"])
167
168 AM_CONDITIONAL(BUILD_SETI, test x$want_seti = xyes)
169 if test x$want_seti = xyes; then
170   AC_DEFINE(SETI, 1, [Define if you want SETI at Home stats])
171 fi
172
173 dnl
174 dnl Hddtemp
175 dnl
176
177 want_hddtemp=yes
178 AC_ARG_ENABLE(hddtemp,
179 [  --enable-hddtemp        enable if you want hddtemp support [[default=yes]]],
180   [want_hddtemp="$enableval"])
181
182 AM_CONDITIONAL(BUILD_HDDTEMP, test x$want_hddtemp = xyes)
183 if test x$want_hddtemp = xyes; then
184   AC_DEFINE(HDDTEMP, 1, [Define if you want hddtemp support])
185 fi
186
187 dnl
188 dnl MPD
189 dnl
190
191 want_mpd=yes
192 AC_ARG_ENABLE(mpd,
193 [  --enable-mpd            enable if you want MPD support [[default=yes]]],
194   [want_mpd="$enableval"])
195
196 AM_CONDITIONAL(BUILD_MPD, test x$want_mpd = xyes)
197 if test x$want_mpd = xyes; then
198   AC_DEFINE(MPD, 1, [Define if you want MPD support])
199 fi
200
201 dnl
202 dnl XMMS2
203 dnl
204
205 want_xmms2=no
206 AC_ARG_ENABLE(xmms2,
207 [  --enable-xmms2          enable if you want XMMS2 support [[default=no]]],
208   [want_xmms2="$enableval"])
209
210 AM_CONDITIONAL(BUILD_XMMS2, test x$want_xmms2 = xyes)
211 if test x$want_xmms2 = xyes; then
212   CFLAGS="$CFLAGS `pkg-config --cflags xmms2-client`"
213   LIBS="$LIBS `pkg-config --libs xmms2-client`"
214   AC_DEFINE(XMMS2, 1, [Define if you want XMMS2 support])
215 fi
216
217 dnl
218 dnl IMLIB2
219 dnl
220
221 want_imlib2=no
222 AC_ARG_ENABLE(imlib2,
223 [  --enable-imlib2         enable if you want Imlib2 support [[default=no]]],
224   [want_imlib2="$enableval"])
225
226 AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes)
227 if test x$want_imlib2 = xyes; then
228         PKG_CHECK_MODULES([Imlib2], [imlib2])
229         CFLAGS="$CFLAGS $Imlib2_CFLAGS"
230         LIBS="$LIBS $Imlib2_LIBS"
231         AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support])
232 fi
233
234 dnl
235 dnl PORT_MONITORS
236 dnl
237
238 want_portmon=yes
239 AC_ARG_ENABLE(portmon,
240 [  --enable-portmon        enable if you want tcp (ip4) port monitoring [[default=yes]]],
241   [want_portmon="$enableval"])
242
243 AM_CONDITIONAL(BUILD_PORT_MONITORS, test x$want_portmon = xyes)
244 if test x$want_portmon = xyes; then
245   AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h sys/socket.h arpa/inet.h], [], [PORT_MONITORS_MISSING=yes])
246   if test "x$PORT_MONITORS_MISSING" = xyes; then
247          AC_MSG_ERROR([missing a needed network header for port monitoring])
248   fi
249   AC_DEFINE(TCP_PORT_MONITOR, 1, [Define if you want tcp port monitoring support])
250 fi
251
252 dnl
253 dnl Cairo
254 dnl
255
256 dnl
257 dnl MLDonkey
258 dnl
259
260 want_mldonkey=no
261 AC_ARG_ENABLE(mldonkey,
262 [  --enable-mldonkey       enable if you want MLDonkey support [[default=no]]],
263   [want_mldonkey="$enableval"])
264
265 AM_CONDITIONAL(BUILD_MLDONKEY, test x$want_mldonkey = xyes)
266 if test x$want_mldonkey = xyes; then
267   AC_DEFINE(MLDONKEY, 1, [Define if you want MLDonkey support])
268 fi
269
270 dnl
271 dnl ICONV
272 dnl
273
274 AM_ICONV
275 if test "$am_cv_func_iconv" != yes; then
276         AC_MSG_WARN([Could not find libiconv])
277 else
278         LIBS="$LIBS $LIBICONV"
279 fi
280
281 dnl
282 dnl debug
283 dnl
284
285 want_debug=no
286 AC_ARG_ENABLE(debug, 
287         [  --enable-debug       compile with debug symbols [[default=no]]],
288         [want_debug="$enableval"])
289
290 if test "x$want_debug" = "xyes" -a $ac_cv_c_compiler_gnu != no; then
291         CFLAGS="$CFLAGS -g3"
292 fi
293
294 dnl
295 dnl X
296 dnl
297
298 want_double_buffer=yes
299 AC_ARG_ENABLE(double_buffer,
300 [  --enable-double-buffer  enable if you want to support flicker-free operation [[default=yes]]],
301   [want_double_buffer="$enableval"])
302
303 want_xdamage=yes
304 AC_ARG_ENABLE(xdamage,
305 [  --enable-xdamage        enable if you want Xdamage support [[default=yes]]],
306   [want_xdamage="$enableval"])
307
308 want_x11=yes
309 AC_ARG_ENABLE(x11,
310 [  --enable-x11            enable if you want X11 support [[default=yes]]],
311  [want_x11="$enableval"])
312
313
314 if test "x$want_x11" = "xyes"; then
315         AC_PATH_X
316         AC_PATH_XTRA
317         CFLAGS="$CFLAGS $X_CFLAGS"
318         LIBS="$LIBS $X_LIBS $X11_LIBS"
319         LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
320         
321         if test "x$no_x" = xyes; then
322                 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])
323         fi
324         
325         AC_CHECK_LIB(
326                 [X11], [XOpenDisplay],[], 
327                 AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
328         )
329
330         AC_DEFINE(X11, 1, [Define if you want to use X11])
331         AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
332         AM_CONDITIONAL(BUILD_X11, true)
333         
334         if test "x$want_double_buffer" != xno; then
335                 AC_DEFINE(DOUBLE_BUFFER, 1, [Define if you want support for the DBE extension])
336                 AC_CHECK_LIB(Xext, XdbeQueryExtension, [AC_DEFINE([HAVE_XDBE], 1, [Xdbe]) LIBS="$LIBS -lXext"],
337                      [AC_MSG_ERROR([something went wrong when checking for Xdbe (double buffer extension)])])
338         fi
339
340         if test "x$want_xdamage" = "xyes"; then
341                 AC_DEFINE(XDAMAGE, 1, [Define if you want support for the Xdamage extension])
342                 AC_CHECK_LIB(Xdamage, XDamageQueryExtension, 
343                              [AC_DEFINE([HAVE_XDAMAGE], 1, [Xdamage]) LIBS="$LIBS -lXdamage"],
344                               [AC_MSG_ERROR([something went wrong when checking for Xdamage])])
345         fi
346 else
347         AM_CONDITIONAL(BUILD_X11, false)
348 fi
349
350 dnl
351 dnl Xft
352 dnl
353
354 if test x$want_xft && test x$want_x11; then
355   PKG_CHECK_MODULES(XFT, [xft],
356                     [
357                      AC_DEFINE(XFT, 1, [Define if you are using Xft])
358                      CFLAGS="$CFLAGS $XFT_CFLAGS"
359                      AC_SUBST(XFT_LIBS)
360                     ], 
361                     [want_xft=no])
362 fi
363
364 dnl
365 dnl KVM
366 dnl
367
368 if test x$WANT_KVM = xyes; then
369   AC_CHECK_LIB(kvm, kvm_open,
370         LIBS="$LIBS -lkvm",
371         AC_MSG_ERROR([Could not find kvm_open in -lkvm.])
372   )
373 fi
374
375 dnl
376 dnl devstat
377 dnl
378
379 if test x$WANT_DEVSTAT = xyes; then
380         AC_CHECK_LIB(devstat, devstat_getversion,
381                      LIBS="$LIBS -ldevstat",
382                      AC_MSG_ERROR([Cound not find devstat_getversion in -ldevstat.])
383         )
384 fi
385
386 dnl
387 dnl OSSLIB for NetBSD/OpenBSD
388 dnl
389
390 if test x$WANT_OSSLIB = xyes; then
391     AC_CHECK_LIB(ossaudio, _oss_ioctl,
392         LIBS="$LIBS -lossaudio",
393         AC_MSG_ERROR([Could not find oss_ioctl in -lossaudio.])
394     )
395 fi
396
397 dnl
398 dnl Some random headers
399 dnl
400
401
402 AC_CHECK_HEADERS([signal.h unistd.h sys/utsname.h sys/stat.h linux/soundcard.h dirent.h mcheck.h])
403 AC_CHECK_HEADERS([sys/statfs.h sys/param.h])
404 AC_CHECK_HEADERS([sys/mount.h], [], [],
405                  [#ifdef HAVE_SYS_PARAM_H
406                   #include <sys/param.h>
407                   #endif
408 ])
409
410 dnl
411 dnl Check doc stuff
412 dnl
413
414 AC_CHECK_PROGS(db2x_xsltproc_cmd, db2x_xsltproc)
415 AC_CHECK_PROGS(db2x_manxml_cmd, db2x_manxml)
416 AC_CHECK_PROGS(xsltproc_cmd, xsltproc)
417 if test x$db2x_xsltproc_cmd = "x" -o x$xsltproc_cmd = "x"; then
418         AM_CONDITIONAL(HAVE_DOCSTUFF, false)
419 else
420         AM_CONDITIONAL(HAVE_DOCSTUFF, true)
421 fi
422
423 dnl
424 dnl Check sysinfo()
425 dnl
426
427 if test x$WANT_SYSINFO = xyes; then
428   dah=no
429   AC_MSG_CHECKING(for sysinfo)
430   AC_TRY_COMPILE(
431     [#include <sys/types.h>
432      #include <sys/sysinfo.h>],
433     [struct sysinfo s; sysinfo(&s); (void) s.uptime; ],
434     [AC_MSG_RESULT(yes); dah=yes],
435     [AC_MSG_RESULT(not usable); dah=no])
436
437   if test x$dah = xyes; then
438     AC_DEFINE(HAVE_SYSINFO, 1, [Define if you have sysinfo (Linux)])
439   fi
440 fi
441
442 dnl
443 dnl kstat in Solaris
444 dnl
445
446 if test x$WANT_KSTAT = xyes; then
447   dah=no
448   AC_CHECK_LIB([kstat], [kstat_open], [dah=yes], [])
449
450   if test x$dah = xyes; then
451     AC_DEFINE(HAVE_KSTAT, 1, [Define if you have kstat (Solaris)])
452     LDFLAGS="$LDFLAGS -lkstat"
453   fi
454 fi
455
456 AC_DEFUN([AM_LANGINFO_CODESET],
457 [
458   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
459     [AC_TRY_LINK([#include <langinfo.h>],
460       [char* cs = nl_langinfo(CODESET);],
461       am_cv_langinfo_codeset=yes,
462       am_cv_langinfo_codeset=no)
463     ])
464   if test $am_cv_langinfo_codeset = yes; then
465     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
466       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
467   fi
468 ])
469
470 dnl
471 dnl Check getloadavg
472 dnl
473
474 AC_MSG_CHECKING(for getloadavg)
475 AC_TRY_COMPILE(
476   [#include <stdlib.h>],
477   [double v[3]; getloadavg(v, 3);],
478   [AC_MSG_RESULT(yes)
479    AC_DEFINE(HAVE_GETLOADAVG, 1, [Define if you have getloadavg])],
480   [AC_MSG_RESULT(no)])
481
482 dnl
483 dnl Check popen
484 dnl
485
486 AC_CHECK_FUNCS(popen)
487
488 dnl
489 dnl Da.
490 dnl
491
492 CFLAGS="$CFLAGS -Wall -W"
493
494 AC_SUBST(CFLAGS)
495 AC_SUBST(X11_LIBS)
496
497 AC_OUTPUT
498
499 dnl
500 dnl Print summary
501 dnl
502 cat << EOF
503
504 $PACKAGE $VERSION configured successfully:
505
506  Installing into:       $prefix
507  C compiler flags:      $CFLAGS
508  Linker flags:          $LDFLAGS
509  Libraries:             $LIBS
510
511  * x11:
512   x11 support:          $want_x11
513   xft support:          $want_xft
514   xdamage extension:    $want_xdamage  
515
516  * music detection:
517   audacious:            $want_audacious
518   bmpx:                 $want_bmpx
519   xmms2:                $want_xmms2
520   mpd:                  $want_mpd
521
522  * general:
523   portmon:              $want_portmon  
524   mldonkey:             $want_mldonkey
525   hddtemp:              $want_hddtemp
526
527 EOF