Free msg.
[doldaconnect.git] / configure.in
1 AC_INIT(daemon/main.c)
2 AM_INIT_AUTOMAKE([doldaconnect], [0.2])
3 AM_CONFIG_HEADER(config.h)
4
5 AC_PROG_CC
6 AC_PROG_INSTALL
7
8 AM_GNU_GETTEXT_VERSION(0.12.1)
9 AM_GNU_GETTEXT([external])
10 AM_PROG_LIBTOOL
11
12 AC_CHECK_LIB(pam, pam_start, , AC_MSG_ERROR([*** must have PAM]))
13 AC_CHECK_LIB(dl, dlopen, , AC_MSG_ERROR([*** PAM requires a working dynamic loader (libdl)]))
14 AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** must have zlib]))
15 AC_CHECK_LIB(bz2, BZ2_bzWriteOpen, , AC_MSG_ERROR([*** must have bzlib]))
16
17 clients=
18 extlibs=
19 experimental=no
20
21 AC_CHECK_PROG([PKG_CONFIG], pkg-config, yes, no)
22
23 AC_ARG_WITH(gtk2, [  --with-gtk2             Enable GTK2 support])
24 if test "$with_gtk2" = no; then
25         HAS_GTK2=no
26 fi
27 if test "$HAS_GTK2" != no; then
28         if test "$PKG_CONFIG" = yes; then
29                 AC_MSG_CHECKING([for GTK2 package information])
30                 if pkg-config --modversion gtk+-2.0 >/dev/null 2>&1; then
31                         AC_MSG_RESULT(yes)
32                 else
33                         AC_MSG_RESULT(no)
34                         HAS_GTK2=no
35                 fi
36                 if test "$HAS_GTK2" != no; then
37                         AC_CHECK_LIB(gtk-x11-2.0, gtk_init, [HAS_GTK2=yes], [HAS_GTK2=no], `pkg-config --libs gtk+-2.0`)
38                 fi
39                 if test "$HAS_GTK2" = yes; then
40                         cpp_bak="$CPPFLAGS"
41                         CPPFLAGS="$CPPFLAGS `pkg-config --cflags gtk+-2.0`"
42                         AC_CHECK_HEADER(gtk/gtk.h, [], [HAS_GTK2=no])
43                         CPPFLAGS="$cpp_bak"
44                 fi
45         else
46                 HAS_GTK2=no
47         fi
48 fi
49 if test "$with_gtk2" = yes -a "$HAS_GTK2" = no; then
50         AC_MSG_ERROR([*** cannot find GTK2 on this system])
51 fi
52
53 gtk2ui_msg=No
54 AC_ARG_ENABLE(gtk2ui, [  --enable-gtk2ui         Enable the GTK2 user interface])
55 if test "$enable_gtk2ui" = yes -a "$HAS_GTK2" = no; then
56         AC_MSG_ERROR([*** cannot build the GTK2 UI without a GTK2 library])
57 fi
58 if test "$enable_gtk2ui" != no -a "$HAS_GTK2" = yes; then
59         clients="$clients gtk2"
60         gtk2ui_msg=Yes
61 fi
62
63 gtk2pbar_msg=No
64 AH_TEMPLATE(ENABLE_GTK2PBAR, [define to compile GTK2 progress bars (experimental)])
65 AC_ARG_ENABLE(gtk2pbar, [  --enable-gtk2pbar       Enable GTK2 progress bars (experimental)])
66 if test "$enable_gtk2pbar" = yes; then
67         if test "$HAS_GTK2" = no; then
68                 AC_MSG_ERROR([*** cannot build GTK2 progress bars without GTK2])
69         fi
70         experimental=yes
71         gtk2pbar_msg=Yes
72         AC_DEFINE(ENABLE_GTK2PBAR)
73 fi
74
75 gnometrapplet_msg=No
76 AC_ARG_ENABLE(gnomeapplet, [  --enable-gnomeapplet    Enable GNOME transfer applet (experimental)])
77 if test "$enable_gnomeapplet" = yes; then
78         experimental=yes
79         gnometrapplet_msg=Yes
80         clients="$clients gnome-trans-applet"
81 fi
82
83 gaimplugin_msg=No
84 AC_ARG_ENABLE(gaimplugin, [  --enable-gaimplugin     Enable GNOME transfer applet (experimental)])
85 if test "$enable_gaimplugin" = yes; then
86         experimental=yes
87         gaimplugin_msg=Yes
88         clients="$clients gaim"
89 fi
90
91 guile_msg=No
92 if test "$with_guile" = yes; then
93         GUILE_FLAGS
94         extlibs="$extlibs guile"
95         guile_msg=Yes
96 fi
97
98 krb_msg=No
99 AH_TEMPLATE(HAVE_KRB5, [define to compile support for Kerberos 5 (not GSS-API) authentication])
100 AC_ARG_WITH(krb5, [  --with-krb5[=PATH]        Enable Kerberos 5 (not GSSAPI) authentication])
101 if test "$with_krb5" != no; then
102         cpp_bak="$CPPFLAGS"
103         ld_bak="$LDFLAGS"
104         if test "$with_krb5" != yes; then
105                 CPPFLAGS="$CPPFLAGS -I${with_krb5}/include"
106                 LDFLAGS="$LDFLAGS -L${with_krb5}/lib"
107         fi
108         AC_CHECK_LIB(krb5, krb5_init_context, [HAS_KRB5=yes], [HAS_KRB5=no])
109         if test "$HAS_KRB5" = yes; then
110                 AC_CHECK_HEADER(com_err.h, [HAS_COMERR=yes], [HAS_COMERR=no])
111                 if test "$HAS_COMERR" = no; then
112                         AC_CHECK_HEADER(et/com_err.h, [HAS_COMERR=yes; CPPFLAGS="$CPPFLAGS -I/usr/include/et"], [])
113                 fi
114         fi
115         if test "$HAS_COMERR" = no; then
116                 HAS_KRB5=no
117         fi
118         if test "$HAS_KRB5" = no; then
119                 CPPFLAGS="$cpp_bak"
120                 LDFLAGS="$ld_bak"
121         fi
122 fi
123 KRB5_LDADD=
124 if test -n "$with_krb5" -a "$with_krb5" != no -a "$HAS_KRB5" != yes; then
125         AC_MSG_ERROR([*** cannot find Kerberos 5 on this system - try passing --with-krb5=/path/to/kerberos])
126 fi
127 if test "$with_krb5" != no -a "$HAS_KRB5" = yes; then
128         AC_DEFINE(HAVE_KRB5)
129         KRB5_LDADD=-lkrb5
130         krb_msg=Yes
131 fi
132 AC_SUBST([KRB5_LDADD])
133
134 AC_CHECK_FUNC(vswprintf, , AC_MSG_ERROR([*** must have vswprintf]))
135 AH_TEMPLATE(HAVE_WCSCASECMP, [define if your system implements wcscasecmp])
136 AC_CHECK_FUNC(wcscasecmp, [ AC_DEFINE(HAVE_WCSCASECMP) ])
137
138 AH_TEMPLATE(HAVE_LINUX_SOCKIOS_H, [define if you have linux/sockios.h on your system])
139 AC_CHECK_HEADER([linux/sockios.h], [ AC_DEFINE(HAVE_LINUX_SOCKIOS_H) ])
140
141 AH_TEMPLATE(HAVE_IPV6, [define if your system supports IPv6 and you wish to compile with support for it])
142 AC_CHECK_MEMBER(struct sockaddr_in6.sin6_family, [ AC_DEFINE(HAVE_IPV6) ], , [#include <netinet/in.h>])
143
144 AH_TEMPLATE(HAVE_RESOLVER, [define if your system supports the res_* functions to fetch DNS RRs])
145 AC_CHECK_LIB(resolv, res_query, [ AC_DEFINE(HAVE_RESOLVER)
146                                   LDFLAGS="$LDFLAGS -lresolv" ])
147 AH_TEMPLATE(HAVE_KEYUTILS, [define if your system supports the Linux keyring functions])
148 AC_CHECK_LIB(keyutils, keyctl_search, [ AC_DEFINE(HAVE_KEYUTILS)
149                                         LDFLAGS="$LDFLAGS -lkeyutils" ])
150
151 AC_HEADER_STDC
152 AC_HEADER_DIRENT
153 AC_HEADER_SYS_WAIT
154
155 AC_TYPE_PID_T
156 AC_TYPE_SIZE_T
157 AC_HEADER_TIME
158 AC_TYPE_SIGNAL
159
160 CPPFLAGS="-I\$(top_srcdir)/include $CPPFLAGS"
161
162 AC_SUBST([clients extlibs])
163 AC_OUTPUT([
164 Makefile
165 autopackage/Makefile
166 daemon/Makefile
167 lib/Makefile
168 lib/guile/Makefile
169 lib/guile/dolcon/Makefile
170 clients/Makefile
171 clients/gtk2/Makefile
172 clients/gnome-trans-applet/Makefile
173 clients/gaim/Makefile
174 include/Makefile
175 po/Makefile.in
176 config/Makefile
177 autopackage/dolcon.apspec
178 autopackage/dcuilib.apspec
179 autopackage/dcguile.apspec
180 ])
181
182 echo
183 echo "Dolda Connect has been configured with the following settings:"
184 echo
185 echo "    Kerberos 5 support:      $krb_msg"
186 echo "    GTK2 user interface:     $gtk2ui_msg"
187 echo "    GTK2 progress bars:      $gtk2pbar_msg"
188 echo "    Guile extension library: $guile_msg"
189 echo "    GNOME transfer applet:   $gnometrapplet_msg"
190 echo "    Gaim chat plugin:        $gaimplugin_msg"
191 echo
192
193 if tput bold >/dev/null 2>&1 && tty <&2 >/dev/null 2>&1; then
194         hastput=y
195 fi
196 if test "$HAS_GTK2" = no -a "$with_gtk2" != no -a "$enable_gtk2ui" != no; then
197         if test "$hastput" = y; then
198                 tput bold
199                 tput setf 4 2>/dev/null
200         fi
201         echo -n "    Warning: " >&2
202         if test "$hastput" = y; then
203                 tput sgr0
204         fi
205         echo "Could not find a GTK2 development installation on this system." >&2
206         echo "             That means you won't get a UI." >&2
207         echo "             Make absolutely sure this is what you want!" >&2
208         if test "$hastput" = y; then
209                 tput bel
210         fi
211         sleep 1
212 fi
213 if test "$experimental" = yes; then
214         if test "$hastput" = y; then
215                 tput bold
216                 tput setf 4 2>/dev/null
217         fi
218         echo -n "    Warning: " >&2
219         if test "$hastput" = y; then
220                 tput sgr0
221         fi
222         echo "You have enabled one or more experimental features!" >&2
223         echo "             Please don't complain that it doesn't work, unless" >&2
224         echo "             you have something constructive to add about the situation." >&2
225         if test "$hastput" = y; then
226                 tput bel
227         fi
228         sleep 1
229 fi