Add libmenu-cache to the packages modules in configure.ac, needed by launchbar.c
[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
198 AC_MSG_CHECKING([which plugins should be built dynamically])
199 AC_ARG_WITH(plugins,
200 [  --with-plugins=<list>  compile dynamic plugins in <list> ]
201 [                         plugins may be comma separated ]
202 [                         'all' builds all plugins (default), 'none' builds none ]
203 [                         Possible plugins are: ]
204 [                         netstatus, volume, volumealsa, cpu, deskno, batt, kbled, xkb, thermal, cpufreq], plugins="$withval",[plugins="all"])
205
206 if test x"$plugins" != xall -a x"$plugins" != xnone; then
207     if test x"$plugins_loading" = xno; then
208         AC_MSG_ERROR(
209         [--disable-plugins-loading and --with-plugins conflict each other.])
210     fi
211 fi
212
213 ALL_PLUGINS_LIST="netstatus volume volumealsa cpu deskno batt kbled xkb thermal cpufreq"
214 AC_SUBST(ALL_PLUGINS_LIST)
215
216 if test x"$plugins" = xall; then
217 dnl    for name in $ALL_PLUGINS
218 dnl    do
219 dnl        export plugin_$name="$name"
220 dnl    done
221
222     plugin_netstatus=netstatus
223     plugin_volume=volume
224     plugin_volumealsa=volumealsa
225     plugin_cpu=cpu
226     plugin_deskno=deskno
227     plugin_batt=batt
228     plugin_kbled=kbled
229     plugin_xkb=xkb
230     plugin_thermal=thermal
231     plugin_cpufreq=cpufreq
232
233     AC_MSG_RESULT(all)
234 else
235     if test "$plugins" != "none"; then
236         plugins=`echo $plugins | sed 's/,/ /g'`
237         for plugin in $plugins
238         do
239         case "$plugin" in
240             netstatus)
241                 plugin_netstatus=netstatus
242                 ;;
243             volume)
244                 plugin_volume=volume
245                 ;;
246             volumealsa)
247                 plugin_volumealsa=volumealsa
248                 ;;
249             cpu)
250                 plugin_cpu=cpu
251                 ;;
252             deskno)
253                 plugin_deskno=deskno
254                 ;;
255             batt)
256                 plugin_batt=batt
257                 ;;
258             kbled)
259                 plugin_kbled=kbled
260                 ;;
261             xkb)
262                 plugin_xkb=xkb
263                 ;;
264             thermal)
265                 plugin_thermal=thermal
266                 ;;
267             cpufreq)
268                 plugin_cpufreq=cpufreq
269                 ;;
270             *)
271                 echo "Unknown plugin $plugin."
272                 exit 1
273                 ;;
274         esac
275         done
276         AC_MSG_RESULT($plugins)
277     fi
278 fi
279
280 dnl FIXME: OSS/ALSA checking
281 if test x"$compile_alsa" = "xno"; then
282     if test ! -z $plugin_volumealsa; then
283         AC_MSG_RESULT([no ALSA headers/libraries found!])
284         plugin_volumealsa=
285     fi
286 else
287     dnl force OSS plugin to <null>
288     plugin_volume=
289 fi
290 PLUGINS_LIST="\
291     $plugin_netstatus \
292     $plugin_volume \
293     $plugin_volumealsa \
294     $plugin_cpu \
295     $plugin_deskno \
296     $plugin_batt \
297     $plugin_kbled \
298     $plugin_xkb \
299     $plugin_thermal \
300     $plugin_cpufreq"
301
302 AC_SUBST(PLUGINS_LIST)
303
304
305 # Checks for header files.
306 AC_PATH_X
307 AC_HEADER_STDC
308 AC_HEADER_SYS_WAIT
309 AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
310
311 # Checks for typedefs, structures, and compiler characteristics.
312 AC_C_CONST
313 AC_C_INLINE
314 AC_STRUCT_TM
315
316 # Checks for library functions.
317 AC_FUNC_MALLOC
318 AC_FUNC_MEMCMP
319 AC_TYPE_SIGNAL
320 AC_FUNC_STAT
321 AC_FUNC_STRFTIME
322 AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
323
324
325 # Generate po/LINGUAS on the fly rather than relying on translators
326 # to maintain it manually. This also overcome the problem that Transifex
327 # cannot add a language to po/LINGUAS if a new po file is submitted.
328 rm -f $srcdir/po/LINGUAS
329 for po_file in `ls $srcdir/po/*.po | sort`;
330 do
331     lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
332     echo $lang >> $srcdir/po/LINGUAS
333 done
334
335 GETTEXT_PACKAGE=lxpanel
336 #AM_GNU_GETTEXT([external])
337 AM_GNU_GETTEXT_VERSION(0.14.1)
338 AC_SUBST(GETTEXT_PACKAGE)
339 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
340
341 AM_GLIB_GNU_GETTEXT
342
343 if test x"$enable_man" = x"yes"; then
344         AC_PATH_PROG([XSLTPROC], [xsltproc])
345         if test -z "$XSLTPROC"; then
346                 enable_man=no
347         fi
348
349         dnl check for DocBook DTD and stylesheets in the local catalog.
350         JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
351                 [DocBook XML DTD V4.1.2], [], enable_man=no)
352         JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
353                 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
354 fi
355
356 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
357
358 AC_CONFIG_FILES([
359     lxpanel.pc
360     Makefile
361     src/Makefile
362     src/plugins/Makefile
363     src/plugins/netstatus/Makefile
364     src/plugins/volume/Makefile
365     src/plugins/volumealsa/Makefile
366     src/plugins/cpu/Makefile
367     src/plugins/deskno/Makefile
368     src/plugins/batt/Makefile
369     src/plugins/kbled/Makefile
370     src/plugins/xkb/Makefile
371     src/plugins/thermal/Makefile
372     src/plugins/cpufreq/Makefile
373     po/Makefile.in
374     data/Makefile
375     data/default/panels/panel
376     man/Makefile
377 ])
378 AC_OUTPUT
379
380 echo
381 echo lxpanel ......................... : Version $VERSION
382 echo
383 echo Prefix........................... : $prefix
384 if test x$plugins_loading = xyes; then
385 echo Building dynamic plugins:
386     if test x"$plugin_netstatus" != x; then
387         AC_MSG_RESULT([    netstatus - Monitor networking status])
388     fi
389     if test x"$plugin_volume" != x; then
390         AC_MSG_RESULT([    volume - Display and adjust volume of sound card for OSS])
391     fi
392     if test x"$plugin_volumealsa" != x; then
393         AC_MSG_RESULT([    volumealsa - Display and adjust volume of sound card for ALSA])
394     fi
395     if test x"$plugin_cpu" != x; then
396         AC_MSG_RESULT([    cpu - Display CPU loading])
397     fi
398     if test x"$plugin_deskno" != x; then
399         AC_MSG_RESULT([    deskno - Display desktop number])
400     fi
401     if test x"$plugin_batt" != x; then
402         AC_MSG_RESULT([    batt - Monitor battery status])
403     fi
404     if test x"$plugin_kbled" != x; then
405         AC_MSG_RESULT([    kbled - Indicator for CapsLock, NumLock, and ScrLock])
406     fi
407     if test x"$plugin_xkb" != x; then
408         AC_MSG_RESULT([    xkb - Keyboard layout switcher])
409     fi
410     if test x"$plugin_thermal" != x; then
411         AC_MSG_RESULT([    thermal - Temperature monitor])
412     fi
413     if test x"$plugin_cpufreq" != x; then
414         AC_MSG_RESULT([    cpufreq - CpuFreq frontend])
415     fi
416 else
417 echo Dynamic loader for plugins....... : disabled.
418 fi
419
420 echo
421 echo 'LXPanel requires menu-cache and lxmenu-data packages since'
422 echo 'version 0.4.0. Please make sure they are correctly installed.'
423 echo 'Otherwise, you will not be able to use applications menu.'
424 echo
425