Fix compilation of launchtaskbar plugin due to new APIs.
[lxde/lxpanel.git] / configure.ac
CommitLineData
a52c2257 1AC_PREREQ(2.53)
8a05ac3d 2AC_INIT(lxpanel, 0.6.1, http://lxde.org/)
797fcaca 3AM_INIT_AUTOMAKE([-Wall foreign 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
18AC_PROG_INTLTOOL(, [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.
bf2b2430
AF
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"
4f5769fc 37 pkg_modules="$pkg_modules gtk+-3.0 libfm-gtk3 >= 1.2.0"
bf2b2430 38else
4f5769fc 39 pkg_modules="$pkg_modules gtk+-2.0 >= 2.16.0 libfm-gtk >= 1.2.0"
bf2b2430
AF
40fi
41
42pkg_modules="$pkg_modules \
1d434622 43 gio-unix-2.0 \
c4ff9fd2 44 gthread-2.0 \
63cdb785 45 gmodule-2.0 \
2ae466ab 46 libmenu-cache"
a52c2257
HJYP
47PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
48AC_SUBST(PACKAGE_CFLAGS)
49AC_SUBST(PACKAGE_LIBS)
50
9dda8252
JL
51###########################
52# Indicator Info
53###########################
54AC_ARG_ENABLE([indicator_support],
55 AS_HELP_STRING([--enable-indicator-support],
56 [enable plugin loading (default: disable)]),
57 indicator_support=$enableval, indicator_support="no")
58AM_CONDITIONAL(ENABLE_INDICATOR_SUPPORT, test x"$indicator_support" = x"yes")
59
60if test "$indicator_support" != "no"; then
61 INDICATOR_REQUIRED_VERSION=0.3.0
62 INDICATOR_PKG_NAME=indicator-0.4
63
64 PKG_CHECK_MODULES(APPLET, $INDICATOR_PKG_NAME >= $INDICATOR_REQUIRED_VERSION)
65 AC_SUBST(APPLET_CFLAGS)
66
67 if test "x$with_localinstall" = "xyes"; then
68 INDICATORDIR="${libdir}/indicators/2/"
69 INDICATORICONSDIR="${datadir}/indicator-applet/icons/"
70 else
71 INDICATORDIR=`$PKG_CONFIG --variable=indicatordir $INDICATOR_PKG_NAME`
72 INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir $INDICATOR_PKG_NAME`
73fi
74 AC_SUBST(INDICATORDIR)
75 AC_SUBST(INDICATORICONSDIR)
76fi
77
78
9bf13ef5
MTW
79pkg_modules="x11"
80PKG_CHECK_MODULES(X11, [$pkg_modules])
81AC_SUBST(X11_LIBS)
82
2ae466ab
JL
83pkg_modules="libwnck-1.0"
84PKG_CHECK_MODULES(WNCK, [$pkg_modules])
85AC_SUBST(WNCK_CFLAGS)
86AC_SUBST(WNCK_LIBS)
87
ace2a572
JH
88pkg_modules="libmenu-cache"
89PKG_CHECK_MODULES(MENU_CACHE, [$pkg_modules],
90 enable_menu_cache=yes, enable_menu_cache=no)
91if test x"$enable_menu_cache" = "xno"; then
92 AC_WARN([No libmenu-cache found. All menu related routines are not built.])
93 AC_DEFINE(DISABLE_MENU, [1], [Disable menu related routines])
94fi
95AC_SUBST(MENU_CACHE_CFLAGS)
96AC_SUBST(MENU_CACHE_LIBS)
ade9c95c 97AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
ace2a572 98
77f69cbd
JL
99AC_ARG_ENABLE(more_warnings,
100 [AC_HELP_STRING([--enable-more-warnings],
101 [Add more warnings @<:@default=no@:>@])],
102 [enable_more_warnings="${enableval}"],
103 [enable_more_warnings=no]
104)
105
106if test x"$enable_more_warnings" = x"yes"; then
107 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"
108fi
109AC_SUBST(ADDITIONAL_FLAGS)
ade9c95c 110
77f69cbd 111PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
ace2a572
JH
112PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
113
40189d64
JH
114AC_ARG_ENABLE(man,
115 [AC_HELP_STRING([--enable-man],
116 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
117 [enable_man="${enableval}"],
118 [enable_man=no]
119)
120
cc0c9990
JH
121dnl linker tweaking
122# The function of the link flag --as-needed is to prevent unnecesary linking.
123# Example: A -> B -> C
20b3e401
JH
124# Normally, A would link to B and also depend on C, this is of cource
125# unnecesary. In this situation, however we do need to link to C, so this
cc0c9990
JH
126# must be done explicitly. This flag comes in handy when a library ABI
127# is changed, minimizing the amount of recompilations needed.
128AC_MSG_CHECKING([whether $LD accepts --as-needed])
129case `$LD --as-needed -v 2>&1 </dev/null` in
130*GNU* | *'with BFD'*)
20b3e401
JH
131 LDFLAGS="$LDFLAGS -Wl,--as-needed"
132 AC_MSG_RESULT([yes])
133 ;;
cc0c9990 134*)
20b3e401
JH
135 AC_MSG_RESULT([no])
136 ;;
cc0c9990
JH
137esac
138
cae18977
JH
139dnl linker optimizations
140AC_MSG_CHECKING([whether $LD accepts -O1])
141case `$LD -O1 -v 2>&1 </dev/null` in
142*GNU* | *'with BFD'*)
143 LDFLAGS="$LDFLAGS -Wl,-O1"
144 AC_MSG_RESULT([yes])
145 ;;
146*)
147 AC_MSG_RESULT([no])
148 ;;
149esac
150AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
151case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
152*GNU* | *'with BFD'*)
153 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
154 AC_MSG_RESULT([yes])
155 ;;
7e20ea34 156*)
cae18977
JH
157 AC_MSG_RESULT([no])
158 ;;
159esac
85026f6c
JH
160AC_MSG_CHECKING([whether $LD accepts --sort-common])
161case `$LD --sort-common -v 2>&1 </dev/null` in
7e20ea34 162*GNU* | *'with BFD'*)
85026f6c
JH
163 LDFLAGS="$LDFLAGS -Wl,--sort-common"
164 AC_MSG_RESULT([yes])
165 ;;
166*)
167 AC_MSG_RESULT([no])
168 ;;
169esac
cae18977 170
cc0c9990
JH
171dnl FIXME: filter for undefined symbols in plugins
172# when passing "-z defs" to linker, we would better to make sure
173# there are no undefined references. However, we intend not to
174# fix at the moment since we don't have spin-off libraray containing
175# the necessary functions.
176if test ! -z "$LDFLAGS"; then
20b3e401 177 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
cc0c9990
JH
178fi
179
180LXPANEL_MODULE="-avoid-version \
181-rpath \$(libdir)/lxpanel/plugins \
182-no-undefined "'-export-symbols-regex "^[[^_]].*"'
183AC_SUBST(LXPANEL_MODULE)
184
c044bccf 185AC_ARG_ENABLE([alsa],
24053345
HJYP
186 AS_HELP_STRING([--disable-alsa],
187 [compile ALSA providers (default: enable)]),
188 compile_alsa=$enableval, compile_alsa="yes")
c044bccf 189if test x"$compile_alsa" = "xyes"; then
24053345
HJYP
190 AC_CHECK_HEADERS([alsa/asoundlib.h],
191 [AC_CHECK_LIB([asound],
192 [snd_seq_open],
193 compile_alsa=yes,compile_alsa=no)],
c044bccf
JH
194 compile_alsa=no)
195fi
196AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
197dnl FIXME: check OSS existence
198AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
199
2d29cc96 200AC_ARG_ENABLE([plugins-loading],
24053345
HJYP
201 AS_HELP_STRING([--disable-plugins-loading],
202 [disable plugin loading (default: enable)]),
203 plugins_loading=$enableval, plugins_loading="yes")
2d29cc96 204
31b80004
JH
205AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
206
535ac098 207if test x"$plugins_loading" = "xno"; then
24053345 208 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
2d29cc96
JH
209fi
210
199c3ea8
JH
211dnl Here are plugin listing.
212plugin_netstatus=
65efa143 213plugin_netstat=
199c3ea8 214plugin_volume=
15556f61 215plugin_volumealsa=
199c3ea8 216plugin_cpu=
ce728cd9 217plugin_deskno=
8f11d5f8 218plugin_batt=
22242ed4 219plugin_xkb=
7e20ea34 220plugin_kbled=
09f498a1 221plugin_thermal=
c03f7bd0 222plugin_cpufreq=
9770479a 223plugin_monitors=
2ae466ab 224plugin_wnckpager=
9dda8252 225plugin_indicator=
199c3ea8
JH
226
227AC_MSG_CHECKING([which plugins should be built dynamically])
228AC_ARG_WITH(plugins,
229[ --with-plugins=<list> compile dynamic plugins in <list> ]
230[ plugins may be comma separated ]
231[ 'all' builds all plugins (default), 'none' builds none ]
3a604782 232[ plugins prefixed with '-' are not built]
199c3ea8 233[ Possible plugins are: ]
3a604782
HG
234[ netstatus, netstat, volume, volumealsa, cpu, deskno, batt,]
235[ kbled, xkb, thermal, cpufreq, monitors, wnckpager]
236, plugins="$withval",[plugins="all"])
199c3ea8
JH
237
238if test x"$plugins" != xall -a x"$plugins" != xnone; then
24053345
HJYP
239 if test x"$plugins_loading" = xno; then
240 AC_MSG_ERROR(
241 [--disable-plugins-loading and --with-plugins conflict each other.])
242 fi
199c3ea8
JH
243fi
244
65efa143 245ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors wnckpager indicator"
24053345
HJYP
246AC_SUBST(ALL_PLUGINS_LIST)
247
3a604782
HG
248AC_DEFUN([check_plugin_name],[
249 plugin_found=false
250 for name in $ALL_PLUGINS_LIST; do
251 if test x[$1] = x[$name]; then
252 plugin_found=true
253 fi
254 done
255 if test x[$plugin_found] = false; then
256 echo [Unknown plugin $1.]
257 exit 1
258 fi
259])
260
261if test "$plugins" != "none"; then
262 plugins=`echo $plugins | sed 's/,/ /g'`
263 for plugin in $plugins
264 do
24053345 265 case "$plugin" in
3a604782
HG
266 all)
267 for name in $ALL_PLUGINS_LIST
268 do
269 export plugin_$name="$name"
270 done
24053345 271 ;;
3a604782
HG
272 -*)
273 check_plugin_name([${plugin#-}])
274 export plugin_${plugin#-}=
9dda8252 275 ;;
24053345 276 *)
3a604782
HG
277 check_plugin_name([$plugin])
278 export plugin_$plugin=$plugin
24053345
HJYP
279 ;;
280 esac
3a604782
HG
281 done
282 AC_MSG_RESULT($plugins)
199c3ea8
JH
283fi
284
c044bccf
JH
285dnl FIXME: OSS/ALSA checking
286if test x"$compile_alsa" = "xno"; then
24053345
HJYP
287 if test ! -z $plugin_volumealsa; then
288 AC_MSG_RESULT([no ALSA headers/libraries found!])
289 plugin_volumealsa=
290 fi
c044bccf 291else
24053345
HJYP
292 dnl force OSS plugin to <null>
293 plugin_volume=
c044bccf 294fi
9dda8252
JL
295
296dnl Exclude indicator support when there is no support.
297if test x"$indicator_support" = "xno"; then
298 plugin_indicator=
299fi
300
22242ed4 301PLUGINS_LIST="\
7e20ea34 302 $plugin_netstatus \
65efa143 303 $plugin_netstat \
7e20ea34
HJYP
304 $plugin_volume \
305 $plugin_volumealsa \
306 $plugin_cpu \
307 $plugin_deskno \
308 $plugin_batt \
309 $plugin_kbled \
62550cea 310 $plugin_xkb \
c03f7bd0 311 $plugin_thermal \
9770479a 312 $plugin_cpufreq \
2ae466ab 313 $plugin_monitors \
9dda8252
JL
314 $plugin_wnckpager\
315 $plugin_indicator"
22242ed4 316
199c3ea8
JH
317AC_SUBST(PLUGINS_LIST)
318
fcb35553
PS
319# Plugin-specific dependencies
320# nestat
321if test x"$plugin_netstat" != "x";then
322AC_CHECK_HEADER([iwlib.h],,
323 AC_MSG_ERROR([netstat plugin requires wireless-tools-devel]))
324fi
1141e22a 325
a52c2257
HJYP
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
345
5f9e4cb1
JL
346# Generate po/LINGUAS on the fly rather than relying on translators
347# to maintain it manually. This also overcome the problem that Transifex
348# cannot add a language to po/LINGUAS if a new po file is submitted.
349rm -f $srcdir/po/LINGUAS
350for po_file in `ls $srcdir/po/*.po | sort`;
351do
352 lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
353 echo $lang >> $srcdir/po/LINGUAS
354done
355
a52c2257 356GETTEXT_PACKAGE=lxpanel
00118bd4 357AM_GNU_GETTEXT([external])
a52c2257
HJYP
358AM_GNU_GETTEXT_VERSION(0.14.1)
359AC_SUBST(GETTEXT_PACKAGE)
360AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
361
a52c2257
HJYP
362AM_GLIB_GNU_GETTEXT
363
40189d64
JH
364if test x"$enable_man" = x"yes"; then
365 AC_PATH_PROG([XSLTPROC], [xsltproc])
366 if test -z "$XSLTPROC"; then
367 enable_man=no
368 fi
369
370 dnl check for DocBook DTD and stylesheets in the local catalog.
371 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
372 [DocBook XML DTD V4.1.2], [], enable_man=no)
373 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
374 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
375fi
376
377AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
378
b366baa2
AG
379AC_ARG_ENABLE(debug,
380 [AC_HELP_STRING([--enable-debug],
381 [enable debug support @<:@default=no@:>@])],
382 [enable_debug="${enableval}"],
383 [enable_debug=no]
384)
385if test "$enable_debug" = "yes"; then
386 # turn on debug and disable optimization
387 CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
388 case "$CC" in
389 gcc*)
390 CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration"
391 ;;
392 *)
393 ;;
394 esac
395 dnl Be more strict on portability
396 #CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
397else
398 # turn off glib debug checks
399 CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
400fi
401
a52c2257 402AC_CONFIG_FILES([
f5c43b11 403 lxpanel.pc
24053345
HJYP
404 Makefile
405 src/Makefile
406 src/plugins/Makefile
407 src/plugins/netstatus/Makefile
65efa143 408 src/plugins/netstat/Makefile
24053345
HJYP
409 src/plugins/volume/Makefile
410 src/plugins/volumealsa/Makefile
411 src/plugins/cpu/Makefile
412 src/plugins/deskno/Makefile
413 src/plugins/batt/Makefile
7e20ea34 414 src/plugins/kbled/Makefile
22242ed4 415 src/plugins/xkb/Makefile
62550cea 416 src/plugins/thermal/Makefile
c03f7bd0 417 src/plugins/cpufreq/Makefile
9770479a 418 src/plugins/monitors/Makefile
2ae466ab 419 src/plugins/wnckpager/Makefile
9dda8252 420 src/plugins/indicator/Makefile
24053345
HJYP
421 po/Makefile.in
422 data/Makefile
cf701cb7 423 data/default/panels/panel
65efa143
JL
424 data/two_panels/panels/top
425 data/two_panels/panels/bottom
70344206 426 man/Makefile
a52c2257
HJYP
427])
428AC_OUTPUT
199c3ea8 429
24053345 430echo
ce728cd9 431echo lxpanel ......................... : Version $VERSION
199c3ea8
JH
432echo
433echo Prefix........................... : $prefix
434if test x$plugins_loading = xyes; then
435echo Building dynamic plugins:
24053345
HJYP
436 if test x"$plugin_netstatus" != x; then
437 AC_MSG_RESULT([ netstatus - Monitor networking status])
438 fi
65efa143
JL
439 if test x"$plugin_netstat" != x; then
440 AC_MSG_RESULT([ netstat - Monitor networking status])
441 fi
24053345 442 if test x"$plugin_volume" != x; then
8f9e6256 443 AC_MSG_RESULT([ volume - Display and adjust volume of sound card for OSS])
24053345
HJYP
444 fi
445 if test x"$plugin_volumealsa" != x; then
446 AC_MSG_RESULT([ volumealsa - Display and adjust volume of sound card for ALSA])
447 fi
448 if test x"$plugin_cpu" != x; then
449 AC_MSG_RESULT([ cpu - Display CPU loading])
450 fi
451 if test x"$plugin_deskno" != x; then
452 AC_MSG_RESULT([ deskno - Display desktop number])
453 fi
454 if test x"$plugin_batt" != x; then
455 AC_MSG_RESULT([ batt - Monitor battery status])
456 fi
7e20ea34
HJYP
457 if test x"$plugin_kbled" != x; then
458 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
459 fi
22242ed4 460 if test x"$plugin_xkb" != x; then
fc26a89e 461 AC_MSG_RESULT([ xkb - Keyboard layout handler])
22242ed4 462 fi
62550cea
FC
463 if test x"$plugin_thermal" != x; then
464 AC_MSG_RESULT([ thermal - Temperature monitor])
465 fi
c03f7bd0
DK
466 if test x"$plugin_cpufreq" != x; then
467 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
468 fi
9770479a
JL
469 if test x"$plugin_monitors" != x; then
470 AC_MSG_RESULT([ monitors - Monitors for CPU & RAM])
471 fi
2ae466ab
JL
472 if test x"$plugin_wnckpager" != x; then
473 AC_MSG_RESULT([ wnckpager - Pager which support openbox and compiz])
474 fi
9dda8252
JL
475 if test x"$plugin_indicator" != x; then
476 AC_MSG_RESULT([ indicator - Indicator support])
477 fi
199c3ea8
JH
478else
479echo Dynamic loader for plugins....... : disabled.
480fi
1234b94c
HJYP
481
482echo
46cea569
HJYP
483echo 'LXPanel requires menu-cache and lxmenu-data packages since'
484echo 'version 0.4.0. Please make sure they are correctly installed.'
485echo 'Otherwise, you will not be able to use applications menu.'
486echo
1234b94c 487