Bump Standards-Version to 3.9.6.
[debian/lxpanel.git] / configure.ac
CommitLineData
6cc5e1a6 1AC_PREREQ(2.53)
dcd17043 2AC_INIT(lxpanel, 0.7.2, http://lxde.org/)
64ea8d44 3AM_INIT_AUTOMAKE([-Wall foreign subdir-objects 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
64ea8d44 18IT_PROG_INTLTOOL([0.40.0], [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
6cc5e1a6
DB
108dnl linker tweaking
109# The function of the link flag --as-needed is to prevent unnecesary linking.
110# Example: A -> B -> C
111# Normally, A would link to B and also depend on C, this is of cource
112# unnecesary. In this situation, however we do need to link to C, so this
113# must be done explicitly. This flag comes in handy when a library ABI
114# is changed, minimizing the amount of recompilations needed.
115AC_MSG_CHECKING([whether $LD accepts --as-needed])
116case `$LD --as-needed -v 2>&1 </dev/null` in
117*GNU* | *'with BFD'*)
118 LDFLAGS="$LDFLAGS -Wl,--as-needed"
119 AC_MSG_RESULT([yes])
120 ;;
121*)
122 AC_MSG_RESULT([no])
123 ;;
124esac
125
126dnl linker optimizations
127AC_MSG_CHECKING([whether $LD accepts -O1])
128case `$LD -O1 -v 2>&1 </dev/null` in
129*GNU* | *'with BFD'*)
130 LDFLAGS="$LDFLAGS -Wl,-O1"
131 AC_MSG_RESULT([yes])
132 ;;
133*)
134 AC_MSG_RESULT([no])
135 ;;
136esac
137AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
138case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
139*GNU* | *'with BFD'*)
140 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
141 AC_MSG_RESULT([yes])
142 ;;
143*)
144 AC_MSG_RESULT([no])
145 ;;
146esac
147AC_MSG_CHECKING([whether $LD accepts --sort-common])
148case `$LD --sort-common -v 2>&1 </dev/null` in
149*GNU* | *'with BFD'*)
150 LDFLAGS="$LDFLAGS -Wl,--sort-common"
151 AC_MSG_RESULT([yes])
152 ;;
153*)
154 AC_MSG_RESULT([no])
155 ;;
156esac
157
158dnl FIXME: filter for undefined symbols in plugins
159# when passing "-z defs" to linker, we would better to make sure
160# there are no undefined references. However, we intend not to
161# fix at the moment since we don't have spin-off libraray containing
162# the necessary functions.
163if test ! -z "$LDFLAGS"; then
164 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
165fi
166
167LXPANEL_MODULE="-avoid-version \
168-rpath \$(libdir)/lxpanel/plugins \
169-no-undefined "'-export-symbols-regex "^[[^_]].*"'
170AC_SUBST(LXPANEL_MODULE)
171
172AC_ARG_ENABLE([alsa],
173 AS_HELP_STRING([--disable-alsa],
174 [compile ALSA providers (default: enable)]),
175 compile_alsa=$enableval, compile_alsa="yes")
176if test x"$compile_alsa" = "xyes"; then
177 AC_CHECK_HEADERS([alsa/asoundlib.h],
178 [AC_CHECK_LIB([asound],
179 [snd_seq_open],
180 compile_alsa=yes,compile_alsa=no)],
181 compile_alsa=no)
182fi
183AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
184dnl FIXME: check OSS existence
185AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
186
6cc5e1a6
DB
187AC_ARG_ENABLE([plugins-loading],
188 AS_HELP_STRING([--disable-plugins-loading],
189 [disable plugin loading (default: enable)]),
190 plugins_loading=$enableval, plugins_loading="yes")
191
192AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
193
194if test x"$plugins_loading" = "xno"; then
195 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
196fi
197
198dnl Here are plugin listing.
199plugin_netstatus=
f8c25730 200plugin_netstat=
6cc5e1a6
DB
201plugin_volume=
202plugin_volumealsa=
203plugin_cpu=
204plugin_deskno=
205plugin_batt=
206plugin_xkb=
207plugin_kbled=
10862fa6 208plugin_thermal=
bfba7517 209plugin_cpufreq=
f8c25730 210plugin_monitors=
f8c25730 211plugin_indicator=
6cc5e1a6
DB
212
213AC_MSG_CHECKING([which plugins should be built dynamically])
214AC_ARG_WITH(plugins,
215[ --with-plugins=<list> compile dynamic plugins in <list> ]
216[ plugins may be comma separated ]
217[ 'all' builds all plugins (default), 'none' builds none ]
0f7f2ef3 218[ plugins prefixed with '-' are not built]
6cc5e1a6 219[ Possible plugins are: ]
0f7f2ef3 220[ netstatus, netstat, volume, volumealsa, cpu, deskno, batt,]
64ea8d44 221[ kbled, xkb, thermal, cpufreq, monitors, indicator, weather]
0f7f2ef3 222, plugins="$withval",[plugins="all"])
6cc5e1a6
DB
223
224if test x"$plugins" != xall -a x"$plugins" != xnone; then
225 if test x"$plugins_loading" = xno; then
226 AC_MSG_ERROR(
227 [--disable-plugins-loading and --with-plugins conflict each other.])
228 fi
229fi
230
00916e98 231ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors indicator weather"
6cc5e1a6
DB
232AC_SUBST(ALL_PLUGINS_LIST)
233
0f7f2ef3
AL
234AC_DEFUN([check_plugin_name],[
235 plugin_found=false
236 for name in $ALL_PLUGINS_LIST; do
237 if test x[$1] = x[$name]; then
238 plugin_found=true
239 fi
240 done
241 if test x[$plugin_found] = false; then
242 echo [Unknown plugin $1.]
243 exit 1
244 fi
245])
246
247if test "$plugins" != "none"; then
248 plugins=`echo $plugins | sed 's/,/ /g'`
249 for plugin in $plugins
250 do
6cc5e1a6 251 case "$plugin" in
0f7f2ef3
AL
252 all)
253 for name in $ALL_PLUGINS_LIST
254 do
64ea8d44 255 export plugin_$name="$name.la"
0f7f2ef3 256 done
6cc5e1a6 257 ;;
0f7f2ef3
AL
258 -*)
259 check_plugin_name([${plugin#-}])
260 export plugin_${plugin#-}=
f8c25730 261 ;;
6cc5e1a6 262 *)
0f7f2ef3 263 check_plugin_name([$plugin])
64ea8d44 264 export plugin_$plugin=$plugin.la
6cc5e1a6
DB
265 ;;
266 esac
0f7f2ef3
AL
267 done
268 AC_MSG_RESULT($plugins)
6cc5e1a6
DB
269fi
270
271dnl FIXME: OSS/ALSA checking
272if test x"$compile_alsa" = "xno"; then
273 if test ! -z $plugin_volumealsa; then
274 AC_MSG_RESULT([no ALSA headers/libraries found!])
275 plugin_volumealsa=
276 fi
277else
278 dnl force OSS plugin to <null>
279 plugin_volume=
280fi
f8c25730
DB
281
282dnl Exclude indicator support when there is no support.
283if test x"$indicator_support" = "xno"; then
284 plugin_indicator=
285fi
286
6cc5e1a6
DB
287PLUGINS_LIST="\
288 $plugin_netstatus \
f8c25730 289 $plugin_netstat \
6cc5e1a6
DB
290 $plugin_volume \
291 $plugin_volumealsa \
292 $plugin_cpu \
293 $plugin_deskno \
294 $plugin_batt \
295 $plugin_kbled \
10862fa6 296 $plugin_xkb \
bfba7517 297 $plugin_thermal \
f8c25730
DB
298 $plugin_cpufreq \
299 $plugin_monitors \
00916e98
AG
300 $plugin_indicator \
301 $plugin_weather"
6cc5e1a6
DB
302
303AC_SUBST(PLUGINS_LIST)
304
f8c25730
DB
305# Plugin-specific dependencies
306# nestat
307if test x"$plugin_netstat" != "x";then
308AC_CHECK_HEADER([iwlib.h],,
309 AC_MSG_ERROR([netstat plugin requires wireless-tools-devel]))
310fi
6cc5e1a6 311
00916e98
AG
312# weather
313if test x"$plugin_weather" != "x";then
314PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
315AC_SUBST(LIBXML2_CFLAGS)
316AC_SUBST(LIBXML2_LIBS)
317fi
318
6cc5e1a6
DB
319# Checks for header files.
320AC_PATH_X
321AC_HEADER_STDC
322AC_HEADER_SYS_WAIT
323AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
324
325# Checks for typedefs, structures, and compiler characteristics.
326AC_C_CONST
327AC_C_INLINE
328AC_STRUCT_TM
329
330# Checks for library functions.
331AC_FUNC_MALLOC
332AC_FUNC_MEMCMP
333AC_TYPE_SIGNAL
334AC_FUNC_STAT
335AC_FUNC_STRFTIME
336AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
337
00916e98
AG
338dnl check for menu-cache versions 0.4.x since no macro MENU_CACHE_CHECK_VERSION
339dnl is available in those versions
340LIBS_save="${LIBS}"
341LIBS="${LIBS} ${MENU_CACHE_LIBS}"
342AC_CHECK_FUNCS(menu_cache_dir_list_children)
343LIBS="${LIBS_save}"
6cc5e1a6 344
ca14ea2b
DB
345# Generate po/LINGUAS on the fly rather than relying on translators
346# to maintain it manually. This also overcome the problem that Transifex
347# cannot add a language to po/LINGUAS if a new po file is submitted.
348rm -f $srcdir/po/LINGUAS
349for po_file in `ls $srcdir/po/*.po | sort`;
350do
351 lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
352 echo $lang >> $srcdir/po/LINGUAS
353done
354
6cc5e1a6 355GETTEXT_PACKAGE=lxpanel
6cc5e1a6
DB
356AC_SUBST(GETTEXT_PACKAGE)
357AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
358
6cc5e1a6
DB
359AM_GLIB_GNU_GETTEXT
360
00916e98
AG
361AC_ARG_ENABLE(debug,
362 [AC_HELP_STRING([--enable-debug],
363 [enable debug support @<:@default=no@:>@])],
364 [enable_debug="${enableval}"],
365 [enable_debug=no]
366)
367if test "$enable_debug" = "yes"; then
368 # turn on debug and disable optimization
369 CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
370 case "$CC" in
371 gcc*)
372 CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration"
373 ;;
374 *)
375 ;;
376 esac
377 dnl Be more strict on portability
378 #CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
379else
380 # turn off glib debug checks
381 CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
382fi
383
384dnl Fix invalid sysconfdir when --prefix=/usr
385if test `eval "echo $sysconfdir"` = /usr/etc
386then
387 sysconfdir=/etc
388fi
389
6cc5e1a6 390AC_CONFIG_FILES([
10862fa6 391 lxpanel.pc
6cc5e1a6
DB
392 Makefile
393 src/Makefile
00916e98 394 plugins/Makefile
6cc5e1a6
DB
395 po/Makefile.in
396 data/Makefile
397 data/default/panels/panel
f8c25730
DB
398 data/two_panels/panels/top
399 data/two_panels/panels/bottom
6cc5e1a6
DB
400 man/Makefile
401])
402AC_OUTPUT
403
404echo
405echo lxpanel ......................... : Version $VERSION
406echo
407echo Prefix........................... : $prefix
00916e98
AG
408echo System config directory.......... : `eval "echo $sysconfdir"`
409echo
410
6cc5e1a6
DB
411if test x$plugins_loading = xyes; then
412echo Building dynamic plugins:
413 if test x"$plugin_netstatus" != x; then
414 AC_MSG_RESULT([ netstatus - Monitor networking status])
415 fi
f8c25730
DB
416 if test x"$plugin_netstat" != x; then
417 AC_MSG_RESULT([ netstat - Monitor networking status])
418 fi
6cc5e1a6 419 if test x"$plugin_volume" != x; then
1ea75322 420 AC_MSG_RESULT([ volume - Display and adjust volume of sound card for OSS])
6cc5e1a6
DB
421 fi
422 if test x"$plugin_volumealsa" != x; then
423 AC_MSG_RESULT([ volumealsa - Display and adjust volume of sound card for ALSA])
424 fi
425 if test x"$plugin_cpu" != x; then
426 AC_MSG_RESULT([ cpu - Display CPU loading])
427 fi
428 if test x"$plugin_deskno" != x; then
429 AC_MSG_RESULT([ deskno - Display desktop number])
430 fi
431 if test x"$plugin_batt" != x; then
432 AC_MSG_RESULT([ batt - Monitor battery status])
433 fi
434 if test x"$plugin_kbled" != x; then
435 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
436 fi
437 if test x"$plugin_xkb" != x; then
00916e98 438 AC_MSG_RESULT([ xkb - Keyboard layout handler])
6cc5e1a6 439 fi
10862fa6
DB
440 if test x"$plugin_thermal" != x; then
441 AC_MSG_RESULT([ thermal - Temperature monitor])
442 fi
bfba7517
DB
443 if test x"$plugin_cpufreq" != x; then
444 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
445 fi
f8c25730
DB
446 if test x"$plugin_monitors" != x; then
447 AC_MSG_RESULT([ monitors - Monitors for CPU & RAM])
448 fi
f8c25730
DB
449 if test x"$plugin_indicator" != x; then
450 AC_MSG_RESULT([ indicator - Indicator support])
451 fi
00916e98
AG
452 if test x"$plugin_weather" != x; then
453 AC_MSG_RESULT([ weather - Weather conditions and forecast])
454 fi
6cc5e1a6
DB
455else
456echo Dynamic loader for plugins....... : disabled.
457fi
10862fa6 458
00916e98
AG
459if test x"$sysconfdir" != x'/etc'; then
460 echo
461 echo 'Warning: sysconfdir is not /etc. It might be not what you want.'
462 echo 'Please consider passing --sysconfdir=/etc to configure.'
463fi
464
10862fa6
DB
465echo
466echo 'LXPanel requires menu-cache and lxmenu-data packages since'
467echo 'version 0.4.0. Please make sure they are correctly installed.'
468echo 'Otherwise, you will not be able to use applications menu.'
469echo
470