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