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