Fix line-wrapping bug in baseconv.
[doldaconnect.git] / configure.in
CommitLineData
d3372da9 1AC_INIT(daemon/main.c)
ae7ccbfe 2AM_INIT_AUTOMAKE([doldaconnect], [0.5])
d3372da9 3AM_CONFIG_HEADER(config.h)
4
5AC_PROG_CC
3be6a9b7 6AC_PROG_CC_C_O
7AM_PROG_CC_C_O
d3372da9 8AC_PROG_INSTALL
9
10AM_GNU_GETTEXT_VERSION(0.12.1)
11AM_GNU_GETTEXT([external])
5d0dcf5c 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)
a47ecc70 16AC_PROG_LIBTOOL
d3372da9 17
18AC_CHECK_LIB(pam, pam_start, , AC_MSG_ERROR([*** must have PAM]))
d3372da9 19AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** must have zlib]))
20AC_CHECK_LIB(bz2, BZ2_bzWriteOpen, , AC_MSG_ERROR([*** must have bzlib]))
05fe12f8 21AC_CHECK_LIB(gdbm, gdbm_open, , AC_MSG_ERROR([*** must have gdbm]))
d3372da9 22
d3372da9 23extlibs=
24experimental=no
25
26AC_CHECK_PROG([PKG_CONFIG], pkg-config, yes, no)
27
0c1a8103 28# Gtk 2.0 check
d3372da9 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
3be6a9b7 42 GTK2_LDADD="`pkg-config --libs gtk+-2.0`"
43 GTK2_CFLAGS="`pkg-config --cflags gtk+-2.0`"
d3372da9 44 if test "$HAS_GTK2" != no; then
3be6a9b7 45 AC_CHECK_LIB(gtk-x11-2.0, gtk_init, [HAS_GTK2=yes], [HAS_GTK2=no], "$GTK2_LDADD")
d3372da9 46 fi
47 if test "$HAS_GTK2" = yes; then
48 cpp_bak="$CPPFLAGS"
3be6a9b7 49 CPPFLAGS="$CPPFLAGS $GTK2_CFLAGS"
d3372da9 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
3be6a9b7 60AC_SUBST([GTK2_LDADD GTK2_CFLAGS])
d3372da9 61
0c1a8103 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
3be6a9b7 71 LIBXML_LDADD="`pkg-config --libs libxml-2.0`"
72 LIBXML_CFLAGS="`pkg-config --cflags libxml-2.0`"
0c1a8103 73 if test "$HAS_LIBXML" != no; then
3be6a9b7 74 AC_CHECK_LIB(xml2, xmlReadFile, [HAS_LIBXML=yes], [HAS_LIBXML=no], "$LIBXML_LDADD")
0c1a8103 75 fi
76else
77 AC_MSG_RESULT(no)
78 HAS_LIBXML=no
79fi
3be6a9b7 80AC_SUBST([LIBXML_LDADD LIBXML_CFLAGS])
0c1a8103 81
bbc9d874 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
0c1a8103 99# Gtk GUI check
d3372da9 100gtk2ui_msg=No
101AC_ARG_ENABLE(gtk2ui, [ --enable-gtk2ui Enable the GTK2 user interface])
0c1a8103 102if test "$enable_gtk2ui" = yes; then
f4e3c478 103 if test "$HAS_GTK2" = no; then
0c1a8103 104 AC_MSG_ERROR([*** cannot build the GTK2 UI without a GTK2 library])
105 fi
f4e3c478 106 if test "$HAS_LIBXML" = no; then
0c1a8103 107 AC_MSG_ERROR([*** the GTK2 UI needs libxml2])
108 fi
d3372da9 109fi
f7b314dc 110if test "$enable_gtk2ui" != no -a "$HAS_GTK2" = yes -a "$HAS_LIBXML" = yes; then
d3372da9 111 gtk2ui_msg=Yes
112fi
f7b314dc 113AM_CONDITIONAL(CLI_GTK2, test "$gtk2ui_msg" = Yes)
d3372da9 114
3589c61e 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
3589c61e 122 dolconf_msg=Yes
3589c61e 123fi
f7b314dc 124AM_CONDITIONAL(DOLCONF, test "$dolconf_msg" = Yes)
3589c61e 125
0c1a8103 126# Gtk progress bar check
d3372da9 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
0c1a8103 139# Gnome applet check
d3372da9 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
d3372da9 145fi
f7b314dc 146AM_CONDITIONAL(CLI_GNOMEAPPLET, test "$gnometrapplet_msg" = Yes)
d3372da9 147
0c1a8103 148# Gaim plugin check
9db6483b 149gaimplugin_msg=No
150AC_ARG_ENABLE(gaimplugin, [ --enable-gaimplugin Enable GNOME transfer applet (experimental)])
151if test "$enable_gaimplugin" = yes; then
152 experimental=yes
153 gaimplugin_msg=Yes
9db6483b 154fi
f7b314dc 155AM_CONDITIONAL(CLI_GAIM, test "$gaimplugin_msg" = Yes)
9db6483b 156
0c1a8103 157# Guile check (XXX: Shouldn't have to be enabled manually)
d3372da9 158guile_msg=No
159if test "$with_guile" = yes; then
160 GUILE_FLAGS
161 extlibs="$extlibs guile"
162 guile_msg=Yes
163fi
164
72e3daf5 165# Check whether to install baseconv
166AC_ARG_ENABLE(baseconv, [ --enable-baseconv Install the baseconv utility])
a1b1a665 167AM_CONDITIONAL(BASECONV, test "$enable_baseconv" = yes)
72e3daf5 168
0c1a8103 169# Kerberos check
d3372da9 170krb_msg=No
171AH_TEMPLATE(HAVE_KRB5, [define to compile support for Kerberos 5 (not GSS-API) authentication])
172AC_ARG_WITH(krb5, [ --with-krb5[=PATH] Enable Kerberos 5 (not GSSAPI) authentication])
173if test "$with_krb5" != no; then
174 cpp_bak="$CPPFLAGS"
175 ld_bak="$LDFLAGS"
176 if test "$with_krb5" != yes; then
177 CPPFLAGS="$CPPFLAGS -I${with_krb5}/include"
178 LDFLAGS="$LDFLAGS -L${with_krb5}/lib"
179 fi
180 AC_CHECK_LIB(krb5, krb5_init_context, [HAS_KRB5=yes], [HAS_KRB5=no])
181 if test "$HAS_KRB5" = yes; then
182 AC_CHECK_HEADER(com_err.h, [HAS_COMERR=yes], [HAS_COMERR=no])
183 if test "$HAS_COMERR" = no; then
184 AC_CHECK_HEADER(et/com_err.h, [HAS_COMERR=yes; CPPFLAGS="$CPPFLAGS -I/usr/include/et"], [])
185 fi
186 fi
187 if test "$HAS_COMERR" = no; then
188 HAS_KRB5=no
189 fi
190 if test "$HAS_KRB5" = no; then
191 CPPFLAGS="$cpp_bak"
192 LDFLAGS="$ld_bak"
193 fi
194fi
195KRB5_LDADD=
196if test -n "$with_krb5" -a "$with_krb5" != no -a "$HAS_KRB5" != yes; then
197 AC_MSG_ERROR([*** cannot find Kerberos 5 on this system - try passing --with-krb5=/path/to/kerberos])
198fi
199if test "$with_krb5" != no -a "$HAS_KRB5" = yes; then
200 AC_DEFINE(HAVE_KRB5)
201 KRB5_LDADD=-lkrb5
202 krb_msg=Yes
203fi
204AC_SUBST([KRB5_LDADD])
205
0c1a8103 206# Misc. functions checks
d3372da9 207AC_CHECK_FUNC(vswprintf, , AC_MSG_ERROR([*** must have vswprintf]))
208AH_TEMPLATE(HAVE_WCSCASECMP, [define if your system implements wcscasecmp])
209AC_CHECK_FUNC(wcscasecmp, [ AC_DEFINE(HAVE_WCSCASECMP) ])
210
211AH_TEMPLATE(HAVE_LINUX_SOCKIOS_H, [define if you have linux/sockios.h on your system])
212AC_CHECK_HEADER([linux/sockios.h], [ AC_DEFINE(HAVE_LINUX_SOCKIOS_H) ])
213
214AH_TEMPLATE(HAVE_IPV6, [define if your system supports IPv6 and you wish to compile with support for it])
215AC_CHECK_MEMBER(struct sockaddr_in6.sin6_family, [ AC_DEFINE(HAVE_IPV6) ], , [#include <netinet/in.h>])
216
217AH_TEMPLATE(HAVE_RESOLVER, [define if your system supports the res_* functions to fetch DNS RRs])
218AC_CHECK_LIB(resolv, res_query, [ AC_DEFINE(HAVE_RESOLVER)
219 LDFLAGS="$LDFLAGS -lresolv" ])
57f76d12 220AH_TEMPLATE(HAVE_KEYUTILS, [define if your system supports the Linux keyring functions])
221AC_CHECK_LIB(keyutils, keyctl_search, [ AC_DEFINE(HAVE_KEYUTILS)
222 LDFLAGS="$LDFLAGS -lkeyutils" ])
d3372da9 223
a8c5ada6 224# Unix credentials selector
225AH_TEMPLATE(UNIX_AUTH_STYLE, [undefine for no Unix auth, 1 for Linux style, 2 for BSD style])
226AC_CHECK_MEMBER(struct ucred.pid, [ linuxcreds=y ], [ linuxcreds=n ], [#include <sys/socket.h>])
227AC_CHECK_FUNC(getpeereid, [ bsdcreds=y ], [ bsdcreds=n ])
228AC_MSG_CHECKING([for Unix auth style])
229if test $linuxcreds = y; then
230 AC_DEFINE(UNIX_AUTH_STYLE, 1)
231 AC_MSG_RESULT(linux)
232elif test $bsdcreds = y; then
233 AC_DEFINE(UNIX_AUTH_STYLE, 2)
234 AC_MSG_RESULT(bsd)
235else
236 AC_MSG_RESULT(none)
237fi
238
d3372da9 239AC_HEADER_STDC
240AC_HEADER_DIRENT
241AC_HEADER_SYS_WAIT
242
243AC_TYPE_PID_T
244AC_TYPE_SIZE_T
245AC_HEADER_TIME
246AC_TYPE_SIGNAL
247
248CPPFLAGS="-I\$(top_srcdir)/include $CPPFLAGS"
249
f7b314dc 250AC_SUBST([extlibs])
d3372da9 251AC_OUTPUT([
252Makefile
b43db3fd 253autopackage/Makefile
8b17e919 254common/Makefile
d3372da9 255daemon/Makefile
256lib/Makefile
257lib/guile/Makefile
258lib/guile/dolcon/Makefile
259clients/Makefile
260clients/gtk2/Makefile
a24f31ec 261clients/tty/Makefile
d3372da9 262clients/gnome-trans-applet/Makefile
9db6483b 263clients/gaim/Makefile
d3372da9 264include/Makefile
5b5c7760 265include/doldaconnect/Makefile
d9d072f9 266doc/Makefile
e7e96456 267doc/man/Makefile
d3372da9 268po/Makefile.in
269config/Makefile
0870fc19 270contrib/Makefile
d3372da9 271autopackage/dolcon.apspec
5fbecb4f 272autopackage/dcuilib.apspec
273autopackage/dcguile.apspec
d3372da9 274])
275
276echo
277echo "Dolda Connect has been configured with the following settings:"
278echo
279echo " Kerberos 5 support: $krb_msg"
280echo " GTK2 user interface: $gtk2ui_msg"
281echo " GTK2 progress bars: $gtk2pbar_msg"
3589c61e 282echo " Dolconf configurator: $dolconf_msg"
d3372da9 283echo " Guile extension library: $guile_msg"
284echo " GNOME transfer applet: $gnometrapplet_msg"
9db6483b 285echo " Gaim chat plugin: $gaimplugin_msg"
d3372da9 286echo
287
288if tput bold >/dev/null 2>&1 && tty <&2 >/dev/null 2>&1; then
289 hastput=y
290fi
291if test "$HAS_GTK2" = no -a "$with_gtk2" != no -a "$enable_gtk2ui" != no; then
292 if test "$hastput" = y; then
293 tput bold
294 tput setf 4 2>/dev/null
295 fi
296 echo -n " Warning: " >&2
297 if test "$hastput" = y; then
298 tput sgr0
299 fi
300 echo "Could not find a GTK2 development installation on this system." >&2
301 echo " That means you won't get a UI." >&2
302 echo " Make absolutely sure this is what you want!" >&2
303 if test "$hastput" = y; then
304 tput bel
305 fi
306 sleep 1
307fi
308if test "$experimental" = yes; then
309 if test "$hastput" = y; then
310 tput bold
311 tput setf 4 2>/dev/null
312 fi
313 echo -n " Warning: " >&2
314 if test "$hastput" = y; then
315 tput sgr0
316 fi
317 echo "You have enabled one or more experimental features!" >&2
318 echo " Please don't complain that it doesn't work, unless" >&2
319 echo " you have something constructive to add about the situation." >&2
320 if test "$hastput" = y; then
321 tput bel
322 fi
323 sleep 1
324fi