debian: build from GIT requires gtk-doc-tools so adding it to debian/control.
[lxde/lxpanel.git] / configure.ac
1 AC_PREREQ(2.53)
2 AC_INIT(lxpanel, 0.7.0, http://lxde.org/)
3 AM_INIT_AUTOMAKE([-Wall foreign no-dist-gzip dist-xz])
4 AC_CONFIG_HEADER([config.h])
5 AC_CONFIG_MACRO_DIR([m4])
6
7 # Support silent build rules. Disable by either passing --disable-silent-rules
8 # to configure or passing V=1 to make
9 AM_SILENT_RULES([yes])
10
11 # Force to dynamic
12 AC_DISABLE_STATIC
13
14 # Checks for programs.
15 AC_PROG_CC
16 AC_PROG_INSTALL
17 AC_PROG_LN_S
18 AC_PROG_INTLTOOL(, [no-xml])
19 AM_PROG_CC_C_O
20 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
21
22 #Initialize libtool
23 LT_PREREQ([2.2])
24 LT_INIT
25
26 # Checks for libraries.
27 AC_ARG_ENABLE(gtk3,
28 AC_HELP_STRING([--enable-gtk3],[enable to use gtk-3.0 instead of gtk-2.0]),
29 [case "${enableval}" in
30   yes)  enable_gtk3=yes ;;
31   no)   enable_gtk3=no ;;
32   *) AC_MSG_ERROR([bad value "${enableval}" for --enable-gtk3, use "yes" (default) or "no".]) ;;
33 esac],[])
34
35 if test "x$enable_gtk3" = "xyes" ; then
36   CFLAGS="$CFLAGS -DENABLE_GTK3"
37   pkg_modules="$pkg_modules gtk+-3.0 libfm-gtk3 >= 1.2.0 libwnck-3.0"
38 else
39   pkg_modules="$pkg_modules gtk+-2.0 >= 2.18.0 libfm-gtk >= 1.2.0 libwnck-1.0"
40 fi
41
42 pkg_modules="$pkg_modules \
43              gio-unix-2.0 \
44              gthread-2.0 \
45              gmodule-2.0"
46 PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
47 AC_SUBST(PACKAGE_CFLAGS)
48 AC_SUBST(PACKAGE_LIBS)
49
50 ###########################
51 # Indicator Info
52 ###########################
53 AC_ARG_ENABLE([indicator_support],
54     AS_HELP_STRING([--enable-indicator-support],
55                [enable plugin loading (default: disable)]),
56                indicator_support=$enableval, indicator_support="no")
57 AM_CONDITIONAL(ENABLE_INDICATOR_SUPPORT, test x"$indicator_support" = x"yes")
58
59 if test "$indicator_support" != "no"; then
60         INDICATOR_REQUIRED_VERSION=0.3.0
61         INDICATOR_PKG_NAME=indicator-0.4
62
63         PKG_CHECK_MODULES(APPLET, $INDICATOR_PKG_NAME >= $INDICATOR_REQUIRED_VERSION)
64         AC_SUBST(APPLET_CFLAGS)
65
66         if test "x$with_localinstall" = "xyes"; then
67                 INDICATORDIR="${libdir}/indicators/2/"
68                 INDICATORICONSDIR="${datadir}/indicator-applet/icons/"
69         else
70                 INDICATORDIR=`$PKG_CONFIG --variable=indicatordir $INDICATOR_PKG_NAME`
71                 INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir $INDICATOR_PKG_NAME`
72 fi
73         AC_SUBST(INDICATORDIR)
74         AC_SUBST(INDICATORICONSDIR)
75 fi
76
77
78 pkg_modules="x11"
79 PKG_CHECK_MODULES(X11, [$pkg_modules])
80 AC_SUBST(X11_LIBS)
81
82 pkg_modules="libmenu-cache"
83 PKG_CHECK_MODULES(MENU_CACHE, [$pkg_modules],
84                   enable_menu_cache=yes, enable_menu_cache=no)
85 if test x"$enable_menu_cache" = "xno"; then
86         AC_WARN([No libmenu-cache found.  All menu related routines are not built.])
87         AC_DEFINE(DISABLE_MENU, [1], [Disable menu related routines])
88 fi
89 AC_SUBST(MENU_CACHE_CFLAGS)
90 AC_SUBST(MENU_CACHE_LIBS)
91 AM_CONDITIONAL(ENABLE_MENU_CACHE, test x"$enable_menu_cache" = x"yes")
92
93 AC_ARG_ENABLE(more_warnings,
94        [AC_HELP_STRING([--enable-more-warnings],
95                [Add more warnings @<:@default=no@:>@])],
96        [enable_more_warnings="${enableval}"],
97        [enable_more_warnings=no]
98 )
99
100 if test x"$enable_more_warnings" = x"yes"; then
101   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"
102 fi
103 AC_SUBST(ADDITIONAL_FLAGS)
104
105 PACKAGE_CFLAGS="$PACKAGE_CFLAGS $MENU_CACHE_CFLAGS $ADDITIONAL_FLAGS"
106 PACKAGE_LIBS="$PACKAGE_LIBS $MENU_CACHE_LIBS"
107
108 AC_ARG_ENABLE(man,
109         [AC_HELP_STRING([--enable-man],
110                 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
111         [enable_man="${enableval}"],
112         [enable_man=no]
113 )
114
115 dnl linker tweaking
116 # The function of the link flag --as-needed is to prevent unnecesary linking.
117 # Example: A -> B -> C
118 # Normally, A would link to B and also depend on C, this is of cource
119 # unnecesary. In this situation, however we do need to link to C, so this
120 # must be done explicitly. This flag comes in handy when a library ABI
121 # is changed, minimizing the amount of recompilations needed.
122 AC_MSG_CHECKING([whether $LD accepts --as-needed])
123 case `$LD --as-needed -v 2>&1 </dev/null` in
124 *GNU* | *'with BFD'*)
125     LDFLAGS="$LDFLAGS -Wl,--as-needed"
126     AC_MSG_RESULT([yes])
127     ;;
128 *)
129     AC_MSG_RESULT([no])
130     ;;
131 esac
132
133 dnl linker optimizations
134 AC_MSG_CHECKING([whether $LD accepts -O1])
135 case `$LD -O1 -v 2>&1 </dev/null` in
136 *GNU* | *'with BFD'*)
137   LDFLAGS="$LDFLAGS -Wl,-O1"
138   AC_MSG_RESULT([yes])
139   ;;
140 *)
141   AC_MSG_RESULT([no])
142   ;;
143 esac
144 AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
145 case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
146 *GNU* | *'with BFD'*)
147   LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
148   AC_MSG_RESULT([yes])
149   ;;
150 *)
151   AC_MSG_RESULT([no])
152   ;;
153 esac
154 AC_MSG_CHECKING([whether $LD accepts --sort-common])
155 case `$LD --sort-common -v 2>&1 </dev/null` in
156 *GNU* | *'with BFD'*)
157   LDFLAGS="$LDFLAGS -Wl,--sort-common"
158   AC_MSG_RESULT([yes])
159   ;;
160 *)
161   AC_MSG_RESULT([no])
162   ;;
163 esac
164
165 dnl FIXME: filter for undefined symbols in plugins
166 # when passing "-z defs" to linker, we would better to make sure
167 # there are no undefined references.  However, we intend not to
168 # fix at the moment since we don't have spin-off libraray containing
169 # the necessary functions.
170 if test ! -z "$LDFLAGS"; then
171     LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
172 fi
173
174 LXPANEL_MODULE="-avoid-version \
175 -rpath \$(libdir)/lxpanel/plugins \
176 -no-undefined "'-export-symbols-regex "^[[^_]].*"'
177 AC_SUBST(LXPANEL_MODULE)
178
179 AC_ARG_ENABLE([alsa],
180     AS_HELP_STRING([--disable-alsa],
181                     [compile ALSA providers (default: enable)]),
182             compile_alsa=$enableval, compile_alsa="yes")
183 if test x"$compile_alsa" = "xyes"; then
184     AC_CHECK_HEADERS([alsa/asoundlib.h],
185                      [AC_CHECK_LIB([asound],
186                                    [snd_seq_open],
187                                    compile_alsa=yes,compile_alsa=no)],
188                           compile_alsa=no)
189 fi
190 AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
191 dnl FIXME: check OSS existence
192 AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
193
194 AC_ARG_ENABLE([plugins-loading],
195     AS_HELP_STRING([--disable-plugins-loading],
196                [disable plugin loading (default: enable)]),
197                plugins_loading=$enableval, plugins_loading="yes")
198
199 AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
200
201 if test x"$plugins_loading" = "xno"; then
202     AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
203 fi
204
205 dnl Here are plugin listing.
206 plugin_netstatus=
207 plugin_netstat=
208 plugin_volume=
209 plugin_volumealsa=
210 plugin_cpu=
211 plugin_deskno=
212 plugin_batt=
213 plugin_xkb=
214 plugin_kbled=
215 plugin_thermal=
216 plugin_cpufreq=
217 plugin_monitors=
218 plugin_indicator=
219
220 AC_MSG_CHECKING([which plugins should be built dynamically])
221 AC_ARG_WITH(plugins,
222 [  --with-plugins=<list>  compile dynamic plugins in <list> ]
223 [                         plugins may be comma separated ]
224 [                         'all' builds all plugins (default), 'none' builds none ]
225 [                         plugins prefixed with '-' are not built]
226 [                         Possible plugins are: ]
227 [                         netstatus, netstat, volume, volumealsa, cpu, deskno, batt,]
228 [                         kbled, xkb, thermal, cpufreq, monitors, weather]
229 , plugins="$withval",[plugins="all"])
230
231 if test x"$plugins" != xall -a x"$plugins" != xnone; then
232     if test x"$plugins_loading" = xno; then
233         AC_MSG_ERROR(
234         [--disable-plugins-loading and --with-plugins conflict each other.])
235     fi
236 fi
237
238 ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb thermal cpufreq monitors indicator weather"
239 AC_SUBST(ALL_PLUGINS_LIST)
240
241 AC_DEFUN([check_plugin_name],[
242     plugin_found=false
243     for name in $ALL_PLUGINS_LIST; do
244         if test x[$1] = x[$name]; then
245             plugin_found=true
246         fi
247     done
248     if test x[$plugin_found] = false; then
249         echo [Unknown plugin $1.]
250         exit 1
251     fi
252 ])
253
254 if test "$plugins" != "none"; then
255     plugins=`echo $plugins | sed 's/,/ /g'`
256     for plugin in $plugins
257     do
258         case "$plugin" in
259             all)
260                 for name in $ALL_PLUGINS_LIST
261                 do
262                     export plugin_$name="$name"
263                 done
264                 ;;
265             -*)
266                 check_plugin_name([${plugin#-}])
267                 export plugin_${plugin#-}=
268                 ;;
269             *)
270                 check_plugin_name([$plugin])
271                 export plugin_$plugin=$plugin
272                 ;;
273         esac
274     done
275     AC_MSG_RESULT($plugins)
276 fi
277
278 dnl FIXME: OSS/ALSA checking
279 if test x"$compile_alsa" = "xno"; then
280     if test ! -z $plugin_volumealsa; then
281         AC_MSG_RESULT([no ALSA headers/libraries found!])
282         plugin_volumealsa=
283     fi
284 else
285     dnl force OSS plugin to <null>
286     plugin_volume=
287 fi
288
289 dnl Exclude indicator support when there is no support.
290 if test x"$indicator_support" = "xno"; then
291     plugin_indicator=
292 fi
293
294 PLUGINS_LIST="\
295     $plugin_netstatus \
296     $plugin_netstat \
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     $plugin_indicator \
308     $plugin_weather"
309
310 AC_SUBST(PLUGINS_LIST)
311
312 # Plugin-specific dependencies
313 # nestat
314 if test x"$plugin_netstat" != "x";then
315 AC_CHECK_HEADER([iwlib.h],,
316  AC_MSG_ERROR([netstat plugin requires wireless-tools-devel]))
317 fi
318
319 # weather
320 if test x"$plugin_weather" != "x";then
321 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
322 AC_SUBST(LIBXML2_CFLAGS)
323 AC_SUBST(LIBXML2_LIBS)
324 fi
325
326 # Checks for header files.
327 AC_PATH_X
328 AC_HEADER_STDC
329 AC_HEADER_SYS_WAIT
330 AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
331
332 # Checks for typedefs, structures, and compiler characteristics.
333 AC_C_CONST
334 AC_C_INLINE
335 AC_STRUCT_TM
336
337 # Checks for library functions.
338 AC_FUNC_MALLOC
339 AC_FUNC_MEMCMP
340 AC_TYPE_SIGNAL
341 AC_FUNC_STAT
342 AC_FUNC_STRFTIME
343 AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
344
345 dnl check for menu-cache versions 0.4.x since no macro MENU_CACHE_CHECK_VERSION
346 dnl is available in those versions
347 LIBS_save="${LIBS}"
348 LIBS="${LIBS} ${MENU_CACHE_LIBS}"
349 AC_CHECK_FUNCS(menu_cache_dir_list_children)
350 LIBS="${LIBS_save}"
351
352 # Generate po/LINGUAS on the fly rather than relying on translators
353 # to maintain it manually. This also overcome the problem that Transifex
354 # cannot add a language to po/LINGUAS if a new po file is submitted.
355 rm -f $srcdir/po/LINGUAS
356 for po_file in `ls $srcdir/po/*.po | sort`;
357 do
358     lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
359     echo $lang >> $srcdir/po/LINGUAS
360 done
361
362 GETTEXT_PACKAGE=lxpanel
363 AM_GNU_GETTEXT([external])
364 AM_GNU_GETTEXT_VERSION(0.14.1)
365 AC_SUBST(GETTEXT_PACKAGE)
366 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
367
368 AM_GLIB_GNU_GETTEXT
369
370 if test x"$enable_man" = x"yes"; then
371         AC_PATH_PROG([XSLTPROC], [xsltproc])
372         if test -z "$XSLTPROC"; then
373                 enable_man=no
374         fi
375
376         dnl check for DocBook DTD and stylesheets in the local catalog.
377         JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
378                 [DocBook XML DTD V4.1.2], [], enable_man=no)
379         JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
380                 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
381 fi
382
383 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
384
385 AC_ARG_ENABLE(debug,
386     [AC_HELP_STRING([--enable-debug],
387         [enable debug support @<:@default=no@:>@])],
388     [enable_debug="${enableval}"],
389     [enable_debug=no]
390 )
391 if test "$enable_debug" = "yes"; then
392     # turn on debug and disable optimization
393     CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
394     case "$CC" in
395     gcc*)
396         CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration"
397         ;;
398     *)
399         ;;
400     esac
401     dnl Be more strict on portability
402     #CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
403 else
404     # turn off glib debug checks
405     CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
406 fi
407
408 dnl Fix invalid sysconfdir when --prefix=/usr
409 if test `eval "echo $sysconfdir"` = /usr/etc
410 then
411     sysconfdir=/etc
412 fi
413
414 AC_CONFIG_FILES([
415     lxpanel.pc
416     Makefile
417     src/Makefile
418     plugins/Makefile
419     plugins/netstatus/Makefile
420     plugins/netstat/Makefile
421     plugins/volume/Makefile
422     plugins/volumealsa/Makefile
423     plugins/cpu/Makefile
424     plugins/deskno/Makefile
425     plugins/batt/Makefile
426     plugins/kbled/Makefile
427     plugins/xkb/Makefile
428     plugins/thermal/Makefile
429     plugins/cpufreq/Makefile
430     plugins/monitors/Makefile
431     plugins/indicator/Makefile
432     plugins/weather/Makefile
433     po/Makefile.in
434     data/Makefile
435     data/default/panels/panel
436     data/two_panels/panels/top
437     data/two_panels/panels/bottom
438     man/Makefile
439 ])
440 AC_OUTPUT
441
442 echo
443 echo lxpanel ......................... : Version $VERSION
444 echo
445 echo Prefix........................... : $prefix
446 echo System config directory.......... : `eval "echo $sysconfdir"`
447 echo
448
449 if test x$plugins_loading = xyes; then
450 echo Building dynamic plugins:
451     if test x"$plugin_netstatus" != x; then
452         AC_MSG_RESULT([    netstatus - Monitor networking status])
453     fi
454     if test x"$plugin_netstat" != x; then
455         AC_MSG_RESULT([    netstat - Monitor networking status])
456     fi
457     if test x"$plugin_volume" != x; then
458         AC_MSG_RESULT([    volume - Display and adjust volume of sound card for OSS])
459     fi
460     if test x"$plugin_volumealsa" != x; then
461         AC_MSG_RESULT([    volumealsa - Display and adjust volume of sound card for ALSA])
462     fi
463     if test x"$plugin_cpu" != x; then
464         AC_MSG_RESULT([    cpu - Display CPU loading])
465     fi
466     if test x"$plugin_deskno" != x; then
467         AC_MSG_RESULT([    deskno - Display desktop number])
468     fi
469     if test x"$plugin_batt" != x; then
470         AC_MSG_RESULT([    batt - Monitor battery status])
471     fi
472     if test x"$plugin_kbled" != x; then
473         AC_MSG_RESULT([    kbled - Indicator for CapsLock, NumLock, and ScrLock])
474     fi
475     if test x"$plugin_xkb" != x; then
476         AC_MSG_RESULT([    xkb - Keyboard layout handler])
477     fi
478     if test x"$plugin_thermal" != x; then
479         AC_MSG_RESULT([    thermal - Temperature monitor])
480     fi
481     if test x"$plugin_cpufreq" != x; then
482         AC_MSG_RESULT([    cpufreq - CpuFreq frontend])
483     fi
484     if test x"$plugin_monitors" != x; then
485         AC_MSG_RESULT([    monitors - Monitors for CPU & RAM])
486     fi
487     if test x"$plugin_indicator" != x; then
488         AC_MSG_RESULT([    indicator - Indicator support])
489     fi
490     if test x"$plugin_weather" != x; then
491         AC_MSG_RESULT([    weather - Weather conditions and forecast])
492     fi
493 else
494 echo Dynamic loader for plugins....... : disabled.
495 fi
496
497 if test x"$sysconfdir" != x'/etc'; then
498     echo
499     echo 'Warning: sysconfdir is not /etc. It might be not what you want.'
500     echo 'Please consider passing --sysconfdir=/etc to configure.'
501 fi
502
503 echo
504 echo 'LXPanel requires menu-cache and lxmenu-data packages since'
505 echo 'version 0.4.0. Please make sure they are correctly installed.'
506 echo 'Otherwise, you will not be able to use applications menu.'
507 echo
508