Adding upstream version 0.5.3.
[debian/lxpanel.git] / configure.ac
CommitLineData
6cc5e1a6 1AC_PREREQ(2.53)
2ba86315 2AC_INIT(lxpanel, 0.5.3, http://lxde.org/)
6cc5e1a6
DB
3AM_INIT_AUTOMAKE
4AC_CONFIG_SRCDIR([src/bg.c])
5AC_CONFIG_HEADER([config.h])
6
7# Force to dynamic
8AC_DISABLE_STATIC
9
10# Checks for programs.
11AC_PROG_CC
12AC_PROG_INSTALL
13AC_PROG_LN_S
14AC_PROG_LIBTOOL
15AC_PROG_INTLTOOL(, [no-xml])
2ba86315 16AM_PROG_CC_C_O
6cc5e1a6
DB
17
18# Checks for libraries.
7486d297 19pkg_modules="gtk+-2.0 >= 2.12.0 \
2ba86315 20 gio-unix-2.0 \
6cc5e1a6
DB
21 gthread-2.0"
22# libstartup-notification-1.0"
23PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
24AC_SUBST(PACKAGE_CFLAGS)
25AC_SUBST(PACKAGE_LIBS)
26
7486d297
DB
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
2ba86315
DB
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)
7486d297 47
6cc5e1a6
DB
48AC_ARG_ENABLE([cast-checks],
49 AS_HELP_STRING([--enable-cast-checks],
50 [enable Glib casting checks (default: disable)]),
51 cast_checks=$enableval, cast_checks="no")
52G_CAST_CHECKS=""
53if test x"$cast_checks" = "xno"; then
54 G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
55fi
56AC_SUBST(G_CAST_CHECKS)
57
58dnl linker tweaking
59# The function of the link flag --as-needed is to prevent unnecesary linking.
60# Example: A -> B -> C
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
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'*)
68 LDFLAGS="$LDFLAGS -Wl,--as-needed"
69 AC_MSG_RESULT([yes])
70 ;;
71*)
72 AC_MSG_RESULT([no])
73 ;;
74esac
75
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 ;;
93*)
94 AC_MSG_RESULT([no])
95 ;;
96esac
97AC_MSG_CHECKING([whether $LD accepts --sort-common])
98case `$LD --sort-common -v 2>&1 </dev/null` in
99*GNU* | *'with BFD'*)
100 LDFLAGS="$LDFLAGS -Wl,--sort-common"
101 AC_MSG_RESULT([yes])
102 ;;
103*)
104 AC_MSG_RESULT([no])
105 ;;
106esac
107
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
114 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
115fi
116
117LXPANEL_MODULE="-avoid-version \
118-rpath \$(libdir)/lxpanel/plugins \
119-no-undefined "'-export-symbols-regex "^[[^_]].*"'
120AC_SUBST(LXPANEL_MODULE)
121
122AC_ARG_ENABLE([alsa],
123 AS_HELP_STRING([--disable-alsa],
124 [compile ALSA providers (default: enable)]),
125 compile_alsa=$enableval, compile_alsa="yes")
126if test x"$compile_alsa" = "xyes"; then
127 AC_CHECK_HEADERS([alsa/asoundlib.h],
128 [AC_CHECK_LIB([asound],
129 [snd_seq_open],
130 compile_alsa=yes,compile_alsa=no)],
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
6cc5e1a6
DB
137AC_ARG_ENABLE([plugins-loading],
138 AS_HELP_STRING([--disable-plugins-loading],
139 [disable plugin loading (default: enable)]),
140 plugins_loading=$enableval, plugins_loading="yes")
141
142AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
143
144if test x"$plugins_loading" = "xno"; then
145 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
146fi
147
148dnl Here are plugin listing.
149plugin_netstatus=
6cc5e1a6
DB
150plugin_volume=
151plugin_volumealsa=
152plugin_cpu=
153plugin_deskno=
154plugin_batt=
155plugin_xkb=
156plugin_kbled=
7486d297 157plugin_thermal=
6cc5e1a6
DB
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: ]
2ba86315 165[ netstatus, volume, volumealsa, cpu, deskno, batt, kbled, xkb, thermal], plugins="$withval",[plugins="all"])
6cc5e1a6
DB
166
167if test x"$plugins" != xall -a x"$plugins" != xnone; then
168 if test x"$plugins_loading" = xno; then
169 AC_MSG_ERROR(
170 [--disable-plugins-loading and --with-plugins conflict each other.])
171 fi
172fi
173
2ba86315 174ALL_PLUGINS_LIST="netstatus volume volumealsa cpu deskno batt kbled xkb thermal"
6cc5e1a6
DB
175AC_SUBST(ALL_PLUGINS_LIST)
176
177if test x"$plugins" = xall; then
178dnl for name in $ALL_PLUGINS
179dnl do
180dnl export plugin_$name="$name"
181dnl done
182
183 plugin_netstatus=netstatus
6cc5e1a6
DB
184 plugin_volume=volume
185 plugin_volumealsa=volumealsa
186 plugin_cpu=cpu
187 plugin_deskno=deskno
188 plugin_batt=batt
189 plugin_kbled=kbled
2ba86315 190 plugin_xkb=xkb
7486d297 191 plugin_thermal=thermal
6cc5e1a6
DB
192
193 AC_MSG_RESULT(all)
194else
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 ;;
6cc5e1a6
DB
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)
216 plugin_batt=batt
217 ;;
218 kbled)
219 plugin_kbled=kbled
220 ;;
221 xkb)
222 plugin_xkb=xkb
223 ;;
7486d297
DB
224 thermal)
225 plugin_thermal=thermal
226 ;;
6cc5e1a6
DB
227 *)
228 echo "Unknown plugin $plugin."
229 exit 1
230 ;;
231 esac
232 done
233 AC_MSG_RESULT($plugins)
234 fi
235fi
236
237dnl FIXME: OSS/ALSA checking
238if test x"$compile_alsa" = "xno"; then
239 if test ! -z $plugin_volumealsa; then
240 AC_MSG_RESULT([no ALSA headers/libraries found!])
241 plugin_volumealsa=
242 fi
243else
244 dnl force OSS plugin to <null>
245 plugin_volume=
246fi
6cc5e1a6
DB
247PLUGINS_LIST="\
248 $plugin_netstatus \
6cc5e1a6
DB
249 $plugin_volume \
250 $plugin_volumealsa \
251 $plugin_cpu \
252 $plugin_deskno \
253 $plugin_batt \
254 $plugin_kbled \
7486d297
DB
255 $plugin_xkb \
256 $plugin_thermal"
6cc5e1a6
DB
257
258AC_SUBST(PLUGINS_LIST)
259
260
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
282#AM_GNU_GETTEXT([external])
283AM_GNU_GETTEXT_VERSION(0.14.1)
284AC_SUBST(GETTEXT_PACKAGE)
285AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
286
7486d297 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"
6cc5e1a6
DB
288AM_GLIB_GNU_GETTEXT
289
2ba86315
DB
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
6cc5e1a6 305AC_CONFIG_FILES([
7486d297 306 lxpanel.pc
6cc5e1a6
DB
307 Makefile
308 src/Makefile
309 src/plugins/Makefile
310 src/plugins/netstatus/Makefile
6cc5e1a6
DB
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
316 src/plugins/kbled/Makefile
317 src/plugins/xkb/Makefile
7486d297 318 src/plugins/thermal/Makefile
6cc5e1a6
DB
319 po/Makefile.in
320 data/Makefile
321 data/default/panels/panel
322 man/Makefile
323])
324AC_OUTPUT
325
326echo
327echo lxpanel ......................... : Version $VERSION
328echo
329echo Prefix........................... : $prefix
330if test x$plugins_loading = xyes; then
331echo Building dynamic plugins:
332 if test x"$plugin_netstatus" != x; then
333 AC_MSG_RESULT([ netstatus - Monitor networking status])
334 fi
6cc5e1a6 335 if test x"$plugin_volume" != x; then
2ba86315 336 AC_MSG_RESULT([ volume - Display and adjust volume of sound card for OSS])
6cc5e1a6
DB
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
350 if test x"$plugin_kbled" != x; then
351 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
352 fi
353 if test x"$plugin_xkb" != x; then
354 AC_MSG_RESULT([ xkb - Keyboard layout switcher])
355 fi
7486d297
DB
356 if test x"$plugin_thermal" != x; then
357 AC_MSG_RESULT([ thermal - Temperature monitor])
358 fi
6cc5e1a6
DB
359else
360echo Dynamic loader for plugins....... : disabled.
361fi
7486d297
DB
362
363echo
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
368