Configuration dialog to the 'volume' plugin.
[lxde/lxpanel.git] / configure.ac
CommitLineData
a52c2257 1AC_PREREQ(2.53)
ee3cd18a 2AC_INIT(lxpanel, 0.8.99, http://lxde.org/)
6dbdce2b 3AM_INIT_AUTOMAKE([-Wall foreign subdir-objects no-dist-gzip dist-xz])
a52c2257 4AC_CONFIG_HEADER([config.h])
00118bd4 5AC_CONFIG_MACRO_DIR([m4])
a52c2257 6
8e4890cb
JL
7# Support silent build rules. Disable by either passing --disable-silent-rules
8# to configure or passing V=1 to make
9AM_SILENT_RULES([yes])
10
86db742c
JH
11# Force to dynamic
12AC_DISABLE_STATIC
13
a52c2257
HJYP
14# Checks for programs.
15AC_PROG_CC
16AC_PROG_INSTALL
17AC_PROG_LN_S
c94790df 18IT_PROG_INTLTOOL([0.40.0], [no-xml])
e7a42ecf 19AM_PROG_CC_C_O
00118bd4 20m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
a52c2257 21
8e4890cb
JL
22#Initialize libtool
23LT_PREREQ([2.2])
24LT_INIT
25
a52c2257 26# Checks for libraries.
46c7d227 27AC_SEARCH_LIBS([log], [m])
bf2b2430
AF
28AC_ARG_ENABLE(gtk3,
29AC_HELP_STRING([--enable-gtk3],[enable to use gtk-3.0 instead of gtk-2.0]),
30[case "${enableval}" in
31 yes) enable_gtk3=yes ;;
32 no) enable_gtk3=no ;;
33 *) AC_MSG_ERROR([bad value "${enableval}" for --enable-gtk3, use "yes" (default) or "no".]) ;;
34esac],[])
35
36if test "x$enable_gtk3" = "xyes" ; then
baf50582
BG
37 gtk_module="gtk+-3.0"
38 pkg_modules="$pkg_modules $gtk_module libfm-gtk3 >= 1.2.0 libwnck-3.0"
cab6bba8 39 keybinder_module=keybinder-3.0
bf2b2430 40else
baf50582
BG
41 gtk_module="gtk+-2.0 >= 2.18.0"
42 pkg_modules="$pkg_modules $gtk_module libfm-gtk >= 1.2.0 libwnck-1.0"
cab6bba8 43 keybinder_module=keybinder
bf2b2430
AF
44fi
45
46pkg_modules="$pkg_modules \
1d434622 47 gio-unix-2.0 \
c4ff9fd2 48 gthread-2.0 \
688d30f0 49 gmodule-2.0"
a52c2257
HJYP
50PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
51AC_SUBST(PACKAGE_CFLAGS)
52AC_SUBST(PACKAGE_LIBS)
baf50582 53AC_SUBST(gtk_module)
a52c2257 54
cab6bba8 55PKG_CHECK_MODULES(KEYBINDER, [$keybinder_module])
f7a4447c
AG
56AC_SUBST(KEYBINDER_CFLAGS)
57AC_SUBST(KEYBINDER_LIBS)
58
9dda8252
JL
59###########################
60# Indicator Info
61###########################
62AC_ARG_ENABLE([indicator_support],
63 AS_HELP_STRING([--enable-indicator-support],
64 [enable plugin loading (default: disable)]),
65 indicator_support=$enableval, indicator_support="no")
66AM_CONDITIONAL(ENABLE_INDICATOR_SUPPORT, test x"$indicator_support" = x"yes")
67
68if test "$indicator_support" != "no"; then
69 INDICATOR_REQUIRED_VERSION=0.3.0
70 INDICATOR_PKG_NAME=indicator-0.4
71
72 PKG_CHECK_MODULES(APPLET, $INDICATOR_PKG_NAME >= $INDICATOR_REQUIRED_VERSION)
73 AC_SUBST(APPLET_CFLAGS)
74
75 if test "x$with_localinstall" = "xyes"; then
76 INDICATORDIR="${libdir}/indicators/2/"
77 INDICATORICONSDIR="${datadir}/indicator-applet/icons/"
78 else
79 INDICATORDIR=`$PKG_CONFIG --variable=indicatordir $INDICATOR_PKG_NAME`
80 INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir $INDICATOR_PKG_NAME`
81fi
82 AC_SUBST(INDICATORDIR)
83 AC_SUBST(INDICATORICONSDIR)
84fi
85
86
9bf13ef5
MTW
87pkg_modules="x11"
88PKG_CHECK_MODULES(X11, [$pkg_modules])
89AC_SUBST(X11_LIBS)
90
ace2a572
JH
91pkg_modules="libmenu-cache"
92PKG_CHECK_MODULES(MENU_CACHE, [$pkg_modules],
93 enable_menu_cache=yes, enable_menu_cache=no)
94if test x"$enable_menu_cache" = "xno"; then
95 AC_WARN([No libmenu-cache found. All menu related routines are not built.])
96 AC_DEFINE(DISABLE_MENU, [1], [Disable menu related routines])
97fi
ade9c95c 98AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
ace2a572 99
77f69cbd
JL
100AC_ARG_ENABLE(more_warnings,
101 [AC_HELP_STRING([--enable-more-warnings],
102 [Add more warnings @<:@default=no@:>@])],
103 [enable_more_warnings="${enableval}"],
104 [enable_more_warnings=no]
105)
106
107if test x"$enable_more_warnings" = x"yes"; then
108 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"
109fi
ade9c95c 110
77f69cbd 111PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
ace2a572
JH
112PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
113
cc0c9990
JH
114dnl linker tweaking
115# The function of the link flag --as-needed is to prevent unnecesary linking.
116# Example: A -> B -> C
20b3e401
JH
117# Normally, A would link to B and also depend on C, this is of cource
118# unnecesary. In this situation, however we do need to link to C, so this
cc0c9990
JH
119# must be done explicitly. This flag comes in handy when a library ABI
120# is changed, minimizing the amount of recompilations needed.
121AC_MSG_CHECKING([whether $LD accepts --as-needed])
122case `$LD --as-needed -v 2>&1 </dev/null` in
123*GNU* | *'with BFD'*)
20b3e401
JH
124 LDFLAGS="$LDFLAGS -Wl,--as-needed"
125 AC_MSG_RESULT([yes])
126 ;;
cc0c9990 127*)
20b3e401
JH
128 AC_MSG_RESULT([no])
129 ;;
cc0c9990
JH
130esac
131
cae18977
JH
132dnl linker optimizations
133AC_MSG_CHECKING([whether $LD accepts -O1])
134case `$LD -O1 -v 2>&1 </dev/null` in
135*GNU* | *'with BFD'*)
136 LDFLAGS="$LDFLAGS -Wl,-O1"
137 AC_MSG_RESULT([yes])
138 ;;
139*)
140 AC_MSG_RESULT([no])
141 ;;
142esac
143AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
144case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
145*GNU* | *'with BFD'*)
146 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
147 AC_MSG_RESULT([yes])
148 ;;
7e20ea34 149*)
cae18977
JH
150 AC_MSG_RESULT([no])
151 ;;
152esac
85026f6c
JH
153AC_MSG_CHECKING([whether $LD accepts --sort-common])
154case `$LD --sort-common -v 2>&1 </dev/null` in
7e20ea34 155*GNU* | *'with BFD'*)
85026f6c
JH
156 LDFLAGS="$LDFLAGS -Wl,--sort-common"
157 AC_MSG_RESULT([yes])
158 ;;
159*)
160 AC_MSG_RESULT([no])
161 ;;
162esac
cae18977 163
c044bccf 164AC_ARG_ENABLE([alsa],
24053345
HJYP
165 AS_HELP_STRING([--disable-alsa],
166 [compile ALSA providers (default: enable)]),
167 compile_alsa=$enableval, compile_alsa="yes")
c044bccf 168if test x"$compile_alsa" = "xyes"; then
24053345
HJYP
169 AC_CHECK_HEADERS([alsa/asoundlib.h],
170 [AC_CHECK_LIB([asound],
171 [snd_seq_open],
172 compile_alsa=yes,compile_alsa=no)],
c044bccf
JH
173 compile_alsa=no)
174fi
175AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
176dnl FIXME: check OSS existence
177AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
178
2d29cc96 179AC_ARG_ENABLE([plugins-loading],
24053345
HJYP
180 AS_HELP_STRING([--disable-plugins-loading],
181 [disable plugin loading (default: enable)]),
182 plugins_loading=$enableval, plugins_loading="yes")
2d29cc96 183
31b80004
JH
184AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
185
535ac098 186if test x"$plugins_loading" = "xno"; then
24053345 187 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
2d29cc96
JH
188fi
189
199c3ea8
JH
190dnl Here are plugin listing.
191plugin_netstatus=
65efa143 192plugin_netstat=
199c3ea8
JH
193plugin_volume=
194plugin_cpu=
ce728cd9 195plugin_deskno=
8f11d5f8 196plugin_batt=
22242ed4 197plugin_xkb=
7e20ea34 198plugin_kbled=
09f498a1 199plugin_thermal=
c03f7bd0 200plugin_cpufreq=
9770479a 201plugin_monitors=
9dda8252 202plugin_indicator=
199c3ea8
JH
203
204AC_MSG_CHECKING([which plugins should be built dynamically])
205AC_ARG_WITH(plugins,
206[ --with-plugins=<list> compile dynamic plugins in <list> ]
207[ plugins may be comma separated ]
208[ 'all' builds all plugins (default), 'none' builds none ]
3a604782 209[ plugins prefixed with '-' are not built]
199c3ea8 210[ Possible plugins are: ]
9d4601f2
AG
211[ netstatus, netstat, volume, cpu, deskno, batt, kbled,]
212[ xkb, thermal, cpufreq, monitors, indicator, weather]
3a604782 213, plugins="$withval",[plugins="all"])
199c3ea8
JH
214
215if test x"$plugins" != xall -a x"$plugins" != xnone; then
24053345
HJYP
216 if test x"$plugins_loading" = xno; then
217 AC_MSG_ERROR(
218 [--disable-plugins-loading and --with-plugins conflict each other.])
219 fi
199c3ea8
JH
220fi
221
6d51da94 222ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors indicator weather"
24053345 223
3a604782
HG
224AC_DEFUN([check_plugin_name],[
225 plugin_found=false
226 for name in $ALL_PLUGINS_LIST; do
227 if test x[$1] = x[$name]; then
228 plugin_found=true
229 fi
230 done
231 if test x[$plugin_found] = false; then
232 echo [Unknown plugin $1.]
233 exit 1
234 fi
235])
236
237if test "$plugins" != "none"; then
238 plugins=`echo $plugins | sed 's/,/ /g'`
239 for plugin in $plugins
240 do
24053345 241 case "$plugin" in
3a604782
HG
242 all)
243 for name in $ALL_PLUGINS_LIST
244 do
6dbdce2b 245 export plugin_$name="$name.la"
3a604782 246 done
24053345 247 ;;
3a604782
HG
248 -*)
249 check_plugin_name([${plugin#-}])
250 export plugin_${plugin#-}=
9dda8252 251 ;;
24053345 252 *)
3a604782 253 check_plugin_name([$plugin])
6dbdce2b 254 export plugin_$plugin=$plugin.la
24053345
HJYP
255 ;;
256 esac
3a604782
HG
257 done
258 AC_MSG_RESULT($plugins)
199c3ea8
JH
259fi
260
c044bccf
JH
261dnl FIXME: OSS/ALSA checking
262if test x"$compile_alsa" = "xno"; then
9d4601f2
AG
263 AC_DEFINE(DISABLE_ALSA, [1], [Define to disable using ALSA in 'volume' plugin.])
264 if test -n $plugin_volume; then
265 AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h])
266 if test x$ac_cv_header_sys_soundcard_h = xno && test x$ac_cv_header_linux_soundcard_h = xno; then
267 AC_MSG_RESULT([no OSS headers found!])
268 plugin_volume=
269 fi
24053345 270 fi
c044bccf 271else
9d4601f2
AG
272 dnl use $plugin_volumealsa for backward compatibility
273 if test -n $plugin_volumealsa; then
274 plugin_volume=volume.la
17d22719
AG
275 fi
276fi
9dda8252
JL
277
278dnl Exclude indicator support when there is no support.
279if test x"$indicator_support" = "xno"; then
280 plugin_indicator=
281fi
282
22242ed4 283PLUGINS_LIST="\
7e20ea34 284 $plugin_netstatus \
65efa143 285 $plugin_netstat \
7e20ea34 286 $plugin_volume \
7e20ea34
HJYP
287 $plugin_cpu \
288 $plugin_deskno \
289 $plugin_batt \
290 $plugin_kbled \
62550cea 291 $plugin_xkb \
c03f7bd0 292 $plugin_thermal \
9770479a 293 $plugin_cpufreq \
2ae466ab 294 $plugin_monitors \
f0a22461
PS
295 $plugin_indicator \
296 $plugin_weather"
22242ed4 297
199c3ea8
JH
298AC_SUBST(PLUGINS_LIST)
299
fcb35553
PS
300# Plugin-specific dependencies
301# nestat
302if test x"$plugin_netstat" != "x";then
303AC_CHECK_HEADER([iwlib.h],,
304 AC_MSG_ERROR([netstat plugin requires wireless-tools-devel]))
305fi
1141e22a 306
f0a22461
PS
307# weather
308if test x"$plugin_weather" != "x";then
309PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
310AC_SUBST(LIBXML2_CFLAGS)
311AC_SUBST(LIBXML2_LIBS)
312fi
313
a52c2257
HJYP
314# Checks for header files.
315AC_PATH_X
316AC_HEADER_STDC
317AC_HEADER_SYS_WAIT
318AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
319
320# Checks for typedefs, structures, and compiler characteristics.
321AC_C_CONST
322AC_C_INLINE
323AC_STRUCT_TM
324
325# Checks for library functions.
326AC_FUNC_MALLOC
327AC_FUNC_MEMCMP
328AC_TYPE_SIGNAL
329AC_FUNC_STAT
330AC_FUNC_STRFTIME
331AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
332
bed635b7
AG
333dnl check for menu-cache versions 0.4.x since no macro MENU_CACHE_CHECK_VERSION
334dnl is available in those versions
335LIBS_save="${LIBS}"
336LIBS="${LIBS} ${MENU_CACHE_LIBS}"
337AC_CHECK_FUNCS(menu_cache_dir_list_children)
338LIBS="${LIBS_save}"
a52c2257 339
5f9e4cb1
JL
340# Generate po/LINGUAS on the fly rather than relying on translators
341# to maintain it manually. This also overcome the problem that Transifex
342# cannot add a language to po/LINGUAS if a new po file is submitted.
343rm -f $srcdir/po/LINGUAS
344for po_file in `ls $srcdir/po/*.po | sort`;
345do
346 lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
347 echo $lang >> $srcdir/po/LINGUAS
348done
349
a52c2257 350GETTEXT_PACKAGE=lxpanel
a52c2257
HJYP
351AC_SUBST(GETTEXT_PACKAGE)
352AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
353
a52c2257
HJYP
354AM_GLIB_GNU_GETTEXT
355
b366baa2
AG
356AC_ARG_ENABLE(debug,
357 [AC_HELP_STRING([--enable-debug],
358 [enable debug support @<:@default=no@:>@])],
359 [enable_debug="${enableval}"],
360 [enable_debug=no]
361)
362if test "$enable_debug" = "yes"; then
363 # turn on debug and disable optimization
364 CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
365 case "$CC" in
366 gcc*)
367 CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration"
368 ;;
369 *)
370 ;;
371 esac
372 dnl Be more strict on portability
373 #CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
374else
375 # turn off glib debug checks
376 CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
377fi
378
98c7671a
AG
379dnl Make version subfields for LXPANEL_CHECK_VERSION macro
380ac_version_subst_str=`echo $VERSION | awk -F '.' '/.*/ { printf "VERSION_MAJOR=%d VERSION_MINOR=%d VERSION_MICRO=%d", $1, $2, $3 }'`
381eval ${ac_version_subst_str}
382AC_SUBST(VERSION_MAJOR)
383AC_SUBST(VERSION_MINOR)
384AC_SUBST(VERSION_MICRO)
385
1f4bc3aa
AG
386dnl Fix invalid sysconfdir when --prefix=/usr
387if test `eval "echo $sysconfdir"` = /usr/etc
388then
389 sysconfdir=/etc
390fi
391
a52c2257 392AC_CONFIG_FILES([
f5c43b11 393 lxpanel.pc
24053345
HJYP
394 Makefile
395 src/Makefile
98c7671a 396 src/panel.h
d609cab0 397 plugins/Makefile
24053345
HJYP
398 po/Makefile.in
399 data/Makefile
cf701cb7 400 data/default/panels/panel
65efa143
JL
401 data/two_panels/panels/top
402 data/two_panels/panels/bottom
70344206 403 man/Makefile
a52c2257
HJYP
404])
405AC_OUTPUT
199c3ea8 406
24053345 407echo
ce728cd9 408echo lxpanel ......................... : Version $VERSION
199c3ea8
JH
409echo
410echo Prefix........................... : $prefix
1f4bc3aa
AG
411echo System config directory.......... : `eval "echo $sysconfdir"`
412echo
413
199c3ea8
JH
414if test x$plugins_loading = xyes; then
415echo Building dynamic plugins:
24053345
HJYP
416 if test x"$plugin_netstatus" != x; then
417 AC_MSG_RESULT([ netstatus - Monitor networking status])
418 fi
65efa143
JL
419 if test x"$plugin_netstat" != x; then
420 AC_MSG_RESULT([ netstat - Monitor networking status])
421 fi
24053345 422 if test x"$plugin_volume" != x; then
9d4601f2 423 AC_MSG_RESULT([ volume - Display and adjust volume of sound card])
24053345
HJYP
424 fi
425 if test x"$plugin_cpu" != x; then
426 AC_MSG_RESULT([ cpu - Display CPU loading])
427 fi
428 if test x"$plugin_deskno" != x; then
429 AC_MSG_RESULT([ deskno - Display desktop number])
430 fi
431 if test x"$plugin_batt" != x; then
432 AC_MSG_RESULT([ batt - Monitor battery status])
433 fi
7e20ea34
HJYP
434 if test x"$plugin_kbled" != x; then
435 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
436 fi
22242ed4 437 if test x"$plugin_xkb" != x; then
fc26a89e 438 AC_MSG_RESULT([ xkb - Keyboard layout handler])
22242ed4 439 fi
62550cea
FC
440 if test x"$plugin_thermal" != x; then
441 AC_MSG_RESULT([ thermal - Temperature monitor])
442 fi
c03f7bd0
DK
443 if test x"$plugin_cpufreq" != x; then
444 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
445 fi
9770479a
JL
446 if test x"$plugin_monitors" != x; then
447 AC_MSG_RESULT([ monitors - Monitors for CPU & RAM])
448 fi
9dda8252
JL
449 if test x"$plugin_indicator" != x; then
450 AC_MSG_RESULT([ indicator - Indicator support])
451 fi
f0a22461
PS
452 if test x"$plugin_weather" != x; then
453 AC_MSG_RESULT([ weather - Weather conditions and forecast])
454 fi
199c3ea8
JH
455else
456echo Dynamic loader for plugins....... : disabled.
457fi
1234b94c 458
1f4bc3aa
AG
459if test x"$sysconfdir" != x'/etc'; then
460 echo
461 echo 'Warning: sysconfdir is not /etc. It might be not what you want.'
462 echo 'Please consider passing --sysconfdir=/etc to configure.'
463fi
464
1234b94c 465echo
46cea569
HJYP
466echo 'LXPanel requires menu-cache and lxmenu-data packages since'
467echo 'version 0.4.0. Please make sure they are correctly installed.'
468echo 'Otherwise, you will not be able to use applications menu.'
469echo
1234b94c 470