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