Apply patch from Debian to fix battery plugin display
[lxde/lxpanel.git] / configure.ac
1 AC_PREREQ(2.53)
2 AC_INIT(lxpanel, 0.5.6, 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 pkg_modules="gtk+-2.0 >= 2.12.0 \
26              gio-unix-2.0 \
27              gthread-2.0"
28 #             libstartup-notification-1.0"
29 PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
30 AC_SUBST(PACKAGE_CFLAGS)
31 AC_SUBST(PACKAGE_LIBS)
32
33 pkg_modules="x11"
34 PKG_CHECK_MODULES(X11, [$pkg_modules])
35 AC_SUBST(X11_LIBS)
36
37 pkg_modules="libmenu-cache"
38 PKG_CHECK_MODULES(MENU_CACHE, [$pkg_modules],
39                   enable_menu_cache=yes, enable_menu_cache=no)
40 if test x"$enable_menu_cache" = "xno"; then
41         AC_WARN([No libmenu-cache found.  All menu related routines are not built.])
42         AC_DEFINE(DISABLE_MENU, [1], [Disable menu related routines])
43 fi
44 AC_SUBST(MENU_CACHE_CFLAGS)
45 AC_SUBST(MENU_CACHE_LIBS)
46 AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
47
48 #Don't use deprecated GTK and Glib functions 
49 DISABLE_DEPRECATED_FLAGS="-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 -DGSEAL_ENABLE"
50 AC_SUBST(DISABLE_DEPRECATED_FLAGS)
51
52 PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $DISABLE_DEPRECATED_FLAGS"
53 PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
54
55 AC_ARG_ENABLE(man,
56         [AC_HELP_STRING([--enable-man],
57                 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
58         [enable_man="${enableval}"],
59         [enable_man=no]
60 )
61
62 AC_ARG_ENABLE([cast-checks],
63     AS_HELP_STRING([--enable-cast-checks],
64                [enable Glib casting checks (default: disable)]),
65                cast_checks=$enableval, cast_checks="no")
66 G_CAST_CHECKS=""
67 if test x"$cast_checks" = "xno"; then
68     G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
69 fi
70 AC_SUBST(G_CAST_CHECKS)
71
72 dnl linker tweaking
73 # The function of the link flag --as-needed is to prevent unnecesary linking.
74 # Example: A -> B -> C
75 # Normally, A would link to B and also depend on C, this is of cource
76 # unnecesary. In this situation, however we do need to link to C, so this
77 # must be done explicitly. This flag comes in handy when a library ABI
78 # is changed, minimizing the amount of recompilations needed.
79 AC_MSG_CHECKING([whether $LD accepts --as-needed])
80 case `$LD --as-needed -v 2>&1 </dev/null` in
81 *GNU* | *'with BFD'*)
82     LDFLAGS="$LDFLAGS -Wl,--as-needed"
83     AC_MSG_RESULT([yes])
84     ;;
85 *)
86     AC_MSG_RESULT([no])
87     ;;
88 esac
89
90 dnl linker optimizations
91 AC_MSG_CHECKING([whether $LD accepts -O1])
92 case `$LD -O1 -v 2>&1 </dev/null` in
93 *GNU* | *'with BFD'*)
94   LDFLAGS="$LDFLAGS -Wl,-O1"
95   AC_MSG_RESULT([yes])
96   ;;
97 *)
98   AC_MSG_RESULT([no])
99   ;;
100 esac
101 AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
102 case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
103 *GNU* | *'with BFD'*)
104   LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
105   AC_MSG_RESULT([yes])
106   ;;
107 *)
108   AC_MSG_RESULT([no])
109   ;;
110 esac
111 AC_MSG_CHECKING([whether $LD accepts --sort-common])
112 case `$LD --sort-common -v 2>&1 </dev/null` in
113 *GNU* | *'with BFD'*)
114   LDFLAGS="$LDFLAGS -Wl,--sort-common"
115   AC_MSG_RESULT([yes])
116   ;;
117 *)
118   AC_MSG_RESULT([no])
119   ;;
120 esac
121
122 dnl FIXME: filter for undefined symbols in plugins
123 # when passing "-z defs" to linker, we would better to make sure
124 # there are no undefined references.  However, we intend not to
125 # fix at the moment since we don't have spin-off libraray containing
126 # the necessary functions.
127 if test ! -z "$LDFLAGS"; then
128     LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
129 fi
130
131 LXPANEL_MODULE="-avoid-version \
132 -rpath \$(libdir)/lxpanel/plugins \
133 -no-undefined "'-export-symbols-regex "^[[^_]].*"'
134 AC_SUBST(LXPANEL_MODULE)
135
136 AC_ARG_ENABLE([alsa],
137     AS_HELP_STRING([--disable-alsa],
138                     [compile ALSA providers (default: enable)]),
139             compile_alsa=$enableval, compile_alsa="yes")
140 if test x"$compile_alsa" = "xyes"; then
141     AC_CHECK_HEADERS([alsa/asoundlib.h],
142                      [AC_CHECK_LIB([asound],
143                                    [snd_seq_open],
144                                    compile_alsa=yes,compile_alsa=no)],
145                           compile_alsa=no)
146 fi
147 AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
148 dnl FIXME: check OSS existence
149 AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
150
151 AC_ARG_ENABLE([plugins-loading],
152     AS_HELP_STRING([--disable-plugins-loading],
153                [disable plugin loading (default: enable)]),
154                plugins_loading=$enableval, plugins_loading="yes")
155
156 AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
157
158 if test x"$plugins_loading" = "xno"; then
159     AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
160 fi
161
162 dnl Here are plugin listing.
163 plugin_netstatus=
164 plugin_volume=
165 plugin_volumealsa=
166 plugin_cpu=
167 plugin_deskno=
168 plugin_batt=
169 plugin_xkb=
170 plugin_kbled=
171 plugin_thermal=
172 plugin_cpufreq=
173
174 AC_MSG_CHECKING([which plugins should be built dynamically])
175 AC_ARG_WITH(plugins,
176 [  --with-plugins=<list>  compile dynamic plugins in <list> ]
177 [                         plugins may be comma separated ]
178 [                         'all' builds all plugins (default), 'none' builds none ]
179 [                         Possible plugins are: ]
180 [                         netstatus, volume, volumealsa, cpu, deskno, batt, kbled, xkb, thermal, cpufreq], plugins="$withval",[plugins="all"])
181
182 if test x"$plugins" != xall -a x"$plugins" != xnone; then
183     if test x"$plugins_loading" = xno; then
184         AC_MSG_ERROR(
185         [--disable-plugins-loading and --with-plugins conflict each other.])
186     fi
187 fi
188
189 ALL_PLUGINS_LIST="netstatus volume volumealsa cpu deskno batt kbled xkb thermal cpufreq"
190 AC_SUBST(ALL_PLUGINS_LIST)
191
192 if test x"$plugins" = xall; then
193 dnl    for name in $ALL_PLUGINS
194 dnl    do
195 dnl        export plugin_$name="$name"
196 dnl    done
197
198     plugin_netstatus=netstatus
199     plugin_volume=volume
200     plugin_volumealsa=volumealsa
201     plugin_cpu=cpu
202     plugin_deskno=deskno
203     plugin_batt=batt
204     plugin_kbled=kbled
205     plugin_xkb=xkb
206     plugin_thermal=thermal
207     plugin_cpufreq=cpufreq
208
209     AC_MSG_RESULT(all)
210 else
211     if test "$plugins" != "none"; then
212         plugins=`echo $plugins | sed 's/,/ /g'`
213         for plugin in $plugins
214         do
215         case "$plugin" in
216             netstatus)
217                 plugin_netstatus=netstatus
218                 ;;
219             volume)
220                 plugin_volume=volume
221                 ;;
222             volumealsa)
223                 plugin_volumealsa=volumealsa
224                 ;;
225             cpu)
226                 plugin_cpu=cpu
227                 ;;
228             deskno)
229                 plugin_deskno=deskno
230                 ;;
231             batt)
232                 plugin_batt=batt
233                 ;;
234             kbled)
235                 plugin_kbled=kbled
236                 ;;
237             xkb)
238                 plugin_xkb=xkb
239                 ;;
240             thermal)
241                 plugin_thermal=thermal
242                 ;;
243             cpufreq)
244                 plugin_cpufreq=cpufreq
245                 ;;
246             *)
247                 echo "Unknown plugin $plugin."
248                 exit 1
249                 ;;
250         esac
251         done
252         AC_MSG_RESULT($plugins)
253     fi
254 fi
255
256 dnl FIXME: OSS/ALSA checking
257 if test x"$compile_alsa" = "xno"; then
258     if test ! -z $plugin_volumealsa; then
259         AC_MSG_RESULT([no ALSA headers/libraries found!])
260         plugin_volumealsa=
261     fi
262 else
263     dnl force OSS plugin to <null>
264     plugin_volume=
265 fi
266 PLUGINS_LIST="\
267     $plugin_netstatus \
268     $plugin_volume \
269     $plugin_volumealsa \
270     $plugin_cpu \
271     $plugin_deskno \
272     $plugin_batt \
273     $plugin_kbled \
274     $plugin_xkb \
275     $plugin_thermal \
276     $plugin_cpufreq"
277
278 AC_SUBST(PLUGINS_LIST)
279
280
281 # Checks for header files.
282 AC_PATH_X
283 AC_HEADER_STDC
284 AC_HEADER_SYS_WAIT
285 AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
286
287 # Checks for typedefs, structures, and compiler characteristics.
288 AC_C_CONST
289 AC_C_INLINE
290 AC_STRUCT_TM
291
292 # Checks for library functions.
293 AC_FUNC_MALLOC
294 AC_FUNC_MEMCMP
295 AC_TYPE_SIGNAL
296 AC_FUNC_STAT
297 AC_FUNC_STRFTIME
298 AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
299
300
301 GETTEXT_PACKAGE=lxpanel
302 #AM_GNU_GETTEXT([external])
303 AM_GNU_GETTEXT_VERSION(0.14.1)
304 AC_SUBST(GETTEXT_PACKAGE)
305 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
306
307 ALL_LINGUAS="af ar cs da de es et eu fa fi fr gl hu hr id it ja ko lt ml ms nb nl nn pl ps pt pt_BR ru sk sl sv tr uk ur ur_PK vi zh_CN zh_TW"
308 AM_GLIB_GNU_GETTEXT
309
310 if test x"$enable_man" = x"yes"; then
311         AC_PATH_PROG([XSLTPROC], [xsltproc])
312         if test -z "$XSLTPROC"; then
313                 enable_man=no
314         fi
315
316         dnl check for DocBook DTD and stylesheets in the local catalog.
317         JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
318                 [DocBook XML DTD V4.1.2], [], enable_man=no)
319         JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
320                 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
321 fi
322
323 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
324
325 AC_CONFIG_FILES([
326     lxpanel.pc
327     Makefile
328     src/Makefile
329     src/plugins/Makefile
330     src/plugins/netstatus/Makefile
331     src/plugins/volume/Makefile
332     src/plugins/volumealsa/Makefile
333     src/plugins/cpu/Makefile
334     src/plugins/deskno/Makefile
335     src/plugins/batt/Makefile
336     src/plugins/kbled/Makefile
337     src/plugins/xkb/Makefile
338     src/plugins/thermal/Makefile
339     src/plugins/cpufreq/Makefile
340     po/Makefile.in
341     data/Makefile
342     data/default/panels/panel
343     man/Makefile
344 ])
345 AC_OUTPUT
346
347 echo
348 echo lxpanel ......................... : Version $VERSION
349 echo
350 echo Prefix........................... : $prefix
351 if test x$plugins_loading = xyes; then
352 echo Building dynamic plugins:
353     if test x"$plugin_netstatus" != x; then
354         AC_MSG_RESULT([    netstatus - Monitor networking status])
355     fi
356     if test x"$plugin_volume" != x; then
357         AC_MSG_RESULT([    volume - Display and adjust volume of sound card for OSS])
358     fi
359     if test x"$plugin_volumealsa" != x; then
360         AC_MSG_RESULT([    volumealsa - Display and adjust volume of sound card for ALSA])
361     fi
362     if test x"$plugin_cpu" != x; then
363         AC_MSG_RESULT([    cpu - Display CPU loading])
364     fi
365     if test x"$plugin_deskno" != x; then
366         AC_MSG_RESULT([    deskno - Display desktop number])
367     fi
368     if test x"$plugin_batt" != x; then
369         AC_MSG_RESULT([    batt - Monitor battery status])
370     fi
371     if test x"$plugin_kbled" != x; then
372         AC_MSG_RESULT([    kbled - Indicator for CapsLock, NumLock, and ScrLock])
373     fi
374     if test x"$plugin_xkb" != x; then
375         AC_MSG_RESULT([    xkb - Keyboard layout switcher])
376     fi
377     if test x"$plugin_thermal" != x; then
378         AC_MSG_RESULT([    thermal - Temperature monitor])
379     fi
380     if test x"$plugin_cpufreq" != x; then
381         AC_MSG_RESULT([    cpufreq - CpuFreq frontend])
382     fi
383 else
384 echo Dynamic loader for plugins....... : disabled.
385 fi
386
387 echo
388 echo 'LXPanel requires menu-cache and lxmenu-data packages since'
389 echo 'version 0.4.0. Please make sure they are correctly installed.'
390 echo 'Otherwise, you will not be able to use applications menu.'
391 echo
392