blob: 615a8dac37ee6ed95f2a8024afcf0fac3c722de5 [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 Miller07278932000-01-22 14:05:37 +1100106 MANTYPE='$(CATMAN)'
Damien Miller1808f382000-01-06 12:03:12 +1100107 no_libsocket=1
108 no_libnsl=1
109 ;;
110*-*-irix6*)
Damien Miller07278932000-01-22 14:05:37 +1100111 MANTYPE='$(CATMAN)'
112 AC_MSG_WARN([*** Irix 6.x is not tested, please report you experiences *** ])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100113 no_libsocket=1
114 no_libnsl=1
115 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100116*-*-linux*)
117 no_dev_ptmx=1
118 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100119*-*-netbsd*)
120 if test "$GOT_SSL" = "yes"; then
121 LDFLAGS="$LDFLAGS -R$ssldir/lib"
122 fi
123 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100124*-*-solaris*)
125 AC_DEFINE(USE_UTMPX)
126 ;;
127*-*-sysv*)
Damien Miller0e1cf7c2000-01-26 12:15:30 +1100128 AC_DEFINE(USE_UTMPX)
129 MANTYPE='$(CATMAN)'
130 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +1100131 LIBS="$LIBS -lgen -lsocket"
132 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100133esac
134
Damien Millerc7b38ce1999-11-09 10:28:04 +1100135dnl Check for RSAref library.
136AC_MSG_CHECKING([for RSAref library])
137saved_LIBS="$LIBS"
138LIBS="$saved_LIBS -lRSAglue -lrsaref"
139AC_TRY_LINK([], [],
Damien Millerd00d1611999-12-29 10:17:09 +1100140[AC_MSG_RESULT(yes);
141 AC_DEFINE(RSAREF)],
Damien Millerc7b38ce1999-11-09 10:28:04 +1100142[AC_MSG_RESULT(no)]; LIBS="$saved_LIBS")
Damien Miller7f6ea021999-10-28 13:25:17 +1000143
Damien Millerab18c411999-11-11 10:40:23 +1100144dnl Checks for libraries.
145AC_CHECK_LIB(crypto, CRYPTO_lock, ,AC_MSG_ERROR([*** libcrypto missing - please install first ***]))
146AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
147AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Millerab18c411999-11-11 10:40:23 +1100148
Damien Millerbeb4ba51999-12-28 15:09:35 +1100149if test -z "$no_libsocket" ; then
150 AC_CHECK_LIB(nsl, yp_match, , )
151fi
152if test -z "$no_libnsl" ; then
153 AC_CHECK_LIB(socket, main, , )
Damien Miller32b3cf21999-12-26 10:21:48 +1100154fi
Damien Millerab18c411999-11-11 10:40:23 +1100155
Damien Miller7f6ea021999-10-28 13:25:17 +1000156dnl Checks for header files.
Damien Miller670a4b82000-01-22 13:53:11 +1100157AC_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 +1100158
Damien Millercedfecc1999-11-15 14:36:53 +1100159dnl Checks for library functions.
Damien Miller834171e2000-01-17 09:59:41 +1100160AC_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 +1100161
Damien Miller04f80141999-11-19 15:32:34 +1100162AC_CHECK_FUNC(login,
163 [AC_DEFINE(HAVE_LOGIN)],
164 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
165)
166
167AC_CHECK_FUNC(daemon,
168 [AC_DEFINE(HAVE_DAEMON)],
169 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
170)
171
Damien Millerc6398ef1999-11-20 12:18:40 +1100172dnl Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100173AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100174AC_CHECK_SIZEOF(short int, 2)
175AC_CHECK_SIZEOF(int, 4)
176AC_CHECK_SIZEOF(long int, 4)
177AC_CHECK_SIZEOF(long long int, 8)
178
179dnl More checks for data types
Damien Miller859cec01999-11-22 14:27:24 +1100180AC_MSG_CHECKING([for intXX_t types])
Damien Millerc6398ef1999-11-20 12:18:40 +1100181AC_TRY_COMPILE(
182 [#include <sys/types.h>],
183 [int16_t a; int32_t b; a = 1235; b = 1235;],
184 [
185 AC_DEFINE(HAVE_INTXX_T)
186 AC_MSG_RESULT(yes)
Damien Millerb29ea912000-01-15 14:12:03 +1100187 have_intxx_t=1
Damien Millerc6398ef1999-11-20 12:18:40 +1100188 ],
189 [AC_MSG_RESULT(no)]
190)
191
Damien Miller859cec01999-11-22 14:27:24 +1100192AC_MSG_CHECKING([for u_intXX_t types])
Damien Millerc6398ef1999-11-20 12:18:40 +1100193AC_TRY_COMPILE(
194 [#include <sys/types.h>],
195 [u_int16_t c; u_int32_t d; c = 1235; d = 1235;],
196 [
197 AC_DEFINE(HAVE_U_INTXX_T)
198 AC_MSG_RESULT(yes)
Damien Millerb29ea912000-01-15 14:12:03 +1100199 have_u_intxx_t=1
Damien Millerc6398ef1999-11-20 12:18:40 +1100200 ],
201 [AC_MSG_RESULT(no)]
202)
203
Damien Millereaf99942000-01-19 13:45:07 +1100204if test -z "$have_u_intxx_t" -o -z "$have_intxx_t" -a \
Damien Millerb29ea912000-01-15 14:12:03 +1100205 "x$ac_cv_header_sys_bitypes_h" = "xyes"
206then
207 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
208 AC_TRY_COMPILE(
209 [#include <sys/bitypes.h>],
210 [
211 u_int16_t c; u_int32_t d;
212 int16_t e; int32_t f;
213 c = 1235; d = 1235;
214 e = 1235; f = 1235;
215 ],
216 [
217 AC_DEFINE(HAVE_U_INTXX_T)
218 AC_DEFINE(HAVE_INTXX_T)
219 AC_MSG_RESULT(yes)
220 ],
221 [AC_MSG_RESULT(no)]
222 )
223fi
224
Damien Miller34132e52000-01-14 15:45:46 +1100225AC_MSG_CHECKING([for uintXX_t types])
Damien Millerc6398ef1999-11-20 12:18:40 +1100226AC_TRY_COMPILE(
227 [#include <sys/types.h>],
228 [uint16_t c; uint32_t d; c = 1235; d = 1235;],
229 [
230 AC_DEFINE(HAVE_UINTXX_T)
231 AC_MSG_RESULT(yes)
232 ],
233 [AC_MSG_RESULT(no)]
234)
235
Damien Miller34132e52000-01-14 15:45:46 +1100236AC_MSG_CHECKING([for socklen_t])
Damien Miller74d0d4a1999-12-29 02:24:35 +1100237AC_TRY_COMPILE(
Damien Millerf3e8be81999-12-31 08:59:04 +1100238 [
239 #include <sys/types.h>
240 #include <sys/socket.h>
241 ],
Damien Miller74d0d4a1999-12-29 02:24:35 +1100242 [socklen_t foo; foo = 1235;],
243 [
244 AC_DEFINE(HAVE_SOCKLEN_T)
245 AC_MSG_RESULT(yes)
246 ],
247 [AC_MSG_RESULT(no)]
248)
249
Damien Miller34132e52000-01-14 15:45:46 +1100250AC_MSG_CHECKING([for size_t])
Damien Miller95058511999-12-29 10:36:45 +1100251AC_TRY_COMPILE(
252 [#include <sys/types.h>],
Damien Miller95058511999-12-29 10:36:45 +1100253 [size_t foo; foo = 1235;],
254 [
255 AC_DEFINE(HAVE_SIZE_T)
256 AC_MSG_RESULT(yes)
257 ],
258 [AC_MSG_RESULT(no)]
259)
260
Damien Miller34132e52000-01-14 15:45:46 +1100261AC_MSG_CHECKING([for struct sockaddr_storage])
262AC_TRY_COMPILE(
Damien Miller66409952000-01-17 21:40:06 +1100263 [
264 #include <sys/types.h>
265 #include <sys/socket.h>
266 ],
Damien Miller34132e52000-01-14 15:45:46 +1100267 [struct sockaddr_storage s;],
268 [
269 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
270 AC_MSG_RESULT(yes)
271 ],
272 [AC_MSG_RESULT(no)]
273)
274
275AC_MSG_CHECKING([for struct sockaddr_in6])
276AC_TRY_COMPILE(
277 [#include <netinet/in.h>],
278 [struct sockaddr_in6 s; s.sin6_family = 0;],
279 [
280 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
281 AC_MSG_RESULT(yes)
282 ],
283 [AC_MSG_RESULT(no)]
284)
285
286AC_MSG_CHECKING([for struct in6_addr])
287AC_TRY_COMPILE(
288 [#include <netinet/in.h>],
289 [struct in6_addr s; s.s6_addr[0] = 0;],
290 [
291 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
292 AC_MSG_RESULT(yes)
293 ],
294 [AC_MSG_RESULT(no)]
295)
296
297AC_MSG_CHECKING([for struct addrinfo])
298AC_TRY_COMPILE(
299 [
Damien Miller66409952000-01-17 21:40:06 +1100300 #include <sys/types.h>
Damien Miller34132e52000-01-14 15:45:46 +1100301 #include <sys/socket.h>
302 #include <netdb.h>
303 ],
304 [struct addrinfo s; s.ai_flags = AI_PASSIVE;],
305 [
306 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
307 AC_MSG_RESULT(yes)
308 ],
309 [AC_MSG_RESULT(no)]
310)
311
Damien Millerbeb4ba51999-12-28 15:09:35 +1100312AC_ARG_WITH(pam,
313 [ --without-pam Disable PAM support ],
Damien Miller859cec01999-11-22 14:27:24 +1100314 [
Damien Millerbeb4ba51999-12-28 15:09:35 +1100315 if test "x$withval" = "xno" ; then
316 no_pam=1
317 AC_DEFINE(DISABLE_PAM)
318 fi
Damien Miller859cec01999-11-22 14:27:24 +1100319 ]
Damien Millerbeb4ba51999-12-28 15:09:35 +1100320)
321
322if test -z "$no_pam" -a "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
323 AC_CHECK_LIB(dl, dlopen, , )
324 LIBS="$LIBS -lpam"
325 dnl Check PAM strerror arguments
326 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
327 AC_TRY_COMPILE(
328 [
329 #include <stdlib.h>
330 #include <security/pam_appl.h>
331 ],
332 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
333 [AC_MSG_RESULT(no)],
334 [
335 AC_DEFINE(HAVE_OLD_PAM)
336 AC_MSG_RESULT(yes)
337 ]
338 )
339fi
Damien Miller859cec01999-11-22 14:27:24 +1100340
Damien Miller98ac0071999-11-25 13:19:55 +1100341AC_MSG_CHECKING([whether to build GNOME ssh-askpass])
342dnl Check whether user wants GNOME ssh-askpass
343AC_ARG_WITH(gnome-askpass,
344 [ --with-gnome-askpass Build the GNOME passphrase requester (default=no)],
Damien Millercedfecc1999-11-15 14:36:53 +1100345 [
346 if test x$withval = xno ; then
Damien Miller98ac0071999-11-25 13:19:55 +1100347 GNOME_ASKPASS="";
Damien Millercedfecc1999-11-15 14:36:53 +1100348 else
Damien Miller98ac0071999-11-25 13:19:55 +1100349 GNOME_ASKPASS="gnome-ssh-askpass";
Damien Millercedfecc1999-11-15 14:36:53 +1100350 fi
Damien Miller98ac0071999-11-25 13:19:55 +1100351 ])
352AC_SUBST(GNOME_ASKPASS)
353
354if test -z "$GNOME_ASKPASS" ; then
Damien Millercedfecc1999-11-15 14:36:53 +1100355 AC_MSG_RESULT(no)
Damien Miller98ac0071999-11-25 13:19:55 +1100356else
357 AC_MSG_RESULT(yes)
Damien Millercedfecc1999-11-15 14:36:53 +1100358fi
Damien Millere0d444c1999-11-09 14:23:45 +1100359
Damien Millerab18c411999-11-11 10:40:23 +1100360dnl Check for user-specified random device
361AC_ARG_WITH(random,
Damien Millercedfecc1999-11-15 14:36:53 +1100362 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
Damien Millerab18c411999-11-11 10:40:23 +1100363 [
364 RANDOM_POOL="$withval";
Damien Miller0a6e6681999-11-15 09:56:06 +1100365 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
Damien Millerab18c411999-11-11 10:40:23 +1100366 ],
367 [
368 dnl Check for random device
369 AC_CHECK_FILE("/dev/urandom",
370 [
371 RANDOM_POOL="/dev/urandom";
Damien Millera82feb31999-11-11 11:04:17 +1100372 AC_SUBST(RANDOM_POOL)
373 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
Damien Millerab18c411999-11-11 10:40:23 +1100374 ]
375 )
376 ]
377)
378
379dnl Check for EGD pool file
380AC_ARG_WITH(egd-pool,
Damien Millercedfecc1999-11-15 14:36:53 +1100381 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
Damien Millerab18c411999-11-11 10:40:23 +1100382 [
383 RANDOM_POOL="$withval";
384 AC_DEFINE(HAVE_EGD)
Damien Millera82feb31999-11-11 11:04:17 +1100385 AC_SUBST(RANDOM_POOL)
386 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
Damien Millerab18c411999-11-11 10:40:23 +1100387 ]
388)
389
Damien Millercedfecc1999-11-15 14:36:53 +1100390dnl Make sure we have random number support
Damien Millerab18c411999-11-11 10:40:23 +1100391if test -z "$RANDOM_POOL" -a -z "$EGD_POOL"; then
392 AC_MSG_ERROR([No random device found, and no EGD random pool specified])
393fi
394
Damien Miller3f905871999-11-15 17:10:57 +1100395AC_MSG_CHECKING([whether utmp.h has ut_host field])
396AC_EGREP_HEADER(ut_host, utmp.h,
397 [AC_DEFINE(HAVE_HOST_IN_UTMP) AC_MSG_RESULT(yes); ],
398 [AC_MSG_RESULT(no)]
399)
Damien Millerbf1c9b21999-12-09 10:16:54 +1100400AC_MSG_CHECKING([whether utmpx.h has ut_host field])
401AC_EGREP_HEADER(ut_host, utmpx.h,
402 [AC_DEFINE(HAVE_HOST_IN_UTMPX) AC_MSG_RESULT(yes); ],
403 [AC_MSG_RESULT(no)]
404)
Damien Miller2e1b0821999-12-25 10:11:29 +1100405AC_MSG_CHECKING([whether utmpx.h has syslen field])
406AC_EGREP_HEADER(syslen, utmpx.h,
407 [AC_DEFINE(HAVE_SYSLEN_IN_UTMPX) AC_MSG_RESULT(yes); ],
408 [AC_MSG_RESULT(no)]
409)
Damien Miller4ff2b9b1999-12-28 10:41:12 +1100410AC_MSG_CHECKING([whether utmp.h has ut_pid field])
411AC_EGREP_HEADER(ut_pid, utmp.h,
412 [AC_DEFINE(HAVE_PID_IN_UTMP) AC_MSG_RESULT(yes); ],
413 [AC_MSG_RESULT(no)]
414)
415AC_MSG_CHECKING([whether utmp.h has ut_type field])
416AC_EGREP_HEADER(ut_type, utmp.h,
417 [AC_DEFINE(HAVE_TYPE_IN_UTMP) AC_MSG_RESULT(yes); ],
418 [AC_MSG_RESULT(no)]
419)
420AC_MSG_CHECKING([whether utmp.h has ut_tv field])
421AC_EGREP_HEADER(ut_tv, utmp.h,
422 [AC_DEFINE(HAVE_TV_IN_UTMP) AC_MSG_RESULT(yes); ],
423 [AC_MSG_RESULT(no)]
424)
Damien Miller9550a761999-12-29 02:32:22 +1100425AC_MSG_CHECKING([whether utmp.h has ut_id field])
426AC_EGREP_HEADER(ut_id, utmp.h,
427 [AC_DEFINE(HAVE_ID_IN_UTMP) AC_MSG_RESULT(yes); ],
428 [AC_MSG_RESULT(no)]
429)
Damien Miller3131d8b1999-12-31 09:42:24 +1100430AC_MSG_CHECKING([whether utmp.h has ut_addr field])
431AC_EGREP_HEADER(ut_addr, utmp.h,
432 [AC_DEFINE(HAVE_ADDR_IN_UTMP) AC_MSG_RESULT(yes); ],
433 [AC_MSG_RESULT(no)]
434)
435AC_MSG_CHECKING([whether utmpx.h has ut_addr field])
436AC_EGREP_HEADER(ut_addr, utmpx.h,
Damien Miller34132e52000-01-14 15:45:46 +1100437 [AC_DEFINE(HAVE_ADDR_IN_UTMPX) AC_MSG_RESULT(yes); ],
438 [AC_MSG_RESULT(no)]
439)
440AC_MSG_CHECKING([whether utmp.h has ut_addr_v6 field])
441AC_EGREP_HEADER(ut_addr_v6, utmp.h,
442 [AC_DEFINE(HAVE_ADDR_V6_IN_UTMP) AC_MSG_RESULT(yes); ],
443 [AC_MSG_RESULT(no)]
444)
445AC_MSG_CHECKING([whether utmpx.h has ut_addr_v6 field])
446AC_EGREP_HEADER(ut_addr_v6, utmpx.h,
447 [AC_DEFINE(HAVE_ADDR_V6_IN_UTMPX) AC_MSG_RESULT(yes); ],
448 [AC_MSG_RESULT(no)]
449)
450
451AC_MSG_CHECKING([whether struct sockaddr_storage has ss_family field])
452AC_TRY_COMPILE(
Damien Miller66409952000-01-17 21:40:06 +1100453 [
454 #include <sys/types.h>
455 #include <sys/socket.h>
456 ],
Damien Miller34132e52000-01-14 15:45:46 +1100457 [struct sockaddr_storage s; s.ss_family = 1;],
458 [
459 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
460 AC_MSG_RESULT(yes)
461 ],
462 [AC_MSG_RESULT(no)]
463)
464AC_MSG_CHECKING([whether struct sockaddr_storage has __ss_family field])
465AC_TRY_COMPILE(
Damien Miller66409952000-01-17 21:40:06 +1100466 [
467 #include <sys/types.h>
468 #include <sys/socket.h>
469 ],
Damien Miller34132e52000-01-14 15:45:46 +1100470 [struct sockaddr_storage s; s.__ss_family = 1;],
471 [
472 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
473 AC_MSG_RESULT(yes)
474 ],
Damien Miller3131d8b1999-12-31 09:42:24 +1100475 [AC_MSG_RESULT(no)]
476)
Damien Millerbf1c9b21999-12-09 10:16:54 +1100477
Damien Miller3f905871999-11-15 17:10:57 +1100478dnl Look for lastlog location
Damien Miller76112de1999-12-21 11:18:08 +1100479AC_ARG_WITH(lastlog,
Damien Miller5a3e6831999-12-27 09:48:56 +1100480 [ --with-lastlog=FILE Location of lastlog file],
Damien Miller76112de1999-12-21 11:18:08 +1100481 [
482 if test "x$withval" = "xno" ; then
483 AC_DEFINE(DISABLE_LASTLOG)
484 else
485 AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$withval")
486 fi
487 ],
488 [
489 AC_MSG_CHECKING([location of lastlog file])
490 for lastlog in /var/log/lastlog /var/adm/lastlog /etc/security/lastlog ; do
491 if test -f $lastlog ; then
492 gotlastlog="file"
493 break
494 fi
495 if test -d $lastlog ; then
496 gotlastlog="dir"
497 break
498 fi
499 done
500 if test -z "$gotlastlog" ; then
Damien Millerbeb4ba51999-12-28 15:09:35 +1100501 AC_MSG_RESULT(not found)
Damien Miller76112de1999-12-21 11:18:08 +1100502 nolastlog=1
503 else
504 if test "x$gotlastlog" = "xdir" ; then
Damien Millerbeb4ba51999-12-28 15:09:35 +1100505 AC_MSG_RESULT(${lastlog}/)
Damien Miller76112de1999-12-21 11:18:08 +1100506 AC_DEFINE(LASTLOG_IS_DIR)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100507 else
508 AC_MSG_RESULT($lastlog)
509 AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$lastlog")
Damien Miller76112de1999-12-21 11:18:08 +1100510 fi
Damien Miller76112de1999-12-21 11:18:08 +1100511 fi
512 ]
513)
514
515if test ! -z "$nolastlog" ; then
516 AC_MSG_WARN([*** Disabling lastlog support *** ])
517 AC_DEFINE(DISABLE_LASTLOG)
518fi
Damien Miller3f905871999-11-15 17:10:57 +1100519
Damien Miller8bdeee21999-12-30 15:50:54 +1100520dnl Compile with dante SOCKS library
521AC_ARG_WITH(dante,
522 [ --with-dante=DIR Use Dante SOCKS lib (default is system library path)],
523 [
Damien Miller1fa154b2000-01-23 10:32:03 +1100524 SAVELIBS="$LIBS"
525 SOCKSLIBS=""
526 SOCKSLIBPATH=""
Damien Miller8bdeee21999-12-30 15:50:54 +1100527 if test "x$withval" != "xno" ; then
528 if test -n $withval ; then
529 LIBS="$LIBS -L$withval"
Damien Miller1fa154b2000-01-23 10:32:03 +1100530 SOCKSLIBPATH="-L$withval"
Damien Miller8bdeee21999-12-30 15:50:54 +1100531 fi
Damien Miller1fa154b2000-01-23 10:32:03 +1100532 AC_CHECK_LIB(socks, Rconnect, AC_DEFINE(HAVE_DANTE) SOCKSLIBS="$SOCKSLIBPATH -lsocks")
Damien Miller8bdeee21999-12-30 15:50:54 +1100533 fi
Damien Miller1fa154b2000-01-23 10:32:03 +1100534 LIBS="$SAVELIBS $SOCKSLIBS"
535 ]
536)
537
538dnl Compile with SOCKS4 SOCKS library
539AC_ARG_WITH(socks4,
540 [ --with-socks4=DIR Use Socks4 SOCKS lib (default is system library path)],
541 [
542 SAVELIBS="$LIBS"
543 SOCKSLIBS=""
544 SOCKSLIBPATH=""
545 if test "x$withval" != "xno" ; then
546 if test -n $withval ; then
547 LIBS="$LIBS -L$withval"
548 SOCKSLIBPATH="-L$withval"
549 fi
550 AC_CHECK_LIB(socks, Rconnect, AC_DEFINE(HAVE_SOCKS4) SOCKSLIBS="$SOCKSLIBPATH -lsocks")
551 fi
552 LIBS="$SAVELIBS $SOCKSLIBS"
553 ]
554)
555
556dnl Compile with SOCKS5 SOCKS library
557AC_ARG_WITH(socks5,
558 [ --with-socks5=DIR Use Socks5 SOCKS lib (default is system library path)],
559 [
560 SAVELIBS="$LIBS"
561 SOCKSLIBS=""
562 SOCKSLIBPATH=""
563 if test "x$withval" != "xno" ; then
564 if test -n $withval ; then
565 LIBS="$LIBS -L$withval"
566 SOCKSLIBPATH="-L$withval"
567 fi
568 AC_CHECK_LIB(socks5, SOCKSconnect, AC_DEFINE(HAVE_SOCKS5) SOCKSLIBS="$SOCKSLIBPATH -lsocks5")
569 fi
570 LIBS="$SAVELIBS $SOCKSLIBS"
Damien Miller8bdeee21999-12-30 15:50:54 +1100571 ]
572)
Damien Miller670a4b82000-01-22 13:53:11 +1100573AC_ARG_WITH(catman,
574 [ --with-catman=man|cat Install preformatted manpages[no]],
575 [
576 MANTYPE='$(CATMAN)'
577 if test x"$withval" != x"yes" ; then
578 mansubdir=$withval
579 else
580 mansubdir=cat
581 fi
582 ], [
583 if test -z "$MANTYPE" ; then
584 MANTYPE='$(TROFFMAN)'
585 mansubdir=man
586 fi
587 ]
588)
589AC_SUBST(MANTYPE)
590AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +1100591
Damien Miller62a52ef2000-01-16 23:03:56 +1100592if test -z "$no_dev_ptmx" ; then
Damien Millerb29ea912000-01-15 14:12:03 +1100593 AC_CHECK_FILE("/dev/ptmx", AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX))
594fi
Damien Miller037a0dc1999-12-07 15:38:31 +1100595AC_CHECK_FILE("/dev/ptc", AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC))
596
Damien Miller3f905871999-11-15 17:10:57 +1100597AC_MSG_CHECKING([whether libc defines __progname])
598AC_TRY_LINK([],
Damien Miller04f80141999-11-19 15:32:34 +1100599 [extern char *__progname; printf("%s", __progname);],
Damien Miller3f905871999-11-15 17:10:57 +1100600 [
601 AC_DEFINE(HAVE___PROGNAME)
602 AC_MSG_RESULT(yes)
603 ],
604 [
605 AC_MSG_RESULT(no)
606 ]
607)
608
Damien Miller80297751999-11-19 13:03:25 +1100609dnl Check whether user wants Kerberos support
610AC_ARG_WITH(kerberos4,
Damien Miller105b7f02000-01-07 08:45:55 +1100611 [ --with-kerberos4=PATH Enable Kerberos 4 support],
Damien Miller80297751999-11-19 13:03:25 +1100612 [
Damien Miller8bdeee21999-12-30 15:50:54 +1100613 if test "x$withval" != "$xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +1100614
615 if test "x$withval" != "$xyes" ; then
616 CFLAGS="$CFLAGS -I${withval}/include"
617 LDFLAGS="$LDFLAGS -L${withval}/lib"
618 else
619 if test -d /usr/include/kerberosIV ; then
620 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
621 fi
622 fi
623
624 AC_CHECK_HEADERS(krb.h)
625 AC_CHECK_LIB(krb, main)
626 if test "$ac_cv_header_krb_h" != yes; then
627 AC_MSG_WARN([Cannot find krb.h, build may fail])
628 fi
629 if test "$ac_cv_lib_krb_main" != yes; then
630 AC_MSG_WARN([Cannot find libkrb, build may fail])
631 fi
632
633 LIBS="$LIBS -lkrb -ldes"
634 AC_CHECK_LIB(resolv, dn_expand, , )
635 KRB4=yes
Damien Miller8bdeee21999-12-30 15:50:54 +1100636 AC_DEFINE(KRB4)
Damien Miller8bdeee21999-12-30 15:50:54 +1100637 fi
Damien Miller80297751999-11-19 13:03:25 +1100638 ]
639)
640
641dnl Check whether user wants AFS support
Damien Millerc6398ef1999-11-20 12:18:40 +1100642AC_ARG_WITH(afs,
Damien Miller105b7f02000-01-07 08:45:55 +1100643 [ --with-afs=PATH Enable AFS support],
Damien Miller80297751999-11-19 13:03:25 +1100644 [
Damien Miller8bdeee21999-12-30 15:50:54 +1100645 if test "x$withval" != "$xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +1100646
647 if test "x$withval" != "$xyes" ; then
648 CFLAGS="$CFLAGS -I${withval}/include"
649 LFLAGS="$LFLAGS -L${withval}/lib"
650 fi
651
652 if test -z "$KRB4" ; then
653 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
654 fi
655
Damien Miller8bdeee21999-12-30 15:50:54 +1100656 LIBS="$LIBS -lkafs"
Damien Miller105b7f02000-01-07 08:45:55 +1100657 if test ! -z "$AFS_LIBS" ; then
658 LIBS="$LIBS $AFS_LIBS"
659 fi
660 AC_DEFINE(AFS)
Damien Miller8bdeee21999-12-30 15:50:54 +1100661 fi
Damien Miller80297751999-11-19 13:03:25 +1100662 ]
663)
664
665dnl Check whether user wants S/Key support
666AC_ARG_WITH(skey,
667 [ --with-skey Enable S/Key support],
668 [
Damien Miller8bdeee21999-12-30 15:50:54 +1100669 if test "x$withval" != "$xno" ; then
670 AC_DEFINE(SKEY)
671 LIBS="$LIBS -lskey"
672 fi
Damien Miller80297751999-11-19 13:03:25 +1100673 ]
674)
675
676dnl Check whether user wants TCP wrappers support
Damien Millerf7c0f821999-11-22 22:31:49 +1100677AC_ARG_WITH(tcp-wrappers,
Damien Miller80297751999-11-19 13:03:25 +1100678 [ --with-tcp-wrappers Enable tcpwrappers support],
679 [
Damien Miller8bdeee21999-12-30 15:50:54 +1100680 if test "x$withval" != "$xno" ; then
681 AC_DEFINE(LIBWRAP)
Damien Miller105b7f02000-01-07 08:45:55 +1100682 LIBS="$LIBS -lwrap"
Damien Miller8bdeee21999-12-30 15:50:54 +1100683 fi
Damien Miller80297751999-11-19 13:03:25 +1100684 ]
685)
686
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100687dnl Check whether to enable MD5 passwords
Damien Millerf7c0f821999-11-22 22:31:49 +1100688AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100689 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +1100690 [
691 if test "x$withval" != "$xno" ; then
692 AC_DEFINE(HAVE_MD5_PASSWORDS)
693 fi
694 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100695)
696
Damien Miller368cf641999-12-21 09:51:36 +1100697dnl Check whether to enable utmpx support
698AC_ARG_WITH(utmpx,
699 [ --with-utmpx Enable utmpx support],
Damien Miller76112de1999-12-21 11:18:08 +1100700 [
701 if test "x$withval" != "xno" ; then
702 AC_DEFINE(USE_UTMPX)
703 fi
704 ]
Damien Miller368cf641999-12-21 09:51:36 +1100705)
706
Damien Miller76112de1999-12-21 11:18:08 +1100707dnl Whether to disable shadow password support
708AC_ARG_WITH(shadow,
709 [ --without-shadow Disable shadow password support],
710 [
711 if test "x$withval" = "xno" ; then
712 AC_DEFINE(DISABLE_SHADOW)
713 fi
714 ]
715)
716
717dnl Use ip address instead of hostname in $DISPLAY
718AC_ARG_WITH(ipaddr-display,
719 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
720 [
Damien Miller66409952000-01-17 21:40:06 +1100721 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +1100722 AC_DEFINE(IPADDR_IN_DISPLAY)
723 fi
724 ]
725)
726
Damien Millere7f626c1999-12-31 09:49:44 +1100727AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +1100728 [ --with-default-path=PATH Specify default \$PATH environment for server],
729 [
730 if test "x$withval" != "xno" ; then
Damien Miller9550a761999-12-29 02:32:22 +1100731 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
Damien Miller5a3e6831999-12-27 09:48:56 +1100732 fi
733 ]
734)
735
Damien Miller7d80e342000-01-19 14:36:49 +1100736AC_ARG_WITH(ipv4-default,
737 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
738 [
739 if test "x$withval" != "xno" ; then
740 AC_DEFINE(IPV4_DEFAULT)
741 fi
742 ]
743)
744
Damien Millerb13c73e2000-01-17 22:02:17 +1100745piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +1100746AC_ARG_WITH(pid-dir,
747 [ --with-pid-dir=PATH Specify location of ssh.pid file],
748 [
749 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +1100750 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +1100751 fi
752 ]
753)
Damien Millerdbd250f2000-01-18 08:57:14 +1100754AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +1100755AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +1100756
Damien Miller76112de1999-12-21 11:18:08 +1100757dnl Check for mail directory (last resort if we cannot get it from headers)
758if test ! -z "$MAIL" ; then
759 maildir=`dirname $MAIL`
760 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
761fi
Damien Millerc6b3bbe1999-12-13 08:27:33 +1100762
Damien Miller7f6ea021999-10-28 13:25:17 +1000763AC_OUTPUT(Makefile)