Add ARGB visual support.
[monky] / configure.ac.in
1 # -*- mode: Makefile; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
2 #
3 dnl major, minor and micro version macros.
4 m4_define([conky_version_major], [1])
5 m4_define([conky_version_minor], [8])
6 m4_define([conky_version_micro], [0])
7 m4_define([conky_version_tag], [pre]) dnl [] for releases
8 m4_define([conky_version_revision],[_pre@REVISION@])
9 m4_define([conky_version],
10     [conky_version_major().conky_version_minor().conky_version_micro()ifelse(
11       conky_version_tag(), [pre],
12       [conky_version_revision()],
13       [ifelse(conky_version_tag(), [], [], [conky_version_tag()])])])
14
15 AC_INIT([Conky], [conky_version()], [brenden1@users.sourceforge.net])
16
17 AM_INIT_AUTOMAKE(conky, conky_version())
18 AM_CONFIG_HEADER(src/config.h)
19 AC_CONFIG_MACRO_DIR([m4])
20
21 dnl prevent libtool setting LTCFLAGS to default of -g -O2 when CFLAGS unset.
22 dnl libtool must be deleted with make distclean to see this fix.
23 if test x"$CFLAGS" = x""; then
24   AC_SUBST(CFLAGS, [ ])
25 fi
26
27 AC_DEFINE([_GNU_SOURCE], [], [Define for GNU source and extensions])
28
29 dnl
30 dnl Tools
31 dnl
32 AC_PROG_CC
33 AC_PROG_LD
34 AC_PROG_INSTALL
35 AC_PROG_LIBTOOL
36 AM_PROG_LIBTOOL
37 AM_PROG_CC_C_O
38
39 AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
40 if test x"$HAVE_PKGCONFIG" = x"no"; then
41   AC_MSG_ERROR([pkg-config is required!])
42 fi
43 PKG_PROG_PKG_CONFIG([0.19])
44
45 AC_CONFIG_FILES(
46   Makefile
47   data/Makefile
48   doc/Makefile
49   src/Makefile
50   src/build.h
51   lua/Makefile
52   )
53
54 uname=`uname`
55
56 case $uname in
57   Linux*)
58     WANT_SYSINFO=yes
59     ;;
60   FreeBSD*|GNU/kFreeBSD*)
61     WANT_KVM=yes
62     WANT_DEVSTAT=yes
63     ;;
64 #  NetBSD*)
65 #    WANT_KVM=yes
66 #    WANT_OSSLIB=yes
67 #    ;;
68
69   OpenBSD*)
70     WANT_KVM=yes
71     WANT_OSSLIB=yes
72     ;;
73
74 # Solaris doesn't work at all right now
75 #  SunOS*)
76 #    WANT_KSTAT=yes
77 #    ;;
78
79   *)
80     echo "Your operating system $uname isn't supported"
81     echo "Feel free to help. :P"
82     exit 1
83     ;;
84 esac
85
86 AM_CONDITIONAL(BUILD_LINUX, test x$uname = xLinux)
87 #AM_CONDITIONAL(BUILD_SOLARIS, test x$uname = xSunOS)
88 AM_CONDITIONAL(BUILD_FREEBSD, test x$uname = xFreeBSD -o x$uname = xGNU/kFreeBSD)
89 #AM_CONDITIONAL(BUILD_NETBSD, test x$uname = xNetBSD)
90 AM_CONDITIONAL(BUILD_OPENBSD, test x$uname = xOpenBSD)
91
92 BUILD_DATE=$(LANG=en_US LC_ALL=en_US LOCALE=en_US date)
93 BUILD_ARCH="$(uname -sr) ($(uname -m))"
94 AC_SUBST(BUILD_DATE)
95 AC_SUBST(BUILD_ARCH)
96
97
98 dnl
99 dnl BUILD_CONFIG_OUTPUT option
100 dnl
101
102 AC_ARG_ENABLE([config_output],
103               AC_HELP_STRING([--disable-config-output], [disable if you do not want conky to output a default config (with -C) @<:@default=yes@:>@]),
104               [want_config_output="$enableval"], [want_config_output=yes])
105
106 AM_CONDITIONAL(BUILD_CONFIG_OUTPUT, test x$want_config_output = xyes)
107 if test x$want_config_output = xyes; then
108   AC_DEFINE(CONFIG_OUTPUT, 1, [Define if you want conky to output a default config (with -C)])
109   AC_CHECK_FUNCS(fopencookie)
110   AC_CHECK_FUNCS(funopen)
111 fi
112
113 dnl
114 dnl OWN_WINDOW option
115 dnl
116
117 AC_ARG_ENABLE([own_window],
118               AC_HELP_STRING([--disable-own-window],
119                              [disable if you do not want support for creating own window @<:@default=yes@:>@]),
120               [dah="$enableval"], [dah=yes])
121
122 if test $dah != "no"; then
123   AC_DEFINE(OWN_WINDOW, 1, [Define if you want support for window creating])
124 fi
125
126 dnl
127 dnl NCURSES option
128 dnl
129
130 AC_ARG_ENABLE([ncurses],
131               AC_HELP_STRING([--disable-ncurses], [disable if you do not want ncurses support in conky @<:@default=yes@:>@]),
132               [want_ncurses="$enableval"], [want_ncurses=yes])
133
134 AM_CONDITIONAL(BUILD_NCURSES, test x$want_ncurses = xyes)
135 if test x$want_ncurses = xyes; then
136       conky_LIBS="$conky_LIBS -lncurses"
137       AC_DEFINE(NCURSES, 1, [Define for ncurses support])
138 fi
139
140
141 dnl
142 dnl Audacious Media Player
143 dnl
144
145 AC_ARG_ENABLE([audacious],
146               AC_HELP_STRING([--enable-audacious=[[yes|no|legacy]]],
147                              [enable audacious player support @<:@default=no@:>@]),
148               [want_audacious="$enableval"], [want_audacious=no])
149
150 AM_CONDITIONAL(BUILD_AUDACIOUS, test x$want_audacious = xyes -o x$want_audacious = xlegacy)
151 if test x$want_audacious = xyes; then
152       PKG_CHECK_MODULES([Audacious], [audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0])
153       conky_CFLAGS="$conky_CFLAGS $Audacious_CFLAGS"
154       conky_LIBS="$conky_LIBS $Audacious_LIBS"
155       save_CPPFLAGS="$CPPFLAGS"
156       CPPFLAGS="$Audacious_CFLAGS -I`pkg-config --variable=audacious_include_dir audacious`/audacious"
157       AC_CHECK_HEADERS([audacious/audctrl.h audacious/dbus.h glib.h glib-object.h],
158                        [], AC_MSG_ERROR([required header(s) not found]))
159       CPPFLAGS="$save_CPPFLAGS"
160       AC_DEFINE(AUDACIOUS, 1, [Define for Audacious support])
161 else if test x$want_audacious = xlegacy; then
162       PKG_CHECK_MODULES([Audacious], [audacious < 1.4.0 glib-2.0])
163       conky_CFLAGS="$conky_CFLAGS $Audacious_CFLAGS"
164       conky_LIBS="$conky_LIBS $Audacious_LIBS"
165       save_CPPFLAGS="$CPPFLAGS"
166       CPPFLAGS="$Audacious_CFLAGS -I`pkg-config --variable=audacious_include_dir audacious`/audacious"
167       AC_CHECK_HEADERS([audacious/beepctrl.h glib.h], [], AC_MSG_ERROR([required  header(s) not found]))
168       CPPFLAGS="$save_CPPFLAGS"
169       AC_DEFINE(AUDACIOUS, 1, [Define for Audacious support])
170       AC_DEFINE(AUDACIOUS_LEGACY, 1, [Define for Audacious Legacy support])
171       fi
172 fi
173
174
175 dnl
176 dnl BMPx
177 dnl
178
179 AC_ARG_ENABLE([bmpx],
180               AC_HELP_STRING([--enable-bmpx], [enable if you want BMPx support @<:@default=no@:>@]),
181               [want_bmpx="$enableval"], [want_bmpx=no])
182
183 AM_CONDITIONAL(BUILD_BMPX, test x$want_bmpx = xyes)
184 if test x$want_bmpx = xyes; then
185   PKG_CHECK_MODULES([BMPx], [bmp-2.0 >= 0.14.0])
186   conky_CFLAGS="$conky_CFLAGS $BMPx_CFLAGS"
187   conky_LIBS="$conky_LIBS $BMPx_LIBS"
188   AC_DEFINE(BMPX, 1, [Define if you want BMPx support])
189 fi
190
191
192 dnl
193 dnl Support for IBM/Lenovo notebooks
194 dnl
195
196 AC_ARG_ENABLE([ibm],
197               AC_HELP_STRING([--enable-ibm], [enable if you want support for IBM/Lenovo notebooks @<:default=no@:>@]),
198               [want_ibm="$enableval"], [want_ibm=no])
199
200 AM_CONDITIONAL(BUILD_IBM, test x$want_ibm = xyes)
201 if test x$want_ibm = xyes; then
202         if test x"$uname" != xLinux; then
203                 AC_MSG_NOTICE([support for IBM/Lenovo notebooks not supported on $uname... disabling])
204                 want_ibm="not supported on $uname"
205         else
206                 AC_DEFINE(IBM, 1, [Define if you want support for IBM/Lenovo notebooks (SMAPI)])
207         fi
208 fi
209
210
211 dnl
212 dnl Hddtemp
213 dnl
214
215 AC_ARG_ENABLE([hddtemp],
216               AC_HELP_STRING([--disable-hddtemp],
217                              [disable if you do not want hddtemp support @<:@default=yes@:>@]),
218               [want_hddtemp="$enableval"], [want_hddtemp=yes])
219
220 AM_CONDITIONAL(BUILD_HDDTEMP, test x$want_hddtemp = xyes)
221 if test x$want_hddtemp = xyes; then
222   if test x"$uname" != xLinux; then
223       AC_MSG_NOTICE([hddtemp not supported on $uname... disabling])
224       want_hddtemp="not supported on $uname"
225   else
226       AC_DEFINE(HDDTEMP, 1, [Define if you want hddtemp support])
227   fi
228 fi
229
230
231 dnl
232 dnl Apcupsd
233 dnl
234
235 AC_ARG_ENABLE([apcupsd],
236               AC_HELP_STRING([--disable-apcupsd],
237                              [disable if you do not want apcupsd support @<:@default=yes@:>@]),
238               [want_apcupsd="$enableval"], [want_apcupsd=yes])
239
240 if test x$want_apcupsd = xyes; then
241   if test x"$uname" != xLinux; then
242       AC_MSG_NOTICE([apcupsd not supported on $uname... disabling])
243       want_apcupsd="not supported on $uname"
244   else
245       AC_DEFINE(APCUPSD, 1, [Define if you want apcupsd support])
246   fi
247 fi
248 AM_CONDITIONAL(BUILD_APCUPSD, test x$want_apcupsd = xyes)
249
250
251 dnl
252 dnl I/O stats
253 dnl
254
255 AC_ARG_ENABLE([iostats],
256               AC_HELP_STRING([--enable-iostats],
257                              [enable if you want support for per-task I/O statistics @<:@default=yes@:>@]),
258               [want_iostats="$enableval"], [want_iostats=yes])
259
260 if test x$want_iostats = xyes; then
261   if test x"$uname" != xLinux; then
262       AC_MSG_NOTICE([iostats not supported on $uname... disabling])
263       want_iostats="not supported on $uname"
264   else
265       AC_DEFINE(IOSTATS, 1, [Define if you want support for per-task I/O statistics])
266   fi
267 fi
268
269
270 dnl
271 dnl Math
272 dnl
273
274 AC_ARG_ENABLE([math],
275               AC_HELP_STRING([--disable-math], [disable if you do not want math support @<:@default=yes@:>@]),
276               [want_math="$enableval"], [want_math=yes])
277
278 AM_CONDITIONAL(BUILD_MATH, test x$want_math = xyes)
279 if test x$want_math = xyes; then
280   conky_LIBS="$conky_LIBS -lm"
281   AC_DEFINE(MATH, 1, [Define if you want math support])
282 fi
283
284 dnl
285 dnl MPD
286 dnl
287
288 AC_ARG_ENABLE([mpd],
289               AC_HELP_STRING([--disable-mpd], [disable if you do not want MPD support @<:@default=yes@:>@]),
290               [want_mpd="$enableval"], [want_mpd=yes])
291
292 AM_CONDITIONAL(BUILD_MPD, test x$want_mpd = xyes)
293 if test x$want_mpd = xyes; then
294   AC_DEFINE(MPD, 1, [Define if you want MPD support])
295 fi
296
297 dnl
298 dnl MOC
299 dnl
300
301 AC_ARG_ENABLE([moc],
302               AC_HELP_STRING([--disable-moc], [disable if you do not want MOC support @<:@default=yes@:>@]),
303               [want_moc="$enableval"], [want_moc=yes])
304
305 AM_CONDITIONAL(BUILD_MOC, test x$want_moc = xyes)
306 if test x$want_moc = xyes; then
307   AC_DEFINE(MOC, 1, [Define if you want MOC support])
308 fi
309
310 dnl
311 dnl XMMS2
312 dnl
313
314 AC_ARG_ENABLE([xmms2],
315               AC_HELP_STRING([--enable-xmms2], [enable if you want XMMS2 support @<:@default=no@:>@]),
316               [want_xmms2="$enableval"], [want_xmms2=no])
317
318 AM_CONDITIONAL(BUILD_XMMS2, test x$want_xmms2 = xyes)
319 if test x$want_xmms2 = xyes; then
320   PKG_CHECK_MODULES([XMMS2], [xmms2-client] >= [0.6])
321     conky_CFLAGS="$conky_CFLAGS $XMMS2_CFLAGS"
322     conky_LIBS="$conky_LIBS $XMMS2_LIBS"
323     AC_DEFINE(XMMS2, 1, [Define if you want XMMS2 support])
324 fi
325
326 dnl
327 dnl libcurl, see below for more (this has to be above the other uses of want_curl)
328 dnl
329
330 AC_ARG_ENABLE([curl],
331                 AC_HELP_STRING([--enable-curl], [enable if you want curl support @<:@default=no@:>@]),
332                 [want_curl="$enableval"], [want_curl=no])
333
334 dnl
335 dnl EVE Skill Monitor
336 dnl
337
338 AC_ARG_ENABLE([eve],
339               AC_HELP_STRING([--enable-eve], [Eve-Online skill monitor @<:@default=no@:>@]),
340               [want_eve="$enableval"], [want_eve=no])
341
342 AM_CONDITIONAL(BUILD_EVE, test x$want_eve = xyes)
343 if test x$want_eve = xyes; then
344         want_curl=yes
345         want_libxml2=yes
346         AC_DEFINE(EVE, 1, [Define if you want Eve-Online Skill monitor support])
347         AC_DEFINE(EVEURL_TRAINING, "http://api.eve-online.com/char/SkillInTraining.xml.aspx", [Eve training URL])
348         AC_DEFINE(EVEURL_SKILLTREE, "http://api.eve-online.com/eve/Skilltree.xml.aspx", [Eve skilltree URL])
349         AC_DEFINE(MY_ENCODING, "ISO-8859-1", [Textencoding to use])
350         AC_DEFINE(EVE_OUTPUT_FORMAT, "%s %d in %s", [Eve output format])
351 fi
352
353 dnl
354 dnl RSS
355 dnl
356
357 AC_ARG_ENABLE([rss],
358               AC_HELP_STRING([--enable-rss], [enable if you want rss support @<:@default=no@:>@]),
359               [want_rss="$enableval"], [want_rss=no])
360 #
361 AM_CONDITIONAL(BUILD_RSS, test x$want_rss = xyes)
362 if test x$want_rss = xyes; then
363         WANT_GLIB=yes
364         want_curl=yes
365         want_libxml2=yes
366         AC_DEFINE(RSS, 1, [Define if you want Curl support])
367 fi
368
369 dnl
370 dnl WEATHER
371 dnl
372
373 AC_ARG_ENABLE([weather-metar],
374               AC_HELP_STRING([--enable-weather-metar], [enable if you want METAR weather support @<:@default=no@:>@]),
375               [want_metar="$enableval"], [want_metar=no])
376
377 AC_ARG_ENABLE([weather-xoap],
378               AC_HELP_STRING([--enable-weather-xoap], [enable if you want XOAP weather support (also enables METAR) @<:@default=no@:>@]),
379               [want_xoap="$enableval"], [want_xoap=no])
380 #
381 if test x$want_xoap = xyes; then
382         want_metar=yes
383 fi
384 AM_CONDITIONAL(BUILD_WEATHER, test x$want_metar = xyes)
385 AM_CONDITIONAL(BUILD_XOAP, test x$want_xoap = xyes)
386 if test x$want_metar = xyes; then
387         if test x$want_xoap = xyes; then
388                 want_libxml2=yes
389                 AC_DEFINE(XOAP, 1, [Define if you want XOAP weather support])
390                 AC_DEFINE(XOAP_FILE, "$HOME/.xoaprc", [User xoap keys file])
391         fi
392         want_curl=yes
393         AC_DEFINE(WEATHER, 1, [Define if you want METAR weather support])
394 fi
395
396 dnl
397 dnl X11
398 dnl
399
400 AC_ARG_ENABLE([x11],
401               AC_HELP_STRING([--disable-x11], [disable if you do not want X11 support @<:@default=yes@:>@]),
402               [want_x11="$enableval"], [want_x11=yes])
403
404 AM_CONDITIONAL(BUILD_X11, test x$want_x11 = xyes)
405 if test "x$want_x11" = "xyes"; then
406     if $PKG_CONFIG --exists x11; then
407       PKG_CHECK_MODULES([X11], [x11])
408       conky_CFLAGS="$conky_CFLAGS $X11_CFLAGS"
409       conky_LIBS="$conky_LIBS $X11_LIBS"
410     else
411       dnl non-modular X11 installations
412       AC_PATH_X
413       AC_PATH_XTRA
414       conky_CFLAGS="$conky_CFLAGS $X_CFLAGS"
415       conky_LIBS="$conky_LIBS $X_LIBS"
416       conky_LDFLAGS="$conky_LDFLAGS $conky_LIBS $X_PRE_LIBS"
417       if test "x$no_x" = "xyes"; then
418         AC_MSG_ERROR([Can't locate your X11 installation])
419       fi
420       AC_CHECK_LIB([X11], [XOpenDisplay], [], AC_MSG_ERROR([Could not find XOpenDisplay in -lX11]))
421     fi
422     AC_DEFINE(X11, 1, [Define if you want to use X11])
423 fi
424
425 dnl
426 dnl ARGB
427 dnl
428
429 AC_ARG_ENABLE([argb],
430               AC_HELP_STRING([--enable-argb], [enable if you want a argb visual [[default=no]]]),
431               [want_argb="$enableval"], [want_argb=no])
432 if test x$want_argb = xyes; then
433         AC_DEFINE(USE_ARGB, 1, [Define if you want argb visual support])
434 fi
435
436 dnl
437 dnl IMLIB2
438 dnl
439
440 AC_ARG_ENABLE([imlib2],
441                           AC_HELP_STRING([--enable-imlib2], [enable if you want Imlib2 support [[default=no]]]),
442                           [want_imlib2="$enableval"], [want_imlib2=no])
443 AC_ARG_ENABLE([lua-imlib2],
444               AC_HELP_STRING([--enable-lua-imlib2], [enable if you want Lua Imlib2 bindings for Conky @<:@default=no@:>@]),
445               [want_lua_imlib2="$enableval"], [want_lua_imlib2=no])
446
447 # if lua-imlib2 is enabled, we must force imlib2
448 if test x$want_lua_imlib2 = xyes; then
449         want_imlib2=yes
450 fi
451
452 if test x$want_imlib2 = xyes; then
453         if test "x$want_x11" != "xyes"; then
454                 dnl silently disable if no x11
455                 want_imlib2=no
456         else
457                 PKG_CHECK_MODULES([Imlib2], [imlib2])
458                 conky_CFLAGS="$conky_CFLAGS $Imlib2_CFLAGS"
459                 conky_LIBS="$conky_LIBS $Imlib2_LIBS"
460                 AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support])
461         fi
462 fi
463 AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes)
464
465 dnl
466 dnl Lua
467 dnl
468
469 AC_ARG_ENABLE([lua],
470               AC_HELP_STRING([--enable-lua], [enable if you want Lua scripting support @<:@default=yes@:>@]),
471               [want_lua="$enableval"], [want_lua=yes])
472 AC_ARG_ENABLE([lua-cairo],
473               AC_HELP_STRING([--enable-lua-cairo], [enable if you want Lua Cairo bindings for Conky @<:@default=no@:>@]),
474               [want_lua_cairo="$enableval"], [want_lua_cairo=no])
475 need_tolua=no
476 if test x$want_lua_cairo = xyes -o x$want_lua_imlib2 = xyes; then
477         need_tolua=yes
478         want_lua=yes
479 fi
480
481 AM_CONDITIONAL(BUILD_LUA, test x$want_lua = xyes)
482 if test x$want_lua = xyes; then
483         PKG_CHECK_MODULES(LUA, lua >= 5.1, [ ],[
484                 PKG_CHECK_MODULES(LUA51, lua-5.1 >= 5.1, [ ],[
485                         PKG_CHECK_MODULES(LUA51, lua5.1 >= 5.1)
486                 ])
487         ])
488         conky_CFLAGS="$conky_CFLAGS $LUA_CFLAGS $LUA51_CFLAGS"
489         conky_LIBS="$conky_LIBS $LUA_LIBS $LUA51_LIBS"
490
491         if test x$need_tolua = xyes; then
492                 AC_DEFINE(LUA_EXTRAS, 1, [Define if you want Lua extras])
493                 if test "x$want_x11" != "xyes"; then
494                         dnl silently disable if no x11
495                         want_lua_cairo=no
496                 else
497                         if test x$want_lua_cairo = xyes; then
498                                 PKG_CHECK_MODULES([cairo], cairo)
499                                 PKG_CHECK_MODULES([cairo_xlib], cairo-xlib)
500                                 AC_DEFINE(HAVE_LUA_CAIRO, 1, [Define if you want Lua Cairo bindings for Conky])
501                                 libcairo_CFLAGS="$libcairo_CFLAGS $cairo_CFLAGS $cairo_xlib_CFLAGS"
502                                 libcairo_LIBS="$libcairo_LIBS $cairo_LIBS $cairo_xlib_LIBS"
503                         fi
504                         if test x$want_imlib2 = xyes; then
505                                 AC_DEFINE(HAVE_LUA_IMLIB2, 1, [Define if you want Lua Imlib2 bindings for Conky])
506                         fi
507                 fi
508                 AC_CHECK_PROGS(toluapp, [tolua++ tolua++5.1 tolua++-5.1], no)
509                 if test x$toluapp = xno; then
510                         AC_MSG_ERROR([tolua++, tolua++5.1, or tolua++-5.1 is required for Lua extras.])
511                 else
512                         AC_SEARCH_LIBS(tolua_error,
513                                                    [tolua++-5.1 tolua++ tolua++5.1],
514                                                    [
515                                                         AC_SUBST(tolua_LIBS, "${LIBS}")
516                                                         AC_SUBST(tolua_CFLAGS, "${CFLAGS}")
517                                                         ],
518                                                    AC_MSG_ERROR([tolua_error not found]),
519                                                    [$LUA_LIBS $LUA51_LIBS])
520                 fi
521                 conky_LIBS="$conky_LIBS $tolua_LIBS"
522                 tolua_CFLAGS="$tolua_CFLAGS $LUA_CFLAGS $LUA51_CFLAGS"
523                 tolua_LIBS="$tolua_LIBS $LUA_LIBS $LUA51_LIBS"
524         fi
525         AC_DEFINE(HAVE_LUA, 1, [Define if you want Lua scripting support])
526 fi
527 AM_CONDITIONAL(BUILD_LUA_CAIRO, test x$want_lua_cairo = xyes)
528 AM_CONDITIONAL(BUILD_LUA_IMLIB2, test x$want_lua_imlib2 = xyes)
529
530 dnl
531 dnl Wireless extensions
532 dnl
533
534 AC_ARG_ENABLE([wlan],
535               AC_HELP_STRING([--enable-wlan], [enable if you want wireless support @<:@default=no@:>@]),
536               [want_wlan="$enableval"], [want_wlan=no])
537
538 AM_CONDITIONAL(BUILD_WLAN, test x$want_wlan = xyes)
539 if test x$want_wlan = xyes; then
540   AC_CHECK_HEADERS([iwlib.h], [], AC_MSG_ERROR([iwlib.h header not found]))
541   AC_CHECK_LIB([iw], [iw_sockets_open], [conky_LIBS="$conky_LIBS -liw"], AC_MSG_ERROR([iw_sockets_open not found]))
542         AC_DEFINE(HAVE_IWLIB, 1, [Define if you want wireless support])
543 fi
544
545 dnl
546 dnl PORT_MONITORS
547 dnl
548
549 AC_ARG_ENABLE([portmon],
550               AC_HELP_STRING([--disable-portmon],
551                              [disable if you do not want tcp (ip4) port monitoring @<:@default=yes@:>@]),
552               [want_portmon="$enableval"], [want_portmon=yes])
553
554 if test x"$want_portmon" = xyes; then
555   if test x"$uname" != xLinux; then
556       AC_MSG_NOTICE([port monitors not supported on $uname... disabling])
557       want_portmon="not supported on $uname"
558   else
559         AC_CHECK_FUNCS([getnameinfo], [], AC_MSG_ERROR([getnameinfo function not found]))
560         AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h sys/socket.h arpa/inet.h], [],
561            [PORT_MONITORS_MISSING=yes])
562         if test x"$PORT_MONITORS_MISSING" = xyes; then
563               AC_MSG_ERROR([missing a needed network header for port monitoring])
564         fi
565         WANT_GLIB=yes
566         AC_DEFINE(TCP_PORT_MONITOR, 1, [Define if you want tcp port monitoring support])
567   fi
568 fi
569 AM_CONDITIONAL(BUILD_PORT_MONITORS, test x"$want_portmon" = xyes)
570
571
572 dnl
573 dnl ICONV
574 dnl
575
576 m4_pattern_allow([AM_ICONV])
577 AM_ICONV
578 if test "$am_cv_func_iconv" != yes; then
579   AC_MSG_WARN([Could not find libiconv])
580 else
581   conky_LIBS="$conky_LIBS $LIBICONV"
582 fi
583 AM_CONDITIONAL(BUILD_ICONV, test "$am_cv_func_iconv" = yes)
584
585 dnl
586 dnl Xext Double-buffering Extension
587 dnl
588
589 AC_ARG_ENABLE([double_buffer],
590               AC_HELP_STRING([--disable-double-buffer],
591                              [disable for no Xdbe double-buffering support @<:@default=yes@:>@]),
592               [want_double_buffer="$enableval"], [want_double_buffer=yes])
593
594 if test "x$want_double_buffer" = "xyes"; then
595     if test "x$want_x11" != "xyes"; then
596       dnl silently disable if no x11
597       want_double_buffer=no
598     else
599       if $PKG_CONFIG --exists xext; then
600         PKG_CHECK_MODULES([Xext],[xext])
601         conky_CFLAGS="$conky_CFLAGS $Xext_CFLAGS"
602         conky_LIBS="$conky_LIBS $Xext_LIBS"
603       else
604         dnl non-modular X11 installation
605         AC_CHECK_LIB([Xext], [XdbeQueryExtension], [conky_LIBS="$conky_LIBS -lXext"],
606                     AC_MSG_ERROR([Could not find XdbeQueryExtension in -lXext]))
607       fi
608       AC_DEFINE(HAVE_XDBE, 1, [Define for X11 double-buffering])
609     fi
610 fi
611
612
613 dnl
614 dnl Xdamage Extension
615 dnl
616
617 AC_ARG_ENABLE([xdamage],
618               AC_HELP_STRING([--disable-xdamage],
619                              [disable if you do not want Xdamage support @<:@default=yes@:>@]),
620               [want_xdamage="$enableval"], [want_xdamage=yes])
621
622 if test "x$want_xdamage" = "xyes"; then
623     if test "x$want_x11" != "xyes"; then
624       dnl silently disable if no x11
625       want_xdamage=no
626     else
627       if $PKG_CONFIG --exists xdamage; then
628         PKG_CHECK_MODULES([XDamage],[xdamage])
629         conky_CFLAGS="$conky_CFLAGS $XDamage_CFLAGS"
630         conky_LIBS="$conky_LIBS $XDamage_LIBS"
631       else
632         dnl non-modular X11 installation
633                 AC_CHECK_LIB([Xdamage], [XDamageQueryExtension], [conky_LIBS="$conky_LIBS -lXdamage"],
634                      AC_MSG_ERROR([Could not find XDamageQueryExtension in -lXdamage]))
635       fi
636       AC_DEFINE(HAVE_XDAMAGE, 1, [Define for X11 Xdamage extension])
637     fi
638 fi
639
640
641 dnl
642 dnl Xft
643 dnl
644
645 AC_ARG_ENABLE([xft],
646               AC_HELP_STRING([--disable-xft], [disable if you do not want to use Xft @<:@default=yes@:>@]),
647               [want_xft="$enableval"], [want_xft=yes])
648
649 if test x$want_xft = "xyes"; then
650     if test "x$want_x11" != "xyes"; then
651       dnl silently disable if no x11
652       want_xft=no
653     else
654       PKG_CHECK_MODULES([Xft], [xft])
655       conky_CFLAGS="$conky_CFLAGS $Xft_CFLAGS"
656       conky_LIBS="$conky_LIBS $Xft_LIBS"
657       AC_DEFINE(XFT, 1, [Define for Xft support])
658     fi
659 fi
660
661 dnl
662 dnl NVIDIA libXNVCtrl support
663 dnl
664
665 AC_ARG_ENABLE([nvidia],
666                 AC_HELP_STRING([--enable-nvidia], [enable if you want nvidia support @<:@default=no@:>@]),
667                 [want_nvidia="$enableval"], [want_nvidia=no])
668 if test x$want_nvidia = xyes; then
669     if test "x$want_x11" != "xyes"; then
670                 # do nada
671                 want_nvidia=no
672         else
673                 AC_CHECK_HEADERS([NVCtrl/NVCtrl.h], [], AC_MSG_ERROR([NVCtrl/NVCtrl.h header not found]))
674 dnl AC_CHECK_LIB([XNVCtrl], [XNVCTRLQueryVersion], [] ,[AC_MSG_ERROR([grrr])] )
675 dnl AC_CHECK_LIB([XNVCtrl], [XNVCTRLCheckTargetData], [], [AC_MSG_ERROR([grr])])
676 dnl ## am I Stupid ??
677 dnl ## it won't find the lib for some reason!?
678                 conky_LIBS="$conky_LIBS -lXNVCtrl"
679                         AC_DEFINE(NVIDIA, 1, [Define if you want nvidia support])
680         fi
681 fi
682 AM_CONDITIONAL(BUILD_NVIDIA, test x$want_nvidia = xyes)
683
684 dnl
685 dnl GLIB
686 dnl
687
688 if test x$WANT_GLIB = xyes; then
689         PKG_CHECK_MODULES([GLib2], [glib-2.0])
690         conky_CFLAGS="$conky_CFLAGS $GLib2_CFLAGS"
691         conky_LIBS="$conky_LIBS $GLib2_LIBS"
692 fi
693
694 dnl
695 dnl libcurl
696 dnl
697
698 if test x$want_curl = xyes; then
699         PKG_CHECK_MODULES([libcurl], libcurl)
700         conky_CFLAGS="$conky_CFLAGS $libcurl_CFLAGS"
701         conky_LIBS="$conky_LIBS $libcurl_LIBS"
702         AC_DEFINE(HAVE_CURL, 1, [Define if you want Curl support])
703 fi
704 AM_CONDITIONAL(BUILD_CURL, test x$want_curl = xyes)
705
706 dnl
707 dnl libx
708 dnl
709
710 if test x$want_libxml2 = xyes; then
711         PKG_CHECK_MODULES([libxml2], libxml-2.0)
712         conky_CFLAGS="$conky_CFLAGS $libxml2_CFLAGS"
713         conky_LIBS="$conky_LIBS $libxml2_LIBS"
714 fi
715
716 dnl
717 dnl KVM
718 dnl
719
720 if test x$WANT_KVM = xyes; then
721   AC_CHECK_LIB(kvm, kvm_open,
722     conky_LIBS="$conky_LIBS -lkvm",
723   AC_MSG_ERROR([Could not find kvm_open in -lkvm.])
724   )
725 fi
726
727 dnl
728 dnl devstat
729 dnl
730
731 if test x$WANT_DEVSTAT = xyes; then
732   AC_CHECK_LIB(devstat, devstat_getversion,
733          conky_LIBS="$conky_LIBS -ldevstat",
734          AC_MSG_ERROR([Cound not find devstat_getversion in -ldevstat.])
735   )
736 fi
737
738 dnl
739 dnl OSSLIB for NetBSD/OpenBSD
740 dnl
741
742 if test x$WANT_OSSLIB = xyes; then
743     AC_CHECK_LIB(ossaudio, _oss_ioctl,
744   conky_LIBS="$conky_LIBS -lossaudio",
745   AC_MSG_ERROR([Could not find oss_ioctl in -lossaudio.])
746     )
747 fi
748
749 dnl
750 dnl ALSA for Linux
751 dnl
752 AC_ARG_ENABLE([alsa],
753               AC_HELP_STRING([--disable-alsa], [disable if you do not
754   want ALSA support @<:@default=yes@:>@]),
755               [want_alsa="$enableval"], [want_alsa=yes])
756
757 if test x$want_alsa = xyes; then
758     AC_CHECK_HEADER(alsa/asoundlib.h,, want_alsa=no)
759 fi
760 if test x$want_alsa = xyes; then
761     AC_CHECK_LIB(asound, snd_pcm_open,conky_LIBS="$conky_LIBS -lasound", want_alsa=no)
762 fi
763 if test x$want_alsa = xyes; then
764 AC_DEFINE(MIXER_IS_ALSA, 1, [Define if the mixers use ALSA])
765 fi
766 dnl
767 dnl Some headers
768 dnl
769
770 AC_CHECK_HEADERS([signal.h unistd.h sys/utsname.h sys/stat.h linux/soundcard.h alsa/asoundlib.h dirent.h mcheck.h \
771       sys/statfs.h sys/param.h pthread.h semaphore.h assert.h errno.h time.h])
772 AC_CHECK_HEADERS([sys/mount.h], [], [],
773      [#ifdef HAVE_SYS_PARAM_H
774       #include <sys/param.h>
775       #endif
776       ])
777 # check if we have inotify support
778 AC_CHECK_HEADERS([sys/inotify.h])
779
780 dnl
781 dnl Some defines
782 dnl
783
784 AC_DEFINE(DEFAULTNETDEV, "eth0", [Default networkdevice])
785 AC_DEFINE(CONFIG_FILE, "$HOME/.conkyrc", [Configfile of the user])
786 AC_DEFINE(MAX_SPECIALS_DEFAULT, 512, [Default maximum number of special things, e.g. fonts, offsets, aligns, etc.])
787 AC_DEFINE(MAX_USER_TEXT_DEFAULT, 16384, [Default maximum size of config TEXT buffer, i.e. below TEXT line.])
788 AC_DEFINE(DEFAULT_TEXT_BUFFER_SIZE, 256, [Default size used for temporary, static text buffers])
789 AC_DEFINE(MAX_NET_INTERFACES, 16, [Maximum number of network devices])
790
791 dnl
792 dnl Some functions
793 dnl
794
795 AC_CHECK_FUNCS([calloc malloc free popen sysinfo getloadavg memrchr strndup gethostbyname_r])
796 AC_SEARCH_LIBS(clock_gettime, [rt], conky_LIBS="$conky_LIBS $LIBS"
797                [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])],
798                [AC_CHECK_FUNCS([gettimeofday], [], [AC_MSG_ERROR([gettimeofday() not available!])])], [])
799
800 dnl
801 dnl Structure checks
802 dnl
803
804 AC_CHECK_MEMBER([struct statfs.f_fstypename],
805                  [AC_DEFINE(HAVE_STRUCT_STATFS_F_FSTYPENAME, 1, [Define if struct statfs has the f_fstypename member])],
806                  [],
807                  [#include <sys/statfs.h>])
808
809 dnl
810 dnl Check for zlib
811 dnl
812
813 AC_CHECK_HEADER(zlib.h,
814                 [],
815                 [AC_MSG_ERROR([zlib is missing; please install the headers first])])
816
817
818 dnl
819 dnl Check for OpenMP support
820 dnl
821 dnl removed for now due to problems with GCC's OpenMP implementation
822
823 dnl AC_ARG_ENABLE([openmp],
824 dnl           AC_HELP_STRING([--enable-openmp], [enable if you want OpenMP support @<:@default=no@:>@]),
825 dnl           [want_openmp="$enableval"], [want_openmp=no])
826
827 dnl if test x$want_openmp = xyes; then
828 dnl     AX_OPENMP([
829 dnl       gcc_version=`$CC -dumpversion`
830 dnl       gcc_major=`echo $gcc_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
831 dnl       gcc_minor=`echo $gcc_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
832 dnl       dnl check that the gcc version is >=4.3, if we're using gcc
833 dnl       if test ! "x$GCC" = "xyes" -o $gcc_major -ge 4 -a $gcc_minor -ge 3; then
834 dnl         AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])
835 dnl         conky_CFLAGS="$conky_CFLAGS $OPENMP_CFLAGS"
836 dnl       else
837 dnl         want_openmp=no
838 dnl       fi
839 dnl     ])
840 dnl fi
841
842 dnl
843 dnl Check doc stuff
844 dnl
845
846 AC_CHECK_PROGS(db2x_xsltproc_cmd, db2x_xsltproc)
847 AC_CHECK_PROGS(db2x_manxml_cmd, db2x_manxml)
848 AC_CHECK_PROGS(xsltproc_cmd, xsltproc)
849 if test x$db2x_xsltproc_cmd = "x" -o x$xsltproc_cmd = "x"; then
850   AM_CONDITIONAL(HAVE_DOCSTUFF, false)
851 else
852   AM_CONDITIONAL(HAVE_DOCSTUFF, true)
853 fi
854
855 dnl
856 dnl kstat in Solaris
857 dnl
858
859 if test x$WANT_KSTAT = xyes; then
860   dah=no
861   AC_CHECK_LIB([kstat], [kstat_open], [dah=yes], [])
862
863   if test x$dah = xyes; then
864     AC_DEFINE(HAVE_KSTAT, 1, [Define if you have kstat (Solaris)])
865     conky_LDFLAGS="$conky_LDFLAGS -lkstat"
866   fi
867 fi
868
869 AC_DEFUN([AM_LANGINFO_CODESET],
870 [
871   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
872     [AC_TRY_LINK([#include <langinfo.h>],
873       [char* cs = nl_langinfo(CODESET);],
874       am_cv_langinfo_codeset=yes,
875       am_cv_langinfo_codeset=no)
876     ])
877   if test $am_cv_langinfo_codeset = yes; then
878     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
879       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
880   fi
881 ])
882
883
884 dnl ************************
885 dnl * Linker optimizations *
886 dnl ************************
887 AC_MSG_CHECKING([if $LD accepts -O1])
888 case `$LD -O1 -v 2>&1 </dev/null` in
889 *GNU* | *BSD*)
890   conky_LDFLAGS="$conky_LDFLAGS -Wl,-O1"
891   AC_MSG_RESULT([yes])
892   ;;
893 *)
894   AC_MSG_RESULT([no])
895   ;;
896 esac
897
898 dnl Solve multiple definitions (only necessary when gnulib is used)
899 dnl conky_LDFLAGS="$conky_LDFLAGS -Xlinker -zmuldefs"
900
901 dnl
902 dnl Da.
903 dnl
904
905 conky_CFLAGS="$conky_CFLAGS -Wall -W"
906
907 dnl
908 dnl debug
909 dnl
910
911 AC_ARG_ENABLE([debug],
912               AC_HELP_STRING([--enable-debug], [compile with debug symbols @<:@default=no@:>@]),
913               [want_debug="$enableval"], [want_debug=no])
914
915 if test "x$want_debug" = "xyes" -a $ac_cv_c_compiler_gnu != no; then
916   conky_CFLAGS="$conky_CFLAGS -g3 -O0"
917   AC_DEFINE([DEBUG], 1, [Define for debugging])
918 fi
919
920 dnl
921 dnl testing
922 dnl
923
924 AC_ARG_ENABLE([testing],
925               AC_HELP_STRING([--enable-testing], [use strict compiler flags for testing @<:@default=no@:>@]),
926               [want_testing="$enableval"], [want_testing=no])
927
928 if test "x$want_testing" = "xyes" -a $ac_cv_c_compiler_gnu != no; then
929   if test "x$want_debug" = "xyes"; then
930     conky_CFLAGS="$conky_CFLAGS -Wextra -Wunused -Wdeclaration-after-statement -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Winline -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -std=c99 -pedantic -Werror"
931     AC_DEFINE([TESTING], [], [Define for testing (enables strict compiler flags)])
932   else
933     conky_CFLAGS="$conky_CFLAGS -O0 -g3 -Wextra -Wunused -Wdeclaration-after-statement -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Winline -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -std=c99 -pedantic -Werror"
934     AC_DEFINE([TESTING], [], [Define for testing (enables strict compiler flags)])
935   fi
936 fi
937
938 dnl
939 dnl profiling
940 dnl
941
942 AC_ARG_ENABLE([profiling],
943               AC_HELP_STRING([--enable-profiling], [specify compiler flags for use with gprof and gcov @<:@default=no@:>@]),
944               [want_profiling="$enableval"], [want_profiling=no])
945
946 if test "x$want_profiling" = "xyes" -a $ac_cv_c_compiler_gnu != no; then
947   if test "x$want_debug" = "xyes"; then
948     conky_CFLAGS="$conky_CFLAGS -pg -fprofile-arcs -ftest-coverage"
949   else
950     conky_CFLAGS="$conky_CFLAGS -g3 -pg -fprofile-arcs -ftest-coverage"
951   fi
952   AC_DEFINE([PROFILING], [], [Define for profiling (gprof and gcov) support])
953 fi
954
955 AC_SUBST(conky_CFLAGS)
956 AC_SUBST(conky_LIBS)
957 AC_SUBST(X11_LIBS)
958
959 AC_OUTPUT
960
961 dnl
962 dnl Print summary
963 dnl
964 cat << EOF
965
966 $PACKAGE $VERSION configured successfully:
967
968  Installing into:   $prefix
969  System config dir: $sysconfdir
970  C compiler flags:  $conky_CFLAGS
971  Libraries:         $conky_LIBS
972  Linker flags:      $conky_LDFLAGS
973
974  * X11:
975   X11 support:      $want_x11
976   XDamage support:  $want_xdamage
977   XDBE support:     $want_double_buffer
978   Xft support:      $want_xft
979   ARGB support      $want_argb
980
981  * Music detection:
982   Audacious:        $want_audacious
983   BMPx:             $want_bmpx
984   MPD:              $want_mpd
985   MOC:              $want_moc
986   XMMS2:            $want_xmms2
987
988  * General:
989 dnl  OpenMP:           $want_openmp
990   math:             $want_math
991   hddtemp:          $want_hddtemp
992   portmon:          $want_portmon
993   RSS:              $want_rss
994   Curl:             $want_curl
995   Weather
996     METAR:          $want_metar
997     XOAP:           $want_xoap
998   wireless:         $want_wlan
999   IBM:              $want_ibm
1000   nvidia:           $want_nvidia
1001   eve-online:       $want_eve
1002   config-output:    $want_config_output
1003   Imlib2:           $want_imlib2
1004   ALSA mixer:       $want_alsa
1005   apcupsd:          $want_apcupsd
1006   I/O stats:        $want_iostats
1007
1008  * Lua ($want_lua) bindings:
1009   Cairo:            $want_lua_cairo
1010   Imlib2:           $want_lua_imlib2
1011
1012 EOF