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