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