Automatic translation update from Pootle
[lxde/lxpanel.git] / configure.ac
... / ...
CommitLineData
1AC_PREREQ(2.53)
2AC_INIT(lxpanel, 0.10.0, http://lxde.org/)
3AM_INIT_AUTOMAKE([-Wall foreign subdir-objects no-dist-gzip dist-xz])
4AC_CONFIG_HEADER([config.h])
5AC_CONFIG_MACRO_DIR([m4])
6
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
11# Force to dynamic
12AC_DISABLE_STATIC
13
14# Checks for programs.
15AC_PROG_CC
16AC_PROG_INSTALL
17AC_PROG_LN_S
18IT_PROG_INTLTOOL([0.40.0], [no-xml])
19AM_PROG_CC_C_O
20m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
21
22#Initialize libtool
23LT_PREREQ([2.2])
24LT_INIT
25
26# Checks for libraries.
27AC_SEARCH_LIBS([log], [m])
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
37 gtk_module="gtk+-3.0"
38 pkg_modules="$pkg_modules $gtk_module libfm-gtk3 >= 1.2.0 libwnck-3.0"
39 keybinder_module=keybinder-3.0
40else
41 gtk_module="gtk+-2.0 >= 2.18.0"
42 pkg_modules="$pkg_modules $gtk_module libfm-gtk >= 1.2.0 libwnck-1.0"
43 keybinder_module=keybinder
44fi
45
46pkg_modules="$pkg_modules \
47 gio-unix-2.0 \
48 gthread-2.0 \
49 gmodule-2.0"
50PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
51AC_SUBST(PACKAGE_CFLAGS)
52AC_SUBST(PACKAGE_LIBS)
53AC_SUBST(gtk_module)
54
55PKG_CHECK_MODULES(KEYBINDER, [$keybinder_module])
56AC_SUBST(KEYBINDER_CFLAGS)
57AC_SUBST(KEYBINDER_LIBS)
58
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
87pkg_modules="x11"
88PKG_CHECK_MODULES(X11, [$pkg_modules])
89AC_SUBST(X11_LIBS)
90
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
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)
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
110
111PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
112PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
113
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
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
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=
192plugin_netstat=
193plugin_volume=
194plugin_cpu=
195plugin_deskno=
196plugin_batt=
197plugin_xkb=
198plugin_kbled=
199plugin_thermal=
200plugin_cpufreq=
201plugin_monitors=
202plugin_indicator=
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 ]
209[ plugins prefixed with '-' are not built]
210[ Possible plugins are: ]
211[ netstatus, netstat, volume, cpu, deskno, batt, kbled,]
212[ xkb, thermal, cpufreq, monitors, indicator, weather]
213, plugins="$withval",[plugins="all"])
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
222ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors indicator weather"
223
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
241 case "$plugin" in
242 all)
243 for name in $ALL_PLUGINS_LIST
244 do
245 export plugin_$name="$name.la"
246 done
247 ;;
248 -*)
249 check_plugin_name([${plugin#-}])
250 export plugin_${plugin#-}=
251 ;;
252 *)
253 check_plugin_name([$plugin])
254 export plugin_$plugin=$plugin.la
255 ;;
256 esac
257 done
258 AC_MSG_RESULT($plugins)
259fi
260
261dnl FIXME: OSS/ALSA checking
262if test x"$compile_alsa" = "xno"; then
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
270 fi
271else
272 dnl use $plugin_volumealsa for backward compatibility
273 if test -n "$plugin_volumealsa"; then
274 plugin_volume=volume.la
275 fi
276fi
277
278if test -n "$plugin_weather"; then
279 AC_MSG_CHECKING([for CURL development files])
280 curl-config --help &>/dev/null || {
281 AC_MSG_ERROR([weather plugin requires libcurl development files])
282 }
283 CURL_CFLAGS=$(curl-config --cflags)
284 CURL_LIBS=$(curl-config --libs)
285 AC_MSG_RESULT([found])
286 AC_SUBST(CURL_CFLAGS)
287 AC_SUBST(CURL_LIBS)
288fi
289
290dnl Exclude indicator support when there is no support.
291if test x"$indicator_support" = "xno"; then
292 plugin_indicator=
293fi
294
295PLUGINS_LIST="\
296 $plugin_netstatus \
297 $plugin_netstat \
298 $plugin_volume \
299 $plugin_cpu \
300 $plugin_deskno \
301 $plugin_batt \
302 $plugin_kbled \
303 $plugin_xkb \
304 $plugin_thermal \
305 $plugin_cpufreq \
306 $plugin_monitors \
307 $plugin_indicator \
308 $plugin_weather"
309
310AC_SUBST(PLUGINS_LIST)
311
312# Plugin-specific dependencies
313# nestat
314if test x"$plugin_netstat" != "x";then
315AC_CHECK_HEADER([iwlib.h],,
316 AC_MSG_ERROR([netstat plugin requires wireless-tools-devel]))
317fi
318
319# weather
320if test x"$plugin_weather" != "x";then
321PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
322AC_SUBST(LIBXML2_CFLAGS)
323AC_SUBST(LIBXML2_LIBS)
324fi
325
326# Checks for header files.
327AC_PATH_X
328AC_HEADER_STDC
329AC_HEADER_SYS_WAIT
330AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
331
332# Checks for typedefs, structures, and compiler characteristics.
333AC_C_CONST
334AC_C_INLINE
335AC_STRUCT_TM
336
337# Checks for library functions.
338AC_FUNC_MALLOC
339AC_FUNC_MEMCMP
340AC_TYPE_SIGNAL
341AC_FUNC_STAT
342AC_FUNC_STRFTIME
343AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
344
345dnl check for menu-cache versions 0.4.x since no macro MENU_CACHE_CHECK_VERSION
346dnl is available in those versions
347LIBS_save="${LIBS}"
348LIBS="${LIBS} ${MENU_CACHE_LIBS}"
349AC_CHECK_FUNCS(menu_cache_dir_list_children)
350LIBS="${LIBS_save}"
351
352# Generate po/LINGUAS on the fly rather than relying on translators
353# to maintain it manually. This also overcome the problem that Transifex
354# cannot add a language to po/LINGUAS if a new po file is submitted.
355rm -f $srcdir/po/LINGUAS
356for po_file in `ls $srcdir/po/*.po | sort`;
357do
358 lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
359 echo $lang >> $srcdir/po/LINGUAS
360done
361
362GETTEXT_PACKAGE=lxpanel
363AC_SUBST(GETTEXT_PACKAGE)
364AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
365
366AM_GLIB_GNU_GETTEXT
367
368AC_ARG_ENABLE(debug,
369 [AC_HELP_STRING([--enable-debug],
370 [enable debug support @<:@default=no@:>@])],
371 [enable_debug="${enableval}"],
372 [enable_debug=no]
373)
374if test "$enable_debug" = "yes"; then
375 # turn on debug and disable optimization
376 CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
377 case "$CC" in
378 gcc*)
379 CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration"
380 ;;
381 *)
382 ;;
383 esac
384 dnl Be more strict on portability
385 #CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
386else
387 # turn off glib debug checks
388 CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
389fi
390
391dnl Make version subfields for LXPANEL_CHECK_VERSION macro
392ac_version_subst_str=`echo $VERSION | awk -F '.' '/.*/ { printf "VERSION_MAJOR=%d VERSION_MINOR=%d VERSION_MICRO=%d", $1, $2, $3 }'`
393eval ${ac_version_subst_str}
394AC_SUBST(VERSION_MAJOR)
395AC_SUBST(VERSION_MINOR)
396AC_SUBST(VERSION_MICRO)
397
398dnl Fix invalid sysconfdir when --prefix=/usr
399if test `eval "echo $sysconfdir"` = /usr/etc
400then
401 sysconfdir=/etc
402fi
403
404AC_CONFIG_FILES([
405 lxpanel.pc
406 Makefile
407 src/Makefile
408 src/panel.h
409 plugins/Makefile
410 po/Makefile.in
411 data/Makefile
412 data/default/panels/panel
413 data/two_panels/panels/top
414 data/two_panels/panels/bottom
415 man/Makefile
416])
417AC_OUTPUT
418
419echo
420echo lxpanel ......................... : Version $VERSION
421echo
422echo Prefix........................... : $prefix
423echo System config directory.......... : `eval "echo $sysconfdir"`
424echo
425
426if test x$plugins_loading = xyes; then
427echo Building dynamic plugins:
428 if test x"$plugin_netstatus" != x; then
429 AC_MSG_RESULT([ netstatus - Monitor networking status])
430 fi
431 if test x"$plugin_netstat" != x; then
432 AC_MSG_RESULT([ netstat - Monitor networking status])
433 fi
434 if test x"$plugin_volume" != x; then
435 AC_MSG_RESULT([ volume - Display and adjust volume of sound card])
436 fi
437 if test x"$plugin_cpu" != x; then
438 AC_MSG_RESULT([ cpu - Display CPU loading])
439 fi
440 if test x"$plugin_deskno" != x; then
441 AC_MSG_RESULT([ deskno - Display desktop number])
442 fi
443 if test x"$plugin_batt" != x; then
444 AC_MSG_RESULT([ batt - Monitor battery status])
445 fi
446 if test x"$plugin_kbled" != x; then
447 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
448 fi
449 if test x"$plugin_xkb" != x; then
450 AC_MSG_RESULT([ xkb - Keyboard layout handler])
451 fi
452 if test x"$plugin_thermal" != x; then
453 AC_MSG_RESULT([ thermal - Temperature monitor])
454 fi
455 if test x"$plugin_cpufreq" != x; then
456 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
457 fi
458 if test x"$plugin_monitors" != x; then
459 AC_MSG_RESULT([ monitors - Monitors for CPU & RAM])
460 fi
461 if test x"$plugin_indicator" != x; then
462 AC_MSG_RESULT([ indicator - Indicator support])
463 fi
464 if test x"$plugin_weather" != x; then
465 AC_MSG_RESULT([ weather - Weather conditions and forecast])
466 fi
467else
468echo Dynamic loader for plugins....... : disabled.
469fi
470
471if test x"$sysconfdir" != x'/etc'; then
472 echo
473 echo 'Warning: sysconfdir is not /etc. It might be not what you want.'
474 echo 'Please consider passing --sysconfdir=/etc to configure.'
475fi
476
477echo
478echo 'LXPanel requires menu-cache and lxmenu-data packages since'
479echo 'version 0.4.0. Please make sure they are correctly installed.'
480echo 'Otherwise, you will not be able to use applications menu.'
481echo
482