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