Adding upstream version 0.3.8.1.
[debian/lxpanel.git] / configure.ac
CommitLineData
6cc5e1a6 1AC_PREREQ(2.53)
96dc8a45 2AC_INIT(lxpanel, 0.3.8.1, 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])
16
17# Checks for libraries.
18pkg_modules="gtk+-2.0 >= 2.6.0 \
19 gthread-2.0"
20# libstartup-notification-1.0"
21PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
22AC_SUBST(PACKAGE_CFLAGS)
23AC_SUBST(PACKAGE_LIBS)
24
25AC_ARG_ENABLE([cast-checks],
26 AS_HELP_STRING([--enable-cast-checks],
27 [enable Glib casting checks (default: disable)]),
28 cast_checks=$enableval, cast_checks="no")
29G_CAST_CHECKS=""
30if test x"$cast_checks" = "xno"; then
31 G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
32fi
33AC_SUBST(G_CAST_CHECKS)
34
35dnl linker tweaking
36# The function of the link flag --as-needed is to prevent unnecesary linking.
37# Example: A -> B -> C
38# Normally, A would link to B and also depend on C, this is of cource
39# unnecesary. In this situation, however we do need to link to C, so this
40# must be done explicitly. This flag comes in handy when a library ABI
41# is changed, minimizing the amount of recompilations needed.
42AC_MSG_CHECKING([whether $LD accepts --as-needed])
43case `$LD --as-needed -v 2>&1 </dev/null` in
44*GNU* | *'with BFD'*)
45 LDFLAGS="$LDFLAGS -Wl,--as-needed"
46 AC_MSG_RESULT([yes])
47 ;;
48*)
49 AC_MSG_RESULT([no])
50 ;;
51esac
52
53dnl linker optimizations
54AC_MSG_CHECKING([whether $LD accepts -O1])
55case `$LD -O1 -v 2>&1 </dev/null` in
56*GNU* | *'with BFD'*)
57 LDFLAGS="$LDFLAGS -Wl,-O1"
58 AC_MSG_RESULT([yes])
59 ;;
60*)
61 AC_MSG_RESULT([no])
62 ;;
63esac
64AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
65case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
66*GNU* | *'with BFD'*)
67 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
68 AC_MSG_RESULT([yes])
69 ;;
70*)
71 AC_MSG_RESULT([no])
72 ;;
73esac
74AC_MSG_CHECKING([whether $LD accepts --sort-common])
75case `$LD --sort-common -v 2>&1 </dev/null` in
76*GNU* | *'with BFD'*)
77 LDFLAGS="$LDFLAGS -Wl,--sort-common"
78 AC_MSG_RESULT([yes])
79 ;;
80*)
81 AC_MSG_RESULT([no])
82 ;;
83esac
84
85dnl FIXME: filter for undefined symbols in plugins
86# when passing "-z defs" to linker, we would better to make sure
87# there are no undefined references. However, we intend not to
88# fix at the moment since we don't have spin-off libraray containing
89# the necessary functions.
90if test ! -z "$LDFLAGS"; then
91 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
92fi
93
94LXPANEL_MODULE="-avoid-version \
95-rpath \$(libdir)/lxpanel/plugins \
96-no-undefined "'-export-symbols-regex "^[[^_]].*"'
97AC_SUBST(LXPANEL_MODULE)
98
99AC_ARG_ENABLE([alsa],
100 AS_HELP_STRING([--disable-alsa],
101 [compile ALSA providers (default: enable)]),
102 compile_alsa=$enableval, compile_alsa="yes")
103if test x"$compile_alsa" = "xyes"; then
104 AC_CHECK_HEADERS([alsa/asoundlib.h],
105 [AC_CHECK_LIB([asound],
106 [snd_seq_open],
107 compile_alsa=yes,compile_alsa=no)],
108 compile_alsa=no)
109fi
110AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
111dnl FIXME: check OSS existence
112AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
113
114# check libiw for netstat plugin
115AC_ARG_ENABLE([libiw],
116 AS_HELP_STRING([--disable-libiw],
117 [compile libiw-based netstat plugin (default: enable)]),
118 compile_libiw=$enableval, compile_libiw="yes")
119if test x"$compile_libiw" = "xyes"; then
120 AC_CHECK_HEADERS(iwlib.h,
121 [AC_CHECK_LIB(iw,
122 iw_sockets_open,
123 compile_libiw=yes,
124 compile_libiw=no)],
125 compile_libiw=no)
126fi
127AM_CONDITIONAL(BUILD_LIBIW_PLUGINS, test x$compile_libiw = xyes)
128
129AC_ARG_ENABLE([plugins-loading],
130 AS_HELP_STRING([--disable-plugins-loading],
131 [disable plugin loading (default: enable)]),
132 plugins_loading=$enableval, plugins_loading="yes")
133
134AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
135
136if test x"$plugins_loading" = "xno"; then
137 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
138fi
139
140dnl Here are plugin listing.
141plugin_netstatus=
142plugin_netstat=
143plugin_volume=
144plugin_volumealsa=
145plugin_cpu=
146plugin_deskno=
147plugin_batt=
148plugin_xkb=
149plugin_kbled=
150
151AC_MSG_CHECKING([which plugins should be built dynamically])
152AC_ARG_WITH(plugins,
153[ --with-plugins=<list> compile dynamic plugins in <list> ]
154[ plugins may be comma separated ]
155[ 'all' builds all plugins (default), 'none' builds none ]
156[ Possible plugins are: ]
157[ netstatus, netstat, volume, volumealsa, cpu, deskno, batt, kbled, xkb], plugins="$withval",[plugins="all"])
158
159if test x"$plugins" != xall -a x"$plugins" != xnone; then
160 if test x"$plugins_loading" = xno; then
161 AC_MSG_ERROR(
162 [--disable-plugins-loading and --with-plugins conflict each other.])
163 fi
164fi
165
166ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb"
167AC_SUBST(ALL_PLUGINS_LIST)
168
169if test x"$plugins" = xall; then
170dnl for name in $ALL_PLUGINS
171dnl do
172dnl export plugin_$name="$name"
173dnl done
174
175 plugin_netstatus=netstatus
176 plugin_netstat=netstat
177 plugin_volume=volume
178 plugin_volumealsa=volumealsa
179 plugin_cpu=cpu
180 plugin_deskno=deskno
181 plugin_batt=batt
182 plugin_kbled=kbled
183 plugin_xkb=
184
185 AC_MSG_RESULT(all)
186else
187 if test "$plugins" != "none"; then
188 plugins=`echo $plugins | sed 's/,/ /g'`
189 for plugin in $plugins
190 do
191 case "$plugin" in
192 netstatus)
193 plugin_netstatus=netstatus
194 ;;
195 netstat)
196 plugin_netstat=netstat
197 ;;
198 volume)
199 plugin_volume=volume
200 ;;
201 volumealsa)
202 plugin_volumealsa=volumealsa
203 ;;
204 cpu)
205 plugin_cpu=cpu
206 ;;
207 deskno)
208 plugin_deskno=deskno
209 ;;
210 batt)
211 plugin_batt=batt
212 ;;
213 kbled)
214 plugin_kbled=kbled
215 ;;
216 xkb)
217 plugin_xkb=xkb
218 ;;
219 *)
220 echo "Unknown plugin $plugin."
221 exit 1
222 ;;
223 esac
224 done
225 AC_MSG_RESULT($plugins)
226 fi
227fi
228
229dnl FIXME: OSS/ALSA checking
230if test x"$compile_alsa" = "xno"; then
231 if test ! -z $plugin_volumealsa; then
232 AC_MSG_RESULT([no ALSA headers/libraries found!])
233 plugin_volumealsa=
234 fi
235else
236 dnl force OSS plugin to <null>
237 plugin_volume=
238fi
239if test x"$compile_libiw" = "xno"; then
240 if test ! -z $plugin_netstat; then
241 AC_MSG_RESULT([no libiw headers/libraries found!])
242 fi
243 plugin_netstat=
244fi
245PLUGINS_LIST="\
246 $plugin_netstatus \
247 $plugin_netstat \
248 $plugin_volume \
249 $plugin_volumealsa \
250 $plugin_cpu \
251 $plugin_deskno \
252 $plugin_batt \
253 $plugin_kbled \
254 $plugin_xkb"
255
256AC_SUBST(PLUGINS_LIST)
257
258
259# Checks for header files.
260AC_PATH_X
261AC_HEADER_STDC
262AC_HEADER_SYS_WAIT
263AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
264
265# Checks for typedefs, structures, and compiler characteristics.
266AC_C_CONST
267AC_C_INLINE
268AC_STRUCT_TM
269
270# Checks for library functions.
271AC_FUNC_MALLOC
272AC_FUNC_MEMCMP
273AC_TYPE_SIGNAL
274AC_FUNC_STAT
275AC_FUNC_STRFTIME
276AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
277
278
279GETTEXT_PACKAGE=lxpanel
280#AM_GNU_GETTEXT([external])
281AM_GNU_GETTEXT_VERSION(0.14.1)
282AC_SUBST(GETTEXT_PACKAGE)
283AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
284
96dc8a45 285ALL_LINGUAS="zh_TW ko hu sk pl fr pt_BR fi de es"
6cc5e1a6
DB
286AM_GLIB_GNU_GETTEXT
287
288AC_CONFIG_FILES([
289 Makefile
290 src/Makefile
291 src/plugins/Makefile
292 src/plugins/netstatus/Makefile
293 src/plugins/netstat/Makefile
294 src/plugins/volume/Makefile
295 src/plugins/volumealsa/Makefile
296 src/plugins/cpu/Makefile
297 src/plugins/deskno/Makefile
298 src/plugins/batt/Makefile
299 src/plugins/kbled/Makefile
300 src/plugins/xkb/Makefile
301 po/Makefile.in
302 data/Makefile
303 data/default/panels/panel
304 man/Makefile
305])
306AC_OUTPUT
307
308echo
309echo lxpanel ......................... : Version $VERSION
310echo
311echo Prefix........................... : $prefix
312if test x$plugins_loading = xyes; then
313echo Building dynamic plugins:
314 if test x"$plugin_netstatus" != x; then
315 AC_MSG_RESULT([ netstatus - Monitor networking status])
316 fi
317 if test x"$plugin_netstat" != x; then
318 AC_MSG_RESULT([ netstat - Monitor networking status (Linux Only)])
319 fi
320 if test x"$plugin_volume" != x; then
321 AC_MSG_RESULT([ volume - Display and adjust volume of sound card])
322 fi
323 if test x"$plugin_volumealsa" != x; then
324 AC_MSG_RESULT([ volumealsa - Display and adjust volume of sound card for ALSA])
325 fi
326 if test x"$plugin_cpu" != x; then
327 AC_MSG_RESULT([ cpu - Display CPU loading])
328 fi
329 if test x"$plugin_deskno" != x; then
330 AC_MSG_RESULT([ deskno - Display desktop number])
331 fi
332 if test x"$plugin_batt" != x; then
333 AC_MSG_RESULT([ batt - Monitor battery status])
334 fi
335 if test x"$plugin_kbled" != x; then
336 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
337 fi
338 if test x"$plugin_xkb" != x; then
339 AC_MSG_RESULT([ xkb - Keyboard layout switcher])
340 fi
341else
342echo Dynamic loader for plugins....... : disabled.
343fi