1. Replace ptk-ui-xml with GtkBuilder.
[lxde/lxpanel.git] / configure.ac
1 AC_PREREQ(2.53)
2 AC_INIT(lxpanel, 0.3.8.1, http://lxde.org/)
3 AM_INIT_AUTOMAKE
4 AC_CONFIG_SRCDIR([src/bg.c])
5 AC_CONFIG_HEADER([config.h])
6
7 # Force to dynamic
8 AC_DISABLE_STATIC
9
10 # Checks for programs.
11 AC_PROG_CC
12 AC_PROG_INSTALL
13 AC_PROG_LN_S
14 AC_PROG_LIBTOOL
15 AC_PROG_INTLTOOL(, [no-xml])
16
17 # Checks for libraries.
18 pkg_modules="gtk+-2.0 >= 2.12.0 \
19              gthread-2.0 \
20              libmenu-cache"
21 #             libstartup-notification-1.0"
22 PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
23 AC_SUBST(PACKAGE_CFLAGS)
24 AC_SUBST(PACKAGE_LIBS)
25
26 # Gtk Builder
27 AC_PATH_PROG([GTK_BUILDER_CONVERT],[gtk-builder-convert],[false])
28 if test "$GTK_BUILDER_CONVERT" = "false"; then
29   AC_MSG_ERROR([gtk-builder-convert not found])
30 fi
31
32
33 AC_ARG_ENABLE([cast-checks],
34     AS_HELP_STRING([--enable-cast-checks],
35                [enable Glib casting checks (default: disable)]),
36                cast_checks=$enableval, cast_checks="no")
37 G_CAST_CHECKS=""
38 if test x"$cast_checks" = "xno"; then
39     G_CAST_CHECKS="-DG_DISABLE_CAST_CHECKS"
40 fi
41 AC_SUBST(G_CAST_CHECKS)
42
43 dnl linker tweaking
44 # The function of the link flag --as-needed is to prevent unnecesary linking.
45 # Example: A -> B -> C
46 # Normally, A would link to B and also depend on C, this is of cource
47 # unnecesary. In this situation, however we do need to link to C, so this
48 # must be done explicitly. This flag comes in handy when a library ABI
49 # is changed, minimizing the amount of recompilations needed.
50 AC_MSG_CHECKING([whether $LD accepts --as-needed])
51 case `$LD --as-needed -v 2>&1 </dev/null` in
52 *GNU* | *'with BFD'*)
53     LDFLAGS="$LDFLAGS -Wl,--as-needed"
54     AC_MSG_RESULT([yes])
55     ;;
56 *)
57     AC_MSG_RESULT([no])
58     ;;
59 esac
60
61 dnl linker optimizations
62 AC_MSG_CHECKING([whether $LD accepts -O1])
63 case `$LD -O1 -v 2>&1 </dev/null` in
64 *GNU* | *'with BFD'*)
65   LDFLAGS="$LDFLAGS -Wl,-O1"
66   AC_MSG_RESULT([yes])
67   ;;
68 *)
69   AC_MSG_RESULT([no])
70   ;;
71 esac
72 AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
73 case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
74 *GNU* | *'with BFD'*)
75   LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
76   AC_MSG_RESULT([yes])
77   ;;
78 *)
79   AC_MSG_RESULT([no])
80   ;;
81 esac
82 AC_MSG_CHECKING([whether $LD accepts --sort-common])
83 case `$LD --sort-common -v 2>&1 </dev/null` in
84 *GNU* | *'with BFD'*)
85   LDFLAGS="$LDFLAGS -Wl,--sort-common"
86   AC_MSG_RESULT([yes])
87   ;;
88 *)
89   AC_MSG_RESULT([no])
90   ;;
91 esac
92
93 dnl FIXME: filter for undefined symbols in plugins
94 # when passing "-z defs" to linker, we would better to make sure
95 # there are no undefined references.  However, we intend not to
96 # fix at the moment since we don't have spin-off libraray containing
97 # the necessary functions.
98 if test ! -z "$LDFLAGS"; then
99     LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
100 fi
101
102 LXPANEL_MODULE="-avoid-version \
103 -rpath \$(libdir)/lxpanel/plugins \
104 -no-undefined "'-export-symbols-regex "^[[^_]].*"'
105 AC_SUBST(LXPANEL_MODULE)
106
107 AC_ARG_ENABLE([alsa],
108     AS_HELP_STRING([--disable-alsa],
109                     [compile ALSA providers (default: enable)]),
110             compile_alsa=$enableval, compile_alsa="yes")
111 if test x"$compile_alsa" = "xyes"; then
112     AC_CHECK_HEADERS([alsa/asoundlib.h],
113                      [AC_CHECK_LIB([asound],
114                                    [snd_seq_open],
115                                    compile_alsa=yes,compile_alsa=no)],
116                           compile_alsa=no)
117 fi
118 AM_CONDITIONAL(BUILD_ALSA_PLUGINS, test x$compile_alsa = xyes)
119 dnl FIXME: check OSS existence
120 AM_CONDITIONAL(BUILD_OSS_PLUGINS, test x$compile_alsa = xno)
121
122 # check libiw for netstat plugin
123 AC_ARG_ENABLE([libiw],
124     AS_HELP_STRING([--disable-libiw],
125                     [compile libiw-based netstat plugin (default: enable)]),
126             compile_libiw=$enableval, compile_libiw="yes")
127 if test x"$compile_libiw" = "xyes"; then
128     AC_CHECK_HEADERS(iwlib.h,
129                      [AC_CHECK_LIB(iw,
130                                    iw_sockets_open,
131                                    compile_libiw=yes,
132                                    compile_libiw=no)],
133                                    compile_libiw=no)
134 fi
135 AM_CONDITIONAL(BUILD_LIBIW_PLUGINS, test x$compile_libiw = xyes)
136
137 AC_ARG_ENABLE([plugins-loading],
138     AS_HELP_STRING([--disable-plugins-loading],
139                [disable plugin loading (default: enable)]),
140                plugins_loading=$enableval, plugins_loading="yes")
141
142 AM_CONDITIONAL(BUILD_PLUGIN_LOADER, test x$plugins_loading = xyes)
143
144 if test x"$plugins_loading" = "xno"; then
145     AC_DEFINE(DISABLE_PLUGINS_LOADING, [1], [Disable plugin loading])
146 fi
147
148 dnl Here are plugin listing.
149 plugin_netstatus=
150 plugin_netstat=
151 plugin_volume=
152 plugin_volumealsa=
153 plugin_cpu=
154 plugin_deskno=
155 plugin_batt=
156 plugin_xkb=
157 plugin_kbled=
158 plugin_thermal=thermal
159
160 AC_MSG_CHECKING([which plugins should be built dynamically])
161 AC_ARG_WITH(plugins,
162 [  --with-plugins=<list>  compile dynamic plugins in <list> ]
163 [                         plugins may be comma separated ]
164 [                         'all' builds all plugins (default), 'none' builds none ]
165 [                         Possible plugins are: ]
166 [                         netstatus, netstat, volume, volumealsa, cpu, deskno, batt, kbled, xkb, thermal], plugins="$withval",[plugins="all"])
167
168 if test x"$plugins" != xall -a x"$plugins" != xnone; then
169     if test x"$plugins_loading" = xno; then
170         AC_MSG_ERROR(
171         [--disable-plugins-loading and --with-plugins conflict each other.])
172     fi
173 fi
174
175 ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt kbled xkb thermal"
176 AC_SUBST(ALL_PLUGINS_LIST)
177
178 if test x"$plugins" = xall; then
179 dnl    for name in $ALL_PLUGINS
180 dnl    do
181 dnl        export plugin_$name="$name"
182 dnl    done
183
184     plugin_netstatus=netstatus
185     plugin_netstat=netstat
186     plugin_volume=volume
187     plugin_volumealsa=volumealsa
188     plugin_cpu=cpu
189     plugin_deskno=deskno
190     plugin_batt=batt
191     plugin_kbled=kbled
192     plugin_xkb=
193     plugin_thermal=thermal
194
195     AC_MSG_RESULT(all)
196 else
197     if test "$plugins" != "none"; then
198         plugins=`echo $plugins | sed 's/,/ /g'`
199         for plugin in $plugins
200         do
201         case "$plugin" in
202             netstatus)
203                 plugin_netstatus=netstatus
204                 ;;
205             netstat)
206                 plugin_netstat=netstat
207                 ;;
208             volume)
209                 plugin_volume=volume
210                 ;;
211             volumealsa)
212                 plugin_volumealsa=volumealsa
213                 ;;
214             cpu)
215                 plugin_cpu=cpu
216                 ;;
217             deskno)
218                 plugin_deskno=deskno
219                 ;;
220             batt)
221                 plugin_batt=batt
222                 ;;
223             kbled)
224                 plugin_kbled=kbled
225                 ;;
226             xkb)
227                 plugin_xkb=xkb
228                 ;;
229             thermal)
230                 plugin_thermal=thermal
231                 ;;
232             *)
233                 echo "Unknown plugin $plugin."
234                 exit 1
235                 ;;
236         esac
237         done
238         AC_MSG_RESULT($plugins)
239     fi
240 fi
241
242 dnl FIXME: OSS/ALSA checking
243 if test x"$compile_alsa" = "xno"; then
244     if test ! -z $plugin_volumealsa; then
245         AC_MSG_RESULT([no ALSA headers/libraries found!])
246         plugin_volumealsa=
247     fi
248 else
249     dnl force OSS plugin to <null>
250     plugin_volume=
251 fi
252 if test x"$compile_libiw" = "xno"; then
253    if test ! -z $plugin_netstat; then
254        AC_MSG_RESULT([no libiw headers/libraries found!])
255    fi
256    plugin_netstat=
257 fi
258 PLUGINS_LIST="\
259     $plugin_netstatus \
260     $plugin_netstat \
261     $plugin_volume \
262     $plugin_volumealsa \
263     $plugin_cpu \
264     $plugin_deskno \
265     $plugin_batt \
266     $plugin_kbled \
267     $plugin_xkb \
268     $plugin_thermal"
269
270 AC_SUBST(PLUGINS_LIST)
271
272
273 # Checks for header files.
274 AC_PATH_X
275 AC_HEADER_STDC
276 AC_HEADER_SYS_WAIT
277 AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
278
279 # Checks for typedefs, structures, and compiler characteristics.
280 AC_C_CONST
281 AC_C_INLINE
282 AC_STRUCT_TM
283
284 # Checks for library functions.
285 AC_FUNC_MALLOC
286 AC_FUNC_MEMCMP
287 AC_TYPE_SIGNAL
288 AC_FUNC_STAT
289 AC_FUNC_STRFTIME
290 AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])
291
292
293 GETTEXT_PACKAGE=lxpanel
294 #AM_GNU_GETTEXT([external])
295 AM_GNU_GETTEXT_VERSION(0.14.1)
296 AC_SUBST(GETTEXT_PACKAGE)
297 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
298
299 ALL_LINGUAS="zh_TW ko hu sk pl fr pt_BR fi de es zh_CN"
300 AM_GLIB_GNU_GETTEXT
301
302 AC_CONFIG_FILES([
303     Makefile
304     src/Makefile
305     src/plugins/Makefile
306     src/plugins/netstatus/Makefile
307     src/plugins/netstat/Makefile
308     src/plugins/volume/Makefile
309     src/plugins/volumealsa/Makefile
310     src/plugins/cpu/Makefile
311     src/plugins/deskno/Makefile
312     src/plugins/batt/Makefile
313     src/plugins/kbled/Makefile
314     src/plugins/xkb/Makefile
315     src/plugins/thermal/Makefile
316     po/Makefile.in
317     data/Makefile
318     data/default/panels/panel
319     man/Makefile
320 ])
321 AC_OUTPUT
322
323 echo
324 echo lxpanel ......................... : Version $VERSION
325 echo
326 echo Prefix........................... : $prefix
327 if test x$plugins_loading = xyes; then
328 echo Building dynamic plugins:
329     if test x"$plugin_netstatus" != x; then
330         AC_MSG_RESULT([    netstatus - Monitor networking status])
331     fi
332     if test x"$plugin_netstat" != x; then
333         AC_MSG_RESULT([    netstat - Monitor networking status (Linux Only)])
334     fi
335     if test x"$plugin_volume" != x; then
336         AC_MSG_RESULT([    volume - Display and adjust volume of sound card])
337     fi
338     if test x"$plugin_volumealsa" != x; then
339         AC_MSG_RESULT([    volumealsa - Display and adjust volume of sound card for ALSA])
340     fi
341     if test x"$plugin_cpu" != x; then
342         AC_MSG_RESULT([    cpu - Display CPU loading])
343     fi
344     if test x"$plugin_deskno" != x; then
345         AC_MSG_RESULT([    deskno - Display desktop number])
346     fi
347     if test x"$plugin_batt" != x; then
348         AC_MSG_RESULT([    batt - Monitor battery status])
349     fi
350     if test x"$plugin_kbled" != x; then
351         AC_MSG_RESULT([    kbled - Indicator for CapsLock, NumLock, and ScrLock])
352     fi
353     if test x"$plugin_xkb" != x; then
354         AC_MSG_RESULT([    xkb - Keyboard layout switcher])
355     fi
356     if test x"$plugin_thermal" != x; then
357         AC_MSG_RESULT([    thermal - Temperature monitor])
358     fi
359 else
360 echo Dynamic loader for plugins....... : disabled.
361 fi