Merging upstream version 0.5.9.
[debian/lxpanel.git] / configure.ac
CommitLineData
6cc5e1a6 1AC_PREREQ(2.53)
f8c25730 2AC_INIT(lxpanel, 0.5.9, http://lxde.org/)
ca14ea2b 3AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign])
6cc5e1a6
DB
4AC_CONFIG_HEADER([config.h])
5
ca14ea2b
DB
6# Support silent build rules. Disable by either passing --disable-silent-rules
7# to configure or passing V=1 to make
8AM_SILENT_RULES([yes])
9
6cc5e1a6
DB
10# Force to dynamic
11AC_DISABLE_STATIC
12
13# Checks for programs.
14AC_PROG_CC
15AC_PROG_INSTALL
16AC_PROG_LN_S
6cc5e1a6 17AC_PROG_INTLTOOL(, [no-xml])
1ea75322 18AM_PROG_CC_C_O
6cc5e1a6 19
ca14ea2b
DB
20#Initialize libtool
21LT_PREREQ([2.2])
22LT_INIT
23
6cc5e1a6 24# Checks for libraries.
f8c25730
DB
25AC_ARG_ENABLE(gtk3,
26AC_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".]) ;;
31esac],[])
32
33if test "x$enable_gtk3" = "xyes" ; then
34 CFLAGS="$CFLAGS -DENABLE_GTK3"
35 pkg_modules="$pkg_modules gtk+-3.0"
36else
37 pkg_modules="$pkg_modules gtk+-2.0 >= 2.12.0"
38fi
39
40pkg_modules="$pkg_modules \
1ea75322 41 gio-unix-2.0 \
f8c25730
DB
42 gthread-2.0 \
43 libmenu-cache"
6cc5e1a6
DB
44# libstartup-notification-1.0"
45PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
46AC_SUBST(PACKAGE_CFLAGS)
47AC_SUBST(PACKAGE_LIBS)
48
f8c25730
DB
49###########################
50# Indicator Info
51###########################
52AC_ARG_ENABLE([indicator_support],
53 AS_HELP_STRING([--enable-indicator-support],
54 [enable plugin loading (default: disable)]),
55 indicator_support=$enableval, indicator_support="no")
56AM_CONDITIONAL(ENABLE_INDICATOR_SUPPORT, test x"$indicator_support" = x"yes")
57
58if 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`
71fi
72 AC_SUBST(INDICATORDIR)
73 AC_SUBST(INDICATORICONSDIR)
74fi
75
76
934ecce5
DB
77pkg_modules="x11"
78PKG_CHECK_MODULES(X11, [$pkg_modules])
79AC_SUBST(X11_LIBS)
80
f8c25730
DB
81pkg_modules="libwnck-1.0"
82PKG_CHECK_MODULES(WNCK, [$pkg_modules])
83AC_SUBST(WNCK_CFLAGS)
84AC_SUBST(WNCK_LIBS)
85
10862fa6
DB
86pkg_modules="libmenu-cache"
87PKG_CHECK_MODULES(MENU_CACHE, [$pkg_modules],
88 enable_menu_cache=yes, enable_menu_cache=no)
89if 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])
92fi
93AC_SUBST(MENU_CACHE_CFLAGS)
94AC_SUBST(MENU_CACHE_LIBS)
ca14ea2b
DB
95AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
96
97AC_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)
10862fa6 103
ca14ea2b
DB
104if 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"
106fi
107AC_SUBST(ADDITIONAL_FLAGS)
108
109PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
10862fa6
DB
110PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
111
1ea75322
DB
112AC_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)
10862fa6 118
6cc5e1a6
DB
119AC_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")
123G_CAST_CHECKS=""
124if test x"$cast_checks" = "xno"; then
125 G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
126fi
127AC_SUBST(G_CAST_CHECKS)
128
129dnl 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.
136AC_MSG_CHECKING([whether $LD accepts --as-needed])
137case `$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 ;;
145esac
146
147dnl linker optimizations
148AC_MSG_CHECKING([whether $LD accepts -O1])
149case `$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 ;;
157esac
158AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
159case `$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 ;;
167esac
168AC_MSG_CHECKING([whether $LD accepts --sort-common])
169case `$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 ;;
177esac
178
179dnl 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.
184if test ! -z "$LDFLAGS"; then
185 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
186fi
187
188LXPANEL_MODULE="-avoid-version \
189-rpath \$(libdir)/lxpanel/plugins \
190-no-undefined "'-export-symbols-regex "^[[^_]].*"'
191AC_SUBST(LXPANEL_MODULE)
192
193AC_ARG_ENABLE([alsa],
194 AS_HELP_STRING([--disable-alsa],
195 [compile ALSA providers (default: enable)]),
196 compile_alsa=$enableval, compile_alsa="yes")
197if 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)
203fi
204AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
205dnl FIXME: check OSS existence
206AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
207
6cc5e1a6
DB
208AC_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
213AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
214
215if test x"$plugins_loading" = "xno"; then
216 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
217fi
218
219dnl Here are plugin listing.
220plugin_netstatus=
f8c25730 221plugin_netstat=
6cc5e1a6
DB
222plugin_volume=
223plugin_volumealsa=
224plugin_cpu=
225plugin_deskno=
226plugin_batt=
227plugin_xkb=
228plugin_kbled=
10862fa6 229plugin_thermal=
bfba7517 230plugin_cpufreq=
f8c25730
DB
231plugin_monitors=
232plugin_wnckpager=
233plugin_indicator=
6cc5e1a6
DB
234
235AC_MSG_CHECKING([which plugins should be built dynamically])
236AC_ARG_WITH(plugins,
237[ --with-plugins=<list> compile dynamic plugins in <list> ]
238[ plugins may be comma separated ]
239[ 'all' builds all plugins (default), 'none' builds none ]
240[ Possible plugins are: ]
f8c25730 241[ netstatus, netstat, volume, volumealsa, cpu, deskno, batt, kbled, xkb, thermal, cpufreq, monitors, wnckpager], plugins="$withval",[plugins="all"])
6cc5e1a6
DB
242
243if test x"$plugins" != xall -a x"$plugins" != xnone; then
244 if test x"$plugins_loading" = xno; then
245 AC_MSG_ERROR(
246 [--disable-plugins-loading and --with-plugins conflict each other.])
247 fi
248fi
249
f8c25730 250ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors wnckpager indicator"
6cc5e1a6
DB
251AC_SUBST(ALL_PLUGINS_LIST)
252
253if test x"$plugins" = xall; then
254dnl for name in $ALL_PLUGINS
255dnl do
256dnl export plugin_$name="$name"
257dnl done
258
259 plugin_netstatus=netstatus
f8c25730 260 plugin_netstat=netstat
6cc5e1a6
DB
261 plugin_volume=volume
262 plugin_volumealsa=volumealsa
263 plugin_cpu=cpu
264 plugin_deskno=deskno
265 plugin_batt=batt
266 plugin_kbled=kbled
1ea75322 267 plugin_xkb=xkb
10862fa6 268 plugin_thermal=thermal
bfba7517 269 plugin_cpufreq=cpufreq
f8c25730
DB
270 plugin_monitors=monitors
271 plugin_wnckpager=wnckpager
272 plugin_indicator=indicator
6cc5e1a6
DB
273
274 AC_MSG_RESULT(all)
275else
276 if test "$plugins" != "none"; then
277 plugins=`echo $plugins | sed 's/,/ /g'`
278 for plugin in $plugins
279 do
280 case "$plugin" in
281 netstatus)
282 plugin_netstatus=netstatus
283 ;;
f8c25730
DB
284 netstat)
285 plugin_netstat=netstat
286 ;;
6cc5e1a6
DB
287 volume)
288 plugin_volume=volume
289 ;;
290 volumealsa)
291 plugin_volumealsa=volumealsa
292 ;;
293 cpu)
294 plugin_cpu=cpu
295 ;;
296 deskno)
297 plugin_deskno=deskno
298 ;;
299 batt)
300 plugin_batt=batt
301 ;;
302 kbled)
303 plugin_kbled=kbled
304 ;;
305 xkb)
306 plugin_xkb=xkb
307 ;;
10862fa6
DB
308 thermal)
309 plugin_thermal=thermal
310 ;;
bfba7517
DB
311 cpufreq)
312 plugin_cpufreq=cpufreq
313 ;;
f8c25730
DB
314 monitors)
315 plugin_monitors=monitors
316 ;;
317 wnckpager)
318 plugin_wnckpager=wnckpager
319 ;;
320 indicator)
321 plugin_indicator=indicator
322 ;;
6cc5e1a6
DB
323 *)
324 echo "Unknown plugin $plugin."
325 exit 1
326 ;;
327 esac
328 done
329 AC_MSG_RESULT($plugins)
330 fi
331fi
332
333dnl FIXME: OSS/ALSA checking
334if test x"$compile_alsa" = "xno"; then
335 if test ! -z $plugin_volumealsa; then
336 AC_MSG_RESULT([no ALSA headers/libraries found!])
337 plugin_volumealsa=
338 fi
339else
340 dnl force OSS plugin to <null>
341 plugin_volume=
342fi
f8c25730
DB
343
344dnl Exclude indicator support when there is no support.
345if test x"$indicator_support" = "xno"; then
346 plugin_indicator=
347fi
348
6cc5e1a6
DB
349PLUGINS_LIST="\
350 $plugin_netstatus \
f8c25730 351 $plugin_netstat \
6cc5e1a6
DB
352 $plugin_volume \
353 $plugin_volumealsa \
354 $plugin_cpu \
355 $plugin_deskno \
356 $plugin_batt \
357 $plugin_kbled \
10862fa6 358 $plugin_xkb \
bfba7517 359 $plugin_thermal \
f8c25730
DB
360 $plugin_cpufreq \
361 $plugin_monitors \
362 $plugin_wnckpager\
363 $plugin_indicator"
6cc5e1a6
DB
364
365AC_SUBST(PLUGINS_LIST)
366
f8c25730
DB
367# Plugin-specific dependencies
368# nestat
369if test x"$plugin_netstat" != "x";then
370AC_CHECK_HEADER([iwlib.h],,
371 AC_MSG_ERROR([netstat plugin requires wireless-tools-devel]))
372fi
6cc5e1a6
DB
373
374# Checks for header files.
375AC_PATH_X
376AC_HEADER_STDC
377AC_HEADER_SYS_WAIT
378AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
379
380# Checks for typedefs, structures, and compiler characteristics.
381AC_C_CONST
382AC_C_INLINE
383AC_STRUCT_TM
384
385# Checks for library functions.
386AC_FUNC_MALLOC
387AC_FUNC_MEMCMP
388AC_TYPE_SIGNAL
389AC_FUNC_STAT
390AC_FUNC_STRFTIME
391AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
392
393
ca14ea2b
DB
394# Generate po/LINGUAS on the fly rather than relying on translators
395# to maintain it manually. This also overcome the problem that Transifex
396# cannot add a language to po/LINGUAS if a new po file is submitted.
397rm -f $srcdir/po/LINGUAS
398for po_file in `ls $srcdir/po/*.po | sort`;
399do
400 lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
401 echo $lang >> $srcdir/po/LINGUAS
402done
403
6cc5e1a6
DB
404GETTEXT_PACKAGE=lxpanel
405#AM_GNU_GETTEXT([external])
406AM_GNU_GETTEXT_VERSION(0.14.1)
407AC_SUBST(GETTEXT_PACKAGE)
408AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
409
6cc5e1a6
DB
410AM_GLIB_GNU_GETTEXT
411
1ea75322
DB
412if test x"$enable_man" = x"yes"; then
413 AC_PATH_PROG([XSLTPROC], [xsltproc])
414 if test -z "$XSLTPROC"; then
415 enable_man=no
416 fi
417
418 dnl check for DocBook DTD and stylesheets in the local catalog.
419 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
420 [DocBook XML DTD V4.1.2], [], enable_man=no)
421 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
422 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
423fi
424
425AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
426
6cc5e1a6 427AC_CONFIG_FILES([
10862fa6 428 lxpanel.pc
6cc5e1a6
DB
429 Makefile
430 src/Makefile
431 src/plugins/Makefile
432 src/plugins/netstatus/Makefile
f8c25730 433 src/plugins/netstat/Makefile
6cc5e1a6
DB
434 src/plugins/volume/Makefile
435 src/plugins/volumealsa/Makefile
436 src/plugins/cpu/Makefile
437 src/plugins/deskno/Makefile
438 src/plugins/batt/Makefile
439 src/plugins/kbled/Makefile
440 src/plugins/xkb/Makefile
10862fa6 441 src/plugins/thermal/Makefile
bfba7517 442 src/plugins/cpufreq/Makefile
f8c25730
DB
443 src/plugins/monitors/Makefile
444 src/plugins/wnckpager/Makefile
445 src/plugins/indicator/Makefile
6cc5e1a6
DB
446 po/Makefile.in
447 data/Makefile
448 data/default/panels/panel
f8c25730
DB
449 data/two_panels/panels/top
450 data/two_panels/panels/bottom
6cc5e1a6
DB
451 man/Makefile
452])
453AC_OUTPUT
454
455echo
456echo lxpanel ......................... : Version $VERSION
457echo
458echo Prefix........................... : $prefix
459if test x$plugins_loading = xyes; then
460echo Building dynamic plugins:
461 if test x"$plugin_netstatus" != x; then
462 AC_MSG_RESULT([ netstatus - Monitor networking status])
463 fi
f8c25730
DB
464 if test x"$plugin_netstat" != x; then
465 AC_MSG_RESULT([ netstat - Monitor networking status])
466 fi
6cc5e1a6 467 if test x"$plugin_volume" != x; then
1ea75322 468 AC_MSG_RESULT([ volume - Display and adjust volume of sound card for OSS])
6cc5e1a6
DB
469 fi
470 if test x"$plugin_volumealsa" != x; then
471 AC_MSG_RESULT([ volumealsa - Display and adjust volume of sound card for ALSA])
472 fi
473 if test x"$plugin_cpu" != x; then
474 AC_MSG_RESULT([ cpu - Display CPU loading])
475 fi
476 if test x"$plugin_deskno" != x; then
477 AC_MSG_RESULT([ deskno - Display desktop number])
478 fi
479 if test x"$plugin_batt" != x; then
480 AC_MSG_RESULT([ batt - Monitor battery status])
481 fi
482 if test x"$plugin_kbled" != x; then
483 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
484 fi
485 if test x"$plugin_xkb" != x; then
486 AC_MSG_RESULT([ xkb - Keyboard layout switcher])
487 fi
10862fa6
DB
488 if test x"$plugin_thermal" != x; then
489 AC_MSG_RESULT([ thermal - Temperature monitor])
490 fi
bfba7517
DB
491 if test x"$plugin_cpufreq" != x; then
492 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
493 fi
f8c25730
DB
494 if test x"$plugin_monitors" != x; then
495 AC_MSG_RESULT([ monitors - Monitors for CPU & RAM])
496 fi
497 if test x"$plugin_wnckpager" != x; then
498 AC_MSG_RESULT([ wnckpager - Pager which support openbox and compiz])
499 fi
500 if test x"$plugin_indicator" != x; then
501 AC_MSG_RESULT([ indicator - Indicator support])
502 fi
6cc5e1a6
DB
503else
504echo Dynamic loader for plugins....... : disabled.
505fi
10862fa6
DB
506
507echo
508echo 'LXPanel requires menu-cache and lxmenu-data packages since'
509echo 'version 0.4.0. Please make sure they are correctly installed.'
510echo 'Otherwise, you will not be able to use applications menu.'
511echo
512