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