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