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