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