Apply patch from Debian to fix battery plugin display
[lxde/lxpanel.git] / configure.ac
CommitLineData
a52c2257 1AC_PREREQ(2.53)
71dc2560 2AC_INIT(lxpanel, 0.5.6, 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.
b3139230 25pkg_modules="gtk+-2.0 >= 2.12.0 \
1d434622 26 gio-unix-2.0 \
ace2a572 27 gthread-2.0"
fb20a9b5 28# libstartup-notification-1.0"
a52c2257
HJYP
29PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
30AC_SUBST(PACKAGE_CFLAGS)
31AC_SUBST(PACKAGE_LIBS)
32
9bf13ef5
MTW
33pkg_modules="x11"
34PKG_CHECK_MODULES(X11, [$pkg_modules])
35AC_SUBST(X11_LIBS)
36
ace2a572
JH
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)
ade9c95c 46AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
ace2a572 47
ade9c95c
JL
48#Don't use deprecated GTK and Glib functions
49DISABLE_DEPRECATED_FLAGS="-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 -DGSEAL_ENABLE"
50AC_SUBST(DISABLE_DEPRECATED_FLAGS)
51
52PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $DISABLE_DEPRECATED_FLAGS"
ace2a572
JH
53PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
54
40189d64
JH
55AC_ARG_ENABLE(man,
56 [AC_HELP_STRING([--enable-man],
57 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
58 [enable_man="${enableval}"],
59 [enable_man=no]
60)
61
535ac098 62AC_ARG_ENABLE([cast-checks],
24053345
HJYP
63 AS_HELP_STRING([--enable-cast-checks],
64 [enable Glib casting checks (default: disable)]),
65 cast_checks=$enableval, cast_checks="no")
535ac098
JH
66G_CAST_CHECKS=""
67if test x"$cast_checks" = "xno"; then
24053345 68 G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
535ac098
JH
69fi
70AC_SUBST(G_CAST_CHECKS)
71
cc0c9990
JH
72dnl linker tweaking
73# The function of the link flag --as-needed is to prevent unnecesary linking.
74# Example: A -> B -> C
20b3e401
JH
75# Normally, A would link to B and also depend on C, this is of cource
76# unnecesary. In this situation, however we do need to link to C, so this
cc0c9990
JH
77# must be done explicitly. This flag comes in handy when a library ABI
78# is changed, minimizing the amount of recompilations needed.
79AC_MSG_CHECKING([whether $LD accepts --as-needed])
80case `$LD --as-needed -v 2>&1 </dev/null` in
81*GNU* | *'with BFD'*)
20b3e401
JH
82 LDFLAGS="$LDFLAGS -Wl,--as-needed"
83 AC_MSG_RESULT([yes])
84 ;;
cc0c9990 85*)
20b3e401
JH
86 AC_MSG_RESULT([no])
87 ;;
cc0c9990
JH
88esac
89
cae18977
JH
90dnl linker optimizations
91AC_MSG_CHECKING([whether $LD accepts -O1])
92case `$LD -O1 -v 2>&1 </dev/null` in
93*GNU* | *'with BFD'*)
94 LDFLAGS="$LDFLAGS -Wl,-O1"
95 AC_MSG_RESULT([yes])
96 ;;
97*)
98 AC_MSG_RESULT([no])
99 ;;
100esac
101AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
102case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
103*GNU* | *'with BFD'*)
104 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
105 AC_MSG_RESULT([yes])
106 ;;
7e20ea34 107*)
cae18977
JH
108 AC_MSG_RESULT([no])
109 ;;
110esac
85026f6c
JH
111AC_MSG_CHECKING([whether $LD accepts --sort-common])
112case `$LD --sort-common -v 2>&1 </dev/null` in
7e20ea34 113*GNU* | *'with BFD'*)
85026f6c
JH
114 LDFLAGS="$LDFLAGS -Wl,--sort-common"
115 AC_MSG_RESULT([yes])
116 ;;
117*)
118 AC_MSG_RESULT([no])
119 ;;
120esac
cae18977 121
cc0c9990
JH
122dnl FIXME: filter for undefined symbols in plugins
123# when passing "-z defs" to linker, we would better to make sure
124# there are no undefined references. However, we intend not to
125# fix at the moment since we don't have spin-off libraray containing
126# the necessary functions.
127if test ! -z "$LDFLAGS"; then
20b3e401 128 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
cc0c9990
JH
129fi
130
131LXPANEL_MODULE="-avoid-version \
132-rpath \$(libdir)/lxpanel/plugins \
133-no-undefined "'-export-symbols-regex "^[[^_]].*"'
134AC_SUBST(LXPANEL_MODULE)
135
c044bccf 136AC_ARG_ENABLE([alsa],
24053345
HJYP
137 AS_HELP_STRING([--disable-alsa],
138 [compile ALSA providers (default: enable)]),
139 compile_alsa=$enableval, compile_alsa="yes")
c044bccf 140if test x"$compile_alsa" = "xyes"; then
24053345
HJYP
141 AC_CHECK_HEADERS([alsa/asoundlib.h],
142 [AC_CHECK_LIB([asound],
143 [snd_seq_open],
144 compile_alsa=yes,compile_alsa=no)],
c044bccf
JH
145 compile_alsa=no)
146fi
147AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
148dnl FIXME: check OSS existence
149AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
150
2d29cc96 151AC_ARG_ENABLE([plugins-loading],
24053345
HJYP
152 AS_HELP_STRING([--disable-plugins-loading],
153 [disable plugin loading (default: enable)]),
154 plugins_loading=$enableval, plugins_loading="yes")
2d29cc96 155
31b80004
JH
156AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
157
535ac098 158if test x"$plugins_loading" = "xno"; then
24053345 159 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
2d29cc96
JH
160fi
161
199c3ea8
JH
162dnl Here are plugin listing.
163plugin_netstatus=
164plugin_volume=
15556f61 165plugin_volumealsa=
199c3ea8 166plugin_cpu=
ce728cd9 167plugin_deskno=
8f11d5f8 168plugin_batt=
22242ed4 169plugin_xkb=
7e20ea34 170plugin_kbled=
09f498a1 171plugin_thermal=
c03f7bd0 172plugin_cpufreq=
199c3ea8
JH
173
174AC_MSG_CHECKING([which plugins should be built dynamically])
175AC_ARG_WITH(plugins,
176[ --with-plugins=<list> compile dynamic plugins in <list> ]
177[ plugins may be comma separated ]
178[ 'all' builds all plugins (default), 'none' builds none ]
179[ Possible plugins are: ]
c03f7bd0 180[ netstatus, volume, volumealsa, cpu, deskno, batt, kbled, xkb, thermal, cpufreq], plugins="$withval",[plugins="all"])
199c3ea8
JH
181
182if test x"$plugins" != xall -a x"$plugins" != xnone; then
24053345
HJYP
183 if test x"$plugins_loading" = xno; then
184 AC_MSG_ERROR(
185 [--disable-plugins-loading and --with-plugins conflict each other.])
186 fi
199c3ea8
JH
187fi
188
974881a1 189ALL_PLUGINS_LIST="netstatus volume volumealsa cpu deskno batt kbled xkb thermal cpufreq"
24053345
HJYP
190AC_SUBST(ALL_PLUGINS_LIST)
191
199c3ea8 192if test x"$plugins" = xall; then
24053345
HJYP
193dnl for name in $ALL_PLUGINS
194dnl do
195dnl export plugin_$name="$name"
196dnl done
197
198 plugin_netstatus=netstatus
24053345
HJYP
199 plugin_volume=volume
200 plugin_volumealsa=volumealsa
201 plugin_cpu=cpu
202 plugin_deskno=deskno
203 plugin_batt=batt
7e20ea34 204 plugin_kbled=kbled
8f9e6256 205 plugin_xkb=xkb
62550cea 206 plugin_thermal=thermal
c03f7bd0 207 plugin_cpufreq=cpufreq
24053345
HJYP
208
209 AC_MSG_RESULT(all)
199c3ea8 210else
24053345
HJYP
211 if test "$plugins" != "none"; then
212 plugins=`echo $plugins | sed 's/,/ /g'`
213 for plugin in $plugins
214 do
215 case "$plugin" in
216 netstatus)
217 plugin_netstatus=netstatus
218 ;;
24053345
HJYP
219 volume)
220 plugin_volume=volume
221 ;;
222 volumealsa)
223 plugin_volumealsa=volumealsa
224 ;;
225 cpu)
226 plugin_cpu=cpu
227 ;;
228 deskno)
229 plugin_deskno=deskno
230 ;;
231 batt)
22242ed4
HJYP
232 plugin_batt=batt
233 ;;
7e20ea34
HJYP
234 kbled)
235 plugin_kbled=kbled
236 ;;
22242ed4
HJYP
237 xkb)
238 plugin_xkb=xkb
24053345 239 ;;
62550cea
FC
240 thermal)
241 plugin_thermal=thermal
242 ;;
c03f7bd0
DK
243 cpufreq)
244 plugin_cpufreq=cpufreq
245 ;;
24053345
HJYP
246 *)
247 echo "Unknown plugin $plugin."
248 exit 1
249 ;;
250 esac
251 done
252 AC_MSG_RESULT($plugins)
253 fi
199c3ea8
JH
254fi
255
c044bccf
JH
256dnl FIXME: OSS/ALSA checking
257if test x"$compile_alsa" = "xno"; then
24053345
HJYP
258 if test ! -z $plugin_volumealsa; then
259 AC_MSG_RESULT([no ALSA headers/libraries found!])
260 plugin_volumealsa=
261 fi
c044bccf 262else
24053345
HJYP
263 dnl force OSS plugin to <null>
264 plugin_volume=
c044bccf 265fi
22242ed4 266PLUGINS_LIST="\
7e20ea34 267 $plugin_netstatus \
7e20ea34
HJYP
268 $plugin_volume \
269 $plugin_volumealsa \
270 $plugin_cpu \
271 $plugin_deskno \
272 $plugin_batt \
273 $plugin_kbled \
62550cea 274 $plugin_xkb \
c03f7bd0
DK
275 $plugin_thermal \
276 $plugin_cpufreq"
22242ed4 277
199c3ea8
JH
278AC_SUBST(PLUGINS_LIST)
279
1141e22a 280
a52c2257
HJYP
281# Checks for header files.
282AC_PATH_X
283AC_HEADER_STDC
284AC_HEADER_SYS_WAIT
285AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
286
287# Checks for typedefs, structures, and compiler characteristics.
288AC_C_CONST
289AC_C_INLINE
290AC_STRUCT_TM
291
292# Checks for library functions.
293AC_FUNC_MALLOC
294AC_FUNC_MEMCMP
295AC_TYPE_SIGNAL
296AC_FUNC_STAT
297AC_FUNC_STRFTIME
298AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
299
300
301GETTEXT_PACKAGE=lxpanel
42fe8c5f 302#AM_GNU_GETTEXT([external])
a52c2257
HJYP
303AM_GNU_GETTEXT_VERSION(0.14.1)
304AC_SUBST(GETTEXT_PACKAGE)
305AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
306
96e15404 307ALL_LINGUAS="af ar cs da de es et eu fa fi fr gl hu hr id it ja ko lt ml ms nb nl nn pl ps pt pt_BR ru sk sl sv tr uk ur ur_PK vi zh_CN zh_TW"
a52c2257
HJYP
308AM_GLIB_GNU_GETTEXT
309
40189d64
JH
310if test x"$enable_man" = x"yes"; then
311 AC_PATH_PROG([XSLTPROC], [xsltproc])
312 if test -z "$XSLTPROC"; then
313 enable_man=no
314 fi
315
316 dnl check for DocBook DTD and stylesheets in the local catalog.
317 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
318 [DocBook XML DTD V4.1.2], [], enable_man=no)
319 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
320 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
321fi
322
323AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
324
a52c2257 325AC_CONFIG_FILES([
f5c43b11 326 lxpanel.pc
24053345
HJYP
327 Makefile
328 src/Makefile
329 src/plugins/Makefile
330 src/plugins/netstatus/Makefile
24053345
HJYP
331 src/plugins/volume/Makefile
332 src/plugins/volumealsa/Makefile
333 src/plugins/cpu/Makefile
334 src/plugins/deskno/Makefile
335 src/plugins/batt/Makefile
7e20ea34 336 src/plugins/kbled/Makefile
22242ed4 337 src/plugins/xkb/Makefile
62550cea 338 src/plugins/thermal/Makefile
c03f7bd0 339 src/plugins/cpufreq/Makefile
24053345
HJYP
340 po/Makefile.in
341 data/Makefile
cf701cb7 342 data/default/panels/panel
70344206 343 man/Makefile
a52c2257
HJYP
344])
345AC_OUTPUT
199c3ea8 346
24053345 347echo
ce728cd9 348echo lxpanel ......................... : Version $VERSION
199c3ea8
JH
349echo
350echo Prefix........................... : $prefix
351if test x$plugins_loading = xyes; then
352echo Building dynamic plugins:
24053345
HJYP
353 if test x"$plugin_netstatus" != x; then
354 AC_MSG_RESULT([ netstatus - Monitor networking status])
355 fi
24053345 356 if test x"$plugin_volume" != x; then
8f9e6256 357 AC_MSG_RESULT([ volume - Display and adjust volume of sound card for OSS])
24053345
HJYP
358 fi
359 if test x"$plugin_volumealsa" != x; then
360 AC_MSG_RESULT([ volumealsa - Display and adjust volume of sound card for ALSA])
361 fi
362 if test x"$plugin_cpu" != x; then
363 AC_MSG_RESULT([ cpu - Display CPU loading])
364 fi
365 if test x"$plugin_deskno" != x; then
366 AC_MSG_RESULT([ deskno - Display desktop number])
367 fi
368 if test x"$plugin_batt" != x; then
369 AC_MSG_RESULT([ batt - Monitor battery status])
370 fi
7e20ea34
HJYP
371 if test x"$plugin_kbled" != x; then
372 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
373 fi
22242ed4
HJYP
374 if test x"$plugin_xkb" != x; then
375 AC_MSG_RESULT([ xkb - Keyboard layout switcher])
376 fi
62550cea
FC
377 if test x"$plugin_thermal" != x; then
378 AC_MSG_RESULT([ thermal - Temperature monitor])
379 fi
c03f7bd0
DK
380 if test x"$plugin_cpufreq" != x; then
381 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
382 fi
199c3ea8
JH
383else
384echo Dynamic loader for plugins....... : disabled.
385fi
1234b94c
HJYP
386
387echo
46cea569
HJYP
388echo 'LXPanel requires menu-cache and lxmenu-data packages since'
389echo 'version 0.4.0. Please make sure they are correctly installed.'
390echo 'Otherwise, you will not be able to use applications menu.'
391echo
1234b94c 392