Little fix
[lxde/lxpanel.git] / configure.ac
CommitLineData
a52c2257 1AC_PREREQ(2.53)
c14f78d1 2AC_INIT(lxpanel, 0.3.8.1, 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
HJYP
15AC_PROG_INTLTOOL(, [no-xml])
16
17# Checks for libraries.
f1286efa 18pkg_modules="gtk+-2.0 >= 2.12.0 \
70684259
HJYP
19 gthread-2.0 \
20 libmenu-cache"
fb20a9b5 21# libstartup-notification-1.0"
a52c2257
HJYP
22PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
23AC_SUBST(PACKAGE_CFLAGS)
24AC_SUBST(PACKAGE_LIBS)
25
f1286efa 26# Gtk Builder
4bfa602f
HJYP
27#AC_PATH_PROG([GTK_BUILDER_CONVERT],[gtk-builder-convert],[false])
28#if test "$GTK_BUILDER_CONVERT" = "false"; then
29# AC_MSG_ERROR([gtk-builder-convert not found])
30#fi
f1286efa 31
535ac098 32AC_ARG_ENABLE([cast-checks],
24053345
HJYP
33 AS_HELP_STRING([--enable-cast-checks],
34 [enable Glib casting checks (default: disable)]),
35 cast_checks=$enableval, cast_checks="no")
535ac098
JH
36G_CAST_CHECKS=""
37if test x"$cast_checks" = "xno"; then
24053345 38 G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
535ac098
JH
39fi
40AC_SUBST(G_CAST_CHECKS)
41
cc0c9990
JH
42dnl linker tweaking
43# The function of the link flag --as-needed is to prevent unnecesary linking.
44# Example: A -> B -> C
20b3e401
JH
45# Normally, A would link to B and also depend on C, this is of cource
46# unnecesary. In this situation, however we do need to link to C, so this
cc0c9990
JH
47# must be done explicitly. This flag comes in handy when a library ABI
48# is changed, minimizing the amount of recompilations needed.
49AC_MSG_CHECKING([whether $LD accepts --as-needed])
50case `$LD --as-needed -v 2>&1 </dev/null` in
51*GNU* | *'with BFD'*)
20b3e401
JH
52 LDFLAGS="$LDFLAGS -Wl,--as-needed"
53 AC_MSG_RESULT([yes])
54 ;;
cc0c9990 55*)
20b3e401
JH
56 AC_MSG_RESULT([no])
57 ;;
cc0c9990
JH
58esac
59
cae18977
JH
60dnl linker optimizations
61AC_MSG_CHECKING([whether $LD accepts -O1])
62case `$LD -O1 -v 2>&1 </dev/null` in
63*GNU* | *'with BFD'*)
64 LDFLAGS="$LDFLAGS -Wl,-O1"
65 AC_MSG_RESULT([yes])
66 ;;
67*)
68 AC_MSG_RESULT([no])
69 ;;
70esac
71AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
72case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
73*GNU* | *'with BFD'*)
74 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
75 AC_MSG_RESULT([yes])
76 ;;
7e20ea34 77*)
cae18977
JH
78 AC_MSG_RESULT([no])
79 ;;
80esac
85026f6c
JH
81AC_MSG_CHECKING([whether $LD accepts --sort-common])
82case `$LD --sort-common -v 2>&1 </dev/null` in
7e20ea34 83*GNU* | *'with BFD'*)
85026f6c
JH
84 LDFLAGS="$LDFLAGS -Wl,--sort-common"
85 AC_MSG_RESULT([yes])
86 ;;
87*)
88 AC_MSG_RESULT([no])
89 ;;
90esac
cae18977 91
cc0c9990
JH
92dnl FIXME: filter for undefined symbols in plugins
93# when passing "-z defs" to linker, we would better to make sure
94# there are no undefined references. However, we intend not to
95# fix at the moment since we don't have spin-off libraray containing
96# the necessary functions.
97if test ! -z "$LDFLAGS"; then
20b3e401 98 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
cc0c9990
JH
99fi
100
101LXPANEL_MODULE="-avoid-version \
102-rpath \$(libdir)/lxpanel/plugins \
103-no-undefined "'-export-symbols-regex "^[[^_]].*"'
104AC_SUBST(LXPANEL_MODULE)
105
c044bccf 106AC_ARG_ENABLE([alsa],
24053345
HJYP
107 AS_HELP_STRING([--disable-alsa],
108 [compile ALSA providers (default: enable)]),
109 compile_alsa=$enableval, compile_alsa="yes")
c044bccf 110if test x"$compile_alsa" = "xyes"; then
24053345
HJYP
111 AC_CHECK_HEADERS([alsa/asoundlib.h],
112 [AC_CHECK_LIB([asound],
113 [snd_seq_open],
114 compile_alsa=yes,compile_alsa=no)],
c044bccf
JH
115 compile_alsa=no)
116fi
117AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
118dnl FIXME: check OSS existence
119AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
120
e64c0317
JH
121# check libiw for netstat plugin
122AC_ARG_ENABLE([libiw],
123 AS_HELP_STRING([--disable-libiw],
124 [compile libiw-based netstat plugin (default: enable)]),
125 compile_libiw=$enableval, compile_libiw="yes")
126if test x"$compile_libiw" = "xyes"; then
127 AC_CHECK_HEADERS(iwlib.h,
128 [AC_CHECK_LIB(iw,
129 iw_sockets_open,
130 compile_libiw=yes,
131 compile_libiw=no)],
132 compile_libiw=no)
133fi
134AM_CONDITIONAL(BUILD_LIBIW_PLUGINS, test x$compile_libiw = xyes)
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=
19348802 149plugin_netstat=
199c3ea8 150plugin_volume=
15556f61 151plugin_volumealsa=
199c3ea8 152plugin_cpu=
ce728cd9 153plugin_deskno=
8f11d5f8 154plugin_batt=
22242ed4 155plugin_xkb=
7e20ea34 156plugin_kbled=
62550cea 157plugin_thermal=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: ]
62550cea 165[ netstatus, netstat, 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
62550cea 174ALL_PLUGINS_LIST="netstatus netstat 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
184 plugin_netstat=netstat
185 plugin_volume=volume
186 plugin_volumealsa=volumealsa
187 plugin_cpu=cpu
188 plugin_deskno=deskno
189 plugin_batt=batt
7e20ea34 190 plugin_kbled=kbled
9088628c 191 plugin_xkb=
62550cea 192 plugin_thermal=thermal
24053345
HJYP
193
194 AC_MSG_RESULT(all)
199c3ea8 195else
24053345
HJYP
196 if test "$plugins" != "none"; then
197 plugins=`echo $plugins | sed 's/,/ /g'`
198 for plugin in $plugins
199 do
200 case "$plugin" in
201 netstatus)
202 plugin_netstatus=netstatus
203 ;;
204 netstat)
205 plugin_netstat=netstat
206 ;;
207 volume)
208 plugin_volume=volume
209 ;;
210 volumealsa)
211 plugin_volumealsa=volumealsa
212 ;;
213 cpu)
214 plugin_cpu=cpu
215 ;;
216 deskno)
217 plugin_deskno=deskno
218 ;;
219 batt)
22242ed4
HJYP
220 plugin_batt=batt
221 ;;
7e20ea34
HJYP
222 kbled)
223 plugin_kbled=kbled
224 ;;
22242ed4
HJYP
225 xkb)
226 plugin_xkb=xkb
24053345 227 ;;
62550cea
FC
228 thermal)
229 plugin_thermal=thermal
230 ;;
24053345
HJYP
231 *)
232 echo "Unknown plugin $plugin."
233 exit 1
234 ;;
235 esac
236 done
237 AC_MSG_RESULT($plugins)
238 fi
199c3ea8
JH
239fi
240
c044bccf
JH
241dnl FIXME: OSS/ALSA checking
242if test x"$compile_alsa" = "xno"; then
24053345
HJYP
243 if test ! -z $plugin_volumealsa; then
244 AC_MSG_RESULT([no ALSA headers/libraries found!])
245 plugin_volumealsa=
246 fi
c044bccf 247else
24053345
HJYP
248 dnl force OSS plugin to <null>
249 plugin_volume=
c044bccf 250fi
e64c0317
JH
251if test x"$compile_libiw" = "xno"; then
252 if test ! -z $plugin_netstat; then
253 AC_MSG_RESULT([no libiw headers/libraries found!])
254 fi
255 plugin_netstat=
256fi
22242ed4 257PLUGINS_LIST="\
7e20ea34
HJYP
258 $plugin_netstatus \
259 $plugin_netstat \
260 $plugin_volume \
261 $plugin_volumealsa \
262 $plugin_cpu \
263 $plugin_deskno \
264 $plugin_batt \
265 $plugin_kbled \
62550cea
FC
266 $plugin_xkb \
267 $plugin_thermal"
22242ed4 268
199c3ea8
JH
269AC_SUBST(PLUGINS_LIST)
270
1141e22a 271
a52c2257
HJYP
272# Checks for header files.
273AC_PATH_X
274AC_HEADER_STDC
275AC_HEADER_SYS_WAIT
276AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
277
278# Checks for typedefs, structures, and compiler characteristics.
279AC_C_CONST
280AC_C_INLINE
281AC_STRUCT_TM
282
283# Checks for library functions.
284AC_FUNC_MALLOC
285AC_FUNC_MEMCMP
286AC_TYPE_SIGNAL
287AC_FUNC_STAT
288AC_FUNC_STRFTIME
289AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
290
291
292GETTEXT_PACKAGE=lxpanel
42fe8c5f 293#AM_GNU_GETTEXT([external])
a52c2257
HJYP
294AM_GNU_GETTEXT_VERSION(0.14.1)
295AC_SUBST(GETTEXT_PACKAGE)
296AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
297
52dacfea 298ALL_LINGUAS="zh_TW ko hu sk pl fr pt_BR fi de es zh_CN"
a52c2257
HJYP
299AM_GLIB_GNU_GETTEXT
300
301AC_CONFIG_FILES([
f5c43b11 302 lxpanel.pc
24053345
HJYP
303 Makefile
304 src/Makefile
305 src/plugins/Makefile
306 src/plugins/netstatus/Makefile
307 src/plugins/netstat/Makefile
308 src/plugins/volume/Makefile
309 src/plugins/volumealsa/Makefile
310 src/plugins/cpu/Makefile
311 src/plugins/deskno/Makefile
312 src/plugins/batt/Makefile
7e20ea34 313 src/plugins/kbled/Makefile
22242ed4 314 src/plugins/xkb/Makefile
62550cea 315 src/plugins/thermal/Makefile
24053345
HJYP
316 po/Makefile.in
317 data/Makefile
cf701cb7 318 data/default/panels/panel
70344206 319 man/Makefile
a52c2257
HJYP
320])
321AC_OUTPUT
199c3ea8 322
24053345 323echo
ce728cd9 324echo lxpanel ......................... : Version $VERSION
199c3ea8
JH
325echo
326echo Prefix........................... : $prefix
327if test x$plugins_loading = xyes; then
328echo Building dynamic plugins:
24053345
HJYP
329 if test x"$plugin_netstatus" != x; then
330 AC_MSG_RESULT([ netstatus - Monitor networking status])
331 fi
332 if test x"$plugin_netstat" != x; then
333 AC_MSG_RESULT([ netstat - Monitor networking status (Linux Only)])
334 fi
335 if test x"$plugin_volume" != x; then
336 AC_MSG_RESULT([ volume - Display and adjust volume of sound card])
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