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