]> andersk Git - openssh.git/blob - configure.in
- (djm) Check for SCO pty naming style (ptyp%d/ttyp%d). Based on fix from
[openssh.git] / configure.in
1 AC_INIT(ssh.c)
2
3 AC_CONFIG_HEADER(config.h)
4 AC_PROG_CC
5 AC_CANONICAL_HOST
6
7 # Checks for programs.
8 AC_PROG_CPP
9 AC_PROG_RANLIB
10 AC_PROG_INSTALL
11 AC_CHECK_PROG(AR, ar, ar)
12 AC_PATH_PROG(PERL, perl)
13 AC_SUBST(PERL)
14 AC_PATH_PROG(ENT, ent)
15 AC_SUBST(ENT)
16
17 # Use LOGIN_PROGRAM from environment if possible
18 if test ! -z "$LOGIN_PROGRAM" ; then
19         AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
20 else
21         # Search for login
22         AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
23         if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
24                 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
25         fi
26 fi
27
28 if test -z "$LD" ; then
29         LD=$CC
30 fi
31 AC_SUBST(LD)
32         
33 # C Compiler features
34 AC_C_INLINE
35 if test "$GCC" = "yes"; then 
36         CFLAGS="$CFLAGS -Wall"
37 fi
38
39 # Check for some target-specific stuff
40 case "$host" in
41 *-*-aix*)
42         AFS_LIBS="-lld"
43         CFLAGS="$CFLAGS -I/usr/local/include"
44         LDFLAGS="$LDFLAGS -L/usr/local/lib"
45         if (test "$LD" != "gcc" && test -z "$blibpath"); then
46                 blibpath="/usr/lib:/lib:/usr/local/lib"
47         fi
48         AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
49         AC_DEFINE(BROKEN_GETADDRINFO)
50         MANTYPE='$(CATMAN)'
51         mansubdir=cat
52         dnl AIX handles lastlog as part of its login message
53         AC_DEFINE(DISABLE_LASTLOG)
54         MANTYPE='$(CATMAN)'
55         mansubdir=cat
56         ;;
57 *-*-hpux10*)
58         if test -z "$GCC"; then
59                 CFLAGS="$CFLAGS -Ae"
60         fi
61         CFLAGS="$CFLAGS -D_HPUX_SOURCE"
62         AC_DEFINE(IPADDR_IN_DISPLAY)
63         AC_DEFINE(USE_PIPES)
64         AC_MSG_CHECKING(for HPUX trusted system password database)
65         if test -f /tcb/files/auth/system/default; then
66                 AC_MSG_RESULT(yes)
67                 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
68                 LIBS="$LIBS -lsec"
69                 AC_MSG_WARN([This configuration is untested])
70         else
71                 AC_MSG_RESULT(no)
72                 AC_DEFINE(DISABLE_SHADOW)
73         fi
74         MANTYPE='$(CATMAN)'
75         mansubdir=cat
76         ;;
77 *-*-hpux11*)
78         if test -z "$GCC"; then
79                 CFLAGS="$CFLAGS -Ae"
80         fi
81         CFLAGS="$CFLAGS -D_HPUX_SOURCE"
82         AC_DEFINE(IPADDR_IN_DISPLAY)
83         AC_MSG_CHECKING(for HPUX trusted system password database)
84         if test -f /tcb/files/auth/system/default; then
85                 AC_MSG_RESULT(yes)
86                 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
87                 LIBS="$LIBS -lsec"
88                 AC_MSG_WARN([This configuration is untested])
89         else
90                 AC_MSG_RESULT(no)
91                 AC_DEFINE(DISABLE_SHADOW)
92         fi
93         MANTYPE='$(CATMAN)'
94         mansubdir=cat
95         ;;
96 *-*-irix5*)
97         CFLAGS="$CFLAGS -I/usr/local/include"
98         LDFLAGS="$LDFLAGS"
99         MANTYPE='$(CATMAN)'
100         no_libsocket=1
101         no_libnsl=1
102         AC_DEFINE(BROKEN_INET_NTOA)
103         ;;
104 *-*-irix6*)
105         CFLAGS="$CFLAGS -I/usr/local/include"
106         LDFLAGS="$LDFLAGS"
107         MANTYPE='$(CATMAN)'
108         AC_DEFINE(WITH_IRIX_ARRAY)
109         AC_DEFINE(WITH_IRIX_PROJECT)
110         AC_DEFINE(WITH_IRIX_AUDIT)
111         no_libsocket=1
112         no_libnsl=1
113         AC_DEFINE(BROKEN_INET_NTOA)
114         ;;
115 *-*-linux*)
116         no_dev_ptmx=1
117         AC_DEFINE(DONT_TRY_OTHER_AF)
118         AC_DEFINE(PAM_TTY_KLUDGE)
119         inet6_default_4in6=yes
120         ;;
121 *-*-netbsd*)
122         need_dash_r=1
123         ;;
124 *-next-*)
125         # hardwire lastlog location (can't detect it on some versions)
126         conf_lastlog_location="/usr/adm/lastlog"
127         conf_utmp_location=/etc/utmp
128         AC_DEFINE(HAVE_NEXT)
129         CFLAGS="$CFLAGS -I/usr/local/include"
130         MAIL=/usr/spool/mail
131         AC_MSG_WARN([*** Tested: PA-RISC/m68k  Untested: Sparc/Intel])
132         AC_MSG_WARN([*** Expect 'scp' to fail!])
133         AC_MSG_WARN([*** Please report any problems, thanks])
134         ;;
135 *-*-solaris*)
136         CFLAGS="$CFLAGS -I/usr/local/include"
137         LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
138         need_dash_r=1
139         # hardwire lastlog location (can't detect it on some versions)
140         conf_lastlog_location="/var/adm/lastlog"
141         AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
142         sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
143         if test "$sol2ver" -ge 8; then
144                 AC_MSG_RESULT(yes)
145                 AC_DEFINE(DISABLE_UTMP)
146                 AC_DEFINE(DISABLE_WTMP)
147         else
148                 AC_MSG_RESULT(no)
149         fi
150         ;;
151 *-*-sunos4*)
152         CFLAGS="$CFLAGS -DSUNOS4"
153         AC_CHECK_FUNCS(getpwanam)
154         conf_utmp_location=/etc/utmp
155         conf_wtmp_location=/var/adm/wtmp
156         conf_lastlog_location=/var/adm/lastlog
157         AC_DEFINE(USE_PIPES)
158         MANTYPE='$(CATMAN)'
159         mansubdir=cat
160         ;;
161 *-sni-sysv*)
162         CFLAGS="$CFLAGS -I/usr/local/include"
163         LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
164         MANTYPE='$(CATMAN)'
165         AC_DEFINE(IP_TOS_IS_BROKEN)
166         mansubdir=cat
167         LIBS="$LIBS -lgen -lnsl -lucb"
168         ;;
169 *-*-sysv*)
170         CFLAGS="$CFLAGS -I/usr/local/include"
171         LDFLAGS="$LDFLAGS -L/usr/local/lib"
172         MANTYPE='$(CATMAN)'
173         mansubdir=cat
174         LIBS="$LIBS -lgen -lsocket"
175         ;;
176 *-*-sco3*)
177         CFLAGS="$CFLAGS -I/usr/local/include"
178         LDFLAGS="$LDFLAGS -L/usr/local/lib"
179         MANTYPE='$(CATMAN)'
180         mansubdir=cat
181         LIBS="$LIBS -lgen -lsocket"
182         no_dev_ptmx=1
183         ;;
184 *-dec-osf*)
185 # This is untested
186         if test ! -z "USE_SIA" ; then
187                 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
188                 if test -f /etc/sia/matrix.conf; then
189                         AC_MSG_RESULT(yes)
190                         AC_DEFINE(HAVE_OSF_SIA)
191                         AC_DEFINE(DISABLE_LOGIN)
192                         LIBS="$LIBS -lsecurity -ldb -lm -laud"
193                 else
194                         AC_MSG_RESULT(no)
195                 fi
196         fi
197         ;;
198 esac
199
200 # Allow user to specify flags
201 AC_ARG_WITH(cflags,
202         [  --with-cflags           Specify additional flags to pass to compiler],
203         [
204                 if test "x$withval" != "xno" ; then
205                         CFLAGS="$CFLAGS $withval"
206                 fi
207         ]       
208 )
209 AC_ARG_WITH(ldflags,
210         [  --with-ldlags           Specify additional flags to pass to linker],
211         [
212                 if test "x$withval" != "xno" ; then
213                         LDFLAGS="$LDFLAGS $withval"
214                 fi
215         ]       
216 )
217 AC_ARG_WITH(libs,
218         [  --with-libs             Specify additional libraries to link with],
219         [
220                 if test "x$withval" != "xno" ; then
221                         LIBS="$LIBS $withval"
222                 fi
223         ]       
224 )
225
226
227 # Checks for libraries.
228 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
229 AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
230
231 if test -z "$no_libsocket" ; then
232         AC_CHECK_LIB(nsl, yp_match, , )
233 fi
234 if test -z "$no_libnsl" ; then
235         AC_CHECK_LIB(socket, main, , )
236 fi
237
238 # Checks for header files.
239 AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.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/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h)
240
241 dnl    Checks for library functions.
242 AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strerror strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop)
243 dnl    Checks for time functions
244 AC_CHECK_FUNCS(gettimeofday time)
245 dnl    Checks for libutil functions
246 AC_CHECK_FUNCS(login logout updwtmp logwtmp)
247 dnl    Checks for utmp functions
248 AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
249 AC_CHECK_FUNCS(utmpname)
250 dnl    Checks for utmpx functions
251 AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
252 AC_CHECK_FUNCS(setutxent utmpxname)
253
254 AC_CHECK_FUNC(getuserattr, 
255         [AC_DEFINE(HAVE_GETUSERATTR)],
256         [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
257 )
258
259 AC_CHECK_FUNC(login, 
260         [AC_DEFINE(HAVE_LOGIN)],
261         [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
262 )
263
264 AC_CHECK_FUNC(daemon, 
265         [AC_DEFINE(HAVE_DAEMON)],
266         [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
267 )
268
269 AC_CHECK_FUNC(getpagesize, 
270         [AC_DEFINE(HAVE_GETPAGESIZE)],
271         [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
272 )
273
274 # Check for broken snprintf
275 if test "x$ac_cv_func_snprintf" = "xyes" ; then
276         AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
277         AC_TRY_RUN(
278                 [
279 #include <stdio.h>
280 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
281                 ],
282                 [AC_MSG_RESULT(yes)], 
283                 [
284                         AC_MSG_RESULT(no)
285                         AC_DEFINE(BROKEN_SNPRINTF)
286                         AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
287                 ]
288         )
289 fi
290
291 PAM_MSG="no"
292 AC_ARG_WITH(pam,
293         [  --without-pam           Disable PAM support ],
294         [
295                 if test "x$withval" = "xno" ; then
296                         no_pam=1
297                         AC_DEFINE(DISABLE_PAM)
298                         PAM_MSG="disabled"
299                 fi
300         ]
301 )
302 if (test -z "$no_pam" && test "x$ac_cv_header_security_pam_appl_h" = "xyes") ; then
303         AC_CHECK_LIB(dl, dlopen, , )
304         LIBS="$LIBS -lpam"
305
306         AC_CHECK_FUNCS(pam_getenvlist)
307
308         disable_shadow=yes
309
310         PAM_MSG="yes"
311
312         # Check PAM strerror arguments (old PAM)
313         AC_MSG_CHECKING([whether pam_strerror takes only one argument])
314         AC_TRY_COMPILE(
315                 [
316 #include <stdlib.h>
317 #include <security/pam_appl.h>
318                 ], 
319                 [(void)pam_strerror((pam_handle_t *)NULL, -1);], 
320                 [AC_MSG_RESULT(no)],
321                 [
322                         AC_DEFINE(HAVE_OLD_PAM)
323                         AC_MSG_RESULT(yes)
324                         PAM_MSG="yes (old library)"
325                 ]
326         ) 
327 fi
328
329 # The big search for OpenSSL
330 AC_ARG_WITH(ssl-dir,
331         [  --with-ssl-dir=PATH     Specify path to OpenSSL installation ],
332         [
333                 if test "x$withval" != "$xno" ; then
334                         tryssldir=$withval
335                 fi
336         ]
337 )
338
339 saved_LIBS="$LIBS"
340 saved_LDFLAGS="$LDFLAGS"
341 saved_CFLAGS="$CFLAGS"
342 if test "x$prefix" != "xNONE" ; then
343         tryssldir="$tryssldir $prefix"
344 fi
345 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
346
347         for ssldir in "" $tryssldir /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
348                 if test ! -z "$ssldir" ; then
349                         LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
350                         CFLAGS="$saved_CFLAGS -I$ssldir/include"
351                         if test ! -z "$need_dash_r" ; then
352                                 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
353                         fi
354                 else
355                         LDFLAGS="$saved_LDFLAGS"
356                 fi
357
358                 LIBS="$saved_LIBS -lcrypto"
359
360                 # Basic test to check for compatible version and correct linking
361                 # *does not* test for RSA - that comes later.
362                 AC_TRY_RUN(
363                         [
364 #include <string.h>
365 #include <openssl/rand.h>
366 int main(void) 
367 {
368         char a[2048];
369         memset(a, 0, sizeof(a));
370         RAND_add(a, sizeof(a), sizeof(a));
371         return(RAND_status() <= 0);
372 }
373                         ],
374                         [
375                                 found_crypto=1
376                                 break;
377                         ], []
378                 )
379
380                 if test ! -z "$found_crypto" ; then
381                         break;
382                 fi
383         done
384
385         if test -z "$found_crypto" ; then
386                 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])       
387         fi
388         if test -z "$ssldir" ; then
389                 ssldir="(system)"
390         fi
391
392         ac_cv_openssldir=$ssldir
393 ])
394
395 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
396         AC_DEFINE(HAVE_OPENSSL)
397         dnl Need to recover ssldir - test above runs in subshell
398         ssldir=$ac_cv_openssldir
399         CFLAGS="$saved_CFLAGS -I$ssldir/include"
400         LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
401         if test ! -z "$need_dash_r" ; then
402                 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
403         fi
404         if test ! -z "$blibpath" ; then
405                 blibpath="$blibpath:$ssldir:$ssldir/lib"
406         fi
407 fi
408 LIBS="$saved_LIBS -lcrypto"
409
410 # Now test RSA support
411 saved_LIBS="$LIBS"
412 AC_MSG_CHECKING([for RSA support])
413 for WANTS_RSAREF in "" 1 ; do
414         if test -z "$WANTS_RSAREF" ; then
415                 LIBS="$saved_LIBS"
416         else
417                 LIBS="$saved_LIBS -lRSAglue -lrsaref"
418         fi
419         AC_TRY_RUN([
420 #include <string.h>
421 #include <openssl/rand.h>
422 #include <openssl/rsa.h>
423 #include <openssl/bn.h>
424 #include <openssl/sha.h>
425 int main(void) 
426 {
427         int num; RSA *key; static unsigned char p_in[] = "blahblah";
428         unsigned char c[256], p[256];
429         memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
430         if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
431         num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
432         return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
433 }
434         ],
435         [
436                 rsa_works=1
437                 break;
438         ], [])
439 done
440
441 if test ! -z "$no_rsa" ; then
442         AC_MSG_RESULT(disabled)
443         RSA_MSG="disabled"
444 else
445         if test -z "$rsa_works" ; then
446                 AC_MSG_WARN([*** No RSA support found *** ])
447                 RSA_MSG="no"
448         else
449                 if test -z "$WANTS_RSAREF" ; then
450                         AC_MSG_RESULT(yes)
451                         RSA_MSG="yes"
452                 else
453                         RSA_MSG="yes (using RSAref)"
454                         AC_MSG_RESULT(using RSAref)
455                         LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
456                 fi
457         fi
458 fi
459
460 # Checks for data types
461 AC_CHECK_SIZEOF(char, 1)
462 AC_CHECK_SIZEOF(short int, 2)
463 AC_CHECK_SIZEOF(int, 4)
464 AC_CHECK_SIZEOF(long int, 4)
465 AC_CHECK_SIZEOF(long long int, 8)
466
467 # More checks for data types
468 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
469         AC_TRY_COMPILE(
470                 [ #include <sys/types.h> ], 
471                 [ u_int a; a = 1;], 
472                 [ ac_cv_have_u_int="yes" ],
473                 [ ac_cv_have_u_int="no" ]
474         )
475 ])
476 if test "x$ac_cv_have_u_int" = "xyes" ; then
477         AC_DEFINE(HAVE_U_INT)
478         have_u_int=1
479 fi
480
481 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
482         AC_TRY_COMPILE(
483                 [ #include <sys/types.h> ], 
484                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;], 
485                 [ ac_cv_have_intxx_t="yes" ],
486                 [ ac_cv_have_intxx_t="no" ]
487         )
488 ])
489 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
490         AC_DEFINE(HAVE_INTXX_T)
491         have_intxx_t=1
492 fi
493         
494 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
495         AC_TRY_COMPILE(
496                 [ #include <sys/types.h> ], 
497                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], 
498                 [ ac_cv_have_u_intxx_t="yes" ],
499                 [ ac_cv_have_u_intxx_t="no" ]
500         )
501 ])
502 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
503         AC_DEFINE(HAVE_U_INTXX_T)
504         have_u_intxx_t=1
505 fi
506
507 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
508            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
509 then
510         AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
511         AC_TRY_COMPILE(
512                 [
513 #include <sys/bitypes.h>
514                 ], 
515                 [
516                         int8_t a; int16_t b; int32_t c;
517                         u_int8_t e; u_int16_t f; u_int32_t g;
518                         a = b = c = e = f = g = 1;
519                 ], 
520                 [
521                         AC_DEFINE(HAVE_U_INTXX_T)
522                         AC_DEFINE(HAVE_INTXX_T)
523                         AC_MSG_RESULT(yes)
524                 ],
525                 [AC_MSG_RESULT(no)]
526         ) 
527 fi
528
529 if test -z "$have_u_intxx_t" ; then
530         AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
531                 AC_TRY_COMPILE(
532                         [
533 #include <sys/types.h>
534                         ], 
535                         [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ], 
536                         [ ac_cv_have_uintxx_t="yes" ],
537                         [ ac_cv_have_uintxx_t="no" ]
538                 )
539         ])
540         if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
541                 AC_DEFINE(HAVE_UINTXX_T)
542         fi
543 fi
544
545 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
546         AC_TRY_COMPILE(
547                 [
548 #include <sys/types.h>
549 #include <sys/socket.h>
550                 ],
551                 [socklen_t foo; foo = 1235;],
552                 [ ac_cv_have_socklen_t="yes" ],
553                 [ ac_cv_have_socklen_t="no" ]
554         )
555 ])
556 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
557         AC_DEFINE(HAVE_SOCKLEN_T)
558 fi
559
560 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
561         AC_TRY_COMPILE(
562                 [
563 #include <sys/types.h>
564                 ],
565                 [ size_t foo; foo = 1235; ],
566                 [ ac_cv_have_size_t="yes" ],
567                 [ ac_cv_have_size_t="no" ]
568         )
569 ])
570 if test "x$ac_cv_have_size_t" = "xyes" ; then
571         AC_DEFINE(HAVE_SIZE_T)
572 fi
573
574 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
575         AC_TRY_COMPILE(
576                 [
577 #include <sys/types.h>
578                 ],
579                 [ ssize_t foo; foo = 1235; ],
580                 [ ac_cv_have_ssize_t="yes" ],
581                 [ ac_cv_have_ssize_t="no" ]
582         )
583 ])
584 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
585         AC_DEFINE(HAVE_SSIZE_T)
586 fi
587
588 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
589         AC_TRY_COMPILE(
590                 [
591 #include <sys/types.h>
592 #include <sys/socket.h>
593                 ],
594                 [ sa_family_t foo; foo = 1235; ],
595                 [ ac_cv_have_sa_family_t="yes" ],
596                 [ ac_cv_have_sa_family_t="no" ]
597         )
598 ])
599 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
600         AC_DEFINE(HAVE_SA_FAMILY_T)
601 fi
602
603 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
604         AC_TRY_COMPILE(
605                 [
606 #include <sys/types.h>
607                 ],
608                 [ pid_t foo; foo = 1235; ],
609                 [ ac_cv_have_pid_t="yes" ],
610                 [ ac_cv_have_pid_t="no" ]
611         )
612 ])
613 if test "x$ac_cv_have_pid_t" = "xyes" ; then
614         AC_DEFINE(HAVE_PID_T)
615 fi
616
617 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
618         AC_TRY_COMPILE(
619                 [
620 #include <sys/types.h>
621                 ],
622                 [ mode_t foo; foo = 1235; ],
623                 [ ac_cv_have_mode_t="yes" ],
624                 [ ac_cv_have_mode_t="no" ]
625         )
626 ])
627 if test "x$ac_cv_have_mode_t" = "xyes" ; then
628         AC_DEFINE(HAVE_MODE_T)
629 fi
630
631
632 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
633         AC_TRY_COMPILE(
634                 [
635 #include <sys/types.h>
636 #include <sys/socket.h>
637                 ],
638                 [ struct sockaddr_storage s; ],
639                 [ ac_cv_have_struct_sockaddr_storage="yes" ],
640                 [ ac_cv_have_struct_sockaddr_storage="no" ]
641         )
642 ])
643 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
644         AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
645 fi
646
647 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
648         AC_TRY_COMPILE(
649                 [
650 #include <sys/types.h>
651 #include <netinet/in.h>
652                 ],
653                 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
654                 [ ac_cv_have_struct_sockaddr_in6="yes" ],
655                 [ ac_cv_have_struct_sockaddr_in6="no" ]
656         )
657 ])
658 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
659         AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
660 fi
661
662 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
663         AC_TRY_COMPILE(
664                 [
665 #include <sys/types.h>
666 #include <netinet/in.h>
667                 ],
668                 [ struct in6_addr s; s.s6_addr[0] = 0; ],
669                 [ ac_cv_have_struct_in6_addr="yes" ],
670                 [ ac_cv_have_struct_in6_addr="no" ]
671         )
672 ])
673 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
674         AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
675 fi
676
677 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
678         AC_TRY_COMPILE(
679                 [
680 #include <sys/types.h>
681 #include <sys/socket.h>
682 #include <netdb.h>
683                 ],
684                 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
685                 [ ac_cv_have_struct_addrinfo="yes" ],
686                 [ ac_cv_have_struct_addrinfo="no" ]
687         )
688 ])
689 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
690         AC_DEFINE(HAVE_STRUCT_ADDRINFO)
691 fi
692
693
694 # Checks for structure members
695
696 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
697 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
698 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
699 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
700 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
701 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
702 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
703 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
704 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
705 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
706 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
707 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
708 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
709 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
710 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
711 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
712 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
713
714 AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
715                 ac_cv_have_sun_len_in_struct_sockaddr_un, [
716         AC_TRY_COMPILE(
717                 [
718 #include <sys/types.h>
719 #include <sys/socket.h>
720                 ],
721                 [ struct sockaddr_un s; s.sun_len = 1; ],
722                 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
723                 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
724         )
725 ])
726 if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
727         AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
728 fi
729
730 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
731                 ac_cv_have_ss_family_in_struct_ss, [
732         AC_TRY_COMPILE(
733                 [
734 #include <sys/types.h>
735 #include <sys/socket.h>
736                 ],
737                 [ struct sockaddr_storage s; s.ss_family = 1; ],
738                 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
739                 [ ac_cv_have_ss_family_in_struct_ss="no" ],
740         )
741 ])
742 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
743         AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
744 fi
745
746 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
747                 ac_cv_have___ss_family_in_struct_ss, [
748         AC_TRY_COMPILE(
749                 [
750 #include <sys/types.h>
751 #include <sys/socket.h>
752                 ],
753                 [ struct sockaddr_storage s; s.__ss_family = 1; ],
754                 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
755                 [ ac_cv_have___ss_family_in_struct_ss="no" ]
756         )
757 ])
758 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
759         AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
760 fi
761
762 AC_CACHE_CHECK([for pw_class field in struct passwd],
763                 ac_cv_have_pw_class_in_struct_passwd, [
764         AC_TRY_COMPILE(
765                 [
766 #include <sys/types.h>
767 #include <pwd.h>
768                 ],
769                 [ struct passwd p s; p.pw_class = NULL; ],
770                 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
771                 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
772         )
773 ])
774 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
775         AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
776 fi
777
778
779 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
780         AC_TRY_LINK([], 
781                 [ extern char *__progname; printf("%s", __progname); ], 
782                 [ ac_cv_libc_defines___progname="yes" ],
783                 [ ac_cv_libc_defines___progname="no" ]
784         )
785 ])
786 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
787         AC_DEFINE(HAVE___PROGNAME)
788 fi
789
790
791 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
792         AC_TRY_LINK([], 
793                 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);], 
794                 [ ac_cv_libc_defines_sys_errlist="yes" ],
795                 [ ac_cv_libc_defines_sys_errlist="no" ]
796         )
797 ])
798 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
799         AC_DEFINE(HAVE_SYS_ERRLIST)
800 fi
801
802
803 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
804         AC_TRY_LINK([], 
805                 [ extern int sys_nerr; printf("%i", sys_nerr);], 
806                 [ ac_cv_libc_defines_sys_nerr="yes" ],
807                 [ ac_cv_libc_defines_sys_nerr="no" ]
808         )
809 ])
810 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
811         AC_DEFINE(HAVE_SYS_NERR)
812 fi
813
814
815 # Looking for programs, paths and files
816 AC_ARG_WITH(rsh,
817         [  --with-rsh=PATH         Specify path to remote shell program ],
818         [
819                 if test "x$withval" != "$no" ; then
820                         rsh_path=$withval
821                 fi
822         ],
823         [
824                 AC_PATH_PROG(rsh_path, rsh)
825         ]
826 )
827
828 AC_ARG_WITH(xauth,
829         [  --with-xauth=PATH       Specify path to xauth program ],
830         [
831                 if test "x$withval" != "$xno" ; then
832                         xauth_path=$withval
833                 fi
834         ],
835         [
836                 AC_PATH_PROG(xauth_path, xauth)
837                 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
838                         xauth_path="/usr/openwin/bin/xauth"
839                 fi
840         ]
841 )
842
843 if test ! -z "$xauth_path" ; then
844         AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
845 fi
846 if test ! -z "$rsh_path" ; then
847         AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
848 fi
849
850 # Check for mail directory (last resort if we cannot get it from headers)
851 if test ! -z "$MAIL" ; then
852         maildir=`dirname $MAIL`
853         AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
854 fi
855
856 if test -z "$no_dev_ptmx" ; then
857         AC_CHECK_FILE("/dev/ptmx", 
858                 [
859                         AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
860                         have_dev_ptmx=1
861                 ]
862         )
863 fi
864 AC_CHECK_FILE("/dev/ptc", 
865         [
866                 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
867                 have_dev_ptc=1
868         ]
869 )
870
871 # Options from here on. Some of these are preset by platform above
872
873 # Check for user-specified random device, otherwise check /dev/urandom
874 AC_ARG_WITH(random,
875         [  --with-random=FILE      read randomness from FILE (default=/dev/urandom)],
876         [
877                 if test "x$withval" != "xno" ; then
878                         RANDOM_POOL="$withval";
879                         AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
880                 fi
881         ],
882         [
883                 # Check for random device
884                 AC_CHECK_FILE("/dev/urandom",
885                         [
886                                 RANDOM_POOL="/dev/urandom"; 
887                                 AC_SUBST(RANDOM_POOL)
888                                 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
889                         ]
890                 )
891         ]
892 )
893
894 # Check for EGD pool file
895 AC_ARG_WITH(egd-pool,
896         [  --with-egd-pool=FILE    read randomness from EGD pool FILE (default none)],
897         [
898                 if test "x$withval" != "xno" ; then
899                         EGD_SOCKET="$withval";
900                         AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
901                 fi
902         ]
903 )
904
905 # detect pathnames for entropy gathering commands, if we need them
906 INSTALL_SSH_PRNG_CMDS=""
907 rm -f prng_commands
908 if (test -z "$RANDOM_POOL" && test -z "$EGD_SOCKET") ; then
909         # Use these commands to collect entropy
910         OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
911         OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
912         OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
913         OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
914         OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
915         OSSH_PATH_ENTROPY_PROG(PROG_W, w)
916         OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
917         OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
918         OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
919         OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
920         OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
921         OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
922         OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
923         OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
924         OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
925
926         INSTALL_SSH_PRNG_CMDS="yes"
927 fi
928 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
929
930
931 AC_ARG_WITH(catman,
932         [  --with-catman=man|cat   Install preformatted manpages[no]],
933         [
934                 MANTYPE='$(CATMAN)'
935                 if test x"$withval" != x"yes" ; then
936                    mansubdir=$withval
937                 else
938                    mansubdir=cat
939                 fi
940         ], [
941                 if test -z "$MANTYPE" ; then
942                         MANTYPE='$(TROFFMAN)'
943                         mansubdir=man
944                 fi
945         ]
946 )
947 AC_SUBST(MANTYPE)
948 AC_SUBST(mansubdir)
949
950 # Check whether user wants Kerberos support
951 KRB4_MSG="no" 
952 AC_ARG_WITH(kerberos4,
953         [  --with-kerberos4=PATH   Enable Kerberos 4 support],
954         [
955                 if test "x$withval" != "xno" ; then
956         
957                         if test "x$withval" != "$xyes" ; then
958                                 CFLAGS="$CFLAGS -I${withval}/include"
959                                 LDFLAGS="$LDFLAGS -L${withval}/lib"
960                                 if test ! -z "$need_dash_r" ; then
961                                         LDFLAGS="$LDFLAGS -R${withval}/lib"
962                                 fi
963                                 if test ! -z "$blibpath" ; then
964                                         blibpath="$blibpath:${withval}/lib"
965                                 fi
966                         else
967                                 if test -d /usr/include/kerberosIV ; then
968                                         CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
969                                 fi
970                         fi
971
972                         AC_CHECK_HEADERS(krb.h)
973                         AC_CHECK_LIB(krb, main)
974                         if test "$ac_cv_header_krb_h" != yes; then
975                                 AC_MSG_WARN([Cannot find krb.h, build may fail])
976                         fi
977                         if test "$ac_cv_lib_krb_main" != yes; then
978                                 AC_MSG_WARN([Cannot find libkrb, build may fail])
979                         fi
980
981                         KLIBS="-lkrb -ldes"
982                         AC_CHECK_LIB(resolv, dn_expand, , )
983                         KRB4=yes
984                         KRB4_MSG="yes" 
985                         AC_DEFINE(KRB4)
986                 fi
987         ]
988 )
989
990 # Check whether user wants AFS support
991 AFS_MSG="no" 
992 AC_ARG_WITH(afs,
993         [  --with-afs=PATH         Enable AFS support],
994         [
995                 if test "x$withval" != "xno" ; then
996
997                         if test "x$withval" != "$xyes" ; then
998                                 CFLAGS="$CFLAGS -I${withval}/include"
999                                 LFLAGS="$LFLAGS -L${withval}/lib"
1000                         fi
1001
1002                         if test -z "$KRB4" ; then
1003                                 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1004                         fi
1005
1006                         LIBS="$LIBS -lkafs"
1007                         if test ! -z "$AFS_LIBS" ; then
1008                                 LIBS="$LIBS $AFS_LIBS"
1009                         fi
1010                         AC_DEFINE(AFS)
1011                         AFS_MSG="yes" 
1012                 fi
1013         ]
1014 )
1015 LIBS="$LIBS $KLIBS"
1016
1017 # Check whether user wants S/Key support
1018 SKEY_MSG="no" 
1019 AC_ARG_WITH(skey,
1020         [  --with-skey             Enable S/Key support],
1021         [
1022                 if test "x$withval" != "xno" ; then
1023                         AC_DEFINE(SKEY)
1024                         LIBS="$LIBS -lskey"
1025                         SKEY_MSG="yes" 
1026                 fi
1027         ]
1028 )
1029
1030 # Check whether user wants TCP wrappers support
1031 TCPW_MSG="no" 
1032 AC_ARG_WITH(tcp-wrappers,
1033         [  --with-tcp-wrappers     Enable tcpwrappers support],
1034         [
1035                 if test "x$withval" != "xno" ; then
1036                         saved_LIBS="$LIBS"
1037                         LIBS="$LIBS -lwrap"
1038                         AC_MSG_CHECKING(for libwrap)
1039                         AC_TRY_LINK(
1040                                 [
1041 #include <tcpd.h>
1042                                         int deny_severity = 0, allow_severity = 0;
1043                                 ],
1044                                 [hosts_access(0);],
1045                                 [
1046                                         AC_MSG_RESULT(yes)
1047                                         AC_DEFINE(LIBWRAP)
1048                                         TCPW_MSG="yes" 
1049                                 ],
1050                                 [
1051                                         AC_MSG_ERROR([*** libwrap missing])
1052                                 ]
1053                         )
1054                 fi
1055         ]
1056 )
1057
1058 # Check whether to enable MD5 passwords
1059 MD5_MSG="no" 
1060 AC_ARG_WITH(md5-passwords,
1061         [  --with-md5-passwords    Enable use of MD5 passwords],
1062         [
1063                 if test "x$withval" != "xno" ; then
1064                         AC_DEFINE(HAVE_MD5_PASSWORDS)
1065                         MD5_MSG="yes" 
1066                 fi
1067         ]
1068 )
1069
1070 # Whether to disable shadow password support
1071 AC_ARG_WITH(shadow,
1072         [  --without-shadow        Disable shadow password support],
1073         [
1074                 if test "x$withval" = "xno" ; then      
1075                         AC_DEFINE(DISABLE_SHADOW)
1076                         disable_shadow=yes
1077                 fi
1078         ]
1079 )
1080
1081 if test -z "$disable_shadow" ; then
1082         AC_MSG_CHECKING([if the systems has expire shadow information])
1083         AC_TRY_COMPILE(
1084         [
1085 #include <sys/types.h>
1086 #include <shadow.h>
1087         struct spwd sp;
1088         ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1089         [ sp_expire_available=yes ], []
1090         )
1091
1092         if test "x$sp_expire_available" = "xyes" ; then
1093                 AC_MSG_RESULT(yes)
1094                 AC_DEFINE(HAS_SHADOW_EXPIRE)
1095         else
1096                 AC_MSG_RESULT(no)
1097         fi
1098 fi
1099
1100 # Use ip address instead of hostname in $DISPLAY
1101 DISPLAY_HACK_MSG="no" 
1102 AC_ARG_WITH(ipaddr-display,
1103         [  --with-ipaddr-display   Use ip address instead of hostname in \$DISPLAY],
1104         [
1105                 if test "x$withval" != "xno" ; then     
1106                         AC_DEFINE(IPADDR_IN_DISPLAY)
1107                         DISPLAY_HACK_MSG="yes" 
1108                 fi
1109         ]
1110 )
1111
1112 # Whether to mess with the default path
1113 SERVER_PATH_MSG="(default)" 
1114 AC_ARG_WITH(default-path,
1115         [  --with-default-path=PATH Specify default \$PATH environment for server],
1116         [
1117                 if test "x$withval" != "xno" ; then     
1118                         AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
1119                         SERVER_PATH_MSG="$withval" 
1120                 fi
1121         ]
1122 )
1123
1124 # Whether to force IPv4 by default (needed on broken glibc Linux)
1125 IPV4_HACK_MSG="no" 
1126 AC_ARG_WITH(ipv4-default,
1127         [  --with-ipv4-default     Use IPv4 by connections unless '-6' specified],
1128         [
1129                 if test "x$withval" != "xno" ; then     
1130                         AC_DEFINE(IPV4_DEFAULT)
1131                         IPV4_HACK_MSG="yes" 
1132                 fi
1133         ]
1134 )
1135
1136 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
1137 IPV4_IN6_HACK_MSG="no" 
1138 AC_ARG_WITH(4in6,
1139         [  --with-4in6             Check for and convert IPv4 in IPv6 mapped addresses],
1140         [
1141                 if test "x$withval" != "xno" ; then
1142                         AC_MSG_RESULT(yes)
1143                         AC_DEFINE(IPV4_IN_IPV6)
1144                         IPV4_IN6_HACK_MSG="yes" 
1145                 else
1146                         AC_MSG_RESULT(no)
1147                 fi
1148         ],[
1149                 if test "x$inet6_default_4in6" = "xyes"; then
1150                         AC_MSG_RESULT([yes (default)])
1151                         AC_DEFINE(IPV4_IN_IPV6)
1152                         IPV4_IN6_HACK_MSG="yes" 
1153                 else
1154                         AC_MSG_RESULT([no (default)])
1155                 fi
1156         ]
1157 )
1158
1159 # Where to place sshd.pid
1160 piddir=/var/run
1161 AC_ARG_WITH(pid-dir,
1162         [  --with-pid-dir=PATH     Specify location of ssh.pid file],
1163         [
1164                 if test "x$withval" != "xno" ; then     
1165                         piddir=$withval
1166                 fi
1167         ]
1168 )
1169
1170 AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
1171 AC_SUBST(piddir)
1172
1173 dnl allow user to disable some login recording features
1174 AC_ARG_ENABLE(lastlog,
1175         [  --disable-lastlog       disable use of lastlog even if detected [no]],
1176         [ AC_DEFINE(DISABLE_LASTLOG) ]
1177 )
1178 AC_ARG_ENABLE(utmp,
1179         [  --disable-utmp          disable use of utmp even if detected [no]],
1180         [ AC_DEFINE(DISABLE_UTMP) ]
1181 )
1182 AC_ARG_ENABLE(utmpx,
1183         [  --disable-utmpx         disable use of utmpx even if detected [no]],
1184         [ AC_DEFINE(DISABLE_UTMPX) ]
1185 )
1186 AC_ARG_ENABLE(wtmp,
1187         [  --disable-wtmp          disable use of wtmp even if detected [no]],
1188         [ AC_DEFINE(DISABLE_WTMP) ]
1189 )
1190 AC_ARG_ENABLE(wtmpx,
1191         [  --disable-wtmpx         disable use of wtmpx even if detected [no]],
1192         [ AC_DEFINE(DISABLE_WTMPX) ]
1193 )
1194 AC_ARG_ENABLE(libutil,
1195         [  --disable-libutil       disable use of libutil (login() etc.) [no]],
1196         [ AC_DEFINE(DISABLE_LOGIN) ]
1197 )
1198 AC_ARG_ENABLE(pututline,
1199         [  --disable-pututline     disable use of pututline() etc. ([uw]tmp) [no]],
1200         [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1201 )
1202 AC_ARG_ENABLE(pututxline,
1203         [  --disable-pututxline    disable use of pututxline() etc. ([uw]tmpx) [no]],
1204         [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1205 )
1206 AC_ARG_WITH(lastlog,
1207   [  --with-lastlog=FILE|DIR specify lastlog location [common locations]],
1208   [ conf_lastlog_location="$withval";  ],)
1209
1210 dnl lastlog, [uw]tmpx? detection
1211 dnl  NOTE: set the paths in the platform section to avoid the
1212 dnl   need for command-line parameters
1213 dnl lastlog and [uw]tmp are subject to a file search if all else fails
1214
1215 dnl lastlog detection
1216 dnl  NOTE: the code itself will detect if lastlog is a directory
1217 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1218 AC_TRY_COMPILE([
1219 #include <sys/types.h>
1220 #include <utmp.h>
1221 #ifdef HAVE_LASTLOG_H
1222 #  include <lastlog.h>
1223 #endif
1224 #ifdef HAVE_PATHS_H
1225 #  include <paths.h>
1226 #endif
1227         ],
1228         [ char *lastlog = LASTLOG_FILE; ],
1229         [ AC_MSG_RESULT(yes) ],
1230         [
1231                 AC_MSG_RESULT(no)
1232                 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1233                 AC_TRY_COMPILE([
1234 #include <sys/types.h>
1235 #include <utmp.h>
1236 #ifdef HAVE_LASTLOG_H
1237 #  include <lastlog.h>
1238 #endif
1239 #ifdef HAVE_PATHS_H
1240 #  include <paths.h>
1241 #endif
1242                 ],
1243                 [ char *lastlog = _PATH_LASTLOG; ],
1244                 [ AC_MSG_RESULT(yes) ],
1245                 [
1246                         AC_MSG_RESULT(no)
1247                         system_lastlog_path=no
1248                 ])
1249         ]
1250 )
1251
1252 if test -z "$conf_lastlog_location"; then
1253         if test x"$system_lastlog_path" = x"no" ; then
1254                 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
1255                                 if (test -d "$f" || test -f "$f") ; then
1256                                         conf_lastlog_location=$f
1257                                 fi
1258                 done
1259                 if test -z "$conf_lastlog_location"; then
1260                         AC_MSG_WARN([** Cannot find lastlog **])
1261                         dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1262                 fi
1263         fi
1264 fi
1265
1266 if test -n "$conf_lastlog_location"; then
1267         AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1268 fi      
1269
1270 dnl utmp detection
1271 AC_MSG_CHECKING([if your system defines UTMP_FILE])
1272 AC_TRY_COMPILE([
1273 #include <sys/types.h>
1274 #include <utmp.h>
1275 #ifdef HAVE_PATHS_H
1276 #  include <paths.h>
1277 #endif
1278         ],
1279         [ char *utmp = UTMP_FILE; ],
1280         [ AC_MSG_RESULT(yes) ],
1281         [ AC_MSG_RESULT(no)
1282           system_utmp_path=no ]
1283 )
1284 if test -z "$conf_utmp_location"; then
1285         if test x"$system_utmp_path" = x"no" ; then
1286                 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1287                         if test -f $f ; then
1288                                 conf_utmp_location=$f
1289                         fi
1290                 done
1291                 if test -z "$conf_utmp_location"; then
1292                         AC_DEFINE(DISABLE_UTMP)
1293                 fi
1294         fi
1295 fi
1296 if test -n "$conf_utmp_location"; then
1297         AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1298 fi      
1299
1300 dnl wtmp detection
1301 AC_MSG_CHECKING([if your system defines WTMP_FILE])
1302 AC_TRY_COMPILE([
1303 #include <sys/types.h>
1304 #include <utmp.h>
1305 #ifdef HAVE_PATHS_H
1306 #  include <paths.h>
1307 #endif
1308         ],
1309         [ char *wtmp = WTMP_FILE; ],
1310         [ AC_MSG_RESULT(yes) ],
1311         [ AC_MSG_RESULT(no)
1312           system_wtmp_path=no ]
1313 )
1314 if test -z "$conf_wtmp_location"; then
1315         if test x"$system_wtmp_path" = x"no" ; then
1316                 for f in /usr/adm/wtmp /var/log/wtmp; do
1317                         if test -f $f ; then
1318                                 conf_wtmp_location=$f
1319                         fi
1320                 done
1321                 if test -z "$conf_wtmp_location"; then
1322                         AC_DEFINE(DISABLE_WTMP)
1323                 fi
1324         fi
1325 fi
1326 if test -n "$conf_wtmp_location"; then
1327         AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1328 fi      
1329
1330
1331 dnl utmpx detection - I don't know any system so perverse as to require
1332 dnl  utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1333 dnl  there, though.
1334 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1335 AC_TRY_COMPILE([
1336 #include <sys/types.h>
1337 #include <utmp.h>
1338 #ifdef HAVE_UTMPX_H
1339 #include <utmpx.h>
1340 #endif
1341 #ifdef HAVE_PATHS_H
1342 #  include <paths.h>
1343 #endif
1344         ],
1345         [ char *utmpx = UTMPX_FILE; ],
1346         [ AC_MSG_RESULT(yes) ],
1347         [ AC_MSG_RESULT(no)
1348           system_utmpx_path=no ]
1349 )
1350 if test -z "$conf_utmpx_location"; then
1351         if test x"$system_utmpx_path" = x"no" ; then
1352                 AC_DEFINE(DISABLE_UTMPX)
1353         fi
1354 else
1355         AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1356 fi      
1357
1358 dnl wtmpx detection
1359 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1360 AC_TRY_COMPILE([
1361 #include <sys/types.h>
1362 #include <utmp.h>
1363 #ifdef HAVE_UTMPX_H
1364 #include <utmpx.h>
1365 #endif
1366 #ifdef HAVE_PATHS_H
1367 #  include <paths.h>
1368 #endif
1369         ],
1370         [ char *wtmpx = WTMPX_FILE; ],
1371         [ AC_MSG_RESULT(yes) ],
1372         [ AC_MSG_RESULT(no)
1373           system_wtmpx_path=no ]
1374 )
1375 if test -z "$conf_wtmpx_location"; then
1376         if test x"$system_wtmpx_path" = x"no" ; then
1377                 AC_DEFINE(DISABLE_WTMPX)
1378         fi
1379 else
1380         AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1381 fi      
1382
1383
1384 # Change default command timeout for builtin PRNG
1385 entropy_timeout=200
1386 AC_ARG_WITH(entropy-timeout,
1387         [  --with-entropy-timeout  Specify entropy gathering command timeout (msec)],
1388         [
1389                 if test "x$withval" != "xno" ; then
1390                         entropy_timeout=$withval
1391                 fi
1392         ]       
1393 )
1394 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1395
1396
1397 if test ! -z "$blibpath" ; then
1398         LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1399         AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1400 fi
1401
1402 AC_OUTPUT(Makefile ssh_prng_cmds)
1403
1404 # Print summary of options
1405
1406 if test x$MANTYPE = x'$(CATMAN)' ; then
1407         MAN_MSG=cat
1408 else 
1409         MAN_MSG=man
1410 fi
1411 if test ! -z "$RANDOM_POOL" ; then
1412         RAND_MSG="Device ($RANDOM_POOL)"
1413 else
1414         if test ! -z "$EGD_SOCKET" ; then
1415                 RAND_MSG="EGD ($EGD_SOCKET)"
1416         else
1417                 RAND_MSG="Builtin (timeout $entropy_timeout)"
1418         fi
1419 fi
1420
1421 # Someone please show me a better way :)
1422 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1423 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1424 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1425 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
1426 E=`eval echo ${libexecdir}/ssh/ssh-askpass` ; E=`eval echo ${E}`
1427 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
1428 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
1429
1430 echo ""
1431 echo "OpenSSH configured has been configured with the following options."
1432 echo "                 User binaries: $B"
1433 echo "               System binaries: $C"
1434 echo "           Configuration files: $D"
1435 echo "               Askpass program: $E"
1436 echo "                  Manual pages: $F"
1437 echo "                      PID file: $G"
1438 echo "      Random number collection: $RAND_MSG"
1439 echo "                Manpage format: $MAN_MSG"
1440 echo "                   PAM support: ${PAM_MSG}"
1441 echo "            KerberosIV support: $KRB4_MSG"
1442 echo "                   AFS support: $AFS_MSG"
1443 echo "                 S/KEY support: $SKEY_MSG"
1444 echo "          TCP Wrappers support: $TCPW_MSG"
1445 echo "          MD5 password support: $MD5_MSG"
1446 echo "   IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1447 echo "      Use IPv4 by default hack: $IPV4_HACK_MSG"
1448 echo "       Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1449
1450 echo ""
1451
1452 echo "Compiler flags: ${CFLAGS}"
1453 echo "Linker flags: ${LDFLAGS}"
1454 echo "Libraries: ${LIBS}"
1455
1456 echo ""
1457
This page took 0.24882 seconds and 5 git commands to generate.