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