Releasing debian version 0.8.0-2.
[debian/lxpanel.git] / configure.ac
CommitLineData
6cc5e1a6 1AC_PREREQ(2.53)
89173f95 2AC_INIT(lxpanel, 0.8.0, 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
f8c25730
DB
270
271dnl Exclude indicator support when there is no support.
272if test x"$indicator_support" = "xno"; then
273 plugin_indicator=
274fi
275
6cc5e1a6
DB
276PLUGINS_LIST="\
277 $plugin_netstatus \
f8c25730 278 $plugin_netstat \
6cc5e1a6
DB
279 $plugin_volume \
280 $plugin_volumealsa \
281 $plugin_cpu \
282 $plugin_deskno \
283 $plugin_batt \
284 $plugin_kbled \
10862fa6 285 $plugin_xkb \
bfba7517 286 $plugin_thermal \
f8c25730
DB
287 $plugin_cpufreq \
288 $plugin_monitors \
00916e98
AG
289 $plugin_indicator \
290 $plugin_weather"
6cc5e1a6
DB
291
292AC_SUBST(PLUGINS_LIST)
293
f8c25730
DB
294# Plugin-specific dependencies
295# nestat
296if test x"$plugin_netstat" != "x";then
297AC_CHECK_HEADER([iwlib.h],,
298 AC_MSG_ERROR([netstat plugin requires wireless-tools-devel]))
299fi
6cc5e1a6 300
00916e98
AG
301# weather
302if test x"$plugin_weather" != "x";then
303PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
304AC_SUBST(LIBXML2_CFLAGS)
305AC_SUBST(LIBXML2_LIBS)
306fi
307
6cc5e1a6
DB
308# Checks for header files.
309AC_PATH_X
310AC_HEADER_STDC
311AC_HEADER_SYS_WAIT
312AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
313
314# Checks for typedefs, structures, and compiler characteristics.
315AC_C_CONST
316AC_C_INLINE
317AC_STRUCT_TM
318
319# Checks for library functions.
320AC_FUNC_MALLOC
321AC_FUNC_MEMCMP
322AC_TYPE_SIGNAL
323AC_FUNC_STAT
324AC_FUNC_STRFTIME
325AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
326
00916e98
AG
327dnl check for menu-cache versions 0.4.x since no macro MENU_CACHE_CHECK_VERSION
328dnl is available in those versions
329LIBS_save="${LIBS}"
330LIBS="${LIBS} ${MENU_CACHE_LIBS}"
331AC_CHECK_FUNCS(menu_cache_dir_list_children)
332LIBS="${LIBS_save}"
6cc5e1a6 333
ca14ea2b
DB
334# Generate po/LINGUAS on the fly rather than relying on translators
335# to maintain it manually. This also overcome the problem that Transifex
336# cannot add a language to po/LINGUAS if a new po file is submitted.
337rm -f $srcdir/po/LINGUAS
338for po_file in `ls $srcdir/po/*.po | sort`;
339do
340 lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
341 echo $lang >> $srcdir/po/LINGUAS
342done
343
6cc5e1a6 344GETTEXT_PACKAGE=lxpanel
6cc5e1a6
DB
345AC_SUBST(GETTEXT_PACKAGE)
346AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
347
6cc5e1a6
DB
348AM_GLIB_GNU_GETTEXT
349
00916e98
AG
350AC_ARG_ENABLE(debug,
351 [AC_HELP_STRING([--enable-debug],
352 [enable debug support @<:@default=no@:>@])],
353 [enable_debug="${enableval}"],
354 [enable_debug=no]
355)
356if test "$enable_debug" = "yes"; then
357 # turn on debug and disable optimization
358 CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
359 case "$CC" in
360 gcc*)
361 CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration"
362 ;;
363 *)
364 ;;
365 esac
366 dnl Be more strict on portability
367 #CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
368else
369 # turn off glib debug checks
370 CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
371fi
372
89173f95
AG
373dnl Make version subfields for LXPANEL_CHECK_VERSION macro
374ac_version_subst_str=`echo $VERSION | awk -F '.' '/.*/ { printf "VERSION_MAJOR=%d VERSION_MINOR=%d VERSION_MICRO=%d", $1, $2, $3 }'`
375eval ${ac_version_subst_str}
376AC_SUBST(VERSION_MAJOR)
377AC_SUBST(VERSION_MINOR)
378AC_SUBST(VERSION_MICRO)
379
00916e98
AG
380dnl Fix invalid sysconfdir when --prefix=/usr
381if test `eval "echo $sysconfdir"` = /usr/etc
382then
383 sysconfdir=/etc
384fi
385
6cc5e1a6 386AC_CONFIG_FILES([
10862fa6 387 lxpanel.pc
6cc5e1a6
DB
388 Makefile
389 src/Makefile
89173f95 390 src/panel.h
00916e98 391 plugins/Makefile
6cc5e1a6
DB
392 po/Makefile.in
393 data/Makefile
394 data/default/panels/panel
f8c25730
DB
395 data/two_panels/panels/top
396 data/two_panels/panels/bottom
6cc5e1a6
DB
397 man/Makefile
398])
399AC_OUTPUT
400
401echo
402echo lxpanel ......................... : Version $VERSION
403echo
404echo Prefix........................... : $prefix
00916e98
AG
405echo System config directory.......... : `eval "echo $sysconfdir"`
406echo
407
6cc5e1a6
DB
408if test x$plugins_loading = xyes; then
409echo Building dynamic plugins:
410 if test x"$plugin_netstatus" != x; then
411 AC_MSG_RESULT([ netstatus - Monitor networking status])
412 fi
f8c25730
DB
413 if test x"$plugin_netstat" != x; then
414 AC_MSG_RESULT([ netstat - Monitor networking status])
415 fi
6cc5e1a6 416 if test x"$plugin_volume" != x; then
1ea75322 417 AC_MSG_RESULT([ volume - Display and adjust volume of sound card for OSS])
6cc5e1a6
DB
418 fi
419 if test x"$plugin_volumealsa" != x; then
420 AC_MSG_RESULT([ volumealsa - Display and adjust volume of sound card for ALSA])
421 fi
422 if test x"$plugin_cpu" != x; then
423 AC_MSG_RESULT([ cpu - Display CPU loading])
424 fi
425 if test x"$plugin_deskno" != x; then
426 AC_MSG_RESULT([ deskno - Display desktop number])
427 fi
428 if test x"$plugin_batt" != x; then
429 AC_MSG_RESULT([ batt - Monitor battery status])
430 fi
431 if test x"$plugin_kbled" != x; then
432 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
433 fi
434 if test x"$plugin_xkb" != x; then
00916e98 435 AC_MSG_RESULT([ xkb - Keyboard layout handler])
6cc5e1a6 436 fi
10862fa6
DB
437 if test x"$plugin_thermal" != x; then
438 AC_MSG_RESULT([ thermal - Temperature monitor])
439 fi
bfba7517
DB
440 if test x"$plugin_cpufreq" != x; then
441 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
442 fi
f8c25730
DB
443 if test x"$plugin_monitors" != x; then
444 AC_MSG_RESULT([ monitors - Monitors for CPU & RAM])
445 fi
f8c25730
DB
446 if test x"$plugin_indicator" != x; then
447 AC_MSG_RESULT([ indicator - Indicator support])
448 fi
00916e98
AG
449 if test x"$plugin_weather" != x; then
450 AC_MSG_RESULT([ weather - Weather conditions and forecast])
451 fi
6cc5e1a6
DB
452else
453echo Dynamic loader for plugins....... : disabled.
454fi
10862fa6 455
00916e98
AG
456if test x"$sysconfdir" != x'/etc'; then
457 echo
458 echo 'Warning: sysconfdir is not /etc. It might be not what you want.'
459 echo 'Please consider passing --sysconfdir=/etc to configure.'
460fi
461
10862fa6
DB
462echo
463echo 'LXPanel requires menu-cache and lxmenu-data packages since'
464echo 'version 0.4.0. Please make sure they are correctly installed.'
465echo 'Otherwise, you will not be able to use applications menu.'
466echo
467