little fixes
[lxde/lxpanel.git] / configure.ac
CommitLineData
a52c2257 1AC_PREREQ(2.53)
4d1028b5 2AC_INIT(lxpanel, 0.2.8.2, http://lxde.sourceforge.net/)
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 \
fb20a9b5
HJYP
19 gthread-2.0"
20# libstartup-notification-1.0"
a52c2257
HJYP
21PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
22AC_SUBST(PACKAGE_CFLAGS)
23AC_SUBST(PACKAGE_LIBS)
24
535ac098 25AC_ARG_ENABLE([cast-checks],
24053345
HJYP
26 AS_HELP_STRING([--enable-cast-checks],
27 [enable Glib casting checks (default: disable)]),
28 cast_checks=$enableval, cast_checks="no")
535ac098
JH
29G_CAST_CHECKS=""
30if test x"$cast_checks" = "xno"; then
24053345 31 G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
535ac098
JH
32fi
33AC_SUBST(G_CAST_CHECKS)
34
cc0c9990
JH
35dnl linker tweaking
36# The function of the link flag --as-needed is to prevent unnecesary linking.
37# Example: A -> B -> C
20b3e401
JH
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
cc0c9990
JH
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'*)
20b3e401
JH
45 LDFLAGS="$LDFLAGS -Wl,--as-needed"
46 AC_MSG_RESULT([yes])
47 ;;
cc0c9990 48*)
20b3e401
JH
49 AC_MSG_RESULT([no])
50 ;;
cc0c9990
JH
51esac
52
53dnl FIXME: filter for undefined symbols in plugins
54# when passing "-z defs" to linker, we would better to make sure
55# there are no undefined references. However, we intend not to
56# fix at the moment since we don't have spin-off libraray containing
57# the necessary functions.
58if test ! -z "$LDFLAGS"; then
20b3e401 59 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
cc0c9990
JH
60fi
61
62LXPANEL_MODULE="-avoid-version \
63-rpath \$(libdir)/lxpanel/plugins \
64-no-undefined "'-export-symbols-regex "^[[^_]].*"'
65AC_SUBST(LXPANEL_MODULE)
66
c044bccf 67AC_ARG_ENABLE([alsa],
24053345
HJYP
68 AS_HELP_STRING([--disable-alsa],
69 [compile ALSA providers (default: enable)]),
70 compile_alsa=$enableval, compile_alsa="yes")
c044bccf 71if test x"$compile_alsa" = "xyes"; then
24053345
HJYP
72 AC_CHECK_HEADERS([alsa/asoundlib.h],
73 [AC_CHECK_LIB([asound],
74 [snd_seq_open],
75 compile_alsa=yes,compile_alsa=no)],
c044bccf
JH
76 compile_alsa=no)
77fi
78AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
79dnl FIXME: check OSS existence
80AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
81
e64c0317
JH
82# check libiw for netstat plugin
83AC_ARG_ENABLE([libiw],
84 AS_HELP_STRING([--disable-libiw],
85 [compile libiw-based netstat plugin (default: enable)]),
86 compile_libiw=$enableval, compile_libiw="yes")
87if test x"$compile_libiw" = "xyes"; then
88 AC_CHECK_HEADERS(iwlib.h,
89 [AC_CHECK_LIB(iw,
90 iw_sockets_open,
91 compile_libiw=yes,
92 compile_libiw=no)],
93 compile_libiw=no)
94fi
95AM_CONDITIONAL(BUILD_LIBIW_PLUGINS, test x$compile_libiw = xyes)
96
2d29cc96 97AC_ARG_ENABLE([plugins-loading],
24053345
HJYP
98 AS_HELP_STRING([--disable-plugins-loading],
99 [disable plugin loading (default: enable)]),
100 plugins_loading=$enableval, plugins_loading="yes")
2d29cc96 101
31b80004
JH
102AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
103
535ac098 104if test x"$plugins_loading" = "xno"; then
24053345 105 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
2d29cc96
JH
106fi
107
199c3ea8
JH
108dnl Here are plugin listing.
109plugin_netstatus=
19348802 110plugin_netstat=
199c3ea8 111plugin_volume=
15556f61 112plugin_volumealsa=
199c3ea8 113plugin_cpu=
ce728cd9 114plugin_deskno=
8f11d5f8 115plugin_batt=
199c3ea8
JH
116
117AC_MSG_CHECKING([which plugins should be built dynamically])
118AC_ARG_WITH(plugins,
119[ --with-plugins=<list> compile dynamic plugins in <list> ]
120[ plugins may be comma separated ]
121[ 'all' builds all plugins (default), 'none' builds none ]
122[ Possible plugins are: ]
19348802 123[ netstatus, netstat, volume, volumealsa, cpu, deskno, batt], plugins="$withval",[plugins="all"])
199c3ea8
JH
124
125if test x"$plugins" != xall -a x"$plugins" != xnone; then
24053345
HJYP
126 if test x"$plugins_loading" = xno; then
127 AC_MSG_ERROR(
128 [--disable-plugins-loading and --with-plugins conflict each other.])
129 fi
199c3ea8
JH
130fi
131
24053345
HJYP
132ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt"
133AC_SUBST(ALL_PLUGINS_LIST)
134
199c3ea8 135if test x"$plugins" = xall; then
24053345
HJYP
136dnl for name in $ALL_PLUGINS
137dnl do
138dnl export plugin_$name="$name"
139dnl done
140
141 plugin_netstatus=netstatus
142 plugin_netstat=netstat
143 plugin_volume=volume
144 plugin_volumealsa=volumealsa
145 plugin_cpu=cpu
146 plugin_deskno=deskno
147 plugin_batt=batt
148
149 AC_MSG_RESULT(all)
199c3ea8 150else
24053345
HJYP
151 if test "$plugins" != "none"; then
152 plugins=`echo $plugins | sed 's/,/ /g'`
153 for plugin in $plugins
154 do
155 case "$plugin" in
156 netstatus)
157 plugin_netstatus=netstatus
158 ;;
159 netstat)
160 plugin_netstat=netstat
161 ;;
162 volume)
163 plugin_volume=volume
164 ;;
165 volumealsa)
166 plugin_volumealsa=volumealsa
167 ;;
168 cpu)
169 plugin_cpu=cpu
170 ;;
171 deskno)
172 plugin_deskno=deskno
173 ;;
174 batt)
175 plugin_deskno=batt
176 ;;
177 *)
178 echo "Unknown plugin $plugin."
179 exit 1
180 ;;
181 esac
182 done
183 AC_MSG_RESULT($plugins)
184 fi
199c3ea8
JH
185fi
186
c044bccf
JH
187dnl FIXME: OSS/ALSA checking
188if test x"$compile_alsa" = "xno"; then
24053345
HJYP
189 if test ! -z $plugin_volumealsa; then
190 AC_MSG_RESULT([no ALSA headers/libraries found!])
191 plugin_volumealsa=
192 fi
c044bccf 193else
24053345
HJYP
194 dnl force OSS plugin to <null>
195 plugin_volume=
c044bccf 196fi
e64c0317
JH
197if test x"$compile_libiw" = "xno"; then
198 if test ! -z $plugin_netstat; then
199 AC_MSG_RESULT([no libiw headers/libraries found!])
200 fi
201 plugin_netstat=
202fi
19348802 203PLUGINS_LIST="$plugin_netstatus $plugin_netstat $plugin_volume $plugin_volumealsa $plugin_cpu $plugin_deskno $plugin_batt"
199c3ea8
JH
204AC_SUBST(PLUGINS_LIST)
205
1141e22a 206
a52c2257
HJYP
207# Checks for header files.
208AC_PATH_X
209AC_HEADER_STDC
210AC_HEADER_SYS_WAIT
211AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
212
213# Checks for typedefs, structures, and compiler characteristics.
214AC_C_CONST
215AC_C_INLINE
216AC_STRUCT_TM
217
218# Checks for library functions.
219AC_FUNC_MALLOC
220AC_FUNC_MEMCMP
221AC_TYPE_SIGNAL
222AC_FUNC_STAT
223AC_FUNC_STRFTIME
224AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
225
226
227GETTEXT_PACKAGE=lxpanel
42fe8c5f 228#AM_GNU_GETTEXT([external])
a52c2257
HJYP
229AM_GNU_GETTEXT_VERSION(0.14.1)
230AC_SUBST(GETTEXT_PACKAGE)
231AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
232
a134326c
FC
233#ALL_LINGUAS="zh_TW ko hu sk pl fr pt_BR"
234ALL_LINGUAS="zh_TW ko hu sk pl fr"
a52c2257
HJYP
235AM_GLIB_GNU_GETTEXT
236
237AC_CONFIG_FILES([
24053345
HJYP
238 Makefile
239 src/Makefile
240 src/plugins/Makefile
241 src/plugins/netstatus/Makefile
242 src/plugins/netstat/Makefile
243 src/plugins/volume/Makefile
244 src/plugins/volumealsa/Makefile
245 src/plugins/cpu/Makefile
246 src/plugins/deskno/Makefile
247 src/plugins/batt/Makefile
248 po/Makefile.in
249 data/Makefile
250 data/default/config
70344206 251 man/Makefile
a52c2257
HJYP
252])
253AC_OUTPUT
199c3ea8 254
24053345 255echo
ce728cd9 256echo lxpanel ......................... : Version $VERSION
199c3ea8
JH
257echo
258echo Prefix........................... : $prefix
259if test x$plugins_loading = xyes; then
260echo Building dynamic plugins:
24053345
HJYP
261 if test x"$plugin_netstatus" != x; then
262 AC_MSG_RESULT([ netstatus - Monitor networking status])
263 fi
264 if test x"$plugin_netstat" != x; then
265 AC_MSG_RESULT([ netstat - Monitor networking status (Linux Only)])
266 fi
267 if test x"$plugin_volume" != x; then
268 AC_MSG_RESULT([ volume - Display and adjust volume of sound card])
269 fi
270 if test x"$plugin_volumealsa" != x; then
271 AC_MSG_RESULT([ volumealsa - Display and adjust volume of sound card for ALSA])
272 fi
273 if test x"$plugin_cpu" != x; then
274 AC_MSG_RESULT([ cpu - Display CPU loading])
275 fi
276 if test x"$plugin_deskno" != x; then
277 AC_MSG_RESULT([ deskno - Display desktop number])
278 fi
279 if test x"$plugin_batt" != x; then
280 AC_MSG_RESULT([ batt - Monitor battery status])
281 fi
199c3ea8
JH
282else
283echo Dynamic loader for plugins....... : disabled.
284fi