blob: 5773325001e911663582af9c8b6a5f39e981d940 [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)
Damien Miller76112de1999-12-21 11:18:08 +11004AC_CANONICAL_HOST
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6dnl Checks for programs.
7AC_PROG_CC
Damien Millerab18c411999-11-11 10:40:23 +11008AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +10009AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110010AC_PROG_INSTALL
Damien Millerc7b38ce1999-11-09 10:28:04 +110011AC_CHECK_PROG(AR, ar, ar)
Damien Millere79334a1999-12-29 10:03:37 +110012AC_PATH_PROG(PERL, perl)
13AC_SUBST(PERL)
Damien Miller2e1b0821999-12-25 10:11:29 +110014
Damien Miller2e1b0821999-12-25 10:11:29 +110015AC_ARG_WITH(rsh,
16 [ --with-rsh=PATH Specify path to remote shell program ],
17 [
Damien Miller8bdeee21999-12-30 15:50:54 +110018 if test "x$withval" != "$xno" ; then
19 AC_DEFINE_UNQUOTED(RSH_PATH, "$withval")
20 fi
Damien Miller2e1b0821999-12-25 10:11:29 +110021 ],
22 [
23 AC_PATH_PROG(rsh_path, rsh)
24 ]
25)
26
Damien Miller5eed6a22000-01-16 12:05:18 +110027AC_ARG_WITH(xauth,
28 [ --with-xauth=PATH Specify path to xauth program ],
Damien Millerb29ea912000-01-15 14:12:03 +110029 [
30 if test "x$withval" != "$xno" ; then
31 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$withval")
32 fi
33 ],
34 [
35 AC_PATH_PROG(xauth_path, xauth)
36 if test ! -z "$xauth_path" -a -x "/usr/openwin/bin/xauth" ; then
37 xauth_path="/usr/openwin/bin/xauth"
38 fi
39 ]
40)
41
Damien Miller2e1b0821999-12-25 10:11:29 +110042if test ! -z "$xauth_path" ; then
43 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
44fi
45if test ! -z "$rsh_path" ; then
46 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
47fi
Damien Miller76112de1999-12-21 11:18:08 +110048
Damien Miller3b9d5e91999-12-15 09:34:31 +110049dnl Checks for compiler characteristics
Damien Millerc7b38ce1999-11-09 10:28:04 +110050if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi
Damien Miller76112de1999-12-21 11:18:08 +110051
Damien Miller3b9d5e91999-12-15 09:34:31 +110052AC_C_INLINE
Damien Miller7f6ea021999-10-28 13:25:17 +100053
Damien Milleree1c0b32000-01-21 00:18:15 +110054dnl Check for OpenSSL/SSLeay directories.
55AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
56for ssldir in $prefix /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local $prefix /usr/pkg ; do
57 if test -f "$ssldir/include/openssl/crypto.h"; then
58 AC_DEFINE(HAVE_OPENSSL)
59 GOT_SSL="yes"
60 break
61 fi
62 if test -f "$ssldir/include/ssl/crypto.h"; then
63 AC_DEFINE(HAVE_SSL)
64 GOT_SSL="yes"
65 break
66 fi
67done
68if test -z "$GOT_SSL" ; then
69 AC_MSG_ERROR([Could not find SSLeay / OpenSSL libraries, please install])
70fi
71AC_SUBST(ssldir)
72AC_DEFINE_UNQUOTED(ssldir, "$ssldir")
73if test "$ssldir" != "/usr"; then
74 CFLAGS="$CFLAGS -I$ssldir/include"
75 LDFLAGS="$LDFLAGS -L$ssldir/lib"
76fi
77AC_MSG_RESULT($ssldir)
78
Damien Miller76112de1999-12-21 11:18:08 +110079dnl Check for some target-specific stuff
80case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110081*-*-aix*)
82 AFS_LIBS="-lld"
Damien Millereca71f82000-01-20 22:38:27 +110083 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Miller75b1d102000-01-07 14:01:41 +110084 ;;
Damien Miller76112de1999-12-21 11:18:08 +110085*-*-hpux10*)
86 if test -z "$GCC"; then
87 CFLAGS="$CFLAGS -Aa"
88 fi
89 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
90 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Miller2e1b0821999-12-25 10:11:29 +110091 AC_DEFINE(USE_UTMPX)
Damien Miller76112de1999-12-21 11:18:08 +110092 AC_MSG_CHECKING(for HPUX trusted system password database)
93 if test -f /tcb/files/auth/system/default; then
94 AC_MSG_RESULT(yes)
95 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
96 LIBS="$LIBS -lsec"
Damien Miller105b7f02000-01-07 08:45:55 +110097 AC_MSG_WARN([This configuration is untested])
Damien Miller76112de1999-12-21 11:18:08 +110098 else
99 AC_MSG_RESULT(no)
100 AC_DEFINE(DISABLE_SHADOW)
101 fi
Damien Miller670a4b82000-01-22 13:53:11 +1100102 MANTYPE='$(CATMAN)'
103 mansubdir=cat
Damien Miller76112de1999-12-21 11:18:08 +1100104 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100105*-*-irix5*)
Damien Miller1808f382000-01-06 12:03:12 +1100106 no_libsocket=1
107 no_libnsl=1
108 ;;
109*-*-irix6*)
110 AC_MSG_WARN([*** Irix 6.x is not tested *** ])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100111 no_libsocket=1
112 no_libnsl=1
113 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100114*-*-linux*)
115 no_dev_ptmx=1
116 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100117*-*-netbsd*)
118 if test "$GOT_SSL" = "yes"; then
119 LDFLAGS="$LDFLAGS -R$ssldir/lib"
120 fi
121 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100122*-*-solaris*)
123 AC_DEFINE(USE_UTMPX)
124 ;;
125*-*-sysv*)
126 LIBS="$LIBS -lgen -lsocket"
127 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100128esac
129
Damien Millerc7b38ce1999-11-09 10:28:04 +1100130dnl Check for RSAref library.
131AC_MSG_CHECKING([for RSAref library])
132saved_LIBS="$LIBS"
133LIBS="$saved_LIBS -lRSAglue -lrsaref"
134AC_TRY_LINK([], [],
Damien Millerd00d1611999-12-29 10:17:09 +1100135[AC_MSG_RESULT(yes);
136 AC_DEFINE(RSAREF)],
Damien Millerc7b38ce1999-11-09 10:28:04 +1100137[AC_MSG_RESULT(no)]; LIBS="$saved_LIBS")
Damien Miller7f6ea021999-10-28 13:25:17 +1000138
Damien Millerab18c411999-11-11 10:40:23 +1100139dnl Checks for libraries.
140AC_CHECK_LIB(crypto, CRYPTO_lock, ,AC_MSG_ERROR([*** libcrypto missing - please install first ***]))
141AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
142AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Millerab18c411999-11-11 10:40:23 +1100143
Damien Millerbeb4ba51999-12-28 15:09:35 +1100144if test -z "$no_libsocket" ; then
145 AC_CHECK_LIB(nsl, yp_match, , )
146fi
147if test -z "$no_libnsl" ; then
148 AC_CHECK_LIB(socket, main, , )
Damien Miller32b3cf21999-12-26 10:21:48 +1100149fi
Damien Millerab18c411999-11-11 10:40:23 +1100150
Damien Miller7f6ea021999-10-28 13:25:17 +1000151dnl Checks for header files.
Damien Miller670a4b82000-01-22 13:53:11 +1100152AC_CHECK_HEADERS(bstring.h endian.h lastlog.h login.h maillock.h netdb.h netgroup.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h util.h utmp.h utmpx.h)
Damien Millerab18c411999-11-11 10:40:23 +1100153
Damien Millercedfecc1999-11-15 14:36:53 +1100154dnl Checks for library functions.
Damien Miller834171e2000-01-17 09:59:41 +1100155AC_CHECK_FUNCS(arc4random bindresvport_af freeaddrinfo gai_strerror getaddrinfo getpagesize getnameinfo innetgr md5_crypt mkdtemp openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy updwtmpx vsnprintf _getpty)
Damien Millercedfecc1999-11-15 14:36:53 +1100156
Damien Miller04f80141999-11-19 15:32:34 +1100157AC_CHECK_FUNC(login,
158 [AC_DEFINE(HAVE_LOGIN)],
159 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
160)
161
162AC_CHECK_FUNC(daemon,
163 [AC_DEFINE(HAVE_DAEMON)],
164 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
165)
166
Damien Millerc6398ef1999-11-20 12:18:40 +1100167dnl Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100168AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100169AC_CHECK_SIZEOF(short int, 2)
170AC_CHECK_SIZEOF(int, 4)
171AC_CHECK_SIZEOF(long int, 4)
172AC_CHECK_SIZEOF(long long int, 8)
173
174dnl More checks for data types
Damien Miller859cec01999-11-22 14:27:24 +1100175AC_MSG_CHECKING([for intXX_t types])
Damien Millerc6398ef1999-11-20 12:18:40 +1100176AC_TRY_COMPILE(
177 [#include <sys/types.h>],
178 [int16_t a; int32_t b; a = 1235; b = 1235;],
179 [
180 AC_DEFINE(HAVE_INTXX_T)
181 AC_MSG_RESULT(yes)
Damien Millerb29ea912000-01-15 14:12:03 +1100182 have_intxx_t=1
Damien Millerc6398ef1999-11-20 12:18:40 +1100183 ],
184 [AC_MSG_RESULT(no)]
185)
186
Damien Miller859cec01999-11-22 14:27:24 +1100187AC_MSG_CHECKING([for u_intXX_t types])
Damien Millerc6398ef1999-11-20 12:18:40 +1100188AC_TRY_COMPILE(
189 [#include <sys/types.h>],
190 [u_int16_t c; u_int32_t d; c = 1235; d = 1235;],
191 [
192 AC_DEFINE(HAVE_U_INTXX_T)
193 AC_MSG_RESULT(yes)
Damien Millerb29ea912000-01-15 14:12:03 +1100194 have_u_intxx_t=1
Damien Millerc6398ef1999-11-20 12:18:40 +1100195 ],
196 [AC_MSG_RESULT(no)]
197)
198
Damien Millereaf99942000-01-19 13:45:07 +1100199if test -z "$have_u_intxx_t" -o -z "$have_intxx_t" -a \
Damien Millerb29ea912000-01-15 14:12:03 +1100200 "x$ac_cv_header_sys_bitypes_h" = "xyes"
201then
202 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
203 AC_TRY_COMPILE(
204 [#include <sys/bitypes.h>],
205 [
206 u_int16_t c; u_int32_t d;
207 int16_t e; int32_t f;
208 c = 1235; d = 1235;
209 e = 1235; f = 1235;
210 ],
211 [
212 AC_DEFINE(HAVE_U_INTXX_T)
213 AC_DEFINE(HAVE_INTXX_T)
214 AC_MSG_RESULT(yes)
215 ],
216 [AC_MSG_RESULT(no)]
217 )
218fi
219
Damien Miller34132e52000-01-14 15:45:46 +1100220AC_MSG_CHECKING([for uintXX_t types])
Damien Millerc6398ef1999-11-20 12:18:40 +1100221AC_TRY_COMPILE(
222 [#include <sys/types.h>],
223 [uint16_t c; uint32_t d; c = 1235; d = 1235;],
224 [
225 AC_DEFINE(HAVE_UINTXX_T)
226 AC_MSG_RESULT(yes)
227 ],
228 [AC_MSG_RESULT(no)]
229)
230
Damien Miller34132e52000-01-14 15:45:46 +1100231AC_MSG_CHECKING([for socklen_t])
Damien Miller74d0d4a1999-12-29 02:24:35 +1100232AC_TRY_COMPILE(
Damien Millerf3e8be81999-12-31 08:59:04 +1100233 [
234 #include <sys/types.h>
235 #include <sys/socket.h>
236 ],
Damien Miller74d0d4a1999-12-29 02:24:35 +1100237 [socklen_t foo; foo = 1235;],
238 [
239 AC_DEFINE(HAVE_SOCKLEN_T)
240 AC_MSG_RESULT(yes)
241 ],
242 [AC_MSG_RESULT(no)]
243)
244
Damien Miller34132e52000-01-14 15:45:46 +1100245AC_MSG_CHECKING([for size_t])
Damien Miller95058511999-12-29 10:36:45 +1100246AC_TRY_COMPILE(
247 [#include <sys/types.h>],
Damien Miller95058511999-12-29 10:36:45 +1100248 [size_t foo; foo = 1235;],
249 [
250 AC_DEFINE(HAVE_SIZE_T)
251 AC_MSG_RESULT(yes)
252 ],
253 [AC_MSG_RESULT(no)]
254)
255
Damien Miller34132e52000-01-14 15:45:46 +1100256AC_MSG_CHECKING([for struct sockaddr_storage])
257AC_TRY_COMPILE(
Damien Miller66409952000-01-17 21:40:06 +1100258 [
259 #include <sys/types.h>
260 #include <sys/socket.h>
261 ],
Damien Miller34132e52000-01-14 15:45:46 +1100262 [struct sockaddr_storage s;],
263 [
264 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
265 AC_MSG_RESULT(yes)
266 ],
267 [AC_MSG_RESULT(no)]
268)
269
270AC_MSG_CHECKING([for struct sockaddr_in6])
271AC_TRY_COMPILE(
272 [#include <netinet/in.h>],
273 [struct sockaddr_in6 s; s.sin6_family = 0;],
274 [
275 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
276 AC_MSG_RESULT(yes)
277 ],
278 [AC_MSG_RESULT(no)]
279)
280
281AC_MSG_CHECKING([for struct in6_addr])
282AC_TRY_COMPILE(
283 [#include <netinet/in.h>],
284 [struct in6_addr s; s.s6_addr[0] = 0;],
285 [
286 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
287 AC_MSG_RESULT(yes)
288 ],
289 [AC_MSG_RESULT(no)]
290)
291
292AC_MSG_CHECKING([for struct addrinfo])
293AC_TRY_COMPILE(
294 [
Damien Miller66409952000-01-17 21:40:06 +1100295 #include <sys/types.h>
Damien Miller34132e52000-01-14 15:45:46 +1100296 #include <sys/socket.h>
297 #include <netdb.h>
298 ],
299 [struct addrinfo s; s.ai_flags = AI_PASSIVE;],
300 [
301 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
302 AC_MSG_RESULT(yes)
303 ],
304 [AC_MSG_RESULT(no)]
305)
306
Damien Millerbeb4ba51999-12-28 15:09:35 +1100307AC_ARG_WITH(pam,
308 [ --without-pam Disable PAM support ],
Damien Miller859cec01999-11-22 14:27:24 +1100309 [
Damien Millerbeb4ba51999-12-28 15:09:35 +1100310 if test "x$withval" = "xno" ; then
311 no_pam=1
312 AC_DEFINE(DISABLE_PAM)
313 fi
Damien Miller859cec01999-11-22 14:27:24 +1100314 ]
Damien Millerbeb4ba51999-12-28 15:09:35 +1100315)
316
317if test -z "$no_pam" -a "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
318 AC_CHECK_LIB(dl, dlopen, , )
319 LIBS="$LIBS -lpam"
320 dnl Check PAM strerror arguments
321 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
322 AC_TRY_COMPILE(
323 [
324 #include <stdlib.h>
325 #include <security/pam_appl.h>
326 ],
327 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
328 [AC_MSG_RESULT(no)],
329 [
330 AC_DEFINE(HAVE_OLD_PAM)
331 AC_MSG_RESULT(yes)
332 ]
333 )
334fi
Damien Miller859cec01999-11-22 14:27:24 +1100335
Damien Miller98ac0071999-11-25 13:19:55 +1100336AC_MSG_CHECKING([whether to build GNOME ssh-askpass])
337dnl Check whether user wants GNOME ssh-askpass
338AC_ARG_WITH(gnome-askpass,
339 [ --with-gnome-askpass Build the GNOME passphrase requester (default=no)],
Damien Millercedfecc1999-11-15 14:36:53 +1100340 [
341 if test x$withval = xno ; then
Damien Miller98ac0071999-11-25 13:19:55 +1100342 GNOME_ASKPASS="";
Damien Millercedfecc1999-11-15 14:36:53 +1100343 else
Damien Miller98ac0071999-11-25 13:19:55 +1100344 GNOME_ASKPASS="gnome-ssh-askpass";
Damien Millercedfecc1999-11-15 14:36:53 +1100345 fi
Damien Miller98ac0071999-11-25 13:19:55 +1100346 ])
347AC_SUBST(GNOME_ASKPASS)
348
349if test -z "$GNOME_ASKPASS" ; then
Damien Millercedfecc1999-11-15 14:36:53 +1100350 AC_MSG_RESULT(no)
Damien Miller98ac0071999-11-25 13:19:55 +1100351else
352 AC_MSG_RESULT(yes)
Damien Millercedfecc1999-11-15 14:36:53 +1100353fi
Damien Millere0d444c1999-11-09 14:23:45 +1100354
Damien Millerab18c411999-11-11 10:40:23 +1100355dnl Check for user-specified random device
356AC_ARG_WITH(random,
Damien Millercedfecc1999-11-15 14:36:53 +1100357 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
Damien Millerab18c411999-11-11 10:40:23 +1100358 [
359 RANDOM_POOL="$withval";
Damien Miller0a6e6681999-11-15 09:56:06 +1100360 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
Damien Millerab18c411999-11-11 10:40:23 +1100361 ],
362 [
363 dnl Check for random device
364 AC_CHECK_FILE("/dev/urandom",
365 [
366 RANDOM_POOL="/dev/urandom";
Damien Millera82feb31999-11-11 11:04:17 +1100367 AC_SUBST(RANDOM_POOL)
368 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
Damien Millerab18c411999-11-11 10:40:23 +1100369 ]
370 )
371 ]
372)
373
374dnl Check for EGD pool file
375AC_ARG_WITH(egd-pool,
Damien Millercedfecc1999-11-15 14:36:53 +1100376 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
Damien Millerab18c411999-11-11 10:40:23 +1100377 [
378 RANDOM_POOL="$withval";
379 AC_DEFINE(HAVE_EGD)
Damien Millera82feb31999-11-11 11:04:17 +1100380 AC_SUBST(RANDOM_POOL)
381 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
Damien Millerab18c411999-11-11 10:40:23 +1100382 ]
383)
384
Damien Millercedfecc1999-11-15 14:36:53 +1100385dnl Make sure we have random number support
Damien Millerab18c411999-11-11 10:40:23 +1100386if test -z "$RANDOM_POOL" -a -z "$EGD_POOL"; then
387 AC_MSG_ERROR([No random device found, and no EGD random pool specified])
388fi
389
Damien Miller3f905871999-11-15 17:10:57 +1100390AC_MSG_CHECKING([whether utmp.h has ut_host field])
391AC_EGREP_HEADER(ut_host, utmp.h,
392 [AC_DEFINE(HAVE_HOST_IN_UTMP) AC_MSG_RESULT(yes); ],
393 [AC_MSG_RESULT(no)]
394)
Damien Millerbf1c9b21999-12-09 10:16:54 +1100395AC_MSG_CHECKING([whether utmpx.h has ut_host field])
396AC_EGREP_HEADER(ut_host, utmpx.h,
397 [AC_DEFINE(HAVE_HOST_IN_UTMPX) AC_MSG_RESULT(yes); ],
398 [AC_MSG_RESULT(no)]
399)
Damien Miller2e1b0821999-12-25 10:11:29 +1100400AC_MSG_CHECKING([whether utmpx.h has syslen field])
401AC_EGREP_HEADER(syslen, utmpx.h,
402 [AC_DEFINE(HAVE_SYSLEN_IN_UTMPX) AC_MSG_RESULT(yes); ],
403 [AC_MSG_RESULT(no)]
404)
Damien Miller4ff2b9b1999-12-28 10:41:12 +1100405AC_MSG_CHECKING([whether utmp.h has ut_pid field])
406AC_EGREP_HEADER(ut_pid, utmp.h,
407 [AC_DEFINE(HAVE_PID_IN_UTMP) AC_MSG_RESULT(yes); ],
408 [AC_MSG_RESULT(no)]
409)
410AC_MSG_CHECKING([whether utmp.h has ut_type field])
411AC_EGREP_HEADER(ut_type, utmp.h,
412 [AC_DEFINE(HAVE_TYPE_IN_UTMP) AC_MSG_RESULT(yes); ],
413 [AC_MSG_RESULT(no)]
414)
415AC_MSG_CHECKING([whether utmp.h has ut_tv field])
416AC_EGREP_HEADER(ut_tv, utmp.h,
417 [AC_DEFINE(HAVE_TV_IN_UTMP) AC_MSG_RESULT(yes); ],
418 [AC_MSG_RESULT(no)]
419)
Damien Miller9550a761999-12-29 02:32:22 +1100420AC_MSG_CHECKING([whether utmp.h has ut_id field])
421AC_EGREP_HEADER(ut_id, utmp.h,
422 [AC_DEFINE(HAVE_ID_IN_UTMP) AC_MSG_RESULT(yes); ],
423 [AC_MSG_RESULT(no)]
424)
Damien Miller3131d8b1999-12-31 09:42:24 +1100425AC_MSG_CHECKING([whether utmp.h has ut_addr field])
426AC_EGREP_HEADER(ut_addr, utmp.h,
427 [AC_DEFINE(HAVE_ADDR_IN_UTMP) AC_MSG_RESULT(yes); ],
428 [AC_MSG_RESULT(no)]
429)
430AC_MSG_CHECKING([whether utmpx.h has ut_addr field])
431AC_EGREP_HEADER(ut_addr, utmpx.h,
Damien Miller34132e52000-01-14 15:45:46 +1100432 [AC_DEFINE(HAVE_ADDR_IN_UTMPX) AC_MSG_RESULT(yes); ],
433 [AC_MSG_RESULT(no)]
434)
435AC_MSG_CHECKING([whether utmp.h has ut_addr_v6 field])
436AC_EGREP_HEADER(ut_addr_v6, utmp.h,
437 [AC_DEFINE(HAVE_ADDR_V6_IN_UTMP) AC_MSG_RESULT(yes); ],
438 [AC_MSG_RESULT(no)]
439)
440AC_MSG_CHECKING([whether utmpx.h has ut_addr_v6 field])
441AC_EGREP_HEADER(ut_addr_v6, utmpx.h,
442 [AC_DEFINE(HAVE_ADDR_V6_IN_UTMPX) AC_MSG_RESULT(yes); ],
443 [AC_MSG_RESULT(no)]
444)
445
446AC_MSG_CHECKING([whether struct sockaddr_storage has ss_family field])
447AC_TRY_COMPILE(
Damien Miller66409952000-01-17 21:40:06 +1100448 [
449 #include <sys/types.h>
450 #include <sys/socket.h>
451 ],
Damien Miller34132e52000-01-14 15:45:46 +1100452 [struct sockaddr_storage s; s.ss_family = 1;],
453 [
454 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
455 AC_MSG_RESULT(yes)
456 ],
457 [AC_MSG_RESULT(no)]
458)
459AC_MSG_CHECKING([whether struct sockaddr_storage has __ss_family field])
460AC_TRY_COMPILE(
Damien Miller66409952000-01-17 21:40:06 +1100461 [
462 #include <sys/types.h>
463 #include <sys/socket.h>
464 ],
Damien Miller34132e52000-01-14 15:45:46 +1100465 [struct sockaddr_storage s; s.__ss_family = 1;],
466 [
467 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
468 AC_MSG_RESULT(yes)
469 ],
Damien Miller3131d8b1999-12-31 09:42:24 +1100470 [AC_MSG_RESULT(no)]
471)
Damien Millerbf1c9b21999-12-09 10:16:54 +1100472
Damien Miller3f905871999-11-15 17:10:57 +1100473dnl Look for lastlog location
Damien Miller76112de1999-12-21 11:18:08 +1100474AC_ARG_WITH(lastlog,
Damien Miller5a3e6831999-12-27 09:48:56 +1100475 [ --with-lastlog=FILE Location of lastlog file],
Damien Miller76112de1999-12-21 11:18:08 +1100476 [
477 if test "x$withval" = "xno" ; then
478 AC_DEFINE(DISABLE_LASTLOG)
479 else
480 AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$withval")
481 fi
482 ],
483 [
484 AC_MSG_CHECKING([location of lastlog file])
485 for lastlog in /var/log/lastlog /var/adm/lastlog /etc/security/lastlog ; do
486 if test -f $lastlog ; then
487 gotlastlog="file"
488 break
489 fi
490 if test -d $lastlog ; then
491 gotlastlog="dir"
492 break
493 fi
494 done
495 if test -z "$gotlastlog" ; then
Damien Millerbeb4ba51999-12-28 15:09:35 +1100496 AC_MSG_RESULT(not found)
Damien Miller76112de1999-12-21 11:18:08 +1100497 nolastlog=1
498 else
499 if test "x$gotlastlog" = "xdir" ; then
Damien Millerbeb4ba51999-12-28 15:09:35 +1100500 AC_MSG_RESULT(${lastlog}/)
Damien Miller76112de1999-12-21 11:18:08 +1100501 AC_DEFINE(LASTLOG_IS_DIR)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100502 else
503 AC_MSG_RESULT($lastlog)
504 AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$lastlog")
Damien Miller76112de1999-12-21 11:18:08 +1100505 fi
Damien Miller76112de1999-12-21 11:18:08 +1100506 fi
507 ]
508)
509
510if test ! -z "$nolastlog" ; then
511 AC_MSG_WARN([*** Disabling lastlog support *** ])
512 AC_DEFINE(DISABLE_LASTLOG)
513fi
Damien Miller3f905871999-11-15 17:10:57 +1100514
Damien Miller8bdeee21999-12-30 15:50:54 +1100515dnl Compile with dante SOCKS library
516AC_ARG_WITH(dante,
517 [ --with-dante=DIR Use Dante SOCKS lib (default is system library path)],
518 [
519 AC_DEFINE(HAVE_DANTE)
520 if test "x$withval" != "xno" ; then
521 if test -n $withval ; then
522 LIBS="$LIBS -L$withval"
523 fi
524 LIBS="$LIBS -lsocks"
525 fi
526 ]
527)
Damien Miller670a4b82000-01-22 13:53:11 +1100528AC_ARG_WITH(catman,
529 [ --with-catman=man|cat Install preformatted manpages[no]],
530 [
531 MANTYPE='$(CATMAN)'
532 if test x"$withval" != x"yes" ; then
533 mansubdir=$withval
534 else
535 mansubdir=cat
536 fi
537 ], [
538 if test -z "$MANTYPE" ; then
539 MANTYPE='$(TROFFMAN)'
540 mansubdir=man
541 fi
542 ]
543)
544AC_SUBST(MANTYPE)
545AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +1100546
Damien Miller62a52ef2000-01-16 23:03:56 +1100547if test -z "$no_dev_ptmx" ; then
Damien Millerb29ea912000-01-15 14:12:03 +1100548 AC_CHECK_FILE("/dev/ptmx", AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX))
549fi
Damien Miller037a0dc1999-12-07 15:38:31 +1100550AC_CHECK_FILE("/dev/ptc", AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC))
551
Damien Miller3f905871999-11-15 17:10:57 +1100552AC_MSG_CHECKING([whether libc defines __progname])
553AC_TRY_LINK([],
Damien Miller04f80141999-11-19 15:32:34 +1100554 [extern char *__progname; printf("%s", __progname);],
Damien Miller3f905871999-11-15 17:10:57 +1100555 [
556 AC_DEFINE(HAVE___PROGNAME)
557 AC_MSG_RESULT(yes)
558 ],
559 [
560 AC_MSG_RESULT(no)
561 ]
562)
563
Damien Miller80297751999-11-19 13:03:25 +1100564dnl Check whether user wants Kerberos support
565AC_ARG_WITH(kerberos4,
Damien Miller105b7f02000-01-07 08:45:55 +1100566 [ --with-kerberos4=PATH Enable Kerberos 4 support],
Damien Miller80297751999-11-19 13:03:25 +1100567 [
Damien Miller8bdeee21999-12-30 15:50:54 +1100568 if test "x$withval" != "$xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +1100569
570 if test "x$withval" != "$xyes" ; then
571 CFLAGS="$CFLAGS -I${withval}/include"
572 LDFLAGS="$LDFLAGS -L${withval}/lib"
573 else
574 if test -d /usr/include/kerberosIV ; then
575 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
576 fi
577 fi
578
579 AC_CHECK_HEADERS(krb.h)
580 AC_CHECK_LIB(krb, main)
581 if test "$ac_cv_header_krb_h" != yes; then
582 AC_MSG_WARN([Cannot find krb.h, build may fail])
583 fi
584 if test "$ac_cv_lib_krb_main" != yes; then
585 AC_MSG_WARN([Cannot find libkrb, build may fail])
586 fi
587
588 LIBS="$LIBS -lkrb -ldes"
589 AC_CHECK_LIB(resolv, dn_expand, , )
590 KRB4=yes
Damien Miller8bdeee21999-12-30 15:50:54 +1100591 AC_DEFINE(KRB4)
Damien Miller8bdeee21999-12-30 15:50:54 +1100592 fi
Damien Miller80297751999-11-19 13:03:25 +1100593 ]
594)
595
596dnl Check whether user wants AFS support
Damien Millerc6398ef1999-11-20 12:18:40 +1100597AC_ARG_WITH(afs,
Damien Miller105b7f02000-01-07 08:45:55 +1100598 [ --with-afs=PATH Enable AFS support],
Damien Miller80297751999-11-19 13:03:25 +1100599 [
Damien Miller8bdeee21999-12-30 15:50:54 +1100600 if test "x$withval" != "$xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +1100601
602 if test "x$withval" != "$xyes" ; then
603 CFLAGS="$CFLAGS -I${withval}/include"
604 LFLAGS="$LFLAGS -L${withval}/lib"
605 fi
606
607 if test -z "$KRB4" ; then
608 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
609 fi
610
Damien Miller8bdeee21999-12-30 15:50:54 +1100611 LIBS="$LIBS -lkafs"
Damien Miller105b7f02000-01-07 08:45:55 +1100612 if test ! -z "$AFS_LIBS" ; then
613 LIBS="$LIBS $AFS_LIBS"
614 fi
615 AC_DEFINE(AFS)
Damien Miller8bdeee21999-12-30 15:50:54 +1100616 fi
Damien Miller80297751999-11-19 13:03:25 +1100617 ]
618)
619
620dnl Check whether user wants S/Key support
621AC_ARG_WITH(skey,
622 [ --with-skey Enable S/Key support],
623 [
Damien Miller8bdeee21999-12-30 15:50:54 +1100624 if test "x$withval" != "$xno" ; then
625 AC_DEFINE(SKEY)
626 LIBS="$LIBS -lskey"
627 fi
Damien Miller80297751999-11-19 13:03:25 +1100628 ]
629)
630
631dnl Check whether user wants TCP wrappers support
Damien Millerf7c0f821999-11-22 22:31:49 +1100632AC_ARG_WITH(tcp-wrappers,
Damien Miller80297751999-11-19 13:03:25 +1100633 [ --with-tcp-wrappers Enable tcpwrappers support],
634 [
Damien Miller8bdeee21999-12-30 15:50:54 +1100635 if test "x$withval" != "$xno" ; then
636 AC_DEFINE(LIBWRAP)
Damien Miller105b7f02000-01-07 08:45:55 +1100637 LIBS="$LIBS -lwrap"
Damien Miller8bdeee21999-12-30 15:50:54 +1100638 fi
Damien Miller80297751999-11-19 13:03:25 +1100639 ]
640)
641
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100642dnl Check whether to enable MD5 passwords
Damien Millerf7c0f821999-11-22 22:31:49 +1100643AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100644 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +1100645 [
646 if test "x$withval" != "$xno" ; then
647 AC_DEFINE(HAVE_MD5_PASSWORDS)
648 fi
649 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100650)
651
Damien Miller368cf641999-12-21 09:51:36 +1100652dnl Check whether to enable utmpx support
653AC_ARG_WITH(utmpx,
654 [ --with-utmpx Enable utmpx support],
Damien Miller76112de1999-12-21 11:18:08 +1100655 [
656 if test "x$withval" != "xno" ; then
657 AC_DEFINE(USE_UTMPX)
658 fi
659 ]
Damien Miller368cf641999-12-21 09:51:36 +1100660)
661
Damien Miller76112de1999-12-21 11:18:08 +1100662dnl Whether to disable shadow password support
663AC_ARG_WITH(shadow,
664 [ --without-shadow Disable shadow password support],
665 [
666 if test "x$withval" = "xno" ; then
667 AC_DEFINE(DISABLE_SHADOW)
668 fi
669 ]
670)
671
672dnl Use ip address instead of hostname in $DISPLAY
673AC_ARG_WITH(ipaddr-display,
674 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
675 [
Damien Miller66409952000-01-17 21:40:06 +1100676 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +1100677 AC_DEFINE(IPADDR_IN_DISPLAY)
678 fi
679 ]
680)
681
Damien Millere7f626c1999-12-31 09:49:44 +1100682AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +1100683 [ --with-default-path=PATH Specify default \$PATH environment for server],
684 [
685 if test "x$withval" != "xno" ; then
Damien Miller9550a761999-12-29 02:32:22 +1100686 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
Damien Miller5a3e6831999-12-27 09:48:56 +1100687 fi
688 ]
689)
690
Damien Miller7d80e342000-01-19 14:36:49 +1100691AC_ARG_WITH(ipv4-default,
692 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
693 [
694 if test "x$withval" != "xno" ; then
695 AC_DEFINE(IPV4_DEFAULT)
696 fi
697 ]
698)
699
Damien Millerb13c73e2000-01-17 22:02:17 +1100700piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +1100701AC_ARG_WITH(pid-dir,
702 [ --with-pid-dir=PATH Specify location of ssh.pid file],
703 [
704 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +1100705 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +1100706 fi
707 ]
708)
Damien Millerdbd250f2000-01-18 08:57:14 +1100709AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +1100710AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +1100711
Damien Miller76112de1999-12-21 11:18:08 +1100712dnl Check for mail directory (last resort if we cannot get it from headers)
713if test ! -z "$MAIL" ; then
714 maildir=`dirname $MAIL`
715 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
716fi
Damien Millerc6b3bbe1999-12-13 08:27:33 +1100717
Damien Miller7f6ea021999-10-28 13:25:17 +1000718AC_OUTPUT(Makefile)