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