Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 1 | AC_INIT(ssh.c) |
Damien Miller | 7f6ea02 | 1999-10-28 13:25:17 +1000 | [diff] [blame] | 2 | |
| 3 | AC_CONFIG_HEADER(config.h) |
| 4 | |
| 5 | dnl Checks for programs. |
| 6 | AC_PROG_CC |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 7 | AC_PROG_CPP |
Damien Miller | 7f6ea02 | 1999-10-28 13:25:17 +1000 | [diff] [blame] | 8 | AC_PROG_RANLIB |
Damien Miller | d8087f6 | 1999-11-25 12:31:26 +1100 | [diff] [blame] | 9 | AC_PROG_INSTALL |
Damien Miller | c7b38ce | 1999-11-09 10:28:04 +1100 | [diff] [blame] | 10 | AC_CHECK_PROG(AR, ar, ar) |
Damien Miller | 3b9d5e9 | 1999-12-15 09:34:31 +1100 | [diff] [blame] | 11 | |
| 12 | dnl Checks for compiler characteristics |
Damien Miller | c7b38ce | 1999-11-09 10:28:04 +1100 | [diff] [blame] | 13 | if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi |
Damien Miller | 3b9d5e9 | 1999-12-15 09:34:31 +1100 | [diff] [blame] | 14 | AC_C_INLINE |
Damien Miller | 7f6ea02 | 1999-10-28 13:25:17 +1000 | [diff] [blame] | 15 | |
Damien Miller | c7b38ce | 1999-11-09 10:28:04 +1100 | [diff] [blame] | 16 | dnl Check for OpenSSL/SSLeay directories. |
| 17 | AC_MSG_CHECKING([for OpenSSL/SSLeay directory]) |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 18 | for ssldir in /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local $prefix /usr/pkg ; do |
Damien Miller | a82feb3 | 1999-11-11 11:04:17 +1100 | [diff] [blame] | 19 | if test -f "$ssldir/include/openssl/crypto.h"; then |
| 20 | AC_DEFINE(HAVE_OPENSSL) |
| 21 | GOT_SSL="yes" |
| 22 | break |
| 23 | fi |
| 24 | if test -f "$ssldir/include/ssl/crypto.h"; then |
| 25 | AC_DEFINE(HAVE_SSL) |
| 26 | GOT_SSL="yes" |
| 27 | break |
| 28 | fi |
Damien Miller | c7b38ce | 1999-11-09 10:28:04 +1100 | [diff] [blame] | 29 | done |
Damien Miller | a82feb3 | 1999-11-11 11:04:17 +1100 | [diff] [blame] | 30 | if test -z "$GOT_SSL" ; then |
| 31 | AC_MSG_ERROR([Could not find SSLeay / OpenSSL libraries, please install]) |
| 32 | fi |
Damien Miller | c7b38ce | 1999-11-09 10:28:04 +1100 | [diff] [blame] | 33 | AC_SUBST(ssldir) |
| 34 | AC_DEFINE_UNQUOTED(ssldir, "$ssldir") |
| 35 | if test "$ssldir" != "/usr"; then |
| 36 | CFLAGS="$CFLAGS -I$ssldir/include" |
Damien Miller | 84093e9 | 1999-12-15 09:06:28 +1100 | [diff] [blame] | 37 | LDFLAGS="$LDFLAGS -L$ssldir/lib" |
Damien Miller | c7b38ce | 1999-11-09 10:28:04 +1100 | [diff] [blame] | 38 | fi |
| 39 | LIBS="$LIBS -lssl -lcrypto" |
Damien Miller | a82feb3 | 1999-11-11 11:04:17 +1100 | [diff] [blame] | 40 | AC_MSG_RESULT($ssldir) |
Damien Miller | 7f6ea02 | 1999-10-28 13:25:17 +1000 | [diff] [blame] | 41 | |
Damien Miller | c7b38ce | 1999-11-09 10:28:04 +1100 | [diff] [blame] | 42 | dnl Check for RSAref library. |
| 43 | AC_MSG_CHECKING([for RSAref library]) |
| 44 | saved_LIBS="$LIBS" |
| 45 | LIBS="$saved_LIBS -lRSAglue -lrsaref" |
| 46 | AC_TRY_LINK([], [], |
| 47 | [AC_MSG_RESULT(yes); ], |
| 48 | [AC_MSG_RESULT(no)]; LIBS="$saved_LIBS") |
Damien Miller | 7f6ea02 | 1999-10-28 13:25:17 +1000 | [diff] [blame] | 49 | |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 50 | dnl Checks for libraries. |
| 51 | AC_CHECK_LIB(crypto, CRYPTO_lock, ,AC_MSG_ERROR([*** libcrypto missing - please install first ***])) |
| 52 | AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***])) |
| 53 | AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil") |
| 54 | AC_CHECK_LIB(nsl, yp_match, , ) |
| 55 | AC_CHECK_LIB(socket, main, , ) |
| 56 | |
| 57 | dnl libdl is needed by PAM on Redhat systems |
| 58 | AC_CHECK_LIB(dl, dlopen, , ) |
| 59 | AC_CHECK_LIB(pam, pam_authenticate, , ) |
| 60 | |
Damien Miller | 7f6ea02 | 1999-10-28 13:25:17 +1000 | [diff] [blame] | 61 | dnl Checks for header files. |
Damien Miller | 6ae00d6 | 1999-12-14 15:43:03 +1100 | [diff] [blame] | 62 | AC_CHECK_HEADERS(endian.h lastlog.h login.h maillock.h netgroup.h paths.h poll.h pty.h shadow.h util.h utmp.h utmpx.h sys/poll.h sys/select.h sys/stropts.h sys/time.h) |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 63 | |
Damien Miller | cedfecc | 1999-11-15 14:36:53 +1100 | [diff] [blame] | 64 | dnl Checks for library functions. |
Damien Miller | 037a0dc | 1999-12-07 15:38:31 +1100 | [diff] [blame] | 65 | AC_CHECK_FUNCS(arc4random mkdtemp openpty _getpty setenv setlogin setproctitle snprintf strlcat strlcpy vsnprintf) |
Damien Miller | cedfecc | 1999-11-15 14:36:53 +1100 | [diff] [blame] | 66 | |
Damien Miller | 04f8014 | 1999-11-19 15:32:34 +1100 | [diff] [blame] | 67 | AC_CHECK_FUNC(login, |
| 68 | [AC_DEFINE(HAVE_LOGIN)], |
| 69 | [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])] |
| 70 | ) |
| 71 | |
| 72 | AC_CHECK_FUNC(daemon, |
| 73 | [AC_DEFINE(HAVE_DAEMON)], |
| 74 | [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])] |
| 75 | ) |
| 76 | |
Damien Miller | c6398ef | 1999-11-20 12:18:40 +1100 | [diff] [blame] | 77 | dnl Checks for data types |
| 78 | AC_CHECK_SIZEOF(short int, 2) |
| 79 | AC_CHECK_SIZEOF(int, 4) |
| 80 | AC_CHECK_SIZEOF(long int, 4) |
| 81 | AC_CHECK_SIZEOF(long long int, 8) |
| 82 | |
| 83 | dnl More checks for data types |
Damien Miller | 859cec0 | 1999-11-22 14:27:24 +1100 | [diff] [blame] | 84 | AC_MSG_CHECKING([for quad_t]) |
Damien Miller | c6398ef | 1999-11-20 12:18:40 +1100 | [diff] [blame] | 85 | AC_TRY_COMPILE( |
| 86 | [#include <sys/types.h>], |
| 87 | [quad_t a; a = 1235;], |
| 88 | [ |
| 89 | AC_DEFINE(HAVE_QUAD_T) |
| 90 | AC_MSG_RESULT(yes) |
| 91 | ], |
| 92 | [AC_MSG_RESULT(no)] |
| 93 | ) |
| 94 | |
Damien Miller | 859cec0 | 1999-11-22 14:27:24 +1100 | [diff] [blame] | 95 | AC_MSG_CHECKING([for intXX_t types]) |
Damien Miller | c6398ef | 1999-11-20 12:18:40 +1100 | [diff] [blame] | 96 | AC_TRY_COMPILE( |
| 97 | [#include <sys/types.h>], |
| 98 | [int16_t a; int32_t b; a = 1235; b = 1235;], |
| 99 | [ |
| 100 | AC_DEFINE(HAVE_INTXX_T) |
| 101 | AC_MSG_RESULT(yes) |
| 102 | ], |
| 103 | [AC_MSG_RESULT(no)] |
| 104 | ) |
| 105 | |
Damien Miller | 859cec0 | 1999-11-22 14:27:24 +1100 | [diff] [blame] | 106 | AC_MSG_CHECKING([for u_intXX_t types]) |
Damien Miller | c6398ef | 1999-11-20 12:18:40 +1100 | [diff] [blame] | 107 | AC_TRY_COMPILE( |
| 108 | [#include <sys/types.h>], |
| 109 | [u_int16_t c; u_int32_t d; c = 1235; d = 1235;], |
| 110 | [ |
| 111 | AC_DEFINE(HAVE_U_INTXX_T) |
| 112 | AC_MSG_RESULT(yes) |
| 113 | ], |
| 114 | [AC_MSG_RESULT(no)] |
| 115 | ) |
| 116 | |
| 117 | AC_MSG_CHECKING([For uintXX_t types]) |
| 118 | AC_TRY_COMPILE( |
| 119 | [#include <sys/types.h>], |
| 120 | [uint16_t c; uint32_t d; c = 1235; d = 1235;], |
| 121 | [ |
| 122 | AC_DEFINE(HAVE_UINTXX_T) |
| 123 | AC_MSG_RESULT(yes) |
| 124 | ], |
| 125 | [AC_MSG_RESULT(no)] |
| 126 | ) |
| 127 | |
Damien Miller | 859cec0 | 1999-11-22 14:27:24 +1100 | [diff] [blame] | 128 | dnl Check PAM strerror arguments |
| 129 | AC_MSG_CHECKING([whether pam_strerror takes only one argument]) |
| 130 | AC_TRY_COMPILE( |
| 131 | [ |
| 132 | #include <stdlib.h> |
| 133 | #include <security/pam_appl.h> |
| 134 | ], |
| 135 | [(void)pam_strerror((pam_handle_t *)NULL, -1);], |
| 136 | [AC_MSG_RESULT(no)], |
| 137 | [ |
| 138 | AC_DEFINE(HAVE_OLD_PAM) |
| 139 | AC_MSG_RESULT(yes) |
| 140 | ] |
| 141 | ) |
| 142 | |
Damien Miller | 98ac007 | 1999-11-25 13:19:55 +1100 | [diff] [blame] | 143 | AC_MSG_CHECKING([whether to build GNOME ssh-askpass]) |
| 144 | dnl Check whether user wants GNOME ssh-askpass |
| 145 | AC_ARG_WITH(gnome-askpass, |
| 146 | [ --with-gnome-askpass Build the GNOME passphrase requester (default=no)], |
Damien Miller | cedfecc | 1999-11-15 14:36:53 +1100 | [diff] [blame] | 147 | [ |
| 148 | if test x$withval = xno ; then |
Damien Miller | 98ac007 | 1999-11-25 13:19:55 +1100 | [diff] [blame] | 149 | GNOME_ASKPASS=""; |
Damien Miller | cedfecc | 1999-11-15 14:36:53 +1100 | [diff] [blame] | 150 | else |
Damien Miller | 98ac007 | 1999-11-25 13:19:55 +1100 | [diff] [blame] | 151 | GNOME_ASKPASS="gnome-ssh-askpass"; |
Damien Miller | cedfecc | 1999-11-15 14:36:53 +1100 | [diff] [blame] | 152 | fi |
Damien Miller | 98ac007 | 1999-11-25 13:19:55 +1100 | [diff] [blame] | 153 | ]) |
| 154 | AC_SUBST(GNOME_ASKPASS) |
| 155 | |
| 156 | if test -z "$GNOME_ASKPASS" ; then |
Damien Miller | cedfecc | 1999-11-15 14:36:53 +1100 | [diff] [blame] | 157 | AC_MSG_RESULT(no) |
Damien Miller | 98ac007 | 1999-11-25 13:19:55 +1100 | [diff] [blame] | 158 | else |
| 159 | AC_MSG_RESULT(yes) |
Damien Miller | cedfecc | 1999-11-15 14:36:53 +1100 | [diff] [blame] | 160 | fi |
Damien Miller | e0d444c | 1999-11-09 14:23:45 +1100 | [diff] [blame] | 161 | |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 162 | dnl Check for user-specified random device |
| 163 | AC_ARG_WITH(random, |
Damien Miller | cedfecc | 1999-11-15 14:36:53 +1100 | [diff] [blame] | 164 | [ --with-random=FILE read randomness from FILE (default=/dev/urandom)], |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 165 | [ |
| 166 | RANDOM_POOL="$withval"; |
Damien Miller | 0a6e668 | 1999-11-15 09:56:06 +1100 | [diff] [blame] | 167 | AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL") |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 168 | ], |
| 169 | [ |
| 170 | dnl Check for random device |
| 171 | AC_CHECK_FILE("/dev/urandom", |
| 172 | [ |
| 173 | RANDOM_POOL="/dev/urandom"; |
Damien Miller | a82feb3 | 1999-11-11 11:04:17 +1100 | [diff] [blame] | 174 | AC_SUBST(RANDOM_POOL) |
| 175 | AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL") |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 176 | ] |
| 177 | ) |
| 178 | ] |
| 179 | ) |
| 180 | |
| 181 | dnl Check for EGD pool file |
| 182 | AC_ARG_WITH(egd-pool, |
Damien Miller | cedfecc | 1999-11-15 14:36:53 +1100 | [diff] [blame] | 183 | [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)], |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 184 | [ |
| 185 | RANDOM_POOL="$withval"; |
| 186 | AC_DEFINE(HAVE_EGD) |
Damien Miller | a82feb3 | 1999-11-11 11:04:17 +1100 | [diff] [blame] | 187 | AC_SUBST(RANDOM_POOL) |
| 188 | AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL") |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 189 | ] |
| 190 | ) |
| 191 | |
Damien Miller | cedfecc | 1999-11-15 14:36:53 +1100 | [diff] [blame] | 192 | dnl Make sure we have random number support |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 193 | if test -z "$RANDOM_POOL" -a -z "$EGD_POOL"; then |
| 194 | AC_MSG_ERROR([No random device found, and no EGD random pool specified]) |
| 195 | fi |
| 196 | |
Damien Miller | 3f90587 | 1999-11-15 17:10:57 +1100 | [diff] [blame] | 197 | dnl Check for ut_host field in utmp |
| 198 | AC_MSG_CHECKING([whether utmp.h has ut_host field]) |
| 199 | AC_EGREP_HEADER(ut_host, utmp.h, |
| 200 | [AC_DEFINE(HAVE_HOST_IN_UTMP) AC_MSG_RESULT(yes); ], |
| 201 | [AC_MSG_RESULT(no)] |
| 202 | ) |
| 203 | |
Damien Miller | bf1c9b2 | 1999-12-09 10:16:54 +1100 | [diff] [blame] | 204 | dnl Check for ut_host field in utmpx |
| 205 | AC_MSG_CHECKING([whether utmpx.h has ut_host field]) |
| 206 | AC_EGREP_HEADER(ut_host, utmpx.h, |
| 207 | [AC_DEFINE(HAVE_HOST_IN_UTMPX) AC_MSG_RESULT(yes); ], |
| 208 | [AC_MSG_RESULT(no)] |
| 209 | ) |
| 210 | |
Damien Miller | 3f90587 | 1999-11-15 17:10:57 +1100 | [diff] [blame] | 211 | dnl Look for lastlog location |
| 212 | AC_MSG_CHECKING([location of lastlog file]) |
| 213 | for lastlog in /var/log/lastlog /var/adm/lastlog /etc/security/lastlog ; do |
| 214 | if test -f $lastlog ; then |
Damien Miller | c6398ef | 1999-11-20 12:18:40 +1100 | [diff] [blame] | 215 | gotlastlog="file" |
| 216 | break |
| 217 | fi |
| 218 | if test -d $lastlog ; then |
| 219 | gotlastlog="dir" |
Damien Miller | 3f90587 | 1999-11-15 17:10:57 +1100 | [diff] [blame] | 220 | break |
| 221 | fi |
| 222 | done |
Damien Miller | 36fb30f | 1999-11-19 19:14:04 +1100 | [diff] [blame] | 223 | if test -z "$gotlastlog" ; then |
| 224 | AC_MSG_ERROR([*** Cannot find lastlog ***]) |
Damien Miller | c6398ef | 1999-11-20 12:18:40 +1100 | [diff] [blame] | 225 | else |
| 226 | if test "x$gotlastlog" = "xdir" ; then |
| 227 | AC_DEFINE(LASTLOG_IS_DIR) |
| 228 | AC_MSG_ERROR([*** Directory-based lastlogs are not yet supported ***]) |
| 229 | fi |
| 230 | AC_MSG_RESULT($lastlog) |
| 231 | AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$lastlog") |
Damien Miller | 36fb30f | 1999-11-19 19:14:04 +1100 | [diff] [blame] | 232 | fi |
Damien Miller | 3f90587 | 1999-11-15 17:10:57 +1100 | [diff] [blame] | 233 | |
Damien Miller | 037a0dc | 1999-12-07 15:38:31 +1100 | [diff] [blame] | 234 | AC_CHECK_FILE("/dev/ptmx", AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)) |
| 235 | AC_CHECK_FILE("/dev/ptc", AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)) |
| 236 | |
Damien Miller | 3f90587 | 1999-11-15 17:10:57 +1100 | [diff] [blame] | 237 | AC_MSG_CHECKING([whether libc defines __progname]) |
| 238 | AC_TRY_LINK([], |
Damien Miller | 04f8014 | 1999-11-19 15:32:34 +1100 | [diff] [blame] | 239 | [extern char *__progname; printf("%s", __progname);], |
Damien Miller | 3f90587 | 1999-11-15 17:10:57 +1100 | [diff] [blame] | 240 | [ |
| 241 | AC_DEFINE(HAVE___PROGNAME) |
| 242 | AC_MSG_RESULT(yes) |
| 243 | ], |
| 244 | [ |
| 245 | AC_MSG_RESULT(no) |
| 246 | ] |
| 247 | ) |
| 248 | |
Damien Miller | 8029775 | 1999-11-19 13:03:25 +1100 | [diff] [blame] | 249 | dnl Check whether user wants Kerberos support |
| 250 | AC_ARG_WITH(kerberos4, |
| 251 | [ --with-kerberos4 Enable Kerberos 4 support], |
| 252 | [ |
| 253 | AC_DEFINE(KRB4) |
| 254 | LIBS="$LIBS -lkrb" |
| 255 | CFLAGS="$CFLAGS -I/usr/include/kerberosIV" |
| 256 | ] |
| 257 | ) |
| 258 | |
| 259 | dnl Check whether user wants AFS support |
Damien Miller | c6398ef | 1999-11-20 12:18:40 +1100 | [diff] [blame] | 260 | AC_ARG_WITH(afs, |
Damien Miller | 8029775 | 1999-11-19 13:03:25 +1100 | [diff] [blame] | 261 | [ --with-afs Enable AFS support], |
| 262 | [ |
| 263 | AC_DEFINE(AFS) |
| 264 | LIBS="$LIBS -lkafs" |
| 265 | ] |
| 266 | ) |
| 267 | |
| 268 | dnl Check whether user wants S/Key support |
| 269 | AC_ARG_WITH(skey, |
| 270 | [ --with-skey Enable S/Key support], |
| 271 | [ |
| 272 | AC_DEFINE(SKEY) |
| 273 | LIBS="$LIBS -lskey" |
| 274 | ] |
| 275 | ) |
| 276 | |
| 277 | dnl Check whether user wants TCP wrappers support |
Damien Miller | f7c0f82 | 1999-11-22 22:31:49 +1100 | [diff] [blame] | 278 | AC_ARG_WITH(tcp-wrappers, |
Damien Miller | 8029775 | 1999-11-19 13:03:25 +1100 | [diff] [blame] | 279 | [ --with-tcp-wrappers Enable tcpwrappers support], |
| 280 | [ |
| 281 | AC_DEFINE(LIBWRAP) |
Damien Miller | d7f6615 | 1999-12-09 10:48:58 +1100 | [diff] [blame] | 282 | LIBWRAP="-lwrap" |
Damien Miller | 8029775 | 1999-11-19 13:03:25 +1100 | [diff] [blame] | 283 | ] |
| 284 | ) |
Damien Miller | d7f6615 | 1999-12-09 10:48:58 +1100 | [diff] [blame] | 285 | AC_SUBST(LIBWRAP) |
Damien Miller | 8029775 | 1999-11-19 13:03:25 +1100 | [diff] [blame] | 286 | |
Damien Miller | dd1c7ba | 1999-11-19 15:53:20 +1100 | [diff] [blame] | 287 | dnl Check whether to enable MD5 passwords |
Damien Miller | f7c0f82 | 1999-11-22 22:31:49 +1100 | [diff] [blame] | 288 | AC_ARG_WITH(md5-passwords, |
Damien Miller | dd1c7ba | 1999-11-19 15:53:20 +1100 | [diff] [blame] | 289 | [ --with-md5-passwords Enable use of MD5 passwords], |
| 290 | [AC_DEFINE(HAVE_MD5_PASSWORDS)] |
| 291 | ) |
| 292 | |
Damien Miller | 368cf64 | 1999-12-21 09:51:36 +1100 | [diff] [blame^] | 293 | dnl Check whether to enable utmpx support |
| 294 | AC_ARG_WITH(utmpx, |
| 295 | [ --with-utmpx Enable utmpx support], |
| 296 | [AC_DEFINE(USE_UTMPX)] |
| 297 | ) |
| 298 | |
Damien Miller | c6b3bbe | 1999-12-13 08:27:33 +1100 | [diff] [blame] | 299 | dnl Check for the path to xauth |
| 300 | AC_PATH_PROG(xauth_path, xauth) |
| 301 | AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path") |
| 302 | |
Damien Miller | 7f6ea02 | 1999-10-28 13:25:17 +1000 | [diff] [blame] | 303 | AC_OUTPUT(Makefile) |