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