linking with new glib - ID: 3528633
[lxde/lxpanel.git] / configure.ac
1 AC_PREREQ(2.53)
2 AC_INIT(lxpanel, 0.5.10, http://lxde.org/)
3 AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign])
4 AC_CONFIG_HEADER([config.h])
5
6 # Support silent build rules. Disable by either passing --disable-silent-rules
7 # to configure or passing V=1 to make
8 AM_SILENT_RULES([yes])
9
10 # Force to dynamic
11 AC_DISABLE_STATIC
12
13 # Checks for programs.
14 AC_PROG_CC
15 AC_PROG_INSTALL
16 AC_PROG_LN_S
17 AC_PROG_INTLTOOL(, [no-xml])
18 AM_PROG_CC_C_O
19
20 #Initialize libtool
21 LT_PREREQ([2.2])
22 LT_INIT
23
24 # Checks for libraries.
25 AC_ARG_ENABLE(gtk3,
26 AC_HELP_STRING([--enable-gtk3],[enable to use gtk-3.0 instead of gtk-2.0]),
27 [case "${enableval}" in
28   yes)  enable_gtk3=yes ;;
29   no)   enable_gtk3=no ;;
30   *) AC_MSG_ERROR([bad value "${enableval}" for --enable-gtk3, use "yes" (default) or "no".]) ;;
31 esac],[])
32
33 if test "x$enable_gtk3" = "xyes" ; then
34   CFLAGS="$CFLAGS -DENABLE_GTK3"
35   pkg_modules="$pkg_modules gtk+-3.0"
36 else
37   pkg_modules="$pkg_modules gtk+-2.0 >= 2.12.0"
38 fi
39
40 pkg_modules="$pkg_modules \
41              gio-unix-2.0 \
42              gthread-2.0 \
43              gmodule-2.0 \
44              libmenu-cache"
45 #             libstartup-notification-1.0"
46 PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
47 AC_SUBST(PACKAGE_CFLAGS)
48 AC_SUBST(PACKAGE_LIBS)
49
50 ###########################
51 # Indicator Info
52 ###########################
53 AC_ARG_ENABLE([indicator_support],
54     AS_HELP_STRING([--enable-indicator-support],
55                [enable plugin loading (default: disable)]),
56                indicator_support=$enableval, indicator_support="no")
57 AM_CONDITIONAL(ENABLE_INDICATOR_SUPPORT, test x"$indicator_support" = x"yes")
58
59 if 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`
72 fi
73         AC_SUBST(INDICATORDIR)
74         AC_SUBST(INDICATORICONSDIR)
75 fi
76
77
78 pkg_modules="x11"
79 PKG_CHECK_MODULES(X11, [$pkg_modules])
80 AC_SUBST(X11_LIBS)
81
82 pkg_modules="libwnck-1.0"
83 PKG_CHECK_MODULES(WNCK, [$pkg_modules])
84 AC_SUBST(WNCK_CFLAGS)
85 AC_SUBST(WNCK_LIBS)
86
87 pkg_modules="libmenu-cache"
88 PKG_CHECK_MODULES(MENU_CACHE, [$pkg_modules],
89                   enable_menu_cache=yes, enable_menu_cache=no)
90 if test x"$enable_menu_cache" = "xno"; then
91         AC_WARN([No libmenu-cache found.  All menu related routines are not built.])
92         AC_DEFINE(DISABLE_MENU, [1], [Disable menu related routines])
93 fi
94 AC_SUBST(MENU_CACHE_CFLAGS)
95 AC_SUBST(MENU_CACHE_LIBS)
96 AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
97
98 AC_ARG_ENABLE(more_warnings,
99        [AC_HELP_STRING([--enable-more-warnings],
100                [Add more warnings @<:@default=no@:>@])],
101        [enable_more_warnings="${enableval}"],
102        [enable_more_warnings=no]
103 )
104
105 if test x"$enable_more_warnings" = x"yes"; then
106   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"
107 fi
108 AC_SUBST(ADDITIONAL_FLAGS)
109
110 PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
111 PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
112
113 AC_ARG_ENABLE(man,
114         [AC_HELP_STRING([--enable-man],
115                 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
116         [enable_man="${enableval}"],
117         [enable_man=no]
118 )
119
120 AC_ARG_ENABLE([cast-checks],
121     AS_HELP_STRING([--enable-cast-checks],
122                [enable Glib casting checks (default: disable)]),
123                cast_checks=$enableval, cast_checks="no")
124 G_CAST_CHECKS=""
125 if test x"$cast_checks" = "xno"; then
126     G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
127 fi
128 AC_SUBST(G_CAST_CHECKS)
129
130 dnl linker tweaking
131 # The function of the link flag --as-needed is to prevent unnecesary linking.
132 # Example: A -> B -> C
133 # Normally, A would link to B and also depend on C, this is of cource
134 # unnecesary. In this situation, however we do need to link to C, so this
135 # must be done explicitly. This flag comes in handy when a library ABI
136 # is changed, minimizing the amount of recompilations needed.
137 AC_MSG_CHECKING([whether $LD accepts --as-needed])
138 case `$LD --as-needed -v 2>&1 </dev/null` in
139 *GNU* | *'with BFD'*)
140     LDFLAGS="$LDFLAGS -Wl,--as-needed"
141     AC_MSG_RESULT([yes])
142     ;;
143 *)
144     AC_MSG_RESULT([no])
145     ;;
146 esac
147
148 dnl linker optimizations
149 AC_MSG_CHECKING([whether $LD accepts -O1])
150 case `$LD -O1 -v 2>&1 </dev/null` in
151 *GNU* | *'with BFD'*)
152   LDFLAGS="$LDFLAGS -Wl,-O1"
153   AC_MSG_RESULT([yes])
154   ;;
155 *)
156   AC_MSG_RESULT([no])
157   ;;
158 esac
159 AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
160 case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
161 *GNU* | *'with BFD'*)
162   LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
163   AC_MSG_RESULT([yes])
164   ;;
165 *)
166   AC_MSG_RESULT([no])
167   ;;
168 esac
169 AC_MSG_CHECKING([whether $LD accepts --sort-common])
170 case `$LD --sort-common -v 2>&1 </dev/null` in
171 *GNU* | *'with BFD'*)
172   LDFLAGS="$LDFLAGS -Wl,--sort-common"
173   AC_MSG_RESULT([yes])
174   ;;
175 *)
176   AC_MSG_RESULT([no])
177   ;;
178 esac
179
180 dnl FIXME: filter for undefined symbols in plugins
181 # when passing "-z defs" to linker, we would better to make sure
182 # there are no undefined references.  However, we intend not to
183 # fix at the moment since we don't have spin-off libraray containing
184 # the necessary functions.
185 if test ! -z "$LDFLAGS"; then
186     LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
187 fi
188
189 LXPANEL_MODULE="-avoid-version \
190 -rpath \$(libdir)/lxpanel/plugins \
191 -no-undefined "'-export-symbols-regex "^[[^_]].*"'
192 AC_SUBST(LXPANEL_MODULE)
193
194 AC_ARG_ENABLE([alsa],
195     AS_HELP_STRING([--disable-alsa],
196                     [compile ALSA providers (default: enable)]),
197             compile_alsa=$enableval, compile_alsa="yes")
198 if test x"$compile_alsa" = "xyes"; then
199     AC_CHECK_HEADERS([alsa/asoundlib.h],
200                      [AC_CHECK_LIB([asound],
201                                    [snd_seq_open],
202                                    compile_alsa=yes,compile_alsa=no)],
203                           compile_alsa=no)
204 fi
205 AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
206 dnl FIXME: check OSS existence
207 AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
208
209 AC_ARG_ENABLE([plugins-loading],
210     AS_HELP_STRING([--disable-plugins-loading],
211                [disable plugin loading (default: enable)]),
212                plugins_loading=$enableval, plugins_loading="yes")
213
214 AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
215
216 if test x"$plugins_loading" = "xno"; then
217     AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
218 fi
219
220 dnl Here are plugin listing.
221 plugin_netstatus=
222 plugin_netstat=
223 plugin_volume=
224 plugin_volumealsa=
225 plugin_cpu=
226 plugin_deskno=
227 plugin_batt=
228 plugin_xkb=
229 plugin_kbled=
230 plugin_thermal=
231 plugin_cpufreq=
232 plugin_monitors=
233 plugin_wnckpager=
234 plugin_indicator=
235
236 AC_MSG_CHECKING([which plugins should be built dynamically])
237 AC_ARG_WITH(plugins,
238 [  --with-plugins=<list>  compile dynamic plugins in <list> ]
239 [                         plugins may be comma separated ]
240 [                         'all' builds all plugins (default), 'none' builds none ]
241 [                         Possible plugins are: ]
242 [                         netstatus, netstat, volume, volumealsa, cpu, deskno, batt, kbled, xkb, thermal, cpufreq, monitors, wnckpager], plugins="$withval",[plugins="all"])
243
244 if test x"$plugins" != xall -a x"$plugins" != xnone; then
245     if test x"$plugins_loading" = xno; then
246         AC_MSG_ERROR(
247         [--disable-plugins-loading and --with-plugins conflict each other.])
248     fi
249 fi
250
251 ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors wnckpager indicator"
252 AC_SUBST(ALL_PLUGINS_LIST)
253
254 if test x"$plugins" = xall; then
255 dnl    for name in $ALL_PLUGINS
256 dnl    do
257 dnl        export plugin_$name="$name"
258 dnl    done
259
260     plugin_netstatus=netstatus
261     plugin_netstat=netstat
262     plugin_volume=volume
263     plugin_volumealsa=volumealsa
264     plugin_cpu=cpu
265     plugin_deskno=deskno
266     plugin_batt=batt
267     plugin_kbled=kbled
268     plugin_xkb=xkb
269     plugin_thermal=thermal
270     plugin_cpufreq=cpufreq
271     plugin_monitors=monitors
272     plugin_wnckpager=wnckpager
273     plugin_indicator=indicator
274
275     AC_MSG_RESULT(all)
276 else
277     if test "$plugins" != "none"; then
278         plugins=`echo $plugins | sed 's/,/ /g'`
279         for plugin in $plugins
280         do
281         case "$plugin" in
282             netstatus)
283                 plugin_netstatus=netstatus
284                 ;;
285             netstat)
286                 plugin_netstat=netstat
287                 ;;
288             volume)
289                 plugin_volume=volume
290                 ;;
291             volumealsa)
292                 plugin_volumealsa=volumealsa
293                 ;;
294             cpu)
295                 plugin_cpu=cpu
296                 ;;
297             deskno)
298                 plugin_deskno=deskno
299                 ;;
300             batt)
301                 plugin_batt=batt
302                 ;;
303             kbled)
304                 plugin_kbled=kbled
305                 ;;
306             xkb)
307                 plugin_xkb=xkb
308                 ;;
309             thermal)
310                 plugin_thermal=thermal
311                 ;;
312             cpufreq)
313                 plugin_cpufreq=cpufreq
314                 ;;
315             monitors)
316                 plugin_monitors=monitors
317                 ;;
318             wnckpager)
319                 plugin_wnckpager=wnckpager
320                 ;;
321             indicator)
322                 plugin_indicator=indicator
323                 ;;
324             *)
325                 echo "Unknown plugin $plugin."
326                 exit 1
327                 ;;
328         esac
329         done
330         AC_MSG_RESULT($plugins)
331     fi
332 fi
333
334 dnl FIXME: OSS/ALSA checking
335 if test x"$compile_alsa" = "xno"; then
336     if test ! -z $plugin_volumealsa; then
337         AC_MSG_RESULT([no ALSA headers/libraries found!])
338         plugin_volumealsa=
339     fi
340 else
341     dnl force OSS plugin to <null>
342     plugin_volume=
343 fi
344
345 dnl Exclude indicator support when there is no support.
346 if test x"$indicator_support" = "xno"; then
347     plugin_indicator=
348 fi
349
350 PLUGINS_LIST="\
351     $plugin_netstatus \
352     $plugin_netstat \
353     $plugin_volume \
354     $plugin_volumealsa \
355     $plugin_cpu \
356     $plugin_deskno \
357     $plugin_batt \
358     $plugin_kbled \
359     $plugin_xkb \
360     $plugin_thermal \
361     $plugin_cpufreq \
362     $plugin_monitors \
363     $plugin_wnckpager\
364     $plugin_indicator"
365
366 AC_SUBST(PLUGINS_LIST)
367
368 # Plugin-specific dependencies
369 # nestat
370 if test x"$plugin_netstat" != "x";then
371 AC_CHECK_HEADER([iwlib.h],,
372  AC_MSG_ERROR([netstat plugin requires wireless-tools-devel]))
373 fi
374
375 # Checks for header files.
376 AC_PATH_X
377 AC_HEADER_STDC
378 AC_HEADER_SYS_WAIT
379 AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
380
381 # Checks for typedefs, structures, and compiler characteristics.
382 AC_C_CONST
383 AC_C_INLINE
384 AC_STRUCT_TM
385
386 # Checks for library functions.
387 AC_FUNC_MALLOC
388 AC_FUNC_MEMCMP
389 AC_TYPE_SIGNAL
390 AC_FUNC_STAT
391 AC_FUNC_STRFTIME
392 AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
393
394
395 # Generate po/LINGUAS on the fly rather than relying on translators
396 # to maintain it manually. This also overcome the problem that Transifex
397 # cannot add a language to po/LINGUAS if a new po file is submitted.
398 rm -f $srcdir/po/LINGUAS
399 for po_file in `ls $srcdir/po/*.po | sort`;
400 do
401     lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
402     echo $lang >> $srcdir/po/LINGUAS
403 done
404
405 GETTEXT_PACKAGE=lxpanel
406 #AM_GNU_GETTEXT([external])
407 AM_GNU_GETTEXT_VERSION(0.14.1)
408 AC_SUBST(GETTEXT_PACKAGE)
409 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
410
411 AM_GLIB_GNU_GETTEXT
412
413 if test x"$enable_man" = x"yes"; then
414         AC_PATH_PROG([XSLTPROC], [xsltproc])
415         if test -z "$XSLTPROC"; then
416                 enable_man=no
417         fi
418
419         dnl check for DocBook DTD and stylesheets in the local catalog.
420         JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
421                 [DocBook XML DTD V4.1.2], [], enable_man=no)
422         JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
423                 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
424 fi
425
426 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
427
428 AC_CONFIG_FILES([
429     lxpanel.pc
430     Makefile
431     src/Makefile
432     src/plugins/Makefile
433     src/plugins/netstatus/Makefile
434     src/plugins/netstat/Makefile
435     src/plugins/volume/Makefile
436     src/plugins/volumealsa/Makefile
437     src/plugins/cpu/Makefile
438     src/plugins/deskno/Makefile
439     src/plugins/batt/Makefile
440     src/plugins/kbled/Makefile
441     src/plugins/xkb/Makefile
442     src/plugins/thermal/Makefile
443     src/plugins/cpufreq/Makefile
444     src/plugins/monitors/Makefile
445     src/plugins/wnckpager/Makefile
446     src/plugins/indicator/Makefile
447     po/Makefile.in
448     data/Makefile
449     data/default/panels/panel
450     data/two_panels/panels/top
451     data/two_panels/panels/bottom
452     man/Makefile
453 ])
454 AC_OUTPUT
455
456 echo
457 echo lxpanel ......................... : Version $VERSION
458 echo
459 echo Prefix........................... : $prefix
460 if test x$plugins_loading = xyes; then
461 echo Building dynamic plugins:
462     if test x"$plugin_netstatus" != x; then
463         AC_MSG_RESULT([    netstatus - Monitor networking status])
464     fi
465     if test x"$plugin_netstat" != x; then
466         AC_MSG_RESULT([    netstat - Monitor networking status])
467     fi
468     if test x"$plugin_volume" != x; then
469         AC_MSG_RESULT([    volume - Display and adjust volume of sound card for OSS])
470     fi
471     if test x"$plugin_volumealsa" != x; then
472         AC_MSG_RESULT([    volumealsa - Display and adjust volume of sound card for ALSA])
473     fi
474     if test x"$plugin_cpu" != x; then
475         AC_MSG_RESULT([    cpu - Display CPU loading])
476     fi
477     if test x"$plugin_deskno" != x; then
478         AC_MSG_RESULT([    deskno - Display desktop number])
479     fi
480     if test x"$plugin_batt" != x; then
481         AC_MSG_RESULT([    batt - Monitor battery status])
482     fi
483     if test x"$plugin_kbled" != x; then
484         AC_MSG_RESULT([    kbled - Indicator for CapsLock, NumLock, and ScrLock])
485     fi
486     if test x"$plugin_xkb" != x; then
487         AC_MSG_RESULT([    xkb - Keyboard layout switcher])
488     fi
489     if test x"$plugin_thermal" != x; then
490         AC_MSG_RESULT([    thermal - Temperature monitor])
491     fi
492     if test x"$plugin_cpufreq" != x; then
493         AC_MSG_RESULT([    cpufreq - CpuFreq frontend])
494     fi
495     if test x"$plugin_monitors" != x; then
496         AC_MSG_RESULT([    monitors - Monitors for CPU & RAM])
497     fi
498     if test x"$plugin_wnckpager" != x; then
499         AC_MSG_RESULT([    wnckpager - Pager which support openbox and compiz])
500     fi
501     if test x"$plugin_indicator" != x; then
502         AC_MSG_RESULT([    indicator - Indicator support])
503     fi
504 else
505 echo Dynamic loader for plugins....... : disabled.
506 fi
507
508 echo
509 echo 'LXPanel requires menu-cache and lxmenu-data packages since'
510 echo 'version 0.4.0. Please make sure they are correctly installed.'
511 echo 'Otherwise, you will not be able to use applications menu.'
512 echo
513