taskbar: update menu_item in recompute_group_visibility_for_class() as well.
[lxde/lxpanel.git] / configure.ac
CommitLineData
a52c2257 1AC_PREREQ(2.53)
46c7d227 2AC_INIT(lxpanel, 0.7.99, http://lxde.org/)
6dbdce2b 3AM_INIT_AUTOMAKE([-Wall foreign subdir-objects no-dist-gzip dist-xz])
a52c2257 4AC_CONFIG_HEADER([config.h])
00118bd4 5AC_CONFIG_MACRO_DIR([m4])
a52c2257 6
8e4890cb
JL
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
86db742c
JH
11# Force to dynamic
12AC_DISABLE_STATIC
13
a52c2257
HJYP
14# Checks for programs.
15AC_PROG_CC
16AC_PROG_INSTALL
17AC_PROG_LN_S
c94790df 18IT_PROG_INTLTOOL([0.40.0], [no-xml])
e7a42ecf 19AM_PROG_CC_C_O
00118bd4 20m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
a52c2257 21
8e4890cb
JL
22#Initialize libtool
23LT_PREREQ([2.2])
24LT_INIT
25
a52c2257 26# Checks for libraries.
46c7d227 27AC_SEARCH_LIBS([log], [m])
bf2b2430
AF
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"
697e84f4 38 pkg_modules="$pkg_modules gtk+-3.0 libfm-gtk3 >= 1.2.0 libwnck-3.0"
bf2b2430 39else
09fa171b 40 pkg_modules="$pkg_modules gtk+-2.0 >= 2.18.0 libfm-gtk >= 1.2.0 libwnck-1.0"
bf2b2430
AF
41fi
42
43pkg_modules="$pkg_modules \
1d434622 44 gio-unix-2.0 \
c4ff9fd2 45 gthread-2.0 \
688d30f0 46 gmodule-2.0"
a52c2257
HJYP
47PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
48AC_SUBST(PACKAGE_CFLAGS)
49AC_SUBST(PACKAGE_LIBS)
50
f7a4447c
AG
51PKG_CHECK_MODULES(KEYBINDER, [keybinder])
52AC_SUBST(KEYBINDER_CFLAGS)
53AC_SUBST(KEYBINDER_LIBS)
54
9dda8252
JL
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
9bf13ef5
MTW
83pkg_modules="x11"
84PKG_CHECK_MODULES(X11, [$pkg_modules])
85AC_SUBST(X11_LIBS)
86
ace2a572
JH
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)
ade9c95c 96AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
ace2a572 97
77f69cbd
JL
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)
ade9c95c 109
77f69cbd 110PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
ace2a572
JH
111PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
112
cc0c9990
JH
113dnl linker tweaking
114# The function of the link flag --as-needed is to prevent unnecesary linking.
115# Example: A -> B -> C
20b3e401
JH
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
cc0c9990
JH
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'*)
20b3e401
JH
123 LDFLAGS="$LDFLAGS -Wl,--as-needed"
124 AC_MSG_RESULT([yes])
125 ;;
cc0c9990 126*)
20b3e401
JH
127 AC_MSG_RESULT([no])
128 ;;
cc0c9990
JH
129esac
130
cae18977
JH
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 ;;
7e20ea34 148*)
cae18977
JH
149 AC_MSG_RESULT([no])
150 ;;
151esac
85026f6c
JH
152AC_MSG_CHECKING([whether $LD accepts --sort-common])
153case `$LD --sort-common -v 2>&1 </dev/null` in
7e20ea34 154*GNU* | *'with BFD'*)
85026f6c
JH
155 LDFLAGS="$LDFLAGS -Wl,--sort-common"
156 AC_MSG_RESULT([yes])
157 ;;
158*)
159 AC_MSG_RESULT([no])
160 ;;
161esac
cae18977 162
c044bccf 163AC_ARG_ENABLE([alsa],
24053345
HJYP
164 AS_HELP_STRING([--disable-alsa],
165 [compile ALSA providers (default: enable)]),
166 compile_alsa=$enableval, compile_alsa="yes")
c044bccf 167if test x"$compile_alsa" = "xyes"; then
24053345
HJYP
168 AC_CHECK_HEADERS([alsa/asoundlib.h],
169 [AC_CHECK_LIB([asound],
170 [snd_seq_open],
171 compile_alsa=yes,compile_alsa=no)],
c044bccf
JH
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
2d29cc96 178AC_ARG_ENABLE([plugins-loading],
24053345
HJYP
179 AS_HELP_STRING([--disable-plugins-loading],
180 [disable plugin loading (default: enable)]),
181 plugins_loading=$enableval, plugins_loading="yes")
2d29cc96 182
31b80004
JH
183AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
184
535ac098 185if test x"$plugins_loading" = "xno"; then
24053345 186 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
2d29cc96
JH
187fi
188
199c3ea8
JH
189dnl Here are plugin listing.
190plugin_netstatus=
65efa143 191plugin_netstat=
199c3ea8 192plugin_volume=
15556f61 193plugin_volumealsa=
199c3ea8 194plugin_cpu=
ce728cd9 195plugin_deskno=
8f11d5f8 196plugin_batt=
22242ed4 197plugin_xkb=
7e20ea34 198plugin_kbled=
09f498a1 199plugin_thermal=
c03f7bd0 200plugin_cpufreq=
9770479a 201plugin_monitors=
9dda8252 202plugin_indicator=
199c3ea8
JH
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 ]
3a604782 209[ plugins prefixed with '-' are not built]
199c3ea8 210[ Possible plugins are: ]
3a604782 211[ netstatus, netstat, volume, volumealsa, cpu, deskno, batt,]
d607ba2e 212[ kbled, xkb, thermal, cpufreq, monitors, indicator, weather]
3a604782 213, plugins="$withval",[plugins="all"])
199c3ea8
JH
214
215if test x"$plugins" != xall -a x"$plugins" != xnone; then
24053345
HJYP
216 if test x"$plugins_loading" = xno; then
217 AC_MSG_ERROR(
218 [--disable-plugins-loading and --with-plugins conflict each other.])
219 fi
199c3ea8
JH
220fi
221
6d51da94 222ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors indicator weather"
24053345
HJYP
223AC_SUBST(ALL_PLUGINS_LIST)
224
3a604782
HG
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
24053345 242 case "$plugin" in
3a604782
HG
243 all)
244 for name in $ALL_PLUGINS_LIST
245 do
6dbdce2b 246 export plugin_$name="$name.la"
3a604782 247 done
24053345 248 ;;
3a604782
HG
249 -*)
250 check_plugin_name([${plugin#-}])
251 export plugin_${plugin#-}=
9dda8252 252 ;;
24053345 253 *)
3a604782 254 check_plugin_name([$plugin])
6dbdce2b 255 export plugin_$plugin=$plugin.la
24053345
HJYP
256 ;;
257 esac
3a604782
HG
258 done
259 AC_MSG_RESULT($plugins)
199c3ea8
JH
260fi
261
c044bccf
JH
262dnl FIXME: OSS/ALSA checking
263if test x"$compile_alsa" = "xno"; then
24053345
HJYP
264 if test ! -z $plugin_volumealsa; then
265 AC_MSG_RESULT([no ALSA headers/libraries found!])
266 plugin_volumealsa=
267 fi
c044bccf 268else
24053345
HJYP
269 dnl force OSS plugin to <null>
270 plugin_volume=
c044bccf 271fi
9dda8252
JL
272
273dnl Exclude indicator support when there is no support.
274if test x"$indicator_support" = "xno"; then
275 plugin_indicator=
276fi
277
22242ed4 278PLUGINS_LIST="\
7e20ea34 279 $plugin_netstatus \
65efa143 280 $plugin_netstat \
7e20ea34
HJYP
281 $plugin_volume \
282 $plugin_volumealsa \
283 $plugin_cpu \
284 $plugin_deskno \
285 $plugin_batt \
286 $plugin_kbled \
62550cea 287 $plugin_xkb \
c03f7bd0 288 $plugin_thermal \
9770479a 289 $plugin_cpufreq \
2ae466ab 290 $plugin_monitors \
f0a22461
PS
291 $plugin_indicator \
292 $plugin_weather"
22242ed4 293
199c3ea8
JH
294AC_SUBST(PLUGINS_LIST)
295
fcb35553
PS
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
1141e22a 302
f0a22461
PS
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
a52c2257
HJYP
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
bed635b7
AG
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}"
a52c2257 335
5f9e4cb1
JL
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
a52c2257 346GETTEXT_PACKAGE=lxpanel
a52c2257
HJYP
347AC_SUBST(GETTEXT_PACKAGE)
348AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
349
a52c2257
HJYP
350AM_GLIB_GNU_GETTEXT
351
b366baa2
AG
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
98c7671a
AG
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
1f4bc3aa
AG
382dnl Fix invalid sysconfdir when --prefix=/usr
383if test `eval "echo $sysconfdir"` = /usr/etc
384then
385 sysconfdir=/etc
386fi
387
a52c2257 388AC_CONFIG_FILES([
f5c43b11 389 lxpanel.pc
24053345
HJYP
390 Makefile
391 src/Makefile
98c7671a 392 src/panel.h
d609cab0 393 plugins/Makefile
24053345
HJYP
394 po/Makefile.in
395 data/Makefile
cf701cb7 396 data/default/panels/panel
65efa143
JL
397 data/two_panels/panels/top
398 data/two_panels/panels/bottom
70344206 399 man/Makefile
a52c2257
HJYP
400])
401AC_OUTPUT
199c3ea8 402
24053345 403echo
ce728cd9 404echo lxpanel ......................... : Version $VERSION
199c3ea8
JH
405echo
406echo Prefix........................... : $prefix
1f4bc3aa
AG
407echo System config directory.......... : `eval "echo $sysconfdir"`
408echo
409
199c3ea8
JH
410if test x$plugins_loading = xyes; then
411echo Building dynamic plugins:
24053345
HJYP
412 if test x"$plugin_netstatus" != x; then
413 AC_MSG_RESULT([ netstatus - Monitor networking status])
414 fi
65efa143
JL
415 if test x"$plugin_netstat" != x; then
416 AC_MSG_RESULT([ netstat - Monitor networking status])
417 fi
24053345 418 if test x"$plugin_volume" != x; then
8f9e6256 419 AC_MSG_RESULT([ volume - Display and adjust volume of sound card for OSS])
24053345
HJYP
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
7e20ea34
HJYP
433 if test x"$plugin_kbled" != x; then
434 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
435 fi
22242ed4 436 if test x"$plugin_xkb" != x; then
fc26a89e 437 AC_MSG_RESULT([ xkb - Keyboard layout handler])
22242ed4 438 fi
62550cea
FC
439 if test x"$plugin_thermal" != x; then
440 AC_MSG_RESULT([ thermal - Temperature monitor])
441 fi
c03f7bd0
DK
442 if test x"$plugin_cpufreq" != x; then
443 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
444 fi
9770479a
JL
445 if test x"$plugin_monitors" != x; then
446 AC_MSG_RESULT([ monitors - Monitors for CPU & RAM])
447 fi
9dda8252
JL
448 if test x"$plugin_indicator" != x; then
449 AC_MSG_RESULT([ indicator - Indicator support])
450 fi
f0a22461
PS
451 if test x"$plugin_weather" != x; then
452 AC_MSG_RESULT([ weather - Weather conditions and forecast])
453 fi
199c3ea8
JH
454else
455echo Dynamic loader for plugins....... : disabled.
456fi
1234b94c 457
1f4bc3aa
AG
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
1234b94c 464echo
46cea569
HJYP
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
1234b94c 469