blob: a7a2c699fed1644cf4a903845a2a1d6bc32f0936 [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
Damien Millera22ba012000-03-02 23:09:20 +11006# C Compiler features
7if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi
8AC_C_INLINE
9
10# Checks for programs.
Damien Miller7f6ea021999-10-28 13:25:17 +100011AC_PROG_CC
Damien Millerab18c411999-11-11 10:40:23 +110012AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100013AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110014AC_PROG_INSTALL
Damien Millerc7b38ce1999-11-09 10:28:04 +110015AC_CHECK_PROG(AR, ar, ar)
Damien Millere79334a1999-12-29 10:03:37 +110016AC_PATH_PROG(PERL, perl)
17AC_SUBST(PERL)
Damien Miller2e1b0821999-12-25 10:11:29 +110018
Damien Millera22ba012000-03-02 23:09:20 +110019# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110020case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110021*-*-aix*)
22 AFS_LIBS="-lld"
Damien Millereca71f82000-01-20 22:38:27 +110023 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Miller75b1d102000-01-07 14:01:41 +110024 ;;
Damien Miller76112de1999-12-21 11:18:08 +110025*-*-hpux10*)
26 if test -z "$GCC"; then
27 CFLAGS="$CFLAGS -Aa"
28 fi
29 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
30 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Miller2e1b0821999-12-25 10:11:29 +110031 AC_DEFINE(USE_UTMPX)
Damien Miller76112de1999-12-21 11:18:08 +110032 AC_MSG_CHECKING(for HPUX trusted system password database)
33 if test -f /tcb/files/auth/system/default; then
34 AC_MSG_RESULT(yes)
35 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
36 LIBS="$LIBS -lsec"
Damien Miller105b7f02000-01-07 08:45:55 +110037 AC_MSG_WARN([This configuration is untested])
Damien Miller76112de1999-12-21 11:18:08 +110038 else
39 AC_MSG_RESULT(no)
40 AC_DEFINE(DISABLE_SHADOW)
41 fi
Damien Miller670a4b82000-01-22 13:53:11 +110042 MANTYPE='$(CATMAN)'
43 mansubdir=cat
Damien Miller76112de1999-12-21 11:18:08 +110044 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +110045*-*-irix5*)
Damien Miller07278932000-01-22 14:05:37 +110046 MANTYPE='$(CATMAN)'
Damien Miller1808f382000-01-06 12:03:12 +110047 no_libsocket=1
48 no_libnsl=1
49 ;;
50*-*-irix6*)
Damien Miller07278932000-01-22 14:05:37 +110051 MANTYPE='$(CATMAN)'
52 AC_MSG_WARN([*** Irix 6.x is not tested, please report you experiences *** ])
Damien Millerbeb4ba51999-12-28 15:09:35 +110053 no_libsocket=1
54 no_libnsl=1
55 ;;
Damien Millerb29ea912000-01-15 14:12:03 +110056*-*-linux*)
57 no_dev_ptmx=1
58 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +110059*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +110060 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +110061 ;;
Damien Miller75b1d102000-01-07 14:01:41 +110062*-*-solaris*)
Damien Millera22ba012000-03-02 23:09:20 +110063 need_dash_r=1
Damien Miller9fb07e42000-03-05 16:22:59 +110064 LDFLAGS="-L/usr/ucblib"
Damien Miller75b1d102000-01-07 14:01:41 +110065 AC_DEFINE(USE_UTMPX)
66 ;;
67*-*-sysv*)
Damien Miller0e1cf7c2000-01-26 12:15:30 +110068 AC_DEFINE(USE_UTMPX)
69 MANTYPE='$(CATMAN)'
70 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +110071 LIBS="$LIBS -lgen -lsocket"
72 ;;
Damien Miller76112de1999-12-21 11:18:08 +110073esac
74
Damien Millera22ba012000-03-02 23:09:20 +110075# Checks for libraries.
Damien Millerab18c411999-11-11 10:40:23 +110076AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
77AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Millerab18c411999-11-11 10:40:23 +110078
Damien Millerbeb4ba51999-12-28 15:09:35 +110079if test -z "$no_libsocket" ; then
80 AC_CHECK_LIB(nsl, yp_match, , )
81fi
82if test -z "$no_libnsl" ; then
83 AC_CHECK_LIB(socket, main, , )
Damien Miller32b3cf21999-12-26 10:21:48 +110084fi
Damien Millerab18c411999-11-11 10:40:23 +110085
Damien Millera22ba012000-03-02 23:09:20 +110086# Checks for header files.
Damien Miller670a4b82000-01-22 13:53:11 +110087AC_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 +110088
Damien Millera22ba012000-03-02 23:09:20 +110089# Checks for library functions.
Damien Miller9fb07e42000-03-05 16:22:59 +110090AC_CHECK_FUNCS(arc4random bindresvport_af freeaddrinfo gai_strerror getaddrinfo 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 +110091
Damien Miller04f80141999-11-19 15:32:34 +110092AC_CHECK_FUNC(login,
93 [AC_DEFINE(HAVE_LOGIN)],
94 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
95)
96
97AC_CHECK_FUNC(daemon,
98 [AC_DEFINE(HAVE_DAEMON)],
99 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
100)
101
Damien Miller9fb07e42000-03-05 16:22:59 +1100102AC_CHECK_FUNC(getpagesize,
103 [AC_DEFINE(HAVE_GETPAGESIZE)],
104 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
105)
106
Damien Millera22ba012000-03-02 23:09:20 +1100107AC_ARG_WITH(pam,
108 [ --without-pam Disable PAM support ],
109 [
110 if test "x$withval" = "xno" ; then
111 no_pam=1
112 AC_DEFINE(DISABLE_PAM)
113 fi
114 ]
115)
116if test -z "$no_pam" -a "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
117 AC_CHECK_LIB(dl, dlopen, , )
118 LIBS="$LIBS -lpam"
119
120 # Check PAM strerror arguments (old PAM)
121 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
122 AC_TRY_COMPILE(
123 [
124 #include <stdlib.h>
125 #include <security/pam_appl.h>
126 ],
127 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
128 [AC_MSG_RESULT(no)],
129 [
130 AC_DEFINE(HAVE_OLD_PAM)
131 AC_MSG_RESULT(yes)
132 ]
133 )
134fi
135
136# The big search for OpenSSL
137AC_ARG_WITH(ssl-dir,
138 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
139 [
140 if test "x$withval" != "$xno" ; then
141 tryssldir=$withval
142 fi
143 ]
144)
145
146saved_LIBS="$LIBS"
147saved_CFLAGS="$CFLAGS"
148if test "x$prefix" != "xNONE" ; then
149 tryssldir="$tryssldir $prefix"
150fi
151AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
152for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
153 if test ! -z "$ssldir" ; then
Damien Millerb85dcad2000-03-11 11:37:00 +1100154 LIBS="$saved_LIBS -L$ssldir -lcrypto"
Damien Millera22ba012000-03-02 23:09:20 +1100155 CFLAGS="$CFLAGS -I$ssldir/include"
156 if test "x$need_dash_r" = "x1" ; then
Damien Miller1a07ebd2000-03-08 09:03:44 +1100157 LIBS="$LIBS -R$ssldir/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100158 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100159 else
160 LIBS="$saved_LIBS -lcrypto"
Damien Millera22ba012000-03-02 23:09:20 +1100161 fi
Damien Millera22ba012000-03-02 23:09:20 +1100162
Damien Millerb85dcad2000-03-11 11:37:00 +1100163 for WANTS_RSAREF in "" 1 ; do
164
165 if test ! -z "$WANTS_RSAREF" ; then
166 LIBS="$LIBS -lRSAglue -lrsaref"
167 fi
168
169 AC_TRY_RUN(
170 [
171 #include <openssl/rsa.h>
172 #include <openssl/bn.h>
173 #include <openssl/sha.h>
174 int main(void)
175 {RSA *key; char seed[2048];memset(seed, 0, sizeof(seed));
176 RAND_seed(seed, sizeof(seed));key=RSA_generate_key(32,3,NULL,NULL);
177 return(key==NULL);}
178 ],
179 [
180 AC_DEFINE(HAVE_OPENSSL)
181 found_crypto=1
182 break;
183 ], []
184 )
185 AC_TRY_RUN(
186 [
187 #include <ssl/rsa.h>
188 #include <ssl/bn.h>
189 #include <ssl/sha.h>
190 int main(void)
191 {RSA *key; char seed[2048];memset(seed, 0, sizeof(seed));
192 RAND_seed(seed, sizeof(seed));key=RSA_generate_key(32,3,NULL,NULL);
193 return(key==NULL);}
194 ],
195 [
196 AC_DEFINE(HAVE_SSL)
197 found_crypto=1
198 break;
199 ], []
200 )
201 done
202
203 if test ! -z "$found_crypto" ; then
204 break;
205 fi
Damien Millera22ba012000-03-02 23:09:20 +1100206done
207
208if test -z "$found_crypto" ; then
209 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
210fi
211if test -z "$ssldir" ; then
212 ssldir="(system)"
213else
214 CFLAGS="$CFLAGS -I$ssldir/include"
215 LDFLAGS="$LDFLAGS -L$ssldir/lib"
216 if test "x$need_dash_r" = "x1" ; then
217 LDFLAGS="$LDFLAGS -R$ssldir"
218 fi
219fi
220LIBS="$saved_LIBS -lcrypto"
Damien Millerb85dcad2000-03-11 11:37:00 +1100221if test ! -z $WANTS_RSAREF ; then
222 LIBS="$LIBS -lRSAglue -lrsaref"
223fi
Damien Millera22ba012000-03-02 23:09:20 +1100224AC_MSG_RESULT($ssldir)
225
226# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100227AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100228AC_CHECK_SIZEOF(short int, 2)
229AC_CHECK_SIZEOF(int, 4)
230AC_CHECK_SIZEOF(long int, 4)
231AC_CHECK_SIZEOF(long long int, 8)
232
Damien Millera22ba012000-03-02 23:09:20 +1100233# More checks for data types
Damien Miller859cec01999-11-22 14:27:24 +1100234AC_MSG_CHECKING([for intXX_t types])
Damien Millerc6398ef1999-11-20 12:18:40 +1100235AC_TRY_COMPILE(
236 [#include <sys/types.h>],
237 [int16_t a; int32_t b; a = 1235; b = 1235;],
238 [
239 AC_DEFINE(HAVE_INTXX_T)
240 AC_MSG_RESULT(yes)
Damien Millerb29ea912000-01-15 14:12:03 +1100241 have_intxx_t=1
Damien Millerc6398ef1999-11-20 12:18:40 +1100242 ],
243 [AC_MSG_RESULT(no)]
244)
245
Damien Miller859cec01999-11-22 14:27:24 +1100246AC_MSG_CHECKING([for u_intXX_t types])
Damien Millerc6398ef1999-11-20 12:18:40 +1100247AC_TRY_COMPILE(
248 [#include <sys/types.h>],
249 [u_int16_t c; u_int32_t d; c = 1235; d = 1235;],
250 [
251 AC_DEFINE(HAVE_U_INTXX_T)
252 AC_MSG_RESULT(yes)
Damien Millerb29ea912000-01-15 14:12:03 +1100253 have_u_intxx_t=1
Damien Millerc6398ef1999-11-20 12:18:40 +1100254 ],
255 [AC_MSG_RESULT(no)]
256)
257
Damien Millereaf99942000-01-19 13:45:07 +1100258if test -z "$have_u_intxx_t" -o -z "$have_intxx_t" -a \
Damien Millerb29ea912000-01-15 14:12:03 +1100259 "x$ac_cv_header_sys_bitypes_h" = "xyes"
260then
261 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
262 AC_TRY_COMPILE(
263 [#include <sys/bitypes.h>],
264 [
265 u_int16_t c; u_int32_t d;
266 int16_t e; int32_t f;
267 c = 1235; d = 1235;
268 e = 1235; f = 1235;
269 ],
270 [
271 AC_DEFINE(HAVE_U_INTXX_T)
272 AC_DEFINE(HAVE_INTXX_T)
273 AC_MSG_RESULT(yes)
274 ],
275 [AC_MSG_RESULT(no)]
276 )
277fi
278
Damien Miller34132e52000-01-14 15:45:46 +1100279AC_MSG_CHECKING([for uintXX_t types])
Damien Millerc6398ef1999-11-20 12:18:40 +1100280AC_TRY_COMPILE(
281 [#include <sys/types.h>],
282 [uint16_t c; uint32_t d; c = 1235; d = 1235;],
283 [
284 AC_DEFINE(HAVE_UINTXX_T)
285 AC_MSG_RESULT(yes)
286 ],
287 [AC_MSG_RESULT(no)]
288)
289
Damien Miller34132e52000-01-14 15:45:46 +1100290AC_MSG_CHECKING([for socklen_t])
Damien Miller74d0d4a1999-12-29 02:24:35 +1100291AC_TRY_COMPILE(
Damien Millerf3e8be81999-12-31 08:59:04 +1100292 [
293 #include <sys/types.h>
294 #include <sys/socket.h>
295 ],
Damien Miller74d0d4a1999-12-29 02:24:35 +1100296 [socklen_t foo; foo = 1235;],
297 [
298 AC_DEFINE(HAVE_SOCKLEN_T)
299 AC_MSG_RESULT(yes)
300 ],
301 [AC_MSG_RESULT(no)]
302)
303
Damien Miller34132e52000-01-14 15:45:46 +1100304AC_MSG_CHECKING([for size_t])
Damien Miller95058511999-12-29 10:36:45 +1100305AC_TRY_COMPILE(
306 [#include <sys/types.h>],
Damien Miller95058511999-12-29 10:36:45 +1100307 [size_t foo; foo = 1235;],
308 [
309 AC_DEFINE(HAVE_SIZE_T)
310 AC_MSG_RESULT(yes)
311 ],
312 [AC_MSG_RESULT(no)]
313)
314
Damien Miller34132e52000-01-14 15:45:46 +1100315AC_MSG_CHECKING([for struct sockaddr_storage])
316AC_TRY_COMPILE(
Damien Miller66409952000-01-17 21:40:06 +1100317 [
318 #include <sys/types.h>
319 #include <sys/socket.h>
320 ],
Damien Miller34132e52000-01-14 15:45:46 +1100321 [struct sockaddr_storage s;],
322 [
323 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
324 AC_MSG_RESULT(yes)
325 ],
326 [AC_MSG_RESULT(no)]
327)
328
329AC_MSG_CHECKING([for struct sockaddr_in6])
330AC_TRY_COMPILE(
331 [#include <netinet/in.h>],
332 [struct sockaddr_in6 s; s.sin6_family = 0;],
333 [
334 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
335 AC_MSG_RESULT(yes)
336 ],
337 [AC_MSG_RESULT(no)]
338)
339
340AC_MSG_CHECKING([for struct in6_addr])
341AC_TRY_COMPILE(
342 [#include <netinet/in.h>],
343 [struct in6_addr s; s.s6_addr[0] = 0;],
344 [
345 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
346 AC_MSG_RESULT(yes)
347 ],
348 [AC_MSG_RESULT(no)]
349)
350
351AC_MSG_CHECKING([for struct addrinfo])
352AC_TRY_COMPILE(
353 [
Damien Miller66409952000-01-17 21:40:06 +1100354 #include <sys/types.h>
Damien Miller34132e52000-01-14 15:45:46 +1100355 #include <sys/socket.h>
356 #include <netdb.h>
357 ],
358 [struct addrinfo s; s.ai_flags = AI_PASSIVE;],
359 [
360 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
361 AC_MSG_RESULT(yes)
362 ],
363 [AC_MSG_RESULT(no)]
364)
365
Damien Millera22ba012000-03-02 23:09:20 +1100366# Checks for structure members
Damien Miller3f905871999-11-15 17:10:57 +1100367AC_MSG_CHECKING([whether utmp.h has ut_host field])
368AC_EGREP_HEADER(ut_host, utmp.h,
369 [AC_DEFINE(HAVE_HOST_IN_UTMP) AC_MSG_RESULT(yes); ],
370 [AC_MSG_RESULT(no)]
371)
Damien Millerbf1c9b21999-12-09 10:16:54 +1100372AC_MSG_CHECKING([whether utmpx.h has ut_host field])
373AC_EGREP_HEADER(ut_host, utmpx.h,
374 [AC_DEFINE(HAVE_HOST_IN_UTMPX) AC_MSG_RESULT(yes); ],
375 [AC_MSG_RESULT(no)]
376)
Damien Miller2e1b0821999-12-25 10:11:29 +1100377AC_MSG_CHECKING([whether utmpx.h has syslen field])
378AC_EGREP_HEADER(syslen, utmpx.h,
379 [AC_DEFINE(HAVE_SYSLEN_IN_UTMPX) AC_MSG_RESULT(yes); ],
380 [AC_MSG_RESULT(no)]
381)
Damien Miller4ff2b9b1999-12-28 10:41:12 +1100382AC_MSG_CHECKING([whether utmp.h has ut_pid field])
383AC_EGREP_HEADER(ut_pid, utmp.h,
384 [AC_DEFINE(HAVE_PID_IN_UTMP) AC_MSG_RESULT(yes); ],
385 [AC_MSG_RESULT(no)]
386)
387AC_MSG_CHECKING([whether utmp.h has ut_type field])
388AC_EGREP_HEADER(ut_type, utmp.h,
389 [AC_DEFINE(HAVE_TYPE_IN_UTMP) AC_MSG_RESULT(yes); ],
390 [AC_MSG_RESULT(no)]
391)
392AC_MSG_CHECKING([whether utmp.h has ut_tv field])
393AC_EGREP_HEADER(ut_tv, utmp.h,
394 [AC_DEFINE(HAVE_TV_IN_UTMP) AC_MSG_RESULT(yes); ],
395 [AC_MSG_RESULT(no)]
396)
Damien Miller9550a761999-12-29 02:32:22 +1100397AC_MSG_CHECKING([whether utmp.h has ut_id field])
398AC_EGREP_HEADER(ut_id, utmp.h,
399 [AC_DEFINE(HAVE_ID_IN_UTMP) AC_MSG_RESULT(yes); ],
400 [AC_MSG_RESULT(no)]
401)
Damien Miller3131d8b1999-12-31 09:42:24 +1100402AC_MSG_CHECKING([whether utmp.h has ut_addr field])
403AC_EGREP_HEADER(ut_addr, utmp.h,
404 [AC_DEFINE(HAVE_ADDR_IN_UTMP) AC_MSG_RESULT(yes); ],
405 [AC_MSG_RESULT(no)]
406)
407AC_MSG_CHECKING([whether utmpx.h has ut_addr field])
408AC_EGREP_HEADER(ut_addr, utmpx.h,
Damien Miller34132e52000-01-14 15:45:46 +1100409 [AC_DEFINE(HAVE_ADDR_IN_UTMPX) AC_MSG_RESULT(yes); ],
410 [AC_MSG_RESULT(no)]
411)
412AC_MSG_CHECKING([whether utmp.h has ut_addr_v6 field])
413AC_EGREP_HEADER(ut_addr_v6, utmp.h,
414 [AC_DEFINE(HAVE_ADDR_V6_IN_UTMP) AC_MSG_RESULT(yes); ],
415 [AC_MSG_RESULT(no)]
416)
417AC_MSG_CHECKING([whether utmpx.h has ut_addr_v6 field])
418AC_EGREP_HEADER(ut_addr_v6, utmpx.h,
419 [AC_DEFINE(HAVE_ADDR_V6_IN_UTMPX) AC_MSG_RESULT(yes); ],
420 [AC_MSG_RESULT(no)]
421)
422
423AC_MSG_CHECKING([whether struct sockaddr_storage has ss_family field])
424AC_TRY_COMPILE(
Damien Miller66409952000-01-17 21:40:06 +1100425 [
426 #include <sys/types.h>
427 #include <sys/socket.h>
428 ],
Damien Miller34132e52000-01-14 15:45:46 +1100429 [struct sockaddr_storage s; s.ss_family = 1;],
430 [
431 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
432 AC_MSG_RESULT(yes)
433 ],
434 [AC_MSG_RESULT(no)]
435)
436AC_MSG_CHECKING([whether struct sockaddr_storage has __ss_family field])
437AC_TRY_COMPILE(
Damien Miller66409952000-01-17 21:40:06 +1100438 [
439 #include <sys/types.h>
440 #include <sys/socket.h>
441 ],
Damien Miller34132e52000-01-14 15:45:46 +1100442 [struct sockaddr_storage s; s.__ss_family = 1;],
443 [
444 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
445 AC_MSG_RESULT(yes)
446 ],
Damien Miller3131d8b1999-12-31 09:42:24 +1100447 [AC_MSG_RESULT(no)]
448)
Damien Millerbf1c9b21999-12-09 10:16:54 +1100449
Damien Millera22ba012000-03-02 23:09:20 +1100450AC_MSG_CHECKING([whether libc defines __progname])
451AC_TRY_LINK([],
452 [extern char *__progname; printf("%s", __progname);],
453 [
454 AC_DEFINE(HAVE___PROGNAME)
455 AC_MSG_RESULT(yes)
456 ],
457 [
458 AC_MSG_RESULT(no)
459 ]
460)
461
462# Looking for programs, paths and files
463AC_ARG_WITH(rsh,
464 [ --with-rsh=PATH Specify path to remote shell program ],
465 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100466 if test "x$withval" != "$no" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100467 AC_DEFINE_UNQUOTED(RSH_PATH, "$withval")
468 fi
469 ],
470 [
471 AC_PATH_PROG(rsh_path, rsh)
472 ]
473)
474
475AC_ARG_WITH(xauth,
476 [ --with-xauth=PATH Specify path to xauth program ],
477 [
478 if test "x$withval" != "$xno" ; then
479 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$withval")
480 fi
481 ],
482 [
483 AC_PATH_PROG(xauth_path, xauth)
484 if test ! -z "$xauth_path" -a -x "/usr/openwin/bin/xauth" ; then
485 xauth_path="/usr/openwin/bin/xauth"
486 fi
487 ]
488)
489
490if test ! -z "$xauth_path" ; then
491 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
492fi
493if test ! -z "$rsh_path" ; then
494 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
495fi
496
497# Check for mail directory (last resort if we cannot get it from headers)
498if test ! -z "$MAIL" ; then
499 maildir=`dirname $MAIL`
500 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
501fi
502
503# Look for lastlog location
Damien Miller76112de1999-12-21 11:18:08 +1100504AC_ARG_WITH(lastlog,
Damien Miller5a3e6831999-12-27 09:48:56 +1100505 [ --with-lastlog=FILE Location of lastlog file],
Damien Miller76112de1999-12-21 11:18:08 +1100506 [
507 if test "x$withval" = "xno" ; then
508 AC_DEFINE(DISABLE_LASTLOG)
509 else
510 AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$withval")
511 fi
512 ],
513 [
514 AC_MSG_CHECKING([location of lastlog file])
Damien Miller27f4c782000-01-27 18:22:13 +1100515 for lastlog in /var/log/lastlog /var/adm/lastlog /usr/adm/lastlog /etc/security/lastlog ; do
Damien Miller76112de1999-12-21 11:18:08 +1100516 if test -f $lastlog ; then
517 gotlastlog="file"
518 break
519 fi
520 if test -d $lastlog ; then
521 gotlastlog="dir"
522 break
523 fi
524 done
525 if test -z "$gotlastlog" ; then
Damien Millerbeb4ba51999-12-28 15:09:35 +1100526 AC_MSG_RESULT(not found)
Damien Miller76112de1999-12-21 11:18:08 +1100527 nolastlog=1
528 else
529 if test "x$gotlastlog" = "xdir" ; then
Damien Millerbeb4ba51999-12-28 15:09:35 +1100530 AC_MSG_RESULT(${lastlog}/)
Damien Miller76112de1999-12-21 11:18:08 +1100531 AC_DEFINE(LASTLOG_IS_DIR)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100532 else
533 AC_MSG_RESULT($lastlog)
534 AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$lastlog")
Damien Miller76112de1999-12-21 11:18:08 +1100535 fi
Damien Miller76112de1999-12-21 11:18:08 +1100536 fi
537 ]
538)
539
540if test ! -z "$nolastlog" ; then
541 AC_MSG_WARN([*** Disabling lastlog support *** ])
542 AC_DEFINE(DISABLE_LASTLOG)
543fi
Damien Miller3f905871999-11-15 17:10:57 +1100544
Damien Millera22ba012000-03-02 23:09:20 +1100545if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +1100546 AC_CHECK_FILE("/dev/ptmx",
547 [
548 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
549 have_dev_ptmx=1
550 ]
551 )
Damien Millera22ba012000-03-02 23:09:20 +1100552fi
Damien Miller204ad072000-03-02 23:56:12 +1100553AC_CHECK_FILE("/dev/ptc",
554 [
555 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
556 have_dev_ptc=1
557 ]
558)
559
Damien Millera22ba012000-03-02 23:09:20 +1100560# Options from here on. Some of these are preset by platform above
561
562# Check whether user wants GNOME ssh-askpass
563AC_MSG_CHECKING([whether to build GNOME ssh-askpass])
564AC_ARG_WITH(gnome-askpass,
565 [ --with-gnome-askpass Build the GNOME passphrase requester (default=no)],
566 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100567 if test "x$withval" = "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100568 GNOME_ASKPASS="";
569 else
570 GNOME_ASKPASS="gnome-ssh-askpass";
571 fi
572 ])
573AC_SUBST(GNOME_ASKPASS)
574
575if test -z "$GNOME_ASKPASS" ; then
576 AC_MSG_RESULT(no)
577else
578 AC_MSG_RESULT(yes)
579fi
580
581# Check for user-specified random device, otherwise check /dev/urandom
582AC_ARG_WITH(random,
583 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
584 [
585 RANDOM_POOL="$withval";
586 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
587 ],
588 [
589 # Check for random device
590 AC_CHECK_FILE("/dev/urandom",
591 [
592 RANDOM_POOL="/dev/urandom";
593 AC_SUBST(RANDOM_POOL)
594 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
595 ]
596 )
597 ]
598)
599
600# Check for EGD pool file
601AC_ARG_WITH(egd-pool,
602 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
603 [
604 RANDOM_POOL="$withval";
605 AC_DEFINE(HAVE_EGD)
606 AC_SUBST(RANDOM_POOL)
607 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
608 ]
609)
610
611# Make sure we have some random number support
612if test -z "$RANDOM_POOL" -a -z "$EGD_POOL"; then
613 AC_MSG_ERROR([No random device found, and no EGD random pool specified])
614fi
615
Damien Miller670a4b82000-01-22 13:53:11 +1100616AC_ARG_WITH(catman,
617 [ --with-catman=man|cat Install preformatted manpages[no]],
618 [
619 MANTYPE='$(CATMAN)'
620 if test x"$withval" != x"yes" ; then
621 mansubdir=$withval
622 else
623 mansubdir=cat
624 fi
625 ], [
626 if test -z "$MANTYPE" ; then
627 MANTYPE='$(TROFFMAN)'
628 mansubdir=man
629 fi
630 ]
631)
632AC_SUBST(MANTYPE)
633AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +1100634
Damien Millera22ba012000-03-02 23:09:20 +1100635# Check whether user wants Kerberos support
Damien Miller80297751999-11-19 13:03:25 +1100636AC_ARG_WITH(kerberos4,
Damien Miller105b7f02000-01-07 08:45:55 +1100637 [ --with-kerberos4=PATH Enable Kerberos 4 support],
Damien Miller80297751999-11-19 13:03:25 +1100638 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100639 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +1100640
641 if test "x$withval" != "$xyes" ; then
642 CFLAGS="$CFLAGS -I${withval}/include"
643 LDFLAGS="$LDFLAGS -L${withval}/lib"
644 else
645 if test -d /usr/include/kerberosIV ; then
646 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
647 fi
648 fi
649
650 AC_CHECK_HEADERS(krb.h)
651 AC_CHECK_LIB(krb, main)
652 if test "$ac_cv_header_krb_h" != yes; then
653 AC_MSG_WARN([Cannot find krb.h, build may fail])
654 fi
655 if test "$ac_cv_lib_krb_main" != yes; then
656 AC_MSG_WARN([Cannot find libkrb, build may fail])
657 fi
658
Damien Millerc85f9b42000-01-29 10:20:21 +1100659 KLIBS="-lkrb -ldes"
Damien Miller105b7f02000-01-07 08:45:55 +1100660 AC_CHECK_LIB(resolv, dn_expand, , )
661 KRB4=yes
Damien Miller8bdeee21999-12-30 15:50:54 +1100662 AC_DEFINE(KRB4)
Damien Miller8bdeee21999-12-30 15:50:54 +1100663 fi
Damien Miller80297751999-11-19 13:03:25 +1100664 ]
665)
666
Damien Millera22ba012000-03-02 23:09:20 +1100667# Check whether user wants AFS support
Damien Millerc6398ef1999-11-20 12:18:40 +1100668AC_ARG_WITH(afs,
Damien Miller105b7f02000-01-07 08:45:55 +1100669 [ --with-afs=PATH Enable AFS support],
Damien Miller80297751999-11-19 13:03:25 +1100670 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100671 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +1100672
673 if test "x$withval" != "$xyes" ; then
674 CFLAGS="$CFLAGS -I${withval}/include"
675 LFLAGS="$LFLAGS -L${withval}/lib"
676 fi
677
678 if test -z "$KRB4" ; then
679 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
680 fi
681
Damien Miller8bdeee21999-12-30 15:50:54 +1100682 LIBS="$LIBS -lkafs"
Damien Miller105b7f02000-01-07 08:45:55 +1100683 if test ! -z "$AFS_LIBS" ; then
684 LIBS="$LIBS $AFS_LIBS"
685 fi
686 AC_DEFINE(AFS)
Damien Miller8bdeee21999-12-30 15:50:54 +1100687 fi
Damien Miller80297751999-11-19 13:03:25 +1100688 ]
689)
Damien Millerc85f9b42000-01-29 10:20:21 +1100690LIBS="$LIBS $KLIBS"
Damien Miller80297751999-11-19 13:03:25 +1100691
Damien Millera22ba012000-03-02 23:09:20 +1100692# Check whether user wants S/Key support
Damien Miller80297751999-11-19 13:03:25 +1100693AC_ARG_WITH(skey,
694 [ --with-skey Enable S/Key support],
695 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100696 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +1100697 AC_DEFINE(SKEY)
698 LIBS="$LIBS -lskey"
699 fi
Damien Miller80297751999-11-19 13:03:25 +1100700 ]
701)
702
Damien Millera22ba012000-03-02 23:09:20 +1100703# Check whether user wants TCP wrappers support
Damien Millerf7c0f821999-11-22 22:31:49 +1100704AC_ARG_WITH(tcp-wrappers,
Damien Miller80297751999-11-19 13:03:25 +1100705 [ --with-tcp-wrappers Enable tcpwrappers support],
706 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100707 if test "x$withval" != "xno" ; then
Damien Miller65165f82000-03-05 17:02:45 +1100708 saved_LIBS="$LIBS"
Damien Miller105b7f02000-01-07 08:45:55 +1100709 LIBS="$LIBS -lwrap"
Damien Miller65165f82000-03-05 17:02:45 +1100710 AC_MSG_CHECKING(for libwrap)
711 AC_TRY_LINK(
712 [
713 #include <tcpd.h>
714 int deny_severity = 0, allow_severity = 0;
715 ],
716 [hosts_access(0);],
717 [
718 AC_MSG_RESULT(yes)
719 AC_DEFINE(LIBWRAP)
720 ],
721 [
722 AC_MSG_RESULT(no)
723 AC_MSG_WARN([*** libwrap missing - tcpwrapper support disabled ***])
724 LIBS="$saved_LIBS"
725 ]
726 )
Damien Miller8bdeee21999-12-30 15:50:54 +1100727 fi
Damien Miller80297751999-11-19 13:03:25 +1100728 ]
729)
730
Damien Millera22ba012000-03-02 23:09:20 +1100731# Check whether to enable MD5 passwords
Damien Millerf7c0f821999-11-22 22:31:49 +1100732AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100733 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +1100734 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100735 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +1100736 AC_DEFINE(HAVE_MD5_PASSWORDS)
737 fi
738 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100739)
740
Damien Millera22ba012000-03-02 23:09:20 +1100741# Check whether to enable utmpx support
Damien Miller368cf641999-12-21 09:51:36 +1100742AC_ARG_WITH(utmpx,
743 [ --with-utmpx Enable utmpx support],
Damien Miller76112de1999-12-21 11:18:08 +1100744 [
745 if test "x$withval" != "xno" ; then
746 AC_DEFINE(USE_UTMPX)
747 fi
748 ]
Damien Miller368cf641999-12-21 09:51:36 +1100749)
750
Damien Millera22ba012000-03-02 23:09:20 +1100751# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +1100752AC_ARG_WITH(shadow,
753 [ --without-shadow Disable shadow password support],
754 [
755 if test "x$withval" = "xno" ; then
756 AC_DEFINE(DISABLE_SHADOW)
757 fi
758 ]
759)
760
Damien Millera22ba012000-03-02 23:09:20 +1100761# Use ip address instead of hostname in $DISPLAY
Damien Miller76112de1999-12-21 11:18:08 +1100762AC_ARG_WITH(ipaddr-display,
763 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
764 [
Damien Miller66409952000-01-17 21:40:06 +1100765 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +1100766 AC_DEFINE(IPADDR_IN_DISPLAY)
767 fi
768 ]
769)
770
Damien Millera22ba012000-03-02 23:09:20 +1100771# Whether to mess with the default path
Damien Millere7f626c1999-12-31 09:49:44 +1100772AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +1100773 [ --with-default-path=PATH Specify default \$PATH environment for server],
774 [
775 if test "x$withval" != "xno" ; then
Damien Miller9550a761999-12-29 02:32:22 +1100776 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
Damien Miller5a3e6831999-12-27 09:48:56 +1100777 fi
778 ]
779)
780
Damien Millera22ba012000-03-02 23:09:20 +1100781# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7d80e342000-01-19 14:36:49 +1100782AC_ARG_WITH(ipv4-default,
783 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
784 [
785 if test "x$withval" != "xno" ; then
786 AC_DEFINE(IPV4_DEFAULT)
787 fi
788 ]
789)
790
Damien Millera22ba012000-03-02 23:09:20 +1100791# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +1100792piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +1100793AC_ARG_WITH(pid-dir,
794 [ --with-pid-dir=PATH Specify location of ssh.pid file],
795 [
796 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +1100797 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +1100798 fi
799 ]
800)
Damien Millerdbd250f2000-01-18 08:57:14 +1100801AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +1100802AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +1100803
Damien Miller7f6ea021999-10-28 13:25:17 +1000804AC_OUTPUT(Makefile)