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