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