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