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