Automatic translation update from Pootle
[lxde/lxpanel.git] / configure.ac
CommitLineData
a52c2257 1AC_PREREQ(2.53)
880342a3 2AC_INIT(lxpanel, 0.10.0, 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 272 dnl use $plugin_volumealsa for backward compatibility
405e10a5 273 if test -n "$plugin_volumealsa"; then
9d4601f2 274 plugin_volume=volume.la
17d22719
AG
275 fi
276fi
9dda8252 277
405e10a5 278if test -n "$plugin_weather"; then
3bb50f7d 279 AC_MSG_CHECKING([for CURL development files])
405e10a5
AG
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)
3bb50f7d 285 AC_MSG_RESULT([found])
405e10a5
AG
286 AC_SUBST(CURL_CFLAGS)
287 AC_SUBST(CURL_LIBS)
288fi
289
9dda8252
JL
290dnl Exclude indicator support when there is no support.
291if test x"$indicator_support" = "xno"; then
292 plugin_indicator=
293fi
294
22242ed4 295PLUGINS_LIST="\
7e20ea34 296 $plugin_netstatus \
65efa143 297 $plugin_netstat \
7e20ea34 298 $plugin_volume \
7e20ea34
HJYP
299 $plugin_cpu \
300 $plugin_deskno \
301 $plugin_batt \
302 $plugin_kbled \
62550cea 303 $plugin_xkb \
c03f7bd0 304 $plugin_thermal \
9770479a 305 $plugin_cpufreq \
2ae466ab 306 $plugin_monitors \
f0a22461
PS
307 $plugin_indicator \
308 $plugin_weather"
22242ed4 309
199c3ea8
JH
310AC_SUBST(PLUGINS_LIST)
311
fcb35553
PS
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
1141e22a 318
f0a22461
PS
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
a52c2257
HJYP
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
bed635b7
AG
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}"
a52c2257 351
5f9e4cb1
JL
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
a52c2257 362GETTEXT_PACKAGE=lxpanel
a52c2257
HJYP
363AC_SUBST(GETTEXT_PACKAGE)
364AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
365
a52c2257
HJYP
366AM_GLIB_GNU_GETTEXT
367
b366baa2
AG
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
98c7671a
AG
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
1f4bc3aa
AG
398dnl Fix invalid sysconfdir when --prefix=/usr
399if test `eval "echo $sysconfdir"` = /usr/etc
400then
401 sysconfdir=/etc
402fi
403
a52c2257 404AC_CONFIG_FILES([
f5c43b11 405 lxpanel.pc
24053345
HJYP
406 Makefile
407 src/Makefile
98c7671a 408 src/panel.h
d609cab0 409 plugins/Makefile
24053345
HJYP
410 po/Makefile.in
411 data/Makefile
cf701cb7 412 data/default/panels/panel
65efa143
JL
413 data/two_panels/panels/top
414 data/two_panels/panels/bottom
70344206 415 man/Makefile
a52c2257
HJYP
416])
417AC_OUTPUT
199c3ea8 418
24053345 419echo
ce728cd9 420echo lxpanel ......................... : Version $VERSION
199c3ea8
JH
421echo
422echo Prefix........................... : $prefix
1f4bc3aa
AG
423echo System config directory.......... : `eval "echo $sysconfdir"`
424echo
425
199c3ea8
JH
426if test x$plugins_loading = xyes; then
427echo Building dynamic plugins:
24053345
HJYP
428 if test x"$plugin_netstatus" != x; then
429 AC_MSG_RESULT([ netstatus - Monitor networking status])
430 fi
65efa143
JL
431 if test x"$plugin_netstat" != x; then
432 AC_MSG_RESULT([ netstat - Monitor networking status])
433 fi
24053345 434 if test x"$plugin_volume" != x; then
9d4601f2 435 AC_MSG_RESULT([ volume - Display and adjust volume of sound card])
24053345
HJYP
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
7e20ea34
HJYP
446 if test x"$plugin_kbled" != x; then
447 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
448 fi
22242ed4 449 if test x"$plugin_xkb" != x; then
fc26a89e 450 AC_MSG_RESULT([ xkb - Keyboard layout handler])
22242ed4 451 fi
62550cea
FC
452 if test x"$plugin_thermal" != x; then
453 AC_MSG_RESULT([ thermal - Temperature monitor])
454 fi
c03f7bd0
DK
455 if test x"$plugin_cpufreq" != x; then
456 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
457 fi
9770479a
JL
458 if test x"$plugin_monitors" != x; then
459 AC_MSG_RESULT([ monitors - Monitors for CPU & RAM])
460 fi
9dda8252
JL
461 if test x"$plugin_indicator" != x; then
462 AC_MSG_RESULT([ indicator - Indicator support])
463 fi
f0a22461
PS
464 if test x"$plugin_weather" != x; then
465 AC_MSG_RESULT([ weather - Weather conditions and forecast])
466 fi
199c3ea8
JH
467else
468echo Dynamic loader for plugins....... : disabled.
469fi
1234b94c 470
1f4bc3aa
AG
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
1234b94c 477echo
46cea569
HJYP
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
1234b94c 482