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