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