Releasing debian version 0.10.0-2.
[debian/lxpanel.git] / configure.ac
CommitLineData
6cc5e1a6 1AC_PREREQ(2.53)
1764e5ff 2AC_INIT(lxpanel, 0.10.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
41c9eeac
AG
37 gtk_module="gtk+-3.0"
38 pkg_modules="$pkg_modules $gtk_module libfm-gtk3 >= 1.2.0 libwnck-3.0"
89173f95 39 keybinder_module=keybinder-3.0
f8c25730 40else
41c9eeac
AG
41 gtk_module="gtk+-2.0 >= 2.18.0"
42 pkg_modules="$pkg_modules $gtk_module libfm-gtk >= 1.2.0 libwnck-1.0"
89173f95 43 keybinder_module=keybinder
f8c25730
DB
44fi
45
46pkg_modules="$pkg_modules \
1ea75322 47 gio-unix-2.0 \
f8c25730 48 gthread-2.0 \
00916e98 49 gmodule-2.0"
6cc5e1a6
DB
50PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
51AC_SUBST(PACKAGE_CFLAGS)
52AC_SUBST(PACKAGE_LIBS)
41c9eeac 53AC_SUBST(gtk_module)
6cc5e1a6 54
89173f95
AG
55PKG_CHECK_MODULES(KEYBINDER, [$keybinder_module])
56AC_SUBST(KEYBINDER_CFLAGS)
57AC_SUBST(KEYBINDER_LIBS)
58
f8c25730
DB
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
934ecce5
DB
87pkg_modules="x11"
88PKG_CHECK_MODULES(X11, [$pkg_modules])
89AC_SUBST(X11_LIBS)
90
10862fa6
DB
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
ca14ea2b
DB
98AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
99
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)
10862fa6 106
ca14ea2b
DB
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
ca14ea2b
DB
110
111PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
10862fa6
DB
112PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
113
6cc5e1a6
DB
114dnl linker tweaking
115# The function of the link flag --as-needed is to prevent unnecesary linking.
116# Example: A -> B -> C
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
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'*)
124 LDFLAGS="$LDFLAGS -Wl,--as-needed"
125 AC_MSG_RESULT([yes])
126 ;;
127*)
128 AC_MSG_RESULT([no])
129 ;;
130esac
131
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 ;;
149*)
150 AC_MSG_RESULT([no])
151 ;;
152esac
153AC_MSG_CHECKING([whether $LD accepts --sort-common])
154case `$LD --sort-common -v 2>&1 </dev/null` in
155*GNU* | *'with BFD'*)
156 LDFLAGS="$LDFLAGS -Wl,--sort-common"
157 AC_MSG_RESULT([yes])
158 ;;
159*)
160 AC_MSG_RESULT([no])
161 ;;
162esac
163
6cc5e1a6
DB
164AC_ARG_ENABLE([alsa],
165 AS_HELP_STRING([--disable-alsa],
166 [compile ALSA providers (default: enable)]),
167 compile_alsa=$enableval, compile_alsa="yes")
168if test x"$compile_alsa" = "xyes"; then
169 AC_CHECK_HEADERS([alsa/asoundlib.h],
170 [AC_CHECK_LIB([asound],
171 [snd_seq_open],
172 compile_alsa=yes,compile_alsa=no)],
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
6cc5e1a6
DB
179AC_ARG_ENABLE([plugins-loading],
180 AS_HELP_STRING([--disable-plugins-loading],
181 [disable plugin loading (default: enable)]),
182 plugins_loading=$enableval, plugins_loading="yes")
183
184AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
185
186if test x"$plugins_loading" = "xno"; then
187 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
188fi
189
190dnl Here are plugin listing.
191plugin_netstatus=
f8c25730 192plugin_netstat=
6cc5e1a6 193plugin_volume=
6cc5e1a6
DB
194plugin_cpu=
195plugin_deskno=
196plugin_batt=
197plugin_xkb=
198plugin_kbled=
10862fa6 199plugin_thermal=
bfba7517 200plugin_cpufreq=
f8c25730 201plugin_monitors=
f8c25730 202plugin_indicator=
6cc5e1a6
DB
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 ]
0f7f2ef3 209[ plugins prefixed with '-' are not built]
6cc5e1a6 210[ Possible plugins are: ]
41c9eeac
AG
211[ netstatus, netstat, volume, cpu, deskno, batt, kbled,]
212[ xkb, thermal, cpufreq, monitors, indicator, weather]
0f7f2ef3 213, plugins="$withval",[plugins="all"])
6cc5e1a6
DB
214
215if test x"$plugins" != xall -a x"$plugins" != xnone; then
216 if test x"$plugins_loading" = xno; then
217 AC_MSG_ERROR(
218 [--disable-plugins-loading and --with-plugins conflict each other.])
219 fi
220fi
221
00916e98 222ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors indicator weather"
6cc5e1a6 223
0f7f2ef3
AL
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
6cc5e1a6 241 case "$plugin" in
0f7f2ef3
AL
242 all)
243 for name in $ALL_PLUGINS_LIST
244 do
64ea8d44 245 export plugin_$name="$name.la"
0f7f2ef3 246 done
6cc5e1a6 247 ;;
0f7f2ef3
AL
248 -*)
249 check_plugin_name([${plugin#-}])
250 export plugin_${plugin#-}=
f8c25730 251 ;;
6cc5e1a6 252 *)
0f7f2ef3 253 check_plugin_name([$plugin])
64ea8d44 254 export plugin_$plugin=$plugin.la
6cc5e1a6
DB
255 ;;
256 esac
0f7f2ef3
AL
257 done
258 AC_MSG_RESULT($plugins)
6cc5e1a6
DB
259fi
260
261dnl FIXME: OSS/ALSA checking
262if test x"$compile_alsa" = "xno"; then
41c9eeac
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
6cc5e1a6
DB
270 fi
271else
41c9eeac 272 dnl use $plugin_volumealsa for backward compatibility
1764e5ff 273 if test -n "$plugin_volumealsa"; then
41c9eeac 274 plugin_volume=volume.la
78ad3d2c
AG
275 fi
276fi
f8c25730 277
1764e5ff
AG
278if test -n "$plugin_weather"; then
279 curl-config --help &>/dev/null || {
280 AC_MSG_ERROR([weather plugin requires libcurl development files])
281 }
282 CURL_CFLAGS=$(curl-config --cflags)
283 CURL_LIBS=$(curl-config --libs)
284 AC_SUBST(CURL_CFLAGS)
285 AC_SUBST(CURL_LIBS)
286fi
287
f8c25730
DB
288dnl Exclude indicator support when there is no support.
289if test x"$indicator_support" = "xno"; then
290 plugin_indicator=
291fi
292
6cc5e1a6
DB
293PLUGINS_LIST="\
294 $plugin_netstatus \
f8c25730 295 $plugin_netstat \
6cc5e1a6 296 $plugin_volume \
6cc5e1a6
DB
297 $plugin_cpu \
298 $plugin_deskno \
299 $plugin_batt \
300 $plugin_kbled \
10862fa6 301 $plugin_xkb \
bfba7517 302 $plugin_thermal \
f8c25730
DB
303 $plugin_cpufreq \
304 $plugin_monitors \
00916e98
AG
305 $plugin_indicator \
306 $plugin_weather"
6cc5e1a6
DB
307
308AC_SUBST(PLUGINS_LIST)
309
f8c25730
DB
310# Plugin-specific dependencies
311# nestat
312if test x"$plugin_netstat" != "x";then
313AC_CHECK_HEADER([iwlib.h],,
314 AC_MSG_ERROR([netstat plugin requires wireless-tools-devel]))
315fi
6cc5e1a6 316
00916e98
AG
317# weather
318if test x"$plugin_weather" != "x";then
319PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
320AC_SUBST(LIBXML2_CFLAGS)
321AC_SUBST(LIBXML2_LIBS)
322fi
323
6cc5e1a6
DB
324# Checks for header files.
325AC_PATH_X
326AC_HEADER_STDC
327AC_HEADER_SYS_WAIT
328AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
329
330# Checks for typedefs, structures, and compiler characteristics.
331AC_C_CONST
332AC_C_INLINE
333AC_STRUCT_TM
334
335# Checks for library functions.
336AC_FUNC_MALLOC
337AC_FUNC_MEMCMP
338AC_TYPE_SIGNAL
339AC_FUNC_STAT
340AC_FUNC_STRFTIME
341AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
342
00916e98
AG
343dnl check for menu-cache versions 0.4.x since no macro MENU_CACHE_CHECK_VERSION
344dnl is available in those versions
345LIBS_save="${LIBS}"
346LIBS="${LIBS} ${MENU_CACHE_LIBS}"
347AC_CHECK_FUNCS(menu_cache_dir_list_children)
348LIBS="${LIBS_save}"
6cc5e1a6 349
ca14ea2b
DB
350# Generate po/LINGUAS on the fly rather than relying on translators
351# to maintain it manually. This also overcome the problem that Transifex
352# cannot add a language to po/LINGUAS if a new po file is submitted.
353rm -f $srcdir/po/LINGUAS
354for po_file in `ls $srcdir/po/*.po | sort`;
355do
356 lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
357 echo $lang >> $srcdir/po/LINGUAS
358done
359
6cc5e1a6 360GETTEXT_PACKAGE=lxpanel
6cc5e1a6
DB
361AC_SUBST(GETTEXT_PACKAGE)
362AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
363
6cc5e1a6
DB
364AM_GLIB_GNU_GETTEXT
365
00916e98
AG
366AC_ARG_ENABLE(debug,
367 [AC_HELP_STRING([--enable-debug],
368 [enable debug support @<:@default=no@:>@])],
369 [enable_debug="${enableval}"],
370 [enable_debug=no]
371)
372if test "$enable_debug" = "yes"; then
373 # turn on debug and disable optimization
374 CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
375 case "$CC" in
376 gcc*)
377 CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration"
378 ;;
379 *)
380 ;;
381 esac
382 dnl Be more strict on portability
383 #CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
384else
385 # turn off glib debug checks
386 CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
387fi
388
89173f95
AG
389dnl Make version subfields for LXPANEL_CHECK_VERSION macro
390ac_version_subst_str=`echo $VERSION | awk -F '.' '/.*/ { printf "VERSION_MAJOR=%d VERSION_MINOR=%d VERSION_MICRO=%d", $1, $2, $3 }'`
391eval ${ac_version_subst_str}
392AC_SUBST(VERSION_MAJOR)
393AC_SUBST(VERSION_MINOR)
394AC_SUBST(VERSION_MICRO)
395
00916e98
AG
396dnl Fix invalid sysconfdir when --prefix=/usr
397if test `eval "echo $sysconfdir"` = /usr/etc
398then
399 sysconfdir=/etc
400fi
401
6cc5e1a6 402AC_CONFIG_FILES([
10862fa6 403 lxpanel.pc
6cc5e1a6
DB
404 Makefile
405 src/Makefile
89173f95 406 src/panel.h
00916e98 407 plugins/Makefile
6cc5e1a6
DB
408 po/Makefile.in
409 data/Makefile
410 data/default/panels/panel
f8c25730
DB
411 data/two_panels/panels/top
412 data/two_panels/panels/bottom
6cc5e1a6
DB
413 man/Makefile
414])
415AC_OUTPUT
416
417echo
418echo lxpanel ......................... : Version $VERSION
419echo
420echo Prefix........................... : $prefix
00916e98
AG
421echo System config directory.......... : `eval "echo $sysconfdir"`
422echo
423
6cc5e1a6
DB
424if test x$plugins_loading = xyes; then
425echo Building dynamic plugins:
426 if test x"$plugin_netstatus" != x; then
427 AC_MSG_RESULT([ netstatus - Monitor networking status])
428 fi
f8c25730
DB
429 if test x"$plugin_netstat" != x; then
430 AC_MSG_RESULT([ netstat - Monitor networking status])
431 fi
6cc5e1a6 432 if test x"$plugin_volume" != x; then
41c9eeac 433 AC_MSG_RESULT([ volume - Display and adjust volume of sound card])
6cc5e1a6
DB
434 fi
435 if test x"$plugin_cpu" != x; then
436 AC_MSG_RESULT([ cpu - Display CPU loading])
437 fi
438 if test x"$plugin_deskno" != x; then
439 AC_MSG_RESULT([ deskno - Display desktop number])
440 fi
441 if test x"$plugin_batt" != x; then
442 AC_MSG_RESULT([ batt - Monitor battery status])
443 fi
444 if test x"$plugin_kbled" != x; then
445 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
446 fi
447 if test x"$plugin_xkb" != x; then
00916e98 448 AC_MSG_RESULT([ xkb - Keyboard layout handler])
6cc5e1a6 449 fi
10862fa6
DB
450 if test x"$plugin_thermal" != x; then
451 AC_MSG_RESULT([ thermal - Temperature monitor])
452 fi
bfba7517
DB
453 if test x"$plugin_cpufreq" != x; then
454 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
455 fi
f8c25730
DB
456 if test x"$plugin_monitors" != x; then
457 AC_MSG_RESULT([ monitors - Monitors for CPU & RAM])
458 fi
f8c25730
DB
459 if test x"$plugin_indicator" != x; then
460 AC_MSG_RESULT([ indicator - Indicator support])
461 fi
00916e98
AG
462 if test x"$plugin_weather" != x; then
463 AC_MSG_RESULT([ weather - Weather conditions and forecast])
464 fi
6cc5e1a6
DB
465else
466echo Dynamic loader for plugins....... : disabled.
467fi
10862fa6 468
00916e98
AG
469if test x"$sysconfdir" != x'/etc'; then
470 echo
471 echo 'Warning: sysconfdir is not /etc. It might be not what you want.'
472 echo 'Please consider passing --sysconfdir=/etc to configure.'
473fi
474
10862fa6
DB
475echo
476echo 'LXPanel requires menu-cache and lxmenu-data packages since'
477echo 'version 0.4.0. Please make sure they are correctly installed.'
478echo 'Otherwise, you will not be able to use applications menu.'
479echo
480