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