Added $Supports command for hubs.
[doldaconnect.git] / configure.in
... / ...
CommitLineData
1AC_INIT(daemon/main.c)
2AM_INIT_AUTOMAKE([doldaconnect], [0.5])
3AM_CONFIG_HEADER(config.h)
4
5AC_PROG_CC
6AC_PROG_CC_C_O
7AM_PROG_CC_C_O
8AC_PROG_INSTALL
9
10AM_GNU_GETTEXT_VERSION(0.12.1)
11AM_GNU_GETTEXT([external])
12
13# Temporary hack to make libtool not check for g++ or g77
14m4_defun([_LT_AC_LANG_CXX_CONFIG], true)
15m4_defun([_LT_AC_LANG_F77_CONFIG], true)
16AC_PROG_LIBTOOL
17
18AC_CHECK_LIB(pam, pam_start, , AC_MSG_ERROR([*** must have PAM]))
19AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** must have zlib]))
20AC_CHECK_LIB(bz2, BZ2_bzWriteOpen, , AC_MSG_ERROR([*** must have bzlib]))
21AC_CHECK_LIB(gdbm, gdbm_open, , AC_MSG_ERROR([*** must have gdbm]))
22
23extlibs=
24experimental=no
25
26AC_CHECK_PROG([PKG_CONFIG], pkg-config, yes, no)
27
28# Gtk 2.0 check
29AC_ARG_WITH(gtk2, [ --with-gtk2 Enable GTK2 support])
30if test "$with_gtk2" = no; then
31 HAS_GTK2=no
32fi
33if test "$HAS_GTK2" != no; then
34 if test "$PKG_CONFIG" = yes; then
35 AC_MSG_CHECKING([for GTK2 package information])
36 if pkg-config --modversion gtk+-2.0 >/dev/null 2>&1; then
37 AC_MSG_RESULT(yes)
38 else
39 AC_MSG_RESULT(no)
40 HAS_GTK2=no
41 fi
42 GTK2_LDADD="`pkg-config --libs gtk+-2.0`"
43 GTK2_CFLAGS="`pkg-config --cflags gtk+-2.0`"
44 if test "$HAS_GTK2" != no; then
45 AC_CHECK_LIB(gtk-x11-2.0, gtk_init, [HAS_GTK2=yes], [HAS_GTK2=no], "$GTK2_LDADD")
46 fi
47 if test "$HAS_GTK2" = yes; then
48 cpp_bak="$CPPFLAGS"
49 CPPFLAGS="$CPPFLAGS $GTK2_CFLAGS"
50 AC_CHECK_HEADER(gtk/gtk.h, [], [HAS_GTK2=no])
51 CPPFLAGS="$cpp_bak"
52 fi
53 else
54 HAS_GTK2=no
55 fi
56fi
57if test "$with_gtk2" = yes -a "$HAS_GTK2" = no; then
58 AC_MSG_ERROR([*** cannot find GTK2 on this system])
59fi
60AC_SUBST([GTK2_LDADD GTK2_CFLAGS])
61
62# libxml2 check
63AC_MSG_CHECKING([for libxml2 package information])
64if test "$PKG_CONFIG" = yes; then
65 if pkg-config --modversion libxml-2.0 >/dev/null 2>&1; then
66 AC_MSG_RESULT(yes)
67 else
68 AC_MSG_RESULT(no)
69 HAS_LIBXML=no
70 fi
71 LIBXML_LDADD="`pkg-config --libs libxml-2.0`"
72 LIBXML_CFLAGS="`pkg-config --cflags libxml-2.0`"
73 if test "$HAS_LIBXML" != no; then
74 AC_CHECK_LIB(xml2, xmlReadFile, [HAS_LIBXML=yes], [HAS_LIBXML=no], "$LIBXML_LDADD")
75 fi
76else
77 AC_MSG_RESULT(no)
78 HAS_LIBXML=no
79fi
80AC_SUBST([LIBXML_LDADD LIBXML_CFLAGS])
81
82# libnotify check
83AC_MSG_CHECKING([for libnotify package information])
84if test "$PKG_CONFIG" = yes; then
85 if pkg-config --modversion libnotify >/dev/null 2>&1; then
86 AC_MSG_RESULT(yes)
87 else
88 AC_MSG_RESULT(no)
89 HAS_LIBNOTIFY=no
90 fi
91else
92 AC_MSG_RESULT(no)
93 HAS_LIBNOTIFY=no
94fi
95if test "$HAS_LIBNOTIFY" != no; then
96 AC_CHECK_LIB(notify, notify_init, [HAS_LIBNOTIFY=yes], [HAS_LIBNOTIFY=no], `pkg-config --libs libnotify`)
97fi
98
99# Gtk GUI check
100gtk2ui_msg=No
101AC_ARG_ENABLE(gtk2ui, [ --enable-gtk2ui Enable the GTK2 user interface])
102if test "$enable_gtk2ui" = yes; then
103 if test "$HAS_GTK2" = no; then
104 AC_MSG_ERROR([*** cannot build the GTK2 UI without a GTK2 library])
105 fi
106 if test "$HAS_LIBXML" = no; then
107 AC_MSG_ERROR([*** the GTK2 UI needs libxml2])
108 fi
109fi
110if test "$enable_gtk2ui" != no -a "$HAS_GTK2" = yes -a "$HAS_LIBXML" = yes; then
111 gtk2ui_msg=Yes
112fi
113AM_CONDITIONAL(CLI_GTK2, test "$gtk2ui_msg" = Yes)
114
115# Dolconf check
116dolconf_msg=No
117AC_ARG_ENABLE(dolconf, [ --enable-dolconf Build the configuration helper])
118if test "$enable_dolconf" = yes -a "$HAS_GTK2" = no; then
119 AC_MSG_ERROR([*** cannot build dolconf without GTK2])
120fi
121if test "$enable_dolconf" != no -a "$HAS_GTK2" = yes; then
122 dolconf_msg=Yes
123fi
124AM_CONDITIONAL(DOLCONF, test "$dolconf_msg" = Yes)
125
126# Gtk progress bar check
127gtk2pbar_msg=No
128AH_TEMPLATE(ENABLE_GTK2PBAR, [define to compile GTK2 progress bars (experimental)])
129AC_ARG_ENABLE(gtk2pbar, [ --enable-gtk2pbar Enable GTK2 progress bars (experimental)])
130if test "$enable_gtk2pbar" = yes; then
131 if test "$HAS_GTK2" = no; then
132 AC_MSG_ERROR([*** cannot build GTK2 progress bars without GTK2])
133 fi
134 experimental=yes
135 gtk2pbar_msg=Yes
136 AC_DEFINE(ENABLE_GTK2PBAR)
137fi
138
139# Gnome applet check
140gnometrapplet_msg=No
141AC_ARG_ENABLE(gnomeapplet, [ --enable-gnomeapplet Enable GNOME transfer applet (experimental)])
142if test "$enable_gnomeapplet" = yes; then
143 experimental=yes
144 gnometrapplet_msg=Yes
145fi
146AM_CONDITIONAL(CLI_GNOMEAPPLET, test "$gnometrapplet_msg" = Yes)
147
148# Gaim plugin check
149gaimplugin_msg=
150AC_ARG_ENABLE(gaimplugin, [ --enable-gaimplugin Enable Gaim chat plugin (experimental)])
151if test "$enable_gaimplugin" = yes; then
152 experimental=yes
153 gaimplugin_msg="Gaim $gaimplugin_msg"
154fi
155AM_CONDITIONAL(CLI_GAIM, test "$enable_gaimplugin" = yes)
156AC_ARG_ENABLE(pidginplugin, [ --enable-pidginplugin Enable Pidgin chat plugin (experimental)])
157if test "$enable_pidginplugin" = yes; then
158 experimental=yes
159 gaimplugin_msg="Pidgin $gaimplugin_msg"
160fi
161AM_CONDITIONAL(CLI_PIDGIN, test "$enable_pidginplugin" = yes)
162if test -z "$gaimplugin_msg"; then
163 gaimplugin_msg=No
164fi
165
166# Guile check (XXX: Shouldn't have to be enabled manually)
167guile_msg=No
168if test "$with_guile" = yes; then
169 GUILE_FLAGS
170 extlibs="$extlibs guile"
171 guile_msg=Yes
172fi
173
174# Check whether to install baseconv
175AC_ARG_ENABLE(baseconv, [ --enable-baseconv Install the baseconv utility])
176AM_CONDITIONAL(BASECONV, test "$enable_baseconv" = yes)
177
178# Kerberos check
179krb_msg=No
180AH_TEMPLATE(HAVE_KRB5, [define to compile support for Kerberos 5 (not GSS-API) authentication])
181AC_ARG_WITH(krb5, [ --with-krb5[=PATH] Enable Kerberos 5 (not GSSAPI) authentication])
182if test "$with_krb5" != no; then
183 cpp_bak="$CPPFLAGS"
184 ld_bak="$LDFLAGS"
185 if test "$with_krb5" != yes; then
186 CPPFLAGS="$CPPFLAGS -I${with_krb5}/include"
187 LDFLAGS="$LDFLAGS -L${with_krb5}/lib"
188 fi
189 AC_CHECK_LIB(krb5, krb5_init_context, [HAS_KRB5=yes], [HAS_KRB5=no])
190 if test "$HAS_KRB5" = yes; then
191 AC_CHECK_HEADER(com_err.h, [HAS_COMERR=yes], [HAS_COMERR=no])
192 if test "$HAS_COMERR" = no; then
193 AC_CHECK_HEADER(et/com_err.h, [HAS_COMERR=yes; CPPFLAGS="$CPPFLAGS -I/usr/include/et"], [])
194 fi
195 fi
196 if test "$HAS_COMERR" = no; then
197 HAS_KRB5=no
198 fi
199 if test "$HAS_KRB5" = no; then
200 CPPFLAGS="$cpp_bak"
201 LDFLAGS="$ld_bak"
202 fi
203fi
204KRB5_LDADD=
205if test -n "$with_krb5" -a "$with_krb5" != no -a "$HAS_KRB5" != yes; then
206 AC_MSG_ERROR([*** cannot find Kerberos 5 on this system - try passing --with-krb5=/path/to/kerberos])
207fi
208if test "$with_krb5" != no -a "$HAS_KRB5" = yes; then
209 AC_DEFINE(HAVE_KRB5)
210 KRB5_LDADD=-lkrb5
211 krb_msg=Yes
212fi
213AC_SUBST([KRB5_LDADD])
214
215# Misc. functions checks
216AC_CHECK_FUNC(vswprintf, , AC_MSG_ERROR([*** must have vswprintf]))
217AH_TEMPLATE(HAVE_WCSCASECMP, [define if your system implements wcscasecmp])
218AC_CHECK_FUNC(wcscasecmp, [ AC_DEFINE(HAVE_WCSCASECMP) ])
219
220AH_TEMPLATE(HAVE_LINUX_SOCKIOS_H, [define if you have linux/sockios.h on your system])
221AC_CHECK_HEADER([linux/sockios.h], [ AC_DEFINE(HAVE_LINUX_SOCKIOS_H) ])
222
223AH_TEMPLATE(HAVE_IPV6, [define if your system supports IPv6 and you wish to compile with support for it])
224AC_CHECK_MEMBER(struct sockaddr_in6.sin6_family, [ AC_DEFINE(HAVE_IPV6) ], , [#include <netinet/in.h>])
225
226AH_TEMPLATE(HAVE_RESOLVER, [define if your system supports the res_* functions to fetch DNS RRs])
227AC_CHECK_LIB(resolv, res_query, [ AC_DEFINE(HAVE_RESOLVER)
228 LDFLAGS="$LDFLAGS -lresolv" ])
229AH_TEMPLATE(HAVE_KEYUTILS, [define if your system supports the Linux keyring functions])
230AC_CHECK_LIB(keyutils, keyctl_search, [ AC_DEFINE(HAVE_KEYUTILS)
231 LDFLAGS="$LDFLAGS -lkeyutils" ])
232
233# Unix credentials selector
234AH_TEMPLATE(UNIX_AUTH_STYLE, [undefine for no Unix auth, 1 for Linux style, 2 for BSD style])
235AC_CHECK_MEMBER(struct ucred.pid, [ linuxcreds=y ], [ linuxcreds=n ], [#include <sys/socket.h>])
236AC_CHECK_FUNC(getpeereid, [ bsdcreds=y ], [ bsdcreds=n ])
237AC_MSG_CHECKING([for Unix auth style])
238if test $linuxcreds = y; then
239 AC_DEFINE(UNIX_AUTH_STYLE, 1)
240 AC_MSG_RESULT(linux)
241elif test $bsdcreds = y; then
242 AC_DEFINE(UNIX_AUTH_STYLE, 2)
243 AC_MSG_RESULT(bsd)
244else
245 AC_MSG_RESULT(none)
246fi
247
248AC_HEADER_STDC
249AC_HEADER_DIRENT
250AC_HEADER_SYS_WAIT
251
252AC_TYPE_PID_T
253AC_TYPE_SIZE_T
254AC_HEADER_TIME
255AC_TYPE_SIGNAL
256
257CPPFLAGS="-I\$(top_srcdir)/include $CPPFLAGS"
258
259AC_SUBST([extlibs])
260AC_OUTPUT([
261Makefile
262autopackage/Makefile
263common/Makefile
264daemon/Makefile
265lib/Makefile
266lib/guile/Makefile
267lib/guile/dolcon/Makefile
268clients/Makefile
269clients/gtk2/Makefile
270clients/tty/Makefile
271clients/gnome-trans-applet/Makefile
272clients/gaim/Makefile
273include/Makefile
274include/doldaconnect/Makefile
275doc/Makefile
276doc/man/Makefile
277po/Makefile.in
278config/Makefile
279config/cmd/Makefile
280config/util/Makefile
281contrib/Makefile
282autopackage/dolcon.apspec
283autopackage/dcuilib.apspec
284autopackage/dcguile.apspec
285])
286
287echo
288echo "Dolda Connect has been configured with the following settings:"
289echo
290echo " Kerberos 5 support: $krb_msg"
291echo " GTK2 user interface: $gtk2ui_msg"
292echo " GTK2 progress bars: $gtk2pbar_msg"
293echo " Dolconf configurator: $dolconf_msg"
294echo " Guile extension library: $guile_msg"
295echo " GNOME transfer applet: $gnometrapplet_msg"
296echo " Gaim chat plugin: $gaimplugin_msg"
297echo
298
299if tput bold >/dev/null 2>&1 && tty <&2 >/dev/null 2>&1; then
300 hastput=y
301fi
302if test "$HAS_GTK2" = no -a "$with_gtk2" != no -a "$enable_gtk2ui" != no; then
303 if test "$hastput" = y; then
304 tput bold
305 tput setf 4 2>/dev/null
306 fi
307 echo -n " Warning: " >&2
308 if test "$hastput" = y; then
309 tput sgr0
310 fi
311 echo "Could not find a GTK2 development installation on this system." >&2
312 echo " That means you won't get a UI." >&2
313 echo " Make absolutely sure this is what you want!" >&2
314 if test "$hastput" = y; then
315 tput bel
316 fi
317 sleep 1
318fi
319if test "$experimental" = yes; then
320 if test "$hastput" = y; then
321 tput bold
322 tput setf 4 2>/dev/null
323 fi
324 echo -n " Warning: " >&2
325 if test "$hastput" = y; then
326 tput sgr0
327 fi
328 echo "You have enabled one or more experimental features!" >&2
329 echo " Please don't complain that it doesn't work, unless" >&2
330 echo " you have something constructive to add about the situation." >&2
331 if test "$hastput" = y; then
332 tput bel
333 fi
334 sleep 1
335fi