Add pager2 plugins, compatible with compiz (apply patch from ID 2802191)
[lxde/lxpanel.git] / configure.ac
CommitLineData
a52c2257 1AC_PREREQ(2.53)
1eacf514 2AC_INIT(lxpanel, 0.5.8, http://lxde.org/)
8e4890cb 3AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign])
a52c2257
HJYP
4AC_CONFIG_HEADER([config.h])
5
8e4890cb
JL
6# Support silent build rules. Disable by either passing --disable-silent-rules
7# to configure or passing V=1 to make
8AM_SILENT_RULES([yes])
9
86db742c
JH
10# Force to dynamic
11AC_DISABLE_STATIC
12
a52c2257
HJYP
13# Checks for programs.
14AC_PROG_CC
15AC_PROG_INSTALL
16AC_PROG_LN_S
17AC_PROG_INTLTOOL(, [no-xml])
e7a42ecf 18AM_PROG_CC_C_O
a52c2257 19
8e4890cb
JL
20#Initialize libtool
21LT_PREREQ([2.2])
22LT_INIT
23
a52c2257 24# Checks for libraries.
bf2b2430
AF
25AC_ARG_ENABLE(gtk3,
26AC_HELP_STRING([--enable-gtk3],[enable to use gtk-3.0 instead of gtk-2.0]),
27[case "${enableval}" in
28 yes) enable_gtk3=yes ;;
29 no) enable_gtk3=no ;;
30 *) AC_MSG_ERROR([bad value "${enableval}" for --enable-gtk3, use "yes" (default) or "no".]) ;;
31esac],[])
32
33if test "x$enable_gtk3" = "xyes" ; then
34 CFLAGS="$CFLAGS -DENABLE_GTK3"
35 pkg_modules="$pkg_modules gtk+-3.0"
36else
37 pkg_modules="$pkg_modules gtk+-2.0 >= 2.12.0"
38fi
39
40pkg_modules="$pkg_modules \
1d434622 41 gio-unix-2.0 \
c4ff9fd2
JL
42 gthread-2.0 \
43 libmenu-cache \
44 libwnck-1.0"
fb20a9b5 45# libstartup-notification-1.0"
a52c2257
HJYP
46PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
47AC_SUBST(PACKAGE_CFLAGS)
48AC_SUBST(PACKAGE_LIBS)
49
9bf13ef5
MTW
50pkg_modules="x11"
51PKG_CHECK_MODULES(X11, [$pkg_modules])
52AC_SUBST(X11_LIBS)
53
ace2a572
JH
54pkg_modules="libmenu-cache"
55PKG_CHECK_MODULES(MENU_CACHE, [$pkg_modules],
56 enable_menu_cache=yes, enable_menu_cache=no)
57if test x"$enable_menu_cache" = "xno"; then
58 AC_WARN([No libmenu-cache found. All menu related routines are not built.])
59 AC_DEFINE(DISABLE_MENU, [1], [Disable menu related routines])
60fi
61AC_SUBST(MENU_CACHE_CFLAGS)
62AC_SUBST(MENU_CACHE_LIBS)
ade9c95c 63AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
ace2a572 64
77f69cbd
JL
65AC_ARG_ENABLE(more_warnings,
66 [AC_HELP_STRING([--enable-more-warnings],
67 [Add more warnings @<:@default=no@:>@])],
68 [enable_more_warnings="${enableval}"],
69 [enable_more_warnings=no]
70)
71
72if test x"$enable_more_warnings" = x"yes"; then
73 ADDITIONAL_FLAGS="-Wall -Werror=all -Werror=format -Werror=implicit-function-declaration -Werror=implicit-int -Werror=missing-braces -Werror=parentheses -Werror=return-type -Werror=strict-aliasing -Werror=switch -Wuninitialized -Werror=unused-label -Werror=unused-value -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Werror=missing-declarations -Wredundant-decls -Wmissing-noreturn -Wpointer-arith -Wcast-align -Wwrite-strings -Werror=inline -Werror=format-nonliteral -Wformat-nonliteral -Werror=format-security -Wformat-security -Winit-self -Werror=missing-include-dirs -Werror=undef -Werror=aggregate-return -Wmissing-format-attribute -Werror=nested-externs -fno-strict-aliasing -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES"
74fi
75AC_SUBST(ADDITIONAL_FLAGS)
ade9c95c 76
77f69cbd 77PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
ace2a572
JH
78PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
79
40189d64
JH
80AC_ARG_ENABLE(man,
81 [AC_HELP_STRING([--enable-man],
82 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
83 [enable_man="${enableval}"],
84 [enable_man=no]
85)
86
535ac098 87AC_ARG_ENABLE([cast-checks],
24053345
HJYP
88 AS_HELP_STRING([--enable-cast-checks],
89 [enable Glib casting checks (default: disable)]),
90 cast_checks=$enableval, cast_checks="no")
535ac098
JH
91G_CAST_CHECKS=""
92if test x"$cast_checks" = "xno"; then
24053345 93 G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
535ac098
JH
94fi
95AC_SUBST(G_CAST_CHECKS)
96
cc0c9990
JH
97dnl linker tweaking
98# The function of the link flag --as-needed is to prevent unnecesary linking.
99# Example: A -> B -> C
20b3e401
JH
100# Normally, A would link to B and also depend on C, this is of cource
101# unnecesary. In this situation, however we do need to link to C, so this
cc0c9990
JH
102# must be done explicitly. This flag comes in handy when a library ABI
103# is changed, minimizing the amount of recompilations needed.
104AC_MSG_CHECKING([whether $LD accepts --as-needed])
105case `$LD --as-needed -v 2>&1 </dev/null` in
106*GNU* | *'with BFD'*)
20b3e401
JH
107 LDFLAGS="$LDFLAGS -Wl,--as-needed"
108 AC_MSG_RESULT([yes])
109 ;;
cc0c9990 110*)
20b3e401
JH
111 AC_MSG_RESULT([no])
112 ;;
cc0c9990
JH
113esac
114
cae18977
JH
115dnl linker optimizations
116AC_MSG_CHECKING([whether $LD accepts -O1])
117case `$LD -O1 -v 2>&1 </dev/null` in
118*GNU* | *'with BFD'*)
119 LDFLAGS="$LDFLAGS -Wl,-O1"
120 AC_MSG_RESULT([yes])
121 ;;
122*)
123 AC_MSG_RESULT([no])
124 ;;
125esac
126AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
127case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
128*GNU* | *'with BFD'*)
129 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
130 AC_MSG_RESULT([yes])
131 ;;
7e20ea34 132*)
cae18977
JH
133 AC_MSG_RESULT([no])
134 ;;
135esac
85026f6c
JH
136AC_MSG_CHECKING([whether $LD accepts --sort-common])
137case `$LD --sort-common -v 2>&1 </dev/null` in
7e20ea34 138*GNU* | *'with BFD'*)
85026f6c
JH
139 LDFLAGS="$LDFLAGS -Wl,--sort-common"
140 AC_MSG_RESULT([yes])
141 ;;
142*)
143 AC_MSG_RESULT([no])
144 ;;
145esac
cae18977 146
cc0c9990
JH
147dnl FIXME: filter for undefined symbols in plugins
148# when passing "-z defs" to linker, we would better to make sure
149# there are no undefined references. However, we intend not to
150# fix at the moment since we don't have spin-off libraray containing
151# the necessary functions.
152if test ! -z "$LDFLAGS"; then
20b3e401 153 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
cc0c9990
JH
154fi
155
156LXPANEL_MODULE="-avoid-version \
157-rpath \$(libdir)/lxpanel/plugins \
158-no-undefined "'-export-symbols-regex "^[[^_]].*"'
159AC_SUBST(LXPANEL_MODULE)
160
c044bccf 161AC_ARG_ENABLE([alsa],
24053345
HJYP
162 AS_HELP_STRING([--disable-alsa],
163 [compile ALSA providers (default: enable)]),
164 compile_alsa=$enableval, compile_alsa="yes")
c044bccf 165if test x"$compile_alsa" = "xyes"; then
24053345
HJYP
166 AC_CHECK_HEADERS([alsa/asoundlib.h],
167 [AC_CHECK_LIB([asound],
168 [snd_seq_open],
169 compile_alsa=yes,compile_alsa=no)],
c044bccf
JH
170 compile_alsa=no)
171fi
172AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
173dnl FIXME: check OSS existence
174AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
175
2d29cc96 176AC_ARG_ENABLE([plugins-loading],
24053345
HJYP
177 AS_HELP_STRING([--disable-plugins-loading],
178 [disable plugin loading (default: enable)]),
179 plugins_loading=$enableval, plugins_loading="yes")
2d29cc96 180
31b80004
JH
181AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
182
535ac098 183if test x"$plugins_loading" = "xno"; then
24053345 184 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
2d29cc96
JH
185fi
186
199c3ea8
JH
187dnl Here are plugin listing.
188plugin_netstatus=
189plugin_volume=
15556f61 190plugin_volumealsa=
199c3ea8 191plugin_cpu=
ce728cd9 192plugin_deskno=
8f11d5f8 193plugin_batt=
22242ed4 194plugin_xkb=
7e20ea34 195plugin_kbled=
09f498a1 196plugin_thermal=
c03f7bd0 197plugin_cpufreq=
9770479a 198plugin_monitors=
199c3ea8
JH
199
200AC_MSG_CHECKING([which plugins should be built dynamically])
201AC_ARG_WITH(plugins,
202[ --with-plugins=<list> compile dynamic plugins in <list> ]
203[ plugins may be comma separated ]
204[ 'all' builds all plugins (default), 'none' builds none ]
205[ Possible plugins are: ]
9770479a 206[ netstatus, volume, volumealsa, cpu, deskno, batt, kbled, xkb, thermal, cpufreq, monitors], plugins="$withval",[plugins="all"])
199c3ea8
JH
207
208if test x"$plugins" != xall -a x"$plugins" != xnone; then
24053345
HJYP
209 if test x"$plugins_loading" = xno; then
210 AC_MSG_ERROR(
211 [--disable-plugins-loading and --with-plugins conflict each other.])
212 fi
199c3ea8
JH
213fi
214
9770479a 215ALL_PLUGINS_LIST="netstatus volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors"
24053345
HJYP
216AC_SUBST(ALL_PLUGINS_LIST)
217
199c3ea8 218if test x"$plugins" = xall; then
24053345
HJYP
219dnl for name in $ALL_PLUGINS
220dnl do
221dnl export plugin_$name="$name"
222dnl done
223
224 plugin_netstatus=netstatus
24053345
HJYP
225 plugin_volume=volume
226 plugin_volumealsa=volumealsa
227 plugin_cpu=cpu
228 plugin_deskno=deskno
229 plugin_batt=batt
7e20ea34 230 plugin_kbled=kbled
8f9e6256 231 plugin_xkb=xkb
62550cea 232 plugin_thermal=thermal
c03f7bd0 233 plugin_cpufreq=cpufreq
9770479a 234 plugin_monitors=monitors
24053345
HJYP
235
236 AC_MSG_RESULT(all)
199c3ea8 237else
24053345
HJYP
238 if test "$plugins" != "none"; then
239 plugins=`echo $plugins | sed 's/,/ /g'`
240 for plugin in $plugins
241 do
242 case "$plugin" in
243 netstatus)
244 plugin_netstatus=netstatus
245 ;;
24053345
HJYP
246 volume)
247 plugin_volume=volume
248 ;;
249 volumealsa)
250 plugin_volumealsa=volumealsa
251 ;;
252 cpu)
253 plugin_cpu=cpu
254 ;;
255 deskno)
256 plugin_deskno=deskno
257 ;;
258 batt)
22242ed4
HJYP
259 plugin_batt=batt
260 ;;
7e20ea34
HJYP
261 kbled)
262 plugin_kbled=kbled
263 ;;
22242ed4
HJYP
264 xkb)
265 plugin_xkb=xkb
24053345 266 ;;
62550cea
FC
267 thermal)
268 plugin_thermal=thermal
269 ;;
c03f7bd0
DK
270 cpufreq)
271 plugin_cpufreq=cpufreq
272 ;;
9770479a
JL
273 monitors)
274 plugin_monitors=monitors
275 ;;
24053345
HJYP
276 *)
277 echo "Unknown plugin $plugin."
278 exit 1
279 ;;
280 esac
281 done
282 AC_MSG_RESULT($plugins)
283 fi
199c3ea8
JH
284fi
285
c044bccf
JH
286dnl FIXME: OSS/ALSA checking
287if test x"$compile_alsa" = "xno"; then
24053345
HJYP
288 if test ! -z $plugin_volumealsa; then
289 AC_MSG_RESULT([no ALSA headers/libraries found!])
290 plugin_volumealsa=
291 fi
c044bccf 292else
24053345
HJYP
293 dnl force OSS plugin to <null>
294 plugin_volume=
c044bccf 295fi
22242ed4 296PLUGINS_LIST="\
7e20ea34 297 $plugin_netstatus \
7e20ea34
HJYP
298 $plugin_volume \
299 $plugin_volumealsa \
300 $plugin_cpu \
301 $plugin_deskno \
302 $plugin_batt \
303 $plugin_kbled \
62550cea 304 $plugin_xkb \
c03f7bd0 305 $plugin_thermal \
9770479a
JL
306 $plugin_cpufreq \
307 $plugin_monitors"
22242ed4 308
199c3ea8
JH
309AC_SUBST(PLUGINS_LIST)
310
1141e22a 311
a52c2257
HJYP
312# Checks for header files.
313AC_PATH_X
314AC_HEADER_STDC
315AC_HEADER_SYS_WAIT
316AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
317
318# Checks for typedefs, structures, and compiler characteristics.
319AC_C_CONST
320AC_C_INLINE
321AC_STRUCT_TM
322
323# Checks for library functions.
324AC_FUNC_MALLOC
325AC_FUNC_MEMCMP
326AC_TYPE_SIGNAL
327AC_FUNC_STAT
328AC_FUNC_STRFTIME
329AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
330
331
5f9e4cb1
JL
332# Generate po/LINGUAS on the fly rather than relying on translators
333# to maintain it manually. This also overcome the problem that Transifex
334# cannot add a language to po/LINGUAS if a new po file is submitted.
335rm -f $srcdir/po/LINGUAS
336for po_file in `ls $srcdir/po/*.po | sort`;
337do
338 lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
339 echo $lang >> $srcdir/po/LINGUAS
340done
341
a52c2257 342GETTEXT_PACKAGE=lxpanel
42fe8c5f 343#AM_GNU_GETTEXT([external])
a52c2257
HJYP
344AM_GNU_GETTEXT_VERSION(0.14.1)
345AC_SUBST(GETTEXT_PACKAGE)
346AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
347
a52c2257
HJYP
348AM_GLIB_GNU_GETTEXT
349
40189d64
JH
350if test x"$enable_man" = x"yes"; then
351 AC_PATH_PROG([XSLTPROC], [xsltproc])
352 if test -z "$XSLTPROC"; then
353 enable_man=no
354 fi
355
356 dnl check for DocBook DTD and stylesheets in the local catalog.
357 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
358 [DocBook XML DTD V4.1.2], [], enable_man=no)
359 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
360 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
361fi
362
363AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
364
a52c2257 365AC_CONFIG_FILES([
f5c43b11 366 lxpanel.pc
24053345
HJYP
367 Makefile
368 src/Makefile
369 src/plugins/Makefile
370 src/plugins/netstatus/Makefile
24053345
HJYP
371 src/plugins/volume/Makefile
372 src/plugins/volumealsa/Makefile
373 src/plugins/cpu/Makefile
374 src/plugins/deskno/Makefile
375 src/plugins/batt/Makefile
7e20ea34 376 src/plugins/kbled/Makefile
22242ed4 377 src/plugins/xkb/Makefile
62550cea 378 src/plugins/thermal/Makefile
c03f7bd0 379 src/plugins/cpufreq/Makefile
9770479a 380 src/plugins/monitors/Makefile
24053345
HJYP
381 po/Makefile.in
382 data/Makefile
cf701cb7 383 data/default/panels/panel
70344206 384 man/Makefile
a52c2257
HJYP
385])
386AC_OUTPUT
199c3ea8 387
24053345 388echo
ce728cd9 389echo lxpanel ......................... : Version $VERSION
199c3ea8
JH
390echo
391echo Prefix........................... : $prefix
392if test x$plugins_loading = xyes; then
393echo Building dynamic plugins:
24053345
HJYP
394 if test x"$plugin_netstatus" != x; then
395 AC_MSG_RESULT([ netstatus - Monitor networking status])
396 fi
24053345 397 if test x"$plugin_volume" != x; then
8f9e6256 398 AC_MSG_RESULT([ volume - Display and adjust volume of sound card for OSS])
24053345
HJYP
399 fi
400 if test x"$plugin_volumealsa" != x; then
401 AC_MSG_RESULT([ volumealsa - Display and adjust volume of sound card for ALSA])
402 fi
403 if test x"$plugin_cpu" != x; then
404 AC_MSG_RESULT([ cpu - Display CPU loading])
405 fi
406 if test x"$plugin_deskno" != x; then
407 AC_MSG_RESULT([ deskno - Display desktop number])
408 fi
409 if test x"$plugin_batt" != x; then
410 AC_MSG_RESULT([ batt - Monitor battery status])
411 fi
7e20ea34
HJYP
412 if test x"$plugin_kbled" != x; then
413 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
414 fi
22242ed4
HJYP
415 if test x"$plugin_xkb" != x; then
416 AC_MSG_RESULT([ xkb - Keyboard layout switcher])
417 fi
62550cea
FC
418 if test x"$plugin_thermal" != x; then
419 AC_MSG_RESULT([ thermal - Temperature monitor])
420 fi
c03f7bd0
DK
421 if test x"$plugin_cpufreq" != x; then
422 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
423 fi
9770479a
JL
424 if test x"$plugin_monitors" != x; then
425 AC_MSG_RESULT([ monitors - Monitors for CPU & RAM])
426 fi
199c3ea8
JH
427else
428echo Dynamic loader for plugins....... : disabled.
429fi
1234b94c
HJYP
430
431echo
46cea569
HJYP
432echo 'LXPanel requires menu-cache and lxmenu-data packages since'
433echo 'version 0.4.0. Please make sure they are correctly installed.'
434echo 'Otherwise, you will not be able to use applications menu.'
435echo
1234b94c 436