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