Adding upstream version 0.5.7.
[debian/lxpanel.git] / configure.ac
CommitLineData
6cc5e1a6 1AC_PREREQ(2.53)
cb7f7ba8
DB
2AC_INIT(lxpanel, 0.5.7, http://lxde.org/)
3AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign])
6cc5e1a6
DB
4AC_CONFIG_HEADER([config.h])
5
cb7f7ba8
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])
2ba86315 18AM_PROG_CC_C_O
6cc5e1a6 19
cb7f7ba8
DB
20#Initialize libtool
21LT_PREREQ([2.2])
22LT_INIT
23
6cc5e1a6 24# Checks for libraries.
7486d297 25pkg_modules="gtk+-2.0 >= 2.12.0 \
2ba86315 26 gio-unix-2.0 \
6cc5e1a6
DB
27 gthread-2.0"
28# libstartup-notification-1.0"
29PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
30AC_SUBST(PACKAGE_CFLAGS)
31AC_SUBST(PACKAGE_LIBS)
32
32a67dc7
DB
33pkg_modules="x11"
34PKG_CHECK_MODULES(X11, [$pkg_modules])
35AC_SUBST(X11_LIBS)
36
7486d297
DB
37pkg_modules="libmenu-cache"
38PKG_CHECK_MODULES(MENU_CACHE, [$pkg_modules],
39 enable_menu_cache=yes, enable_menu_cache=no)
40if test x"$enable_menu_cache" = "xno"; then
41 AC_WARN([No libmenu-cache found. All menu related routines are not built.])
42 AC_DEFINE(DISABLE_MENU, [1], [Disable menu related routines])
43fi
44AC_SUBST(MENU_CACHE_CFLAGS)
45AC_SUBST(MENU_CACHE_LIBS)
cb7f7ba8
DB
46AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
47
48AC_ARG_ENABLE(more_warnings,
49 [AC_HELP_STRING([--enable-more-warnings],
50 [Add more warnings @<:@default=no@:>@])],
51 [enable_more_warnings="${enableval}"],
52 [enable_more_warnings=no]
53)
7486d297 54
cb7f7ba8
DB
55if test x"$enable_more_warnings" = x"yes"; then
56 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"
57fi
58AC_SUBST(ADDITIONAL_FLAGS)
59
60PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
7486d297
DB
61PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
62
2ba86315
DB
63AC_ARG_ENABLE(man,
64 [AC_HELP_STRING([--enable-man],
65 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
66 [enable_man="${enableval}"],
67 [enable_man=no]
68)
7486d297 69
6cc5e1a6
DB
70AC_ARG_ENABLE([cast-checks],
71 AS_HELP_STRING([--enable-cast-checks],
72 [enable Glib casting checks (default: disable)]),
73 cast_checks=$enableval, cast_checks="no")
74G_CAST_CHECKS=""
75if test x"$cast_checks" = "xno"; then
76 G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
77fi
78AC_SUBST(G_CAST_CHECKS)
79
80dnl linker tweaking
81# The function of the link flag --as-needed is to prevent unnecesary linking.
82# Example: A -> B -> C
83# Normally, A would link to B and also depend on C, this is of cource
84# unnecesary. In this situation, however we do need to link to C, so this
85# must be done explicitly. This flag comes in handy when a library ABI
86# is changed, minimizing the amount of recompilations needed.
87AC_MSG_CHECKING([whether $LD accepts --as-needed])
88case `$LD --as-needed -v 2>&1 </dev/null` in
89*GNU* | *'with BFD'*)
90 LDFLAGS="$LDFLAGS -Wl,--as-needed"
91 AC_MSG_RESULT([yes])
92 ;;
93*)
94 AC_MSG_RESULT([no])
95 ;;
96esac
97
98dnl linker optimizations
99AC_MSG_CHECKING([whether $LD accepts -O1])
100case `$LD -O1 -v 2>&1 </dev/null` in
101*GNU* | *'with BFD'*)
102 LDFLAGS="$LDFLAGS -Wl,-O1"
103 AC_MSG_RESULT([yes])
104 ;;
105*)
106 AC_MSG_RESULT([no])
107 ;;
108esac
109AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
110case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
111*GNU* | *'with BFD'*)
112 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
113 AC_MSG_RESULT([yes])
114 ;;
115*)
116 AC_MSG_RESULT([no])
117 ;;
118esac
119AC_MSG_CHECKING([whether $LD accepts --sort-common])
120case `$LD --sort-common -v 2>&1 </dev/null` in
121*GNU* | *'with BFD'*)
122 LDFLAGS="$LDFLAGS -Wl,--sort-common"
123 AC_MSG_RESULT([yes])
124 ;;
125*)
126 AC_MSG_RESULT([no])
127 ;;
128esac
129
130dnl FIXME: filter for undefined symbols in plugins
131# when passing "-z defs" to linker, we would better to make sure
132# there are no undefined references. However, we intend not to
133# fix at the moment since we don't have spin-off libraray containing
134# the necessary functions.
135if test ! -z "$LDFLAGS"; then
136 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
137fi
138
139LXPANEL_MODULE="-avoid-version \
140-rpath \$(libdir)/lxpanel/plugins \
141-no-undefined "'-export-symbols-regex "^[[^_]].*"'
142AC_SUBST(LXPANEL_MODULE)
143
144AC_ARG_ENABLE([alsa],
145 AS_HELP_STRING([--disable-alsa],
146 [compile ALSA providers (default: enable)]),
147 compile_alsa=$enableval, compile_alsa="yes")
148if test x"$compile_alsa" = "xyes"; then
149 AC_CHECK_HEADERS([alsa/asoundlib.h],
150 [AC_CHECK_LIB([asound],
151 [snd_seq_open],
152 compile_alsa=yes,compile_alsa=no)],
153 compile_alsa=no)
154fi
155AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
156dnl FIXME: check OSS existence
157AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
158
6cc5e1a6
DB
159AC_ARG_ENABLE([plugins-loading],
160 AS_HELP_STRING([--disable-plugins-loading],
161 [disable plugin loading (default: enable)]),
162 plugins_loading=$enableval, plugins_loading="yes")
163
164AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
165
166if test x"$plugins_loading" = "xno"; then
167 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
168fi
169
170dnl Here are plugin listing.
171plugin_netstatus=
6cc5e1a6
DB
172plugin_volume=
173plugin_volumealsa=
174plugin_cpu=
175plugin_deskno=
176plugin_batt=
177plugin_xkb=
178plugin_kbled=
7486d297 179plugin_thermal=
aa0e9095 180plugin_cpufreq=
6cc5e1a6
DB
181
182AC_MSG_CHECKING([which plugins should be built dynamically])
183AC_ARG_WITH(plugins,
184[ --with-plugins=<list> compile dynamic plugins in <list> ]
185[ plugins may be comma separated ]
186[ 'all' builds all plugins (default), 'none' builds none ]
187[ Possible plugins are: ]
aa0e9095 188[ netstatus, volume, volumealsa, cpu, deskno, batt, kbled, xkb, thermal, cpufreq], plugins="$withval",[plugins="all"])
6cc5e1a6
DB
189
190if test x"$plugins" != xall -a x"$plugins" != xnone; then
191 if test x"$plugins_loading" = xno; then
192 AC_MSG_ERROR(
193 [--disable-plugins-loading and --with-plugins conflict each other.])
194 fi
195fi
196
aa0e9095 197ALL_PLUGINS_LIST="netstatus volume volumealsa cpu deskno batt kbled xkb thermal cpufreq"
6cc5e1a6
DB
198AC_SUBST(ALL_PLUGINS_LIST)
199
200if test x"$plugins" = xall; then
201dnl for name in $ALL_PLUGINS
202dnl do
203dnl export plugin_$name="$name"
204dnl done
205
206 plugin_netstatus=netstatus
6cc5e1a6
DB
207 plugin_volume=volume
208 plugin_volumealsa=volumealsa
209 plugin_cpu=cpu
210 plugin_deskno=deskno
211 plugin_batt=batt
212 plugin_kbled=kbled
2ba86315 213 plugin_xkb=xkb
7486d297 214 plugin_thermal=thermal
aa0e9095 215 plugin_cpufreq=cpufreq
6cc5e1a6
DB
216
217 AC_MSG_RESULT(all)
218else
219 if test "$plugins" != "none"; then
220 plugins=`echo $plugins | sed 's/,/ /g'`
221 for plugin in $plugins
222 do
223 case "$plugin" in
224 netstatus)
225 plugin_netstatus=netstatus
226 ;;
6cc5e1a6
DB
227 volume)
228 plugin_volume=volume
229 ;;
230 volumealsa)
231 plugin_volumealsa=volumealsa
232 ;;
233 cpu)
234 plugin_cpu=cpu
235 ;;
236 deskno)
237 plugin_deskno=deskno
238 ;;
239 batt)
240 plugin_batt=batt
241 ;;
242 kbled)
243 plugin_kbled=kbled
244 ;;
245 xkb)
246 plugin_xkb=xkb
247 ;;
7486d297
DB
248 thermal)
249 plugin_thermal=thermal
250 ;;
aa0e9095
DB
251 cpufreq)
252 plugin_cpufreq=cpufreq
253 ;;
6cc5e1a6
DB
254 *)
255 echo "Unknown plugin $plugin."
256 exit 1
257 ;;
258 esac
259 done
260 AC_MSG_RESULT($plugins)
261 fi
262fi
263
264dnl FIXME: OSS/ALSA checking
265if test x"$compile_alsa" = "xno"; then
266 if test ! -z $plugin_volumealsa; then
267 AC_MSG_RESULT([no ALSA headers/libraries found!])
268 plugin_volumealsa=
269 fi
270else
271 dnl force OSS plugin to <null>
272 plugin_volume=
273fi
6cc5e1a6
DB
274PLUGINS_LIST="\
275 $plugin_netstatus \
6cc5e1a6
DB
276 $plugin_volume \
277 $plugin_volumealsa \
278 $plugin_cpu \
279 $plugin_deskno \
280 $plugin_batt \
281 $plugin_kbled \
7486d297 282 $plugin_xkb \
aa0e9095
DB
283 $plugin_thermal \
284 $plugin_cpufreq"
6cc5e1a6
DB
285
286AC_SUBST(PLUGINS_LIST)
287
288
289# Checks for header files.
290AC_PATH_X
291AC_HEADER_STDC
292AC_HEADER_SYS_WAIT
293AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
294
295# Checks for typedefs, structures, and compiler characteristics.
296AC_C_CONST
297AC_C_INLINE
298AC_STRUCT_TM
299
300# Checks for library functions.
301AC_FUNC_MALLOC
302AC_FUNC_MEMCMP
303AC_TYPE_SIGNAL
304AC_FUNC_STAT
305AC_FUNC_STRFTIME
306AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
307
308
cb7f7ba8
DB
309# Generate po/LINGUAS on the fly rather than relying on translators
310# to maintain it manually. This also overcome the problem that Transifex
311# cannot add a language to po/LINGUAS if a new po file is submitted.
312rm -f $srcdir/po/LINGUAS
313for po_file in `ls $srcdir/po/*.po | sort`;
314do
315 lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
316 echo $lang >> $srcdir/po/LINGUAS
317done
318
6cc5e1a6
DB
319GETTEXT_PACKAGE=lxpanel
320#AM_GNU_GETTEXT([external])
321AM_GNU_GETTEXT_VERSION(0.14.1)
322AC_SUBST(GETTEXT_PACKAGE)
323AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
324
6cc5e1a6
DB
325AM_GLIB_GNU_GETTEXT
326
2ba86315
DB
327if test x"$enable_man" = x"yes"; then
328 AC_PATH_PROG([XSLTPROC], [xsltproc])
329 if test -z "$XSLTPROC"; then
330 enable_man=no
331 fi
332
333 dnl check for DocBook DTD and stylesheets in the local catalog.
334 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
335 [DocBook XML DTD V4.1.2], [], enable_man=no)
336 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
337 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
338fi
339
340AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
341
6cc5e1a6 342AC_CONFIG_FILES([
7486d297 343 lxpanel.pc
6cc5e1a6
DB
344 Makefile
345 src/Makefile
346 src/plugins/Makefile
347 src/plugins/netstatus/Makefile
6cc5e1a6
DB
348 src/plugins/volume/Makefile
349 src/plugins/volumealsa/Makefile
350 src/plugins/cpu/Makefile
351 src/plugins/deskno/Makefile
352 src/plugins/batt/Makefile
353 src/plugins/kbled/Makefile
354 src/plugins/xkb/Makefile
7486d297 355 src/plugins/thermal/Makefile
aa0e9095 356 src/plugins/cpufreq/Makefile
6cc5e1a6
DB
357 po/Makefile.in
358 data/Makefile
359 data/default/panels/panel
360 man/Makefile
361])
362AC_OUTPUT
363
364echo
365echo lxpanel ......................... : Version $VERSION
366echo
367echo Prefix........................... : $prefix
368if test x$plugins_loading = xyes; then
369echo Building dynamic plugins:
370 if test x"$plugin_netstatus" != x; then
371 AC_MSG_RESULT([ netstatus - Monitor networking status])
372 fi
6cc5e1a6 373 if test x"$plugin_volume" != x; then
2ba86315 374 AC_MSG_RESULT([ volume - Display and adjust volume of sound card for OSS])
6cc5e1a6
DB
375 fi
376 if test x"$plugin_volumealsa" != x; then
377 AC_MSG_RESULT([ volumealsa - Display and adjust volume of sound card for ALSA])
378 fi
379 if test x"$plugin_cpu" != x; then
380 AC_MSG_RESULT([ cpu - Display CPU loading])
381 fi
382 if test x"$plugin_deskno" != x; then
383 AC_MSG_RESULT([ deskno - Display desktop number])
384 fi
385 if test x"$plugin_batt" != x; then
386 AC_MSG_RESULT([ batt - Monitor battery status])
387 fi
388 if test x"$plugin_kbled" != x; then
389 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
390 fi
391 if test x"$plugin_xkb" != x; then
392 AC_MSG_RESULT([ xkb - Keyboard layout switcher])
393 fi
7486d297
DB
394 if test x"$plugin_thermal" != x; then
395 AC_MSG_RESULT([ thermal - Temperature monitor])
396 fi
aa0e9095
DB
397 if test x"$plugin_cpufreq" != x; then
398 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
399 fi
6cc5e1a6
DB
400else
401echo Dynamic loader for plugins....... : disabled.
402fi
7486d297
DB
403
404echo
405echo 'LXPanel requires menu-cache and lxmenu-data packages since'
406echo 'version 0.4.0. Please make sure they are correctly installed.'
407echo 'Otherwise, you will not be able to use applications menu.'
408echo
409