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