blob: 0de61631d37f6ad41affd1ac4f0fcecbc42900e1 [file] [log] [blame]
Damien Millerab18c411999-11-11 10:40:23 +11001AC_INIT(ssh.c)
Damien Miller7f6ea021999-10-28 13:25:17 +10002
3AC_CONFIG_HEADER(config.h)
4
5dnl Checks for programs.
6AC_PROG_CC
Damien Millerab18c411999-11-11 10:40:23 +11007AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +10008AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +11009AC_PROG_INSTALL
Damien Millerc7b38ce1999-11-09 10:28:04 +110010AC_CHECK_PROG(AR, ar, ar)
11if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi
Damien Miller7f6ea021999-10-28 13:25:17 +100012
Damien Millerc7b38ce1999-11-09 10:28:04 +110013dnl Check for OpenSSL/SSLeay directories.
14AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
Damien Millerab18c411999-11-11 10:40:23 +110015for ssldir in /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local $prefix /usr/pkg ; do
Damien Millera82feb31999-11-11 11:04:17 +110016 if test -f "$ssldir/include/openssl/crypto.h"; then
17 AC_DEFINE(HAVE_OPENSSL)
18 GOT_SSL="yes"
19 break
20 fi
21 if test -f "$ssldir/include/ssl/crypto.h"; then
22 AC_DEFINE(HAVE_SSL)
23 GOT_SSL="yes"
24 break
25 fi
Damien Millerc7b38ce1999-11-09 10:28:04 +110026done
Damien Millera82feb31999-11-11 11:04:17 +110027if test -z "$GOT_SSL" ; then
28 AC_MSG_ERROR([Could not find SSLeay / OpenSSL libraries, please install])
29fi
Damien Millerc7b38ce1999-11-09 10:28:04 +110030AC_SUBST(ssldir)
31AC_DEFINE_UNQUOTED(ssldir, "$ssldir")
32if test "$ssldir" != "/usr"; then
33 CFLAGS="$CFLAGS -I$ssldir/include"
34 LIBS="$LIBS -L$ssldir/lib"
35fi
36LIBS="$LIBS -lssl -lcrypto"
Damien Millera82feb31999-11-11 11:04:17 +110037AC_MSG_RESULT($ssldir)
Damien Miller7f6ea021999-10-28 13:25:17 +100038
Damien Millerc7b38ce1999-11-09 10:28:04 +110039dnl Check for RSAref library.
40AC_MSG_CHECKING([for RSAref library])
41saved_LIBS="$LIBS"
42LIBS="$saved_LIBS -lRSAglue -lrsaref"
43AC_TRY_LINK([], [],
44[AC_MSG_RESULT(yes); ],
45[AC_MSG_RESULT(no)]; LIBS="$saved_LIBS")
Damien Miller7f6ea021999-10-28 13:25:17 +100046
Damien Millerab18c411999-11-11 10:40:23 +110047dnl Checks for libraries.
48AC_CHECK_LIB(crypto, CRYPTO_lock, ,AC_MSG_ERROR([*** libcrypto missing - please install first ***]))
49AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
50AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
51AC_CHECK_LIB(nsl, yp_match, , )
52AC_CHECK_LIB(socket, main, , )
53
54dnl libdl is needed by PAM on Redhat systems
55AC_CHECK_LIB(dl, dlopen, , )
56AC_CHECK_LIB(pam, pam_authenticate, , )
57
Damien Miller7f6ea021999-10-28 13:25:17 +100058dnl Checks for header files.
Damien Miller95def091999-11-25 00:26:21 +110059AC_CHECK_HEADERS(pty.h endian.h paths.h lastlog.h shadow.h netgroup.h maillock.h utmp.h util.h sys/select.h sys/time.h)
Damien Millerab18c411999-11-11 10:40:23 +110060
Damien Millercedfecc1999-11-15 14:36:53 +110061dnl Checks for library functions.
Damien Millerd7702521999-11-22 16:11:05 +110062AC_CHECK_FUNCS(openpty strlcpy strlcat mkdtemp arc4random setproctitle setlogin setenv)
Damien Millercedfecc1999-11-15 14:36:53 +110063
Damien Miller04f80141999-11-19 15:32:34 +110064AC_CHECK_FUNC(login,
65 [AC_DEFINE(HAVE_LOGIN)],
66 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
67)
68
69AC_CHECK_FUNC(daemon,
70 [AC_DEFINE(HAVE_DAEMON)],
71 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
72)
73
Damien Millerc6398ef1999-11-20 12:18:40 +110074dnl Checks for data types
75AC_CHECK_SIZEOF(short int, 2)
76AC_CHECK_SIZEOF(int, 4)
77AC_CHECK_SIZEOF(long int, 4)
78AC_CHECK_SIZEOF(long long int, 8)
79
80dnl More checks for data types
Damien Miller859cec01999-11-22 14:27:24 +110081AC_MSG_CHECKING([for quad_t])
Damien Millerc6398ef1999-11-20 12:18:40 +110082AC_TRY_COMPILE(
83 [#include <sys/types.h>],
84 [quad_t a; a = 1235;],
85 [
86 AC_DEFINE(HAVE_QUAD_T)
87 AC_MSG_RESULT(yes)
88 ],
89 [AC_MSG_RESULT(no)]
90)
91
Damien Miller859cec01999-11-22 14:27:24 +110092AC_MSG_CHECKING([for intXX_t types])
Damien Millerc6398ef1999-11-20 12:18:40 +110093AC_TRY_COMPILE(
94 [#include <sys/types.h>],
95 [int16_t a; int32_t b; a = 1235; b = 1235;],
96 [
97 AC_DEFINE(HAVE_INTXX_T)
98 AC_MSG_RESULT(yes)
99 ],
100 [AC_MSG_RESULT(no)]
101)
102
Damien Miller859cec01999-11-22 14:27:24 +1100103AC_MSG_CHECKING([for u_intXX_t types])
Damien Millerc6398ef1999-11-20 12:18:40 +1100104AC_TRY_COMPILE(
105 [#include <sys/types.h>],
106 [u_int16_t c; u_int32_t d; c = 1235; d = 1235;],
107 [
108 AC_DEFINE(HAVE_U_INTXX_T)
109 AC_MSG_RESULT(yes)
110 ],
111 [AC_MSG_RESULT(no)]
112)
113
114AC_MSG_CHECKING([For uintXX_t types])
115AC_TRY_COMPILE(
116 [#include <sys/types.h>],
117 [uint16_t c; uint32_t d; c = 1235; d = 1235;],
118 [
119 AC_DEFINE(HAVE_UINTXX_T)
120 AC_MSG_RESULT(yes)
121 ],
122 [AC_MSG_RESULT(no)]
123)
124
Damien Miller859cec01999-11-22 14:27:24 +1100125dnl Check PAM strerror arguments
126AC_MSG_CHECKING([whether pam_strerror takes only one argument])
127AC_TRY_COMPILE(
128 [
129 #include <stdlib.h>
130 #include <security/pam_appl.h>
131 ],
132 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
133 [AC_MSG_RESULT(no)],
134 [
135 AC_DEFINE(HAVE_OLD_PAM)
136 AC_MSG_RESULT(yes)
137 ]
138)
139
Damien Millercedfecc1999-11-15 14:36:53 +1100140dnl Check whether use wants to disable the external ssh-askpass
141INSTALL_ASKPASS="yes"
142AC_MSG_CHECKING([whether to enable external ssh-askpass support])
143AC_ARG_WITH(askpass,
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100144 [ --with-askpass=yes/no Enable external ssh-askpass support (default=yes)],
Damien Millercedfecc1999-11-15 14:36:53 +1100145 [
146 if test x$withval = xno ; then
147 INSTALL_ASKPASS="no"
148 else
149 INSTALL_ASKPASS="yes"
150 fi
151 ]
152)
153if test "x$INSTALL_ASKPASS" = "xyes" ; then
154 AC_DEFINE(USE_EXTERNAL_ASKPASS)
155 AC_SUBST(INSTALL_ASKPASS)
156 AC_MSG_RESULT(yes)
157else
158 AC_MSG_RESULT(no)
159fi
160
161if test "x$INSTALL_ASKPASS" = "xyes" ; then
162 AC_MSG_CHECKING([whether to build GNOME ssh-askpass])
163 dnl Check whether user wants GNOME ssh-askpass
164 AC_ARG_WITH(gnome-askpass,
165 [ --with-gnome-askpass Build the GNOME passphrase requester (default=no)],
166 [
167 if test x$withval = xno ; then
168 GNOME_ASKPASS="";
169 else
170 GNOME_ASKPASS="gnome-ssh-askpass";
171 fi
172 ])
173 AC_SUBST(GNOME_ASKPASS)
174
175 if test -z "$GNOME_ASKPASS" ; then
176 AC_MSG_RESULT(no)
177 else
178 AC_MSG_RESULT(yes)
179 fi
180fi
Damien Millere0d444c1999-11-09 14:23:45 +1100181
Damien Millerab18c411999-11-11 10:40:23 +1100182dnl Check for user-specified random device
183AC_ARG_WITH(random,
Damien Millercedfecc1999-11-15 14:36:53 +1100184 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
Damien Millerab18c411999-11-11 10:40:23 +1100185 [
186 RANDOM_POOL="$withval";
Damien Miller0a6e6681999-11-15 09:56:06 +1100187 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
Damien Millerab18c411999-11-11 10:40:23 +1100188 ],
189 [
190 dnl Check for random device
191 AC_CHECK_FILE("/dev/urandom",
192 [
193 RANDOM_POOL="/dev/urandom";
Damien Millera82feb31999-11-11 11:04:17 +1100194 AC_SUBST(RANDOM_POOL)
195 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
Damien Millerab18c411999-11-11 10:40:23 +1100196 ]
197 )
198 ]
199)
200
201dnl Check for EGD pool file
202AC_ARG_WITH(egd-pool,
Damien Millercedfecc1999-11-15 14:36:53 +1100203 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
Damien Millerab18c411999-11-11 10:40:23 +1100204 [
205 RANDOM_POOL="$withval";
206 AC_DEFINE(HAVE_EGD)
Damien Millera82feb31999-11-11 11:04:17 +1100207 AC_SUBST(RANDOM_POOL)
208 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
Damien Millerab18c411999-11-11 10:40:23 +1100209 ]
210)
211
Damien Millercedfecc1999-11-15 14:36:53 +1100212dnl Make sure we have random number support
Damien Millerab18c411999-11-11 10:40:23 +1100213if test -z "$RANDOM_POOL" -a -z "$EGD_POOL"; then
214 AC_MSG_ERROR([No random device found, and no EGD random pool specified])
215fi
216
Damien Miller3f905871999-11-15 17:10:57 +1100217dnl Check for ut_host field in utmp
218AC_MSG_CHECKING([whether utmp.h has ut_host field])
219AC_EGREP_HEADER(ut_host, utmp.h,
220 [AC_DEFINE(HAVE_HOST_IN_UTMP) AC_MSG_RESULT(yes); ],
221 [AC_MSG_RESULT(no)]
222)
223
224dnl Look for lastlog location
225AC_MSG_CHECKING([location of lastlog file])
226for lastlog in /var/log/lastlog /var/adm/lastlog /etc/security/lastlog ; do
227 if test -f $lastlog ; then
Damien Millerc6398ef1999-11-20 12:18:40 +1100228 gotlastlog="file"
229 break
230 fi
231 if test -d $lastlog ; then
232 gotlastlog="dir"
Damien Miller3f905871999-11-15 17:10:57 +1100233 break
234 fi
235done
Damien Miller36fb30f1999-11-19 19:14:04 +1100236if test -z "$gotlastlog" ; then
237 AC_MSG_ERROR([*** Cannot find lastlog ***])
Damien Millerc6398ef1999-11-20 12:18:40 +1100238else
239 if test "x$gotlastlog" = "xdir" ; then
240 AC_DEFINE(LASTLOG_IS_DIR)
241 AC_MSG_ERROR([*** Directory-based lastlogs are not yet supported ***])
242 fi
243 AC_MSG_RESULT($lastlog)
244 AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$lastlog")
Damien Miller36fb30f1999-11-19 19:14:04 +1100245fi
Damien Miller3f905871999-11-15 17:10:57 +1100246
247AC_MSG_CHECKING([whether libc defines __progname])
248AC_TRY_LINK([],
Damien Miller04f80141999-11-19 15:32:34 +1100249 [extern char *__progname; printf("%s", __progname);],
Damien Miller3f905871999-11-15 17:10:57 +1100250 [
251 AC_DEFINE(HAVE___PROGNAME)
252 AC_MSG_RESULT(yes)
253 ],
254 [
255 AC_MSG_RESULT(no)
256 ]
257)
258
Damien Miller80297751999-11-19 13:03:25 +1100259dnl Check whether user wants Kerberos support
260AC_ARG_WITH(kerberos4,
261 [ --with-kerberos4 Enable Kerberos 4 support],
262 [
263 AC_DEFINE(KRB4)
264 LIBS="$LIBS -lkrb"
265 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
266 ]
267)
268
269dnl Check whether user wants AFS support
Damien Millerc6398ef1999-11-20 12:18:40 +1100270AC_ARG_WITH(afs,
Damien Miller80297751999-11-19 13:03:25 +1100271 [ --with-afs Enable AFS support],
272 [
273 AC_DEFINE(AFS)
274 LIBS="$LIBS -lkafs"
275 ]
276)
277
278dnl Check whether user wants S/Key support
279AC_ARG_WITH(skey,
280 [ --with-skey Enable S/Key support],
281 [
282 AC_DEFINE(SKEY)
283 LIBS="$LIBS -lskey"
284 ]
285)
286
287dnl Check whether user wants TCP wrappers support
Damien Millerf7c0f821999-11-22 22:31:49 +1100288AC_ARG_WITH(tcp-wrappers,
Damien Miller80297751999-11-19 13:03:25 +1100289 [ --with-tcp-wrappers Enable tcpwrappers support],
290 [
291 AC_DEFINE(LIBWRAP)
292 LIBS="$LIBS -lwrap"
293 ]
294)
295
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100296dnl Check whether to enable MD5 passwords
Damien Millerf7c0f821999-11-22 22:31:49 +1100297AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100298 [ --with-md5-passwords Enable use of MD5 passwords],
299 [AC_DEFINE(HAVE_MD5_PASSWORDS)]
300)
301
Damien Miller7f6ea021999-10-28 13:25:17 +1000302AC_OUTPUT(Makefile)