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