Don't include intltool-*.in files, they aren't required.
[lxde/lxpanel.git] / configure.ac
CommitLineData
a52c2257 1AC_PREREQ(2.53)
7a5d57c2 2AC_INIT(lxpanel, 0.7.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
18AC_PROG_INTLTOOL(, [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.
bf2b2430
AF
27AC_ARG_ENABLE(gtk3,
28AC_HELP_STRING([--enable-gtk3],[enable to use gtk-3.0 instead of gtk-2.0]),
29[case "${enableval}" in
30 yes) enable_gtk3=yes ;;
31 no) enable_gtk3=no ;;
32 *) AC_MSG_ERROR([bad value "${enableval}" for --enable-gtk3, use "yes" (default) or "no".]) ;;
33esac],[])
34
35if test "x$enable_gtk3" = "xyes" ; then
36 CFLAGS="$CFLAGS -DENABLE_GTK3"
697e84f4 37 pkg_modules="$pkg_modules gtk+-3.0 libfm-gtk3 >= 1.2.0 libwnck-3.0"
bf2b2430 38else
09fa171b 39 pkg_modules="$pkg_modules gtk+-2.0 >= 2.18.0 libfm-gtk >= 1.2.0 libwnck-1.0"
bf2b2430
AF
40fi
41
42pkg_modules="$pkg_modules \
1d434622 43 gio-unix-2.0 \
c4ff9fd2 44 gthread-2.0 \
688d30f0 45 gmodule-2.0"
a52c2257
HJYP
46PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
47AC_SUBST(PACKAGE_CFLAGS)
48AC_SUBST(PACKAGE_LIBS)
49
9dda8252
JL
50###########################
51# Indicator Info
52###########################
53AC_ARG_ENABLE([indicator_support],
54 AS_HELP_STRING([--enable-indicator-support],
55 [enable plugin loading (default: disable)]),
56 indicator_support=$enableval, indicator_support="no")
57AM_CONDITIONAL(ENABLE_INDICATOR_SUPPORT, test x"$indicator_support" = x"yes")
58
59if test "$indicator_support" != "no"; then
60 INDICATOR_REQUIRED_VERSION=0.3.0
61 INDICATOR_PKG_NAME=indicator-0.4
62
63 PKG_CHECK_MODULES(APPLET, $INDICATOR_PKG_NAME >= $INDICATOR_REQUIRED_VERSION)
64 AC_SUBST(APPLET_CFLAGS)
65
66 if test "x$with_localinstall" = "xyes"; then
67 INDICATORDIR="${libdir}/indicators/2/"
68 INDICATORICONSDIR="${datadir}/indicator-applet/icons/"
69 else
70 INDICATORDIR=`$PKG_CONFIG --variable=indicatordir $INDICATOR_PKG_NAME`
71 INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir $INDICATOR_PKG_NAME`
72fi
73 AC_SUBST(INDICATORDIR)
74 AC_SUBST(INDICATORICONSDIR)
75fi
76
77
9bf13ef5
MTW
78pkg_modules="x11"
79PKG_CHECK_MODULES(X11, [$pkg_modules])
80AC_SUBST(X11_LIBS)
81
ace2a572
JH
82pkg_modules="libmenu-cache"
83PKG_CHECK_MODULES(MENU_CACHE, [$pkg_modules],
84 enable_menu_cache=yes, enable_menu_cache=no)
85if test x"$enable_menu_cache" = "xno"; then
86 AC_WARN([No libmenu-cache found. All menu related routines are not built.])
87 AC_DEFINE(DISABLE_MENU, [1], [Disable menu related routines])
88fi
89AC_SUBST(MENU_CACHE_CFLAGS)
90AC_SUBST(MENU_CACHE_LIBS)
ade9c95c 91AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
ace2a572 92
77f69cbd
JL
93AC_ARG_ENABLE(more_warnings,
94 [AC_HELP_STRING([--enable-more-warnings],
95 [Add more warnings @<:@default=no@:>@])],
96 [enable_more_warnings="${enableval}"],
97 [enable_more_warnings=no]
98)
99
100if test x"$enable_more_warnings" = x"yes"; then
101 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"
102fi
103AC_SUBST(ADDITIONAL_FLAGS)
ade9c95c 104
77f69cbd 105PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
ace2a572
JH
106PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
107
40189d64
JH
108AC_ARG_ENABLE(man,
109 [AC_HELP_STRING([--enable-man],
110 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
111 [enable_man="${enableval}"],
112 [enable_man=no]
113)
114
cc0c9990
JH
115dnl linker tweaking
116# The function of the link flag --as-needed is to prevent unnecesary linking.
117# Example: A -> B -> C
20b3e401
JH
118# Normally, A would link to B and also depend on C, this is of cource
119# unnecesary. In this situation, however we do need to link to C, so this
cc0c9990
JH
120# must be done explicitly. This flag comes in handy when a library ABI
121# is changed, minimizing the amount of recompilations needed.
122AC_MSG_CHECKING([whether $LD accepts --as-needed])
123case `$LD --as-needed -v 2>&1 </dev/null` in
124*GNU* | *'with BFD'*)
20b3e401
JH
125 LDFLAGS="$LDFLAGS -Wl,--as-needed"
126 AC_MSG_RESULT([yes])
127 ;;
cc0c9990 128*)
20b3e401
JH
129 AC_MSG_RESULT([no])
130 ;;
cc0c9990
JH
131esac
132
cae18977
JH
133dnl linker optimizations
134AC_MSG_CHECKING([whether $LD accepts -O1])
135case `$LD -O1 -v 2>&1 </dev/null` in
136*GNU* | *'with BFD'*)
137 LDFLAGS="$LDFLAGS -Wl,-O1"
138 AC_MSG_RESULT([yes])
139 ;;
140*)
141 AC_MSG_RESULT([no])
142 ;;
143esac
144AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
145case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
146*GNU* | *'with BFD'*)
147 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
148 AC_MSG_RESULT([yes])
149 ;;
7e20ea34 150*)
cae18977
JH
151 AC_MSG_RESULT([no])
152 ;;
153esac
85026f6c
JH
154AC_MSG_CHECKING([whether $LD accepts --sort-common])
155case `$LD --sort-common -v 2>&1 </dev/null` in
7e20ea34 156*GNU* | *'with BFD'*)
85026f6c
JH
157 LDFLAGS="$LDFLAGS -Wl,--sort-common"
158 AC_MSG_RESULT([yes])
159 ;;
160*)
161 AC_MSG_RESULT([no])
162 ;;
163esac
cae18977 164
cc0c9990
JH
165dnl FIXME: filter for undefined symbols in plugins
166# when passing "-z defs" to linker, we would better to make sure
167# there are no undefined references. However, we intend not to
168# fix at the moment since we don't have spin-off libraray containing
169# the necessary functions.
170if test ! -z "$LDFLAGS"; then
20b3e401 171 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
cc0c9990
JH
172fi
173
174LXPANEL_MODULE="-avoid-version \
175-rpath \$(libdir)/lxpanel/plugins \
176-no-undefined "'-export-symbols-regex "^[[^_]].*"'
177AC_SUBST(LXPANEL_MODULE)
178
c044bccf 179AC_ARG_ENABLE([alsa],
24053345
HJYP
180 AS_HELP_STRING([--disable-alsa],
181 [compile ALSA providers (default: enable)]),
182 compile_alsa=$enableval, compile_alsa="yes")
c044bccf 183if test x"$compile_alsa" = "xyes"; then
24053345
HJYP
184 AC_CHECK_HEADERS([alsa/asoundlib.h],
185 [AC_CHECK_LIB([asound],
186 [snd_seq_open],
187 compile_alsa=yes,compile_alsa=no)],
c044bccf
JH
188 compile_alsa=no)
189fi
190AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
191dnl FIXME: check OSS existence
192AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
193
2d29cc96 194AC_ARG_ENABLE([plugins-loading],
24053345
HJYP
195 AS_HELP_STRING([--disable-plugins-loading],
196 [disable plugin loading (default: enable)]),
197 plugins_loading=$enableval, plugins_loading="yes")
2d29cc96 198
31b80004
JH
199AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
200
535ac098 201if test x"$plugins_loading" = "xno"; then
24053345 202 AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
2d29cc96
JH
203fi
204
199c3ea8
JH
205dnl Here are plugin listing.
206plugin_netstatus=
65efa143 207plugin_netstat=
199c3ea8 208plugin_volume=
15556f61 209plugin_volumealsa=
199c3ea8 210plugin_cpu=
ce728cd9 211plugin_deskno=
8f11d5f8 212plugin_batt=
22242ed4 213plugin_xkb=
7e20ea34 214plugin_kbled=
09f498a1 215plugin_thermal=
c03f7bd0 216plugin_cpufreq=
9770479a 217plugin_monitors=
9dda8252 218plugin_indicator=
199c3ea8
JH
219
220AC_MSG_CHECKING([which plugins should be built dynamically])
221AC_ARG_WITH(plugins,
222[ --with-plugins=<list> compile dynamic plugins in <list> ]
223[ plugins may be comma separated ]
224[ 'all' builds all plugins (default), 'none' builds none ]
3a604782 225[ plugins prefixed with '-' are not built]
199c3ea8 226[ Possible plugins are: ]
3a604782 227[ netstatus, netstat, volume, volumealsa, cpu, deskno, batt,]
6d51da94 228[ kbled, xkb, thermal, cpufreq, monitors, weather]
3a604782 229, plugins="$withval",[plugins="all"])
199c3ea8
JH
230
231if test x"$plugins" != xall -a x"$plugins" != xnone; then
24053345
HJYP
232 if test x"$plugins_loading" = xno; then
233 AC_MSG_ERROR(
234 [--disable-plugins-loading and --with-plugins conflict each other.])
235 fi
199c3ea8
JH
236fi
237
6d51da94 238ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors indicator weather"
24053345
HJYP
239AC_SUBST(ALL_PLUGINS_LIST)
240
3a604782
HG
241AC_DEFUN([check_plugin_name],[
242 plugin_found=false
243 for name in $ALL_PLUGINS_LIST; do
244 if test x[$1] = x[$name]; then
245 plugin_found=true
246 fi
247 done
248 if test x[$plugin_found] = false; then
249 echo [Unknown plugin $1.]
250 exit 1
251 fi
252])
253
254if test "$plugins" != "none"; then
255 plugins=`echo $plugins | sed 's/,/ /g'`
256 for plugin in $plugins
257 do
24053345 258 case "$plugin" in
3a604782
HG
259 all)
260 for name in $ALL_PLUGINS_LIST
261 do
6dbdce2b 262 export plugin_$name="$name.la"
3a604782 263 done
24053345 264 ;;
3a604782
HG
265 -*)
266 check_plugin_name([${plugin#-}])
267 export plugin_${plugin#-}=
9dda8252 268 ;;
24053345 269 *)
3a604782 270 check_plugin_name([$plugin])
6dbdce2b 271 export plugin_$plugin=$plugin.la
24053345
HJYP
272 ;;
273 esac
3a604782
HG
274 done
275 AC_MSG_RESULT($plugins)
199c3ea8
JH
276fi
277
c044bccf
JH
278dnl FIXME: OSS/ALSA checking
279if test x"$compile_alsa" = "xno"; then
24053345
HJYP
280 if test ! -z $plugin_volumealsa; then
281 AC_MSG_RESULT([no ALSA headers/libraries found!])
282 plugin_volumealsa=
283 fi
c044bccf 284else
24053345
HJYP
285 dnl force OSS plugin to <null>
286 plugin_volume=
c044bccf 287fi
9dda8252
JL
288
289dnl Exclude indicator support when there is no support.
290if test x"$indicator_support" = "xno"; then
291 plugin_indicator=
292fi
293
22242ed4 294PLUGINS_LIST="\
7e20ea34 295 $plugin_netstatus \
65efa143 296 $plugin_netstat \
7e20ea34
HJYP
297 $plugin_volume \
298 $plugin_volumealsa \
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
00118bd4 363AM_GNU_GETTEXT([external])
a52c2257
HJYP
364AM_GNU_GETTEXT_VERSION(0.14.1)
365AC_SUBST(GETTEXT_PACKAGE)
366AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
367
a52c2257
HJYP
368AM_GLIB_GNU_GETTEXT
369
40189d64
JH
370if test x"$enable_man" = x"yes"; then
371 AC_PATH_PROG([XSLTPROC], [xsltproc])
372 if test -z "$XSLTPROC"; then
373 enable_man=no
374 fi
375
376 dnl check for DocBook DTD and stylesheets in the local catalog.
377 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
378 [DocBook XML DTD V4.1.2], [], enable_man=no)
379 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
380 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
381fi
382
383AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
384
b366baa2
AG
385AC_ARG_ENABLE(debug,
386 [AC_HELP_STRING([--enable-debug],
387 [enable debug support @<:@default=no@:>@])],
388 [enable_debug="${enableval}"],
389 [enable_debug=no]
390)
391if test "$enable_debug" = "yes"; then
392 # turn on debug and disable optimization
393 CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
394 case "$CC" in
395 gcc*)
396 CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration"
397 ;;
398 *)
399 ;;
400 esac
401 dnl Be more strict on portability
402 #CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
403else
404 # turn off glib debug checks
405 CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
406fi
407
1f4bc3aa
AG
408dnl Fix invalid sysconfdir when --prefix=/usr
409if test `eval "echo $sysconfdir"` = /usr/etc
410then
411 sysconfdir=/etc
412fi
413
a52c2257 414AC_CONFIG_FILES([
f5c43b11 415 lxpanel.pc
24053345
HJYP
416 Makefile
417 src/Makefile
d609cab0 418 plugins/Makefile
24053345
HJYP
419 po/Makefile.in
420 data/Makefile
cf701cb7 421 data/default/panels/panel
65efa143
JL
422 data/two_panels/panels/top
423 data/two_panels/panels/bottom
70344206 424 man/Makefile
a52c2257
HJYP
425])
426AC_OUTPUT
199c3ea8 427
24053345 428echo
ce728cd9 429echo lxpanel ......................... : Version $VERSION
199c3ea8
JH
430echo
431echo Prefix........................... : $prefix
1f4bc3aa
AG
432echo System config directory.......... : `eval "echo $sysconfdir"`
433echo
434
199c3ea8
JH
435if test x$plugins_loading = xyes; then
436echo Building dynamic plugins:
24053345
HJYP
437 if test x"$plugin_netstatus" != x; then
438 AC_MSG_RESULT([ netstatus - Monitor networking status])
439 fi
65efa143
JL
440 if test x"$plugin_netstat" != x; then
441 AC_MSG_RESULT([ netstat - Monitor networking status])
442 fi
24053345 443 if test x"$plugin_volume" != x; then
8f9e6256 444 AC_MSG_RESULT([ volume - Display and adjust volume of sound card for OSS])
24053345
HJYP
445 fi
446 if test x"$plugin_volumealsa" != x; then
447 AC_MSG_RESULT([ volumealsa - Display and adjust volume of sound card for ALSA])
448 fi
449 if test x"$plugin_cpu" != x; then
450 AC_MSG_RESULT([ cpu - Display CPU loading])
451 fi
452 if test x"$plugin_deskno" != x; then
453 AC_MSG_RESULT([ deskno - Display desktop number])
454 fi
455 if test x"$plugin_batt" != x; then
456 AC_MSG_RESULT([ batt - Monitor battery status])
457 fi
7e20ea34
HJYP
458 if test x"$plugin_kbled" != x; then
459 AC_MSG_RESULT([ kbled - Indicator for CapsLock, NumLock, and ScrLock])
460 fi
22242ed4 461 if test x"$plugin_xkb" != x; then
fc26a89e 462 AC_MSG_RESULT([ xkb - Keyboard layout handler])
22242ed4 463 fi
62550cea
FC
464 if test x"$plugin_thermal" != x; then
465 AC_MSG_RESULT([ thermal - Temperature monitor])
466 fi
c03f7bd0
DK
467 if test x"$plugin_cpufreq" != x; then
468 AC_MSG_RESULT([ cpufreq - CpuFreq frontend])
469 fi
9770479a
JL
470 if test x"$plugin_monitors" != x; then
471 AC_MSG_RESULT([ monitors - Monitors for CPU & RAM])
472 fi
9dda8252
JL
473 if test x"$plugin_indicator" != x; then
474 AC_MSG_RESULT([ indicator - Indicator support])
475 fi
f0a22461
PS
476 if test x"$plugin_weather" != x; then
477 AC_MSG_RESULT([ weather - Weather conditions and forecast])
478 fi
199c3ea8
JH
479else
480echo Dynamic loader for plugins....... : disabled.
481fi
1234b94c 482
1f4bc3aa
AG
483if test x"$sysconfdir" != x'/etc'; then
484 echo
485 echo 'Warning: sysconfdir is not /etc. It might be not what you want.'
486 echo 'Please consider passing --sysconfdir=/etc to configure.'
487fi
488
1234b94c 489echo
46cea569
HJYP
490echo 'LXPanel requires menu-cache and lxmenu-data packages since'
491echo 'version 0.4.0. Please make sure they are correctly installed.'
492echo 'Otherwise, you will not be able to use applications menu.'
493echo
1234b94c 494