blob: a038c959477c874e0b54791f3057a3a1a197c8eb [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 Miller856799b2000-03-15 21:18:10 +11004AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11005AC_CANONICAL_HOST
Damien Miller7f6ea021999-10-28 13:25:17 +10006
Damien Millera22ba012000-03-02 23:09:20 +11007# Checks for programs.
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 Miller8d1fd572000-05-17 21:34:07 +100014AC_PATH_PROG(ENT, ent)
15AC_SUBST(ENT)
Damien Miller78315eb2000-09-29 23:01:36 +110016AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
Damien Miller2e1b0821999-12-25 10:11:29 +110017
Damien Millerad833b32000-08-23 10:46:23 +100018# Use LOGIN_PROGRAM from environment if possible
19if test ! -z "$LOGIN_PROGRAM" ; then
20 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
21else
22 # Search for login
23 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
24 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
25 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
26 fi
27fi
28
Damien Miller166bd442000-03-16 10:48:25 +110029if test -z "$LD" ; then
30 LD=$CC
31fi
32AC_SUBST(LD)
33
34# C Compiler features
35AC_C_INLINE
36if test "$GCC" = "yes"; then
37 CFLAGS="$CFLAGS -Wall"
38fi
39
Damien Miller78315eb2000-09-29 23:01:36 +110040CFLAGS="$CFLAGS -I. -I${srcdir-.}"
41
Damien Millera22ba012000-03-02 23:09:20 +110042# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110043case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110044*-*-aix*)
45 AFS_LIBS="-lld"
Damien Millerdb819592000-03-14 13:44:01 +110046 CFLAGS="$CFLAGS -I/usr/local/include"
47 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100048 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Miller29ea30d2000-03-17 10:54:15 +110049 blibpath="/usr/lib:/lib:/usr/local/lib"
50 fi
Damien Millerd2c208a2000-05-17 22:00:02 +100051 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
Damien Millereca71f82000-01-20 22:38:27 +110052 AC_DEFINE(BROKEN_GETADDRINFO)
andree441aa32000-06-12 22:34:38 +000053 MANTYPE='$(CATMAN)'
54 mansubdir=cat
andre60f3c982000-06-03 16:18:19 +000055 dnl AIX handles lastlog as part of its login message
56 AC_DEFINE(DISABLE_LASTLOG)
Damien Miller5fc85652000-07-09 23:53:07 +100057 MANTYPE='$(CATMAN)'
58 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +110059 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110060*-*-cygwin*)
61 LIBS="$LIBS /usr/lib/textmode.o"
62 AC_DEFINE(HAVE_CYGWIN)
63 AC_DEFINE(DISABLE_PAM)
64 AC_DEFINE(DISABLE_SHADOW)
65 AC_DEFINE(IPV4_DEFAULT)
66 AC_DEFINE(IP_TOS_IS_BROKEN)
67 AC_DEFINE(BROKEN_VHANGUP)
68 no_pam=1
69 no_libsocket=1
70 no_libnsl=1
71 ;;
Damien Miller76112de1999-12-21 11:18:08 +110072*-*-hpux10*)
73 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100074 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110075 fi
76 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110077 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +100078 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110079 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110080 AC_DEFINE(DISABLE_UTMP)
Damien Miller8a1e6a62000-09-16 15:55:52 +110081 LIBS="$LIBS -lsec"
Damien Miller670a4b82000-01-22 13:53:11 +110082 MANTYPE='$(CATMAN)'
83 mansubdir=cat
Damien Miller76112de1999-12-21 11:18:08 +110084 ;;
Damien Miller1bead332000-04-30 00:47:29 +100085*-*-hpux11*)
Damien Miller1bead332000-04-30 00:47:29 +100086 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110087 IPADDR_IN_DISPLAY=yes
Damien Miller5552d7a2000-08-30 09:53:24 +110088 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110089 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110090 AC_DEFINE(DISABLE_UTMP)
Damien Miller8a1e6a62000-09-16 15:55:52 +110091 LIBS="$LIBS -lsec"
Damien Miller1bead332000-04-30 00:47:29 +100092 MANTYPE='$(CATMAN)'
93 mansubdir=cat
94 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +110095*-*-irix5*)
Damien Millerdb819592000-03-14 13:44:01 +110096 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +100097 LDFLAGS="$LDFLAGS"
Damien Miller07278932000-01-22 14:05:37 +110098 MANTYPE='$(CATMAN)'
Damien Miller1808f382000-01-06 12:03:12 +110099 no_libsocket=1
100 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000101 AC_DEFINE(BROKEN_INET_NTOA)
Damien Miller1808f382000-01-06 12:03:12 +1100102 ;;
103*-*-irix6*)
Damien Millerdb819592000-03-14 13:44:01 +1100104 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000105 LDFLAGS="$LDFLAGS"
Damien Miller07278932000-01-22 14:05:37 +1100106 MANTYPE='$(CATMAN)'
Damien Miller91606b12000-06-28 08:22:29 +1000107 AC_DEFINE(WITH_IRIX_ARRAY)
108 AC_DEFINE(WITH_IRIX_PROJECT)
109 AC_DEFINE(WITH_IRIX_AUDIT)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100110 no_libsocket=1
111 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000112 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100113 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100114*-*-linux*)
115 no_dev_ptmx=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100116 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000117 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100118 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100119 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100120*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100121 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100122 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000123*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000124 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100125 conf_utmp_location=/etc/utmp
126 conf_wtmp_location=/usr/adm/wtmp
127 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000128 AC_DEFINE(HAVE_NEXT)
129 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000130 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100131*-*-solaris*)
Damien Millerdb819592000-03-14 13:44:01 +1100132 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller08c788a2000-03-16 07:52:29 +1100133 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
Damien Millera22ba012000-03-02 23:09:20 +1100134 need_dash_r=1
andre2ff7b5d2000-06-03 14:57:40 +0000135 # hardwire lastlog location (can't detect it on some versions)
136 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000137 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
138 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
139 if test "$sol2ver" -ge 8; then
140 AC_MSG_RESULT(yes)
141 AC_DEFINE(DISABLE_UTMP)
142 AC_DEFINE(DISABLE_WTMP)
143 else
144 AC_MSG_RESULT(no)
145 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100146 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000147*-*-sunos4*)
148 CFLAGS="$CFLAGS -DSUNOS4"
149 AC_CHECK_FUNCS(getpwanam)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000150 conf_utmp_location=/etc/utmp
151 conf_wtmp_location=/var/adm/wtmp
152 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000153 AC_DEFINE(USE_PIPES)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000154 MANTYPE='$(CATMAN)'
155 mansubdir=cat
Damien Millerdfc83f42000-05-20 15:02:59 +1000156 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000157*-sni-sysv*)
158 CFLAGS="$CFLAGS -I/usr/local/include"
159 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
160 MANTYPE='$(CATMAN)'
161 AC_DEFINE(IP_TOS_IS_BROKEN)
162 mansubdir=cat
Damien Millerb2dc28e2000-07-12 09:18:33 +1000163 LIBS="$LIBS -lgen -lnsl -lucb"
Damien Miller2ae714f2000-07-11 09:29:50 +1000164 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100165*-*-sysv4.2*)
166 CFLAGS="$CFLAGS -I/usr/local/include"
167 LDFLAGS="$LDFLAGS -L/usr/local/lib"
168 MANTYPE='$(CATMAN)'
169 mansubdir=cat
170 LIBS="$LIBS -lgen -lsocket -lnsl -lresolv"
171 enable_suid_ssh=no
172 ;;
173*-*-sysv5*)
174 CFLAGS="$CFLAGS -I/usr/local/include"
175 LDFLAGS="$LDFLAGS -L/usr/local/lib"
176 MANTYPE='$(CATMAN)'
177 mansubdir=cat
178 LIBS="$LIBS -lgen -lsocket"
179 enable_suid_ssh=no
180 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100181*-*-sysv*)
Damien Millerdb819592000-03-14 13:44:01 +1100182 CFLAGS="$CFLAGS -I/usr/local/include"
183 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller0e1cf7c2000-01-26 12:15:30 +1100184 MANTYPE='$(CATMAN)'
185 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +1100186 LIBS="$LIBS -lgen -lsocket"
187 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100188*-*-sco3.2v4*)
Damien Miller238a9fa2000-08-31 09:20:05 +1100189 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100190 CFLAGS="$CFLAGS -Dftruncate=chsize -I/usr/local/include"
191 LDFLAGS="$LDFLAGS -L/usr/local/lib"
192 MANTYPE='$(CATMAN)'
193 mansubdir=cat
194 LIBS="$LIBS -lgen -lsocket -los -lprot -lx"
195 no_dev_ptmx=1
196 RANLIB=true
197 AC_DEFINE(BROKEN_SYS_TERMIO_H)
198 rsh_path="/usr/bin/rcmd"
199 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
200 ;;
201*-*-sco3.2v5*)
Damien Millera66626b2000-06-13 18:57:53 +1000202 CFLAGS="$CFLAGS -I/usr/local/include"
203 LDFLAGS="$LDFLAGS -L/usr/local/lib"
204 MANTYPE='$(CATMAN)'
205 mansubdir=cat
Damien Miller78315eb2000-09-29 23:01:36 +1100206 LIBS="$LIBS -lgen -lsocket -lprot -lx"
Damien Millera66626b2000-06-13 18:57:53 +1000207 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100208 rsh_path="/usr/bin/rcmd"
209 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Damien Millera66626b2000-06-13 18:57:53 +1000210 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000211*-dec-osf*)
212# This is untested
213 if test ! -z "USE_SIA" ; then
214 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
215 if test -f /etc/sia/matrix.conf; then
216 AC_MSG_RESULT(yes)
217 AC_DEFINE(HAVE_OSF_SIA)
218 AC_DEFINE(DISABLE_LOGIN)
219 LIBS="$LIBS -lsecurity -ldb -lm -laud"
220 else
221 AC_MSG_RESULT(no)
222 fi
223 fi
224 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100225esac
226
Damien Millere37bfc12000-06-05 09:37:43 +1000227# Allow user to specify flags
228AC_ARG_WITH(cflags,
229 [ --with-cflags Specify additional flags to pass to compiler],
230 [
231 if test "x$withval" != "xno" ; then
232 CFLAGS="$CFLAGS $withval"
233 fi
234 ]
235)
236AC_ARG_WITH(ldflags,
237 [ --with-ldlags Specify additional flags to pass to linker],
238 [
239 if test "x$withval" != "xno" ; then
240 LDFLAGS="$LDFLAGS $withval"
241 fi
242 ]
243)
244AC_ARG_WITH(libs,
245 [ --with-libs Specify additional libraries to link with],
246 [
247 if test "x$withval" != "xno" ; then
248 LIBS="$LIBS $withval"
249 fi
250 ]
251)
252
253
Damien Millera22ba012000-03-02 23:09:20 +1100254# Checks for libraries.
Damien Millerab18c411999-11-11 10:40:23 +1100255AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
256AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Millerab18c411999-11-11 10:40:23 +1100257
Damien Millerbeb4ba51999-12-28 15:09:35 +1100258if test -z "$no_libsocket" ; then
259 AC_CHECK_LIB(nsl, yp_match, , )
260fi
261if test -z "$no_libnsl" ; then
262 AC_CHECK_LIB(socket, main, , )
Damien Miller32b3cf21999-12-26 10:21:48 +1100263fi
Damien Millerab18c411999-11-11 10:40:23 +1100264
Damien Millera22ba012000-03-02 23:09:20 +1100265# Checks for header files.
Damien Miller78315eb2000-09-29 23:01:36 +1100266AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.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 sys/un.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h)
Damien Millerab18c411999-11-11 10:40:23 +1100267
Damien Millerad833b32000-08-23 10:46:23 +1000268dnl Checks for library functions.
Damien Miller78315eb2000-09-29 23:01:36 +1100269AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock fchmod freeaddrinfo futimes 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 setrlimit sigaction sigvec snprintf strerror strlcat strlcpy strsep strtok_r vsnprintf vhangup _getpty __b64_ntop)
Damien Millerad833b32000-08-23 10:46:23 +1000270dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000271AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000272dnl Checks for libutil functions
andre2ff7b5d2000-06-03 14:57:40 +0000273AC_CHECK_FUNCS(login logout updwtmp logwtmp)
Damien Millerad833b32000-08-23 10:46:23 +1000274dnl Checks for utmp functions
andre2ff7b5d2000-06-03 14:57:40 +0000275AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
276AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000277dnl Checks for utmpx functions
andre2ff7b5d2000-06-03 14:57:40 +0000278AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
279AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100280
Damien Miller5fc85652000-07-09 23:53:07 +1000281AC_CHECK_FUNC(getuserattr,
282 [AC_DEFINE(HAVE_GETUSERATTR)],
283 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
284)
285
Damien Miller04f80141999-11-19 15:32:34 +1100286AC_CHECK_FUNC(login,
287 [AC_DEFINE(HAVE_LOGIN)],
288 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
289)
290
291AC_CHECK_FUNC(daemon,
292 [AC_DEFINE(HAVE_DAEMON)],
293 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
294)
295
Damien Miller9fb07e42000-03-05 16:22:59 +1100296AC_CHECK_FUNC(getpagesize,
297 [AC_DEFINE(HAVE_GETPAGESIZE)],
298 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
299)
300
Damien Millercb170cb2000-07-01 16:52:55 +1000301# Check for broken snprintf
302if test "x$ac_cv_func_snprintf" = "xyes" ; then
303 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
304 AC_TRY_RUN(
305 [
306#include <stdio.h>
307int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
308 ],
309 [AC_MSG_RESULT(yes)],
310 [
311 AC_MSG_RESULT(no)
312 AC_DEFINE(BROKEN_SNPRINTF)
313 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
314 ]
315 )
316fi
317
Damien Miller606f8802000-09-16 15:39:56 +1100318AC_FUNC_GETPGRP
319
Damien Miller7b22d652000-06-18 14:07:04 +1000320PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100321AC_ARG_WITH(pam,
322 [ --without-pam Disable PAM support ],
323 [
324 if test "x$withval" = "xno" ; then
325 no_pam=1
326 AC_DEFINE(DISABLE_PAM)
Damien Miller7b22d652000-06-18 14:07:04 +1000327 PAM_MSG="disabled"
Damien Millera22ba012000-03-02 23:09:20 +1100328 fi
329 ]
330)
Damien Milleredb82922000-06-20 13:25:52 +1000331if (test -z "$no_pam" && test "x$ac_cv_header_security_pam_appl_h" = "xyes") ; then
Damien Millera22ba012000-03-02 23:09:20 +1100332 AC_CHECK_LIB(dl, dlopen, , )
333 LIBS="$LIBS -lpam"
334
Damien Miller0e65eed2000-05-17 22:16:05 +1000335 AC_CHECK_FUNCS(pam_getenvlist)
Damien Miller1bead332000-04-30 00:47:29 +1000336
Damien Miller1f335fb2000-06-26 11:31:33 +1000337 disable_shadow=yes
338
Damien Miller7b22d652000-06-18 14:07:04 +1000339 PAM_MSG="yes"
340
Damien Millera22ba012000-03-02 23:09:20 +1100341 # Check PAM strerror arguments (old PAM)
342 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
343 AC_TRY_COMPILE(
344 [
Damien Miller81171112000-04-23 11:14:01 +1000345#include <stdlib.h>
346#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100347 ],
348 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
349 [AC_MSG_RESULT(no)],
350 [
351 AC_DEFINE(HAVE_OLD_PAM)
352 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000353 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100354 ]
355 )
356fi
357
358# The big search for OpenSSL
359AC_ARG_WITH(ssl-dir,
360 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
361 [
362 if test "x$withval" != "$xno" ; then
363 tryssldir=$withval
364 fi
365 ]
366)
367
368saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100369saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100370saved_CFLAGS="$CFLAGS"
371if test "x$prefix" != "xNONE" ; then
372 tryssldir="$tryssldir $prefix"
373fi
Damien Miller61e50f12000-05-08 20:49:37 +1000374AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera22ba012000-03-02 23:09:20 +1100375
Damien Millera1b61e12000-09-16 17:02:16 +1100376 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
Damien Miller61e50f12000-05-08 20:49:37 +1000377 if test ! -z "$ssldir" ; then
378 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
379 CFLAGS="$saved_CFLAGS -I$ssldir/include"
380 if test ! -z "$need_dash_r" ; then
381 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
382 fi
Damien Millera1ad4802000-03-15 10:04:54 +1100383 else
Damien Miller61e50f12000-05-08 20:49:37 +1000384 LDFLAGS="$saved_LDFLAGS"
Damien Millerb85dcad2000-03-11 11:37:00 +1100385 fi
386
Damien Miller3b512e12000-05-17 23:29:18 +1000387 LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000388
Damien Miller3b512e12000-05-17 23:29:18 +1000389 # Basic test to check for compatible version and correct linking
390 # *does not* test for RSA - that comes later.
391 AC_TRY_RUN(
392 [
Damien Millere59ce622000-05-01 20:54:17 +1000393#include <string.h>
394#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000395int main(void)
396{
Damien Miller3b512e12000-05-17 23:29:18 +1000397 char a[2048];
398 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000399 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000400 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000401}
Damien Miller3b512e12000-05-17 23:29:18 +1000402 ],
403 [
404 found_crypto=1
405 break;
406 ], []
407 )
Damien Miller61e50f12000-05-08 20:49:37 +1000408
409 if test ! -z "$found_crypto" ; then
410 break;
411 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100412 done
413
Damien Miller61e50f12000-05-08 20:49:37 +1000414 if test -z "$found_crypto" ; then
415 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
Damien Millerb85dcad2000-03-11 11:37:00 +1100416 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000417 if test -z "$ssldir" ; then
418 ssldir="(system)"
419 fi
Damien Millera22ba012000-03-02 23:09:20 +1100420
Damien Miller61e50f12000-05-08 20:49:37 +1000421 ac_cv_openssldir=$ssldir
422])
423
Damien Milleredb82922000-06-20 13:25:52 +1000424if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000425 AC_DEFINE(HAVE_OPENSSL)
426 dnl Need to recover ssldir - test above runs in subshell
427 ssldir=$ac_cv_openssldir
Damien Millera1ad4802000-03-15 10:04:54 +1100428 CFLAGS="$saved_CFLAGS -I$ssldir/include"
429 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
430 if test ! -z "$need_dash_r" ; then
431 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
Damien Millera22ba012000-03-02 23:09:20 +1100432 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100433 if test ! -z "$blibpath" ; then
434 blibpath="$blibpath:$ssldir:$ssldir/lib"
435 fi
Damien Millera22ba012000-03-02 23:09:20 +1100436fi
Damien Miller3b512e12000-05-17 23:29:18 +1000437LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000438
Damien Miller3b512e12000-05-17 23:29:18 +1000439# Now test RSA support
440saved_LIBS="$LIBS"
441AC_MSG_CHECKING([for RSA support])
442for WANTS_RSAREF in "" 1 ; do
443 if test -z "$WANTS_RSAREF" ; then
444 LIBS="$saved_LIBS"
445 else
446 LIBS="$saved_LIBS -lRSAglue -lrsaref"
447 fi
448 AC_TRY_RUN([
449#include <string.h>
450#include <openssl/rand.h>
451#include <openssl/rsa.h>
452#include <openssl/bn.h>
453#include <openssl/sha.h>
454int main(void)
455{
456 int num; RSA *key; static unsigned char p_in[] = "blahblah";
457 unsigned char c[256], p[256];
458 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
459 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
460 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
461 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
462}
463 ],
464 [
465 rsa_works=1
466 break;
467 ], [])
468done
469
470if test ! -z "$no_rsa" ; then
471 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000472 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000473else
474 if test -z "$rsa_works" ; then
475 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000476 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000477 else
478 if test -z "$WANTS_RSAREF" ; then
479 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000480 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000481 else
Damien Miller7b22d652000-06-18 14:07:04 +1000482 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000483 AC_MSG_RESULT(using RSAref)
484 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
485 fi
486 fi
487fi
Damien Millera22ba012000-03-02 23:09:20 +1100488
489# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100490AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100491AC_CHECK_SIZEOF(short int, 2)
492AC_CHECK_SIZEOF(int, 4)
493AC_CHECK_SIZEOF(long int, 4)
494AC_CHECK_SIZEOF(long long int, 8)
495
Damien Millera22ba012000-03-02 23:09:20 +1100496# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100497AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
498 AC_TRY_COMPILE(
499 [ #include <sys/types.h> ],
500 [ u_int a; a = 1;],
501 [ ac_cv_have_u_int="yes" ],
502 [ ac_cv_have_u_int="no" ]
503 )
504])
505if test "x$ac_cv_have_u_int" = "xyes" ; then
506 AC_DEFINE(HAVE_U_INT)
507 have_u_int=1
508fi
509
Damien Miller61e50f12000-05-08 20:49:37 +1000510AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
511 AC_TRY_COMPILE(
512 [ #include <sys/types.h> ],
513 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
514 [ ac_cv_have_intxx_t="yes" ],
515 [ ac_cv_have_intxx_t="no" ]
516 )
517])
518if test "x$ac_cv_have_intxx_t" = "xyes" ; then
519 AC_DEFINE(HAVE_INTXX_T)
520 have_intxx_t=1
521fi
522
Damien Miller578783e2000-09-23 14:12:24 +1100523AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
524 AC_TRY_COMPILE(
525 [ #include <sys/types.h> ],
526 [ int64_t a; a = 1;],
527 [ ac_cv_have_int64_t="yes" ],
528 [ ac_cv_have_int64_t="no" ]
529 )
530])
531if test "x$ac_cv_have_int64_t" = "xyes" ; then
532 AC_DEFINE(HAVE_INT64_T)
533 have_int64_t=1
534fi
535
Damien Miller61e50f12000-05-08 20:49:37 +1000536AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
537 AC_TRY_COMPILE(
538 [ #include <sys/types.h> ],
539 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
540 [ ac_cv_have_u_intxx_t="yes" ],
541 [ ac_cv_have_u_intxx_t="no" ]
542 )
543])
544if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
545 AC_DEFINE(HAVE_U_INTXX_T)
546 have_u_intxx_t=1
547fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100548
Damien Miller578783e2000-09-23 14:12:24 +1100549AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
550 AC_TRY_COMPILE(
551 [ #include <sys/types.h> ],
552 [ u_int64_t a; a = 1;],
553 [ ac_cv_have_u_int64_t="yes" ],
554 [ ac_cv_have_u_int64_t="no" ]
555 )
556])
557if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
558 AC_DEFINE(HAVE_U_INT64_T)
559 have_u_int64_t=1
560fi
561
Damien Milleredb82922000-06-20 13:25:52 +1000562if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
563 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +1100564then
565 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
566 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000567 [
568#include <sys/bitypes.h>
569 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100570 [
Damien Miller70494d12000-04-03 15:57:06 +1000571 int8_t a; int16_t b; int32_t c;
572 u_int8_t e; u_int16_t f; u_int32_t g;
573 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100574 ],
575 [
576 AC_DEFINE(HAVE_U_INTXX_T)
577 AC_DEFINE(HAVE_INTXX_T)
578 AC_MSG_RESULT(yes)
579 ],
580 [AC_MSG_RESULT(no)]
581 )
582fi
583
Damien Millerd6121d22000-03-17 23:26:46 +1100584if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000585 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
586 AC_TRY_COMPILE(
587 [
588#include <sys/types.h>
589 ],
590 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
591 [ ac_cv_have_uintxx_t="yes" ],
592 [ ac_cv_have_uintxx_t="no" ]
593 )
594 ])
595 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
596 AC_DEFINE(HAVE_UINTXX_T)
597 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100598fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100599
Damien Miller61e50f12000-05-08 20:49:37 +1000600AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
601 AC_TRY_COMPILE(
602 [
Damien Miller81171112000-04-23 11:14:01 +1000603#include <sys/types.h>
604#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000605 ],
606 [socklen_t foo; foo = 1235;],
607 [ ac_cv_have_socklen_t="yes" ],
608 [ ac_cv_have_socklen_t="no" ]
609 )
610])
611if test "x$ac_cv_have_socklen_t" = "xyes" ; then
612 AC_DEFINE(HAVE_SOCKLEN_T)
613fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100614
Damien Miller61e50f12000-05-08 20:49:37 +1000615AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
616 AC_TRY_COMPILE(
617 [
618#include <sys/types.h>
619 ],
620 [ size_t foo; foo = 1235; ],
621 [ ac_cv_have_size_t="yes" ],
622 [ ac_cv_have_size_t="no" ]
623 )
624])
625if test "x$ac_cv_have_size_t" = "xyes" ; then
626 AC_DEFINE(HAVE_SIZE_T)
627fi
Damien Miller95058511999-12-29 10:36:45 +1100628
Damien Miller615f9392000-05-17 22:53:33 +1000629AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
630 AC_TRY_COMPILE(
631 [
632#include <sys/types.h>
633 ],
634 [ ssize_t foo; foo = 1235; ],
635 [ ac_cv_have_ssize_t="yes" ],
636 [ ac_cv_have_ssize_t="no" ]
637 )
638])
639if test "x$ac_cv_have_ssize_t" = "xyes" ; then
640 AC_DEFINE(HAVE_SSIZE_T)
641fi
642
Damien Millerb54b40e2000-06-23 08:23:34 +1000643AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
644 AC_TRY_COMPILE(
645 [
646#include <sys/types.h>
647#include <sys/socket.h>
648 ],
649 [ sa_family_t foo; foo = 1235; ],
650 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +1100651 [ AC_TRY_COMPILE(
652 [
653#include <sys/types.h>
654#include <sys/socket.h>
655#include <netinet/in.h>
656 ],
657 [ sa_family_t foo; foo = 1235; ],
658 [ ac_cv_have_sa_family_t="yes" ],
659
Damien Millerb54b40e2000-06-23 08:23:34 +1000660 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +1100661 )]
Damien Millerb54b40e2000-06-23 08:23:34 +1000662 )
663])
664if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
665 AC_DEFINE(HAVE_SA_FAMILY_T)
666fi
667
Damien Miller0f91b4e2000-06-18 15:43:25 +1000668AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
669 AC_TRY_COMPILE(
670 [
671#include <sys/types.h>
672 ],
673 [ pid_t foo; foo = 1235; ],
674 [ ac_cv_have_pid_t="yes" ],
675 [ ac_cv_have_pid_t="no" ]
676 )
677])
678if test "x$ac_cv_have_pid_t" = "xyes" ; then
679 AC_DEFINE(HAVE_PID_T)
680fi
681
682AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
683 AC_TRY_COMPILE(
684 [
685#include <sys/types.h>
686 ],
687 [ mode_t foo; foo = 1235; ],
688 [ ac_cv_have_mode_t="yes" ],
689 [ ac_cv_have_mode_t="no" ]
690 )
691])
692if test "x$ac_cv_have_mode_t" = "xyes" ; then
693 AC_DEFINE(HAVE_MODE_T)
694fi
695
Damien Miller61e50f12000-05-08 20:49:37 +1000696
697AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
698 AC_TRY_COMPILE(
699 [
Damien Miller81171112000-04-23 11:14:01 +1000700#include <sys/types.h>
701#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000702 ],
703 [ struct sockaddr_storage s; ],
704 [ ac_cv_have_struct_sockaddr_storage="yes" ],
705 [ ac_cv_have_struct_sockaddr_storage="no" ]
706 )
707])
708if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
709 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
710fi
Damien Miller34132e52000-01-14 15:45:46 +1100711
Damien Miller61e50f12000-05-08 20:49:37 +1000712AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
713 AC_TRY_COMPILE(
714 [
Damien Miller7b22d652000-06-18 14:07:04 +1000715#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000716#include <netinet/in.h>
717 ],
718 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
719 [ ac_cv_have_struct_sockaddr_in6="yes" ],
720 [ ac_cv_have_struct_sockaddr_in6="no" ]
721 )
722])
723if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
724 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
725fi
Damien Miller34132e52000-01-14 15:45:46 +1100726
Damien Miller61e50f12000-05-08 20:49:37 +1000727AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
728 AC_TRY_COMPILE(
729 [
Damien Miller7b22d652000-06-18 14:07:04 +1000730#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000731#include <netinet/in.h>
732 ],
733 [ struct in6_addr s; s.s6_addr[0] = 0; ],
734 [ ac_cv_have_struct_in6_addr="yes" ],
735 [ ac_cv_have_struct_in6_addr="no" ]
736 )
737])
738if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
739 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
740fi
Damien Miller34132e52000-01-14 15:45:46 +1100741
Damien Miller61e50f12000-05-08 20:49:37 +1000742AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
743 AC_TRY_COMPILE(
744 [
Damien Miller81171112000-04-23 11:14:01 +1000745#include <sys/types.h>
746#include <sys/socket.h>
747#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000748 ],
749 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
750 [ ac_cv_have_struct_addrinfo="yes" ],
751 [ ac_cv_have_struct_addrinfo="no" ]
752 )
753])
754if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
755 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
756fi
757
Damien Miller78315eb2000-09-29 23:01:36 +1100758dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +1000759OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
760OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
761OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
762OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
763OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +1000764OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +1000765OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
766OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +1000767OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +1000768OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
769OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
770OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
771OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +0000772OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
773OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
774OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
775OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Damien Miller78315eb2000-09-29 23:01:36 +1100776AC_STRUCT_ST_BLKSIZE
andre2ff7b5d2000-06-03 14:57:40 +0000777
Damien Miller942da032000-08-18 13:59:06 +1000778AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
779 ac_cv_have_sun_len_in_struct_sockaddr_un, [
780 AC_TRY_COMPILE(
781 [
782#include <sys/types.h>
783#include <sys/socket.h>
784 ],
785 [ struct sockaddr_un s; s.sun_len = 1; ],
786 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
787 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
788 )
789])
790if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
791 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
792fi
793
Damien Miller61e50f12000-05-08 20:49:37 +1000794AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
795 ac_cv_have_ss_family_in_struct_ss, [
796 AC_TRY_COMPILE(
797 [
Damien Miller81171112000-04-23 11:14:01 +1000798#include <sys/types.h>
799#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000800 ],
801 [ struct sockaddr_storage s; s.ss_family = 1; ],
802 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
803 [ ac_cv_have_ss_family_in_struct_ss="no" ],
804 )
805])
806if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
807 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
808fi
809
Damien Miller61e50f12000-05-08 20:49:37 +1000810AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
811 ac_cv_have___ss_family_in_struct_ss, [
812 AC_TRY_COMPILE(
813 [
Damien Miller81171112000-04-23 11:14:01 +1000814#include <sys/types.h>
815#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000816 ],
817 [ struct sockaddr_storage s; s.__ss_family = 1; ],
818 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
819 [ ac_cv_have___ss_family_in_struct_ss="no" ]
820 )
821])
822if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
823 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
824fi
Damien Millerbf1c9b21999-12-09 10:16:54 +1100825
Damien Millerad833b32000-08-23 10:46:23 +1000826AC_CACHE_CHECK([for pw_class field in struct passwd],
827 ac_cv_have_pw_class_in_struct_passwd, [
828 AC_TRY_COMPILE(
829 [
830#include <sys/types.h>
831#include <pwd.h>
832 ],
833 [ struct passwd p s; p.pw_class = NULL; ],
834 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
835 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
836 )
837])
838if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
839 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
840fi
841
Damien Miller61e50f12000-05-08 20:49:37 +1000842
843AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
844 AC_TRY_LINK([],
845 [ extern char *__progname; printf("%s", __progname); ],
846 [ ac_cv_libc_defines___progname="yes" ],
847 [ ac_cv_libc_defines___progname="no" ]
848 )
849])
850if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
851 AC_DEFINE(HAVE___PROGNAME)
852fi
853
Damien Millera22ba012000-03-02 23:09:20 +1100854
Damien Millerecbb26d2000-07-15 14:59:14 +1000855AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
856 AC_TRY_LINK([],
857 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
858 [ ac_cv_libc_defines_sys_errlist="yes" ],
859 [ ac_cv_libc_defines_sys_errlist="no" ]
860 )
861])
862if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
863 AC_DEFINE(HAVE_SYS_ERRLIST)
864fi
865
866
Damien Miller11fa2cc2000-08-16 10:35:58 +1000867AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
868 AC_TRY_LINK([],
869 [ extern int sys_nerr; printf("%i", sys_nerr);],
870 [ ac_cv_libc_defines_sys_nerr="yes" ],
871 [ ac_cv_libc_defines_sys_nerr="no" ]
872 )
873])
874if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
875 AC_DEFINE(HAVE_SYS_NERR)
876fi
877
878
Damien Millera22ba012000-03-02 23:09:20 +1100879# Looking for programs, paths and files
880AC_ARG_WITH(rsh,
881 [ --with-rsh=PATH Specify path to remote shell program ],
882 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100883 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +1000884 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +1100885 fi
886 ],
887 [
888 AC_PATH_PROG(rsh_path, rsh)
889 ]
890)
891
892AC_ARG_WITH(xauth,
893 [ --with-xauth=PATH Specify path to xauth program ],
894 [
895 if test "x$withval" != "$xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +1000896 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +1100897 fi
898 ],
899 [
Damien Miller78315eb2000-09-29 23:01:36 +1100900 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
Damien Milleredb82922000-06-20 13:25:52 +1000901 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +1100902 xauth_path="/usr/openwin/bin/xauth"
903 fi
904 ]
905)
906
907if test ! -z "$xauth_path" ; then
908 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
909fi
910if test ! -z "$rsh_path" ; then
911 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
912fi
913
914# Check for mail directory (last resort if we cannot get it from headers)
915if test ! -z "$MAIL" ; then
916 maildir=`dirname $MAIL`
917 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
918fi
919
Damien Millera22ba012000-03-02 23:09:20 +1100920if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +1100921 AC_CHECK_FILE("/dev/ptmx",
922 [
923 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
924 have_dev_ptmx=1
925 ]
926 )
Damien Millera22ba012000-03-02 23:09:20 +1100927fi
Damien Miller204ad072000-03-02 23:56:12 +1100928AC_CHECK_FILE("/dev/ptc",
929 [
930 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
931 have_dev_ptc=1
932 ]
933)
934
Damien Millera22ba012000-03-02 23:09:20 +1100935# Options from here on. Some of these are preset by platform above
936
Damien Millera22ba012000-03-02 23:09:20 +1100937# Check for user-specified random device, otherwise check /dev/urandom
938AC_ARG_WITH(random,
939 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
940 [
Damien Miller040f3832000-04-03 14:50:43 +1000941 if test "x$withval" != "xno" ; then
942 RANDOM_POOL="$withval";
943 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
944 fi
Damien Millera22ba012000-03-02 23:09:20 +1100945 ],
946 [
947 # Check for random device
948 AC_CHECK_FILE("/dev/urandom",
949 [
950 RANDOM_POOL="/dev/urandom";
951 AC_SUBST(RANDOM_POOL)
952 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
953 ]
954 )
955 ]
956)
957
958# Check for EGD pool file
959AC_ARG_WITH(egd-pool,
960 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
961 [
Damien Miller040f3832000-04-03 14:50:43 +1000962 if test "x$withval" != "xno" ; then
963 EGD_SOCKET="$withval";
964 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
965 fi
Damien Millera22ba012000-03-02 23:09:20 +1100966 ]
967)
968
Damien Miller0437b332000-05-02 09:56:41 +1000969# detect pathnames for entropy gathering commands, if we need them
970INSTALL_SSH_PRNG_CMDS=""
971rm -f prng_commands
Damien Milleredb82922000-06-20 13:25:52 +1000972if (test -z "$RANDOM_POOL" && test -z "$EGD_SOCKET") ; then
Damien Miller11e37f62000-04-08 18:23:30 +1000973 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +1000974 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
975 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
976 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
977 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
978 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
979 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
980 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
981 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
982 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
983 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
984 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
985 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
986 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
987 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
988 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
Damien Miller0437b332000-05-02 09:56:41 +1000989
990 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +1000991fi
Damien Miller0437b332000-05-02 09:56:41 +1000992AC_SUBST(INSTALL_SSH_PRNG_CMDS)
993
Damien Miller11e37f62000-04-08 18:23:30 +1000994
Damien Miller670a4b82000-01-22 13:53:11 +1100995AC_ARG_WITH(catman,
996 [ --with-catman=man|cat Install preformatted manpages[no]],
997 [
998 MANTYPE='$(CATMAN)'
999 if test x"$withval" != x"yes" ; then
1000 mansubdir=$withval
1001 else
1002 mansubdir=cat
1003 fi
1004 ], [
1005 if test -z "$MANTYPE" ; then
1006 MANTYPE='$(TROFFMAN)'
1007 mansubdir=man
1008 fi
1009 ]
1010)
1011AC_SUBST(MANTYPE)
1012AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001013
Damien Millera22ba012000-03-02 23:09:20 +11001014# Check whether user wants Kerberos support
Damien Miller7b22d652000-06-18 14:07:04 +10001015KRB4_MSG="no"
Damien Miller80297751999-11-19 13:03:25 +11001016AC_ARG_WITH(kerberos4,
Damien Miller105b7f02000-01-07 08:45:55 +11001017 [ --with-kerberos4=PATH Enable Kerberos 4 support],
Damien Miller80297751999-11-19 13:03:25 +11001018 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001019 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +11001020
1021 if test "x$withval" != "$xyes" ; then
1022 CFLAGS="$CFLAGS -I${withval}/include"
1023 LDFLAGS="$LDFLAGS -L${withval}/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +11001024 if test ! -z "$need_dash_r" ; then
1025 LDFLAGS="$LDFLAGS -R${withval}/lib"
1026 fi
1027 if test ! -z "$blibpath" ; then
1028 blibpath="$blibpath:${withval}/lib"
1029 fi
Damien Miller105b7f02000-01-07 08:45:55 +11001030 else
1031 if test -d /usr/include/kerberosIV ; then
1032 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
1033 fi
1034 fi
1035
1036 AC_CHECK_HEADERS(krb.h)
1037 AC_CHECK_LIB(krb, main)
1038 if test "$ac_cv_header_krb_h" != yes; then
1039 AC_MSG_WARN([Cannot find krb.h, build may fail])
1040 fi
1041 if test "$ac_cv_lib_krb_main" != yes; then
1042 AC_MSG_WARN([Cannot find libkrb, build may fail])
1043 fi
1044
Damien Millerc85f9b42000-01-29 10:20:21 +11001045 KLIBS="-lkrb -ldes"
Damien Miller105b7f02000-01-07 08:45:55 +11001046 AC_CHECK_LIB(resolv, dn_expand, , )
1047 KRB4=yes
Damien Miller7b22d652000-06-18 14:07:04 +10001048 KRB4_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001049 AC_DEFINE(KRB4)
Damien Miller8bdeee21999-12-30 15:50:54 +11001050 fi
Damien Miller80297751999-11-19 13:03:25 +11001051 ]
1052)
1053
Damien Millera22ba012000-03-02 23:09:20 +11001054# Check whether user wants AFS support
Damien Miller7b22d652000-06-18 14:07:04 +10001055AFS_MSG="no"
Damien Millerc6398ef1999-11-20 12:18:40 +11001056AC_ARG_WITH(afs,
Damien Miller105b7f02000-01-07 08:45:55 +11001057 [ --with-afs=PATH Enable AFS support],
Damien Miller80297751999-11-19 13:03:25 +11001058 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001059 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +11001060
1061 if test "x$withval" != "$xyes" ; then
1062 CFLAGS="$CFLAGS -I${withval}/include"
1063 LFLAGS="$LFLAGS -L${withval}/lib"
1064 fi
1065
1066 if test -z "$KRB4" ; then
1067 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1068 fi
1069
Damien Miller8bdeee21999-12-30 15:50:54 +11001070 LIBS="$LIBS -lkafs"
Damien Miller105b7f02000-01-07 08:45:55 +11001071 if test ! -z "$AFS_LIBS" ; then
1072 LIBS="$LIBS $AFS_LIBS"
1073 fi
1074 AC_DEFINE(AFS)
Damien Miller7b22d652000-06-18 14:07:04 +10001075 AFS_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001076 fi
Damien Miller80297751999-11-19 13:03:25 +11001077 ]
1078)
Damien Millerc85f9b42000-01-29 10:20:21 +11001079LIBS="$LIBS $KLIBS"
Damien Miller80297751999-11-19 13:03:25 +11001080
Damien Millera22ba012000-03-02 23:09:20 +11001081# Check whether user wants S/Key support
Damien Miller7b22d652000-06-18 14:07:04 +10001082SKEY_MSG="no"
Damien Miller80297751999-11-19 13:03:25 +11001083AC_ARG_WITH(skey,
1084 [ --with-skey Enable S/Key support],
1085 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001086 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001087 AC_DEFINE(SKEY)
1088 LIBS="$LIBS -lskey"
Damien Miller7b22d652000-06-18 14:07:04 +10001089 SKEY_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001090 fi
Damien Miller80297751999-11-19 13:03:25 +11001091 ]
1092)
1093
Damien Millera22ba012000-03-02 23:09:20 +11001094# Check whether user wants TCP wrappers support
Damien Miller7b22d652000-06-18 14:07:04 +10001095TCPW_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001096AC_ARG_WITH(tcp-wrappers,
Damien Miller80297751999-11-19 13:03:25 +11001097 [ --with-tcp-wrappers Enable tcpwrappers support],
1098 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001099 if test "x$withval" != "xno" ; then
Damien Miller65165f82000-03-05 17:02:45 +11001100 saved_LIBS="$LIBS"
Damien Miller105b7f02000-01-07 08:45:55 +11001101 LIBS="$LIBS -lwrap"
Damien Miller65165f82000-03-05 17:02:45 +11001102 AC_MSG_CHECKING(for libwrap)
1103 AC_TRY_LINK(
1104 [
Damien Miller81171112000-04-23 11:14:01 +10001105#include <tcpd.h>
Damien Miller65165f82000-03-05 17:02:45 +11001106 int deny_severity = 0, allow_severity = 0;
1107 ],
1108 [hosts_access(0);],
1109 [
1110 AC_MSG_RESULT(yes)
1111 AC_DEFINE(LIBWRAP)
Damien Miller7b22d652000-06-18 14:07:04 +10001112 TCPW_MSG="yes"
Damien Miller65165f82000-03-05 17:02:45 +11001113 ],
1114 [
Damien Miller7b22d652000-06-18 14:07:04 +10001115 AC_MSG_ERROR([*** libwrap missing])
Damien Miller65165f82000-03-05 17:02:45 +11001116 ]
1117 )
Damien Miller8bdeee21999-12-30 15:50:54 +11001118 fi
Damien Miller80297751999-11-19 13:03:25 +11001119 ]
1120)
1121
Damien Millera22ba012000-03-02 23:09:20 +11001122# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001123MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001124AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001125 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001126 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001127 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001128 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001129 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001130 fi
1131 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001132)
1133
Damien Millera22ba012000-03-02 23:09:20 +11001134# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001135AC_ARG_WITH(shadow,
1136 [ --without-shadow Disable shadow password support],
1137 [
1138 if test "x$withval" = "xno" ; then
1139 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001140 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001141 fi
1142 ]
1143)
1144
Damien Miller1f335fb2000-06-26 11:31:33 +10001145if test -z "$disable_shadow" ; then
1146 AC_MSG_CHECKING([if the systems has expire shadow information])
1147 AC_TRY_COMPILE(
1148 [
1149#include <sys/types.h>
1150#include <shadow.h>
1151 struct spwd sp;
1152 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1153 [ sp_expire_available=yes ], []
1154 )
1155
1156 if test "x$sp_expire_available" = "xyes" ; then
1157 AC_MSG_RESULT(yes)
1158 AC_DEFINE(HAS_SHADOW_EXPIRE)
1159 else
1160 AC_MSG_RESULT(no)
1161 fi
1162fi
1163
Damien Millera22ba012000-03-02 23:09:20 +11001164# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001165if test ! -z "$IPADDR_IN_DISPLAY" ; then
1166 DISPLAY_HACK_MSG="yes"
1167 AC_DEFINE(IPADDR_IN_DISPLAY)
1168else
1169 DISPLAY_HACK_MSG="no"
1170 AC_ARG_WITH(ipaddr-display,
1171 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1172 [
1173 if test "x$withval" != "xno" ; then
1174 AC_DEFINE(IPADDR_IN_DISPLAY)
1175 DISPLAY_HACK_MSG="yes"
1176 fi
1177 ]
1178 )
1179fi
Damien Miller76112de1999-12-21 11:18:08 +11001180
Damien Millera22ba012000-03-02 23:09:20 +11001181# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001182SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001183AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001184 [ --with-default-path=PATH Specify default \$PATH environment for server],
1185 [
1186 if test "x$withval" != "xno" ; then
Damien Miller78315eb2000-09-29 23:01:36 +11001187 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001188 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001189 fi
1190 ]
1191)
1192
Damien Millera22ba012000-03-02 23:09:20 +11001193# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10001194IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11001195AC_ARG_WITH(ipv4-default,
1196 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1197 [
1198 if test "x$withval" != "xno" ; then
1199 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10001200 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11001201 fi
1202 ]
1203)
1204
Damien Miller61e50f12000-05-08 20:49:37 +10001205AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10001206IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11001207AC_ARG_WITH(4in6,
1208 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1209 [
1210 if test "x$withval" != "xno" ; then
1211 AC_MSG_RESULT(yes)
1212 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001213 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001214 else
1215 AC_MSG_RESULT(no)
1216 fi
1217 ],[
1218 if test "x$inet6_default_4in6" = "xyes"; then
1219 AC_MSG_RESULT([yes (default)])
1220 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001221 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001222 else
1223 AC_MSG_RESULT([no (default)])
1224 fi
1225 ]
1226)
1227
Damien Miller78315eb2000-09-29 23:01:36 +11001228AC_MSG_CHECKING(whether to install ssh as suid root)
1229AC_ARG_ENABLE(suid-ssh,
1230[ --enable-suid-ssh Install ssh as suid root (default)
1231 --disable-suid-ssh Install ssh without suid bit],
1232[ case "$enableval" in
1233 no)
1234 AC_MSG_RESULT(no)
1235 SSHMODE=0711
1236 ;;
1237 *) AC_MSG_RESULT(yes)
1238 SSHMODE=04711
1239 ;;
1240 esac ],
1241 AC_MSG_RESULT(yes)
1242 SSHMODE=04711
1243)
1244AC_SUBST(SSHMODE)
1245
1246
Damien Millera22ba012000-03-02 23:09:20 +11001247# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11001248piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +11001249AC_ARG_WITH(pid-dir,
1250 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1251 [
1252 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +11001253 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +11001254 fi
1255 ]
1256)
Damien Miller4018c192000-04-30 09:30:44 +10001257
Damien Miller78315eb2000-09-29 23:01:36 +11001258# make sure the directory exists
1259if test ! -d $piddir ; then
1260 piddir=`eval echo ${sysconfdir}`
1261 case $piddir in
1262 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1263 esac
1264fi
1265
Damien Millerdbd250f2000-01-18 08:57:14 +11001266AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11001267AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11001268
andre2ff7b5d2000-06-03 14:57:40 +00001269dnl allow user to disable some login recording features
1270AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001271 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001272 [ AC_DEFINE(DISABLE_LASTLOG) ]
1273)
1274AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00001275 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001276 [ AC_DEFINE(DISABLE_UTMP) ]
1277)
1278AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00001279 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001280 [ AC_DEFINE(DISABLE_UTMPX) ]
1281)
1282AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00001283 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001284 [ AC_DEFINE(DISABLE_WTMP) ]
1285)
1286AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00001287 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001288 [ AC_DEFINE(DISABLE_WTMPX) ]
1289)
1290AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00001291 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001292 [ AC_DEFINE(DISABLE_LOGIN) ]
1293)
1294AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00001295 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001296 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1297)
1298AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00001299 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001300 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1301)
1302AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001303 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
andre2ff7b5d2000-06-03 14:57:40 +00001304 [ conf_lastlog_location="$withval"; ],)
1305
1306dnl lastlog, [uw]tmpx? detection
1307dnl NOTE: set the paths in the platform section to avoid the
1308dnl need for command-line parameters
1309dnl lastlog and [uw]tmp are subject to a file search if all else fails
1310
1311dnl lastlog detection
1312dnl NOTE: the code itself will detect if lastlog is a directory
1313AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1314AC_TRY_COMPILE([
1315#include <sys/types.h>
1316#include <utmp.h>
1317#ifdef HAVE_LASTLOG_H
1318# include <lastlog.h>
1319#endif
Damien Miller2994e082000-06-04 15:51:47 +10001320#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001321# include <paths.h>
1322#endif
1323 ],
1324 [ char *lastlog = LASTLOG_FILE; ],
1325 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10001326 [
1327 AC_MSG_RESULT(no)
1328 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1329 AC_TRY_COMPILE([
1330#include <sys/types.h>
1331#include <utmp.h>
1332#ifdef HAVE_LASTLOG_H
1333# include <lastlog.h>
1334#endif
1335#ifdef HAVE_PATHS_H
1336# include <paths.h>
1337#endif
1338 ],
1339 [ char *lastlog = _PATH_LASTLOG; ],
1340 [ AC_MSG_RESULT(yes) ],
1341 [
andree441aa32000-06-12 22:34:38 +00001342 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10001343 system_lastlog_path=no
1344 ])
1345 ]
andre2ff7b5d2000-06-03 14:57:40 +00001346)
Damien Miller2994e082000-06-04 15:51:47 +10001347
andre2ff7b5d2000-06-03 14:57:40 +00001348if test -z "$conf_lastlog_location"; then
1349 if test x"$system_lastlog_path" = x"no" ; then
1350 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10001351 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00001352 conf_lastlog_location=$f
1353 fi
1354 done
1355 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00001356 AC_MSG_WARN([** Cannot find lastlog **])
1357 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00001358 fi
1359 fi
1360fi
1361
1362if test -n "$conf_lastlog_location"; then
1363 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1364fi
1365
1366dnl utmp detection
1367AC_MSG_CHECKING([if your system defines UTMP_FILE])
1368AC_TRY_COMPILE([
1369#include <sys/types.h>
1370#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001371#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001372# include <paths.h>
1373#endif
1374 ],
1375 [ char *utmp = UTMP_FILE; ],
1376 [ AC_MSG_RESULT(yes) ],
1377 [ AC_MSG_RESULT(no)
1378 system_utmp_path=no ]
1379)
1380if test -z "$conf_utmp_location"; then
1381 if test x"$system_utmp_path" = x"no" ; then
1382 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1383 if test -f $f ; then
1384 conf_utmp_location=$f
1385 fi
1386 done
1387 if test -z "$conf_utmp_location"; then
1388 AC_DEFINE(DISABLE_UTMP)
1389 fi
1390 fi
1391fi
1392if test -n "$conf_utmp_location"; then
1393 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1394fi
1395
1396dnl wtmp detection
1397AC_MSG_CHECKING([if your system defines WTMP_FILE])
1398AC_TRY_COMPILE([
1399#include <sys/types.h>
1400#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001401#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001402# include <paths.h>
1403#endif
1404 ],
1405 [ char *wtmp = WTMP_FILE; ],
1406 [ AC_MSG_RESULT(yes) ],
1407 [ AC_MSG_RESULT(no)
1408 system_wtmp_path=no ]
1409)
1410if test -z "$conf_wtmp_location"; then
1411 if test x"$system_wtmp_path" = x"no" ; then
1412 for f in /usr/adm/wtmp /var/log/wtmp; do
1413 if test -f $f ; then
1414 conf_wtmp_location=$f
1415 fi
1416 done
1417 if test -z "$conf_wtmp_location"; then
1418 AC_DEFINE(DISABLE_WTMP)
1419 fi
1420 fi
1421fi
1422if test -n "$conf_wtmp_location"; then
1423 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1424fi
1425
1426
1427dnl utmpx detection - I don't know any system so perverse as to require
1428dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1429dnl there, though.
1430AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1431AC_TRY_COMPILE([
1432#include <sys/types.h>
1433#include <utmp.h>
1434#ifdef HAVE_UTMPX_H
1435#include <utmpx.h>
1436#endif
Damien Miller2994e082000-06-04 15:51:47 +10001437#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001438# include <paths.h>
1439#endif
1440 ],
1441 [ char *utmpx = UTMPX_FILE; ],
1442 [ AC_MSG_RESULT(yes) ],
1443 [ AC_MSG_RESULT(no)
1444 system_utmpx_path=no ]
1445)
1446if test -z "$conf_utmpx_location"; then
1447 if test x"$system_utmpx_path" = x"no" ; then
1448 AC_DEFINE(DISABLE_UTMPX)
1449 fi
1450else
1451 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1452fi
1453
1454dnl wtmpx detection
1455AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1456AC_TRY_COMPILE([
1457#include <sys/types.h>
1458#include <utmp.h>
1459#ifdef HAVE_UTMPX_H
1460#include <utmpx.h>
1461#endif
Damien Miller2994e082000-06-04 15:51:47 +10001462#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001463# include <paths.h>
1464#endif
1465 ],
1466 [ char *wtmpx = WTMPX_FILE; ],
1467 [ AC_MSG_RESULT(yes) ],
1468 [ AC_MSG_RESULT(no)
1469 system_wtmpx_path=no ]
1470)
1471if test -z "$conf_wtmpx_location"; then
1472 if test x"$system_wtmpx_path" = x"no" ; then
1473 AC_DEFINE(DISABLE_WTMPX)
1474 fi
1475else
1476 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1477fi
1478
Damien Miller4018c192000-04-30 09:30:44 +10001479
1480# Change default command timeout for builtin PRNG
Damien Miller14c12cb2000-06-07 22:20:23 +10001481entropy_timeout=200
Damien Miller4018c192000-04-30 09:30:44 +10001482AC_ARG_WITH(entropy-timeout,
1483 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1484 [
1485 if test "x$withval" != "xno" ; then
1486 entropy_timeout=$withval
1487 fi
1488 ]
1489)
1490AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1491
1492
Damien Miller29ea30d2000-03-17 10:54:15 +11001493if test ! -z "$blibpath" ; then
1494 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1495 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1496fi
1497
Damien Millerbac2d8a2000-09-05 16:13:06 +11001498AC_EXEEXT
1499
Damien Miller0437b332000-05-02 09:56:41 +10001500AC_OUTPUT(Makefile ssh_prng_cmds)
1501
Damien Miller7b22d652000-06-18 14:07:04 +10001502# Print summary of options
1503
1504if test x$MANTYPE = x'$(CATMAN)' ; then
1505 MAN_MSG=cat
1506else
1507 MAN_MSG=man
1508fi
1509if test ! -z "$RANDOM_POOL" ; then
1510 RAND_MSG="Device ($RANDOM_POOL)"
1511else
1512 if test ! -z "$EGD_SOCKET" ; then
1513 RAND_MSG="EGD ($EGD_SOCKET)"
1514 else
1515 RAND_MSG="Builtin (timeout $entropy_timeout)"
1516 fi
1517fi
1518
1519# Someone please show me a better way :)
1520A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1521B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1522C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1523D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
1524E=`eval echo ${libexecdir}/ssh/ssh-askpass` ; E=`eval echo ${E}`
1525F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
1526G=`eval echo ${piddir}` ; G=`eval echo ${G}`
1527
1528echo ""
1529echo "OpenSSH configured has been configured with the following options."
1530echo " User binaries: $B"
1531echo " System binaries: $C"
1532echo " Configuration files: $D"
1533echo " Askpass program: $E"
1534echo " Manual pages: $F"
1535echo " PID file: $G"
1536echo " Random number collection: $RAND_MSG"
1537echo " Manpage format: $MAN_MSG"
1538echo " PAM support: ${PAM_MSG}"
1539echo " KerberosIV support: $KRB4_MSG"
1540echo " AFS support: $AFS_MSG"
1541echo " S/KEY support: $SKEY_MSG"
1542echo " TCP Wrappers support: $TCPW_MSG"
1543echo " MD5 password support: $MD5_MSG"
1544echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1545echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1546echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1547
1548echo ""
1549
1550echo "Compiler flags: ${CFLAGS}"
1551echo "Linker flags: ${LDFLAGS}"
1552echo "Libraries: ${LIBS}"
1553
1554echo ""
1555