Add indicator applet, turn off by default
[lxde/lxpanel.git] / configure.ac
1 AC_PREREQ(2.53)
2 AC_INIT(lxpanel, 0.5.8, http://lxde.org/)
3 AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign])
4 AC_CONFIG_HEADER([config.h])
5
6 # Support silent build rules. Disable by either passing --disable-silent-rules
7 # to configure or passing V=1 to make
8 AM_SILENT_RULES([yes])
9
10 # Force to dynamic
11 AC_DISABLE_STATIC
12
13 # Checks for programs.
14 AC_PROG_CC
15 AC_PROG_INSTALL
16 AC_PROG_LN_S
17 AC_PROG_INTLTOOL(, [no-xml])
18 AM_PROG_CC_C_O
19
20 #Initialize libtool
21 LT_PREREQ([2.2])
22 LT_INIT
23
24 # Checks for libraries.
25 AC_ARG_ENABLE(gtk3,
26 AC_HELP_STRING([--enable-gtk3],[enable to use gtk-3.0 instead of gtk-2.0]),
27 [case "${enableval}" in
28   yes)  enable_gtk3=yes ;;
29   no)   enable_gtk3=no ;;
30   *) AC_MSG_ERROR([bad value "${enableval}" for --enable-gtk3, use "yes" (default) or "no".]) ;;
31 esac],[])
32
33 if test "x$enable_gtk3" = "xyes" ; then
34   CFLAGS="$CFLAGS -DENABLE_GTK3"
35   pkg_modules="$pkg_modules gtk+-3.0"
36 else
37   pkg_modules="$pkg_modules gtk+-2.0 >= 2.12.0"
38 fi
39
40 pkg_modules="$pkg_modules \
41              gio-unix-2.0 \
42              gthread-2.0 \
43              libmenu-cache"
44 #             libstartup-notification-1.0"
45 PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
46 AC_SUBST(PACKAGE_CFLAGS)
47 AC_SUBST(PACKAGE_LIBS)
48
49 ###########################
50 # Indicator Info
51 ###########################
52 AC_ARG_ENABLE([indicator_support],
53     AS_HELP_STRING([--enable-indicator-support],
54                [enable plugin loading (default: disable)]),
55                indicator_support=$enableval, indicator_support="no")
56 AM_CONDITIONAL(ENABLE_INDICATOR_SUPPORT, test x"$indicator_support" = x"yes")
57
58 if test "$indicator_support" != "no"; then
59         INDICATOR_REQUIRED_VERSION=0.3.0
60         INDICATOR_PKG_NAME=indicator-0.4
61
62         PKG_CHECK_MODULES(APPLET, $INDICATOR_PKG_NAME >= $INDICATOR_REQUIRED_VERSION)
63         AC_SUBST(APPLET_CFLAGS)
64
65         if test "x$with_localinstall" = "xyes"; then
66                 INDICATORDIR="${libdir}/indicators/2/"
67                 INDICATORICONSDIR="${datadir}/indicator-applet/icons/"
68         else
69                 INDICATORDIR=`$PKG_CONFIG --variable=indicatordir $INDICATOR_PKG_NAME`
70                 INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir $INDICATOR_PKG_NAME`
71 fi
72         AC_SUBST(INDICATORDIR)
73         AC_SUBST(INDICATORICONSDIR)
74 fi
75
76
77 pkg_modules="x11"
78 PKG_CHECK_MODULES(X11, [$pkg_modules])
79 AC_SUBST(X11_LIBS)
80
81 pkg_modules="libwnck-1.0"
82 PKG_CHECK_MODULES(WNCK, [$pkg_modules])
83 AC_SUBST(WNCK_CFLAGS)
84 AC_SUBST(WNCK_LIBS)
85
86 pkg_modules="libmenu-cache"
87 PKG_CHECK_MODULES(MENU_CACHE, [$pkg_modules],
88                   enable_menu_cache=yes, enable_menu_cache=no)
89 if test x"$enable_menu_cache" = "xno"; then
90         AC_WARN([No libmenu-cache found.  All menu related routines are not built.])
91         AC_DEFINE(DISABLE_MENU, [1], [Disable menu related routines])
92 fi
93 AC_SUBST(MENU_CACHE_CFLAGS)
94 AC_SUBST(MENU_CACHE_LIBS)
95 AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
96
97 AC_ARG_ENABLE(more_warnings,
98        [AC_HELP_STRING([--enable-more-warnings],
99                [Add more warnings @<:@default=no@:>@])],
100        [enable_more_warnings="${enableval}"],
101        [enable_more_warnings=no]
102 )
103
104 if test x"$enable_more_warnings" = x"yes"; then
105   ADDITIONAL_FLAGS="-Wall -Werror=all -Werror=format -Werror=implicit-function-declaration -Werror=implicit-int -Werror=missing-braces -Werror=parentheses -Werror=return-type -Werror=strict-aliasing -Werror=switch -Wuninitialized -Werror=unused-label -Werror=unused-value -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Werror=missing-declarations -Wredundant-decls -Wmissing-noreturn -Wpointer-arith -Wcast-align -Wwrite-strings -Werror=inline -Werror=format-nonliteral -Wformat-nonliteral -Werror=format-security -Wformat-security -Winit-self -Werror=missing-include-dirs -Werror=undef -Werror=aggregate-return -Wmissing-format-attribute -Werror=nested-externs -fno-strict-aliasing -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES"
106 fi
107 AC_SUBST(ADDITIONAL_FLAGS)
108
109 PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
110 PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
111
112 AC_ARG_ENABLE(man,
113         [AC_HELP_STRING([--enable-man],
114                 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
115         [enable_man="${enableval}"],
116         [enable_man=no]
117 )
118
119 AC_ARG_ENABLE([cast-checks],
120     AS_HELP_STRING([--enable-cast-checks],
121                [enable Glib casting checks (default: disable)]),
122                cast_checks=$enableval, cast_checks="no")
123 G_CAST_CHECKS=""
124 if test x"$cast_checks" = "xno"; then
125     G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
126 fi
127 AC_SUBST(G_CAST_CHECKS)
128
129 dnl linker tweaking
130 # The function of the link flag --as-needed is to prevent unnecesary linking.
131 # Example: A -> B -> C
132 # Normally, A would link to B and also depend on C, this is of cource
133 # unnecesary. In this situation, however we do need to link to C, so this
134 # must be done explicitly. This flag comes in handy when a library ABI
135 # is changed, minimizing the amount of recompilations needed.
136 AC_MSG_CHECKING([whether $LD accepts --as-needed])
137 case `$LD --as-needed -v 2>&1 </dev/null` in
138 *GNU* | *'with BFD'*)
139     LDFLAGS="$LDFLAGS -Wl,--as-needed"
140     AC_MSG_RESULT([yes])
141     ;;
142 *)
143     AC_MSG_RESULT([no])
144     ;;
145 esac
146
147 dnl linker optimizations
148 AC_MSG_CHECKING([whether $LD accepts -O1])
149 case `$LD -O1 -v 2>&1 </dev/null` in
150 *GNU* | *'with BFD'*)
151   LDFLAGS="$LDFLAGS -Wl,-O1"
152   AC_MSG_RESULT([yes])
153   ;;
154 *)
155   AC_MSG_RESULT([no])
156   ;;
157 esac
158 AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
159 case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
160 *GNU* | *'with BFD'*)
161   LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
162   AC_MSG_RESULT([yes])
163   ;;
164 *)
165   AC_MSG_RESULT([no])
166   ;;
167 esac
168 AC_MSG_CHECKING([whether $LD accepts --sort-common])
169 case `$LD --sort-common -v 2>&1 </dev/null` in
170 *GNU* | *'with BFD'*)
171   LDFLAGS="$LDFLAGS -Wl,--sort-common"
172   AC_MSG_RESULT([yes])
173   ;;
174 *)
175   AC_MSG_RESULT([no])
176   ;;
177 esac
178
179 dnl FIXME: filter for undefined symbols in plugins
180 # when passing "-z defs" to linker, we would better to make sure
181 # there are no undefined references.  However, we intend not to
182 # fix at the moment since we don't have spin-off libraray containing
183 # the necessary functions.
184 if test ! -z "$LDFLAGS"; then
185     LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
186 fi
187
188 LXPANEL_MODULE="-avoid-version \
189 -rpath \$(libdir)/lxpanel/plugins \
190 -no-undefined "'-export-symbols-regex "^[[^_]].*"'
191 AC_SUBST(LXPANEL_MODULE)
192
193 AC_ARG_ENABLE([alsa],
194     AS_HELP_STRING([--disable-alsa],
195                     [compile ALSA providers (default: enable)]),
196             compile_alsa=$enableval, compile_alsa="yes")
197 if test x"$compile_alsa" = "xyes"; then
198     AC_CHECK_HEADERS([alsa/asoundlib.h],
199                      [AC_CHECK_LIB([asound],
200                                    [snd_seq_open],
201                                    compile_alsa=yes,compile_alsa=no)],
202                           compile_alsa=no)
203 fi
204 AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
205 dnl FIXME: check OSS existence
206 AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
207
208 AC_ARG_ENABLE([plugins-loading],
209     AS_HELP_STRING([--disable-plugins-loading],
210                [disable plugin loading (default: enable)]),
211                plugins_loading=$enableval, plugins_loading="yes")
212
213 AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
214
215 if test x"$plugins_loading" = "xno"; then
216     AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
217 fi
218
219 dnl Here are plugin listing.
220 plugin_netstatus=
221 plugin_volume=
222 plugin_volumealsa=
223 plugin_cpu=
224 plugin_deskno=
225 plugin_batt=
226 plugin_xkb=
227 plugin_kbled=
228 plugin_thermal=
229 plugin_cpufreq=
230 plugin_monitors=
231 plugin_wnckpager=
232 plugin_indicator=
233
234 AC_MSG_CHECKING([which plugins should be built dynamically])
235 AC_ARG_WITH(plugins,
236 [  --with-plugins=<list>  compile dynamic plugins in <list> ]
237 [                         plugins may be comma separated ]
238 [                         'all' builds all plugins (default), 'none' builds none ]
239 [                         Possible plugins are: ]
240 [                         netstatus, volume, volumealsa, cpu, deskno, batt, kbled, xkb, thermal, cpufreq, monitors, wnckpager], plugins="$withval",[plugins="all"])
241
242 if test x"$plugins" != xall -a x"$plugins" != xnone; then
243     if test x"$plugins_loading" = xno; then
244         AC_MSG_ERROR(
245         [--disable-plugins-loading and --with-plugins conflict each other.])
246     fi
247 fi
248
249 ALL_PLUGINS_LIST="netstatus volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors wnckpager"
250 AC_SUBST(ALL_PLUGINS_LIST)
251
252 if test x"$plugins" = xall; then
253 dnl    for name in $ALL_PLUGINS
254 dnl    do
255 dnl        export plugin_$name="$name"
256 dnl    done
257
258     plugin_netstatus=netstatus
259     plugin_volume=volume
260     plugin_volumealsa=volumealsa
261     plugin_cpu=cpu
262     plugin_deskno=deskno
263     plugin_batt=batt
264     plugin_kbled=kbled
265     plugin_xkb=xkb
266     plugin_thermal=thermal
267     plugin_cpufreq=cpufreq
268     plugin_monitors=monitors
269     plugin_wnckpager=wnckpager
270     plugin_indicator=indicator
271
272     AC_MSG_RESULT(all)
273 else
274     if test "$plugins" != "none"; then
275         plugins=`echo $plugins | sed 's/,/ /g'`
276         for plugin in $plugins
277         do
278         case "$plugin" in
279             netstatus)
280                 plugin_netstatus=netstatus
281                 ;;
282             volume)
283                 plugin_volume=volume
284                 ;;
285             volumealsa)
286                 plugin_volumealsa=volumealsa
287                 ;;
288             cpu)
289                 plugin_cpu=cpu
290                 ;;
291             deskno)
292                 plugin_deskno=deskno
293                 ;;
294             batt)
295                 plugin_batt=batt
296                 ;;
297             kbled)
298                 plugin_kbled=kbled
299                 ;;
300             xkb)
301                 plugin_xkb=xkb
302                 ;;
303             thermal)
304                 plugin_thermal=thermal
305                 ;;
306             cpufreq)
307                 plugin_cpufreq=cpufreq
308                 ;;
309             monitors)
310                 plugin_monitors=monitors
311                 ;;
312             wnckpager)
313                 plugin_wnckpager=wnckpager
314                 ;;
315             indicator)
316                 plugin_indicator=indicator
317                 ;;
318             *)
319                 echo "Unknown plugin $plugin."
320                 exit 1
321                 ;;
322         esac
323         done
324         AC_MSG_RESULT($plugins)
325     fi
326 fi
327
328 dnl FIXME: OSS/ALSA checking
329 if test x"$compile_alsa" = "xno"; then
330     if test ! -z $plugin_volumealsa; then
331         AC_MSG_RESULT([no ALSA headers/libraries found!])
332         plugin_volumealsa=
333     fi
334 else
335     dnl force OSS plugin to <null>
336     plugin_volume=
337 fi
338
339 dnl Exclude indicator support when there is no support.
340 if test x"$indicator_support" = "xno"; then
341     plugin_indicator=
342 fi
343
344 PLUGINS_LIST="\
345     $plugin_netstatus \
346     $plugin_volume \
347     $plugin_volumealsa \
348     $plugin_cpu \
349     $plugin_deskno \
350     $plugin_batt \
351     $plugin_kbled \
352     $plugin_xkb \
353     $plugin_thermal \
354     $plugin_cpufreq \
355     $plugin_monitors \
356     $plugin_wnckpager\
357     $plugin_indicator"
358
359 AC_SUBST(PLUGINS_LIST)
360
361
362 # Checks for header files.
363 AC_PATH_X
364 AC_HEADER_STDC
365 AC_HEADER_SYS_WAIT
366 AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
367
368 # Checks for typedefs, structures, and compiler characteristics.
369 AC_C_CONST
370 AC_C_INLINE
371 AC_STRUCT_TM
372
373 # Checks for library functions.
374 AC_FUNC_MALLOC
375 AC_FUNC_MEMCMP
376 AC_TYPE_SIGNAL
377 AC_FUNC_STAT
378 AC_FUNC_STRFTIME
379 AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
380
381
382 # Generate po/LINGUAS on the fly rather than relying on translators
383 # to maintain it manually. This also overcome the problem that Transifex
384 # cannot add a language to po/LINGUAS if a new po file is submitted.
385 rm -f $srcdir/po/LINGUAS
386 for po_file in `ls $srcdir/po/*.po | sort`;
387 do
388     lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
389     echo $lang >> $srcdir/po/LINGUAS
390 done
391
392 GETTEXT_PACKAGE=lxpanel
393 #AM_GNU_GETTEXT([external])
394 AM_GNU_GETTEXT_VERSION(0.14.1)
395 AC_SUBST(GETTEXT_PACKAGE)
396 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
397
398 AM_GLIB_GNU_GETTEXT
399
400 if test x"$enable_man" = x"yes"; then
401         AC_PATH_PROG([XSLTPROC], [xsltproc])
402         if test -z "$XSLTPROC"; then
403                 enable_man=no
404         fi
405
406         dnl check for DocBook DTD and stylesheets in the local catalog.
407         JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
408                 [DocBook XML DTD V4.1.2], [], enable_man=no)
409         JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
410                 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
411 fi
412
413 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
414
415 AC_CONFIG_FILES([
416     lxpanel.pc
417     Makefile
418     src/Makefile
419     src/plugins/Makefile
420     src/plugins/netstatus/Makefile
421     src/plugins/volume/Makefile
422     src/plugins/volumealsa/Makefile
423     src/plugins/cpu/Makefile
424     src/plugins/deskno/Makefile
425     src/plugins/batt/Makefile
426     src/plugins/kbled/Makefile
427     src/plugins/xkb/Makefile
428     src/plugins/thermal/Makefile
429     src/plugins/cpufreq/Makefile
430     src/plugins/monitors/Makefile
431     src/plugins/wnckpager/Makefile
432     src/plugins/indicator/Makefile
433     po/Makefile.in
434     data/Makefile
435     data/default/panels/panel
436     man/Makefile
437 ])
438 AC_OUTPUT
439
440 echo
441 echo lxpanel ......................... : Version $VERSION
442 echo
443 echo Prefix........................... : $prefix
444 if test x$plugins_loading = xyes; then
445 echo Building dynamic plugins:
446     if test x"$plugin_netstatus" != x; then
447         AC_MSG_RESULT([    netstatus - Monitor networking status])
448     fi
449     if test x"$plugin_volume" != x; then
450         AC_MSG_RESULT([    volume - Display and adjust volume of sound card for OSS])
451     fi
452     if test x"$plugin_volumealsa" != x; then
453         AC_MSG_RESULT([    volumealsa - Display and adjust volume of sound card for ALSA])
454     fi
455     if test x"$plugin_cpu" != x; then
456         AC_MSG_RESULT([    cpu - Display CPU loading])
457     fi
458     if test x"$plugin_deskno" != x; then
459         AC_MSG_RESULT([    deskno - Display desktop number])
460     fi
461     if test x"$plugin_batt" != x; then
462         AC_MSG_RESULT([    batt - Monitor battery status])
463     fi
464     if test x"$plugin_kbled" != x; then
465         AC_MSG_RESULT([    kbled - Indicator for CapsLock, NumLock, and ScrLock])
466     fi
467     if test x"$plugin_xkb" != x; then
468         AC_MSG_RESULT([    xkb - Keyboard layout switcher])
469     fi
470     if test x"$plugin_thermal" != x; then
471         AC_MSG_RESULT([    thermal - Temperature monitor])
472     fi
473     if test x"$plugin_cpufreq" != x; then
474         AC_MSG_RESULT([    cpufreq - CpuFreq frontend])
475     fi
476     if test x"$plugin_monitors" != x; then
477         AC_MSG_RESULT([    monitors - Monitors for CPU & RAM])
478     fi
479     if test x"$plugin_wnckpager" != x; then
480         AC_MSG_RESULT([    wnckpager - Pager which support openbox and compiz])
481     fi
482     if test x"$plugin_indicator" != x; then
483         AC_MSG_RESULT([    indicator - Indicator support])
484     fi
485 else
486 echo Dynamic loader for plugins....... : disabled.
487 fi
488
489 echo
490 echo 'LXPanel requires menu-cache and lxmenu-data packages since'
491 echo 'version 0.4.0. Please make sure they are correctly installed.'
492 echo 'Otherwise, you will not be able to use applications menu.'
493 echo
494