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