Damien Miller | 4fefe24 | 2004-03-11 14:20:10 +1100 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 1999-2004 Damien Miller |
| 3 | # |
| 4 | # Permission to use, copy, modify, and distribute this software for any |
| 5 | # purpose with or without fee is hereby granted, provided that the above |
| 6 | # copyright notice and this permission notice appear in all copies. |
| 7 | # |
| 8 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
Damien Miller | e9cf357 | 2001-02-09 12:55:35 +1100 | [diff] [blame] | 15 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 16 | AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) |
Damien Miller | 3d673d1 | 2014-08-27 06:32:01 +1000 | [diff] [blame] | 17 | AC_REVISION($Revision: 1.583 $) |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 18 | AC_CONFIG_SRCDIR([ssh.c]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 19 | AC_LANG([C]) |
Damien Miller | 7f6ea02 | 1999-10-28 13:25:17 +1000 | [diff] [blame] | 20 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 21 | AC_CONFIG_HEADER([config.h]) |
Darren Tucker | c90a792 | 2019-01-21 09:22:36 +1100 | [diff] [blame] | 22 | AC_PROG_CC([cc gcc]) |
Damien Miller | 76112de | 1999-12-21 11:18:08 +1100 | [diff] [blame] | 23 | AC_CANONICAL_HOST |
Damien Miller | 4df5c76 | 2001-02-28 08:14:22 +1100 | [diff] [blame] | 24 | AC_C_BIGENDIAN |
Damien Miller | 7f6ea02 | 1999-10-28 13:25:17 +1000 | [diff] [blame] | 25 | |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 26 | # Checks for programs. |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 27 | AC_PROG_AWK |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 28 | AC_PROG_CPP |
Damien Miller | 7f6ea02 | 1999-10-28 13:25:17 +1000 | [diff] [blame] | 29 | AC_PROG_RANLIB |
Damien Miller | d8087f6 | 1999-11-25 12:31:26 +1100 | [diff] [blame] | 30 | AC_PROG_INSTALL |
Tim Rice | fd80ddc | 2006-02-02 19:11:56 -0800 | [diff] [blame] | 31 | AC_PROG_EGREP |
Darren Tucker | 6c8a246 | 2017-12-01 17:11:47 +1100 | [diff] [blame] | 32 | AC_PROG_MKDIR_P |
Darren Tucker | 408f4c2 | 2015-04-17 09:39:58 +1000 | [diff] [blame] | 33 | AC_CHECK_TOOLS([AR], [ar]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 34 | AC_PATH_PROG([CAT], [cat]) |
| 35 | AC_PATH_PROG([KILL], [kill]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 36 | AC_PATH_PROG([SED], [sed]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 37 | AC_PATH_PROG([ENT], [ent]) |
| 38 | AC_SUBST([ENT]) |
| 39 | AC_PATH_PROG([TEST_MINUS_S_SH], [bash]) |
| 40 | AC_PATH_PROG([TEST_MINUS_S_SH], [ksh]) |
| 41 | AC_PATH_PROG([TEST_MINUS_S_SH], [sh]) |
| 42 | AC_PATH_PROG([SH], [sh]) |
| 43 | AC_PATH_PROG([GROFF], [groff]) |
Darren Tucker | 285546b | 2019-05-10 15:04:42 +1000 | [diff] [blame] | 44 | AC_PATH_PROG([NROFF], [nroff awf]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 45 | AC_PATH_PROG([MANDOC], [mandoc]) |
| 46 | AC_SUBST([TEST_SHELL], [sh]) |
Damien Miller | 2e1b082 | 1999-12-25 10:11:29 +1100 | [diff] [blame] | 47 | |
Darren Tucker | 285546b | 2019-05-10 15:04:42 +1000 | [diff] [blame] | 48 | dnl select manpage formatter to be used to build "cat" format pages. |
Damien Miller | 30a69e7 | 2011-01-04 08:16:27 +1100 | [diff] [blame] | 49 | if test "x$MANDOC" != "x" ; then |
| 50 | MANFMT="$MANDOC" |
| 51 | elif test "x$NROFF" != "x" ; then |
| 52 | MANFMT="$NROFF -mandoc" |
| 53 | elif test "x$GROFF" != "x" ; then |
| 54 | MANFMT="$GROFF -mandoc -Tascii" |
| 55 | else |
Darren Tucker | 6fd4aa2 | 2019-05-15 16:19:14 +1000 | [diff] [blame] | 56 | AC_MSG_WARN([no manpage formatter found]) |
Damien Miller | 30a69e7 | 2011-01-04 08:16:27 +1100 | [diff] [blame] | 57 | MANFMT="false" |
| 58 | fi |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 59 | AC_SUBST([MANFMT]) |
Damien Miller | 30a69e7 | 2011-01-04 08:16:27 +1100 | [diff] [blame] | 60 | |
Tim Rice | 6f1f758 | 2004-05-30 21:38:51 -0700 | [diff] [blame] | 61 | dnl for buildpkg.sh |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 62 | AC_PATH_PROG([PATH_GROUPADD_PROG], [groupadd], [groupadd], |
Tim Rice | 6f1f758 | 2004-05-30 21:38:51 -0700 | [diff] [blame] | 63 | [/usr/sbin${PATH_SEPARATOR}/etc]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 64 | AC_PATH_PROG([PATH_USERADD_PROG], [useradd], [useradd], |
Tim Rice | 6f1f758 | 2004-05-30 21:38:51 -0700 | [diff] [blame] | 65 | [/usr/sbin${PATH_SEPARATOR}/etc]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 66 | AC_CHECK_PROG([MAKE_PACKAGE_SUPPORTED], [pkgmk], [yes], [no]) |
Darren Tucker | fbea764 | 2006-01-30 00:22:39 +1100 | [diff] [blame] | 67 | if test -x /sbin/sh; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 68 | AC_SUBST([STARTUP_SCRIPT_SHELL], [/sbin/sh]) |
Darren Tucker | fbea764 | 2006-01-30 00:22:39 +1100 | [diff] [blame] | 69 | else |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 70 | AC_SUBST([STARTUP_SCRIPT_SHELL], [/bin/sh]) |
Darren Tucker | fbea764 | 2006-01-30 00:22:39 +1100 | [diff] [blame] | 71 | fi |
Tim Rice | 6f1f758 | 2004-05-30 21:38:51 -0700 | [diff] [blame] | 72 | |
Damien Miller | e8bb450 | 2001-09-25 16:39:35 +1000 | [diff] [blame] | 73 | # System features |
| 74 | AC_SYS_LARGEFILE |
| 75 | |
Damien Miller | 3f62aba | 2000-11-29 11:56:35 +1100 | [diff] [blame] | 76 | if test -z "$AR" ; then |
| 77 | AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***]) |
| 78 | fi |
| 79 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 80 | AC_PATH_PROG([PATH_PASSWD_PROG], [passwd]) |
Darren Tucker | 23bc8d0 | 2004-02-06 16:24:31 +1100 | [diff] [blame] | 81 | if test ! -z "$PATH_PASSWD_PROG" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 82 | AC_DEFINE_UNQUOTED([_PATH_PASSWD_PROG], ["$PATH_PASSWD_PROG"], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 83 | [Full path of your "passwd" program]) |
Darren Tucker | 23bc8d0 | 2004-02-06 16:24:31 +1100 | [diff] [blame] | 84 | fi |
| 85 | |
Darren Tucker | f2c06ab | 2018-06-08 17:43:36 +1000 | [diff] [blame] | 86 | dnl Since autoconf doesn't support it very well, we no longer allow users to |
| 87 | dnl override LD, however keeping the hook here for now in case there's a use |
| 88 | dnl use case we overlooked and someone needs to re-enable it. Unless a good |
| 89 | dnl reason is found we'll be removing this in future. |
| 90 | LD="$CC" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 91 | AC_SUBST([LD]) |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 92 | |
Damien Miller | 166bd44 | 2000-03-16 10:48:25 +1100 | [diff] [blame] | 93 | AC_C_INLINE |
Darren Tucker | 67b3703 | 2005-06-03 17:58:31 +1000 | [diff] [blame] | 94 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 95 | AC_CHECK_DECL([LLONG_MAX], [have_llong_max=1], , [#include <limits.h>]) |
Damien Miller | 69ff1df | 2011-06-23 08:30:03 +1000 | [diff] [blame] | 96 | AC_CHECK_DECL([SYSTR_POLICY_KILL], [have_systr_policy_kill=1], , [ |
| 97 | #include <sys/types.h> |
| 98 | #include <sys/param.h> |
| 99 | #include <dev/systrace.h> |
| 100 | ]) |
| 101 | AC_CHECK_DECL([RLIMIT_NPROC], |
| 102 | [AC_DEFINE([HAVE_RLIMIT_NPROC], [], [sys/resource.h has RLIMIT_NPROC])], , [ |
| 103 | #include <sys/types.h> |
| 104 | #include <sys/resource.h> |
| 105 | ]) |
Damien Miller | e0956e3 | 2012-04-04 11:27:54 +1000 | [diff] [blame] | 106 | AC_CHECK_DECL([PR_SET_NO_NEW_PRIVS], [have_linux_no_new_privs=1], , [ |
| 107 | #include <sys/types.h> |
| 108 | #include <linux/prctl.h> |
| 109 | ]) |
Damien Miller | 868ea1e | 2014-01-17 16:47:04 +1100 | [diff] [blame] | 110 | |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 111 | openssl=yes |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 112 | AC_ARG_WITH([openssl], |
| 113 | [ --without-openssl Disable use of OpenSSL; use only limited internal crypto **EXPERIMENTAL** ], |
Damien Miller | 76c0480 | 2015-01-13 19:38:18 +1100 | [diff] [blame] | 114 | [ if test "x$withval" = "xno" ; then |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 115 | openssl=no |
Damien Miller | 76c0480 | 2015-01-13 19:38:18 +1100 | [diff] [blame] | 116 | fi |
| 117 | ] |
| 118 | ) |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 119 | AC_MSG_CHECKING([whether OpenSSL will be used for cryptography]) |
| 120 | if test "x$openssl" = "xyes" ; then |
| 121 | AC_MSG_RESULT([yes]) |
| 122 | AC_DEFINE_UNQUOTED([WITH_OPENSSL], [1], [use libcrypto for cryptography]) |
| 123 | else |
| 124 | AC_MSG_RESULT([no]) |
| 125 | fi |
| 126 | |
Darren Tucker | b7918af | 2008-03-09 11:34:23 +1100 | [diff] [blame] | 127 | use_stack_protector=1 |
Darren Tucker | fd99437 | 2014-01-17 09:53:24 +1100 | [diff] [blame] | 128 | use_toolchain_hardening=1 |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 129 | AC_ARG_WITH([stackprotect], |
Damien Miller | da3155e | 2008-03-27 12:30:18 +1100 | [diff] [blame] | 130 | [ --without-stackprotect Don't use compiler's stack protection], [ |
Darren Tucker | b7918af | 2008-03-09 11:34:23 +1100 | [diff] [blame] | 131 | if test "x$withval" = "xno"; then |
| 132 | use_stack_protector=0 |
| 133 | fi ]) |
Darren Tucker | fd99437 | 2014-01-17 09:53:24 +1100 | [diff] [blame] | 134 | AC_ARG_WITH([hardening], |
| 135 | [ --without-hardening Don't use toolchain hardening flags], [ |
| 136 | if test "x$withval" = "xno"; then |
Darren Tucker | fd99437 | 2014-01-17 09:53:24 +1100 | [diff] [blame] | 137 | use_toolchain_hardening=0 |
| 138 | fi ]) |
Darren Tucker | b7918af | 2008-03-09 11:34:23 +1100 | [diff] [blame] | 139 | |
Darren Tucker | fd99437 | 2014-01-17 09:53:24 +1100 | [diff] [blame] | 140 | # We use -Werror for the tests only so that we catch warnings like "this is |
| 141 | # on by default" for things like -fPIE. |
| 142 | AC_MSG_CHECKING([if $CC supports -Werror]) |
| 143 | saved_CFLAGS="$CFLAGS" |
| 144 | CFLAGS="$CFLAGS -Werror" |
| 145 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])], |
| 146 | [ AC_MSG_RESULT([yes]) |
| 147 | WERROR="-Werror"], |
| 148 | [ AC_MSG_RESULT([no]) |
| 149 | WERROR="" ] |
| 150 | ) |
| 151 | CFLAGS="$saved_CFLAGS" |
Damien Miller | 134d02a | 2011-01-12 16:00:37 +1100 | [diff] [blame] | 152 | |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 153 | if test "$GCC" = "yes" || test "$GCC" = "egcs"; then |
Darren Tucker | d904886 | 2017-03-31 11:04:43 +1100 | [diff] [blame] | 154 | OSSH_CHECK_CFLAG_COMPILE([-pipe]) |
Darren Tucker | fd99437 | 2014-01-17 09:53:24 +1100 | [diff] [blame] | 155 | OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option]) |
Damien Miller | e0e7e3d | 2019-08-30 14:26:19 +1000 | [diff] [blame] | 156 | OSSH_CHECK_CFLAG_COMPILE([-Wno-error=format-truncation]) |
| 157 | OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments]) |
Damien Miller | b176362 | 2011-05-20 11:45:25 +1000 | [diff] [blame] | 158 | OSSH_CHECK_CFLAG_COMPILE([-Wall]) |
Damien Miller | e0e7e3d | 2019-08-30 14:26:19 +1000 | [diff] [blame] | 159 | OSSH_CHECK_CFLAG_COMPILE([-Wextra]) |
Damien Miller | b176362 | 2011-05-20 11:45:25 +1000 | [diff] [blame] | 160 | OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith]) |
| 161 | OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized]) |
| 162 | OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare]) |
| 163 | OSSH_CHECK_CFLAG_COMPILE([-Wformat-security]) |
Darren Tucker | abbc7a7 | 2013-05-10 13:54:23 +1000 | [diff] [blame] | 164 | OSSH_CHECK_CFLAG_COMPILE([-Wsizeof-pointer-memaccess]) |
Damien Miller | b176362 | 2011-05-20 11:45:25 +1000 | [diff] [blame] | 165 | OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign]) |
| 166 | OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result]) |
Darren Tucker | 6cf1c40 | 2019-11-18 14:14:18 +1100 | [diff] [blame] | 167 | OSSH_CHECK_CFLAG_COMPILE([-Wimplicit-fallthrough]) |
Damien Miller | b176362 | 2011-05-20 11:45:25 +1000 | [diff] [blame] | 168 | OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing]) |
Darren Tucker | fd99437 | 2014-01-17 09:53:24 +1100 | [diff] [blame] | 169 | if test "x$use_toolchain_hardening" = "x1"; then |
Darren Tucker | 3377df0 | 2018-02-11 09:32:37 +1100 | [diff] [blame] | 170 | OSSH_CHECK_CFLAG_COMPILE([-mretpoline]) # clang |
Darren Tucker | 174bed6 | 2018-02-13 18:12:47 +1100 | [diff] [blame] | 171 | OSSH_CHECK_LDFLAG_LINK([-Wl,-z,retpolineplt]) |
Damien Miller | 161af8f | 2017-09-19 10:18:56 +1000 | [diff] [blame] | 172 | OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2]) |
Darren Tucker | fd99437 | 2014-01-17 09:53:24 +1100 | [diff] [blame] | 173 | OSSH_CHECK_LDFLAG_LINK([-Wl,-z,relro]) |
| 174 | OSSH_CHECK_LDFLAG_LINK([-Wl,-z,now]) |
| 175 | OSSH_CHECK_LDFLAG_LINK([-Wl,-z,noexecstack]) |
Damien Miller | 5c2ff5e | 2014-01-22 21:30:12 +1100 | [diff] [blame] | 176 | # NB. -ftrapv expects certain support functions to be present in |
| 177 | # the compiler library (libgcc or similar) to detect integer operations |
| 178 | # that can overflow. We must check that the result of enabling it |
| 179 | # actually links. The test program compiled/linked includes a number |
| 180 | # of integer operations that should exercise this. |
| 181 | OSSH_CHECK_CFLAG_LINK([-ftrapv]) |
Darren Tucker | fd99437 | 2014-01-17 09:53:24 +1100 | [diff] [blame] | 182 | fi |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 183 | AC_MSG_CHECKING([gcc version]) |
Darren Tucker | 3f9545e | 2005-11-12 15:20:52 +1100 | [diff] [blame] | 184 | GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` |
Tim Rice | 3db1e3f | 2005-08-23 17:11:26 -0700 | [diff] [blame] | 185 | case $GCC_VER in |
Darren Tucker | 391de5c | 2007-04-29 14:49:21 +1000 | [diff] [blame] | 186 | 1.*) no_attrib_nonnull=1 ;; |
| 187 | 2.8* | 2.9*) |
Darren Tucker | 391de5c | 2007-04-29 14:49:21 +1000 | [diff] [blame] | 188 | no_attrib_nonnull=1 |
| 189 | ;; |
| 190 | 2.*) no_attrib_nonnull=1 ;; |
Darren Tucker | f032435 | 2005-11-10 21:30:36 +1100 | [diff] [blame] | 191 | *) ;; |
Tim Rice | 3db1e3f | 2005-08-23 17:11:26 -0700 | [diff] [blame] | 192 | esac |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 193 | AC_MSG_RESULT([$GCC_VER]) |
Damien Miller | de3cb0a | 2005-05-26 20:48:25 +1000 | [diff] [blame] | 194 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 195 | AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset]) |
Darren Tucker | 330c93f | 2008-06-16 02:27:48 +1000 | [diff] [blame] | 196 | saved_CFLAGS="$CFLAGS" |
| 197 | CFLAGS="$CFLAGS -fno-builtin-memset" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 198 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]], |
| 199 | [[ char b[10]; memset(b, 0, sizeof(b)); ]])], |
| 200 | [ AC_MSG_RESULT([yes]) ], |
| 201 | [ AC_MSG_RESULT([no]) |
Darren Tucker | 330c93f | 2008-06-16 02:27:48 +1000 | [diff] [blame] | 202 | CFLAGS="$saved_CFLAGS" ] |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 203 | ) |
Darren Tucker | 330c93f | 2008-06-16 02:27:48 +1000 | [diff] [blame] | 204 | |
Darren Tucker | b7918af | 2008-03-09 11:34:23 +1100 | [diff] [blame] | 205 | # -fstack-protector-all doesn't always work for some GCC versions |
Darren Tucker | fe1cf97 | 2008-03-09 22:50:50 +1100 | [diff] [blame] | 206 | # and/or platforms, so we test if we can. If it's not supported |
Damien Miller | 7df2e40 | 2008-12-08 09:35:36 +1100 | [diff] [blame] | 207 | # on a given platform gcc will emit a warning so we use -Werror. |
Darren Tucker | b7918af | 2008-03-09 11:34:23 +1100 | [diff] [blame] | 208 | if test "x$use_stack_protector" = "x1"; then |
Darren Tucker | fd99437 | 2014-01-17 09:53:24 +1100 | [diff] [blame] | 209 | for t in -fstack-protector-strong -fstack-protector-all \ |
| 210 | -fstack-protector; do |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 211 | AC_MSG_CHECKING([if $CC supports $t]) |
Darren Tucker | b7918af | 2008-03-09 11:34:23 +1100 | [diff] [blame] | 212 | saved_CFLAGS="$CFLAGS" |
| 213 | saved_LDFLAGS="$LDFLAGS" |
Darren Tucker | fe1cf97 | 2008-03-09 22:50:50 +1100 | [diff] [blame] | 214 | CFLAGS="$CFLAGS $t -Werror" |
| 215 | LDFLAGS="$LDFLAGS $t -Werror" |
| 216 | AC_LINK_IFELSE( |
Darren Tucker | 9239a18 | 2019-10-24 14:39:49 +1100 | [diff] [blame] | 217 | [AC_LANG_PROGRAM([[ |
| 218 | #include <stdio.h> |
| 219 | int func (int t) {char b[100]; snprintf(b,sizeof b,"%d",t); return t;} |
| 220 | ]], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 221 | [[ |
| 222 | char x[256]; |
Darren Tucker | 9239a18 | 2019-10-24 14:39:49 +1100 | [diff] [blame] | 223 | snprintf(x, sizeof(x), "XXX%d", func(1)); |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 224 | ]])], |
| 225 | [ AC_MSG_RESULT([yes]) |
Darren Tucker | fe1cf97 | 2008-03-09 22:50:50 +1100 | [diff] [blame] | 226 | CFLAGS="$saved_CFLAGS $t" |
| 227 | LDFLAGS="$saved_LDFLAGS $t" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 228 | AC_MSG_CHECKING([if $t works]) |
Darren Tucker | b7918af | 2008-03-09 11:34:23 +1100 | [diff] [blame] | 229 | AC_RUN_IFELSE( |
Darren Tucker | 9239a18 | 2019-10-24 14:39:49 +1100 | [diff] [blame] | 230 | [AC_LANG_PROGRAM([[ |
| 231 | #include <stdio.h> |
| 232 | int func (int t) {char b[100]; snprintf(b,sizeof b,"%d",t); return t;} |
| 233 | ]], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 234 | [[ |
| 235 | char x[256]; |
Darren Tucker | 9239a18 | 2019-10-24 14:39:49 +1100 | [diff] [blame] | 236 | snprintf(x, sizeof(x), "XXX%d", func(1)); |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 237 | ]])], |
| 238 | [ AC_MSG_RESULT([yes]) |
Darren Tucker | b7918af | 2008-03-09 11:34:23 +1100 | [diff] [blame] | 239 | break ], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 240 | [ AC_MSG_RESULT([no]) ], |
Darren Tucker | b7918af | 2008-03-09 11:34:23 +1100 | [diff] [blame] | 241 | [ AC_MSG_WARN([cross compiling: cannot test]) |
| 242 | break ] |
Darren Tucker | fe1cf97 | 2008-03-09 22:50:50 +1100 | [diff] [blame] | 243 | ) |
Darren Tucker | b7918af | 2008-03-09 11:34:23 +1100 | [diff] [blame] | 244 | ], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 245 | [ AC_MSG_RESULT([no]) ] |
Darren Tucker | b7918af | 2008-03-09 11:34:23 +1100 | [diff] [blame] | 246 | ) |
| 247 | CFLAGS="$saved_CFLAGS" |
| 248 | LDFLAGS="$saved_LDFLAGS" |
| 249 | done |
| 250 | fi |
Darren Tucker | 319b3d9 | 2007-12-02 21:02:22 +1100 | [diff] [blame] | 251 | |
Darren Tucker | 67b3703 | 2005-06-03 17:58:31 +1000 | [diff] [blame] | 252 | if test -z "$have_llong_max"; then |
| 253 | # retry LLONG_MAX with -std=gnu99, needed on some Linuxes |
| 254 | unset ac_cv_have_decl_LLONG_MAX |
| 255 | saved_CFLAGS="$CFLAGS" |
| 256 | CFLAGS="$CFLAGS -std=gnu99" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 257 | AC_CHECK_DECL([LLONG_MAX], |
Darren Tucker | 67b3703 | 2005-06-03 17:58:31 +1000 | [diff] [blame] | 258 | [have_llong_max=1], |
| 259 | [CFLAGS="$saved_CFLAGS"], |
| 260 | [#include <limits.h>] |
| 261 | ) |
| 262 | fi |
Damien Miller | 166bd44 | 2000-03-16 10:48:25 +1100 | [diff] [blame] | 263 | fi |
| 264 | |
Darren Tucker | 951b53b | 2013-02-08 11:50:09 +1100 | [diff] [blame] | 265 | AC_MSG_CHECKING([if compiler allows __attribute__ on return types]) |
| 266 | AC_COMPILE_IFELSE( |
| 267 | [AC_LANG_PROGRAM([[ |
| 268 | #include <stdlib.h> |
| 269 | __attribute__((__unused__)) static void foo(void){return;}]], |
| 270 | [[ exit(0); ]])], |
| 271 | [ AC_MSG_RESULT([yes]) ], |
| 272 | [ AC_MSG_RESULT([no]) |
| 273 | AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1, |
| 274 | [compiler does not accept __attribute__ on return types]) ] |
| 275 | ) |
| 276 | |
Darren Tucker | 1323f12 | 2018-02-27 08:41:25 +1100 | [diff] [blame] | 277 | AC_MSG_CHECKING([if compiler allows __attribute__ prototype args]) |
| 278 | AC_COMPILE_IFELSE( |
| 279 | [AC_LANG_PROGRAM([[ |
| 280 | #include <stdlib.h> |
| 281 | typedef void foo(const char *, ...) __attribute__((format(printf, 1, 2)));]], |
| 282 | [[ exit(0); ]])], |
| 283 | [ AC_MSG_RESULT([yes]) ], |
| 284 | [ AC_MSG_RESULT([no]) |
| 285 | AC_DEFINE(NO_ATTRIBUTE_ON_PROTOTYPE_ARGS, 1, |
Damien Miller | 10479cc | 2018-04-10 10:19:02 +1000 | [diff] [blame] | 286 | [compiler does not accept __attribute__ on prototype args]) ] |
Darren Tucker | 1323f12 | 2018-02-27 08:41:25 +1100 | [diff] [blame] | 287 | ) |
| 288 | |
Darren Tucker | 391de5c | 2007-04-29 14:49:21 +1000 | [diff] [blame] | 289 | if test "x$no_attrib_nonnull" != "x1" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 290 | AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull]) |
Darren Tucker | 391de5c | 2007-04-29 14:49:21 +1000 | [diff] [blame] | 291 | fi |
| 292 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 293 | AC_ARG_WITH([rpath], |
Tim Rice | 88368a3 | 2003-12-08 12:35:59 -0800 | [diff] [blame] | 294 | [ --without-rpath Disable auto-added -R linker paths], |
| 295 | [ |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 296 | if test "x$withval" = "xno" ; then |
Darren Tucker | 2f0bad2 | 2019-01-21 21:28:27 +1100 | [diff] [blame] | 297 | rpath_opt="" |
| 298 | elif test "x$withval" = "xyes" ; then |
| 299 | rpath_opt="-R" |
| 300 | else |
| 301 | rpath_opt="$withval" |
Tim Rice | 88368a3 | 2003-12-08 12:35:59 -0800 | [diff] [blame] | 302 | fi |
| 303 | ] |
| 304 | ) |
| 305 | |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 306 | # Allow user to specify flags |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 307 | AC_ARG_WITH([cflags], |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 308 | [ --with-cflags Specify additional flags to pass to compiler], |
| 309 | [ |
| 310 | if test -n "$withval" && test "x$withval" != "xno" && \ |
| 311 | test "x${withval}" != "xyes"; then |
| 312 | CFLAGS="$CFLAGS $withval" |
| 313 | fi |
| 314 | ] |
| 315 | ) |
Damien Miller | de35c38 | 2017-09-08 12:38:31 +1000 | [diff] [blame] | 316 | |
| 317 | AC_ARG_WITH([cflags-after], |
| 318 | [ --with-cflags-after Specify additional flags to pass to compiler after configure], |
| 319 | [ |
| 320 | if test -n "$withval" && test "x$withval" != "xno" && \ |
| 321 | test "x${withval}" != "xyes"; then |
| 322 | CFLAGS_AFTER="$withval" |
| 323 | fi |
| 324 | ] |
| 325 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 326 | AC_ARG_WITH([cppflags], |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 327 | [ --with-cppflags Specify additional flags to pass to preprocessor] , |
| 328 | [ |
| 329 | if test -n "$withval" && test "x$withval" != "xno" && \ |
| 330 | test "x${withval}" != "xyes"; then |
| 331 | CPPFLAGS="$CPPFLAGS $withval" |
| 332 | fi |
| 333 | ] |
| 334 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 335 | AC_ARG_WITH([ldflags], |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 336 | [ --with-ldflags Specify additional flags to pass to linker], |
| 337 | [ |
| 338 | if test -n "$withval" && test "x$withval" != "xno" && \ |
| 339 | test "x${withval}" != "xyes"; then |
| 340 | LDFLAGS="$LDFLAGS $withval" |
| 341 | fi |
| 342 | ] |
| 343 | ) |
Damien Miller | de35c38 | 2017-09-08 12:38:31 +1000 | [diff] [blame] | 344 | AC_ARG_WITH([ldflags-after], |
| 345 | [ --with-ldflags-after Specify additional flags to pass to linker after configure], |
| 346 | [ |
| 347 | if test -n "$withval" && test "x$withval" != "xno" && \ |
| 348 | test "x${withval}" != "xyes"; then |
| 349 | LDFLAGS_AFTER="$withval" |
| 350 | fi |
| 351 | ] |
| 352 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 353 | AC_ARG_WITH([libs], |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 354 | [ --with-libs Specify additional libraries to link with], |
| 355 | [ |
| 356 | if test -n "$withval" && test "x$withval" != "xno" && \ |
| 357 | test "x${withval}" != "xyes"; then |
| 358 | LIBS="$LIBS $withval" |
| 359 | fi |
| 360 | ] |
| 361 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 362 | AC_ARG_WITH([Werror], |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 363 | [ --with-Werror Build main code with -Werror], |
| 364 | [ |
| 365 | if test -n "$withval" && test "x$withval" != "xno"; then |
| 366 | werror_flags="-Werror" |
| 367 | if test "x${withval}" != "xyes"; then |
| 368 | werror_flags="$withval" |
| 369 | fi |
| 370 | fi |
| 371 | ] |
| 372 | ) |
| 373 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 374 | AC_CHECK_HEADERS([ \ |
Damien Miller | 1ff130d | 2013-12-07 11:51:51 +1100 | [diff] [blame] | 375 | blf.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 376 | bstring.h \ |
| 377 | crypt.h \ |
| 378 | crypto/sha2.h \ |
| 379 | dirent.h \ |
| 380 | endian.h \ |
Damien Miller | 91f40d8 | 2013-02-22 11:37:00 +1100 | [diff] [blame] | 381 | elf.h \ |
Darren Tucker | 6310ef2 | 2016-07-13 14:42:35 +1000 | [diff] [blame] | 382 | err.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 383 | features.h \ |
| 384 | fcntl.h \ |
| 385 | floatingpoint.h \ |
Darren Tucker | 0e3c5bc | 2019-11-01 18:24:29 +1100 | [diff] [blame] | 386 | fnmatch.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 387 | getopt.h \ |
| 388 | glob.h \ |
| 389 | ia.h \ |
| 390 | iaf.h \ |
Darren Tucker | b59162d | 2018-02-23 15:20:42 +1100 | [diff] [blame] | 391 | ifaddrs.h \ |
Darren Tucker | 6d72568 | 2014-01-17 19:17:34 +1100 | [diff] [blame] | 392 | inttypes.h \ |
Darren Tucker | f3f2cc8 | 2016-07-11 17:23:38 +1000 | [diff] [blame] | 393 | langinfo.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 394 | limits.h \ |
Darren Tucker | ae133d4 | 2013-06-06 08:30:20 +1000 | [diff] [blame] | 395 | locale.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 396 | login.h \ |
| 397 | maillock.h \ |
| 398 | ndir.h \ |
| 399 | net/if_tun.h \ |
| 400 | netdb.h \ |
| 401 | netgroup.h \ |
| 402 | pam/pam_appl.h \ |
| 403 | paths.h \ |
Darren Tucker | febf0f5 | 2007-06-25 22:15:12 +1000 | [diff] [blame] | 404 | poll.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 405 | pty.h \ |
| 406 | readpassphrase.h \ |
| 407 | rpc/types.h \ |
| 408 | security/pam_appl.h \ |
| 409 | sha2.h \ |
| 410 | shadow.h \ |
| 411 | stddef.h \ |
| 412 | stdint.h \ |
| 413 | string.h \ |
| 414 | strings.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 415 | sys/bitypes.h \ |
| 416 | sys/bsdtty.h \ |
| 417 | sys/cdefs.h \ |
| 418 | sys/dir.h \ |
Damien Miller | f885474 | 2018-02-26 12:18:14 +1100 | [diff] [blame] | 419 | sys/file.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 420 | sys/mman.h \ |
Darren Tucker | ce066f6 | 2018-02-22 20:45:09 +1100 | [diff] [blame] | 421 | sys/label.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 422 | sys/ndir.h \ |
Darren Tucker | 7c92a65 | 2007-09-27 07:00:09 +1000 | [diff] [blame] | 423 | sys/poll.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 424 | sys/prctl.h \ |
| 425 | sys/pstat.h \ |
Darren Tucker | 5ee3fb5 | 2016-11-01 08:12:33 +1100 | [diff] [blame] | 426 | sys/ptrace.h \ |
Damien Miller | afa6e79 | 2018-04-13 13:31:42 +1000 | [diff] [blame] | 427 | sys/random.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 428 | sys/select.h \ |
| 429 | sys/stat.h \ |
| 430 | sys/stream.h \ |
| 431 | sys/stropts.h \ |
| 432 | sys/strtio.h \ |
Darren Tucker | 5b2e2ba | 2008-06-08 09:25:28 +1000 | [diff] [blame] | 433 | sys/statvfs.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 434 | sys/sysmacros.h \ |
| 435 | sys/time.h \ |
| 436 | sys/timers.h \ |
Darren Tucker | 1105756 | 2018-02-25 11:22:57 +1100 | [diff] [blame] | 437 | sys/vfs.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 438 | time.h \ |
| 439 | tmpdir.h \ |
| 440 | ttyent.h \ |
Tim Rice | aa8954f | 2007-05-09 15:57:43 -0700 | [diff] [blame] | 441 | ucred.h \ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 442 | unistd.h \ |
| 443 | usersec.h \ |
| 444 | util.h \ |
| 445 | utime.h \ |
| 446 | utmp.h \ |
| 447 | utmpx.h \ |
| 448 | vis.h \ |
Darren Tucker | f3f2cc8 | 2016-07-11 17:23:38 +1000 | [diff] [blame] | 449 | wchar.h \ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 450 | ]) |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 451 | |
Darren Tucker | ce066f6 | 2018-02-22 20:45:09 +1100 | [diff] [blame] | 452 | # On some platforms (eg SunOS4) sys/audit.h requires sys/[time|types|label.h] |
| 453 | # to be included first. |
| 454 | AC_CHECK_HEADERS([sys/audit.h], [], [], [ |
| 455 | #ifdef HAVE_SYS_TIME_H |
| 456 | # include <sys/time.h> |
| 457 | #endif |
| 458 | #ifdef HAVE_SYS_TYPES_H |
| 459 | # include <sys/types.h> |
| 460 | #endif |
| 461 | #ifdef HAVE_SYS_LABEL_H |
| 462 | # include <sys/label.h> |
| 463 | #endif |
| 464 | ]) |
| 465 | |
Darren Tucker | dd9d9b3 | 2017-08-28 16:48:27 +1000 | [diff] [blame] | 466 | # sys/capsicum.h requires sys/types.h |
| 467 | AC_CHECK_HEADERS([sys/capsicum.h], [], [], [ |
| 468 | #ifdef HAVE_SYS_TYPES_H |
| 469 | # include <sys/types.h> |
| 470 | #endif |
| 471 | ]) |
| 472 | |
Darren Tucker | fa1b834 | 2017-11-03 14:09:45 +1100 | [diff] [blame] | 473 | # net/route.h requires sys/socket.h and sys/types.h. |
| 474 | # sys/sysctl.h also requires sys/param.h |
| 475 | AC_CHECK_HEADERS([net/route.h sys/sysctl.h], [], [], [ |
| 476 | #ifdef HAVE_SYS_TYPES_H |
| 477 | # include <sys/types.h> |
| 478 | #endif |
| 479 | #include <sys/param.h> |
Damien Miller | 3235473 | 2017-10-25 11:25:43 +1100 | [diff] [blame] | 480 | #include <sys/socket.h> |
| 481 | ]) |
| 482 | |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 483 | # lastlog.h requires sys/time.h to be included first on Solaris |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 484 | AC_CHECK_HEADERS([lastlog.h], [], [], [ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 485 | #ifdef HAVE_SYS_TIME_H |
| 486 | # include <sys/time.h> |
| 487 | #endif |
| 488 | ]) |
| 489 | |
| 490 | # sys/ptms.h requires sys/stream.h to be included first on Solaris |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 491 | AC_CHECK_HEADERS([sys/ptms.h], [], [], [ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 492 | #ifdef HAVE_SYS_STREAM_H |
| 493 | # include <sys/stream.h> |
| 494 | #endif |
| 495 | ]) |
| 496 | |
| 497 | # login_cap.h requires sys/types.h on NetBSD |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 498 | AC_CHECK_HEADERS([login_cap.h], [], [], [ |
Tim Rice | 1cfab23 | 2006-10-03 09:34:35 -0700 | [diff] [blame] | 499 | #include <sys/types.h> |
| 500 | ]) |
| 501 | |
Darren Tucker | c4b22ca | 2009-07-12 21:56:29 +1000 | [diff] [blame] | 502 | # older BSDs need sys/param.h before sys/mount.h |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 503 | AC_CHECK_HEADERS([sys/mount.h], [], [], [ |
Darren Tucker | c4b22ca | 2009-07-12 21:56:29 +1000 | [diff] [blame] | 504 | #include <sys/param.h> |
| 505 | ]) |
| 506 | |
Darren Tucker | ef4901c | 2013-06-03 01:59:13 +1000 | [diff] [blame] | 507 | # Android requires sys/socket.h to be included before sys/un.h |
| 508 | AC_CHECK_HEADERS([sys/un.h], [], [], [ |
Darren Tucker | 0b43ffe | 2013-06-03 09:30:44 +1000 | [diff] [blame] | 509 | #include <sys/types.h> |
Darren Tucker | 16cac19 | 2013-06-04 12:55:24 +1000 | [diff] [blame] | 510 | #include <sys/socket.h> |
Darren Tucker | ef4901c | 2013-06-03 01:59:13 +1000 | [diff] [blame] | 511 | ]) |
| 512 | |
Damien Miller | 1b06dc3 | 2006-08-31 03:24:41 +1000 | [diff] [blame] | 513 | # Messages for features tested for in target-specific section |
| 514 | SIA_MSG="no" |
| 515 | SPC_MSG="no" |
Darren Tucker | 9752835 | 2010-11-05 12:03:05 +1100 | [diff] [blame] | 516 | SP_MSG="no" |
Damien Miller | 4626cba | 2016-01-08 14:24:56 +1100 | [diff] [blame] | 517 | SPP_MSG="no" |
| 518 | |
| 519 | # Support for Solaris/Illumos privileges (this test is used by both |
| 520 | # the --with-solaris-privs option and --with-sandbox=solaris). |
| 521 | SOLARIS_PRIVS="no" |
Damien Miller | 1b06dc3 | 2006-08-31 03:24:41 +1000 | [diff] [blame] | 522 | |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 523 | # Check for some target-specific stuff |
Damien Miller | 76112de | 1999-12-21 11:18:08 +1100 | [diff] [blame] | 524 | case "$host" in |
Damien Miller | 75b1d10 | 2000-01-07 14:01:41 +1100 | [diff] [blame] | 525 | *-*-aix*) |
Darren Tucker | 9216c37 | 2006-09-18 23:17:40 +1000 | [diff] [blame] | 526 | # Some versions of VAC won't allow macro redefinitions at |
| 527 | # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that |
| 528 | # particularly with older versions of vac or xlc. |
Damien Miller | 10479cc | 2018-04-10 10:19:02 +1000 | [diff] [blame] | 529 | # It also throws errors about null macro arguments, but these are |
Darren Tucker | 9216c37 | 2006-09-18 23:17:40 +1000 | [diff] [blame] | 530 | # not fatal. |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 531 | AC_MSG_CHECKING([if compiler allows macro redefinitions]) |
Darren Tucker | 9216c37 | 2006-09-18 23:17:40 +1000 | [diff] [blame] | 532 | AC_COMPILE_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 533 | [AC_LANG_PROGRAM([[ |
Darren Tucker | 9216c37 | 2006-09-18 23:17:40 +1000 | [diff] [blame] | 534 | #define testmacro foo |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 535 | #define testmacro bar]], |
| 536 | [[ exit(0); ]])], |
| 537 | [ AC_MSG_RESULT([yes]) ], |
| 538 | [ AC_MSG_RESULT([no]) |
Darren Tucker | 9216c37 | 2006-09-18 23:17:40 +1000 | [diff] [blame] | 539 | CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`" |
Darren Tucker | 9216c37 | 2006-09-18 23:17:40 +1000 | [diff] [blame] | 540 | CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`" |
| 541 | CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`" |
| 542 | ] |
| 543 | ) |
| 544 | |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 545 | AC_MSG_CHECKING([how to specify blibpath for linker ($LD)]) |
Damien Miller | eab4bae | 2003-04-29 23:22:40 +1000 | [diff] [blame] | 546 | if (test -z "$blibpath"); then |
Tim Rice | fcb6220 | 2004-01-23 18:35:16 -0800 | [diff] [blame] | 547 | blibpath="/usr/lib:/lib" |
Damien Miller | 29ea30d | 2000-03-17 10:54:15 +1100 | [diff] [blame] | 548 | fi |
Damien Miller | eab4bae | 2003-04-29 23:22:40 +1000 | [diff] [blame] | 549 | saved_LDFLAGS="$LDFLAGS" |
Darren Tucker | bdc1212 | 2006-07-06 11:56:25 +1000 | [diff] [blame] | 550 | if test "$GCC" = "yes"; then |
| 551 | flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:" |
| 552 | else |
| 553 | flags="-blibpath: -Wl,-blibpath: -Wl,-rpath," |
| 554 | fi |
| 555 | for tryflags in $flags ;do |
Damien Miller | eab4bae | 2003-04-29 23:22:40 +1000 | [diff] [blame] | 556 | if (test -z "$blibflags"); then |
| 557 | LDFLAGS="$saved_LDFLAGS $tryflags$blibpath" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 558 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
| 559 | [blibflags=$tryflags], []) |
Damien Miller | eab4bae | 2003-04-29 23:22:40 +1000 | [diff] [blame] | 560 | fi |
| 561 | done |
| 562 | if (test -z "$blibflags"); then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 563 | AC_MSG_RESULT([not found]) |
Damien Miller | eab4bae | 2003-04-29 23:22:40 +1000 | [diff] [blame] | 564 | AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log]) |
| 565 | else |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 566 | AC_MSG_RESULT([$blibflags]) |
Damien Miller | eab4bae | 2003-04-29 23:22:40 +1000 | [diff] [blame] | 567 | fi |
| 568 | LDFLAGS="$saved_LDFLAGS" |
Darren Tucker | 5c6a91a | 2003-07-14 16:21:44 +1000 | [diff] [blame] | 569 | dnl Check for authenticate. Might be in libs.a on older AIXes |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 570 | AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 571 | [Define if you want to enable AIX4's authenticate function])], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 572 | [AC_CHECK_LIB([s], [authenticate], |
| 573 | [ AC_DEFINE([WITH_AIXAUTHENTICATE]) |
Tim Rice | e958ed3 | 2002-07-05 07:12:33 -0700 | [diff] [blame] | 574 | LIBS="$LIBS -ls" |
| 575 | ]) |
| 576 | ]) |
Darren Tucker | 3c774c5 | 2005-02-16 22:49:31 +1100 | [diff] [blame] | 577 | dnl Check for various auth function declarations in headers. |
Darren Tucker | 04cfbe0 | 2005-02-20 23:27:11 +1100 | [diff] [blame] | 578 | AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess, |
Darren Tucker | e66519d | 2005-03-21 22:46:34 +1100 | [diff] [blame] | 579 | passwdexpired, setauthdb], , , [#include <usersec.h>]) |
Darren Tucker | 5c6a91a | 2003-07-14 16:21:44 +1000 | [diff] [blame] | 580 | dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 581 | AC_CHECK_DECLS([loginfailed], |
| 582 | [AC_MSG_CHECKING([if loginfailed takes 4 arguments]) |
| 583 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]], |
| 584 | [[ (void)loginfailed("user","host","tty",0); ]])], |
| 585 | [AC_MSG_RESULT([yes]) |
| 586 | AC_DEFINE([AIX_LOGINFAILED_4ARG], [1], |
| 587 | [Define if your AIX loginfailed() function |
| 588 | takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no]) |
| 589 | ])], |
| 590 | [], |
| 591 | [#include <usersec.h>] |
Darren Tucker | 5c6a91a | 2003-07-14 16:21:44 +1000 | [diff] [blame] | 592 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 593 | AC_CHECK_FUNCS([getgrset setauthdb]) |
| 594 | AC_CHECK_DECL([F_CLOSEM], |
| 595 | AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]), |
Darren Tucker | 3083bc2 | 2006-08-17 19:35:49 +1000 | [diff] [blame] | 596 | [], |
| 597 | [ #include <limits.h> |
| 598 | #include <fcntl.h> ] |
| 599 | ) |
Darren Tucker | 691d523 | 2005-02-15 21:45:57 +1100 | [diff] [blame] | 600 | check_for_aix_broken_getaddrinfo=1 |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 601 | AC_DEFINE([SETEUID_BREAKS_SETUID], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 602 | [Define if your platform breaks doing a seteuid before a setuid]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 603 | AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken]) |
| 604 | AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken]) |
andre | 60f3c98 | 2000-06-03 16:18:19 +0000 | [diff] [blame] | 605 | dnl AIX handles lastlog as part of its login message |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 606 | AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog]) |
| 607 | AC_DEFINE([LOGIN_NEEDS_UTMPX], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 608 | [Some systems need a utmpx entry for /bin/login to work]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 609 | AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 610 | [Define to a Set Process Title type if your system is |
| 611 | supported by bsd-setproctitle.c]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 612 | AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1], |
Darren Tucker | 91d25a0 | 2005-11-26 22:24:09 +1100 | [diff] [blame] | 613 | [AIX 5.2 and 5.3 (and presumably newer) require this]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 614 | AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd]) |
Darren Tucker | aa97d13 | 2013-03-12 11:31:05 +1100 | [diff] [blame] | 615 | AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)]) |
Darren Tucker | 2c71ca1 | 2018-03-30 18:23:07 +1100 | [diff] [blame] | 616 | AC_DEFINE([BROKEN_STRNDUP], 1, [strndup broken, see APAR IY61211]) |
| 617 | AC_DEFINE([BROKEN_STRNLEN], 1, [strnlen broken, see APAR IY62551]) |
Damien Miller | 75b1d10 | 2000-01-07 14:01:41 +1100 | [diff] [blame] | 618 | ;; |
Darren Tucker | 898ac93 | 2013-06-03 02:03:25 +1000 | [diff] [blame] | 619 | *-*-android*) |
| 620 | AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp]) |
| 621 | AC_DEFINE([DISABLE_WTMP], [1], [Define if you don't want to use wtmp]) |
| 622 | ;; |
Damien Miller | bac2d8a | 2000-09-05 16:13:06 +1100 | [diff] [blame] | 623 | *-*-cygwin*) |
Damien Miller | c8936ac | 2003-02-11 10:04:03 +1100 | [diff] [blame] | 624 | check_for_libcrypt_later=1 |
Darren Tucker | 573e387 | 2007-03-02 17:50:03 +1100 | [diff] [blame] | 625 | LIBS="$LIBS /usr/lib/textreadmode.o" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 626 | AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin]) |
| 627 | AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()]) |
Damien Miller | 4626cba | 2016-01-08 14:24:56 +1100 | [diff] [blame] | 628 | AC_DEFINE([NO_UID_RESTORATION_TEST], [1], |
| 629 | [Define to disable UID restoration test]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 630 | AC_DEFINE([DISABLE_SHADOW], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 631 | [Define if you want to disable shadow passwords]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 632 | AC_DEFINE([NO_X11_UNIX_SOCKETS], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 633 | [Define if X11 doesn't support AF_UNIX sockets on that system]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 634 | AC_DEFINE([DISABLE_FD_PASSING], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 635 | [Define if your platform needs to skip post auth |
| 636 | file descriptor passing]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 637 | AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size]) |
Darren Tucker | fdce373 | 2014-01-18 21:12:42 +1100 | [diff] [blame] | 638 | AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters]) |
| 639 | # Cygwin defines optargs, optargs as declspec(dllimport) for historical |
| 640 | # reasons which cause compile warnings, so we disable those warnings. |
| 641 | OSSH_CHECK_CFLAG_COMPILE([-Wno-attributes]) |
Damien Miller | bac2d8a | 2000-09-05 16:13:06 +1100 | [diff] [blame] | 642 | ;; |
Ben Lindstrom | 5805513 | 2001-02-15 18:34:29 +0000 | [diff] [blame] | 643 | *-*-dgux*) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 644 | AC_DEFINE([IP_TOS_IS_BROKEN], [1], |
Tim Rice | a74000e | 2009-03-18 11:25:02 -0700 | [diff] [blame] | 645 | [Define if your system choked on IP TOS setting]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 646 | AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 647 | AC_DEFINE([BROKEN_SETREUID]) |
| 648 | AC_DEFINE([BROKEN_SETREGID]) |
Ben Lindstrom | 5805513 | 2001-02-15 18:34:29 +0000 | [diff] [blame] | 649 | ;; |
Ben Lindstrom | fed7bb4 | 2001-07-15 18:30:42 +0000 | [diff] [blame] | 650 | *-*-darwin*) |
Damien Miller | 852472a | 2014-01-22 16:31:18 +1100 | [diff] [blame] | 651 | use_pie=auto |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 652 | AC_MSG_CHECKING([if we have working getaddrinfo]) |
| 653 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h> |
Damien Miller | fc93d4b | 2002-09-04 23:26:29 +1000 | [diff] [blame] | 654 | main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) |
| 655 | exit(0); |
| 656 | else |
| 657 | exit(1); |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 658 | } |
| 659 | ]])], |
| 660 | [AC_MSG_RESULT([working])], |
| 661 | [AC_MSG_RESULT([buggy]) |
| 662 | AC_DEFINE([BROKEN_GETADDRINFO], [1], |
| 663 | [getaddrinfo is broken (if present)]) |
| 664 | ], |
| 665 | [AC_MSG_RESULT([assume it is working])]) |
| 666 | AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 667 | AC_DEFINE([BROKEN_SETREUID]) |
| 668 | AC_DEFINE([BROKEN_SETREGID]) |
| 669 | AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect]) |
| 670 | AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 671 | [Define if your resolver libs need this for getrrsetbyname]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 672 | AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way]) |
| 673 | AC_DEFINE([SSH_TUN_COMPAT_AF], [1], |
Darren Tucker | 3eb4834 | 2006-06-23 21:05:12 +1000 | [diff] [blame] | 674 | [Use tunnel device compatibility to OpenBSD]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 675 | AC_DEFINE([SSH_TUN_PREPEND_AF], [1], |
Darren Tucker | 3eb4834 | 2006-06-23 21:05:12 +1000 | [diff] [blame] | 676 | [Prepend the address family to IP tunnel traffic]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 677 | m4_pattern_allow([AU_IPv]) |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 678 | AC_CHECK_DECL([AU_IPv4], [], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 679 | AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records]) |
Darren Tucker | acada07 | 2008-02-25 21:05:04 +1100 | [diff] [blame] | 680 | [#include <bsm/audit.h>] |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 681 | AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1], |
Damien Miller | 20e231f | 2009-02-12 13:12:21 +1100 | [diff] [blame] | 682 | [Define if pututxline updates lastlog too]) |
Darren Tucker | acada07 | 2008-02-25 21:05:04 +1100 | [diff] [blame] | 683 | ) |
Damien Miller | c09182f | 2011-06-03 12:11:38 +1000 | [diff] [blame] | 684 | AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV], |
| 685 | [Define to a Set Process Title type if your system is |
| 686 | supported by bsd-setproctitle.c]) |
Damien Miller | cd5e52e | 2011-06-27 07:18:18 +1000 | [diff] [blame] | 687 | AC_CHECK_FUNCS([sandbox_init]) |
| 688 | AC_CHECK_HEADERS([sandbox.h]) |
Damien Miller | 39f303b | 2016-02-23 12:56:59 +1100 | [diff] [blame] | 689 | AC_CHECK_LIB([sandbox], [sandbox_apply], [ |
| 690 | SSHDLIBS="$SSHDLIBS -lsandbox" |
| 691 | ]) |
Damien Miller | 2874418 | 2019-08-30 13:21:38 +1000 | [diff] [blame] | 692 | # proc_pidinfo()-based closefrom() replacement. |
| 693 | AC_CHECK_HEADERS([libproc.h]) |
| 694 | AC_CHECK_FUNCS([proc_pidinfo]) |
Ben Lindstrom | fed7bb4 | 2001-07-15 18:30:42 +0000 | [diff] [blame] | 695 | ;; |
Darren Tucker | 57b2920 | 2006-09-10 20:25:51 +1000 | [diff] [blame] | 696 | *-*-dragonfly*) |
| 697 | SSHDLIBS="$SSHDLIBS -lcrypt" |
Darren Tucker | 882abfd | 2013-11-09 00:17:41 +1100 | [diff] [blame] | 698 | TEST_MALLOC_OPTIONS="AFGJPRX" |
Darren Tucker | 57b2920 | 2006-09-10 20:25:51 +1000 | [diff] [blame] | 699 | ;; |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 700 | *-*-haiku*) |
Darren Tucker | 5faa52d | 2016-08-02 15:22:40 +1000 | [diff] [blame] | 701 | LIBS="$LIBS -lbsd " |
Darren Tucker | bb4f003 | 2019-11-01 15:06:16 +1100 | [diff] [blame] | 702 | CFLAGS="$CFLAGS -D_BSD_SOURCE" |
Darren Tucker | 5faa52d | 2016-08-02 15:22:40 +1000 | [diff] [blame] | 703 | AC_CHECK_LIB([network], [socket]) |
| 704 | AC_DEFINE([HAVE_U_INT64_T]) |
Darren Tucker | bb4f003 | 2019-11-01 15:06:16 +1100 | [diff] [blame] | 705 | AC_DEFINE([DISABLE_UTMPX], [1], [no utmpx]) |
Darren Tucker | 5faa52d | 2016-08-02 15:22:40 +1000 | [diff] [blame] | 706 | MANTYPE=man |
| 707 | ;; |
Darren Tucker | fd33328 | 2005-05-28 18:31:42 +1000 | [diff] [blame] | 708 | *-*-hpux*) |
| 709 | # first we define all of the options common to all HP-UX releases |
Kevin Steves | 315f8b7 | 2001-06-28 00:24:41 +0000 | [diff] [blame] | 710 | CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1" |
Damien Miller | 9a94734 | 2000-08-30 10:03:33 +1100 | [diff] [blame] | 711 | IPADDR_IN_DISPLAY=yes |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 712 | AC_DEFINE([USE_PIPES]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 713 | AC_DEFINE([LOGIN_NEEDS_UTMPX]) |
| 714 | AC_DEFINE([LOCKED_PASSWD_STRING], ["*"], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 715 | [String used in /etc/passwd to denote locked account]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 716 | AC_DEFINE([SPT_TYPE], [SPT_PSTAT]) |
Darren Tucker | aa97d13 | 2013-03-12 11:31:05 +1100 | [diff] [blame] | 717 | AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)]) |
Tim Rice | 90f42b0 | 2011-06-02 18:17:49 -0700 | [diff] [blame] | 718 | maildir="/var/mail" |
Tim Rice | f028f1e | 2002-07-19 12:41:10 -0700 | [diff] [blame] | 719 | LIBS="$LIBS -lsec" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 720 | AC_CHECK_LIB([xnet], [t_error], , |
| 721 | [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])]) |
Darren Tucker | fd33328 | 2005-05-28 18:31:42 +1000 | [diff] [blame] | 722 | |
| 723 | # next, we define all of the options specific to major releases |
| 724 | case "$host" in |
| 725 | *-*-hpux10*) |
| 726 | if test -z "$GCC"; then |
| 727 | CFLAGS="$CFLAGS -Ae" |
| 728 | fi |
| 729 | ;; |
| 730 | *-*-hpux11*) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 731 | AC_DEFINE([PAM_SUN_CODEBASE], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 732 | [Define if you are using Solaris-derived PAM which |
| 733 | passes pam_messages to the conversation function |
| 734 | with an extra level of indirection]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 735 | AC_DEFINE([DISABLE_UTMP], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 736 | [Define if you don't want to use utmp]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 737 | AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins]) |
Darren Tucker | fd33328 | 2005-05-28 18:31:42 +1000 | [diff] [blame] | 738 | check_for_hpux_broken_getaddrinfo=1 |
| 739 | check_for_conflicting_getspnam=1 |
| 740 | ;; |
| 741 | esac |
| 742 | |
| 743 | # lastly, we define options specific to minor releases |
| 744 | case "$host" in |
| 745 | *-*-hpux10.26) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 746 | AC_DEFINE([HAVE_SECUREWARE], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 747 | [Define if you have SecureWare-based |
| 748 | protected password database]) |
Darren Tucker | fd33328 | 2005-05-28 18:31:42 +1000 | [diff] [blame] | 749 | disable_ptmx_check=yes |
| 750 | LIBS="$LIBS -lsecpw" |
| 751 | ;; |
| 752 | esac |
Damien Miller | 1bead33 | 2000-04-30 00:47:29 +1000 | [diff] [blame] | 753 | ;; |
Damien Miller | beb4ba5 | 1999-12-28 15:09:35 +1100 | [diff] [blame] | 754 | *-*-irix5*) |
Damien Miller | 190d5a8 | 2000-09-30 09:43:19 +1100 | [diff] [blame] | 755 | PATH="$PATH:/usr/etc" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 756 | AC_DEFINE([BROKEN_INET_NTOA], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 757 | [Define if you system's inet_ntoa is busted |
| 758 | (e.g. Irix gcc issue)]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 759 | AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 760 | AC_DEFINE([BROKEN_SETREUID]) |
| 761 | AC_DEFINE([BROKEN_SETREGID]) |
| 762 | AC_DEFINE([WITH_ABBREV_NO_TTY], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 763 | [Define if you shouldn't strip 'tty' from your |
| 764 | ttyname in [uw]tmp]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 765 | AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"]) |
Damien Miller | 1808f38 | 2000-01-06 12:03:12 +1100 | [diff] [blame] | 766 | ;; |
| 767 | *-*-irix6*) |
Damien Miller | 190d5a8 | 2000-09-30 09:43:19 +1100 | [diff] [blame] | 768 | PATH="$PATH:/usr/etc" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 769 | AC_DEFINE([WITH_IRIX_ARRAY], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 770 | [Define if you have/want arrays |
Damien Miller | 10479cc | 2018-04-10 10:19:02 +1000 | [diff] [blame] | 771 | (cluster-wide session management, not C arrays)]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 772 | AC_DEFINE([WITH_IRIX_PROJECT], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 773 | [Define if you want IRIX project management]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 774 | AC_DEFINE([WITH_IRIX_AUDIT], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 775 | [Define if you want IRIX audit trails]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 776 | AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 777 | [Define if you want IRIX kernel jobs])]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 778 | AC_DEFINE([BROKEN_INET_NTOA]) |
| 779 | AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 780 | AC_DEFINE([BROKEN_SETREUID]) |
| 781 | AC_DEFINE([BROKEN_SETREGID]) |
| 782 | AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)]) |
| 783 | AC_DEFINE([WITH_ABBREV_NO_TTY]) |
| 784 | AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"]) |
Damien Miller | beb4ba5 | 1999-12-28 15:09:35 +1100 | [diff] [blame] | 785 | ;; |
Damien Miller | 9055172 | 2009-02-16 15:37:03 +1100 | [diff] [blame] | 786 | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu) |
| 787 | check_for_libcrypt_later=1 |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 788 | AC_DEFINE([PAM_TTY_KLUDGE]) |
| 789 | AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"]) |
| 790 | AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV]) |
| 791 | AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts]) |
| 792 | AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins]) |
Damien Miller | 9055172 | 2009-02-16 15:37:03 +1100 | [diff] [blame] | 793 | ;; |
Damien Miller | b29ea91 | 2000-01-15 14:12:03 +1100 | [diff] [blame] | 794 | *-*-linux*) |
| 795 | no_dev_ptmx=1 |
Damien Miller | 852472a | 2014-01-22 16:31:18 +1100 | [diff] [blame] | 796 | use_pie=auto |
Damien Miller | a64b57a | 2001-01-17 10:44:13 +1100 | [diff] [blame] | 797 | check_for_libcrypt_later=1 |
Darren Tucker | 70a3d55 | 2003-08-21 17:58:29 +1000 | [diff] [blame] | 798 | check_for_openpty_ctty_bug=1 |
Darren Tucker | c61d5ec | 2017-02-03 14:10:34 +1100 | [diff] [blame] | 799 | dnl Target SUSv3/POSIX.1-2001 plus BSD specifics. |
| 800 | dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE |
| 801 | CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 802 | AC_DEFINE([PAM_TTY_KLUDGE], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 803 | [Work around problematic Linux PAM modules handling of PAM_TTY]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 804 | AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 805 | [String used in /etc/passwd to denote locked account]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 806 | AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV]) |
| 807 | AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 808 | [Define to whatever link() returns for "not supported" |
| 809 | if it doesn't return EOPNOTSUPP.]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 810 | AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts]) |
| 811 | AC_DEFINE([USE_BTMP]) |
| 812 | AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer]) |
Damien Miller | 7bcb089 | 2000-03-11 20:45:40 +1100 | [diff] [blame] | 813 | inet6_default_4in6=yes |
Darren Tucker | 3c01654 | 2003-05-02 20:48:21 +1000 | [diff] [blame] | 814 | case `uname -r` in |
Darren Tucker | c437cda | 2003-05-10 17:05:46 +1000 | [diff] [blame] | 815 | 1.*|2.0.*) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 816 | AC_DEFINE([BROKEN_CMSG_TYPE], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 817 | [Define if cmsg_type is not passed correctly]) |
Darren Tucker | 3c01654 | 2003-05-02 20:48:21 +1000 | [diff] [blame] | 818 | ;; |
Darren Tucker | 3c01654 | 2003-05-02 20:48:21 +1000 | [diff] [blame] | 819 | esac |
Damien Miller | 89e03ba | 2005-12-31 16:42:03 +1100 | [diff] [blame] | 820 | # tun(4) forwarding compat code |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 821 | AC_CHECK_HEADERS([linux/if_tun.h]) |
Damien Miller | bd4e410 | 2006-01-01 21:03:30 +1100 | [diff] [blame] | 822 | if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 823 | AC_DEFINE([SSH_TUN_LINUX], [1], |
Damien Miller | 89e03ba | 2005-12-31 16:42:03 +1100 | [diff] [blame] | 824 | [Open tunnel devices the Linux tun/tap way]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 825 | AC_DEFINE([SSH_TUN_COMPAT_AF], [1], |
Damien Miller | 89e03ba | 2005-12-31 16:42:03 +1100 | [diff] [blame] | 826 | [Use tunnel device compatibility to OpenBSD]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 827 | AC_DEFINE([SSH_TUN_PREPEND_AF], [1], |
Damien Miller | 89e03ba | 2005-12-31 16:42:03 +1100 | [diff] [blame] | 828 | [Prepend the address family to IP tunnel traffic]) |
| 829 | fi |
Darren Tucker | 81c9ccd | 2017-11-03 14:52:51 +1100 | [diff] [blame] | 830 | AC_CHECK_HEADER([linux/if.h], |
| 831 | AC_DEFINE([SYS_RDOMAIN_LINUX], [1], |
Darren Tucker | 24d2a33 | 2018-02-11 21:20:39 +1300 | [diff] [blame] | 832 | [Support routing domains using Linux VRF]), [], [ |
| 833 | #ifdef HAVE_SYS_TYPES_H |
Damien Miller | 8729498 | 2019-07-10 09:43:19 +1000 | [diff] [blame] | 834 | # include <sys/types.h> |
Darren Tucker | 24d2a33 | 2018-02-11 21:20:39 +1300 | [diff] [blame] | 835 | #endif |
| 836 | ]) |
Darren Tucker | 60395f9 | 2012-07-03 14:31:18 +1000 | [diff] [blame] | 837 | AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [], |
| 838 | [], [#include <linux/types.h>]) |
Vicente Olivert Riera | 5800867 | 2017-06-20 16:42:11 +0100 | [diff] [blame] | 839 | # Obtain MIPS ABI |
| 840 | case "$host" in |
| 841 | mips*) |
Darren Tucker | fbd733a | 2018-03-12 19:17:26 +1100 | [diff] [blame] | 842 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Vicente Olivert Riera | 5800867 | 2017-06-20 16:42:11 +0100 | [diff] [blame] | 843 | #if _MIPS_SIM != _ABIO32 |
| 844 | #error |
| 845 | #endif |
Darren Tucker | fbd733a | 2018-03-12 19:17:26 +1100 | [diff] [blame] | 846 | ]])],[mips_abi="o32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Vicente Olivert Riera | 5800867 | 2017-06-20 16:42:11 +0100 | [diff] [blame] | 847 | #if _MIPS_SIM != _ABIN32 |
| 848 | #error |
| 849 | #endif |
Darren Tucker | fbd733a | 2018-03-12 19:17:26 +1100 | [diff] [blame] | 850 | ]])],[mips_abi="n32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Vicente Olivert Riera | 5800867 | 2017-06-20 16:42:11 +0100 | [diff] [blame] | 851 | #if _MIPS_SIM != _ABI64 |
| 852 | #error |
| 853 | #endif |
Darren Tucker | fbd733a | 2018-03-12 19:17:26 +1100 | [diff] [blame] | 854 | ]])],[mips_abi="n64"],[AC_MSG_ERROR([unknown MIPS ABI]) |
Vicente Olivert Riera | 5800867 | 2017-06-20 16:42:11 +0100 | [diff] [blame] | 855 | ]) |
| 856 | ]) |
| 857 | ]) |
| 858 | ;; |
| 859 | esac |
Damien Miller | 91f40d8 | 2013-02-22 11:37:00 +1100 | [diff] [blame] | 860 | AC_MSG_CHECKING([for seccomp architecture]) |
| 861 | seccomp_audit_arch= |
Damien Miller | e0956e3 | 2012-04-04 11:27:54 +1000 | [diff] [blame] | 862 | case "$host" in |
| 863 | x86_64-*) |
Damien Miller | 91f40d8 | 2013-02-22 11:37:00 +1100 | [diff] [blame] | 864 | seccomp_audit_arch=AUDIT_ARCH_X86_64 |
Damien Miller | e0956e3 | 2012-04-04 11:27:54 +1000 | [diff] [blame] | 865 | ;; |
| 866 | i*86-*) |
Damien Miller | 91f40d8 | 2013-02-22 11:37:00 +1100 | [diff] [blame] | 867 | seccomp_audit_arch=AUDIT_ARCH_I386 |
Damien Miller | e0956e3 | 2012-04-04 11:27:54 +1000 | [diff] [blame] | 868 | ;; |
Damien Miller | 99f33d7 | 2015-06-17 10:50:51 +1000 | [diff] [blame] | 869 | arm*-*) |
Damien Miller | 91f40d8 | 2013-02-22 11:37:00 +1100 | [diff] [blame] | 870 | seccomp_audit_arch=AUDIT_ARCH_ARM |
Damien Miller | 99f33d7 | 2015-06-17 10:50:51 +1000 | [diff] [blame] | 871 | ;; |
| 872 | aarch64*-*) |
| 873 | seccomp_audit_arch=AUDIT_ARCH_AARCH64 |
Damien Miller | 5c15e22 | 2015-06-18 15:07:56 +1000 | [diff] [blame] | 874 | ;; |
Damien Miller | b9c5061 | 2016-07-08 13:59:13 +1000 | [diff] [blame] | 875 | s390x-*) |
| 876 | seccomp_audit_arch=AUDIT_ARCH_S390X |
| 877 | ;; |
| 878 | s390-*) |
| 879 | seccomp_audit_arch=AUDIT_ARCH_S390 |
| 880 | ;; |
| 881 | powerpc64-*) |
| 882 | seccomp_audit_arch=AUDIT_ARCH_PPC64 |
| 883 | ;; |
| 884 | powerpc64le-*) |
| 885 | seccomp_audit_arch=AUDIT_ARCH_PPC64LE |
| 886 | ;; |
| 887 | mips-*) |
| 888 | seccomp_audit_arch=AUDIT_ARCH_MIPS |
| 889 | ;; |
| 890 | mipsel-*) |
| 891 | seccomp_audit_arch=AUDIT_ARCH_MIPSEL |
| 892 | ;; |
| 893 | mips64-*) |
Vicente Olivert Riera | 4501151 | 2017-06-20 16:42:28 +0100 | [diff] [blame] | 894 | case "$mips_abi" in |
| 895 | "n32") |
| 896 | seccomp_audit_arch=AUDIT_ARCH_MIPS64N32 |
| 897 | ;; |
| 898 | "n64") |
| 899 | seccomp_audit_arch=AUDIT_ARCH_MIPS64 |
| 900 | ;; |
| 901 | esac |
Damien Miller | b9c5061 | 2016-07-08 13:59:13 +1000 | [diff] [blame] | 902 | ;; |
| 903 | mips64el-*) |
Vicente Olivert Riera | 4501151 | 2017-06-20 16:42:28 +0100 | [diff] [blame] | 904 | case "$mips_abi" in |
| 905 | "n32") |
| 906 | seccomp_audit_arch=AUDIT_ARCH_MIPSEL64N32 |
| 907 | ;; |
| 908 | "n64") |
| 909 | seccomp_audit_arch=AUDIT_ARCH_MIPSEL64 |
| 910 | ;; |
| 911 | esac |
Damien Miller | b9c5061 | 2016-07-08 13:59:13 +1000 | [diff] [blame] | 912 | ;; |
Damien Miller | e0956e3 | 2012-04-04 11:27:54 +1000 | [diff] [blame] | 913 | esac |
Damien Miller | 91f40d8 | 2013-02-22 11:37:00 +1100 | [diff] [blame] | 914 | if test "x$seccomp_audit_arch" != "x" ; then |
| 915 | AC_MSG_RESULT(["$seccomp_audit_arch"]) |
Damien Miller | 99f33d7 | 2015-06-17 10:50:51 +1000 | [diff] [blame] | 916 | AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch], |
| 917 | [Specify the system call convention in use]) |
Damien Miller | 91f40d8 | 2013-02-22 11:37:00 +1100 | [diff] [blame] | 918 | else |
| 919 | AC_MSG_RESULT([architecture not supported]) |
| 920 | fi |
Damien Miller | b29ea91 | 2000-01-15 14:12:03 +1100 | [diff] [blame] | 921 | ;; |
Ben Lindstrom | b562864 | 2000-10-18 00:02:25 +0000 | [diff] [blame] | 922 | mips-sony-bsd|mips-sony-newsos4) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 923 | AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty]) |
Ben Lindstrom | b562864 | 2000-10-18 00:02:25 +0000 | [diff] [blame] | 924 | SONY=1 |
Ben Lindstrom | b562864 | 2000-10-18 00:02:25 +0000 | [diff] [blame] | 925 | ;; |
Damien Miller | ee1c0b3 | 2000-01-21 00:18:15 +1100 | [diff] [blame] | 926 | *-*-netbsd*) |
Damien Miller | fc93d4b | 2002-09-04 23:26:29 +1000 | [diff] [blame] | 927 | check_for_libcrypt_before=1 |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 928 | if test "x$withval" != "xno" ; then |
Darren Tucker | 2f0bad2 | 2019-01-21 21:28:27 +1100 | [diff] [blame] | 929 | rpath_opt="-R" |
Tim Rice | 88368a3 | 2003-12-08 12:35:59 -0800 | [diff] [blame] | 930 | fi |
Damien Miller | 99522ba | 2016-07-28 08:54:27 +1000 | [diff] [blame] | 931 | CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 932 | AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way]) |
Damien Miller | 2dcddbf | 2006-01-01 19:47:05 +1100 | [diff] [blame] | 933 | AC_CHECK_HEADER([net/if_tap.h], , |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 934 | AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support])) |
| 935 | AC_DEFINE([SSH_TUN_PREPEND_AF], [1], |
Damien Miller | 2dcddbf | 2006-01-01 19:47:05 +1100 | [diff] [blame] | 936 | [Prepend the address family to IP tunnel traffic]) |
Darren Tucker | 882abfd | 2013-11-09 00:17:41 +1100 | [diff] [blame] | 937 | TEST_MALLOC_OPTIONS="AJRX" |
Damien Miller | f5bbd3b | 2014-01-30 11:26:46 +1100 | [diff] [blame] | 938 | AC_DEFINE([BROKEN_READ_COMPARISON], [1], |
| 939 | [NetBSD read function is sometimes redirected, breaking atomicio comparisons against it]) |
Damien Miller | ee1c0b3 | 2000-01-21 00:18:15 +1100 | [diff] [blame] | 940 | ;; |
Damien Miller | fbd884a | 2001-02-27 08:39:07 +1100 | [diff] [blame] | 941 | *-*-freebsd*) |
| 942 | check_for_libcrypt_later=1 |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 943 | AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)]) |
| 944 | AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way]) |
Damien Miller | 2dcddbf | 2006-01-01 19:47:05 +1100 | [diff] [blame] | 945 | AC_CHECK_HEADER([net/if_tap.h], , |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 946 | AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support])) |
| 947 | AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need]) |
Darren Tucker | 882abfd | 2013-11-09 00:17:41 +1100 | [diff] [blame] | 948 | TEST_MALLOC_OPTIONS="AJRX" |
Damien Miller | 2035b22 | 2014-01-26 09:39:53 +1100 | [diff] [blame] | 949 | # Preauth crypto occasionally uses file descriptors for crypto offload |
| 950 | # and will crash if they cannot be opened. |
Damien Miller | 5b447c0 | 2014-01-26 09:46:53 +1100 | [diff] [blame] | 951 | AC_DEFINE([SANDBOX_SKIP_RLIMIT_NOFILE], [1], |
Tim Rice | 03ae081 | 2014-02-21 09:09:34 -0800 | [diff] [blame] | 952 | [define if setrlimit RLIMIT_NOFILE breaks things]) |
Damien Miller | fbd884a | 2001-02-27 08:39:07 +1100 | [diff] [blame] | 953 | ;; |
Darren Tucker | ed9eb02 | 2003-09-22 11:18:47 +1000 | [diff] [blame] | 954 | *-*-bsdi*) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 955 | AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 956 | AC_DEFINE([BROKEN_SETREUID]) |
| 957 | AC_DEFINE([BROKEN_SETREGID]) |
Darren Tucker | ed9eb02 | 2003-09-22 11:18:47 +1000 | [diff] [blame] | 958 | ;; |
Damien Miller | 0f91b4e | 2000-06-18 15:43:25 +1000 | [diff] [blame] | 959 | *-next-*) |
Damien Miller | 0f91b4e | 2000-06-18 15:43:25 +1000 | [diff] [blame] | 960 | conf_lastlog_location="/usr/adm/lastlog" |
Damien Miller | e5192fa | 2000-08-29 14:30:37 +1100 | [diff] [blame] | 961 | conf_utmp_location=/etc/utmp |
| 962 | conf_wtmp_location=/usr/adm/wtmp |
Tim Rice | 90f42b0 | 2011-06-02 18:17:49 -0700 | [diff] [blame] | 963 | maildir=/usr/spool/mail |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 964 | AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 965 | AC_DEFINE([USE_PIPES]) |
| 966 | AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT]) |
Damien Miller | 0f91b4e | 2000-06-18 15:43:25 +1000 | [diff] [blame] | 967 | ;; |
Darren Tucker | 4a42257 | 2005-07-14 17:22:11 +1000 | [diff] [blame] | 968 | *-*-openbsd*) |
Damien Miller | 852472a | 2014-01-22 16:31:18 +1100 | [diff] [blame] | 969 | use_pie=auto |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 970 | AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel]) |
| 971 | AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded]) |
| 972 | AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way]) |
| 973 | AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1], |
Damien Miller | bb59814 | 2006-08-19 08:38:23 +1000 | [diff] [blame] | 974 | [syslog_r function is safe to use in in a signal handler]) |
Darren Tucker | 882abfd | 2013-11-09 00:17:41 +1100 | [diff] [blame] | 975 | TEST_MALLOC_OPTIONS="AFGJPRX" |
Darren Tucker | 4a42257 | 2005-07-14 17:22:11 +1000 | [diff] [blame] | 976 | ;; |
Damien Miller | 75b1d10 | 2000-01-07 14:01:41 +1100 | [diff] [blame] | 977 | *-*-solaris*) |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 978 | if test "x$withval" != "xno" ; then |
Darren Tucker | 2f0bad2 | 2019-01-21 21:28:27 +1100 | [diff] [blame] | 979 | rpath_opt="-R" |
Tim Rice | ad4a188 | 2004-02-29 15:53:37 -0800 | [diff] [blame] | 980 | fi |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 981 | AC_DEFINE([PAM_SUN_CODEBASE]) |
| 982 | AC_DEFINE([LOGIN_NEEDS_UTMPX]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 983 | AC_DEFINE([PAM_TTY_KLUDGE]) |
| 984 | AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 985 | [Define if pam_chauthtok wants real uid set |
| 986 | to the unpriv'ed user]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 987 | AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"]) |
Darren Tucker | c437cda | 2003-05-10 17:05:46 +1000 | [diff] [blame] | 988 | # Pushing STREAMS modules will cause sshd to acquire a controlling tty. |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 989 | AC_DEFINE([SSHD_ACQUIRES_CTTY], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 990 | [Define if sshd somehow reacquires a controlling TTY |
| 991 | after setsid()]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 992 | AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd |
Darren Tucker | 0249f93 | 2006-06-24 12:10:07 +1000 | [diff] [blame] | 993 | in case the name is longer than 8 chars]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 994 | AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang]) |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 995 | external_path_file=/etc/default/login |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 996 | # hardwire lastlog location (can't detect it on some versions) |
| 997 | conf_lastlog_location="/var/adm/lastlog" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 998 | AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x]) |
Damien Miller | a1cb644 | 2000-06-09 11:58:35 +1000 | [diff] [blame] | 999 | sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'` |
| 1000 | if test "$sol2ver" -ge 8; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1001 | AC_MSG_RESULT([yes]) |
| 1002 | AC_DEFINE([DISABLE_UTMP]) |
| 1003 | AC_DEFINE([DISABLE_WTMP], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 1004 | [Define if you don't want to use wtmp]) |
Damien Miller | a1cb644 | 2000-06-09 11:58:35 +1000 | [diff] [blame] | 1005 | else |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1006 | AC_MSG_RESULT([no]) |
Damien Miller | a1cb644 | 2000-06-09 11:58:35 +1000 | [diff] [blame] | 1007 | fi |
Darren Tucker | a86ec4d | 2016-06-14 10:48:27 +1000 | [diff] [blame] | 1008 | AC_CHECK_FUNCS([setpflags]) |
Darren Tucker | 907091a | 2016-02-19 09:05:39 +1100 | [diff] [blame] | 1009 | AC_CHECK_FUNCS([setppriv]) |
| 1010 | AC_CHECK_FUNCS([priv_basicset]) |
| 1011 | AC_CHECK_HEADERS([priv.h]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1012 | AC_ARG_WITH([solaris-contracts], |
Damien Miller | 1b06dc3 | 2006-08-31 03:24:41 +1000 | [diff] [blame] | 1013 | [ --with-solaris-contracts Enable Solaris process contracts (experimental)], |
| 1014 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1015 | AC_CHECK_LIB([contract], [ct_tmpl_activate], |
| 1016 | [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1], |
Damien Miller | 1b06dc3 | 2006-08-31 03:24:41 +1000 | [diff] [blame] | 1017 | [Define if you have Solaris process contracts]) |
Damien Miller | 4626cba | 2016-01-08 14:24:56 +1100 | [diff] [blame] | 1018 | LIBS="$LIBS -lcontract" |
Damien Miller | 1b06dc3 | 2006-08-31 03:24:41 +1000 | [diff] [blame] | 1019 | SPC_MSG="yes" ], ) |
| 1020 | ], |
| 1021 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1022 | AC_ARG_WITH([solaris-projects], |
Darren Tucker | 9752835 | 2010-11-05 12:03:05 +1100 | [diff] [blame] | 1023 | [ --with-solaris-projects Enable Solaris projects (experimental)], |
| 1024 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1025 | AC_CHECK_LIB([project], [setproject], |
| 1026 | [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1], |
Darren Tucker | 9752835 | 2010-11-05 12:03:05 +1100 | [diff] [blame] | 1027 | [Define if you have Solaris projects]) |
Damien Miller | 4626cba | 2016-01-08 14:24:56 +1100 | [diff] [blame] | 1028 | LIBS="$LIBS -lproject" |
Darren Tucker | 9752835 | 2010-11-05 12:03:05 +1100 | [diff] [blame] | 1029 | SP_MSG="yes" ], ) |
| 1030 | ], |
| 1031 | ) |
Damien Miller | 4626cba | 2016-01-08 14:24:56 +1100 | [diff] [blame] | 1032 | AC_ARG_WITH([solaris-privs], |
| 1033 | [ --with-solaris-privs Enable Solaris/Illumos privileges (experimental)], |
| 1034 | [ |
| 1035 | AC_MSG_CHECKING([for Solaris/Illumos privilege support]) |
Darren Tucker | 907091a | 2016-02-19 09:05:39 +1100 | [diff] [blame] | 1036 | if test "x$ac_cv_func_setppriv" = "xyes" -a \ |
| 1037 | "x$ac_cv_header_priv_h" = "xyes" ; then |
| 1038 | SOLARIS_PRIVS=yes |
Damien Miller | 4626cba | 2016-01-08 14:24:56 +1100 | [diff] [blame] | 1039 | AC_MSG_RESULT([found]) |
| 1040 | AC_DEFINE([NO_UID_RESTORATION_TEST], [1], |
| 1041 | [Define to disable UID restoration test]) |
| 1042 | AC_DEFINE([USE_SOLARIS_PRIVS], [1], |
| 1043 | [Define if you have Solaris privileges]) |
| 1044 | SPP_MSG="yes" |
| 1045 | else |
| 1046 | AC_MSG_RESULT([not found]) |
| 1047 | AC_MSG_ERROR([*** must have support for Solaris privileges to use --with-solaris-privs]) |
| 1048 | fi |
| 1049 | ], |
| 1050 | ) |
Tim Rice | 5ab9b63 | 2013-06-02 14:05:48 -0700 | [diff] [blame] | 1051 | TEST_SHELL=$SHELL # let configure find us a capable shell |
Damien Miller | 75b1d10 | 2000-01-07 14:01:41 +1100 | [diff] [blame] | 1052 | ;; |
Damien Miller | dfc83f4 | 2000-05-20 15:02:59 +1000 | [diff] [blame] | 1053 | *-*-sunos4*) |
Ben Lindstrom | 28bfc0d | 2000-12-18 19:58:57 +0000 | [diff] [blame] | 1054 | CPPFLAGS="$CPPFLAGS -DSUNOS4" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1055 | AC_CHECK_FUNCS([getpwanam]) |
| 1056 | AC_DEFINE([PAM_SUN_CODEBASE]) |
Damien Miller | 36ccb5c | 2000-08-09 16:34:27 +1000 | [diff] [blame] | 1057 | conf_utmp_location=/etc/utmp |
| 1058 | conf_wtmp_location=/var/adm/wtmp |
| 1059 | conf_lastlog_location=/var/adm/lastlog |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1060 | AC_DEFINE([USE_PIPES]) |
Darren Tucker | c0a0c3f | 2018-03-05 20:03:07 +1100 | [diff] [blame] | 1061 | AC_DEFINE([DISABLE_UTMPX], [1], [no utmpx]) |
Damien Miller | dfc83f4 | 2000-05-20 15:02:59 +1000 | [diff] [blame] | 1062 | ;; |
Ben Lindstrom | 603bdfd | 2001-02-12 07:29:45 +0000 | [diff] [blame] | 1063 | *-ncr-sysv*) |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 1064 | LIBS="$LIBS -lc89" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1065 | AC_DEFINE([USE_PIPES]) |
| 1066 | AC_DEFINE([SSHD_ACQUIRES_CTTY]) |
| 1067 | AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1068 | AC_DEFINE([BROKEN_SETREUID]) |
| 1069 | AC_DEFINE([BROKEN_SETREGID]) |
Ben Lindstrom | 603bdfd | 2001-02-12 07:29:45 +0000 | [diff] [blame] | 1070 | ;; |
Damien Miller | 2ae714f | 2000-07-11 09:29:50 +1000 | [diff] [blame] | 1071 | *-sni-sysv*) |
Tim Rice | ffdf4aa | 2001-10-27 10:45:36 -0700 | [diff] [blame] | 1072 | # /usr/ucblib MUST NOT be searched on ReliantUNIX |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1073 | AC_CHECK_LIB([dl], [dlsym], ,) |
Darren Tucker | 79d09fa | 2005-11-24 22:34:54 +1100 | [diff] [blame] | 1074 | # -lresolv needs to be at the end of LIBS or DNS lookups break |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1075 | AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ]) |
Damien Miller | fd9885e | 2001-01-10 08:16:53 +1100 | [diff] [blame] | 1076 | IPADDR_IN_DISPLAY=yes |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1077 | AC_DEFINE([USE_PIPES]) |
| 1078 | AC_DEFINE([IP_TOS_IS_BROKEN]) |
| 1079 | AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1080 | AC_DEFINE([BROKEN_SETREUID]) |
| 1081 | AC_DEFINE([BROKEN_SETREGID]) |
| 1082 | AC_DEFINE([SSHD_ACQUIRES_CTTY]) |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 1083 | external_path_file=/etc/default/login |
Tim Rice | ffdf4aa | 2001-10-27 10:45:36 -0700 | [diff] [blame] | 1084 | # /usr/ucblib/libucb.a no longer needed on ReliantUNIX |
| 1085 | # Attention: always take care to bind libsocket and libnsl before libc, |
| 1086 | # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog |
Damien Miller | 2ae714f | 2000-07-11 09:29:50 +1000 | [diff] [blame] | 1087 | ;; |
Tim Rice | 0f83d29 | 2004-12-08 18:29:58 -0800 | [diff] [blame] | 1088 | # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel. |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 1089 | *-*-sysv4.2*) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1090 | AC_DEFINE([USE_PIPES]) |
| 1091 | AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1092 | AC_DEFINE([BROKEN_SETREUID]) |
| 1093 | AC_DEFINE([BROKEN_SETREGID]) |
| 1094 | AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd]) |
| 1095 | AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"]) |
Tim Rice | 5ab9b63 | 2013-06-02 14:05:48 -0700 | [diff] [blame] | 1096 | TEST_SHELL=$SHELL # let configure find us a capable shell |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 1097 | ;; |
Tim Rice | 0f83d29 | 2004-12-08 18:29:58 -0800 | [diff] [blame] | 1098 | # UnixWare 7.x, OpenUNIX 8 |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 1099 | *-*-sysv5*) |
Tim Rice | 641ebf1 | 2010-01-17 17:05:39 -0800 | [diff] [blame] | 1100 | CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1101 | AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars]) |
| 1102 | AC_DEFINE([USE_PIPES]) |
| 1103 | AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1104 | AC_DEFINE([BROKEN_GETADDRINFO]) |
| 1105 | AC_DEFINE([BROKEN_SETREUID]) |
| 1106 | AC_DEFINE([BROKEN_SETREGID]) |
| 1107 | AC_DEFINE([PASSWD_NEEDS_USERNAME]) |
Tim Rice | 8433d51 | 2017-07-11 18:47:56 -0700 | [diff] [blame] | 1108 | AC_DEFINE([BROKEN_TCGETATTR_ICANON]) |
Tim Rice | 5ab9b63 | 2013-06-02 14:05:48 -0700 | [diff] [blame] | 1109 | TEST_SHELL=$SHELL # let configure find us a capable shell |
Tim Rice | 4afeaf3 | 2018-03-25 10:00:21 -0700 | [diff] [blame] | 1110 | check_for_libcrypt_later=1 |
Tim Rice | 4dbacff | 2005-06-01 20:09:28 -0700 | [diff] [blame] | 1111 | case "$host" in |
| 1112 | *-*-sysv5SCO_SV*) # SCO OpenServer 6.x |
Tim Rice | 90f42b0 | 2011-06-02 18:17:49 -0700 | [diff] [blame] | 1113 | maildir=/var/spool/mail |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1114 | AC_DEFINE([BROKEN_UPDWTMPX]) |
| 1115 | AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot" |
| 1116 | AC_CHECK_FUNCS([getluid setluid], , , [-lprot]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1117 | ], , ) |
Tim Rice | 4dbacff | 2005-06-01 20:09:28 -0700 | [diff] [blame] | 1118 | ;; |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1119 | *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"]) |
Tim Rice | 46259d8 | 2005-11-28 18:40:34 -0800 | [diff] [blame] | 1120 | ;; |
Tim Rice | 4dbacff | 2005-06-01 20:09:28 -0700 | [diff] [blame] | 1121 | esac |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 1122 | ;; |
Damien Miller | 75b1d10 | 2000-01-07 14:01:41 +1100 | [diff] [blame] | 1123 | *-*-sysv*) |
Damien Miller | 75b1d10 | 2000-01-07 14:01:41 +1100 | [diff] [blame] | 1124 | ;; |
Tim Rice | 0f83d29 | 2004-12-08 18:29:58 -0800 | [diff] [blame] | 1125 | # SCO UNIX and OEM versions of SCO UNIX |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 1126 | *-*-sco3.2v4*) |
Tim Rice | c390c8d | 2005-03-07 01:21:37 -0800 | [diff] [blame] | 1127 | AC_MSG_ERROR("This Platform is no longer supported.") |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 1128 | ;; |
Tim Rice | 0f83d29 | 2004-12-08 18:29:58 -0800 | [diff] [blame] | 1129 | # SCO OpenServer 5.x |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 1130 | *-*-sco3.2v5*) |
Tim Rice | 89fe3f3 | 2003-01-19 20:20:24 -0800 | [diff] [blame] | 1131 | if test -z "$GCC"; then |
| 1132 | CFLAGS="$CFLAGS -belf" |
| 1133 | fi |
Damien Miller | 5dfe976 | 2001-02-16 12:05:39 +1100 | [diff] [blame] | 1134 | LIBS="$LIBS -lprot -lx -ltinfo -lm" |
Damien Miller | a66626b | 2000-06-13 18:57:53 +1000 | [diff] [blame] | 1135 | no_dev_ptmx=1 |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1136 | AC_DEFINE([USE_PIPES]) |
| 1137 | AC_DEFINE([HAVE_SECUREWARE]) |
| 1138 | AC_DEFINE([DISABLE_SHADOW]) |
| 1139 | AC_DEFINE([DISABLE_FD_PASSING]) |
| 1140 | AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1141 | AC_DEFINE([BROKEN_GETADDRINFO]) |
| 1142 | AC_DEFINE([BROKEN_SETREUID]) |
| 1143 | AC_DEFINE([BROKEN_SETREGID]) |
| 1144 | AC_DEFINE([WITH_ABBREV_NO_TTY]) |
| 1145 | AC_DEFINE([BROKEN_UPDWTMPX]) |
| 1146 | AC_DEFINE([PASSWD_NEEDS_USERNAME]) |
| 1147 | AC_CHECK_FUNCS([getluid setluid]) |
Tim Rice | 07183b8 | 2001-04-25 21:40:28 -0700 | [diff] [blame] | 1148 | MANTYPE=man |
Tim Rice | 5ab9b63 | 2013-06-02 14:05:48 -0700 | [diff] [blame] | 1149 | TEST_SHELL=$SHELL # let configure find us a capable shell |
Tim Rice | aa86c39 | 2013-03-16 20:55:46 -0700 | [diff] [blame] | 1150 | SKIP_DISABLE_LASTLOG_DEFINE=yes |
Damien Miller | a66626b | 2000-06-13 18:57:53 +1000 | [diff] [blame] | 1151 | ;; |
Damien Miller | b8c656e | 2000-06-28 15:22:41 +1000 | [diff] [blame] | 1152 | *-dec-osf*) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1153 | AC_MSG_CHECKING([for Digital Unix SIA]) |
Ben Lindstrom | 72af2ef | 2001-05-08 20:42:28 +0000 | [diff] [blame] | 1154 | no_osfsia="" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1155 | AC_ARG_WITH([osfsia], |
Ben Lindstrom | 72af2ef | 2001-05-08 20:42:28 +0000 | [diff] [blame] | 1156 | [ --with-osfsia Enable Digital Unix SIA], |
| 1157 | [ |
| 1158 | if test "x$withval" = "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1159 | AC_MSG_RESULT([disabled]) |
Ben Lindstrom | 72af2ef | 2001-05-08 20:42:28 +0000 | [diff] [blame] | 1160 | no_osfsia=1 |
| 1161 | fi |
| 1162 | ], |
| 1163 | ) |
| 1164 | if test -z "$no_osfsia" ; then |
Damien Miller | b8c656e | 2000-06-28 15:22:41 +1000 | [diff] [blame] | 1165 | if test -f /etc/sia/matrix.conf; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1166 | AC_MSG_RESULT([yes]) |
| 1167 | AC_DEFINE([HAVE_OSF_SIA], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 1168 | [Define if you have Digital Unix Security |
| 1169 | Integration Architecture]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1170 | AC_DEFINE([DISABLE_LOGIN], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 1171 | [Define if you don't want to use your |
| 1172 | system's login() call]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1173 | AC_DEFINE([DISABLE_FD_PASSING]) |
Damien Miller | b8c656e | 2000-06-28 15:22:41 +1000 | [diff] [blame] | 1174 | LIBS="$LIBS -lsecurity -ldb -lm -laud" |
Damien Miller | 1b06dc3 | 2006-08-31 03:24:41 +1000 | [diff] [blame] | 1175 | SIA_MSG="yes" |
Damien Miller | b8c656e | 2000-06-28 15:22:41 +1000 | [diff] [blame] | 1176 | else |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1177 | AC_MSG_RESULT([no]) |
| 1178 | AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 1179 | [String used in /etc/passwd to denote locked account]) |
Damien Miller | b8c656e | 2000-06-28 15:22:41 +1000 | [diff] [blame] | 1180 | fi |
| 1181 | fi |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1182 | AC_DEFINE([BROKEN_GETADDRINFO]) |
| 1183 | AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1184 | AC_DEFINE([BROKEN_SETREUID]) |
| 1185 | AC_DEFINE([BROKEN_SETREGID]) |
| 1186 | AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv]) |
Damien Miller | b8c656e | 2000-06-28 15:22:41 +1000 | [diff] [blame] | 1187 | ;; |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 1188 | |
Tim Rice | 70335a6 | 2006-02-04 17:42:58 -0800 | [diff] [blame] | 1189 | *-*-nto-qnx*) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1190 | AC_DEFINE([USE_PIPES]) |
| 1191 | AC_DEFINE([NO_X11_UNIX_SOCKETS]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1192 | AC_DEFINE([DISABLE_LASTLOG]) |
| 1193 | AC_DEFINE([SSHD_ACQUIRES_CTTY]) |
| 1194 | AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken]) |
Tim Rice | 2f99346 | 2006-02-11 18:37:48 -0800 | [diff] [blame] | 1195 | enable_etc_default_login=no # has incompatible /etc/default/login |
Darren Tucker | 8acb3b6 | 2007-08-10 14:36:12 +1000 | [diff] [blame] | 1196 | case "$host" in |
| 1197 | *-*-nto-qnx6*) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1198 | AC_DEFINE([DISABLE_FD_PASSING]) |
Darren Tucker | 8acb3b6 | 2007-08-10 14:36:12 +1000 | [diff] [blame] | 1199 | ;; |
| 1200 | esac |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 1201 | ;; |
Darren Tucker | 2be1cbb | 2005-05-27 21:13:40 +1000 | [diff] [blame] | 1202 | |
| 1203 | *-*-ultrix*) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1204 | AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1]) |
Darren Tucker | 9cac151 | 2019-11-01 18:26:07 +1100 | [diff] [blame] | 1205 | AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to for controlling tty]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1206 | AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix]) |
Darren Tucker | 9cac151 | 2019-11-01 18:26:07 +1100 | [diff] [blame] | 1207 | AC_DEFINE([DISABLE_UTMPX], [1], [Disable utmpx]) |
| 1208 | # DISABLE_FD_PASSING so that we call setpgrp as root, otherwise we |
| 1209 | # don't get a controlling tty. |
| 1210 | AC_DEFINE([DISABLE_FD_PASSING], [1], [Need to call setpgrp as root]) |
Darren Tucker | 39b8710 | 2019-11-15 18:56:54 +1100 | [diff] [blame] | 1211 | # On Ultrix some headers are not protected against multiple includes, |
| 1212 | # so we create wrappers and put it where the compiler will find it. |
| 1213 | AC_MSG_WARN([creating compat wrappers for headers]) |
Darren Tucker | 9cac151 | 2019-11-01 18:26:07 +1100 | [diff] [blame] | 1214 | mkdir -p netinet |
Darren Tucker | 39b8710 | 2019-11-15 18:56:54 +1100 | [diff] [blame] | 1215 | for header in netinet/ip.h netdb.h resolv.h; do |
| 1216 | name=`echo $header | tr 'a-z/.' 'A-Z__'` |
| 1217 | cat >$header <<EOD |
| 1218 | #ifndef _SSH_COMPAT_${name} |
| 1219 | #define _SSH_COMPAT_${name} |
| 1220 | #include "/usr/include/${header}" |
Darren Tucker | 9cac151 | 2019-11-01 18:26:07 +1100 | [diff] [blame] | 1221 | #endif |
| 1222 | EOD |
Darren Tucker | 39b8710 | 2019-11-15 18:56:54 +1100 | [diff] [blame] | 1223 | done |
Tim Rice | fcc7ff1 | 2005-06-02 20:28:29 -0700 | [diff] [blame] | 1224 | ;; |
Darren Tucker | 93e7e8f | 2005-08-23 08:06:55 +1000 | [diff] [blame] | 1225 | |
| 1226 | *-*-lynxos) |
Darren Tucker | 5faa52d | 2016-08-02 15:22:40 +1000 | [diff] [blame] | 1227 | CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__" |
| 1228 | AC_DEFINE([BROKEN_SETVBUF], [1], |
| 1229 | [LynxOS has broken setvbuf() implementation]) |
| 1230 | ;; |
Damien Miller | 76112de | 1999-12-21 11:18:08 +1100 | [diff] [blame] | 1231 | esac |
| 1232 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1233 | AC_MSG_CHECKING([compiler and flags for sanity]) |
| 1234 | AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])], |
| 1235 | [ AC_MSG_RESULT([yes]) ], |
Darren Tucker | 6eb9304 | 2003-06-29 21:30:41 +1000 | [diff] [blame] | 1236 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1237 | AC_MSG_RESULT([no]) |
Darren Tucker | 6eb9304 | 2003-06-29 21:30:41 +1000 | [diff] [blame] | 1238 | AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***]) |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 1239 | ], |
| 1240 | [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ] |
Darren Tucker | 6eb9304 | 2003-06-29 21:30:41 +1000 | [diff] [blame] | 1241 | ) |
| 1242 | |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1243 | dnl Checks for header files. |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 1244 | # Checks for libraries. |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1245 | AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])]) |
Ben Lindstrom | 3ad650a | 2001-01-03 06:02:51 +0000 | [diff] [blame] | 1246 | |
Tim Rice | 1e1ef64 | 2003-09-11 22:19:31 -0700 | [diff] [blame] | 1247 | dnl IRIX and Solaris 2.5.1 have dirname() in libgen |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1248 | AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [ |
| 1249 | AC_CHECK_LIB([gen], [dirname], [ |
Tim Rice | 1e1ef64 | 2003-09-11 22:19:31 -0700 | [diff] [blame] | 1250 | AC_CACHE_CHECK([for broken dirname], |
| 1251 | ac_cv_have_broken_dirname, [ |
| 1252 | save_LIBS="$LIBS" |
| 1253 | LIBS="$LIBS -lgen" |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 1254 | AC_RUN_IFELSE( |
| 1255 | [AC_LANG_SOURCE([[ |
Tim Rice | 1e1ef64 | 2003-09-11 22:19:31 -0700 | [diff] [blame] | 1256 | #include <libgen.h> |
| 1257 | #include <string.h> |
| 1258 | |
| 1259 | int main(int argc, char **argv) { |
| 1260 | char *s, buf[32]; |
| 1261 | |
| 1262 | strncpy(buf,"/etc", 32); |
| 1263 | s = dirname(buf); |
| 1264 | if (!s || strncmp(s, "/", 32) != 0) { |
| 1265 | exit(1); |
| 1266 | } else { |
| 1267 | exit(0); |
| 1268 | } |
| 1269 | } |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 1270 | ]])], |
Tim Rice | 1e1ef64 | 2003-09-11 22:19:31 -0700 | [diff] [blame] | 1271 | [ ac_cv_have_broken_dirname="no" ], |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 1272 | [ ac_cv_have_broken_dirname="yes" ], |
| 1273 | [ ac_cv_have_broken_dirname="no" ], |
Tim Rice | 1e1ef64 | 2003-09-11 22:19:31 -0700 | [diff] [blame] | 1274 | ) |
| 1275 | LIBS="$save_LIBS" |
| 1276 | ]) |
| 1277 | if test "x$ac_cv_have_broken_dirname" = "xno" ; then |
| 1278 | LIBS="$LIBS -lgen" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1279 | AC_DEFINE([HAVE_DIRNAME]) |
| 1280 | AC_CHECK_HEADERS([libgen.h]) |
Tim Rice | 1e1ef64 | 2003-09-11 22:19:31 -0700 | [diff] [blame] | 1281 | fi |
| 1282 | ]) |
| 1283 | ]) |
| 1284 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1285 | AC_CHECK_FUNC([getspnam], , |
| 1286 | [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])]) |
| 1287 | AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1], |
| 1288 | [Define if you have the basename function.])]) |
Tim Rice | 1e1ef64 | 2003-09-11 22:19:31 -0700 | [diff] [blame] | 1289 | |
Darren Tucker | 633a2af | 2020-01-23 22:16:51 +1100 | [diff] [blame] | 1290 | dnl zlib defaults to enabled |
| 1291 | zlib=yes |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1292 | AC_ARG_WITH([zlib], |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 1293 | [ --with-zlib=PATH Use zlib in PATH], |
Darren Tucker | 86a5f8d | 2005-03-21 09:55:17 +1100 | [diff] [blame] | 1294 | [ if test "x$withval" = "xno" ; then |
Darren Tucker | 633a2af | 2020-01-23 22:16:51 +1100 | [diff] [blame] | 1295 | zlib=no |
Darren Tucker | 86a5f8d | 2005-03-21 09:55:17 +1100 | [diff] [blame] | 1296 | elif test "x$withval" != "xyes"; then |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 1297 | if test -d "$withval/lib"; then |
Darren Tucker | 2f0bad2 | 2019-01-21 21:28:27 +1100 | [diff] [blame] | 1298 | if test -n "${rpath_opt}"; then |
| 1299 | LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}" |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 1300 | else |
Tim Rice | 02cebcd | 2001-10-25 10:01:30 -0700 | [diff] [blame] | 1301 | LDFLAGS="-L${withval}/lib ${LDFLAGS}" |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 1302 | fi |
| 1303 | else |
Darren Tucker | 2f0bad2 | 2019-01-21 21:28:27 +1100 | [diff] [blame] | 1304 | if test -n "${rpath_opt}"; then |
| 1305 | LDFLAGS="-L${withval} ${rpath_opt}${withval} ${LDFLAGS}" |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 1306 | else |
Tim Rice | 02cebcd | 2001-10-25 10:01:30 -0700 | [diff] [blame] | 1307 | LDFLAGS="-L${withval} ${LDFLAGS}" |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 1308 | fi |
| 1309 | fi |
| 1310 | if test -d "$withval/include"; then |
Tim Rice | 02cebcd | 2001-10-25 10:01:30 -0700 | [diff] [blame] | 1311 | CPPFLAGS="-I${withval}/include ${CPPFLAGS}" |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 1312 | else |
Tim Rice | 02cebcd | 2001-10-25 10:01:30 -0700 | [diff] [blame] | 1313 | CPPFLAGS="-I${withval} ${CPPFLAGS}" |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 1314 | fi |
Darren Tucker | 86a5f8d | 2005-03-21 09:55:17 +1100 | [diff] [blame] | 1315 | fi ] |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 1316 | ) |
| 1317 | |
Darren Tucker | 633a2af | 2020-01-23 22:16:51 +1100 | [diff] [blame] | 1318 | AC_MSG_CHECKING([for zlib]) |
| 1319 | if test "x${zlib}" = "xno"; then |
| 1320 | AC_MSG_RESULT([no]) |
| 1321 | else |
| 1322 | AC_MSG_RESULT([yes]) |
| 1323 | AC_DEFINE([WITH_ZLIB], [1], [Enable zlib]) |
| 1324 | AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])]) |
| 1325 | AC_CHECK_LIB([z], [deflate], , |
Tim Rice | fcb6220 | 2004-01-23 18:35:16 -0800 | [diff] [blame] | 1326 | [ |
| 1327 | saved_CPPFLAGS="$CPPFLAGS" |
| 1328 | saved_LDFLAGS="$LDFLAGS" |
| 1329 | save_LIBS="$LIBS" |
| 1330 | dnl Check default zlib install dir |
Darren Tucker | 2f0bad2 | 2019-01-21 21:28:27 +1100 | [diff] [blame] | 1331 | if test -n "${rpath_opt}"; then |
| 1332 | LDFLAGS="-L/usr/local/lib ${rpath_opt}/usr/local/lib ${saved_LDFLAGS}" |
Tim Rice | fcb6220 | 2004-01-23 18:35:16 -0800 | [diff] [blame] | 1333 | else |
| 1334 | LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}" |
| 1335 | fi |
| 1336 | CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}" |
| 1337 | LIBS="$LIBS -lz" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1338 | AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])], |
Tim Rice | fcb6220 | 2004-01-23 18:35:16 -0800 | [diff] [blame] | 1339 | [ |
| 1340 | AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]) |
| 1341 | ] |
| 1342 | ) |
| 1343 | ] |
Darren Tucker | 633a2af | 2020-01-23 22:16:51 +1100 | [diff] [blame] | 1344 | ) |
Darren Tucker | dcc736b | 2004-01-30 14:20:59 +1100 | [diff] [blame] | 1345 | |
Darren Tucker | 633a2af | 2020-01-23 22:16:51 +1100 | [diff] [blame] | 1346 | AC_ARG_WITH([zlib-version-check], |
Darren Tucker | dcc736b | 2004-01-30 14:20:59 +1100 | [diff] [blame] | 1347 | [ --without-zlib-version-check Disable zlib version check], |
| 1348 | [ if test "x$withval" = "xno" ; then |
| 1349 | zlib_check_nonfatal=1 |
| 1350 | fi |
| 1351 | ] |
Darren Tucker | 633a2af | 2020-01-23 22:16:51 +1100 | [diff] [blame] | 1352 | ) |
Darren Tucker | dcc736b | 2004-01-30 14:20:59 +1100 | [diff] [blame] | 1353 | |
Darren Tucker | 633a2af | 2020-01-23 22:16:51 +1100 | [diff] [blame] | 1354 | AC_MSG_CHECKING([for possibly buggy zlib]) |
| 1355 | AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
Darren Tucker | 2f0b5c4 | 2005-04-24 17:52:22 +1000 | [diff] [blame] | 1356 | #include <stdio.h> |
Darren Tucker | c8a0f27 | 2013-03-22 12:49:14 +1100 | [diff] [blame] | 1357 | #include <stdlib.h> |
Darren Tucker | 2dcd239 | 2004-01-23 17:13:33 +1100 | [diff] [blame] | 1358 | #include <zlib.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1359 | ]], |
| 1360 | [[ |
Darren Tucker | 2f0b5c4 | 2005-04-24 17:52:22 +1000 | [diff] [blame] | 1361 | int a=0, b=0, c=0, d=0, n, v; |
| 1362 | n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d); |
| 1363 | if (n != 3 && n != 4) |
Darren Tucker | 2dcd239 | 2004-01-23 17:13:33 +1100 | [diff] [blame] | 1364 | exit(1); |
Darren Tucker | 2f0b5c4 | 2005-04-24 17:52:22 +1000 | [diff] [blame] | 1365 | v = a*1000000 + b*10000 + c*100 + d; |
| 1366 | fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v); |
| 1367 | |
| 1368 | /* 1.1.4 is OK */ |
| 1369 | if (a == 1 && b == 1 && c >= 4) |
Darren Tucker | 2dcd239 | 2004-01-23 17:13:33 +1100 | [diff] [blame] | 1370 | exit(0); |
Darren Tucker | 2f0b5c4 | 2005-04-24 17:52:22 +1000 | [diff] [blame] | 1371 | |
Darren Tucker | 41097ed | 2005-07-25 15:24:21 +1000 | [diff] [blame] | 1372 | /* 1.2.3 and up are OK */ |
| 1373 | if (v >= 1020300) |
Darren Tucker | 2f0b5c4 | 2005-04-24 17:52:22 +1000 | [diff] [blame] | 1374 | exit(0); |
| 1375 | |
Darren Tucker | 2dcd239 | 2004-01-23 17:13:33 +1100 | [diff] [blame] | 1376 | exit(2); |
Darren Tucker | 623d92f | 2004-09-12 22:36:15 +1000 | [diff] [blame] | 1377 | ]])], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1378 | AC_MSG_RESULT([no]), |
| 1379 | [ AC_MSG_RESULT([yes]) |
Darren Tucker | dcc736b | 2004-01-30 14:20:59 +1100 | [diff] [blame] | 1380 | if test -z "$zlib_check_nonfatal" ; then |
| 1381 | AC_MSG_ERROR([*** zlib too old - check config.log *** |
| 1382 | Your reported zlib version has known security problems. It's possible your |
| 1383 | vendor has fixed these problems without changing the version number. If you |
| 1384 | are sure this is the case, you can disable the check by running |
| 1385 | "./configure --without-zlib-version-check". |
Darren Tucker | ac1910f | 2005-07-26 12:00:42 +1000 | [diff] [blame] | 1386 | If you are in doubt, upgrade zlib to version 1.2.3 or greater. |
Darren Tucker | 2f0b5c4 | 2005-04-24 17:52:22 +1000 | [diff] [blame] | 1387 | See http://www.gzip.org/zlib/ for details.]) |
Darren Tucker | dcc736b | 2004-01-30 14:20:59 +1100 | [diff] [blame] | 1388 | else |
| 1389 | AC_MSG_WARN([zlib version may have security problems]) |
| 1390 | fi |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 1391 | ], |
| 1392 | [ AC_MSG_WARN([cross compiling: not checking zlib version]) ] |
Darren Tucker | 633a2af | 2020-01-23 22:16:51 +1100 | [diff] [blame] | 1393 | ) |
| 1394 | fi |
Damien Miller | 6f9c337 | 2000-10-25 10:06:04 +1100 | [diff] [blame] | 1395 | |
Ben Lindstrom | 3ad650a | 2001-01-03 06:02:51 +0000 | [diff] [blame] | 1396 | dnl UnixWare 2.x |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1397 | AC_CHECK_FUNC([strcasecmp], |
| 1398 | [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ] |
Ben Lindstrom | 3ad650a | 2001-01-03 06:02:51 +0000 | [diff] [blame] | 1399 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1400 | AC_CHECK_FUNCS([utimes], |
| 1401 | [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES]) |
Tim Rice | cbb9066 | 2002-07-08 19:17:10 -0700 | [diff] [blame] | 1402 | LIBS="$LIBS -lc89"]) ] |
Ben Lindstrom | 3ad650a | 2001-01-03 06:02:51 +0000 | [diff] [blame] | 1403 | ) |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 1404 | |
Tim Rice | e589a29 | 2001-11-03 11:09:32 -0800 | [diff] [blame] | 1405 | dnl Checks for libutil functions |
Damien Miller | b87f6b7 | 2013-02-23 09:12:23 +1100 | [diff] [blame] | 1406 | AC_CHECK_HEADERS([bsd/libutil.h libutil.h]) |
Damien Miller | 398c0ff | 2012-04-19 21:46:35 +1000 | [diff] [blame] | 1407 | AC_SEARCH_LIBS([fmt_scaled], [util bsd]) |
Darren Tucker | e194ba4 | 2013-05-16 20:47:31 +1000 | [diff] [blame] | 1408 | AC_SEARCH_LIBS([scan_scaled], [util bsd]) |
Damien Miller | 398c0ff | 2012-04-19 21:46:35 +1000 | [diff] [blame] | 1409 | AC_SEARCH_LIBS([login], [util bsd]) |
| 1410 | AC_SEARCH_LIBS([logout], [util bsd]) |
| 1411 | AC_SEARCH_LIBS([logwtmp], [util bsd]) |
| 1412 | AC_SEARCH_LIBS([openpty], [util bsd]) |
| 1413 | AC_SEARCH_LIBS([updwtmp], [util bsd]) |
Darren Tucker | e194ba4 | 2013-05-16 20:47:31 +1000 | [diff] [blame] | 1414 | AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp]) |
Tim Rice | e589a29 | 2001-11-03 11:09:32 -0800 | [diff] [blame] | 1415 | |
Darren Tucker | 2fee909 | 2016-02-17 09:48:15 +1100 | [diff] [blame] | 1416 | # On some platforms, inet_ntop and gethostbyname may be found in libresolv |
| 1417 | # or libnsl. |
Damien Miller | ab03949 | 2014-01-28 15:07:10 +1100 | [diff] [blame] | 1418 | AC_SEARCH_LIBS([inet_ntop], [resolv nsl]) |
Darren Tucker | 2fee909 | 2016-02-17 09:48:15 +1100 | [diff] [blame] | 1419 | AC_SEARCH_LIBS([gethostbyname], [resolv nsl]) |
Damien Miller | ab03949 | 2014-01-28 15:07:10 +1100 | [diff] [blame] | 1420 | |
Darren Tucker | 74c1c36 | 2017-09-27 07:44:41 +1000 | [diff] [blame] | 1421 | # "Particular Function Checks" |
| 1422 | # see https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Functions.html |
Ben Lindstrom | 8697e08 | 2001-02-24 21:41:10 +0000 | [diff] [blame] | 1423 | AC_FUNC_STRFTIME |
Darren Tucker | 74c1c36 | 2017-09-27 07:44:41 +1000 | [diff] [blame] | 1424 | AC_FUNC_MALLOC |
| 1425 | AC_FUNC_REALLOC |
| 1426 | # autoconf doesn't have AC_FUNC_CALLOC so fake it if malloc returns NULL; |
Darren Tucker | e9dede0 | 2018-02-25 10:20:31 +1100 | [diff] [blame] | 1427 | AC_MSG_CHECKING([if calloc(0, N) returns non-null]) |
| 1428 | AC_RUN_IFELSE( |
| 1429 | [AC_LANG_PROGRAM( |
| 1430 | [[ #include <stdlib.h> ]], |
| 1431 | [[ void *p = calloc(0, 1); exit(p == NULL); ]] |
| 1432 | )], |
| 1433 | [ func_calloc_0_nonnull=yes ], |
| 1434 | [ func_calloc_0_nonnull=no ], |
| 1435 | [ AC_MSG_WARN([cross compiling: assuming same as malloc]) |
| 1436 | func_calloc_0_nonnull="$ac_cv_func_malloc_0_nonnull"] |
| 1437 | ) |
| 1438 | AC_MSG_RESULT([$func_calloc_0_nonnull]) |
| 1439 | |
Darren Tucker | d97874c | 2018-04-13 13:43:55 +1000 | [diff] [blame] | 1440 | if test "x$func_calloc_0_nonnull" = "xyes"; then |
Darren Tucker | e9dede0 | 2018-02-25 10:20:31 +1100 | [diff] [blame] | 1441 | AC_DEFINE(HAVE_CALLOC, 1, [calloc(0, x) returns non-null]) |
| 1442 | else |
| 1443 | AC_DEFINE(HAVE_CALLOC, 0, [calloc(0, x) returns NULL]) |
Darren Tucker | 74c1c36 | 2017-09-27 07:44:41 +1000 | [diff] [blame] | 1444 | AC_DEFINE(calloc, rpl_calloc, |
| 1445 | [Define to rpl_calloc if the replacement function should be used.]) |
| 1446 | fi |
Ben Lindstrom | 8697e08 | 2001-02-24 21:41:10 +0000 | [diff] [blame] | 1447 | |
Damien Miller | 3c02768 | 2001-03-14 11:39:45 +1100 | [diff] [blame] | 1448 | # Check for ALTDIRFUNC glob() extension |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1449 | AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support]) |
| 1450 | AC_EGREP_CPP([FOUNDIT], |
Damien Miller | 3c02768 | 2001-03-14 11:39:45 +1100 | [diff] [blame] | 1451 | [ |
| 1452 | #include <glob.h> |
| 1453 | #ifdef GLOB_ALTDIRFUNC |
| 1454 | FOUNDIT |
| 1455 | #endif |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 1456 | ], |
Damien Miller | 3c02768 | 2001-03-14 11:39:45 +1100 | [diff] [blame] | 1457 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1458 | AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 1459 | [Define if your system glob() function has |
| 1460 | the GLOB_ALTDIRFUNC extension]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1461 | AC_MSG_RESULT([yes]) |
Damien Miller | 3c02768 | 2001-03-14 11:39:45 +1100 | [diff] [blame] | 1462 | ], |
| 1463 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1464 | AC_MSG_RESULT([no]) |
Damien Miller | 3c02768 | 2001-03-14 11:39:45 +1100 | [diff] [blame] | 1465 | ] |
| 1466 | ) |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 1467 | |
Ben Lindstrom | 45b14db | 2001-03-17 01:15:38 +0000 | [diff] [blame] | 1468 | # Check for g.gl_matchc glob() extension |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1469 | AC_MSG_CHECKING([for gl_matchc field in glob_t]) |
| 1470 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], |
| 1471 | [[ glob_t g; g.gl_matchc = 1; ]])], |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 1472 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1473 | AC_DEFINE([GLOB_HAS_GL_MATCHC], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 1474 | [Define if your system glob() function has |
| 1475 | gl_matchc options in glob_t]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1476 | AC_MSG_RESULT([yes]) |
| 1477 | ], [ |
| 1478 | AC_MSG_RESULT([no]) |
| 1479 | ]) |
Ben Lindstrom | 45b14db | 2001-03-17 01:15:38 +0000 | [diff] [blame] | 1480 | |
Damien Miller | a6e121a | 2010-10-07 21:39:17 +1100 | [diff] [blame] | 1481 | # Check for g.gl_statv glob() extension |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1482 | AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob]) |
| 1483 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[ |
Damien Miller | a6e121a | 2010-10-07 21:39:17 +1100 | [diff] [blame] | 1484 | #ifndef GLOB_KEEPSTAT |
| 1485 | #error "glob does not support GLOB_KEEPSTAT extension" |
| 1486 | #endif |
| 1487 | glob_t g; |
| 1488 | g.gl_statv = NULL; |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1489 | ]])], |
Damien Miller | a6e121a | 2010-10-07 21:39:17 +1100 | [diff] [blame] | 1490 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1491 | AC_DEFINE([GLOB_HAS_GL_STATV], [1], |
Damien Miller | a6e121a | 2010-10-07 21:39:17 +1100 | [diff] [blame] | 1492 | [Define if your system glob() function has |
| 1493 | gl_statv options in glob_t]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1494 | AC_MSG_RESULT([yes]) |
| 1495 | ], [ |
| 1496 | AC_MSG_RESULT([no]) |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 1497 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1498 | ]) |
Damien Miller | a6e121a | 2010-10-07 21:39:17 +1100 | [diff] [blame] | 1499 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1500 | AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>]) |
Darren Tucker | 096faec | 2006-09-01 20:29:10 +1000 | [diff] [blame] | 1501 | |
Darren Tucker | 7df91b0 | 2016-07-14 12:25:24 +1000 | [diff] [blame] | 1502 | AC_CHECK_DECL([VIS_ALL], , |
| 1503 | AC_DEFINE(BROKEN_STRNVIS, 1, [missing VIS_ALL]), [#include <vis.h>]) |
| 1504 | |
Damien Miller | 18bb473 | 2001-03-28 14:35:30 +1000 | [diff] [blame] | 1505 | AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 1506 | AC_RUN_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1507 | [AC_LANG_PROGRAM([[ |
Damien Miller | 18bb473 | 2001-03-28 14:35:30 +1000 | [diff] [blame] | 1508 | #include <sys/types.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1509 | #include <dirent.h>]], |
| 1510 | [[ |
| 1511 | struct dirent d; |
| 1512 | exit(sizeof(d.d_name)<=sizeof(char)); |
Darren Tucker | 623d92f | 2004-09-12 22:36:15 +1000 | [diff] [blame] | 1513 | ]])], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1514 | [AC_MSG_RESULT([yes])], |
Damien Miller | 18bb473 | 2001-03-28 14:35:30 +1000 | [diff] [blame] | 1515 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1516 | AC_MSG_RESULT([no]) |
| 1517 | AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1], |
Darren Tucker | 79d09fa | 2005-11-24 22:34:54 +1100 | [diff] [blame] | 1518 | [Define if your struct dirent expects you to |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 1519 | allocate extra space for d_name]) |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 1520 | ], |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 1521 | [ |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 1522 | AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1523 | AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME]) |
Damien Miller | 18bb473 | 2001-03-28 14:35:30 +1000 | [diff] [blame] | 1524 | ] |
| 1525 | ) |
| 1526 | |
Damien Miller | 36f4965 | 2004-08-15 18:40:59 +1000 | [diff] [blame] | 1527 | AC_MSG_CHECKING([for /proc/pid/fd directory]) |
| 1528 | if test -d "/proc/$$/fd" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1529 | AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd]) |
| 1530 | AC_MSG_RESULT([yes]) |
Damien Miller | 36f4965 | 2004-08-15 18:40:59 +1000 | [diff] [blame] | 1531 | else |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1532 | AC_MSG_RESULT([no]) |
Damien Miller | 36f4965 | 2004-08-15 18:40:59 +1000 | [diff] [blame] | 1533 | fi |
| 1534 | |
Darren Tucker | aa3cbd1 | 2011-11-04 11:25:24 +1100 | [diff] [blame] | 1535 | # Check whether user wants to use ldns |
| 1536 | LDNS_MSG="no" |
| 1537 | AC_ARG_WITH(ldns, |
| 1538 | [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)], |
Damien Miller | 523db85 | 2017-02-03 16:01:22 +1100 | [diff] [blame] | 1539 | [ |
| 1540 | ldns="" |
| 1541 | if test "x$withval" = "xyes" ; then |
| 1542 | AC_PATH_TOOL([LDNSCONFIG], [ldns-config], [no]) |
Darren Tucker | f001de8 | 2017-12-11 13:42:51 +1100 | [diff] [blame] | 1543 | if test "x$LDNSCONFIG" = "xno"; then |
Damien Miller | 523db85 | 2017-02-03 16:01:22 +1100 | [diff] [blame] | 1544 | LIBS="-lldns $LIBS" |
| 1545 | ldns=yes |
| 1546 | else |
| 1547 | LIBS="$LIBS `$LDNSCONFIG --libs`" |
| 1548 | CPPFLAGS="$CPPFLAGS `$LDNSCONFIG --cflags`" |
Darren Tucker | 7af27bf | 2017-03-24 09:44:56 +1100 | [diff] [blame] | 1549 | ldns=yes |
Damien Miller | 523db85 | 2017-02-03 16:01:22 +1100 | [diff] [blame] | 1550 | fi |
| 1551 | elif test "x$withval" != "xno" ; then |
| 1552 | CPPFLAGS="$CPPFLAGS -I${withval}/include" |
| 1553 | LDFLAGS="$LDFLAGS -L${withval}/lib" |
| 1554 | LIBS="-lldns $LIBS" |
| 1555 | ldns=yes |
| 1556 | fi |
Darren Tucker | aa3cbd1 | 2011-11-04 11:25:24 +1100 | [diff] [blame] | 1557 | |
Damien Miller | 523db85 | 2017-02-03 16:01:22 +1100 | [diff] [blame] | 1558 | # Verify that it works. |
| 1559 | if test "x$ldns" = "xyes" ; then |
| 1560 | AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support]) |
| 1561 | LDNS_MSG="yes" |
| 1562 | AC_MSG_CHECKING([for ldns support]) |
| 1563 | AC_LINK_IFELSE( |
| 1564 | [AC_LANG_SOURCE([[ |
Darren Tucker | aa3cbd1 | 2011-11-04 11:25:24 +1100 | [diff] [blame] | 1565 | #include <stdio.h> |
| 1566 | #include <stdlib.h> |
Darren Tucker | 638a45b | 2020-01-26 13:40:51 +1100 | [diff] [blame] | 1567 | #ifdef HAVE_STDINT_H |
| 1568 | # include <stdint.h> |
| 1569 | #endif |
Darren Tucker | aa3cbd1 | 2011-11-04 11:25:24 +1100 | [diff] [blame] | 1570 | #include <ldns/ldns.h> |
| 1571 | int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); } |
Damien Miller | 523db85 | 2017-02-03 16:01:22 +1100 | [diff] [blame] | 1572 | ]]) |
| 1573 | ], |
| 1574 | [AC_MSG_RESULT(yes)], |
Darren Tucker | aa3cbd1 | 2011-11-04 11:25:24 +1100 | [diff] [blame] | 1575 | [ |
| 1576 | AC_MSG_RESULT(no) |
| 1577 | AC_MSG_ERROR([** Incomplete or missing ldns libraries.]) |
| 1578 | ]) |
Damien Miller | 523db85 | 2017-02-03 16:01:22 +1100 | [diff] [blame] | 1579 | fi |
| 1580 | ]) |
Darren Tucker | aa3cbd1 | 2011-11-04 11:25:24 +1100 | [diff] [blame] | 1581 | |
Darren Tucker | 16bcc1c | 2004-11-07 20:14:34 +1100 | [diff] [blame] | 1582 | # Check whether user wants libedit support |
| 1583 | LIBEDIT_MSG="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1584 | AC_ARG_WITH([libedit], |
Darren Tucker | 1b6f229 | 2005-02-11 16:11:49 +1100 | [diff] [blame] | 1585 | [ --with-libedit[[=PATH]] Enable libedit support for sftp], |
Darren Tucker | 16bcc1c | 2004-11-07 20:14:34 +1100 | [diff] [blame] | 1586 | [ if test "x$withval" != "xno" ; then |
Darren Tucker | c4ccb12 | 2010-04-09 14:04:35 +1000 | [diff] [blame] | 1587 | if test "x$withval" = "xyes" ; then |
Darren Tucker | 5935389 | 2012-05-19 15:24:37 +1000 | [diff] [blame] | 1588 | AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no]) |
Darren Tucker | c4ccb12 | 2010-04-09 14:04:35 +1000 | [diff] [blame] | 1589 | if test "x$PKGCONFIG" != "xno"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1590 | AC_MSG_CHECKING([if $PKGCONFIG knows about libedit]) |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 1591 | if "$PKGCONFIG" libedit; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1592 | AC_MSG_RESULT([yes]) |
Darren Tucker | c4ccb12 | 2010-04-09 14:04:35 +1000 | [diff] [blame] | 1593 | use_pkgconfig_for_libedit=yes |
| 1594 | else |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1595 | AC_MSG_RESULT([no]) |
Darren Tucker | c4ccb12 | 2010-04-09 14:04:35 +1000 | [diff] [blame] | 1596 | fi |
| 1597 | fi |
| 1598 | else |
Darren Tucker | c373a56 | 2005-09-22 20:15:08 +1000 | [diff] [blame] | 1599 | CPPFLAGS="$CPPFLAGS -I${withval}/include" |
Darren Tucker | 2f0bad2 | 2019-01-21 21:28:27 +1100 | [diff] [blame] | 1600 | if test -n "${rpath_opt}"; then |
| 1601 | LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}" |
Darren Tucker | c373a56 | 2005-09-22 20:15:08 +1000 | [diff] [blame] | 1602 | else |
| 1603 | LDFLAGS="-L${withval}/lib ${LDFLAGS}" |
| 1604 | fi |
Darren Tucker | 1df6145 | 2005-03-21 09:58:07 +1100 | [diff] [blame] | 1605 | fi |
Damien Miller | 1f78980 | 2010-10-11 22:35:22 +1100 | [diff] [blame] | 1606 | if test "x$use_pkgconfig_for_libedit" = "xyes"; then |
Darren Tucker | 8369c8e | 2013-12-05 11:00:16 +1100 | [diff] [blame] | 1607 | LIBEDIT=`$PKGCONFIG --libs libedit` |
Darren Tucker | c4ccb12 | 2010-04-09 14:04:35 +1000 | [diff] [blame] | 1608 | CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`" |
| 1609 | else |
| 1610 | LIBEDIT="-ledit -lcurses" |
| 1611 | fi |
| 1612 | OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'` |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1613 | AC_CHECK_LIB([edit], [el_init], |
| 1614 | [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp]) |
Darren Tucker | 16bcc1c | 2004-11-07 20:14:34 +1100 | [diff] [blame] | 1615 | LIBEDIT_MSG="yes" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1616 | AC_SUBST([LIBEDIT]) |
Darren Tucker | 16bcc1c | 2004-11-07 20:14:34 +1100 | [diff] [blame] | 1617 | ], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1618 | [ AC_MSG_ERROR([libedit not found]) ], |
Darren Tucker | c4ccb12 | 2010-04-09 14:04:35 +1000 | [diff] [blame] | 1619 | [ $OTHERLIBS ] |
Darren Tucker | 16bcc1c | 2004-11-07 20:14:34 +1100 | [diff] [blame] | 1620 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1621 | AC_MSG_CHECKING([if libedit version is compatible]) |
Tim Rice | c1819c8 | 2005-08-15 17:48:40 -0700 | [diff] [blame] | 1622 | AC_COMPILE_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1623 | [AC_LANG_PROGRAM([[ #include <histedit.h> ]], |
| 1624 | [[ |
Darren Tucker | c7572b2 | 2005-08-10 20:34:15 +1000 | [diff] [blame] | 1625 | int i = H_SETSIZE; |
| 1626 | el_init("", NULL, NULL, NULL); |
| 1627 | exit(0); |
Tim Rice | c1819c8 | 2005-08-15 17:48:40 -0700 | [diff] [blame] | 1628 | ]])], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1629 | [ AC_MSG_RESULT([yes]) ], |
| 1630 | [ AC_MSG_RESULT([no]) |
| 1631 | AC_MSG_ERROR([libedit version is not compatible]) ] |
Darren Tucker | c7572b2 | 2005-08-10 20:34:15 +1000 | [diff] [blame] | 1632 | ) |
Darren Tucker | 16bcc1c | 2004-11-07 20:14:34 +1100 | [diff] [blame] | 1633 | fi ] |
| 1634 | ) |
| 1635 | |
Darren Tucker | d9f8891 | 2005-02-20 21:01:48 +1100 | [diff] [blame] | 1636 | AUDIT_MODULE=none |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1637 | AC_ARG_WITH([audit], |
Darren Tucker | ea52a82 | 2011-01-17 21:15:27 +1100 | [diff] [blame] | 1638 | [ --with-audit=module Enable audit support (modules=debug,bsm,linux)], |
Darren Tucker | d9f8891 | 2005-02-20 21:01:48 +1100 | [diff] [blame] | 1639 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1640 | AC_MSG_CHECKING([for supported audit module]) |
Darren Tucker | d9f8891 | 2005-02-20 21:01:48 +1100 | [diff] [blame] | 1641 | case "$withval" in |
| 1642 | bsm) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1643 | AC_MSG_RESULT([bsm]) |
Darren Tucker | d9f8891 | 2005-02-20 21:01:48 +1100 | [diff] [blame] | 1644 | AUDIT_MODULE=bsm |
| 1645 | dnl Checks for headers, libs and functions |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1646 | AC_CHECK_HEADERS([bsm/audit.h], [], |
| 1647 | [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])], |
Darren Tucker | 6d0d6fb | 2006-09-09 01:05:21 +1000 | [diff] [blame] | 1648 | [ |
| 1649 | #ifdef HAVE_TIME_H |
| 1650 | # include <time.h> |
| 1651 | #endif |
| 1652 | ] |
| 1653 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1654 | AC_CHECK_LIB([bsm], [getaudit], [], |
| 1655 | [AC_MSG_ERROR([BSM enabled and required library not found])]) |
| 1656 | AC_CHECK_FUNCS([getaudit], [], |
| 1657 | [AC_MSG_ERROR([BSM enabled and required function not found])]) |
Darren Tucker | d9f8891 | 2005-02-20 21:01:48 +1100 | [diff] [blame] | 1658 | # These are optional |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1659 | AC_CHECK_FUNCS([getaudit_addr aug_get_machine]) |
| 1660 | AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module]) |
Darren Tucker | 1fcec9d | 2013-12-19 11:00:12 +1100 | [diff] [blame] | 1661 | if test "$sol2ver" -ge 11; then |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 1662 | SSHDLIBS="$SSHDLIBS -lscf" |
| 1663 | AC_DEFINE([BROKEN_BSM_API], [1], |
| 1664 | [The system has incomplete BSM API]) |
Darren Tucker | 93a2d41 | 2012-02-24 10:40:41 +1100 | [diff] [blame] | 1665 | fi |
Darren Tucker | d9f8891 | 2005-02-20 21:01:48 +1100 | [diff] [blame] | 1666 | ;; |
Darren Tucker | ea52a82 | 2011-01-17 21:15:27 +1100 | [diff] [blame] | 1667 | linux) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1668 | AC_MSG_RESULT([linux]) |
Darren Tucker | ea52a82 | 2011-01-17 21:15:27 +1100 | [diff] [blame] | 1669 | AUDIT_MODULE=linux |
| 1670 | dnl Checks for headers, libs and functions |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1671 | AC_CHECK_HEADERS([libaudit.h]) |
Darren Tucker | ea52a82 | 2011-01-17 21:15:27 +1100 | [diff] [blame] | 1672 | SSHDLIBS="$SSHDLIBS -laudit" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1673 | AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module]) |
Darren Tucker | ea52a82 | 2011-01-17 21:15:27 +1100 | [diff] [blame] | 1674 | ;; |
Darren Tucker | d9f8891 | 2005-02-20 21:01:48 +1100 | [diff] [blame] | 1675 | debug) |
| 1676 | AUDIT_MODULE=debug |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1677 | AC_MSG_RESULT([debug]) |
| 1678 | AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module]) |
Darren Tucker | d9f8891 | 2005-02-20 21:01:48 +1100 | [diff] [blame] | 1679 | ;; |
Tim Rice | 8bc6b90 | 2005-08-09 10:09:53 -0700 | [diff] [blame] | 1680 | no) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1681 | AC_MSG_RESULT([no]) |
Tim Rice | 8bc6b90 | 2005-08-09 10:09:53 -0700 | [diff] [blame] | 1682 | ;; |
Darren Tucker | d9f8891 | 2005-02-20 21:01:48 +1100 | [diff] [blame] | 1683 | *) |
| 1684 | AC_MSG_ERROR([Unknown audit module $withval]) |
| 1685 | ;; |
| 1686 | esac ] |
| 1687 | ) |
| 1688 | |
Darren Tucker | 096118d | 2014-01-21 12:48:51 +1100 | [diff] [blame] | 1689 | AC_ARG_WITH([pie], |
Damien Miller | 76c0480 | 2015-01-13 19:38:18 +1100 | [diff] [blame] | 1690 | [ --with-pie Build Position Independent Executables if possible], [ |
Darren Tucker | 096118d | 2014-01-21 12:48:51 +1100 | [diff] [blame] | 1691 | if test "x$withval" = "xno"; then |
Damien Miller | 852472a | 2014-01-22 16:31:18 +1100 | [diff] [blame] | 1692 | use_pie=no |
Darren Tucker | 096118d | 2014-01-21 12:48:51 +1100 | [diff] [blame] | 1693 | fi |
| 1694 | if test "x$withval" = "xyes"; then |
Damien Miller | 852472a | 2014-01-22 16:31:18 +1100 | [diff] [blame] | 1695 | use_pie=yes |
Darren Tucker | 096118d | 2014-01-21 12:48:51 +1100 | [diff] [blame] | 1696 | fi |
| 1697 | ] |
| 1698 | ) |
Damien Miller | 852472a | 2014-01-22 16:31:18 +1100 | [diff] [blame] | 1699 | if test "x$use_pie" = "x"; then |
| 1700 | use_pie=no |
| 1701 | fi |
| 1702 | if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then |
| 1703 | # Turn off automatic PIE when toolchain hardening is off. |
| 1704 | use_pie=no |
| 1705 | fi |
Damien Miller | c161fc9 | 2014-01-29 21:01:33 +1100 | [diff] [blame] | 1706 | if test "x$use_pie" = "xauto"; then |
Damien Miller | 852472a | 2014-01-22 16:31:18 +1100 | [diff] [blame] | 1707 | # Automatic PIE requires gcc >= 4.x |
| 1708 | AC_MSG_CHECKING([for gcc >= 4.x]) |
| 1709 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
| 1710 | #if !defined(__GNUC__) || __GNUC__ < 4 |
| 1711 | #error gcc is too old |
| 1712 | #endif |
| 1713 | ]])], |
| 1714 | [ AC_MSG_RESULT([yes]) ], |
| 1715 | [ AC_MSG_RESULT([no]) |
| 1716 | use_pie=no ] |
| 1717 | ) |
| 1718 | fi |
| 1719 | if test "x$use_pie" != "xno"; then |
Damien Miller | 5c2ff5e | 2014-01-22 21:30:12 +1100 | [diff] [blame] | 1720 | SAVED_CFLAGS="$CFLAGS" |
| 1721 | SAVED_LDFLAGS="$LDFLAGS" |
Darren Tucker | 096118d | 2014-01-21 12:48:51 +1100 | [diff] [blame] | 1722 | OSSH_CHECK_CFLAG_COMPILE([-fPIE]) |
| 1723 | OSSH_CHECK_LDFLAG_LINK([-pie]) |
Damien Miller | 5c2ff5e | 2014-01-22 21:30:12 +1100 | [diff] [blame] | 1724 | # We use both -fPIE and -pie or neither. |
| 1725 | AC_MSG_CHECKING([whether both -fPIE and -pie are supported]) |
| 1726 | if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \ |
| 1727 | echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then |
| 1728 | AC_MSG_RESULT([yes]) |
| 1729 | else |
| 1730 | AC_MSG_RESULT([no]) |
| 1731 | CFLAGS="$SAVED_CFLAGS" |
| 1732 | LDFLAGS="$SAVED_LDFLAGS" |
| 1733 | fi |
Darren Tucker | 096118d | 2014-01-21 12:48:51 +1100 | [diff] [blame] | 1734 | fi |
| 1735 | |
Damien Miller | b218055 | 2019-11-29 12:32:23 +1100 | [diff] [blame] | 1736 | AC_MSG_CHECKING([whether -fPIC is accepted]) |
| 1737 | SAVED_CFLAGS="$CFLAGS" |
| 1738 | CFLAGS="$CFLAGS -fPIC" |
| 1739 | AC_COMPILE_IFELSE( |
| 1740 | [AC_LANG_PROGRAM( [[ #include <stdlib.h> ]], [[ exit(0); ]] )], |
| 1741 | [AC_MSG_RESULT([yes]) |
| 1742 | PICFLAG="-fPIC"; ], |
| 1743 | [AC_MSG_RESULT([no]) |
| 1744 | PICFLAG=""; ]) |
| 1745 | CFLAGS="$SAVED_CFLAGS" |
| 1746 | AC_SUBST([PICFLAG]) |
| 1747 | |
Damien Miller | fe1f143 | 2003-02-24 15:45:42 +1100 | [diff] [blame] | 1748 | dnl Checks for library functions. Please keep in alphabetical order |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1749 | AC_CHECK_FUNCS([ \ |
Damien Miller | 1ff130d | 2013-12-07 11:51:51 +1100 | [diff] [blame] | 1750 | Blowfish_initstate \ |
| 1751 | Blowfish_expandstate \ |
| 1752 | Blowfish_expand0state \ |
| 1753 | Blowfish_stream2word \ |
Darren Tucker | 11cba2a | 2019-07-23 21:51:22 +1000 | [diff] [blame] | 1754 | SHA256Update \ |
| 1755 | SHA384Update \ |
| 1756 | SHA512Update \ |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 1757 | asprintf \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1758 | b64_ntop \ |
| 1759 | __b64_ntop \ |
| 1760 | b64_pton \ |
| 1761 | __b64_pton \ |
| 1762 | bcopy \ |
Damien Miller | a913442 | 2013-12-07 11:35:36 +1100 | [diff] [blame] | 1763 | bcrypt_pbkdf \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1764 | bindresvport_sa \ |
Damien Miller | 1ff130d | 2013-12-07 11:51:51 +1100 | [diff] [blame] | 1765 | blf_enc \ |
Darren Tucker | a900442 | 2018-02-24 20:25:22 +1100 | [diff] [blame] | 1766 | bzero \ |
Damien Miller | c96d853 | 2014-01-25 13:12:28 +1100 | [diff] [blame] | 1767 | cap_rights_limit \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1768 | clock \ |
| 1769 | closefrom \ |
| 1770 | dirfd \ |
Darren Tucker | efdf534 | 2013-05-30 08:29:08 +1000 | [diff] [blame] | 1771 | endgrent \ |
Darren Tucker | 6310ef2 | 2016-07-13 14:42:35 +1000 | [diff] [blame] | 1772 | err \ |
| 1773 | errx \ |
Damien Miller | 1d2c456 | 2014-02-04 11:18:20 +1100 | [diff] [blame] | 1774 | explicit_bzero \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1775 | fchmod \ |
Darren Tucker | a6258e5 | 2019-01-18 11:09:01 +1100 | [diff] [blame] | 1776 | fchmodat \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1777 | fchown \ |
Darren Tucker | a6258e5 | 2019-01-18 11:09:01 +1100 | [diff] [blame] | 1778 | fchownat \ |
Darren Tucker | cd3ab57 | 2018-02-26 14:37:06 +1100 | [diff] [blame] | 1779 | flock \ |
Darren Tucker | 0e3c5bc | 2019-11-01 18:24:29 +1100 | [diff] [blame] | 1780 | fnmatch \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1781 | freeaddrinfo \ |
Damien Miller | b795691 | 2017-09-19 12:29:23 +1000 | [diff] [blame] | 1782 | freezero \ |
Darren Tucker | a5cf1e2 | 2014-01-17 18:10:58 +1100 | [diff] [blame] | 1783 | fstatfs \ |
Darren Tucker | 598eaa6 | 2008-06-09 03:32:29 +1000 | [diff] [blame] | 1784 | fstatvfs \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1785 | futimes \ |
| 1786 | getaddrinfo \ |
| 1787 | getcwd \ |
| 1788 | getgrouplist \ |
Darren Tucker | 6301e6c | 2018-07-02 21:16:58 +1000 | [diff] [blame] | 1789 | getline \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1790 | getnameinfo \ |
| 1791 | getopt \ |
Damien Miller | 151c6e4 | 2017-06-01 15:25:13 +1000 | [diff] [blame] | 1792 | getpagesize \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1793 | getpeereid \ |
Darren Tucker | 164aa30 | 2007-03-21 21:39:57 +1100 | [diff] [blame] | 1794 | getpeerucred \ |
Darren Tucker | 3c4a24c | 2013-02-15 11:41:35 +1100 | [diff] [blame] | 1795 | getpgid \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1796 | _getpty \ |
| 1797 | getrlimit \ |
Damien Miller | afa6e79 | 2018-04-13 13:31:42 +1000 | [diff] [blame] | 1798 | getrandom \ |
Darren Tucker | b39593a | 2018-02-25 13:25:15 +1100 | [diff] [blame] | 1799 | getsid \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1800 | getttyent \ |
| 1801 | glob \ |
Darren Tucker | 909a390 | 2010-01-15 12:38:30 +1100 | [diff] [blame] | 1802 | group_from_gid \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1803 | inet_aton \ |
| 1804 | inet_ntoa \ |
| 1805 | inet_ntop \ |
| 1806 | innetgr \ |
Darren Tucker | d38f05d | 2017-03-20 13:38:27 +1100 | [diff] [blame] | 1807 | llabs \ |
Darren Tucker | 1bcd116 | 2019-10-29 19:45:03 +1100 | [diff] [blame] | 1808 | localtime_r \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1809 | login_getcapbool \ |
| 1810 | md5_crypt \ |
Darren Tucker | 4547889 | 2019-07-16 09:20:23 +1000 | [diff] [blame] | 1811 | memmem \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1812 | memmove \ |
Damien Miller | 3d673d1 | 2014-08-27 06:32:01 +1000 | [diff] [blame] | 1813 | memset_s \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1814 | mkdtemp \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1815 | ngetaddrinfo \ |
| 1816 | nsleep \ |
| 1817 | ogetaddrinfo \ |
| 1818 | openlog_r \ |
Darren Tucker | 3ddd15e | 2015-11-30 07:23:53 +1100 | [diff] [blame] | 1819 | pledge \ |
Darren Tucker | febf0f5 | 2007-06-25 22:15:12 +1000 | [diff] [blame] | 1820 | poll \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1821 | prctl \ |
| 1822 | pstat \ |
Darren Tucker | 6c8c9a6 | 2018-02-24 20:46:37 +1100 | [diff] [blame] | 1823 | raise \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1824 | readpassphrase \ |
Darren Tucker | 642652d | 2014-12-10 01:32:23 +1100 | [diff] [blame] | 1825 | reallocarray \ |
Darren Tucker | 79d46de | 2019-11-01 15:22:32 +1100 | [diff] [blame] | 1826 | realpath \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1827 | recvmsg \ |
Damien Miller | 151c6e4 | 2017-06-01 15:25:13 +1000 | [diff] [blame] | 1828 | recallocarray \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1829 | rresvport_af \ |
| 1830 | sendmsg \ |
| 1831 | setdtablesize \ |
| 1832 | setegid \ |
| 1833 | setenv \ |
| 1834 | seteuid \ |
Darren Tucker | 909a390 | 2010-01-15 12:38:30 +1100 | [diff] [blame] | 1835 | setgroupent \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1836 | setgroups \ |
Darren Tucker | 34f702a | 2012-07-04 08:50:09 +1000 | [diff] [blame] | 1837 | setlinebuf \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1838 | setlogin \ |
Darren Tucker | 909a390 | 2010-01-15 12:38:30 +1100 | [diff] [blame] | 1839 | setpassent\ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1840 | setpcred \ |
| 1841 | setproctitle \ |
| 1842 | setregid \ |
| 1843 | setreuid \ |
| 1844 | setrlimit \ |
| 1845 | setsid \ |
| 1846 | setvbuf \ |
| 1847 | sigaction \ |
| 1848 | sigvec \ |
| 1849 | snprintf \ |
| 1850 | socketpair \ |
Darren Tucker | 5b2e2ba | 2008-06-08 09:25:28 +1000 | [diff] [blame] | 1851 | statfs \ |
| 1852 | statvfs \ |
Darren Tucker | afec077 | 2016-12-13 10:23:03 +1100 | [diff] [blame] | 1853 | strcasestr \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1854 | strdup \ |
| 1855 | strerror \ |
| 1856 | strlcat \ |
| 1857 | strlcpy \ |
| 1858 | strmode \ |
Darren Tucker | 33561e6 | 2018-03-03 14:56:09 +1100 | [diff] [blame] | 1859 | strndup \ |
Darren Tucker | b54f50e | 2011-09-29 23:17:18 +1000 | [diff] [blame] | 1860 | strnlen \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1861 | strnvis \ |
Darren Tucker | aa74f67 | 2010-08-16 13:15:23 +1000 | [diff] [blame] | 1862 | strptime \ |
Darren Tucker | 44fc334 | 2017-09-25 09:48:10 +1000 | [diff] [blame] | 1863 | strsignal \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1864 | strtonum \ |
Darren Tucker | 81eb5d5 | 2005-06-01 21:39:33 +1000 | [diff] [blame] | 1865 | strtoll \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1866 | strtoul \ |
Darren Tucker | 8e6fb78 | 2013-02-15 12:13:01 +1100 | [diff] [blame] | 1867 | strtoull \ |
Damien Miller | 34a1769 | 2007-06-11 14:15:42 +1000 | [diff] [blame] | 1868 | swap32 \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1869 | sysconf \ |
| 1870 | tcgetpgrp \ |
Damien Miller | aa18063 | 2010-10-07 21:25:27 +1100 | [diff] [blame] | 1871 | timingsafe_bcmp \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1872 | truncate \ |
| 1873 | unsetenv \ |
| 1874 | updwtmpx \ |
Darren Tucker | 091093d | 2019-01-18 12:11:42 +1300 | [diff] [blame] | 1875 | utimensat \ |
Darren Tucker | 909a390 | 2010-01-15 12:38:30 +1100 | [diff] [blame] | 1876 | user_from_uid \ |
Damien Miller | f4db77d | 2013-03-15 10:34:25 +1100 | [diff] [blame] | 1877 | usleep \ |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 1878 | vasprintf \ |
Darren Tucker | 0c9653f | 2005-05-28 15:58:14 +1000 | [diff] [blame] | 1879 | vsnprintf \ |
| 1880 | waitpid \ |
Darren Tucker | 6310ef2 | 2016-07-13 14:42:35 +1000 | [diff] [blame] | 1881 | warn \ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1882 | ]) |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 1883 | |
Darren Tucker | afffd31 | 2019-12-11 13:22:06 +1100 | [diff] [blame] | 1884 | AC_CHECK_DECLS([bzero, memmem]) |
Darren Tucker | a900442 | 2018-02-24 20:25:22 +1100 | [diff] [blame] | 1885 | |
Darren Tucker | c61d5ec | 2017-02-03 14:10:34 +1100 | [diff] [blame] | 1886 | dnl Wide character support. |
Darren Tucker | a233358 | 2016-07-14 10:59:09 +1000 | [diff] [blame] | 1887 | AC_CHECK_FUNCS([mblen mbtowc nl_langinfo wcwidth]) |
Darren Tucker | a233358 | 2016-07-14 10:59:09 +1000 | [diff] [blame] | 1888 | |
Darren Tucker | 10e290e | 2016-12-13 13:51:32 +1100 | [diff] [blame] | 1889 | TEST_SSH_UTF8=${TEST_SSH_UTF8:=yes} |
Darren Tucker | 47b8c99 | 2016-12-08 15:48:34 +1100 | [diff] [blame] | 1890 | AC_MSG_CHECKING([for utf8 locale support]) |
| 1891 | AC_RUN_IFELSE( |
| 1892 | [AC_LANG_PROGRAM([[ |
| 1893 | #include <locale.h> |
Darren Tucker | c359950 | 2016-12-09 12:52:02 +1100 | [diff] [blame] | 1894 | #include <stdlib.h> |
Darren Tucker | 47b8c99 | 2016-12-08 15:48:34 +1100 | [diff] [blame] | 1895 | ]], [[ |
| 1896 | char *loc = setlocale(LC_CTYPE, "en_US.UTF-8"); |
| 1897 | if (loc != NULL) |
| 1898 | exit(0); |
| 1899 | exit(1); |
| 1900 | ]])], |
| 1901 | AC_MSG_RESULT(yes), |
| 1902 | [AC_MSG_RESULT(no) |
| 1903 | TEST_SSH_UTF8=no], |
| 1904 | AC_MSG_WARN([cross compiling: assuming yes]) |
| 1905 | ) |
| 1906 | |
Tim Rice | c7a8af0 | 2010-11-08 14:26:23 -0800 | [diff] [blame] | 1907 | AC_LINK_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1908 | [AC_LANG_PROGRAM( |
| 1909 | [[ #include <ctype.h> ]], |
| 1910 | [[ return (isblank('a')); ]])], |
| 1911 | [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).]) |
Tim Rice | c7a8af0 | 2010-11-08 14:26:23 -0800 | [diff] [blame] | 1912 | ]) |
| 1913 | |
Damien Miller | 5fbe93f | 2016-07-15 13:54:31 +1000 | [diff] [blame] | 1914 | disable_pkcs11= |
| 1915 | AC_ARG_ENABLE([pkcs11], |
| 1916 | [ --disable-pkcs11 disable PKCS#11 support code [no]], |
| 1917 | [ |
| 1918 | if test "x$enableval" = "xno" ; then |
| 1919 | disable_pkcs11=1 |
| 1920 | fi |
| 1921 | ] |
| 1922 | ) |
| 1923 | |
Damien Miller | 764d51e | 2019-11-01 13:34:49 +1100 | [diff] [blame] | 1924 | disable_sk= |
| 1925 | AC_ARG_ENABLE([security-key], |
| 1926 | [ --disable-security-key disable U2F/FIDO support code [no]], |
| 1927 | [ |
| 1928 | if test "x$enableval" = "xno" ; then |
| 1929 | disable_sk=1 |
| 1930 | fi |
| 1931 | ] |
| 1932 | ) |
Damien Miller | 5c0bc27 | 2019-11-15 16:08:00 +1100 | [diff] [blame] | 1933 | enable_sk_internal= |
| 1934 | AC_ARG_WITH([security-key-builtin], |
| 1935 | [ --with-security-key-builtin include builtin U2F/FIDO support], |
| 1936 | [ |
| 1937 | if test "x$withval" != "xno" ; then |
| 1938 | enable_sk_internal=yes |
| 1939 | fi |
| 1940 | ] |
| 1941 | ) |
| 1942 | test "x$disable_sk" != "x" && enable_sk_internal="" |
Damien Miller | 764d51e | 2019-11-01 13:34:49 +1100 | [diff] [blame] | 1943 | |
Damien Miller | 764d51e | 2019-11-01 13:34:49 +1100 | [diff] [blame] | 1944 | AC_SEARCH_LIBS([dlopen], [dl]) |
| 1945 | AC_CHECK_FUNCS([dlopen]) |
| 1946 | AC_CHECK_DECL([RTLD_NOW], [], [], [#include <dlfcn.h>]) |
| 1947 | |
Darren Tucker | d5e082f | 2003-09-22 12:08:23 +1000 | [diff] [blame] | 1948 | # IRIX has a const char return value for gai_strerror() |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1949 | AC_CHECK_FUNCS([gai_strerror], [ |
| 1950 | AC_DEFINE([HAVE_GAI_STRERROR]) |
| 1951 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Darren Tucker | d5e082f | 2003-09-22 12:08:23 +1000 | [diff] [blame] | 1952 | #include <sys/types.h> |
| 1953 | #include <sys/socket.h> |
| 1954 | #include <netdb.h> |
| 1955 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1956 | const char *gai_strerror(int); |
| 1957 | ]], [[ |
| 1958 | char *str; |
| 1959 | str = gai_strerror(0); |
| 1960 | ]])], [ |
| 1961 | AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1], |
| 1962 | [Define if gai_strerror() returns const char *])], [])]) |
Darren Tucker | d5e082f | 2003-09-22 12:08:23 +1000 | [diff] [blame] | 1963 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1964 | AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1], |
| 1965 | [Some systems put nanosleep outside of libc])]) |
Damien Miller | cd6853c | 2003-01-28 11:33:42 +1100 | [diff] [blame] | 1966 | |
Darren Tucker | a710891 | 2013-06-02 08:18:31 +1000 | [diff] [blame] | 1967 | AC_SEARCH_LIBS([clock_gettime], [rt], |
| 1968 | [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])]) |
| 1969 | |
Darren Tucker | f1159b5 | 2003-07-07 19:44:01 +1000 | [diff] [blame] | 1970 | dnl Make sure prototypes are defined for these before using them. |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1971 | AC_CHECK_DECL([strsep], |
| 1972 | [AC_CHECK_FUNCS([strsep])], |
Darren Tucker | 390b6d5 | 2005-05-28 16:54:36 +1000 | [diff] [blame] | 1973 | [], |
| 1974 | [ |
| 1975 | #ifdef HAVE_STRING_H |
| 1976 | # include <string.h> |
| 1977 | #endif |
| 1978 | ]) |
Ben Lindstrom | 3e00647 | 2002-10-16 00:24:03 +0000 | [diff] [blame] | 1979 | |
Darren Tucker | b2427c8 | 2003-09-10 15:22:44 +1000 | [diff] [blame] | 1980 | dnl tcsendbreak might be a macro |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1981 | AC_CHECK_DECL([tcsendbreak], |
| 1982 | [AC_DEFINE([HAVE_TCSENDBREAK])], |
| 1983 | [AC_CHECK_FUNCS([tcsendbreak])], |
Darren Tucker | b2427c8 | 2003-09-10 15:22:44 +1000 | [diff] [blame] | 1984 | [#include <termios.h>] |
| 1985 | ) |
| 1986 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1987 | AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>]) |
Darren Tucker | 5bb1400 | 2004-04-23 18:53:10 +1000 | [diff] [blame] | 1988 | |
Darren Tucker | d4860ec | 2020-02-17 22:48:50 +1100 | [diff] [blame] | 1989 | AC_CHECK_DECLS([SHUT_RD, getpeereid], , , |
Darren Tucker | 128a089 | 2006-07-12 19:02:56 +1000 | [diff] [blame] | 1990 | [ |
| 1991 | #include <sys/types.h> |
| 1992 | #include <sys/socket.h> |
Darren Tucker | d4860ec | 2020-02-17 22:48:50 +1100 | [diff] [blame] | 1993 | #include <unistd.h> |
Darren Tucker | 128a089 | 2006-07-12 19:02:56 +1000 | [diff] [blame] | 1994 | ]) |
Darren Tucker | 248469b | 2006-07-12 14:14:31 +1000 | [diff] [blame] | 1995 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 1996 | AC_CHECK_DECLS([O_NONBLOCK], , , |
Darren Tucker | 248469b | 2006-07-12 14:14:31 +1000 | [diff] [blame] | 1997 | [ |
| 1998 | #include <sys/types.h> |
| 1999 | #ifdef HAVE_SYS_STAT_H |
| 2000 | # include <sys/stat.h> |
| 2001 | #endif |
| 2002 | #ifdef HAVE_FCNTL_H |
| 2003 | # include <fcntl.h> |
| 2004 | #endif |
| 2005 | ]) |
| 2006 | |
Darren Tucker | 2eb4041 | 2018-02-24 21:06:48 +1100 | [diff] [blame] | 2007 | AC_CHECK_DECLS([readv, writev], , , [ |
Darren Tucker | ed0b592 | 2006-09-03 22:44:49 +1000 | [diff] [blame] | 2008 | #include <sys/types.h> |
| 2009 | #include <sys/uio.h> |
| 2010 | #include <unistd.h> |
| 2011 | ]) |
| 2012 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2013 | AC_CHECK_DECLS([MAXSYMLINKS], , , [ |
Darren Tucker | 6d862a5 | 2007-04-29 14:39:02 +1000 | [diff] [blame] | 2014 | #include <sys/param.h> |
| 2015 | ]) |
| 2016 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2017 | AC_CHECK_DECLS([offsetof], , , [ |
Darren Tucker | dca0edf | 2007-04-29 15:06:44 +1000 | [diff] [blame] | 2018 | #include <stddef.h> |
| 2019 | ]) |
| 2020 | |
Darren Tucker | c7aad00 | 2013-06-02 07:18:47 +1000 | [diff] [blame] | 2021 | # extra bits for select(2) |
| 2022 | AC_CHECK_DECLS([howmany, NFDBITS], [], [], [[ |
| 2023 | #include <sys/param.h> |
| 2024 | #include <sys/types.h> |
| 2025 | #ifdef HAVE_SYS_SYSMACROS_H |
| 2026 | #include <sys/sysmacros.h> |
| 2027 | #endif |
| 2028 | #ifdef HAVE_SYS_SELECT_H |
| 2029 | #include <sys/select.h> |
| 2030 | #endif |
| 2031 | #ifdef HAVE_SYS_TIME_H |
| 2032 | #include <sys/time.h> |
| 2033 | #endif |
| 2034 | #ifdef HAVE_UNISTD_H |
| 2035 | #include <unistd.h> |
| 2036 | #endif |
| 2037 | ]]) |
| 2038 | AC_CHECK_TYPES([fd_mask], [], [], [[ |
| 2039 | #include <sys/param.h> |
| 2040 | #include <sys/types.h> |
| 2041 | #ifdef HAVE_SYS_SELECT_H |
| 2042 | #include <sys/select.h> |
| 2043 | #endif |
| 2044 | #ifdef HAVE_SYS_TIME_H |
| 2045 | #include <sys/time.h> |
| 2046 | #endif |
| 2047 | #ifdef HAVE_UNISTD_H |
| 2048 | #include <unistd.h> |
| 2049 | #endif |
| 2050 | ]]) |
| 2051 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2052 | AC_CHECK_FUNCS([setresuid], [ |
Darren Tucker | 2a6b029 | 2003-12-31 14:59:17 +1100 | [diff] [blame] | 2053 | dnl Some platorms have setresuid that isn't implemented, test for this |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2054 | AC_MSG_CHECKING([if setresuid seems to work]) |
Darren Tucker | 623d92f | 2004-09-12 22:36:15 +1000 | [diff] [blame] | 2055 | AC_RUN_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2056 | [AC_LANG_PROGRAM([[ |
Darren Tucker | e937be3 | 2003-12-17 18:53:26 +1100 | [diff] [blame] | 2057 | #include <stdlib.h> |
| 2058 | #include <errno.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2059 | ]], [[ |
| 2060 | errno=0; |
| 2061 | setresuid(0,0,0); |
| 2062 | if (errno==ENOSYS) |
| 2063 | exit(1); |
| 2064 | else |
| 2065 | exit(0); |
Darren Tucker | 623d92f | 2004-09-12 22:36:15 +1000 | [diff] [blame] | 2066 | ]])], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2067 | [AC_MSG_RESULT([yes])], |
| 2068 | [AC_DEFINE([BROKEN_SETRESUID], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 2069 | [Define if your setresuid() is broken]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2070 | AC_MSG_RESULT([not implemented])], |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 2071 | [AC_MSG_WARN([cross compiling: not checking setresuid])] |
Darren Tucker | 2a6b029 | 2003-12-31 14:59:17 +1100 | [diff] [blame] | 2072 | ) |
| 2073 | ]) |
Darren Tucker | e937be3 | 2003-12-17 18:53:26 +1100 | [diff] [blame] | 2074 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2075 | AC_CHECK_FUNCS([setresgid], [ |
Darren Tucker | 2a6b029 | 2003-12-31 14:59:17 +1100 | [diff] [blame] | 2076 | dnl Some platorms have setresgid that isn't implemented, test for this |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2077 | AC_MSG_CHECKING([if setresgid seems to work]) |
Darren Tucker | 623d92f | 2004-09-12 22:36:15 +1000 | [diff] [blame] | 2078 | AC_RUN_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2079 | [AC_LANG_PROGRAM([[ |
Darren Tucker | e937be3 | 2003-12-17 18:53:26 +1100 | [diff] [blame] | 2080 | #include <stdlib.h> |
| 2081 | #include <errno.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2082 | ]], [[ |
| 2083 | errno=0; |
| 2084 | setresgid(0,0,0); |
| 2085 | if (errno==ENOSYS) |
| 2086 | exit(1); |
| 2087 | else |
| 2088 | exit(0); |
Darren Tucker | 623d92f | 2004-09-12 22:36:15 +1000 | [diff] [blame] | 2089 | ]])], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2090 | [AC_MSG_RESULT([yes])], |
| 2091 | [AC_DEFINE([BROKEN_SETRESGID], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 2092 | [Define if your setresgid() is broken]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2093 | AC_MSG_RESULT([not implemented])], |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 2094 | [AC_MSG_WARN([cross compiling: not checking setresuid])] |
Darren Tucker | 2a6b029 | 2003-12-31 14:59:17 +1100 | [diff] [blame] | 2095 | ) |
| 2096 | ]) |
Darren Tucker | e937be3 | 2003-12-17 18:53:26 +1100 | [diff] [blame] | 2097 | |
Darren Tucker | 58fd4c5 | 2018-03-05 19:28:08 +1100 | [diff] [blame] | 2098 | AC_MSG_CHECKING([for working fflush(NULL)]) |
| 2099 | AC_RUN_IFELSE( |
| 2100 | [AC_LANG_PROGRAM([[#include <stdio.h>]], [[fflush(NULL); exit(0);]])], |
| 2101 | AC_MSG_RESULT([yes]), |
| 2102 | [AC_MSG_RESULT([no]) |
| 2103 | AC_DEFINE([FFLUSH_NULL_BUG], [1], |
| 2104 | [define if fflush(NULL) does not work])], |
| 2105 | AC_MSG_WARN([cross compiling: assuming working]) |
| 2106 | ) |
| 2107 | |
Damien Miller | ad833b3 | 2000-08-23 10:46:23 +1000 | [diff] [blame] | 2108 | dnl Checks for time functions |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2109 | AC_CHECK_FUNCS([gettimeofday time]) |
Damien Miller | ad833b3 | 2000-08-23 10:46:23 +1000 | [diff] [blame] | 2110 | dnl Checks for utmp functions |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2111 | AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent]) |
| 2112 | AC_CHECK_FUNCS([utmpname]) |
Damien Miller | ad833b3 | 2000-08-23 10:46:23 +1000 | [diff] [blame] | 2113 | dnl Checks for utmpx functions |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2114 | AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline]) |
| 2115 | AC_CHECK_FUNCS([setutxdb setutxent utmpxname]) |
Damien Miller | 20e231f | 2009-02-12 13:12:21 +1100 | [diff] [blame] | 2116 | dnl Checks for lastlog functions |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2117 | AC_CHECK_FUNCS([getlastlogxbyname]) |
Damien Miller | cedfecc | 1999-11-15 14:36:53 +1100 | [diff] [blame] | 2118 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2119 | AC_CHECK_FUNC([daemon], |
| 2120 | [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])], |
| 2121 | [AC_CHECK_LIB([bsd], [daemon], |
| 2122 | [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])] |
Damien Miller | 04f8014 | 1999-11-19 15:32:34 +1100 | [diff] [blame] | 2123 | ) |
| 2124 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2125 | AC_CHECK_FUNC([getpagesize], |
| 2126 | [AC_DEFINE([HAVE_GETPAGESIZE], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 2127 | [Define if your libraries define getpagesize()])], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2128 | [AC_CHECK_LIB([ucb], [getpagesize], |
| 2129 | [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])] |
Damien Miller | 9fb07e4 | 2000-03-05 16:22:59 +1100 | [diff] [blame] | 2130 | ) |
| 2131 | |
Damien Miller | cb170cb | 2000-07-01 16:52:55 +1000 | [diff] [blame] | 2132 | # Check for broken snprintf |
| 2133 | if test "x$ac_cv_func_snprintf" = "xyes" ; then |
| 2134 | AC_MSG_CHECKING([whether snprintf correctly terminates long strings]) |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 2135 | AC_RUN_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2136 | [AC_LANG_PROGRAM([[ #include <stdio.h> ]], |
| 2137 | [[ |
| 2138 | char b[5]; |
| 2139 | snprintf(b,5,"123456789"); |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 2140 | exit(b[4]!='\0'); |
Darren Tucker | 623d92f | 2004-09-12 22:36:15 +1000 | [diff] [blame] | 2141 | ]])], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2142 | [AC_MSG_RESULT([yes])], |
Damien Miller | cb170cb | 2000-07-01 16:52:55 +1000 | [diff] [blame] | 2143 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2144 | AC_MSG_RESULT([no]) |
| 2145 | AC_DEFINE([BROKEN_SNPRINTF], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 2146 | [Define if your snprintf is busted]) |
Damien Miller | cb170cb | 2000-07-01 16:52:55 +1000 | [diff] [blame] | 2147 | AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor]) |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 2148 | ], |
| 2149 | [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ] |
Damien Miller | cb170cb | 2000-07-01 16:52:55 +1000 | [diff] [blame] | 2150 | ) |
| 2151 | fi |
| 2152 | |
Darren Tucker | e526127 | 2018-10-12 16:43:35 +1100 | [diff] [blame] | 2153 | if test "x$ac_cv_func_snprintf" = "xyes" ; then |
| 2154 | AC_MSG_CHECKING([whether snprintf understands %zu]) |
| 2155 | AC_RUN_IFELSE( |
| 2156 | [AC_LANG_PROGRAM([[ |
| 2157 | #include <sys/types.h> |
| 2158 | #include <stdio.h> |
| 2159 | ]], |
| 2160 | [[ |
| 2161 | size_t a = 1, b = 2; |
| 2162 | char z[128]; |
| 2163 | snprintf(z, sizeof z, "%zu%zu", a, b); |
| 2164 | exit(strcmp(z, "12")); |
| 2165 | ]])], |
| 2166 | [AC_MSG_RESULT([yes])], |
| 2167 | [ |
| 2168 | AC_MSG_RESULT([no]) |
| 2169 | AC_DEFINE([BROKEN_SNPRINTF], [1], |
| 2170 | [snprintf does not understand %zu]) |
| 2171 | ], |
| 2172 | [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ] |
| 2173 | ) |
| 2174 | fi |
| 2175 | |
Damien Miller | d244a58 | 2014-08-23 17:06:49 +1000 | [diff] [blame] | 2176 | # We depend on vsnprintf returning the right thing on overflow: the |
| 2177 | # number of characters it tried to create (as per SUSv3) |
| 2178 | if test "x$ac_cv_func_vsnprintf" = "xyes" ; then |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 2179 | AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow]) |
| 2180 | AC_RUN_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2181 | [AC_LANG_PROGRAM([[ |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 2182 | #include <sys/types.h> |
| 2183 | #include <stdio.h> |
| 2184 | #include <stdarg.h> |
| 2185 | |
Damien Miller | d244a58 | 2014-08-23 17:06:49 +1000 | [diff] [blame] | 2186 | int x_snprintf(char *str, size_t count, const char *fmt, ...) |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 2187 | { |
Damien Miller | d244a58 | 2014-08-23 17:06:49 +1000 | [diff] [blame] | 2188 | size_t ret; |
| 2189 | va_list ap; |
| 2190 | |
| 2191 | va_start(ap, fmt); |
| 2192 | ret = vsnprintf(str, count, fmt, ap); |
| 2193 | va_end(ap); |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 2194 | return ret; |
| 2195 | } |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2196 | ]], [[ |
Damien Miller | d244a58 | 2014-08-23 17:06:49 +1000 | [diff] [blame] | 2197 | char x[1]; |
| 2198 | if (x_snprintf(x, 1, "%s %d", "hello", 12345) != 11) |
| 2199 | return 1; |
| 2200 | if (x_snprintf(NULL, 0, "%s %d", "hello", 12345) != 11) |
| 2201 | return 1; |
| 2202 | return 0; |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2203 | ]])], |
| 2204 | [AC_MSG_RESULT([yes])], |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 2205 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2206 | AC_MSG_RESULT([no]) |
| 2207 | AC_DEFINE([BROKEN_SNPRINTF], [1], |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 2208 | [Define if your snprintf is busted]) |
| 2209 | AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor]) |
| 2210 | ], |
| 2211 | [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ] |
| 2212 | ) |
| 2213 | fi |
| 2214 | |
Darren Tucker | d40c66c | 2005-12-17 22:32:03 +1100 | [diff] [blame] | 2215 | # On systems where [v]snprintf is broken, but is declared in stdio, |
| 2216 | # check that the fmt argument is const char * or just char *. |
| 2217 | # This is only useful for when BROKEN_SNPRINTF |
| 2218 | AC_MSG_CHECKING([whether snprintf can declare const char *fmt]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2219 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 2220 | #include <stdio.h> |
| 2221 | int snprintf(char *a, size_t b, const char *c, ...) { return 0; } |
| 2222 | ]], [[ |
| 2223 | snprintf(0, 0, 0); |
| 2224 | ]])], |
| 2225 | [AC_MSG_RESULT([yes]) |
| 2226 | AC_DEFINE([SNPRINTF_CONST], [const], |
Darren Tucker | d40c66c | 2005-12-17 22:32:03 +1100 | [diff] [blame] | 2227 | [Define as const if snprintf() can declare const char *fmt])], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2228 | [AC_MSG_RESULT([no]) |
| 2229 | AC_DEFINE([SNPRINTF_CONST], [/* not const */])]) |
Darren Tucker | d40c66c | 2005-12-17 22:32:03 +1100 | [diff] [blame] | 2230 | |
Damien Miller | b409718 | 2004-05-23 14:09:40 +1000 | [diff] [blame] | 2231 | # Check for missing getpeereid (or equiv) support |
| 2232 | NO_PEERCHECK="" |
Darren Tucker | 164aa30 | 2007-03-21 21:39:57 +1100 | [diff] [blame] | 2233 | if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then |
Damien Miller | b409718 | 2004-05-23 14:09:40 +1000 | [diff] [blame] | 2234 | AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2235 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 2236 | #include <sys/types.h> |
| 2237 | #include <sys/socket.h>]], [[int i = SO_PEERCRED;]])], |
| 2238 | [ AC_MSG_RESULT([yes]) |
| 2239 | AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option]) |
| 2240 | ], [AC_MSG_RESULT([no]) |
| 2241 | NO_PEERCHECK=1 |
| 2242 | ]) |
Damien Miller | b409718 | 2004-05-23 14:09:40 +1000 | [diff] [blame] | 2243 | fi |
| 2244 | |
Damien Miller | e832819 | 2003-01-07 15:18:32 +1100 | [diff] [blame] | 2245 | dnl see whether mkstemp() requires XXXXXX |
| 2246 | if test "x$ac_cv_func_mkdtemp" = "xyes" ; then |
| 2247 | AC_MSG_CHECKING([for (overly) strict mkstemp]) |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 2248 | AC_RUN_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2249 | [AC_LANG_PROGRAM([[ |
Damien Miller | e832819 | 2003-01-07 15:18:32 +1100 | [diff] [blame] | 2250 | #include <stdlib.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2251 | ]], [[ |
| 2252 | char template[]="conftest.mkstemp-test"; |
| 2253 | if (mkstemp(template) == -1) |
| 2254 | exit(1); |
| 2255 | unlink(template); |
| 2256 | exit(0); |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 2257 | ]])], |
Damien Miller | e832819 | 2003-01-07 15:18:32 +1100 | [diff] [blame] | 2258 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2259 | AC_MSG_RESULT([no]) |
Damien Miller | e832819 | 2003-01-07 15:18:32 +1100 | [diff] [blame] | 2260 | ], |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 2261 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2262 | AC_MSG_RESULT([yes]) |
| 2263 | AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()]) |
Damien Miller | e832819 | 2003-01-07 15:18:32 +1100 | [diff] [blame] | 2264 | ], |
| 2265 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2266 | AC_MSG_RESULT([yes]) |
| 2267 | AC_DEFINE([HAVE_STRICT_MKSTEMP]) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 2268 | ] |
Damien Miller | e832819 | 2003-01-07 15:18:32 +1100 | [diff] [blame] | 2269 | ) |
| 2270 | fi |
| 2271 | |
Darren Tucker | 70a3d55 | 2003-08-21 17:58:29 +1000 | [diff] [blame] | 2272 | dnl make sure that openpty does not reacquire controlling terminal |
| 2273 | if test ! -z "$check_for_openpty_ctty_bug"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2274 | AC_MSG_CHECKING([if openpty correctly handles controlling tty]) |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 2275 | AC_RUN_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2276 | [AC_LANG_PROGRAM([[ |
Darren Tucker | 70a3d55 | 2003-08-21 17:58:29 +1000 | [diff] [blame] | 2277 | #include <stdio.h> |
| 2278 | #include <sys/fcntl.h> |
| 2279 | #include <sys/types.h> |
| 2280 | #include <sys/wait.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2281 | ]], [[ |
Darren Tucker | 70a3d55 | 2003-08-21 17:58:29 +1000 | [diff] [blame] | 2282 | pid_t pid; |
| 2283 | int fd, ptyfd, ttyfd, status; |
| 2284 | |
| 2285 | pid = fork(); |
| 2286 | if (pid < 0) { /* failed */ |
| 2287 | exit(1); |
| 2288 | } else if (pid > 0) { /* parent */ |
| 2289 | waitpid(pid, &status, 0); |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 2290 | if (WIFEXITED(status)) |
Darren Tucker | 70a3d55 | 2003-08-21 17:58:29 +1000 | [diff] [blame] | 2291 | exit(WEXITSTATUS(status)); |
| 2292 | else |
| 2293 | exit(2); |
| 2294 | } else { /* child */ |
| 2295 | close(0); close(1); close(2); |
| 2296 | setsid(); |
| 2297 | openpty(&ptyfd, &ttyfd, NULL, NULL, NULL); |
| 2298 | fd = open("/dev/tty", O_RDWR | O_NOCTTY); |
| 2299 | if (fd >= 0) |
| 2300 | exit(3); /* Acquired ctty: broken */ |
| 2301 | else |
| 2302 | exit(0); /* Did not acquire ctty: OK */ |
| 2303 | } |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 2304 | ]])], |
Darren Tucker | 70a3d55 | 2003-08-21 17:58:29 +1000 | [diff] [blame] | 2305 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2306 | AC_MSG_RESULT([yes]) |
Darren Tucker | 70a3d55 | 2003-08-21 17:58:29 +1000 | [diff] [blame] | 2307 | ], |
| 2308 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2309 | AC_MSG_RESULT([no]) |
| 2310 | AC_DEFINE([SSHD_ACQUIRES_CTTY]) |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 2311 | ], |
| 2312 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2313 | AC_MSG_RESULT([cross-compiling, assuming yes]) |
Darren Tucker | 70a3d55 | 2003-08-21 17:58:29 +1000 | [diff] [blame] | 2314 | ] |
| 2315 | ) |
| 2316 | fi |
| 2317 | |
Tim Rice | 8bb561b | 2005-03-17 16:23:19 -0800 | [diff] [blame] | 2318 | if test "x$ac_cv_func_getaddrinfo" = "xyes" && \ |
| 2319 | test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2320 | AC_MSG_CHECKING([if getaddrinfo seems to work]) |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 2321 | AC_RUN_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2322 | [AC_LANG_PROGRAM([[ |
Darren Tucker | 4398cf5 | 2004-04-06 21:39:02 +1000 | [diff] [blame] | 2323 | #include <stdio.h> |
| 2324 | #include <sys/socket.h> |
| 2325 | #include <netdb.h> |
| 2326 | #include <errno.h> |
| 2327 | #include <netinet/in.h> |
| 2328 | |
| 2329 | #define TEST_PORT "2222" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2330 | ]], [[ |
Darren Tucker | 4398cf5 | 2004-04-06 21:39:02 +1000 | [diff] [blame] | 2331 | int err, sock; |
| 2332 | struct addrinfo *gai_ai, *ai, hints; |
| 2333 | char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL; |
| 2334 | |
| 2335 | memset(&hints, 0, sizeof(hints)); |
| 2336 | hints.ai_family = PF_UNSPEC; |
| 2337 | hints.ai_socktype = SOCK_STREAM; |
| 2338 | hints.ai_flags = AI_PASSIVE; |
| 2339 | |
| 2340 | err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai); |
| 2341 | if (err != 0) { |
| 2342 | fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err)); |
| 2343 | exit(1); |
| 2344 | } |
| 2345 | |
| 2346 | for (ai = gai_ai; ai != NULL; ai = ai->ai_next) { |
| 2347 | if (ai->ai_family != AF_INET6) |
| 2348 | continue; |
| 2349 | |
| 2350 | err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, |
| 2351 | sizeof(ntop), strport, sizeof(strport), |
| 2352 | NI_NUMERICHOST|NI_NUMERICSERV); |
| 2353 | |
| 2354 | if (err != 0) { |
| 2355 | if (err == EAI_SYSTEM) |
| 2356 | perror("getnameinfo EAI_SYSTEM"); |
| 2357 | else |
| 2358 | fprintf(stderr, "getnameinfo failed: %s\n", |
| 2359 | gai_strerror(err)); |
| 2360 | exit(2); |
| 2361 | } |
| 2362 | |
| 2363 | sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); |
| 2364 | if (sock < 0) |
| 2365 | perror("socket"); |
| 2366 | if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) { |
| 2367 | if (errno == EBADF) |
| 2368 | exit(3); |
| 2369 | } |
| 2370 | } |
| 2371 | exit(0); |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 2372 | ]])], |
Darren Tucker | 4398cf5 | 2004-04-06 21:39:02 +1000 | [diff] [blame] | 2373 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2374 | AC_MSG_RESULT([yes]) |
Darren Tucker | 4398cf5 | 2004-04-06 21:39:02 +1000 | [diff] [blame] | 2375 | ], |
| 2376 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2377 | AC_MSG_RESULT([no]) |
| 2378 | AC_DEFINE([BROKEN_GETADDRINFO]) |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 2379 | ], |
| 2380 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2381 | AC_MSG_RESULT([cross-compiling, assuming yes]) |
Darren Tucker | 4398cf5 | 2004-04-06 21:39:02 +1000 | [diff] [blame] | 2382 | ] |
| 2383 | ) |
| 2384 | fi |
| 2385 | |
Tim Rice | 8bb561b | 2005-03-17 16:23:19 -0800 | [diff] [blame] | 2386 | if test "x$ac_cv_func_getaddrinfo" = "xyes" && \ |
| 2387 | test "x$check_for_aix_broken_getaddrinfo" = "x1"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2388 | AC_MSG_CHECKING([if getaddrinfo seems to work]) |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 2389 | AC_RUN_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2390 | [AC_LANG_PROGRAM([[ |
Darren Tucker | 691d523 | 2005-02-15 21:45:57 +1100 | [diff] [blame] | 2391 | #include <stdio.h> |
| 2392 | #include <sys/socket.h> |
| 2393 | #include <netdb.h> |
| 2394 | #include <errno.h> |
| 2395 | #include <netinet/in.h> |
| 2396 | |
| 2397 | #define TEST_PORT "2222" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2398 | ]], [[ |
Darren Tucker | 691d523 | 2005-02-15 21:45:57 +1100 | [diff] [blame] | 2399 | int err, sock; |
| 2400 | struct addrinfo *gai_ai, *ai, hints; |
| 2401 | char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL; |
| 2402 | |
| 2403 | memset(&hints, 0, sizeof(hints)); |
| 2404 | hints.ai_family = PF_UNSPEC; |
| 2405 | hints.ai_socktype = SOCK_STREAM; |
| 2406 | hints.ai_flags = AI_PASSIVE; |
| 2407 | |
| 2408 | err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai); |
| 2409 | if (err != 0) { |
| 2410 | fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err)); |
| 2411 | exit(1); |
| 2412 | } |
| 2413 | |
| 2414 | for (ai = gai_ai; ai != NULL; ai = ai->ai_next) { |
| 2415 | if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) |
| 2416 | continue; |
| 2417 | |
| 2418 | err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, |
| 2419 | sizeof(ntop), strport, sizeof(strport), |
| 2420 | NI_NUMERICHOST|NI_NUMERICSERV); |
| 2421 | |
| 2422 | if (ai->ai_family == AF_INET && err != 0) { |
| 2423 | perror("getnameinfo"); |
| 2424 | exit(2); |
| 2425 | } |
| 2426 | } |
| 2427 | exit(0); |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 2428 | ]])], |
Darren Tucker | 691d523 | 2005-02-15 21:45:57 +1100 | [diff] [blame] | 2429 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2430 | AC_MSG_RESULT([yes]) |
| 2431 | AC_DEFINE([AIX_GETNAMEINFO_HACK], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 2432 | [Define if you have a getaddrinfo that fails |
| 2433 | for the all-zeros IPv6 address]) |
Darren Tucker | 691d523 | 2005-02-15 21:45:57 +1100 | [diff] [blame] | 2434 | ], |
| 2435 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2436 | AC_MSG_RESULT([no]) |
| 2437 | AC_DEFINE([BROKEN_GETADDRINFO]) |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 2438 | ], |
Darren Tucker | 8b272ab | 2006-06-27 11:20:28 +1000 | [diff] [blame] | 2439 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2440 | AC_MSG_RESULT([cross-compiling, assuming no]) |
Darren Tucker | 691d523 | 2005-02-15 21:45:57 +1100 | [diff] [blame] | 2441 | ] |
| 2442 | ) |
| 2443 | fi |
| 2444 | |
Darren Tucker | e50e8c9 | 2015-02-21 15:10:33 +1100 | [diff] [blame] | 2445 | if test "x$ac_cv_func_getaddrinfo" = "xyes"; then |
| 2446 | AC_CHECK_DECLS(AI_NUMERICSERV, , , |
| 2447 | [#include <sys/types.h> |
| 2448 | #include <sys/socket.h> |
| 2449 | #include <netdb.h>]) |
| 2450 | fi |
| 2451 | |
Darren Tucker | a56f191 | 2004-11-02 20:30:54 +1100 | [diff] [blame] | 2452 | if test "x$check_for_conflicting_getspnam" = "x1"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2453 | AC_MSG_CHECKING([for conflicting getspnam in shadow.h]) |
| 2454 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]], |
| 2455 | [[ exit(0); ]])], |
Darren Tucker | a56f191 | 2004-11-02 20:30:54 +1100 | [diff] [blame] | 2456 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2457 | AC_MSG_RESULT([no]) |
Darren Tucker | a56f191 | 2004-11-02 20:30:54 +1100 | [diff] [blame] | 2458 | ], |
| 2459 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2460 | AC_MSG_RESULT([yes]) |
| 2461 | AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1], |
Darren Tucker | a56f191 | 2004-11-02 20:30:54 +1100 | [diff] [blame] | 2462 | [Conflicting defs for getspnam]) |
| 2463 | ] |
| 2464 | ) |
| 2465 | fi |
| 2466 | |
Darren Tucker | 20e5e8b | 2016-08-02 12:16:34 +1000 | [diff] [blame] | 2467 | dnl NetBSD added an strnvis and unfortunately made it incompatible with the |
| 2468 | dnl existing one in OpenBSD and Linux's libbsd (the former having existed |
| 2469 | dnl for over ten years). Despite this incompatibility being reported during |
| 2470 | dnl development (see http://gnats.netbsd.org/44977) they still shipped it. |
| 2471 | dnl Even more unfortunately FreeBSD and later MacOS picked up this incompatible |
| 2472 | dnl implementation. Try to detect this mess, and assume the only safe option |
| 2473 | dnl if we're cross compiling. |
| 2474 | dnl |
| 2475 | dnl OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag); |
| 2476 | dnl NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag); |
| 2477 | if test "x$ac_cv_func_strnvis" = "xyes"; then |
| 2478 | AC_MSG_CHECKING([for working strnvis]) |
| 2479 | AC_RUN_IFELSE( |
| 2480 | [AC_LANG_PROGRAM([[ |
| 2481 | #include <signal.h> |
| 2482 | #include <stdlib.h> |
| 2483 | #include <string.h> |
| 2484 | #include <vis.h> |
| 2485 | static void sighandler(int sig) { _exit(1); } |
| 2486 | ]], [[ |
| 2487 | char dst[16]; |
| 2488 | |
| 2489 | signal(SIGSEGV, sighandler); |
| 2490 | if (strnvis(dst, "src", 4, 0) && strcmp(dst, "src") == 0) |
| 2491 | exit(0); |
| 2492 | exit(1) |
| 2493 | ]])], |
| 2494 | [AC_MSG_RESULT([yes])], |
| 2495 | [AC_MSG_RESULT([no]) |
| 2496 | AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis detected broken])], |
| 2497 | [AC_MSG_WARN([cross compiling: assuming broken]) |
| 2498 | AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis assumed broken])] |
| 2499 | ) |
| 2500 | fi |
| 2501 | |
Darren Tucker | c7b5a47 | 2018-02-25 23:55:41 +1100 | [diff] [blame] | 2502 | AC_CHECK_FUNCS([getpgrp],[ |
| 2503 | AC_MSG_CHECKING([if getpgrp accepts zero args]) |
| 2504 | AC_COMPILE_IFELSE( |
| 2505 | [AC_LANG_PROGRAM([[$ac_includes_default]], [[ getpgrp(); ]])], |
| 2506 | [ AC_MSG_RESULT([yes]) |
| 2507 | AC_DEFINE([GETPGRP_VOID], [1], [getpgrp takes zero args])], |
| 2508 | [ AC_MSG_RESULT([no]) |
| 2509 | AC_DEFINE([GETPGRP_VOID], [0], [getpgrp takes one arg])] |
| 2510 | ) |
| 2511 | ]) |
Damien Miller | 606f880 | 2000-09-16 15:39:56 +1100 | [diff] [blame] | 2512 | |
Tim Rice | aef7371 | 2002-05-11 13:17:42 -0700 | [diff] [blame] | 2513 | # Search for OpenSSL |
| 2514 | saved_CPPFLAGS="$CPPFLAGS" |
| 2515 | saved_LDFLAGS="$LDFLAGS" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2516 | AC_ARG_WITH([ssl-dir], |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 2517 | [ --with-ssl-dir=PATH Specify path to OpenSSL installation ], |
| 2518 | [ |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2519 | if test "x$openssl" = "xno" ; then |
| 2520 | AC_MSG_ERROR([cannot use --with-ssl-dir when OpenSSL disabled]) |
| 2521 | fi |
Ben Lindstrom | 23e1371 | 2000-10-29 22:49:19 +0000 | [diff] [blame] | 2522 | if test "x$withval" != "xno" ; then |
Darren Tucker | c7e38d5 | 2005-02-09 22:12:30 +1100 | [diff] [blame] | 2523 | case "$withval" in |
| 2524 | # Relative paths |
| 2525 | ./*|../*) withval="`pwd`/$withval" |
| 2526 | esac |
Tim Rice | aef7371 | 2002-05-11 13:17:42 -0700 | [diff] [blame] | 2527 | if test -d "$withval/lib"; then |
Darren Tucker | 2f0bad2 | 2019-01-21 21:28:27 +1100 | [diff] [blame] | 2528 | if test -n "${rpath_opt}"; then |
| 2529 | LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}" |
Tim Rice | aef7371 | 2002-05-11 13:17:42 -0700 | [diff] [blame] | 2530 | else |
| 2531 | LDFLAGS="-L${withval}/lib ${LDFLAGS}" |
| 2532 | fi |
Darren Tucker | 9f8703b | 2010-04-23 11:12:06 +1000 | [diff] [blame] | 2533 | elif test -d "$withval/lib64"; then |
Darren Tucker | 2f0bad2 | 2019-01-21 21:28:27 +1100 | [diff] [blame] | 2534 | if test -n "${rpath_opt}"; then |
| 2535 | LDFLAGS="-L${withval}/lib64 ${rpath_opt}${withval}/lib64 ${LDFLAGS}" |
Darren Tucker | 9f8703b | 2010-04-23 11:12:06 +1000 | [diff] [blame] | 2536 | else |
| 2537 | LDFLAGS="-L${withval}/lib64 ${LDFLAGS}" |
| 2538 | fi |
Tim Rice | aef7371 | 2002-05-11 13:17:42 -0700 | [diff] [blame] | 2539 | else |
Darren Tucker | 2f0bad2 | 2019-01-21 21:28:27 +1100 | [diff] [blame] | 2540 | if test -n "${rpath_opt}"; then |
| 2541 | LDFLAGS="-L${withval} ${rpath_opt}${withval} ${LDFLAGS}" |
Tim Rice | aef7371 | 2002-05-11 13:17:42 -0700 | [diff] [blame] | 2542 | else |
| 2543 | LDFLAGS="-L${withval} ${LDFLAGS}" |
| 2544 | fi |
| 2545 | fi |
| 2546 | if test -d "$withval/include"; then |
| 2547 | CPPFLAGS="-I${withval}/include ${CPPFLAGS}" |
| 2548 | else |
| 2549 | CPPFLAGS="-I${withval} ${CPPFLAGS}" |
| 2550 | fi |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 2551 | fi |
| 2552 | ] |
| 2553 | ) |
Damien Miller | b9c5667 | 2014-05-15 14:43:37 +1000 | [diff] [blame] | 2554 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2555 | AC_ARG_WITH([openssl-header-check], |
Damien Miller | 9975e48 | 2007-03-05 11:51:27 +1100 | [diff] [blame] | 2556 | [ --without-openssl-header-check Disable OpenSSL version consistency check], |
Damien Miller | ec93237 | 2002-01-22 22:16:03 +1100 | [diff] [blame] | 2557 | [ |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2558 | if test "x$withval" = "xno" ; then |
| 2559 | openssl_check_nonfatal=1 |
Damien Miller | 9975e48 | 2007-03-05 11:51:27 +1100 | [diff] [blame] | 2560 | fi |
Damien Miller | ec93237 | 2002-01-22 22:16:03 +1100 | [diff] [blame] | 2561 | ] |
| 2562 | ) |
| 2563 | |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2564 | openssl_engine=no |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2565 | AC_ARG_WITH([ssl-engine], |
Darren Tucker | fabdb6c | 2006-02-20 20:17:35 +1100 | [diff] [blame] | 2566 | [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ], |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2567 | [ |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2568 | if test "x$withval" != "xno" ; then |
Darren Tucker | b5fa0cd | 2015-12-15 15:10:32 +1100 | [diff] [blame] | 2569 | if test "x$openssl" = "xno" ; then |
| 2570 | AC_MSG_ERROR([cannot use --with-ssl-engine when OpenSSL disabled]) |
| 2571 | fi |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2572 | openssl_engine=yes |
| 2573 | fi |
| 2574 | ] |
| 2575 | ) |
| 2576 | |
| 2577 | if test "x$openssl" = "xyes" ; then |
| 2578 | LIBS="-lcrypto $LIBS" |
Darren Tucker | 8d8340e | 2018-11-16 13:32:13 +1100 | [diff] [blame] | 2579 | AC_TRY_LINK_FUNC([RAND_add], , |
| 2580 | [AC_MSG_ERROR([*** working libcrypto not found, check config.log])]) |
| 2581 | AC_CHECK_HEADER([openssl/opensslv.h], , |
| 2582 | [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])]) |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2583 | |
| 2584 | # Determine OpenSSL header version |
| 2585 | AC_MSG_CHECKING([OpenSSL header version]) |
| 2586 | AC_RUN_IFELSE( |
| 2587 | [AC_LANG_PROGRAM([[ |
Darren Tucker | 1560596 | 2015-11-10 11:14:47 +1100 | [diff] [blame] | 2588 | #include <stdlib.h> |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2589 | #include <stdio.h> |
| 2590 | #include <string.h> |
| 2591 | #include <openssl/opensslv.h> |
| 2592 | #define DATA "conftest.sslincver" |
| 2593 | ]], [[ |
| 2594 | FILE *fd; |
| 2595 | int rc; |
| 2596 | |
| 2597 | fd = fopen(DATA,"w"); |
| 2598 | if(fd == NULL) |
| 2599 | exit(1); |
| 2600 | |
Darren Tucker | b341353 | 2016-04-04 11:09:21 +1000 | [diff] [blame] | 2601 | if ((rc = fprintf(fd, "%08lx (%s)\n", |
| 2602 | (unsigned long)OPENSSL_VERSION_NUMBER, |
| 2603 | OPENSSL_VERSION_TEXT)) < 0) |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2604 | exit(1); |
| 2605 | |
| 2606 | exit(0); |
| 2607 | ]])], |
| 2608 | [ |
| 2609 | ssl_header_ver=`cat conftest.sslincver` |
| 2610 | AC_MSG_RESULT([$ssl_header_ver]) |
| 2611 | ], |
| 2612 | [ |
| 2613 | AC_MSG_RESULT([not found]) |
| 2614 | AC_MSG_ERROR([OpenSSL version header not found.]) |
| 2615 | ], |
| 2616 | [ |
| 2617 | AC_MSG_WARN([cross compiling: not checking]) |
| 2618 | ] |
| 2619 | ) |
| 2620 | |
Darren Tucker | 262d81a | 2018-10-27 16:45:59 +1100 | [diff] [blame] | 2621 | # Determining OpenSSL library version is version dependent. |
| 2622 | AC_CHECK_FUNCS([OpenSSL_version OpenSSL_version_num]) |
| 2623 | |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2624 | # Determine OpenSSL library version |
| 2625 | AC_MSG_CHECKING([OpenSSL library version]) |
| 2626 | AC_RUN_IFELSE( |
| 2627 | [AC_LANG_PROGRAM([[ |
| 2628 | #include <stdio.h> |
| 2629 | #include <string.h> |
| 2630 | #include <openssl/opensslv.h> |
| 2631 | #include <openssl/crypto.h> |
| 2632 | #define DATA "conftest.ssllibver" |
| 2633 | ]], [[ |
| 2634 | FILE *fd; |
| 2635 | int rc; |
| 2636 | |
| 2637 | fd = fopen(DATA,"w"); |
| 2638 | if(fd == NULL) |
| 2639 | exit(1); |
Darren Tucker | 262d81a | 2018-10-27 16:45:59 +1100 | [diff] [blame] | 2640 | #ifndef OPENSSL_VERSION |
| 2641 | # define OPENSSL_VERSION SSLEAY_VERSION |
| 2642 | #endif |
| 2643 | #ifndef HAVE_OPENSSL_VERSION |
Damien Miller | 406a24b | 2018-10-26 13:43:28 +1100 | [diff] [blame] | 2644 | # define OpenSSL_version SSLeay_version |
Darren Tucker | 262d81a | 2018-10-27 16:45:59 +1100 | [diff] [blame] | 2645 | #endif |
| 2646 | #ifndef HAVE_OPENSSL_VERSION_NUM |
| 2647 | # define OpenSSL_version_num SSLeay |
Damien Miller | 406a24b | 2018-10-26 13:43:28 +1100 | [diff] [blame] | 2648 | #endif |
Damien Miller | 859754b | 2018-10-23 17:10:41 +1100 | [diff] [blame] | 2649 | if ((rc = fprintf(fd, "%08lx (%s)\n", |
| 2650 | (unsigned long)OpenSSL_version_num(), |
| 2651 | OpenSSL_version(OPENSSL_VERSION))) < 0) |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2652 | exit(1); |
| 2653 | |
| 2654 | exit(0); |
| 2655 | ]])], |
| 2656 | [ |
| 2657 | ssl_library_ver=`cat conftest.ssllibver` |
| 2658 | # Check version is supported. |
| 2659 | case "$ssl_library_ver" in |
Damien Miller | aede1c3 | 2018-10-17 11:01:20 +1100 | [diff] [blame] | 2660 | 10000*|0*) |
| 2661 | AC_MSG_ERROR([OpenSSL >= 1.0.1 required (have "$ssl_library_ver")]) |
| 2662 | ;; |
| 2663 | 100*) ;; # 1.0.x |
Damien Miller | 28c7b2c | 2018-11-23 10:45:20 +1100 | [diff] [blame] | 2664 | 101000[[0123456]]*) |
Damien Miller | aede1c3 | 2018-10-17 11:01:20 +1100 | [diff] [blame] | 2665 | # https://github.com/openssl/openssl/pull/4613 |
| 2666 | AC_MSG_ERROR([OpenSSL 1.1.x versions prior to 1.1.0g have a bug that breaks their use with OpenSSH (have "$ssl_library_ver")]) |
| 2667 | ;; |
| 2668 | 101*) ;; # 1.1.x |
| 2669 | 200*) ;; # LibreSSL |
Darren Tucker | c882d74 | 2019-01-22 20:38:40 +1100 | [diff] [blame] | 2670 | 300*) ;; # OpenSSL development branch. |
Damien Miller | aede1c3 | 2018-10-17 11:01:20 +1100 | [diff] [blame] | 2671 | *) |
Darren Tucker | c882d74 | 2019-01-22 20:38:40 +1100 | [diff] [blame] | 2672 | AC_MSG_ERROR([Unknown/unsupported OpenSSL version ("$ssl_library_ver")]) |
Damien Miller | aede1c3 | 2018-10-17 11:01:20 +1100 | [diff] [blame] | 2673 | ;; |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2674 | esac |
| 2675 | AC_MSG_RESULT([$ssl_library_ver]) |
| 2676 | ], |
| 2677 | [ |
| 2678 | AC_MSG_RESULT([not found]) |
| 2679 | AC_MSG_ERROR([OpenSSL library not found.]) |
| 2680 | ], |
| 2681 | [ |
| 2682 | AC_MSG_WARN([cross compiling: not checking]) |
| 2683 | ] |
| 2684 | ) |
| 2685 | |
| 2686 | # Sanity check OpenSSL headers |
| 2687 | AC_MSG_CHECKING([whether OpenSSL's headers match the library]) |
| 2688 | AC_RUN_IFELSE( |
| 2689 | [AC_LANG_PROGRAM([[ |
| 2690 | #include <string.h> |
| 2691 | #include <openssl/opensslv.h> |
Darren Tucker | c1d7e54 | 2015-12-15 14:27:09 +1100 | [diff] [blame] | 2692 | #include <openssl/crypto.h> |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2693 | ]], [[ |
Darren Tucker | 262d81a | 2018-10-27 16:45:59 +1100 | [diff] [blame] | 2694 | #ifndef HAVE_OPENSSL_VERSION_NUM |
| 2695 | # define OpenSSL_version_num SSLeay |
Damien Miller | 406a24b | 2018-10-26 13:43:28 +1100 | [diff] [blame] | 2696 | #endif |
Damien Miller | 859754b | 2018-10-23 17:10:41 +1100 | [diff] [blame] | 2697 | exit(OpenSSL_version_num() == OPENSSL_VERSION_NUMBER ? 0 : 1); |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2698 | ]])], |
| 2699 | [ |
| 2700 | AC_MSG_RESULT([yes]) |
| 2701 | ], |
| 2702 | [ |
| 2703 | AC_MSG_RESULT([no]) |
| 2704 | if test "x$openssl_check_nonfatal" = "x"; then |
| 2705 | AC_MSG_ERROR([Your OpenSSL headers do not match your |
| 2706 | library. Check config.log for details. |
| 2707 | If you are sure your installation is consistent, you can disable the check |
| 2708 | by running "./configure --without-openssl-header-check". |
| 2709 | Also see contrib/findssl.sh for help identifying header/library mismatches. |
| 2710 | ]) |
| 2711 | else |
| 2712 | AC_MSG_WARN([Your OpenSSL headers do not match your |
| 2713 | library. Check config.log for details. |
| 2714 | Also see contrib/findssl.sh for help identifying header/library mismatches.]) |
| 2715 | fi |
| 2716 | ], |
| 2717 | [ |
| 2718 | AC_MSG_WARN([cross compiling: not checking]) |
| 2719 | ] |
| 2720 | ) |
| 2721 | |
| 2722 | AC_MSG_CHECKING([if programs using OpenSSL functions will link]) |
| 2723 | AC_LINK_IFELSE( |
Damien Miller | 42c5ec4 | 2018-11-23 10:40:06 +1100 | [diff] [blame] | 2724 | [AC_LANG_PROGRAM([[ #include <openssl/err.h> ]], |
| 2725 | [[ ERR_load_crypto_strings(); ]])], |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2726 | [ |
| 2727 | AC_MSG_RESULT([yes]) |
| 2728 | ], |
| 2729 | [ |
| 2730 | AC_MSG_RESULT([no]) |
| 2731 | saved_LIBS="$LIBS" |
| 2732 | LIBS="$LIBS -ldl" |
| 2733 | AC_MSG_CHECKING([if programs using OpenSSL need -ldl]) |
| 2734 | AC_LINK_IFELSE( |
Damien Miller | 42c5ec4 | 2018-11-23 10:40:06 +1100 | [diff] [blame] | 2735 | [AC_LANG_PROGRAM([[ #include <openssl/err.h> ]], |
| 2736 | [[ ERR_load_crypto_strings(); ]])], |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2737 | [ |
| 2738 | AC_MSG_RESULT([yes]) |
| 2739 | ], |
| 2740 | [ |
| 2741 | AC_MSG_RESULT([no]) |
| 2742 | LIBS="$saved_LIBS" |
| 2743 | ] |
| 2744 | ) |
| 2745 | ] |
| 2746 | ) |
| 2747 | |
| 2748 | AC_CHECK_FUNCS([ \ |
| 2749 | BN_is_prime_ex \ |
| 2750 | DSA_generate_parameters_ex \ |
Damien Miller | 42c5ec4 | 2018-11-23 10:40:06 +1100 | [diff] [blame] | 2751 | EVP_CIPHER_CTX_ctrl \ |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2752 | EVP_DigestFinal_ex \ |
Damien Miller | 42c5ec4 | 2018-11-23 10:40:06 +1100 | [diff] [blame] | 2753 | EVP_DigestInit_ex \ |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2754 | EVP_MD_CTX_cleanup \ |
| 2755 | EVP_MD_CTX_copy_ex \ |
Damien Miller | 42c5ec4 | 2018-11-23 10:40:06 +1100 | [diff] [blame] | 2756 | EVP_MD_CTX_init \ |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2757 | HMAC_CTX_init \ |
| 2758 | RSA_generate_key_ex \ |
| 2759 | RSA_get_default_method \ |
Darren Tucker | 1801cd1 | 2018-11-08 15:03:11 +1100 | [diff] [blame] | 2760 | ]) |
Darren Tucker | 98f878d | 2018-11-25 14:05:08 +1100 | [diff] [blame] | 2761 | |
| 2762 | # OpenSSL_add_all_algorithms may be a macro. |
| 2763 | AC_CHECK_FUNC(OpenSSL_add_all_algorithms, |
| 2764 | AC_DEFINE(HAVE_OPENSSL_ADD_ALL_ALGORITHMS, 1, [as a function]), |
| 2765 | AC_CHECK_DECL(OpenSSL_add_all_algorithms, |
| 2766 | AC_DEFINE(HAVE_OPENSSL_ADD_ALL_ALGORITHMS, 1, [as a macro]), , |
| 2767 | [[#include <openssl/evp.h>]] |
| 2768 | ) |
| 2769 | ) |
| 2770 | |
Darren Tucker | 1801cd1 | 2018-11-08 15:03:11 +1100 | [diff] [blame] | 2771 | # LibreSSL/OpenSSL 1.1x API |
| 2772 | AC_CHECK_FUNCS([ \ |
Darren Tucker | d0d1dfa | 2018-11-16 14:11:44 +1100 | [diff] [blame] | 2773 | OPENSSL_init_crypto \ |
Darren Tucker | 1801cd1 | 2018-11-08 15:03:11 +1100 | [diff] [blame] | 2774 | DH_get0_key \ |
| 2775 | DH_get0_pqg \ |
| 2776 | DH_set0_key \ |
| 2777 | DH_set_length \ |
| 2778 | DH_set0_pqg \ |
| 2779 | DSA_get0_key \ |
| 2780 | DSA_get0_pqg \ |
| 2781 | DSA_set0_key \ |
| 2782 | DSA_set0_pqg \ |
| 2783 | DSA_SIG_get0 \ |
| 2784 | DSA_SIG_set0 \ |
| 2785 | ECDSA_SIG_get0 \ |
| 2786 | ECDSA_SIG_set0 \ |
| 2787 | EVP_CIPHER_CTX_iv \ |
| 2788 | EVP_CIPHER_CTX_iv_noconst \ |
| 2789 | EVP_CIPHER_CTX_get_iv \ |
| 2790 | EVP_CIPHER_CTX_set_iv \ |
| 2791 | RSA_get0_crt_params \ |
| 2792 | RSA_get0_factors \ |
| 2793 | RSA_get0_key \ |
| 2794 | RSA_set0_crt_params \ |
| 2795 | RSA_set0_factors \ |
| 2796 | RSA_set0_key \ |
| 2797 | RSA_meth_free \ |
| 2798 | RSA_meth_dup \ |
| 2799 | RSA_meth_set1_name \ |
| 2800 | RSA_meth_get_finish \ |
| 2801 | RSA_meth_set_priv_enc \ |
| 2802 | RSA_meth_set_priv_dec \ |
| 2803 | RSA_meth_set_finish \ |
| 2804 | EVP_PKEY_get0_RSA \ |
| 2805 | EVP_MD_CTX_new \ |
| 2806 | EVP_MD_CTX_free \ |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2807 | ]) |
| 2808 | |
| 2809 | if test "x$openssl_engine" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2810 | AC_MSG_CHECKING([for OpenSSL ENGINE support]) |
| 2811 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2812 | #include <openssl/engine.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2813 | ]], [[ |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2814 | ENGINE_load_builtin_engines(); |
| 2815 | ENGINE_register_all_complete(); |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2816 | ]])], |
| 2817 | [ AC_MSG_RESULT([yes]) |
| 2818 | AC_DEFINE([USE_OPENSSL_ENGINE], [1], |
Darren Tucker | fabdb6c | 2006-02-20 20:17:35 +1100 | [diff] [blame] | 2819 | [Enable OpenSSL engine support]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 2820 | ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found]) |
| 2821 | ]) |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2822 | fi |
Darren Tucker | fabdb6c | 2006-02-20 20:17:35 +1100 | [diff] [blame] | 2823 | |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2824 | # Check for OpenSSL without EVP_aes_{192,256}_cbc |
| 2825 | AC_MSG_CHECKING([whether OpenSSL has crippled AES support]) |
| 2826 | AC_LINK_IFELSE( |
Darren Tucker | 37bcef5 | 2013-11-09 18:39:25 +1100 | [diff] [blame] | 2827 | [AC_LANG_PROGRAM([[ |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2828 | #include <string.h> |
| 2829 | #include <openssl/evp.h> |
| 2830 | ]], [[ |
| 2831 | exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL); |
| 2832 | ]])], |
| 2833 | [ |
| 2834 | AC_MSG_RESULT([no]) |
| 2835 | ], |
| 2836 | [ |
| 2837 | AC_MSG_RESULT([yes]) |
| 2838 | AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1], |
| 2839 | [libcrypto is missing AES 192 and 256 bit functions]) |
| 2840 | ] |
| 2841 | ) |
| 2842 | |
| 2843 | # Check for OpenSSL with EVP_aes_*ctr |
| 2844 | AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP]) |
| 2845 | AC_LINK_IFELSE( |
| 2846 | [AC_LANG_PROGRAM([[ |
| 2847 | #include <string.h> |
| 2848 | #include <openssl/evp.h> |
| 2849 | ]], [[ |
| 2850 | exit(EVP_aes_128_ctr() == NULL || |
| 2851 | EVP_aes_192_cbc() == NULL || |
| 2852 | EVP_aes_256_cbc() == NULL); |
| 2853 | ]])], |
| 2854 | [ |
| 2855 | AC_MSG_RESULT([yes]) |
| 2856 | AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1], |
| 2857 | [libcrypto has EVP AES CTR]) |
| 2858 | ], |
| 2859 | [ |
| 2860 | AC_MSG_RESULT([no]) |
| 2861 | ] |
| 2862 | ) |
| 2863 | |
| 2864 | # Check for OpenSSL with EVP_aes_*gcm |
| 2865 | AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP]) |
| 2866 | AC_LINK_IFELSE( |
| 2867 | [AC_LANG_PROGRAM([[ |
| 2868 | #include <string.h> |
| 2869 | #include <openssl/evp.h> |
| 2870 | ]], [[ |
| 2871 | exit(EVP_aes_128_gcm() == NULL || |
| 2872 | EVP_aes_256_gcm() == NULL || |
| 2873 | EVP_CTRL_GCM_SET_IV_FIXED == 0 || |
| 2874 | EVP_CTRL_GCM_IV_GEN == 0 || |
| 2875 | EVP_CTRL_GCM_SET_TAG == 0 || |
| 2876 | EVP_CTRL_GCM_GET_TAG == 0 || |
| 2877 | EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0); |
| 2878 | ]])], |
| 2879 | [ |
| 2880 | AC_MSG_RESULT([yes]) |
| 2881 | AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1], |
| 2882 | [libcrypto has EVP AES GCM]) |
| 2883 | ], |
| 2884 | [ |
| 2885 | AC_MSG_RESULT([no]) |
| 2886 | unsupported_algorithms="$unsupported_cipers \ |
Damien Miller | 679ce88 | 2016-07-15 13:44:38 +1000 | [diff] [blame] | 2887 | aes128-gcm@openssh.com \ |
| 2888 | aes256-gcm@openssh.com" |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2889 | ] |
| 2890 | ) |
| 2891 | |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2892 | AC_MSG_CHECKING([if EVP_DigestUpdate returns an int]) |
| 2893 | AC_LINK_IFELSE( |
| 2894 | [AC_LANG_PROGRAM([[ |
| 2895 | #include <string.h> |
| 2896 | #include <openssl/evp.h> |
| 2897 | ]], [[ |
| 2898 | if(EVP_DigestUpdate(NULL, NULL,0)) |
| 2899 | exit(0); |
| 2900 | ]])], |
| 2901 | [ |
| 2902 | AC_MSG_RESULT([yes]) |
| 2903 | ], |
| 2904 | [ |
| 2905 | AC_MSG_RESULT([no]) |
| 2906 | AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1], |
| 2907 | [Define if EVP_DigestUpdate returns void]) |
| 2908 | ] |
| 2909 | ) |
| 2910 | |
| 2911 | # Some systems want crypt() from libcrypt, *not* the version in OpenSSL, |
| 2912 | # because the system crypt() is more featureful. |
| 2913 | if test "x$check_for_libcrypt_before" = "x1"; then |
| 2914 | AC_CHECK_LIB([crypt], [crypt]) |
| 2915 | fi |
| 2916 | |
| 2917 | # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the |
| 2918 | # version in OpenSSL. |
| 2919 | if test "x$check_for_libcrypt_later" = "x1"; then |
| 2920 | AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"]) |
| 2921 | fi |
Damien Miller | 00797e8 | 2015-03-04 05:02:45 +1100 | [diff] [blame] | 2922 | AC_CHECK_FUNCS([crypt DES_crypt]) |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2923 | |
Darren Tucker | 11cba2a | 2019-07-23 21:51:22 +1000 | [diff] [blame] | 2924 | # Check for SHA256, SHA384 and SHA512 support in OpenSSL |
| 2925 | AC_CHECK_FUNCS([EVP_sha256 EVP_sha384 EVP_sha512]) |
| 2926 | |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2927 | # Check complete ECC support in OpenSSL |
| 2928 | AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1]) |
| 2929 | AC_LINK_IFELSE( |
| 2930 | [AC_LANG_PROGRAM([[ |
| 2931 | #include <openssl/ec.h> |
| 2932 | #include <openssl/ecdh.h> |
| 2933 | #include <openssl/ecdsa.h> |
| 2934 | #include <openssl/evp.h> |
| 2935 | #include <openssl/objects.h> |
| 2936 | #include <openssl/opensslv.h> |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2937 | ]], [[ |
| 2938 | EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); |
| 2939 | const EVP_MD *m = EVP_sha256(); /* We need this too */ |
Darren Tucker | 37bcef5 | 2013-11-09 18:39:25 +1100 | [diff] [blame] | 2940 | ]])], |
| 2941 | [ AC_MSG_RESULT([yes]) |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2942 | enable_nistp256=1 ], |
| 2943 | [ AC_MSG_RESULT([no]) ] |
| 2944 | ) |
Darren Tucker | 37bcef5 | 2013-11-09 18:39:25 +1100 | [diff] [blame] | 2945 | |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2946 | AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1]) |
| 2947 | AC_LINK_IFELSE( |
| 2948 | [AC_LANG_PROGRAM([[ |
| 2949 | #include <openssl/ec.h> |
| 2950 | #include <openssl/ecdh.h> |
| 2951 | #include <openssl/ecdsa.h> |
| 2952 | #include <openssl/evp.h> |
| 2953 | #include <openssl/objects.h> |
| 2954 | #include <openssl/opensslv.h> |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2955 | ]], [[ |
| 2956 | EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1); |
| 2957 | const EVP_MD *m = EVP_sha384(); /* We need this too */ |
| 2958 | ]])], |
| 2959 | [ AC_MSG_RESULT([yes]) |
| 2960 | enable_nistp384=1 ], |
| 2961 | [ AC_MSG_RESULT([no]) ] |
| 2962 | ) |
Darren Tucker | 37bcef5 | 2013-11-09 18:39:25 +1100 | [diff] [blame] | 2963 | |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2964 | AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1]) |
| 2965 | AC_LINK_IFELSE( |
| 2966 | [AC_LANG_PROGRAM([[ |
| 2967 | #include <openssl/ec.h> |
| 2968 | #include <openssl/ecdh.h> |
| 2969 | #include <openssl/ecdsa.h> |
| 2970 | #include <openssl/evp.h> |
| 2971 | #include <openssl/objects.h> |
| 2972 | #include <openssl/opensslv.h> |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 2973 | ]], [[ |
| 2974 | EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1); |
| 2975 | const EVP_MD *m = EVP_sha512(); /* We need this too */ |
| 2976 | ]])], |
| 2977 | [ AC_MSG_RESULT([yes]) |
| 2978 | AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional]) |
| 2979 | AC_RUN_IFELSE( |
| 2980 | [AC_LANG_PROGRAM([[ |
| 2981 | #include <openssl/ec.h> |
| 2982 | #include <openssl/ecdh.h> |
| 2983 | #include <openssl/ecdsa.h> |
| 2984 | #include <openssl/evp.h> |
| 2985 | #include <openssl/objects.h> |
| 2986 | #include <openssl/opensslv.h> |
| 2987 | ]],[[ |
| 2988 | EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1); |
| 2989 | const EVP_MD *m = EVP_sha512(); /* We need this too */ |
| 2990 | exit(e == NULL || m == NULL); |
| 2991 | ]])], |
| 2992 | [ AC_MSG_RESULT([yes]) |
| 2993 | enable_nistp521=1 ], |
| 2994 | [ AC_MSG_RESULT([no]) ], |
| 2995 | [ AC_MSG_WARN([cross-compiling: assuming yes]) |
| 2996 | enable_nistp521=1 ] |
| 2997 | )], |
| 2998 | AC_MSG_RESULT([no]) |
| 2999 | ) |
Darren Tucker | 37bcef5 | 2013-11-09 18:39:25 +1100 | [diff] [blame] | 3000 | |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 3001 | COMMENT_OUT_ECC="#no ecc#" |
| 3002 | TEST_SSH_ECC=no |
| 3003 | |
| 3004 | if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \ |
| 3005 | test x$enable_nistp521 = x1; then |
| 3006 | AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC]) |
Damien Miller | e2cb445 | 2019-01-21 11:32:28 +1100 | [diff] [blame] | 3007 | AC_CHECK_FUNCS([EC_KEY_METHOD_new]) |
Darren Tucker | f5cc581 | 2019-11-02 16:39:38 +1100 | [diff] [blame] | 3008 | openssl_ecc=yes |
| 3009 | else |
| 3010 | openssl_ecc=no |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 3011 | fi |
| 3012 | if test x$enable_nistp256 = x1; then |
| 3013 | AC_DEFINE([OPENSSL_HAS_NISTP256], [1], |
| 3014 | [libcrypto has NID_X9_62_prime256v1]) |
| 3015 | TEST_SSH_ECC=yes |
| 3016 | COMMENT_OUT_ECC="" |
| 3017 | else |
Damien Miller | 679ce88 | 2016-07-15 13:44:38 +1000 | [diff] [blame] | 3018 | unsupported_algorithms="$unsupported_algorithms \ |
| 3019 | ecdsa-sha2-nistp256 \ |
| 3020 | ecdh-sha2-nistp256 \ |
| 3021 | ecdsa-sha2-nistp256-cert-v01@openssh.com" |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 3022 | fi |
| 3023 | if test x$enable_nistp384 = x1; then |
| 3024 | AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1]) |
| 3025 | TEST_SSH_ECC=yes |
| 3026 | COMMENT_OUT_ECC="" |
| 3027 | else |
Damien Miller | 679ce88 | 2016-07-15 13:44:38 +1000 | [diff] [blame] | 3028 | unsupported_algorithms="$unsupported_algorithms \ |
| 3029 | ecdsa-sha2-nistp384 \ |
| 3030 | ecdh-sha2-nistp384 \ |
| 3031 | ecdsa-sha2-nistp384-cert-v01@openssh.com" |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 3032 | fi |
| 3033 | if test x$enable_nistp521 = x1; then |
| 3034 | AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1]) |
| 3035 | TEST_SSH_ECC=yes |
| 3036 | COMMENT_OUT_ECC="" |
| 3037 | else |
Damien Miller | 679ce88 | 2016-07-15 13:44:38 +1000 | [diff] [blame] | 3038 | unsupported_algorithms="$unsupported_algorithms \ |
| 3039 | ecdh-sha2-nistp521 \ |
| 3040 | ecdsa-sha2-nistp521 \ |
| 3041 | ecdsa-sha2-nistp521-cert-v01@openssh.com" |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 3042 | fi |
| 3043 | |
| 3044 | AC_SUBST([TEST_SSH_ECC]) |
| 3045 | AC_SUBST([COMMENT_OUT_ECC]) |
| 3046 | else |
| 3047 | AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"]) |
Damien Miller | 00797e8 | 2015-03-04 05:02:45 +1100 | [diff] [blame] | 3048 | AC_CHECK_FUNCS([crypt]) |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 3049 | fi |
Damien Miller | 6af914a | 2010-09-10 11:39:26 +1000 | [diff] [blame] | 3050 | |
Darren Tucker | f5cc581 | 2019-11-02 16:39:38 +1100 | [diff] [blame] | 3051 | # PKCS11/U2F depend on OpenSSL and dlopen(). |
| 3052 | enable_pkcs11=yes |
| 3053 | enable_sk=yes |
| 3054 | if test "x$openssl" != "xyes" ; then |
| 3055 | enable_pkcs11="disabled; missing libcrypto" |
| 3056 | enable_sk="disabled; missing libcrypto" |
| 3057 | fi |
| 3058 | if test "x$openssl_ecc" != "xyes" ; then |
| 3059 | enable_sk="disabled; OpenSSL has no ECC support" |
| 3060 | fi |
| 3061 | if test "x$ac_cv_func_dlopen" != "xyes" ; then |
| 3062 | enable_pkcs11="disabled; missing dlopen(3)" |
| 3063 | enable_sk="disabled; missing dlopen(3)" |
| 3064 | fi |
| 3065 | if test "x$ac_cv_have_decl_RTLD_NOW" != "xyes" ; then |
| 3066 | enable_pkcs11="disabled; missing RTLD_NOW" |
| 3067 | enable_sk="disabled; missing RTLD_NOW" |
| 3068 | fi |
| 3069 | if test ! -z "$disable_pkcs11" ; then |
| 3070 | enable_pkcs11="disabled by user" |
| 3071 | fi |
| 3072 | if test ! -z "$disable_sk" ; then |
| 3073 | enable_sk="disabled by user" |
| 3074 | fi |
| 3075 | |
| 3076 | AC_MSG_CHECKING([whether to enable PKCS11]) |
| 3077 | if test "x$enable_pkcs11" = "xyes" ; then |
| 3078 | AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support]) |
| 3079 | fi |
| 3080 | AC_MSG_RESULT([$enable_pkcs11]) |
| 3081 | |
| 3082 | AC_MSG_CHECKING([whether to enable U2F]) |
| 3083 | if test "x$enable_sk" = "xyes" ; then |
| 3084 | AC_DEFINE([ENABLE_SK], [], [Enable for U2F/FIDO support]) |
| 3085 | fi |
| 3086 | AC_MSG_RESULT([$enable_sk]) |
| 3087 | |
djm@openbsd.org | 6bff952 | 2019-11-14 21:27:29 +0000 | [diff] [blame] | 3088 | # Now check for built-in security key support. |
Damien Miller | 5c0bc27 | 2019-11-15 16:08:00 +1100 | [diff] [blame] | 3089 | if test "x$enable_sk" = "xyes" -a "x$enable_sk_internal" = "xyes" ; then |
djm@openbsd.org | 6bff952 | 2019-11-14 21:27:29 +0000 | [diff] [blame] | 3090 | AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no]) |
| 3091 | use_pkgconfig_for_libfido2= |
| 3092 | if test "x$PKGCONFIG" != "xno"; then |
| 3093 | AC_MSG_CHECKING([if $PKGCONFIG knows about libfido2]) |
| 3094 | if "$PKGCONFIG" libfido2; then |
| 3095 | AC_MSG_RESULT([yes]) |
| 3096 | use_pkgconfig_for_libfido2=yes |
| 3097 | else |
| 3098 | AC_MSG_RESULT([no]) |
| 3099 | fi |
| 3100 | fi |
| 3101 | if test "x$use_pkgconfig_for_libfido2" = "xyes"; then |
| 3102 | LIBFIDO2=`$PKGCONFIG --libs libfido2` |
| 3103 | CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libfido2`" |
| 3104 | else |
| 3105 | LIBFIDO2="-lfido2 -lcbor" |
| 3106 | fi |
| 3107 | OTHERLIBS=`echo $LIBFIDO2 | sed 's/-lfido2//'` |
| 3108 | AC_CHECK_LIB([fido2], [fido_init], |
| 3109 | [ |
djm@openbsd.org | 6bff952 | 2019-11-14 21:27:29 +0000 | [diff] [blame] | 3110 | AC_SUBST([LIBFIDO2]) |
| 3111 | AC_DEFINE([ENABLE_SK_INTERNAL], [], |
| 3112 | [Enable for built-in U2F/FIDO support]) |
| 3113 | enable_sk="built-in" |
djm@openbsd.org | d081f01 | 2020-03-13 03:17:07 +0000 | [diff] [blame] | 3114 | ], [ AC_MSG_ERROR([no usable libfido2 found]) ], |
djm@openbsd.org | 6bff952 | 2019-11-14 21:27:29 +0000 | [diff] [blame] | 3115 | [ $OTHERLIBS ] |
| 3116 | ) |
djm@openbsd.org | d081f01 | 2020-03-13 03:17:07 +0000 | [diff] [blame] | 3117 | AC_CHECK_HEADER([fido.h], [], |
| 3118 | AC_MSG_ERROR([missing fido.h from libfido2])) |
| 3119 | AC_CHECK_HEADER([fido/credman.h], [], |
Darren Tucker | 0eaca93 | 2020-03-14 20:58:46 +1100 | [diff] [blame] | 3120 | AC_MSG_ERROR([missing fido/credman.h from libfido2]), |
| 3121 | [#include <fido.h>] |
| 3122 | ) |
djm@openbsd.org | 6bff952 | 2019-11-14 21:27:29 +0000 | [diff] [blame] | 3123 | fi |
| 3124 | |
Damien Miller | 00f9cd2 | 2014-07-15 10:41:38 +1000 | [diff] [blame] | 3125 | AC_CHECK_FUNCS([ \ |
| 3126 | arc4random \ |
| 3127 | arc4random_buf \ |
| 3128 | arc4random_stir \ |
| 3129 | arc4random_uniform \ |
| 3130 | ]) |
| 3131 | |
Tim Rice | 99203ec | 2007-03-26 09:35:28 -0700 | [diff] [blame] | 3132 | saved_LIBS="$LIBS" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3133 | AC_CHECK_LIB([iaf], [ia_openinfo], [ |
Tim Rice | 99203ec | 2007-03-26 09:35:28 -0700 | [diff] [blame] | 3134 | LIBS="$LIBS -liaf" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3135 | AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf" |
| 3136 | AC_DEFINE([HAVE_LIBIAF], [1], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3137 | [Define if system has libiaf that supports set_id]) |
Tim Rice | 0eeaf12 | 2007-09-10 16:24:17 -0700 | [diff] [blame] | 3138 | ]) |
Tim Rice | 99203ec | 2007-03-26 09:35:28 -0700 | [diff] [blame] | 3139 | ]) |
| 3140 | LIBS="$saved_LIBS" |
Damien Miller | 6c21c51 | 2002-01-22 21:57:53 +1100 | [diff] [blame] | 3141 | |
| 3142 | ### Configure cryptographic random number support |
| 3143 | |
Damien Miller | 10479cc | 2018-04-10 10:19:02 +1000 | [diff] [blame] | 3144 | # Check whether OpenSSL seeds itself |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 3145 | if test "x$openssl" = "xyes" ; then |
| 3146 | AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded]) |
| 3147 | AC_RUN_IFELSE( |
| 3148 | [AC_LANG_PROGRAM([[ |
| 3149 | #include <string.h> |
| 3150 | #include <openssl/rand.h> |
| 3151 | ]], [[ |
| 3152 | exit(RAND_status() == 1 ? 0 : 1); |
| 3153 | ]])], |
| 3154 | [ |
| 3155 | OPENSSL_SEEDS_ITSELF=yes |
| 3156 | AC_MSG_RESULT([yes]) |
| 3157 | ], |
| 3158 | [ |
| 3159 | AC_MSG_RESULT([no]) |
| 3160 | ], |
| 3161 | [ |
| 3162 | AC_MSG_WARN([cross compiling: assuming yes]) |
| 3163 | # This is safe, since we will fatal() at runtime if |
| 3164 | # OpenSSL is not seeded correctly. |
| 3165 | OPENSSL_SEEDS_ITSELF=yes |
| 3166 | ] |
| 3167 | ) |
| 3168 | fi |
Damien Miller | 6c21c51 | 2002-01-22 21:57:53 +1100 | [diff] [blame] | 3169 | |
Damien Miller | f22019b | 2011-05-05 13:48:37 +1000 | [diff] [blame] | 3170 | # PRNGD TCP socket |
| 3171 | AC_ARG_WITH([prngd-port], |
| 3172 | [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT], |
| 3173 | [ |
| 3174 | case "$withval" in |
| 3175 | no) |
| 3176 | withval="" |
| 3177 | ;; |
| 3178 | [[0-9]]*) |
| 3179 | ;; |
| 3180 | *) |
| 3181 | AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port]) |
| 3182 | ;; |
| 3183 | esac |
| 3184 | if test ! -z "$withval" ; then |
| 3185 | PRNGD_PORT="$withval" |
| 3186 | AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT], |
| 3187 | [Port number of PRNGD/EGD random number socket]) |
| 3188 | fi |
| 3189 | ] |
| 3190 | ) |
| 3191 | |
| 3192 | # PRNGD Unix domain socket |
| 3193 | AC_ARG_WITH([prngd-socket], |
| 3194 | [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)], |
| 3195 | [ |
| 3196 | case "$withval" in |
| 3197 | yes) |
| 3198 | withval="/var/run/egd-pool" |
| 3199 | ;; |
| 3200 | no) |
| 3201 | withval="" |
| 3202 | ;; |
| 3203 | /*) |
| 3204 | ;; |
| 3205 | *) |
| 3206 | AC_MSG_ERROR([You must specify an absolute path to the entropy socket]) |
| 3207 | ;; |
| 3208 | esac |
| 3209 | |
| 3210 | if test ! -z "$withval" ; then |
| 3211 | if test ! -z "$PRNGD_PORT" ; then |
| 3212 | AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket]) |
| 3213 | fi |
| 3214 | if test ! -r "$withval" ; then |
| 3215 | AC_MSG_WARN([Entropy socket is not readable]) |
| 3216 | fi |
| 3217 | PRNGD_SOCKET="$withval" |
| 3218 | AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"], |
| 3219 | [Location of PRNGD/EGD random number socket]) |
| 3220 | fi |
| 3221 | ], |
| 3222 | [ |
| 3223 | # Check for existing socket only if we don't have a random device already |
| 3224 | if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then |
| 3225 | AC_MSG_CHECKING([for PRNGD/EGD socket]) |
| 3226 | # Insert other locations here |
| 3227 | for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do |
| 3228 | if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then |
| 3229 | PRNGD_SOCKET="$sock" |
| 3230 | AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"]) |
| 3231 | break; |
| 3232 | fi |
| 3233 | done |
| 3234 | if test ! -z "$PRNGD_SOCKET" ; then |
| 3235 | AC_MSG_RESULT([$PRNGD_SOCKET]) |
| 3236 | else |
| 3237 | AC_MSG_RESULT([not found]) |
| 3238 | fi |
| 3239 | fi |
| 3240 | ] |
| 3241 | ) |
| 3242 | |
| 3243 | # Which randomness source do we use? |
| 3244 | if test ! -z "$PRNGD_PORT" ; then |
| 3245 | RAND_MSG="PRNGd port $PRNGD_PORT" |
| 3246 | elif test ! -z "$PRNGD_SOCKET" ; then |
| 3247 | RAND_MSG="PRNGd socket $PRNGD_SOCKET" |
| 3248 | elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then |
| 3249 | AC_DEFINE([OPENSSL_PRNG_ONLY], [1], |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 3250 | [Define if you want the OpenSSL internally seeded PRNG only]) |
Damien Miller | f22019b | 2011-05-05 13:48:37 +1000 | [diff] [blame] | 3251 | RAND_MSG="OpenSSL internal ONLY" |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 3252 | elif test "x$openssl" = "xno" ; then |
| 3253 | AC_MSG_WARN([OpenSSH will use /dev/urandom as a source of random numbers. It will fail if this device is not supported or accessible]) |
Damien Miller | f22019b | 2011-05-05 13:48:37 +1000 | [diff] [blame] | 3254 | else |
| 3255 | AC_MSG_ERROR([OpenSSH has no source of random numbers. Please configure OpenSSL with an entropy source or re-run configure using one of the --with-prngd-port or --with-prngd-socket options]) |
| 3256 | fi |
| 3257 | |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3258 | # Check for PAM libs |
| 3259 | PAM_MSG="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3260 | AC_ARG_WITH([pam], |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3261 | [ --with-pam Enable PAM support ], |
| 3262 | [ |
| 3263 | if test "x$withval" != "xno" ; then |
| 3264 | if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \ |
| 3265 | test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then |
| 3266 | AC_MSG_ERROR([PAM headers not found]) |
| 3267 | fi |
| 3268 | |
| 3269 | saved_LIBS="$LIBS" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3270 | AC_CHECK_LIB([dl], [dlopen], , ) |
| 3271 | AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])]) |
| 3272 | AC_CHECK_FUNCS([pam_getenvlist]) |
| 3273 | AC_CHECK_FUNCS([pam_putenv]) |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3274 | LIBS="$saved_LIBS" |
| 3275 | |
| 3276 | PAM_MSG="yes" |
| 3277 | |
Darren Tucker | 20e9f97 | 2007-03-25 18:26:01 +1000 | [diff] [blame] | 3278 | SSHDLIBS="$SSHDLIBS -lpam" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3279 | AC_DEFINE([USE_PAM], [1], |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3280 | [Define if you want to enable PAM support]) |
Darren Tucker | 639bbe8 | 2006-08-20 20:17:53 +1000 | [diff] [blame] | 3281 | |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3282 | if test $ac_cv_lib_dl_dlopen = yes; then |
Darren Tucker | 639bbe8 | 2006-08-20 20:17:53 +1000 | [diff] [blame] | 3283 | case "$LIBS" in |
| 3284 | *-ldl*) |
| 3285 | # libdl already in LIBS |
| 3286 | ;; |
| 3287 | *) |
Darren Tucker | 20e9f97 | 2007-03-25 18:26:01 +1000 | [diff] [blame] | 3288 | SSHDLIBS="$SSHDLIBS -ldl" |
Darren Tucker | 639bbe8 | 2006-08-20 20:17:53 +1000 | [diff] [blame] | 3289 | ;; |
| 3290 | esac |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3291 | fi |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3292 | fi |
| 3293 | ] |
| 3294 | ) |
| 3295 | |
Damien Miller | 8bd81e1 | 2016-08-16 13:30:56 +1000 | [diff] [blame] | 3296 | AC_ARG_WITH([pam-service], |
| 3297 | [ --with-pam-service=name Specify PAM service name ], |
| 3298 | [ |
| 3299 | if test "x$withval" != "xno" && \ |
| 3300 | test "x$withval" != "xyes" ; then |
| 3301 | AC_DEFINE_UNQUOTED([SSHD_PAM_SERVICE], |
| 3302 | ["$withval"], [sshd PAM service name]) |
| 3303 | fi |
| 3304 | ] |
| 3305 | ) |
| 3306 | |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3307 | # Check for older PAM |
| 3308 | if test "x$PAM_MSG" = "xyes" ; then |
| 3309 | # Check PAM strerror arguments (old PAM) |
| 3310 | AC_MSG_CHECKING([whether pam_strerror takes only one argument]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3311 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3312 | #include <stdlib.h> |
| 3313 | #if defined(HAVE_SECURITY_PAM_APPL_H) |
| 3314 | #include <security/pam_appl.h> |
| 3315 | #elif defined (HAVE_PAM_PAM_APPL_H) |
| 3316 | #include <pam/pam_appl.h> |
| 3317 | #endif |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3318 | ]], [[ |
| 3319 | (void)pam_strerror((pam_handle_t *)NULL, -1); |
| 3320 | ]])], [AC_MSG_RESULT([no])], [ |
| 3321 | AC_DEFINE([HAVE_OLD_PAM], [1], |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3322 | [Define if you have an old version of PAM |
| 3323 | which takes only one argument to pam_strerror]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3324 | AC_MSG_RESULT([yes]) |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3325 | PAM_MSG="yes (old library)" |
Damien Miller | 72ef7c1 | 2015-01-15 02:21:31 +1100 | [diff] [blame] | 3326 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3327 | ]) |
Darren Tucker | 3e6bde4 | 2006-08-20 20:03:50 +1000 | [diff] [blame] | 3328 | fi |
Damien Miller | 6c21c51 | 2002-01-22 21:57:53 +1100 | [diff] [blame] | 3329 | |
Damien Miller | 6482d90 | 2014-05-27 14:34:42 +1000 | [diff] [blame] | 3330 | case "$host" in |
| 3331 | *-*-cygwin*) |
| 3332 | SSH_PRIVSEP_USER=CYGWIN_SSH_PRIVSEP_USER |
| 3333 | ;; |
| 3334 | *) |
| 3335 | SSH_PRIVSEP_USER=sshd |
| 3336 | ;; |
| 3337 | esac |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3338 | AC_ARG_WITH([privsep-user], |
Kevin Steves | c81e129 | 2002-05-13 03:51:40 +0000 | [diff] [blame] | 3339 | [ --with-privsep-user=user Specify non-privileged user for privilege separation], |
Kevin Steves | 7ff9112 | 2002-04-07 19:22:54 +0000 | [diff] [blame] | 3340 | [ |
Tim Rice | 35cc69d | 2005-03-17 16:44:25 -0800 | [diff] [blame] | 3341 | if test -n "$withval" && test "x$withval" != "xno" && \ |
| 3342 | test "x${withval}" != "xyes"; then |
Damien Miller | d3f6ad2 | 2002-06-25 10:24:47 +1000 | [diff] [blame] | 3343 | SSH_PRIVSEP_USER=$withval |
Kevin Steves | 7ff9112 | 2002-04-07 19:22:54 +0000 | [diff] [blame] | 3344 | fi |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 3345 | ] |
Kevin Steves | 7ff9112 | 2002-04-07 19:22:54 +0000 | [diff] [blame] | 3346 | ) |
Damien Miller | 6482d90 | 2014-05-27 14:34:42 +1000 | [diff] [blame] | 3347 | if test "x$SSH_PRIVSEP_USER" = "xCYGWIN_SSH_PRIVSEP_USER" ; then |
| 3348 | AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], [CYGWIN_SSH_PRIVSEP_USER], |
| 3349 | [Cygwin function to fetch non-privileged user for privilege separation]) |
| 3350 | else |
| 3351 | AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"], |
| 3352 | [non-privileged user for privilege separation]) |
| 3353 | fi |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3354 | AC_SUBST([SSH_PRIVSEP_USER]) |
Kevin Steves | 7ff9112 | 2002-04-07 19:22:54 +0000 | [diff] [blame] | 3355 | |
Damien Miller | 91f40d8 | 2013-02-22 11:37:00 +1100 | [diff] [blame] | 3356 | if test "x$have_linux_no_new_privs" = "x1" ; then |
| 3357 | AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [ |
| 3358 | #include <sys/types.h> |
| 3359 | #include <linux/seccomp.h> |
| 3360 | ]) |
| 3361 | fi |
| 3362 | if test "x$have_seccomp_filter" = "x1" ; then |
| 3363 | AC_MSG_CHECKING([kernel for seccomp_filter support]) |
| 3364 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 3365 | #include <errno.h> |
| 3366 | #include <elf.h> |
| 3367 | #include <linux/audit.h> |
| 3368 | #include <linux/seccomp.h> |
| 3369 | #include <stdlib.h> |
| 3370 | #include <sys/prctl.h> |
| 3371 | ]], |
| 3372 | [[ int i = $seccomp_audit_arch; |
| 3373 | errno = 0; |
| 3374 | prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0); |
| 3375 | exit(errno == EFAULT ? 0 : 1); ]])], |
| 3376 | [ AC_MSG_RESULT([yes]) ], [ |
| 3377 | AC_MSG_RESULT([no]) |
| 3378 | # Disable seccomp filter as a target |
| 3379 | have_seccomp_filter=0 |
| 3380 | ] |
| 3381 | ) |
| 3382 | fi |
| 3383 | |
Damien Miller | 69ff1df | 2011-06-23 08:30:03 +1000 | [diff] [blame] | 3384 | # Decide which sandbox style to use |
| 3385 | sandbox_arg="" |
| 3386 | AC_ARG_WITH([sandbox], |
deraadt@openbsd.org | 2539dce | 2015-10-09 01:37:08 +0000 | [diff] [blame] | 3387 | [ --with-sandbox=style Specify privilege separation sandbox (no, capsicum, darwin, rlimit, seccomp_filter, systrace, pledge)], |
Damien Miller | 69ff1df | 2011-06-23 08:30:03 +1000 | [diff] [blame] | 3388 | [ |
| 3389 | if test "x$withval" = "xyes" ; then |
| 3390 | sandbox_arg="" |
| 3391 | else |
| 3392 | sandbox_arg="$withval" |
| 3393 | fi |
| 3394 | ] |
| 3395 | ) |
Darren Tucker | 60395f9 | 2012-07-03 14:31:18 +1000 | [diff] [blame] | 3396 | |
| 3397 | # Some platforms (seems to be the ones that have a kernel poll(2)-type |
| 3398 | # function with which they implement select(2)) use an extra file descriptor |
| 3399 | # when calling select(2), which means we can't use the rlimit sandbox. |
| 3400 | AC_MSG_CHECKING([if select works with descriptor rlimit]) |
| 3401 | AC_RUN_IFELSE( |
| 3402 | [AC_LANG_PROGRAM([[ |
| 3403 | #include <sys/types.h> |
| 3404 | #ifdef HAVE_SYS_TIME_H |
| 3405 | # include <sys/time.h> |
| 3406 | #endif |
| 3407 | #include <sys/resource.h> |
| 3408 | #ifdef HAVE_SYS_SELECT_H |
| 3409 | # include <sys/select.h> |
| 3410 | #endif |
| 3411 | #include <errno.h> |
| 3412 | #include <fcntl.h> |
| 3413 | #include <stdlib.h> |
| 3414 | ]],[[ |
| 3415 | struct rlimit rl_zero; |
| 3416 | int fd, r; |
| 3417 | fd_set fds; |
Damien Miller | e4f4347 | 2013-03-08 12:14:22 +1100 | [diff] [blame] | 3418 | struct timeval tv; |
Darren Tucker | 60395f9 | 2012-07-03 14:31:18 +1000 | [diff] [blame] | 3419 | |
| 3420 | fd = open("/dev/null", O_RDONLY); |
| 3421 | FD_ZERO(&fds); |
| 3422 | FD_SET(fd, &fds); |
| 3423 | rl_zero.rlim_cur = rl_zero.rlim_max = 0; |
| 3424 | setrlimit(RLIMIT_FSIZE, &rl_zero); |
| 3425 | setrlimit(RLIMIT_NOFILE, &rl_zero); |
Damien Miller | e4f4347 | 2013-03-08 12:14:22 +1100 | [diff] [blame] | 3426 | tv.tv_sec = 1; |
| 3427 | tv.tv_usec = 0; |
| 3428 | r = select(fd+1, &fds, NULL, NULL, &tv); |
Darren Tucker | 60395f9 | 2012-07-03 14:31:18 +1000 | [diff] [blame] | 3429 | exit (r == -1 ? 1 : 0); |
| 3430 | ]])], |
| 3431 | [AC_MSG_RESULT([yes]) |
| 3432 | select_works_with_rlimit=yes], |
| 3433 | [AC_MSG_RESULT([no]) |
| 3434 | select_works_with_rlimit=no], |
Mike Frysinger | dcc714c | 2017-05-24 23:21:19 -0400 | [diff] [blame] | 3435 | [AC_MSG_WARN([cross compiling: assuming yes]) |
| 3436 | select_works_with_rlimit=yes] |
Darren Tucker | 60395f9 | 2012-07-03 14:31:18 +1000 | [diff] [blame] | 3437 | ) |
| 3438 | |
Darren Tucker | ff008de | 2013-03-06 17:48:48 +1100 | [diff] [blame] | 3439 | AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works]) |
| 3440 | AC_RUN_IFELSE( |
| 3441 | [AC_LANG_PROGRAM([[ |
| 3442 | #include <sys/types.h> |
| 3443 | #ifdef HAVE_SYS_TIME_H |
| 3444 | # include <sys/time.h> |
| 3445 | #endif |
| 3446 | #include <sys/resource.h> |
| 3447 | #include <errno.h> |
| 3448 | #include <stdlib.h> |
| 3449 | ]],[[ |
| 3450 | struct rlimit rl_zero; |
Darren Tucker | 34e87fb | 2019-04-30 12:27:57 +1000 | [diff] [blame] | 3451 | int r; |
Darren Tucker | ff008de | 2013-03-06 17:48:48 +1100 | [diff] [blame] | 3452 | |
| 3453 | rl_zero.rlim_cur = rl_zero.rlim_max = 0; |
| 3454 | r = setrlimit(RLIMIT_NOFILE, &rl_zero); |
| 3455 | exit (r == -1 ? 1 : 0); |
| 3456 | ]])], |
| 3457 | [AC_MSG_RESULT([yes]) |
| 3458 | rlimit_nofile_zero_works=yes], |
| 3459 | [AC_MSG_RESULT([no]) |
| 3460 | rlimit_nofile_zero_works=no], |
Mike Frysinger | dcc714c | 2017-05-24 23:21:19 -0400 | [diff] [blame] | 3461 | [AC_MSG_WARN([cross compiling: assuming yes]) |
| 3462 | rlimit_nofile_zero_works=yes] |
Darren Tucker | ff008de | 2013-03-06 17:48:48 +1100 | [diff] [blame] | 3463 | ) |
| 3464 | |
Darren Tucker | d545a4b | 2012-07-03 22:48:31 +1000 | [diff] [blame] | 3465 | AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works]) |
| 3466 | AC_RUN_IFELSE( |
| 3467 | [AC_LANG_PROGRAM([[ |
| 3468 | #include <sys/types.h> |
| 3469 | #include <sys/resource.h> |
| 3470 | #include <stdlib.h> |
| 3471 | ]],[[ |
| 3472 | struct rlimit rl_zero; |
| 3473 | |
| 3474 | rl_zero.rlim_cur = rl_zero.rlim_max = 0; |
| 3475 | exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0); |
| 3476 | ]])], |
| 3477 | [AC_MSG_RESULT([yes])], |
| 3478 | [AC_MSG_RESULT([no]) |
| 3479 | AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1, |
| 3480 | [setrlimit RLIMIT_FSIZE works])], |
| 3481 | [AC_MSG_WARN([cross compiling: assuming yes])] |
| 3482 | ) |
| 3483 | |
deraadt@openbsd.org | 2539dce | 2015-10-09 01:37:08 +0000 | [diff] [blame] | 3484 | if test "x$sandbox_arg" = "xpledge" || \ |
| 3485 | ( test -z "$sandbox_arg" && test "x$ac_cv_func_pledge" = "xyes" ) ; then |
| 3486 | test "x$ac_cv_func_pledge" != "xyes" && \ |
| 3487 | AC_MSG_ERROR([pledge sandbox requires pledge(2) support]) |
| 3488 | SANDBOX_STYLE="pledge" |
Damien Miller | fafe1d8 | 2015-10-14 09:22:15 -0700 | [diff] [blame] | 3489 | AC_DEFINE([SANDBOX_PLEDGE], [1], [Sandbox using pledge(2)]) |
Damien Miller | 9846a2f | 2015-10-08 04:30:48 +1100 | [diff] [blame] | 3490 | elif test "x$sandbox_arg" = "xsystrace" || \ |
Damien Miller | 69ff1df | 2011-06-23 08:30:03 +1000 | [diff] [blame] | 3491 | ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then |
Damien Miller | 1a91c0f | 2011-08-17 11:59:25 +1000 | [diff] [blame] | 3492 | test "x$have_systr_policy_kill" != "x1" && \ |
| 3493 | AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support]) |
Damien Miller | 69ff1df | 2011-06-23 08:30:03 +1000 | [diff] [blame] | 3494 | SANDBOX_STYLE="systrace" |
| 3495 | AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)]) |
Damien Miller | cd5e52e | 2011-06-27 07:18:18 +1000 | [diff] [blame] | 3496 | elif test "x$sandbox_arg" = "xdarwin" || \ |
| 3497 | ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \ |
| 3498 | test "x$ac_cv_header_sandbox_h" = "xyes") ; then |
Damien Miller | 1a91c0f | 2011-08-17 11:59:25 +1000 | [diff] [blame] | 3499 | test "x$ac_cv_func_sandbox_init" != "xyes" -o \ |
| 3500 | "x$ac_cv_header_sandbox_h" != "xyes" && \ |
| 3501 | AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function]) |
Damien Miller | cd5e52e | 2011-06-27 07:18:18 +1000 | [diff] [blame] | 3502 | SANDBOX_STYLE="darwin" |
| 3503 | AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)]) |
Damien Miller | e0956e3 | 2012-04-04 11:27:54 +1000 | [diff] [blame] | 3504 | elif test "x$sandbox_arg" = "xseccomp_filter" || \ |
| 3505 | ( test -z "$sandbox_arg" && \ |
Darren Tucker | d0494fd | 2012-05-19 14:25:39 +1000 | [diff] [blame] | 3506 | test "x$have_seccomp_filter" = "x1" && \ |
Damien Miller | 91f40d8 | 2013-02-22 11:37:00 +1100 | [diff] [blame] | 3507 | test "x$ac_cv_header_elf_h" = "xyes" && \ |
Damien Miller | e0956e3 | 2012-04-04 11:27:54 +1000 | [diff] [blame] | 3508 | test "x$ac_cv_header_linux_audit_h" = "xyes" && \ |
Damien Miller | 91f40d8 | 2013-02-22 11:37:00 +1100 | [diff] [blame] | 3509 | test "x$ac_cv_header_linux_filter_h" = "xyes" && \ |
| 3510 | test "x$seccomp_audit_arch" != "x" && \ |
Damien Miller | e0956e3 | 2012-04-04 11:27:54 +1000 | [diff] [blame] | 3511 | test "x$have_linux_no_new_privs" = "x1" && \ |
| 3512 | test "x$ac_cv_func_prctl" = "xyes" ) ; then |
Damien Miller | 91f40d8 | 2013-02-22 11:37:00 +1100 | [diff] [blame] | 3513 | test "x$seccomp_audit_arch" = "x" && \ |
Damien Miller | e0956e3 | 2012-04-04 11:27:54 +1000 | [diff] [blame] | 3514 | AC_MSG_ERROR([seccomp_filter sandbox not supported on $host]) |
| 3515 | test "x$have_linux_no_new_privs" != "x1" && \ |
| 3516 | AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS]) |
| 3517 | test "x$have_seccomp_filter" != "x1" && \ |
| 3518 | AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers]) |
| 3519 | test "x$ac_cv_func_prctl" != "xyes" && \ |
| 3520 | AC_MSG_ERROR([seccomp_filter sandbox requires prctl function]) |
| 3521 | SANDBOX_STYLE="seccomp_filter" |
| 3522 | AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter]) |
Damien Miller | f62ecef | 2014-01-25 12:34:38 +1100 | [diff] [blame] | 3523 | elif test "x$sandbox_arg" = "xcapsicum" || \ |
| 3524 | ( test -z "$sandbox_arg" && \ |
Darren Tucker | dd9d9b3 | 2017-08-28 16:48:27 +1000 | [diff] [blame] | 3525 | test "x$ac_cv_header_sys_capsicum_h" = "xyes" && \ |
Damien Miller | 603b8f4 | 2014-01-25 13:16:59 +1100 | [diff] [blame] | 3526 | test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then |
Darren Tucker | dd9d9b3 | 2017-08-28 16:48:27 +1000 | [diff] [blame] | 3527 | test "x$ac_cv_header_sys_capsicum_h" != "xyes" && \ |
| 3528 | AC_MSG_ERROR([capsicum sandbox requires sys/capsicum.h header]) |
Damien Miller | 603b8f4 | 2014-01-25 13:16:59 +1100 | [diff] [blame] | 3529 | test "x$ac_cv_func_cap_rights_limit" != "xyes" && \ |
Damien Miller | c96d853 | 2014-01-25 13:12:28 +1100 | [diff] [blame] | 3530 | AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function]) |
Damien Miller | f62ecef | 2014-01-25 12:34:38 +1100 | [diff] [blame] | 3531 | SANDBOX_STYLE="capsicum" |
| 3532 | AC_DEFINE([SANDBOX_CAPSICUM], [1], [Sandbox using capsicum]) |
Damien Miller | 69ff1df | 2011-06-23 08:30:03 +1000 | [diff] [blame] | 3533 | elif test "x$sandbox_arg" = "xrlimit" || \ |
Darren Tucker | 60395f9 | 2012-07-03 14:31:18 +1000 | [diff] [blame] | 3534 | ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \ |
Darren Tucker | ff008de | 2013-03-06 17:48:48 +1100 | [diff] [blame] | 3535 | test "x$select_works_with_rlimit" = "xyes" && \ |
| 3536 | test "x$rlimit_nofile_zero_works" = "xyes" ) ; then |
Damien Miller | 1a91c0f | 2011-08-17 11:59:25 +1000 | [diff] [blame] | 3537 | test "x$ac_cv_func_setrlimit" != "xyes" && \ |
| 3538 | AC_MSG_ERROR([rlimit sandbox requires setrlimit function]) |
Darren Tucker | 60395f9 | 2012-07-03 14:31:18 +1000 | [diff] [blame] | 3539 | test "x$select_works_with_rlimit" != "xyes" && \ |
| 3540 | AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit]) |
Damien Miller | 69ff1df | 2011-06-23 08:30:03 +1000 | [diff] [blame] | 3541 | SANDBOX_STYLE="rlimit" |
| 3542 | AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)]) |
Damien Miller | 4626cba | 2016-01-08 14:24:56 +1100 | [diff] [blame] | 3543 | elif test "x$sandbox_arg" = "xsolaris" || \ |
| 3544 | ( test -z "$sandbox_arg" && test "x$SOLARIS_PRIVS" = "xyes" ) ; then |
| 3545 | SANDBOX_STYLE="solaris" |
| 3546 | AC_DEFINE([SANDBOX_SOLARIS], [1], [Sandbox using Solaris/Illumos privileges]) |
Damien Miller | 69ff1df | 2011-06-23 08:30:03 +1000 | [diff] [blame] | 3547 | elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \ |
| 3548 | test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then |
| 3549 | SANDBOX_STYLE="none" |
| 3550 | AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing]) |
| 3551 | else |
Tim Rice | a6e6061 | 2011-08-17 21:48:22 -0700 | [diff] [blame] | 3552 | AC_MSG_ERROR([unsupported --with-sandbox]) |
Damien Miller | 69ff1df | 2011-06-23 08:30:03 +1000 | [diff] [blame] | 3553 | fi |
| 3554 | |
Ben Lindstrom | b562864 | 2000-10-18 00:02:25 +0000 | [diff] [blame] | 3555 | # Cheap hack to ensure NEWS-OS libraries are arranged right. |
| 3556 | if test ! -z "$SONY" ; then |
| 3557 | LIBS="$LIBS -liberty"; |
| 3558 | fi |
| 3559 | |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 3560 | # Check for long long datatypes |
| 3561 | AC_CHECK_TYPES([long long, unsigned long long, long double]) |
| 3562 | |
| 3563 | # Check datatype sizes |
Dag-Erling Smørgrav | d0153c7 | 2018-10-09 23:03:40 +0200 | [diff] [blame] | 3564 | AC_CHECK_SIZEOF([short int]) |
| 3565 | AC_CHECK_SIZEOF([int]) |
| 3566 | AC_CHECK_SIZEOF([long int]) |
| 3567 | AC_CHECK_SIZEOF([long long int]) |
Damien Miller | c6398ef | 1999-11-20 12:18:40 +1100 | [diff] [blame] | 3568 | |
Damien Miller | fa2bb69 | 2002-04-23 23:22:25 +1000 | [diff] [blame] | 3569 | # Sanity check long long for some platforms (AIX) |
| 3570 | if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then |
| 3571 | ac_cv_sizeof_long_long_int=0 |
| 3572 | fi |
| 3573 | |
Darren Tucker | 537f1ed | 2005-10-25 18:38:33 +1000 | [diff] [blame] | 3574 | # compute LLONG_MIN and LLONG_MAX if we don't know them. |
| 3575 | if test -z "$have_llong_max"; then |
| 3576 | AC_MSG_CHECKING([for max value of long long]) |
| 3577 | AC_RUN_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3578 | [AC_LANG_PROGRAM([[ |
Darren Tucker | 537f1ed | 2005-10-25 18:38:33 +1000 | [diff] [blame] | 3579 | #include <stdio.h> |
| 3580 | /* Why is this so damn hard? */ |
| 3581 | #ifdef __GNUC__ |
| 3582 | # undef __GNUC__ |
| 3583 | #endif |
| 3584 | #define __USE_ISOC99 |
| 3585 | #include <limits.h> |
| 3586 | #define DATA "conftest.llminmax" |
Darren Tucker | d1450db | 2006-03-13 19:06:51 +1100 | [diff] [blame] | 3587 | #define my_abs(a) ((a) < 0 ? ((a) * -1) : (a)) |
| 3588 | |
| 3589 | /* |
| 3590 | * printf in libc on some platforms (eg old Tru64) does not understand %lld so |
| 3591 | * we do this the hard way. |
| 3592 | */ |
| 3593 | static int |
| 3594 | fprint_ll(FILE *f, long long n) |
| 3595 | { |
| 3596 | unsigned int i; |
| 3597 | int l[sizeof(long long) * 8]; |
| 3598 | |
| 3599 | if (n < 0) |
| 3600 | if (fprintf(f, "-") < 0) |
| 3601 | return -1; |
| 3602 | for (i = 0; n != 0; i++) { |
| 3603 | l[i] = my_abs(n % 10); |
| 3604 | n /= 10; |
| 3605 | } |
| 3606 | do { |
| 3607 | if (fprintf(f, "%d", l[--i]) < 0) |
| 3608 | return -1; |
| 3609 | } while (i != 0); |
| 3610 | if (fprintf(f, " ") < 0) |
| 3611 | return -1; |
| 3612 | return 0; |
| 3613 | } |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3614 | ]], [[ |
Darren Tucker | 537f1ed | 2005-10-25 18:38:33 +1000 | [diff] [blame] | 3615 | FILE *f; |
| 3616 | long long i, llmin, llmax = 0; |
| 3617 | |
| 3618 | if((f = fopen(DATA,"w")) == NULL) |
| 3619 | exit(1); |
| 3620 | |
| 3621 | #if defined(LLONG_MIN) && defined(LLONG_MAX) |
| 3622 | fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n"); |
| 3623 | llmin = LLONG_MIN; |
| 3624 | llmax = LLONG_MAX; |
| 3625 | #else |
| 3626 | fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n"); |
| 3627 | /* This will work on one's complement and two's complement */ |
| 3628 | for (i = 1; i > llmax; i <<= 1, i++) |
| 3629 | llmax = i; |
| 3630 | llmin = llmax + 1LL; /* wrap */ |
| 3631 | #endif |
| 3632 | |
| 3633 | /* Sanity check */ |
| 3634 | if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax |
Darren Tucker | d1450db | 2006-03-13 19:06:51 +1100 | [diff] [blame] | 3635 | || llmax - 1 > llmax || llmin == llmax || llmin == 0 |
| 3636 | || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) { |
Darren Tucker | 537f1ed | 2005-10-25 18:38:33 +1000 | [diff] [blame] | 3637 | fprintf(f, "unknown unknown\n"); |
| 3638 | exit(2); |
| 3639 | } |
| 3640 | |
Darren Tucker | d1450db | 2006-03-13 19:06:51 +1100 | [diff] [blame] | 3641 | if (fprint_ll(f, llmin) < 0) |
Darren Tucker | 537f1ed | 2005-10-25 18:38:33 +1000 | [diff] [blame] | 3642 | exit(3); |
Darren Tucker | d1450db | 2006-03-13 19:06:51 +1100 | [diff] [blame] | 3643 | if (fprint_ll(f, llmax) < 0) |
| 3644 | exit(4); |
| 3645 | if (fclose(f) < 0) |
| 3646 | exit(5); |
Darren Tucker | 537f1ed | 2005-10-25 18:38:33 +1000 | [diff] [blame] | 3647 | exit(0); |
Darren Tucker | 537f1ed | 2005-10-25 18:38:33 +1000 | [diff] [blame] | 3648 | ]])], |
| 3649 | [ |
| 3650 | llong_min=`$AWK '{print $1}' conftest.llminmax` |
| 3651 | llong_max=`$AWK '{print $2}' conftest.llminmax` |
| 3652 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3653 | AC_MSG_RESULT([$llong_max]) |
| 3654 | AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL], |
Darren Tucker | 537f1ed | 2005-10-25 18:38:33 +1000 | [diff] [blame] | 3655 | [max value of long long calculated by configure]) |
| 3656 | AC_MSG_CHECKING([for min value of long long]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3657 | AC_MSG_RESULT([$llong_min]) |
| 3658 | AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL], |
Darren Tucker | 537f1ed | 2005-10-25 18:38:33 +1000 | [diff] [blame] | 3659 | [min value of long long calculated by configure]) |
| 3660 | ], |
| 3661 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3662 | AC_MSG_RESULT([not found]) |
Darren Tucker | 537f1ed | 2005-10-25 18:38:33 +1000 | [diff] [blame] | 3663 | ], |
| 3664 | [ |
| 3665 | AC_MSG_WARN([cross compiling: not checking]) |
| 3666 | ] |
| 3667 | ) |
| 3668 | fi |
| 3669 | |
Darren Tucker | 2912596 | 2019-10-28 16:06:59 +1100 | [diff] [blame] | 3670 | AC_CHECK_DECLS([UINT32_MAX], , , [[ |
| 3671 | #ifdef HAVE_SYS_LIMITS_H |
| 3672 | # include <sys/limits.h> |
| 3673 | #endif |
| 3674 | #ifdef HAVE_LIMITS_H |
| 3675 | # include <limits.h> |
| 3676 | #endif |
| 3677 | #ifdef HAVE_STDINT_H |
| 3678 | # include <stdint.h> |
| 3679 | #endif |
| 3680 | ]]) |
Darren Tucker | 537f1ed | 2005-10-25 18:38:33 +1000 | [diff] [blame] | 3681 | |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 3682 | # More checks for data types |
Damien Miller | caf6dd6 | 2000-08-29 11:33:50 +1100 | [diff] [blame] | 3683 | AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3684 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 3685 | [[ u_int a; a = 1;]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3686 | [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3687 | ]) |
Damien Miller | caf6dd6 | 2000-08-29 11:33:50 +1100 | [diff] [blame] | 3688 | ]) |
| 3689 | if test "x$ac_cv_have_u_int" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3690 | AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type]) |
Damien Miller | caf6dd6 | 2000-08-29 11:33:50 +1100 | [diff] [blame] | 3691 | have_u_int=1 |
| 3692 | fi |
| 3693 | |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3694 | AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3695 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 3696 | [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3697 | [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3698 | ]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3699 | ]) |
| 3700 | if test "x$ac_cv_have_intxx_t" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3701 | AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3702 | have_intxx_t=1 |
| 3703 | fi |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3704 | |
| 3705 | if (test -z "$have_intxx_t" && \ |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 3706 | test "x$ac_cv_header_stdint_h" = "xyes") |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3707 | then |
| 3708 | AC_MSG_CHECKING([for intXX_t types in stdint.h]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3709 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]], |
| 3710 | [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])], |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3711 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3712 | AC_DEFINE([HAVE_INTXX_T]) |
| 3713 | AC_MSG_RESULT([yes]) |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3714 | ], [ AC_MSG_RESULT([no]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3715 | ]) |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3716 | fi |
| 3717 | |
Damien Miller | 578783e | 2000-09-23 14:12:24 +1100 | [diff] [blame] | 3718 | AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3719 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Tim Rice | 907881e | 2002-07-18 11:44:50 -0700 | [diff] [blame] | 3720 | #include <sys/types.h> |
| 3721 | #ifdef HAVE_STDINT_H |
| 3722 | # include <stdint.h> |
| 3723 | #endif |
| 3724 | #include <sys/socket.h> |
| 3725 | #ifdef HAVE_SYS_BITYPES_H |
| 3726 | # include <sys/bitypes.h> |
| 3727 | #endif |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3728 | ]], [[ |
| 3729 | int64_t a; a = 1; |
| 3730 | ]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3731 | [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3732 | ]) |
Damien Miller | 578783e | 2000-09-23 14:12:24 +1100 | [diff] [blame] | 3733 | ]) |
| 3734 | if test "x$ac_cv_have_int64_t" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3735 | AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type]) |
Tim Rice | 4cec93f | 2002-02-26 08:40:48 -0800 | [diff] [blame] | 3736 | fi |
| 3737 | |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3738 | AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3739 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 3740 | [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3741 | [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3742 | ]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3743 | ]) |
| 3744 | if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3745 | AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3746 | have_u_intxx_t=1 |
| 3747 | fi |
Damien Miller | c6398ef | 1999-11-20 12:18:40 +1100 | [diff] [blame] | 3748 | |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3749 | if test -z "$have_u_intxx_t" ; then |
| 3750 | AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3751 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]], |
| 3752 | [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])], |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3753 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3754 | AC_DEFINE([HAVE_U_INTXX_T]) |
| 3755 | AC_MSG_RESULT([yes]) |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3756 | ], [ AC_MSG_RESULT([no]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3757 | ]) |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3758 | fi |
| 3759 | |
Damien Miller | 578783e | 2000-09-23 14:12:24 +1100 | [diff] [blame] | 3760 | AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3761 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 3762 | [[ u_int64_t a; a = 1;]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3763 | [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3764 | ]) |
Damien Miller | 578783e | 2000-09-23 14:12:24 +1100 | [diff] [blame] | 3765 | ]) |
| 3766 | if test "x$ac_cv_have_u_int64_t" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3767 | AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type]) |
Damien Miller | 578783e | 2000-09-23 14:12:24 +1100 | [diff] [blame] | 3768 | have_u_int64_t=1 |
| 3769 | fi |
| 3770 | |
Damien Miller | c286819 | 2014-01-30 10:21:19 +1100 | [diff] [blame] | 3771 | if (test -z "$have_u_int64_t" && \ |
| 3772 | test "x$ac_cv_header_sys_bitypes_h" = "xyes") |
| 3773 | then |
Tim Rice | 4cec93f | 2002-02-26 08:40:48 -0800 | [diff] [blame] | 3774 | AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3775 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]], |
| 3776 | [[ u_int64_t a; a = 1]])], |
Tim Rice | 4cec93f | 2002-02-26 08:40:48 -0800 | [diff] [blame] | 3777 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3778 | AC_DEFINE([HAVE_U_INT64_T]) |
| 3779 | AC_MSG_RESULT([yes]) |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3780 | ], [ AC_MSG_RESULT([no]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3781 | ]) |
Tim Rice | 4cec93f | 2002-02-26 08:40:48 -0800 | [diff] [blame] | 3782 | fi |
| 3783 | |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3784 | if test -z "$have_u_intxx_t" ; then |
| 3785 | AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3786 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3787 | #include <sys/types.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3788 | ]], [[ |
| 3789 | uint8_t a; |
| 3790 | uint16_t b; |
| 3791 | uint32_t c; |
| 3792 | a = b = c = 1; |
| 3793 | ]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3794 | [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3795 | ]) |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3796 | ]) |
| 3797 | if test "x$ac_cv_have_uintxx_t" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3798 | AC_DEFINE([HAVE_UINTXX_T], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 3799 | [define if you have uintxx_t data type]) |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3800 | fi |
| 3801 | fi |
| 3802 | |
Damien Miller | c286819 | 2014-01-30 10:21:19 +1100 | [diff] [blame] | 3803 | if (test -z "$have_uintxx_t" && \ |
| 3804 | test "x$ac_cv_header_stdint_h" = "xyes") |
| 3805 | then |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3806 | AC_MSG_CHECKING([for uintXX_t types in stdint.h]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3807 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]], |
| 3808 | [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])], |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3809 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3810 | AC_DEFINE([HAVE_UINTXX_T]) |
| 3811 | AC_MSG_RESULT([yes]) |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3812 | ], [ AC_MSG_RESULT([no]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3813 | ]) |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 3814 | fi |
| 3815 | |
Damien Miller | c286819 | 2014-01-30 10:21:19 +1100 | [diff] [blame] | 3816 | if (test -z "$have_uintxx_t" && \ |
| 3817 | test "x$ac_cv_header_inttypes_h" = "xyes") |
| 3818 | then |
Darren Tucker | 6d72568 | 2014-01-17 19:17:34 +1100 | [diff] [blame] | 3819 | AC_MSG_CHECKING([for uintXX_t types in inttypes.h]) |
| 3820 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <inttypes.h> ]], |
| 3821 | [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])], |
| 3822 | [ |
| 3823 | AC_DEFINE([HAVE_UINTXX_T]) |
| 3824 | AC_MSG_RESULT([yes]) |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3825 | ], [ AC_MSG_RESULT([no]) |
Darren Tucker | 6d72568 | 2014-01-17 19:17:34 +1100 | [diff] [blame] | 3826 | ]) |
| 3827 | fi |
| 3828 | |
Damien Miller | edb8292 | 2000-06-20 13:25:52 +1000 | [diff] [blame] | 3829 | if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \ |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 3830 | test "x$ac_cv_header_sys_bitypes_h" = "xyes") |
Damien Miller | b29ea91 | 2000-01-15 14:12:03 +1100 | [diff] [blame] | 3831 | then |
| 3832 | AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3833 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3834 | #include <sys/bitypes.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3835 | ]], [[ |
Damien Miller | 70494d1 | 2000-04-03 15:57:06 +1000 | [diff] [blame] | 3836 | int8_t a; int16_t b; int32_t c; |
| 3837 | u_int8_t e; u_int16_t f; u_int32_t g; |
| 3838 | a = b = c = e = f = g = 1; |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3839 | ]])], |
Damien Miller | b29ea91 | 2000-01-15 14:12:03 +1100 | [diff] [blame] | 3840 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3841 | AC_DEFINE([HAVE_U_INTXX_T]) |
| 3842 | AC_DEFINE([HAVE_INTXX_T]) |
| 3843 | AC_MSG_RESULT([yes]) |
| 3844 | ], [AC_MSG_RESULT([no]) |
| 3845 | ]) |
Damien Miller | b29ea91 | 2000-01-15 14:12:03 +1100 | [diff] [blame] | 3846 | fi |
| 3847 | |
Damien Miller | 58be738 | 2001-09-15 21:31:54 +1000 | [diff] [blame] | 3848 | |
| 3849 | AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3850 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 3851 | [[ u_char foo; foo = 125; ]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3852 | [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3853 | ]) |
Damien Miller | 58be738 | 2001-09-15 21:31:54 +1000 | [diff] [blame] | 3854 | ]) |
| 3855 | if test "x$ac_cv_have_u_char" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3856 | AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type]) |
Damien Miller | 58be738 | 2001-09-15 21:31:54 +1000 | [diff] [blame] | 3857 | fi |
| 3858 | |
Darren Tucker | 007e3b3 | 2013-11-03 18:43:55 +1100 | [diff] [blame] | 3859 | AC_CHECK_TYPES([intmax_t, uintmax_t], , , [ |
| 3860 | #include <sys/types.h> |
Darren Tucker | 638a45b | 2020-01-26 13:40:51 +1100 | [diff] [blame] | 3861 | #ifdef HAVE_STDINT_H |
| 3862 | # include <stdint.h> |
| 3863 | #endif |
Darren Tucker | 007e3b3 | 2013-11-03 18:43:55 +1100 | [diff] [blame] | 3864 | ]) |
| 3865 | |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 3866 | TYPE_SOCKLEN_T |
Damien Miller | 74d0d4a | 1999-12-29 02:24:35 +1100 | [diff] [blame] | 3867 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3868 | AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>]) |
| 3869 | AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [ |
Darren Tucker | 598eaa6 | 2008-06-09 03:32:29 +1000 | [diff] [blame] | 3870 | #include <sys/types.h> |
| 3871 | #ifdef HAVE_SYS_BITYPES_H |
| 3872 | #include <sys/bitypes.h> |
| 3873 | #endif |
| 3874 | #ifdef HAVE_SYS_STATFS_H |
| 3875 | #include <sys/statfs.h> |
| 3876 | #endif |
| 3877 | #ifdef HAVE_SYS_STATVFS_H |
| 3878 | #include <sys/statvfs.h> |
| 3879 | #endif |
| 3880 | ]) |
Tim Rice | 4cec93f | 2002-02-26 08:40:48 -0800 | [diff] [blame] | 3881 | |
Darren Tucker | d561b0b | 2019-10-28 16:09:04 +1100 | [diff] [blame] | 3882 | AC_CHECK_MEMBERS([struct statfs.f_files, struct statfs.f_flags], [], [], [[ |
Darren Tucker | 382c18c | 2019-11-03 00:09:21 +1100 | [diff] [blame] | 3883 | #include <sys/param.h> |
Darren Tucker | 1105756 | 2018-02-25 11:22:57 +1100 | [diff] [blame] | 3884 | #include <sys/types.h> |
| 3885 | #ifdef HAVE_SYS_BITYPES_H |
| 3886 | #include <sys/bitypes.h> |
| 3887 | #endif |
| 3888 | #ifdef HAVE_SYS_STATFS_H |
| 3889 | #include <sys/statfs.h> |
| 3890 | #endif |
| 3891 | #ifdef HAVE_SYS_STATVFS_H |
| 3892 | #include <sys/statvfs.h> |
| 3893 | #endif |
| 3894 | #ifdef HAVE_SYS_VFS_H |
| 3895 | #include <sys/vfs.h> |
| 3896 | #endif |
Darren Tucker | 382c18c | 2019-11-03 00:09:21 +1100 | [diff] [blame] | 3897 | #ifdef HAVE_SYS_MOUNT_H |
| 3898 | #include <sys/mount.h> |
| 3899 | #endif |
Darren Tucker | 1105756 | 2018-02-25 11:22:57 +1100 | [diff] [blame] | 3900 | ]]) |
| 3901 | |
| 3902 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3903 | AC_CHECK_TYPES([in_addr_t, in_port_t], , , |
Damien Miller | 848b993 | 2005-02-24 12:12:34 +1100 | [diff] [blame] | 3904 | [#include <sys/types.h> |
| 3905 | #include <netinet/in.h>]) |
Darren Tucker | d9f8891 | 2005-02-20 21:01:48 +1100 | [diff] [blame] | 3906 | |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3907 | AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3908 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 3909 | [[ size_t foo; foo = 1235; ]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3910 | [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3911 | ]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3912 | ]) |
| 3913 | if test "x$ac_cv_have_size_t" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3914 | AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3915 | fi |
Damien Miller | 9505851 | 1999-12-29 10:36:45 +1100 | [diff] [blame] | 3916 | |
Damien Miller | 615f939 | 2000-05-17 22:53:33 +1000 | [diff] [blame] | 3917 | AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3918 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 3919 | [[ ssize_t foo; foo = 1235; ]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3920 | [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3921 | ]) |
Damien Miller | 615f939 | 2000-05-17 22:53:33 +1000 | [diff] [blame] | 3922 | ]) |
| 3923 | if test "x$ac_cv_have_ssize_t" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3924 | AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type]) |
Damien Miller | 615f939 | 2000-05-17 22:53:33 +1000 | [diff] [blame] | 3925 | fi |
| 3926 | |
Ben Lindstrom | 0d5af60 | 2001-01-09 00:50:29 +0000 | [diff] [blame] | 3927 | AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3928 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]], |
| 3929 | [[ clock_t foo; foo = 1235; ]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3930 | [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3931 | ]) |
Ben Lindstrom | 0d5af60 | 2001-01-09 00:50:29 +0000 | [diff] [blame] | 3932 | ]) |
| 3933 | if test "x$ac_cv_have_clock_t" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3934 | AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type]) |
Ben Lindstrom | 0d5af60 | 2001-01-09 00:50:29 +0000 | [diff] [blame] | 3935 | fi |
| 3936 | |
Damien Miller | b54b40e | 2000-06-23 08:23:34 +1000 | [diff] [blame] | 3937 | AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3938 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | b54b40e | 2000-06-23 08:23:34 +1000 | [diff] [blame] | 3939 | #include <sys/types.h> |
| 3940 | #include <sys/socket.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3941 | ]], [[ sa_family_t foo; foo = 1235; ]])], |
| 3942 | [ ac_cv_have_sa_family_t="yes" ], |
| 3943 | [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 3944 | #include <sys/types.h> |
| 3945 | #include <sys/socket.h> |
| 3946 | #include <netinet/in.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3947 | ]], [[ sa_family_t foo; foo = 1235; ]])], |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 3948 | [ ac_cv_have_sa_family_t="yes" ], |
Damien Miller | b54b40e | 2000-06-23 08:23:34 +1000 | [diff] [blame] | 3949 | [ ac_cv_have_sa_family_t="no" ] |
| 3950 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3951 | ]) |
Damien Miller | b54b40e | 2000-06-23 08:23:34 +1000 | [diff] [blame] | 3952 | ]) |
| 3953 | if test "x$ac_cv_have_sa_family_t" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3954 | AC_DEFINE([HAVE_SA_FAMILY_T], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 3955 | [define if you have sa_family_t data type]) |
Damien Miller | b54b40e | 2000-06-23 08:23:34 +1000 | [diff] [blame] | 3956 | fi |
| 3957 | |
Damien Miller | 0f91b4e | 2000-06-18 15:43:25 +1000 | [diff] [blame] | 3958 | AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3959 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 3960 | [[ pid_t foo; foo = 1235; ]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3961 | [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3962 | ]) |
Damien Miller | 0f91b4e | 2000-06-18 15:43:25 +1000 | [diff] [blame] | 3963 | ]) |
| 3964 | if test "x$ac_cv_have_pid_t" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3965 | AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type]) |
Damien Miller | 0f91b4e | 2000-06-18 15:43:25 +1000 | [diff] [blame] | 3966 | fi |
| 3967 | |
| 3968 | AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3969 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 3970 | [[ mode_t foo; foo = 1235; ]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3971 | [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3972 | ]) |
Damien Miller | 0f91b4e | 2000-06-18 15:43:25 +1000 | [diff] [blame] | 3973 | ]) |
| 3974 | if test "x$ac_cv_have_mode_t" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3975 | AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type]) |
Damien Miller | 0f91b4e | 2000-06-18 15:43:25 +1000 | [diff] [blame] | 3976 | fi |
| 3977 | |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3978 | |
| 3979 | AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3980 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | 8117111 | 2000-04-23 11:14:01 +1000 | [diff] [blame] | 3981 | #include <sys/types.h> |
| 3982 | #include <sys/socket.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3983 | ]], [[ struct sockaddr_storage s; ]])], |
| 3984 | [ ac_cv_have_struct_sockaddr_storage="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3985 | [ ac_cv_have_struct_sockaddr_storage="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3986 | ]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3987 | ]) |
| 3988 | if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3989 | AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 3990 | [define if you have struct sockaddr_storage data type]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3991 | fi |
Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame] | 3992 | |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3993 | AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3994 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | 7b22d65 | 2000-06-18 14:07:04 +1000 | [diff] [blame] | 3995 | #include <sys/types.h> |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 3996 | #include <netinet/in.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 3997 | ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])], |
| 3998 | [ ac_cv_have_struct_sockaddr_in6="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 3999 | [ ac_cv_have_struct_sockaddr_in6="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4000 | ]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4001 | ]) |
| 4002 | if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4003 | AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4004 | [define if you have struct sockaddr_in6 data type]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4005 | fi |
Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame] | 4006 | |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4007 | AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4008 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | 7b22d65 | 2000-06-18 14:07:04 +1000 | [diff] [blame] | 4009 | #include <sys/types.h> |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4010 | #include <netinet/in.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4011 | ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])], |
| 4012 | [ ac_cv_have_struct_in6_addr="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4013 | [ ac_cv_have_struct_in6_addr="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4014 | ]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4015 | ]) |
| 4016 | if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4017 | AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4018 | [define if you have struct in6_addr data type]) |
Tim Rice | 0f4d2c0 | 2008-11-18 21:26:41 -0800 | [diff] [blame] | 4019 | |
| 4020 | dnl Now check for sin6_scope_id |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4021 | AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , , |
Tim Rice | 0f4d2c0 | 2008-11-18 21:26:41 -0800 | [diff] [blame] | 4022 | [ |
| 4023 | #ifdef HAVE_SYS_TYPES_H |
| 4024 | #include <sys/types.h> |
| 4025 | #endif |
| 4026 | #include <netinet/in.h> |
| 4027 | ]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4028 | fi |
Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame] | 4029 | |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4030 | AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4031 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | 8117111 | 2000-04-23 11:14:01 +1000 | [diff] [blame] | 4032 | #include <sys/types.h> |
| 4033 | #include <sys/socket.h> |
| 4034 | #include <netdb.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4035 | ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])], |
| 4036 | [ ac_cv_have_struct_addrinfo="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4037 | [ ac_cv_have_struct_addrinfo="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4038 | ]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4039 | ]) |
| 4040 | if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4041 | AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4042 | [define if you have struct addrinfo data type]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4043 | fi |
| 4044 | |
Darren Tucker | e0cedca | 2020-01-14 09:42:52 +1100 | [diff] [blame] | 4045 | AC_HEADER_TIME |
| 4046 | |
Ben Lindstrom | 42202bc | 2001-01-15 02:34:37 +0000 | [diff] [blame] | 4047 | AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4048 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]], |
| 4049 | [[ struct timeval tv; tv.tv_sec = 1;]])], |
| 4050 | [ ac_cv_have_struct_timeval="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4051 | [ ac_cv_have_struct_timeval="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4052 | ]) |
Ben Lindstrom | 42202bc | 2001-01-15 02:34:37 +0000 | [diff] [blame] | 4053 | ]) |
| 4054 | if test "x$ac_cv_have_struct_timeval" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4055 | AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval]) |
Ben Lindstrom | 42202bc | 2001-01-15 02:34:37 +0000 | [diff] [blame] | 4056 | have_struct_timeval=1 |
| 4057 | fi |
| 4058 | |
Darren Tucker | e0cedca | 2020-01-14 09:42:52 +1100 | [diff] [blame] | 4059 | AC_CACHE_CHECK([for struct timespec], ac_cv_have_struct_timespec, [ |
| 4060 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4061 | #ifdef TIME_WITH_SYS_TIME |
| 4062 | # include <sys/time.h> |
| 4063 | # include <time.h> |
| 4064 | #else |
| 4065 | # ifdef HAVE_SYS_TIME_H |
| 4066 | # include <sys/time.h> |
| 4067 | # else |
| 4068 | # include <time.h> |
| 4069 | # endif |
| 4070 | #endif |
| 4071 | ]], |
| 4072 | [[ struct timespec ts; ts.tv_sec = 1;]])], |
| 4073 | [ ac_cv_have_struct_timespec="yes" ], |
| 4074 | [ ac_cv_have_struct_timespec="no" |
| 4075 | ]) |
| 4076 | ]) |
| 4077 | if test "x$ac_cv_have_struct_timespec" = "xyes" ; then |
| 4078 | AC_DEFINE([HAVE_STRUCT_TIMESPEC], [1], [define if you have struct timespec]) |
| 4079 | have_struct_timespec=1 |
| 4080 | fi |
Tim Rice | 4e4dc56 | 2003-03-18 10:21:40 -0800 | [diff] [blame] | 4081 | |
Damien Miller | 10479cc | 2018-04-10 10:19:02 +1000 | [diff] [blame] | 4082 | # We need int64_t or else certain parts of the compile will fail. |
Tim Rice | 8bb561b | 2005-03-17 16:23:19 -0800 | [diff] [blame] | 4083 | if test "x$ac_cv_have_int64_t" = "xno" && \ |
| 4084 | test "x$ac_cv_sizeof_long_int" != "x8" && \ |
| 4085 | test "x$ac_cv_sizeof_long_long_int" = "x0" ; then |
Ben Lindstrom | 5bd6eb7 | 2003-03-21 00:34:34 +0000 | [diff] [blame] | 4086 | echo "OpenSSH requires int64_t support. Contact your vendor or install" |
| 4087 | echo "an alternative compiler (I.E., GCC) before continuing." |
| 4088 | echo "" |
| 4089 | exit 1; |
Tim Rice | bee3f22 | 2001-03-11 17:32:12 -0800 | [diff] [blame] | 4090 | else |
| 4091 | dnl test snprintf (broken on SCO w/gcc) |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 4092 | AC_RUN_IFELSE( |
Darren Tucker | 623d92f | 2004-09-12 22:36:15 +1000 | [diff] [blame] | 4093 | [AC_LANG_SOURCE([[ |
Tim Rice | bee3f22 | 2001-03-11 17:32:12 -0800 | [diff] [blame] | 4094 | #include <stdio.h> |
| 4095 | #include <string.h> |
| 4096 | #ifdef HAVE_SNPRINTF |
| 4097 | main() |
| 4098 | { |
| 4099 | char buf[50]; |
| 4100 | char expected_out[50]; |
| 4101 | int mazsize = 50 ; |
| 4102 | #if (SIZEOF_LONG_INT == 8) |
| 4103 | long int num = 0x7fffffffffffffff; |
| 4104 | #else |
Kevin Steves | 6482ec8 | 2001-07-15 02:09:28 +0000 | [diff] [blame] | 4105 | long long num = 0x7fffffffffffffffll; |
Tim Rice | bee3f22 | 2001-03-11 17:32:12 -0800 | [diff] [blame] | 4106 | #endif |
| 4107 | strcpy(expected_out, "9223372036854775807"); |
| 4108 | snprintf(buf, mazsize, "%lld", num); |
| 4109 | if(strcmp(buf, expected_out) != 0) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4110 | exit(1); |
Tim Rice | bee3f22 | 2001-03-11 17:32:12 -0800 | [diff] [blame] | 4111 | exit(0); |
| 4112 | } |
| 4113 | #else |
| 4114 | main() { exit(0); } |
| 4115 | #endif |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4116 | ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ], |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 4117 | AC_MSG_WARN([cross compiling: Assuming working snprintf()]) |
Tim Rice | bee3f22 | 2001-03-11 17:32:12 -0800 | [diff] [blame] | 4118 | ) |
Ben Lindstrom | 3ad650a | 2001-01-03 06:02:51 +0000 | [diff] [blame] | 4119 | fi |
| 4120 | |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 4121 | dnl Checks for structure members |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4122 | OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP]) |
| 4123 | OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX]) |
| 4124 | OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX]) |
| 4125 | OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP]) |
| 4126 | OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP]) |
| 4127 | OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX]) |
| 4128 | OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP]) |
| 4129 | OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP]) |
| 4130 | OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX]) |
| 4131 | OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP]) |
| 4132 | OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX]) |
| 4133 | OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP]) |
| 4134 | OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX]) |
| 4135 | OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP]) |
| 4136 | OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP]) |
| 4137 | OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX]) |
| 4138 | OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX]) |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 4139 | |
| 4140 | AC_CHECK_MEMBERS([struct stat.st_blksize]) |
Damien Miller | bcd1485 | 2017-06-10 23:41:25 +1000 | [diff] [blame] | 4141 | AC_CHECK_MEMBERS([struct stat.st_mtim]) |
| 4142 | AC_CHECK_MEMBERS([struct stat.st_mtime]) |
Damien Miller | 6332da2 | 2013-04-23 14:25:52 +1000 | [diff] [blame] | 4143 | AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class, |
| 4144 | struct passwd.pw_change, struct passwd.pw_expire], |
| 4145 | [], [], [[ |
| 4146 | #include <sys/types.h> |
| 4147 | #include <pwd.h> |
| 4148 | ]]) |
| 4149 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4150 | AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state], |
Darren Tucker | 58e298d | 2005-11-25 13:14:58 +1100 | [diff] [blame] | 4151 | [Define if we don't have struct __res_state in resolv.h])], |
Damien Miller | 6332da2 | 2013-04-23 14:25:52 +1000 | [diff] [blame] | 4152 | [[ |
Darren Tucker | 58e298d | 2005-11-25 13:14:58 +1100 | [diff] [blame] | 4153 | #include <stdio.h> |
| 4154 | #if HAVE_SYS_TYPES_H |
| 4155 | # include <sys/types.h> |
| 4156 | #endif |
| 4157 | #include <netinet/in.h> |
| 4158 | #include <arpa/nameser.h> |
| 4159 | #include <resolv.h> |
Damien Miller | 6332da2 | 2013-04-23 14:25:52 +1000 | [diff] [blame] | 4160 | ]]) |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 4161 | |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4162 | AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage], |
| 4163 | ac_cv_have_ss_family_in_struct_ss, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4164 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | 8117111 | 2000-04-23 11:14:01 +1000 | [diff] [blame] | 4165 | #include <sys/types.h> |
| 4166 | #include <sys/socket.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4167 | ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])], |
| 4168 | [ ac_cv_have_ss_family_in_struct_ss="yes" ], |
| 4169 | [ ac_cv_have_ss_family_in_struct_ss="no" ]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4170 | ]) |
| 4171 | if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4172 | AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4173 | fi |
| 4174 | |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4175 | AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage], |
| 4176 | ac_cv_have___ss_family_in_struct_ss, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4177 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | 8117111 | 2000-04-23 11:14:01 +1000 | [diff] [blame] | 4178 | #include <sys/types.h> |
| 4179 | #include <sys/socket.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4180 | ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])], |
| 4181 | [ ac_cv_have___ss_family_in_struct_ss="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4182 | [ ac_cv_have___ss_family_in_struct_ss="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4183 | ]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4184 | ]) |
| 4185 | if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4186 | AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4187 | [Fields in struct sockaddr_storage]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4188 | fi |
Damien Miller | bf1c9b2 | 1999-12-09 10:16:54 +1100 | [diff] [blame] | 4189 | |
Tim Rice | 28bbb0c | 2002-05-27 17:37:32 -0700 | [diff] [blame] | 4190 | dnl make sure we're using the real structure members and not defines |
Kevin Steves | 939c9db | 2002-03-22 17:23:25 +0000 | [diff] [blame] | 4191 | AC_CACHE_CHECK([for msg_accrights field in struct msghdr], |
| 4192 | ac_cv_have_accrights_in_msghdr, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4193 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Tim Rice | ae49fe6 | 2002-04-12 10:26:21 -0700 | [diff] [blame] | 4194 | #include <sys/types.h> |
Kevin Steves | 939c9db | 2002-03-22 17:23:25 +0000 | [diff] [blame] | 4195 | #include <sys/socket.h> |
| 4196 | #include <sys/uio.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4197 | ]], [[ |
Tim Rice | 28bbb0c | 2002-05-27 17:37:32 -0700 | [diff] [blame] | 4198 | #ifdef msg_accrights |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 4199 | #error "msg_accrights is a macro" |
Tim Rice | 28bbb0c | 2002-05-27 17:37:32 -0700 | [diff] [blame] | 4200 | exit(1); |
| 4201 | #endif |
| 4202 | struct msghdr m; |
| 4203 | m.msg_accrights = 0; |
| 4204 | exit(0); |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4205 | ]])], |
Kevin Steves | 939c9db | 2002-03-22 17:23:25 +0000 | [diff] [blame] | 4206 | [ ac_cv_have_accrights_in_msghdr="yes" ], |
| 4207 | [ ac_cv_have_accrights_in_msghdr="no" ] |
| 4208 | ) |
| 4209 | ]) |
| 4210 | if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4211 | AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4212 | [Define if your system uses access rights style |
| 4213 | file descriptor passing]) |
Kevin Steves | 939c9db | 2002-03-22 17:23:25 +0000 | [diff] [blame] | 4214 | fi |
| 4215 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4216 | AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type]) |
| 4217 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Darren Tucker | e1a3ddf | 2012-05-04 11:05:45 +1000 | [diff] [blame] | 4218 | #include <sys/param.h> |
Darren Tucker | 3278062 | 2009-06-16 16:11:02 +1000 | [diff] [blame] | 4219 | #include <sys/stat.h> |
| 4220 | #ifdef HAVE_SYS_TIME_H |
| 4221 | # include <sys/time.h> |
| 4222 | #endif |
| 4223 | #ifdef HAVE_SYS_MOUNT_H |
| 4224 | #include <sys/mount.h> |
| 4225 | #endif |
| 4226 | #ifdef HAVE_SYS_STATVFS_H |
| 4227 | #include <sys/statvfs.h> |
| 4228 | #endif |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4229 | ]], [[ struct statvfs s; s.f_fsid = 0; ]])], |
| 4230 | [ AC_MSG_RESULT([yes]) ], |
| 4231 | [ AC_MSG_RESULT([no]) |
Darren Tucker | 3278062 | 2009-06-16 16:11:02 +1000 | [diff] [blame] | 4232 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4233 | AC_MSG_CHECKING([if fsid_t has member val]) |
| 4234 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Darren Tucker | 3278062 | 2009-06-16 16:11:02 +1000 | [diff] [blame] | 4235 | #include <sys/types.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4236 | #include <sys/statvfs.h> |
| 4237 | ]], [[ fsid_t t; t.val[0] = 0; ]])], |
| 4238 | [ AC_MSG_RESULT([yes]) |
| 4239 | AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ], |
| 4240 | [ AC_MSG_RESULT([no]) ]) |
Darren Tucker | 3278062 | 2009-06-16 16:11:02 +1000 | [diff] [blame] | 4241 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4242 | AC_MSG_CHECKING([if f_fsid has member __val]) |
| 4243 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Darren Tucker | 3278062 | 2009-06-16 16:11:02 +1000 | [diff] [blame] | 4244 | #include <sys/types.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4245 | #include <sys/statvfs.h> |
| 4246 | ]], [[ fsid_t t; t.__val[0] = 0; ]])], |
| 4247 | [ AC_MSG_RESULT([yes]) |
| 4248 | AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ], |
| 4249 | [ AC_MSG_RESULT([no]) ]) |
Darren Tucker | 3278062 | 2009-06-16 16:11:02 +1000 | [diff] [blame] | 4250 | ]) |
Darren Tucker | 7700138 | 2008-06-09 06:17:53 +1000 | [diff] [blame] | 4251 | |
Kevin Steves | a44e035 | 2002-04-07 16:18:03 +0000 | [diff] [blame] | 4252 | AC_CACHE_CHECK([for msg_control field in struct msghdr], |
| 4253 | ac_cv_have_control_in_msghdr, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4254 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Tim Rice | ae49fe6 | 2002-04-12 10:26:21 -0700 | [diff] [blame] | 4255 | #include <sys/types.h> |
Kevin Steves | a44e035 | 2002-04-07 16:18:03 +0000 | [diff] [blame] | 4256 | #include <sys/socket.h> |
| 4257 | #include <sys/uio.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4258 | ]], [[ |
Tim Rice | 28bbb0c | 2002-05-27 17:37:32 -0700 | [diff] [blame] | 4259 | #ifdef msg_control |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 4260 | #error "msg_control is a macro" |
Tim Rice | 28bbb0c | 2002-05-27 17:37:32 -0700 | [diff] [blame] | 4261 | exit(1); |
| 4262 | #endif |
| 4263 | struct msghdr m; |
| 4264 | m.msg_control = 0; |
| 4265 | exit(0); |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4266 | ]])], |
Kevin Steves | a44e035 | 2002-04-07 16:18:03 +0000 | [diff] [blame] | 4267 | [ ac_cv_have_control_in_msghdr="yes" ], |
| 4268 | [ ac_cv_have_control_in_msghdr="no" ] |
| 4269 | ) |
| 4270 | ]) |
| 4271 | if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4272 | AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4273 | [Define if your system uses ancillary data style |
| 4274 | file descriptor passing]) |
Kevin Steves | a44e035 | 2002-04-07 16:18:03 +0000 | [diff] [blame] | 4275 | fi |
| 4276 | |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4277 | AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4278 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], |
| 4279 | [[ extern char *__progname; printf("%s", __progname); ]])], |
| 4280 | [ ac_cv_libc_defines___progname="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4281 | [ ac_cv_libc_defines___progname="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4282 | ]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4283 | ]) |
| 4284 | if test "x$ac_cv_libc_defines___progname" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4285 | AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname]) |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4286 | fi |
| 4287 | |
Kevin Steves | 4846f4a | 2002-03-22 18:19:53 +0000 | [diff] [blame] | 4288 | AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4289 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], |
| 4290 | [[ printf("%s", __FUNCTION__); ]])], |
| 4291 | [ ac_cv_cc_implements___FUNCTION__="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4292 | [ ac_cv_cc_implements___FUNCTION__="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4293 | ]) |
Kevin Steves | 4846f4a | 2002-03-22 18:19:53 +0000 | [diff] [blame] | 4294 | ]) |
| 4295 | if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4296 | AC_DEFINE([HAVE___FUNCTION__], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4297 | [Define if compiler implements __FUNCTION__]) |
Kevin Steves | 4846f4a | 2002-03-22 18:19:53 +0000 | [diff] [blame] | 4298 | fi |
| 4299 | |
| 4300 | AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4301 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], |
| 4302 | [[ printf("%s", __func__); ]])], |
| 4303 | [ ac_cv_cc_implements___func__="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4304 | [ ac_cv_cc_implements___func__="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4305 | ]) |
Kevin Steves | 4846f4a | 2002-03-22 18:19:53 +0000 | [diff] [blame] | 4306 | ]) |
| 4307 | if test "x$ac_cv_cc_implements___func__" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4308 | AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__]) |
Kevin Steves | 4846f4a | 2002-03-22 18:19:53 +0000 | [diff] [blame] | 4309 | fi |
| 4310 | |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 4311 | AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4312 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 4313 | #include <stdarg.h> |
| 4314 | va_list x,y; |
| 4315 | ]], [[ va_copy(x,y); ]])], |
| 4316 | [ ac_cv_have_va_copy="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4317 | [ ac_cv_have_va_copy="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4318 | ]) |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 4319 | ]) |
| 4320 | if test "x$ac_cv_have_va_copy" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4321 | AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists]) |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 4322 | fi |
| 4323 | |
| 4324 | AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4325 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 4326 | #include <stdarg.h> |
| 4327 | va_list x,y; |
| 4328 | ]], [[ __va_copy(x,y); ]])], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4329 | [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4330 | ]) |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 4331 | ]) |
| 4332 | if test "x$ac_cv_have___va_copy" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4333 | AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists]) |
Damien Miller | 57f3915 | 2005-11-24 19:58:19 +1100 | [diff] [blame] | 4334 | fi |
| 4335 | |
Damien Miller | 4f8e669 | 2001-07-14 13:22:53 +1000 | [diff] [blame] | 4336 | AC_CACHE_CHECK([whether getopt has optreset support], |
| 4337 | ac_cv_have_getopt_optreset, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4338 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]], |
| 4339 | [[ extern int optreset; optreset = 0; ]])], |
| 4340 | [ ac_cv_have_getopt_optreset="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4341 | [ ac_cv_have_getopt_optreset="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4342 | ]) |
Damien Miller | 4f8e669 | 2001-07-14 13:22:53 +1000 | [diff] [blame] | 4343 | ]) |
| 4344 | if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4345 | AC_DEFINE([HAVE_GETOPT_OPTRESET], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4346 | [Define if your getopt(3) defines and uses optreset]) |
Damien Miller | 4f8e669 | 2001-07-14 13:22:53 +1000 | [diff] [blame] | 4347 | fi |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4348 | |
Damien Miller | ecbb26d | 2000-07-15 14:59:14 +1000 | [diff] [blame] | 4349 | AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4350 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], |
| 4351 | [[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])], |
| 4352 | [ ac_cv_libc_defines_sys_errlist="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4353 | [ ac_cv_libc_defines_sys_errlist="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4354 | ]) |
Damien Miller | ecbb26d | 2000-07-15 14:59:14 +1000 | [diff] [blame] | 4355 | ]) |
| 4356 | if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4357 | AC_DEFINE([HAVE_SYS_ERRLIST], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4358 | [Define if your system defines sys_errlist[]]) |
Damien Miller | ecbb26d | 2000-07-15 14:59:14 +1000 | [diff] [blame] | 4359 | fi |
| 4360 | |
| 4361 | |
Damien Miller | 11fa2cc | 2000-08-16 10:35:58 +1000 | [diff] [blame] | 4362 | AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4363 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], |
| 4364 | [[ extern int sys_nerr; printf("%i", sys_nerr);]])], |
| 4365 | [ ac_cv_libc_defines_sys_nerr="yes" ], |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4366 | [ ac_cv_libc_defines_sys_nerr="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4367 | ]) |
Damien Miller | 11fa2cc | 2000-08-16 10:35:58 +1000 | [diff] [blame] | 4368 | ]) |
| 4369 | if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4370 | AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr]) |
Damien Miller | 11fa2cc | 2000-08-16 10:35:58 +1000 | [diff] [blame] | 4371 | fi |
| 4372 | |
Darren Tucker | 5f88d34 | 2003-10-15 16:57:57 +1000 | [diff] [blame] | 4373 | # Check libraries needed by DNS fingerprint support |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4374 | AC_SEARCH_LIBS([getrrsetbyname], [resolv], |
| 4375 | [AC_DEFINE([HAVE_GETRRSETBYNAME], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4376 | [Define if getrrsetbyname() exists])], |
Damien Miller | 7abe09b | 2003-05-15 10:53:49 +1000 | [diff] [blame] | 4377 | [ |
Darren Tucker | 5f88d34 | 2003-10-15 16:57:57 +1000 | [diff] [blame] | 4378 | # Needed by our getrrsetbyname() |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4379 | AC_SEARCH_LIBS([res_query], [resolv]) |
| 4380 | AC_SEARCH_LIBS([dn_expand], [resolv]) |
| 4381 | AC_MSG_CHECKING([if res_query will link]) |
| 4382 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Darren Tucker | e02b49a | 2009-09-11 14:56:08 +1000 | [diff] [blame] | 4383 | #include <sys/types.h> |
| 4384 | #include <netinet/in.h> |
| 4385 | #include <arpa/nameser.h> |
| 4386 | #include <netdb.h> |
| 4387 | #include <resolv.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4388 | ]], [[ |
Darren Tucker | e02b49a | 2009-09-11 14:56:08 +1000 | [diff] [blame] | 4389 | res_query (0, 0, 0, 0, 0); |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4390 | ]])], |
| 4391 | AC_MSG_RESULT([yes]), |
| 4392 | [AC_MSG_RESULT([no]) |
Darren Tucker | 8e968a5 | 2004-05-13 11:56:16 +1000 | [diff] [blame] | 4393 | saved_LIBS="$LIBS" |
| 4394 | LIBS="$LIBS -lresolv" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4395 | AC_MSG_CHECKING([for res_query in -lresolv]) |
| 4396 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Darren Tucker | e02b49a | 2009-09-11 14:56:08 +1000 | [diff] [blame] | 4397 | #include <sys/types.h> |
| 4398 | #include <netinet/in.h> |
| 4399 | #include <arpa/nameser.h> |
| 4400 | #include <netdb.h> |
Darren Tucker | 8e968a5 | 2004-05-13 11:56:16 +1000 | [diff] [blame] | 4401 | #include <resolv.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4402 | ]], [[ |
Darren Tucker | 8e968a5 | 2004-05-13 11:56:16 +1000 | [diff] [blame] | 4403 | res_query (0, 0, 0, 0, 0); |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4404 | ]])], |
| 4405 | [AC_MSG_RESULT([yes])], |
Darren Tucker | 8e968a5 | 2004-05-13 11:56:16 +1000 | [diff] [blame] | 4406 | [LIBS="$saved_LIBS" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4407 | AC_MSG_RESULT([no])]) |
Darren Tucker | 8e968a5 | 2004-05-13 11:56:16 +1000 | [diff] [blame] | 4408 | ]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4409 | AC_CHECK_FUNCS([_getshort _getlong]) |
Darren Tucker | d886e1c | 2005-06-01 18:57:45 +1000 | [diff] [blame] | 4410 | AC_CHECK_DECLS([_getshort, _getlong], , , |
Tim Rice | fcc7ff1 | 2005-06-02 20:28:29 -0700 | [diff] [blame] | 4411 | [#include <sys/types.h> |
| 4412 | #include <arpa/nameser.h>]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4413 | AC_CHECK_MEMBER([HEADER.ad], |
| 4414 | [AC_DEFINE([HAVE_HEADER_AD], [1], |
| 4415 | [Define if HEADER.ad exists in arpa/nameser.h])], , |
Darren Tucker | 5f88d34 | 2003-10-15 16:57:57 +1000 | [diff] [blame] | 4416 | [#include <arpa/nameser.h>]) |
| 4417 | ]) |
Damien Miller | 7abe09b | 2003-05-15 10:53:49 +1000 | [diff] [blame] | 4418 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4419 | AC_MSG_CHECKING([if struct __res_state _res is an extern]) |
| 4420 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Darren Tucker | cc40d5e | 2007-04-29 13:58:06 +1000 | [diff] [blame] | 4421 | #include <stdio.h> |
| 4422 | #if HAVE_SYS_TYPES_H |
| 4423 | # include <sys/types.h> |
| 4424 | #endif |
| 4425 | #include <netinet/in.h> |
| 4426 | #include <arpa/nameser.h> |
| 4427 | #include <resolv.h> |
| 4428 | extern struct __res_state _res; |
Darren Tucker | 7ad8b28 | 2015-09-11 13:11:02 +1000 | [diff] [blame] | 4429 | ]], [[ |
| 4430 | struct __res_state *volatile p = &_res; /* force resolution of _res */ |
| 4431 | return 0; |
| 4432 | ]],)], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4433 | [AC_MSG_RESULT([yes]) |
| 4434 | AC_DEFINE([HAVE__RES_EXTERN], [1], |
Darren Tucker | cc40d5e | 2007-04-29 13:58:06 +1000 | [diff] [blame] | 4435 | [Define if you have struct __res_state _res as an extern]) |
| 4436 | ], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4437 | [ AC_MSG_RESULT([no]) ] |
Darren Tucker | cc40d5e | 2007-04-29 13:58:06 +1000 | [diff] [blame] | 4438 | ) |
| 4439 | |
Damien Miller | 73b42d2 | 2006-04-22 21:26:08 +1000 | [diff] [blame] | 4440 | # Check whether user wants SELinux support |
| 4441 | SELINUX_MSG="no" |
| 4442 | LIBSELINUX="" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4443 | AC_ARG_WITH([selinux], |
Damien Miller | 5b1c8b3 | 2008-03-27 12:33:07 +1100 | [diff] [blame] | 4444 | [ --with-selinux Enable SELinux support], |
Damien Miller | 73b42d2 | 2006-04-22 21:26:08 +1000 | [diff] [blame] | 4445 | [ if test "x$withval" != "xno" ; then |
Darren Tucker | 20e9f97 | 2007-03-25 18:26:01 +1000 | [diff] [blame] | 4446 | save_LIBS="$LIBS" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4447 | AC_DEFINE([WITH_SELINUX], [1], |
| 4448 | [Define if you want SELinux support.]) |
Damien Miller | 73b42d2 | 2006-04-22 21:26:08 +1000 | [diff] [blame] | 4449 | SELINUX_MSG="yes" |
| 4450 | AC_CHECK_HEADER([selinux/selinux.h], , |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4451 | AC_MSG_ERROR([SELinux support requires selinux.h header])) |
| 4452 | AC_CHECK_LIB([selinux], [setexeccon], |
Damien Miller | 1d2bfc4 | 2010-02-10 10:19:29 +1100 | [diff] [blame] | 4453 | [ LIBSELINUX="-lselinux" |
| 4454 | LIBS="$LIBS -lselinux" |
| 4455 | ], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4456 | AC_MSG_ERROR([SELinux support requires libselinux library])) |
Damien Miller | 71adf12 | 2011-01-25 12:16:15 +1100 | [diff] [blame] | 4457 | SSHLIBS="$SSHLIBS $LIBSELINUX" |
Darren Tucker | 20e9f97 | 2007-03-25 18:26:01 +1000 | [diff] [blame] | 4458 | SSHDLIBS="$SSHDLIBS $LIBSELINUX" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4459 | AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level]) |
Darren Tucker | adc947d | 2006-10-07 09:07:20 +1000 | [diff] [blame] | 4460 | LIBS="$save_LIBS" |
Damien Miller | 73b42d2 | 2006-04-22 21:26:08 +1000 | [diff] [blame] | 4461 | fi ] |
| 4462 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4463 | AC_SUBST([SSHLIBS]) |
| 4464 | AC_SUBST([SSHDLIBS]) |
Damien Miller | 73b42d2 | 2006-04-22 21:26:08 +1000 | [diff] [blame] | 4465 | |
Damien Miller | fd4c9ee | 2002-04-13 11:04:40 +1000 | [diff] [blame] | 4466 | # Check whether user wants Kerberos 5 support |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4467 | KRB5_MSG="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4468 | AC_ARG_WITH([kerberos5], |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4469 | [ --with-kerberos5=PATH Enable Kerberos 5 support], |
Darren Tucker | 1d3ca58 | 2004-01-22 12:05:34 +1100 | [diff] [blame] | 4470 | [ if test "x$withval" != "xno" ; then |
| 4471 | if test "x$withval" = "xyes" ; then |
| 4472 | KRB5ROOT="/usr/local" |
| 4473 | else |
| 4474 | KRB5ROOT=${withval} |
| 4475 | fi |
| 4476 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4477 | AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support]) |
Darren Tucker | 1d3ca58 | 2004-01-22 12:05:34 +1100 | [diff] [blame] | 4478 | KRB5_MSG="yes" |
| 4479 | |
Darren Tucker | 4089fc1 | 2016-12-08 12:57:24 +1100 | [diff] [blame] | 4480 | AC_PATH_TOOL([KRB5CONF], [krb5-config], |
Darren Tucker | dad48e7 | 2009-09-01 18:26:00 +1000 | [diff] [blame] | 4481 | [$KRB5ROOT/bin/krb5-config], |
| 4482 | [$KRB5ROOT/bin:$PATH]) |
| 4483 | if test -x $KRB5CONF ; then |
Darren Tucker | 964de18 | 2013-02-22 10:39:59 +1100 | [diff] [blame] | 4484 | K5CFLAGS="`$KRB5CONF --cflags`" |
| 4485 | K5LIBS="`$KRB5CONF --libs`" |
| 4486 | CPPFLAGS="$CPPFLAGS $K5CFLAGS" |
Darren Tucker | 1d3ca58 | 2004-01-22 12:05:34 +1100 | [diff] [blame] | 4487 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4488 | AC_MSG_CHECKING([for gssapi support]) |
Darren Tucker | 1d3ca58 | 2004-01-22 12:05:34 +1100 | [diff] [blame] | 4489 | if $KRB5CONF | grep gssapi >/dev/null ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4490 | AC_MSG_RESULT([yes]) |
| 4491 | AC_DEFINE([GSSAPI], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4492 | [Define this if you want GSSAPI |
| 4493 | support in the version 2 protocol]) |
Darren Tucker | 964de18 | 2013-02-22 10:39:59 +1100 | [diff] [blame] | 4494 | GSSCFLAGS="`$KRB5CONF --cflags gssapi`" |
| 4495 | GSSLIBS="`$KRB5CONF --libs gssapi`" |
| 4496 | CPPFLAGS="$CPPFLAGS $GSSCFLAGS" |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4497 | else |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4498 | AC_MSG_RESULT([no]) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4499 | fi |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4500 | AC_MSG_CHECKING([whether we are using Heimdal]) |
| 4501 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h> |
| 4502 | ]], [[ char *tmp = heimdal_version; ]])], |
| 4503 | [ AC_MSG_RESULT([yes]) |
| 4504 | AC_DEFINE([HEIMDAL], [1], |
| 4505 | [Define this if you are using the Heimdal |
| 4506 | version of Kerberos V5]) ], |
| 4507 | [AC_MSG_RESULT([no]) |
| 4508 | ]) |
Darren Tucker | 1d3ca58 | 2004-01-22 12:05:34 +1100 | [diff] [blame] | 4509 | else |
Damien Miller | fd4c9ee | 2002-04-13 11:04:40 +1000 | [diff] [blame] | 4510 | CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include" |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4511 | LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4512 | AC_MSG_CHECKING([whether we are using Heimdal]) |
| 4513 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h> |
| 4514 | ]], [[ char *tmp = heimdal_version; ]])], |
| 4515 | [ AC_MSG_RESULT([yes]) |
| 4516 | AC_DEFINE([HEIMDAL]) |
Damien Miller | 41bccf7 | 2011-01-02 21:53:07 +1100 | [diff] [blame] | 4517 | K5LIBS="-lkrb5" |
Damien Miller | 5561e0b | 2004-04-20 20:28:55 +1000 | [diff] [blame] | 4518 | K5LIBS="$K5LIBS -lcom_err -lasn1" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4519 | AC_CHECK_LIB([roken], [net_write], |
Damien Miller | 5561e0b | 2004-04-20 20:28:55 +1000 | [diff] [blame] | 4520 | [K5LIBS="$K5LIBS -lroken"]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4521 | AC_CHECK_LIB([des], [des_cbc_encrypt], |
Damien Miller | 41bccf7 | 2011-01-02 21:53:07 +1100 | [diff] [blame] | 4522 | [K5LIBS="$K5LIBS -ldes"]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4523 | ], [ AC_MSG_RESULT([no]) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4524 | K5LIBS="-lkrb5 -lk5crypto -lcom_err" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4525 | ]) |
| 4526 | AC_SEARCH_LIBS([dn_expand], [resolv]) |
Damien Miller | fd4c9ee | 2002-04-13 11:04:40 +1000 | [diff] [blame] | 4527 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4528 | AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context], |
| 4529 | [ AC_DEFINE([GSSAPI]) |
Darren Tucker | 964de18 | 2013-02-22 10:39:59 +1100 | [diff] [blame] | 4530 | GSSLIBS="-lgssapi_krb5" ], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4531 | [ AC_CHECK_LIB([gssapi], [gss_init_sec_context], |
| 4532 | [ AC_DEFINE([GSSAPI]) |
Darren Tucker | 964de18 | 2013-02-22 10:39:59 +1100 | [diff] [blame] | 4533 | GSSLIBS="-lgssapi" ], |
Darren Tucker | a2b5a4c | 2013-02-22 10:43:15 +1100 | [diff] [blame] | 4534 | [ AC_CHECK_LIB([gss], [gss_init_sec_context], |
| 4535 | [ AC_DEFINE([GSSAPI]) |
| 4536 | GSSLIBS="-lgss" ], |
| 4537 | AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail])) |
| 4538 | ]) |
Darren Tucker | 964de18 | 2013-02-22 10:39:59 +1100 | [diff] [blame] | 4539 | ]) |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 4540 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4541 | AC_CHECK_HEADER([gssapi.h], , |
Darren Tucker | 49aaf4a | 2003-08-26 11:58:16 +1000 | [diff] [blame] | 4542 | [ unset ac_cv_header_gssapi_h |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4543 | CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4544 | AC_CHECK_HEADERS([gssapi.h], , |
Darren Tucker | 49aaf4a | 2003-08-26 11:58:16 +1000 | [diff] [blame] | 4545 | AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail]) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4546 | ) |
Darren Tucker | 49aaf4a | 2003-08-26 11:58:16 +1000 | [diff] [blame] | 4547 | ] |
| 4548 | ) |
| 4549 | |
| 4550 | oldCPP="$CPPFLAGS" |
| 4551 | CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4552 | AC_CHECK_HEADER([gssapi_krb5.h], , |
Darren Tucker | 49aaf4a | 2003-08-26 11:58:16 +1000 | [diff] [blame] | 4553 | [ CPPFLAGS="$oldCPP" ]) |
| 4554 | |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4555 | fi |
Darren Tucker | 2f0bad2 | 2019-01-21 21:28:27 +1100 | [diff] [blame] | 4556 | if test -n "${rpath_opt}" ; then |
| 4557 | LDFLAGS="$LDFLAGS ${rpath_opt}${KRB5ROOT}/lib" |
Darren Tucker | 1d3ca58 | 2004-01-22 12:05:34 +1100 | [diff] [blame] | 4558 | fi |
| 4559 | if test ! -z "$blibpath" ; then |
| 4560 | blibpath="$blibpath:${KRB5ROOT}/lib" |
| 4561 | fi |
Tim Rice | fd9e9e3 | 2005-09-12 17:36:10 -0700 | [diff] [blame] | 4562 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4563 | AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h]) |
| 4564 | AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h]) |
| 4565 | AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h]) |
Tim Rice | fd9e9e3 | 2005-09-12 17:36:10 -0700 | [diff] [blame] | 4566 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4567 | AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1], |
| 4568 | [Define this if you want to use libkafs' AFS support])]) |
Darren Tucker | 03978c6 | 2013-02-25 11:24:44 +1100 | [diff] [blame] | 4569 | |
| 4570 | AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[ |
| 4571 | #ifdef HAVE_GSSAPI_H |
| 4572 | # include <gssapi.h> |
| 4573 | #elif defined(HAVE_GSSAPI_GSSAPI_H) |
| 4574 | # include <gssapi/gssapi.h> |
| 4575 | #endif |
| 4576 | |
| 4577 | #ifdef HAVE_GSSAPI_GENERIC_H |
| 4578 | # include <gssapi_generic.h> |
| 4579 | #elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H) |
| 4580 | # include <gssapi/gssapi_generic.h> |
| 4581 | #endif |
| 4582 | ]]) |
Darren Tucker | f3ab2c5 | 2013-08-04 21:48:41 +1000 | [diff] [blame] | 4583 | saved_LIBS="$LIBS" |
| 4584 | LIBS="$LIBS $K5LIBS" |
| 4585 | AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message]) |
| 4586 | LIBS="$saved_LIBS" |
| 4587 | |
Darren Tucker | 0d27ed1 | 2004-02-24 10:37:33 +1100 | [diff] [blame] | 4588 | fi |
Darren Tucker | 0d27ed1 | 2004-02-24 10:37:33 +1100 | [diff] [blame] | 4589 | ] |
Damien Miller | fd4c9ee | 2002-04-13 11:04:40 +1000 | [diff] [blame] | 4590 | ) |
Darren Tucker | 964de18 | 2013-02-22 10:39:59 +1100 | [diff] [blame] | 4591 | AC_SUBST([GSSLIBS]) |
| 4592 | AC_SUBST([K5LIBS]) |
Damien Miller | c79bc0d | 2001-03-28 13:03:42 +1000 | [diff] [blame] | 4593 | |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4594 | # Looking for programs, paths and files |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4595 | |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 4596 | PRIVSEP_PATH=/var/empty |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4597 | AC_ARG_WITH([privsep-path], |
Tim Rice | cbb9066 | 2002-07-08 19:17:10 -0700 | [diff] [blame] | 4598 | [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)], |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 4599 | [ |
Tim Rice | 35cc69d | 2005-03-17 16:44:25 -0800 | [diff] [blame] | 4600 | if test -n "$withval" && test "x$withval" != "xno" && \ |
| 4601 | test "x${withval}" != "xyes"; then |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 4602 | PRIVSEP_PATH=$withval |
| 4603 | fi |
| 4604 | ] |
| 4605 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4606 | AC_SUBST([PRIVSEP_PATH]) |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 4607 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4608 | AC_ARG_WITH([xauth], |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4609 | [ --with-xauth=PATH Specify path to xauth program ], |
| 4610 | [ |
Tim Rice | 35cc69d | 2005-03-17 16:44:25 -0800 | [diff] [blame] | 4611 | if test -n "$withval" && test "x$withval" != "xno" && \ |
| 4612 | test "x${withval}" != "xyes"; then |
Damien Miller | 7b22d65 | 2000-06-18 14:07:04 +1000 | [diff] [blame] | 4613 | xauth_path=$withval |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4614 | fi |
| 4615 | ], |
| 4616 | [ |
Tim Rice | e22be3b | 2002-07-17 19:20:07 -0700 | [diff] [blame] | 4617 | TestPath="$PATH" |
| 4618 | TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin" |
| 4619 | TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11" |
| 4620 | TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin" |
| 4621 | TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4622 | AC_PATH_PROG([xauth_path], [xauth], , [$TestPath]) |
Damien Miller | edb8292 | 2000-06-20 13:25:52 +1000 | [diff] [blame] | 4623 | if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4624 | xauth_path="/usr/openwin/bin/xauth" |
| 4625 | fi |
| 4626 | ] |
| 4627 | ) |
| 4628 | |
Damien Miller | 7d90127 | 2003-01-13 16:55:22 +1100 | [diff] [blame] | 4629 | STRIP_OPT=-s |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4630 | AC_ARG_ENABLE([strip], |
Damien Miller | 7d90127 | 2003-01-13 16:55:22 +1100 | [diff] [blame] | 4631 | [ --disable-strip Disable calling strip(1) on install], |
| 4632 | [ |
| 4633 | if test "x$enableval" = "xno" ; then |
| 4634 | STRIP_OPT= |
| 4635 | fi |
| 4636 | ] |
| 4637 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4638 | AC_SUBST([STRIP_OPT]) |
Damien Miller | 7d90127 | 2003-01-13 16:55:22 +1100 | [diff] [blame] | 4639 | |
Damien Miller | a19cf47 | 2000-11-29 13:28:50 +1100 | [diff] [blame] | 4640 | if test -z "$xauth_path" ; then |
| 4641 | XAUTH_PATH="undefined" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4642 | AC_SUBST([XAUTH_PATH]) |
Damien Miller | a19cf47 | 2000-11-29 13:28:50 +1100 | [diff] [blame] | 4643 | else |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4644 | AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4645 | [Define if xauth is found in your path]) |
Damien Miller | a19cf47 | 2000-11-29 13:28:50 +1100 | [diff] [blame] | 4646 | XAUTH_PATH=$xauth_path |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4647 | AC_SUBST([XAUTH_PATH]) |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4648 | fi |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4649 | |
Tim Rice | 90f42b0 | 2011-06-02 18:17:49 -0700 | [diff] [blame] | 4650 | dnl # --with-maildir=/path/to/mail gets top priority. |
| 4651 | dnl # if maildir is set in the platform case statement above we use that. |
| 4652 | dnl # Otherwise we run a program to get the dir from system headers. |
| 4653 | dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL |
| 4654 | dnl # If we find _PATH_MAILDIR we do nothing because that is what |
| 4655 | dnl # session.c expects anyway. Otherwise we set to the value found |
| 4656 | dnl # stripping any trailing slash. If for some strage reason our program |
| 4657 | dnl # does not find what it needs, we default to /var/spool/mail. |
| 4658 | # Check for mail directory |
| 4659 | AC_ARG_WITH([maildir], |
| 4660 | [ --with-maildir=/path/to/mail Specify your system mail directory], |
| 4661 | [ |
| 4662 | if test "X$withval" != X && test "x$withval" != xno && \ |
| 4663 | test "x${withval}" != xyes; then |
| 4664 | AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"], |
| 4665 | [Set this to your mail directory if you do not have _PATH_MAILDIR]) |
| 4666 | fi |
| 4667 | ],[ |
| 4668 | if test "X$maildir" != "X"; then |
| 4669 | AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"]) |
| 4670 | else |
| 4671 | AC_MSG_CHECKING([Discovering system mail directory]) |
| 4672 | AC_RUN_IFELSE( |
| 4673 | [AC_LANG_PROGRAM([[ |
| 4674 | #include <stdio.h> |
| 4675 | #include <string.h> |
| 4676 | #ifdef HAVE_PATHS_H |
| 4677 | #include <paths.h> |
| 4678 | #endif |
| 4679 | #ifdef HAVE_MAILLOCK_H |
| 4680 | #include <maillock.h> |
| 4681 | #endif |
| 4682 | #define DATA "conftest.maildir" |
| 4683 | ]], [[ |
| 4684 | FILE *fd; |
| 4685 | int rc; |
| 4686 | |
| 4687 | fd = fopen(DATA,"w"); |
| 4688 | if(fd == NULL) |
| 4689 | exit(1); |
| 4690 | |
| 4691 | #if defined (_PATH_MAILDIR) |
| 4692 | if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0) |
| 4693 | exit(1); |
| 4694 | #elif defined (MAILDIR) |
| 4695 | if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0) |
| 4696 | exit(1); |
| 4697 | #elif defined (_PATH_MAIL) |
| 4698 | if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0) |
| 4699 | exit(1); |
| 4700 | #else |
| 4701 | exit (2); |
| 4702 | #endif |
| 4703 | |
| 4704 | exit(0); |
| 4705 | ]])], |
| 4706 | [ |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 4707 | maildir_what=`awk -F: '{print $1}' conftest.maildir` |
Tim Rice | 90f42b0 | 2011-06-02 18:17:49 -0700 | [diff] [blame] | 4708 | maildir=`awk -F: '{print $2}' conftest.maildir \ |
| 4709 | | sed 's|/$||'` |
| 4710 | AC_MSG_RESULT([Using: $maildir from $maildir_what]) |
| 4711 | if test "x$maildir_what" != "x_PATH_MAILDIR"; then |
| 4712 | AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"]) |
| 4713 | fi |
| 4714 | ], |
| 4715 | [ |
| 4716 | if test "X$ac_status" = "X2";then |
| 4717 | # our test program didn't find it. Default to /var/spool/mail |
| 4718 | AC_MSG_RESULT([Using: default value of /var/spool/mail]) |
| 4719 | AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"]) |
| 4720 | else |
| 4721 | AC_MSG_RESULT([*** not found ***]) |
| 4722 | fi |
| 4723 | ], |
| 4724 | [ |
| 4725 | AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail]) |
| 4726 | ] |
| 4727 | ) |
| 4728 | fi |
| 4729 | ] |
| 4730 | ) # maildir |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4731 | |
Darren Tucker | 623d92f | 2004-09-12 22:36:15 +1000 | [diff] [blame] | 4732 | if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 4733 | AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test]) |
| 4734 | disable_ptmx_check=yes |
| 4735 | fi |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4736 | if test -z "$no_dev_ptmx" ; then |
Kevin Steves | 0ea1d9d | 2002-04-25 18:17:04 +0000 | [diff] [blame] | 4737 | if test "x$disable_ptmx_check" != "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4738 | AC_CHECK_FILE(["/dev/ptmx"], |
Kevin Steves | 0ea1d9d | 2002-04-25 18:17:04 +0000 | [diff] [blame] | 4739 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4740 | AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4741 | [Define if you have /dev/ptmx]) |
Kevin Steves | 0ea1d9d | 2002-04-25 18:17:04 +0000 | [diff] [blame] | 4742 | have_dev_ptmx=1 |
| 4743 | ] |
| 4744 | ) |
| 4745 | fi |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4746 | fi |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 4747 | |
Darren Tucker | 623d92f | 2004-09-12 22:36:15 +1000 | [diff] [blame] | 4748 | if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4749 | AC_CHECK_FILE(["/dev/ptc"], |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 4750 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4751 | AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4752 | [Define if you have /dev/ptc]) |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 4753 | have_dev_ptc=1 |
| 4754 | ] |
| 4755 | ) |
| 4756 | else |
| 4757 | AC_MSG_WARN([cross compiling: Disabling /dev/ptc test]) |
| 4758 | fi |
Damien Miller | 204ad07 | 2000-03-02 23:56:12 +1100 | [diff] [blame] | 4759 | |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4760 | # Options from here on. Some of these are preset by platform above |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4761 | AC_ARG_WITH([mantype], |
Damien Miller | 897741e | 2001-04-16 10:41:46 +1000 | [diff] [blame] | 4762 | [ --with-mantype=man|cat|doc Set man page type], |
Damien Miller | 670a4b8 | 2000-01-22 13:53:11 +1100 | [diff] [blame] | 4763 | [ |
Damien Miller | 897741e | 2001-04-16 10:41:46 +1000 | [diff] [blame] | 4764 | case "$withval" in |
| 4765 | man|cat|doc) |
| 4766 | MANTYPE=$withval |
| 4767 | ;; |
| 4768 | *) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4769 | AC_MSG_ERROR([invalid man type: $withval]) |
Damien Miller | 897741e | 2001-04-16 10:41:46 +1000 | [diff] [blame] | 4770 | ;; |
| 4771 | esac |
Damien Miller | 670a4b8 | 2000-01-22 13:53:11 +1100 | [diff] [blame] | 4772 | ] |
| 4773 | ) |
Ben Lindstrom | bc70992 | 2001-04-18 18:04:21 +0000 | [diff] [blame] | 4774 | if test -z "$MANTYPE"; then |
Darren Tucker | 285546b | 2019-05-10 15:04:42 +1000 | [diff] [blame] | 4775 | if ${MANDOC} ${srcdir}/ssh.1 >/dev/null 2>&1; then |
| 4776 | MANTYPE=doc |
| 4777 | elif ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then |
Ben Lindstrom | bc70992 | 2001-04-18 18:04:21 +0000 | [diff] [blame] | 4778 | MANTYPE=doc |
| 4779 | elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then |
| 4780 | MANTYPE=man |
| 4781 | else |
| 4782 | MANTYPE=cat |
| 4783 | fi |
| 4784 | fi |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4785 | AC_SUBST([MANTYPE]) |
Ben Lindstrom | bc70992 | 2001-04-18 18:04:21 +0000 | [diff] [blame] | 4786 | if test "$MANTYPE" = "doc"; then |
| 4787 | mansubdir=man; |
| 4788 | else |
| 4789 | mansubdir=$MANTYPE; |
| 4790 | fi |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4791 | AC_SUBST([mansubdir]) |
Damien Miller | 8bdeee2 | 1999-12-30 15:50:54 +1100 | [diff] [blame] | 4792 | |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4793 | # Check whether to enable MD5 passwords |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4794 | MD5_MSG="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4795 | AC_ARG_WITH([md5-passwords], |
Damien Miller | dd1c7ba | 1999-11-19 15:53:20 +1100 | [diff] [blame] | 4796 | [ --with-md5-passwords Enable use of MD5 passwords], |
Damien Miller | 8bdeee2 | 1999-12-30 15:50:54 +1100 | [diff] [blame] | 4797 | [ |
Damien Miller | b85dcad | 2000-03-11 11:37:00 +1100 | [diff] [blame] | 4798 | if test "x$withval" != "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4799 | AC_DEFINE([HAVE_MD5_PASSWORDS], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4800 | [Define if you want to allow MD5 passwords]) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4801 | MD5_MSG="yes" |
Damien Miller | 8bdeee2 | 1999-12-30 15:50:54 +1100 | [diff] [blame] | 4802 | fi |
| 4803 | ] |
Damien Miller | dd1c7ba | 1999-11-19 15:53:20 +1100 | [diff] [blame] | 4804 | ) |
| 4805 | |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4806 | # Whether to disable shadow password support |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4807 | AC_ARG_WITH([shadow], |
Damien Miller | 76112de | 1999-12-21 11:18:08 +1100 | [diff] [blame] | 4808 | [ --without-shadow Disable shadow password support], |
| 4809 | [ |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 4810 | if test "x$withval" = "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4811 | AC_DEFINE([DISABLE_SHADOW]) |
Damien Miller | 1f335fb | 2000-06-26 11:31:33 +1000 | [diff] [blame] | 4812 | disable_shadow=yes |
Damien Miller | 76112de | 1999-12-21 11:18:08 +1100 | [diff] [blame] | 4813 | fi |
| 4814 | ] |
| 4815 | ) |
| 4816 | |
Damien Miller | 1f335fb | 2000-06-26 11:31:33 +1000 | [diff] [blame] | 4817 | if test -z "$disable_shadow" ; then |
| 4818 | AC_MSG_CHECKING([if the systems has expire shadow information]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4819 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | 1f335fb | 2000-06-26 11:31:33 +1000 | [diff] [blame] | 4820 | #include <sys/types.h> |
| 4821 | #include <shadow.h> |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4822 | struct spwd sp; |
| 4823 | ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])], |
| 4824 | [ sp_expire_available=yes ], [ |
| 4825 | ]) |
Damien Miller | 1f335fb | 2000-06-26 11:31:33 +1000 | [diff] [blame] | 4826 | |
| 4827 | if test "x$sp_expire_available" = "xyes" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4828 | AC_MSG_RESULT([yes]) |
| 4829 | AC_DEFINE([HAS_SHADOW_EXPIRE], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4830 | [Define if you want to use shadow password expire field]) |
Damien Miller | 1f335fb | 2000-06-26 11:31:33 +1000 | [diff] [blame] | 4831 | else |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4832 | AC_MSG_RESULT([no]) |
Damien Miller | 1f335fb | 2000-06-26 11:31:33 +1000 | [diff] [blame] | 4833 | fi |
| 4834 | fi |
| 4835 | |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4836 | # Use ip address instead of hostname in $DISPLAY |
Damien Miller | 9a94734 | 2000-08-30 10:03:33 +1100 | [diff] [blame] | 4837 | if test ! -z "$IPADDR_IN_DISPLAY" ; then |
| 4838 | DISPLAY_HACK_MSG="yes" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4839 | AC_DEFINE([IPADDR_IN_DISPLAY], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4840 | [Define if you need to use IP address |
| 4841 | instead of hostname in $DISPLAY]) |
Damien Miller | 9a94734 | 2000-08-30 10:03:33 +1100 | [diff] [blame] | 4842 | else |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4843 | DISPLAY_HACK_MSG="no" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4844 | AC_ARG_WITH([ipaddr-display], |
Tim Rice | 6397eed | 2015-06-03 21:41:11 -0700 | [diff] [blame] | 4845 | [ --with-ipaddr-display Use ip address instead of hostname in $DISPLAY], |
Damien Miller | 9a94734 | 2000-08-30 10:03:33 +1100 | [diff] [blame] | 4846 | [ |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 4847 | if test "x$withval" != "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4848 | AC_DEFINE([IPADDR_IN_DISPLAY]) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4849 | DISPLAY_HACK_MSG="yes" |
Damien Miller | 9a94734 | 2000-08-30 10:03:33 +1100 | [diff] [blame] | 4850 | fi |
| 4851 | ] |
| 4852 | ) |
| 4853 | fi |
Damien Miller | 76112de | 1999-12-21 11:18:08 +1100 | [diff] [blame] | 4854 | |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 4855 | # check for /etc/default/login and use it if present. |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4856 | AC_ARG_ENABLE([etc-default-login], |
Darren Tucker | 1b6f229 | 2005-02-11 16:11:49 +1100 | [diff] [blame] | 4857 | [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]], |
Darren Tucker | 2f9573d | 2005-02-10 22:28:54 +1100 | [diff] [blame] | 4858 | [ if test "x$enableval" = "xno"; then |
| 4859 | AC_MSG_NOTICE([/etc/default/login handling disabled]) |
| 4860 | etc_default_login=no |
| 4861 | else |
| 4862 | etc_default_login=yes |
| 4863 | fi ], |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 4864 | [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; |
| 4865 | then |
| 4866 | AC_MSG_WARN([cross compiling: not checking /etc/default/login]) |
| 4867 | etc_default_login=no |
| 4868 | else |
| 4869 | etc_default_login=yes |
| 4870 | fi ] |
Darren Tucker | 2f9573d | 2005-02-10 22:28:54 +1100 | [diff] [blame] | 4871 | ) |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 4872 | |
Darren Tucker | 2f9573d | 2005-02-10 22:28:54 +1100 | [diff] [blame] | 4873 | if test "x$etc_default_login" != "xno"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4874 | AC_CHECK_FILE(["/etc/default/login"], |
Darren Tucker | 2f9573d | 2005-02-10 22:28:54 +1100 | [diff] [blame] | 4875 | [ external_path_file=/etc/default/login ]) |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 4876 | if test "x$external_path_file" = "x/etc/default/login"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4877 | AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4878 | [Define if your system has /etc/default/login]) |
Darren Tucker | a0c2b39 | 2004-09-11 23:26:37 +1000 | [diff] [blame] | 4879 | fi |
Darren Tucker | 2f9573d | 2005-02-10 22:28:54 +1100 | [diff] [blame] | 4880 | fi |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 4881 | |
Tim Rice | 43a1c13 | 2002-04-17 21:19:14 -0700 | [diff] [blame] | 4882 | dnl BSD systems use /etc/login.conf so --with-default-path= has no effect |
Tim Rice | 8bb561b | 2005-03-17 16:23:19 -0800 | [diff] [blame] | 4883 | if test $ac_cv_func_login_getcapbool = "yes" && \ |
| 4884 | test $ac_cv_header_login_cap_h = "yes" ; then |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 4885 | external_path_file=/etc/login.conf |
Tim Rice | 43a1c13 | 2002-04-17 21:19:14 -0700 | [diff] [blame] | 4886 | fi |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 4887 | |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 4888 | # Whether to mess with the default path |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4889 | SERVER_PATH_MSG="(default)" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4890 | AC_ARG_WITH([default-path], |
Tim Rice | 6397eed | 2015-06-03 21:41:11 -0700 | [diff] [blame] | 4891 | [ --with-default-path= Specify default $PATH environment for server], |
Damien Miller | 5a3e683 | 1999-12-27 09:48:56 +1100 | [diff] [blame] | 4892 | [ |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 4893 | if test "x$external_path_file" = "x/etc/login.conf" ; then |
Tim Rice | 43a1c13 | 2002-04-17 21:19:14 -0700 | [diff] [blame] | 4894 | AC_MSG_WARN([ |
| 4895 | --with-default-path=PATH has no effect on this system. |
| 4896 | Edit /etc/login.conf instead.]) |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 4897 | elif test "x$withval" != "xno" ; then |
Tim Rice | b925b4b | 2003-09-15 22:40:49 -0700 | [diff] [blame] | 4898 | if test ! -z "$external_path_file" ; then |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 4899 | AC_MSG_WARN([ |
| 4900 | --with-default-path=PATH will only be used if PATH is not defined in |
| 4901 | $external_path_file .]) |
| 4902 | fi |
Tim Rice | 59ea0a0 | 2001-03-10 13:50:45 -0800 | [diff] [blame] | 4903 | user_path="$withval" |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4904 | SERVER_PATH_MSG="$withval" |
Damien Miller | 5a3e683 | 1999-12-27 09:48:56 +1100 | [diff] [blame] | 4905 | fi |
Tim Rice | 59ea0a0 | 2001-03-10 13:50:45 -0800 | [diff] [blame] | 4906 | ], |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 4907 | [ if test "x$external_path_file" = "x/etc/login.conf" ; then |
| 4908 | AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf]) |
Tim Rice | 43a1c13 | 2002-04-17 21:19:14 -0700 | [diff] [blame] | 4909 | else |
Tim Rice | b925b4b | 2003-09-15 22:40:49 -0700 | [diff] [blame] | 4910 | if test ! -z "$external_path_file" ; then |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 4911 | AC_MSG_WARN([ |
| 4912 | If PATH is defined in $external_path_file, ensure the path to scp is included, |
| 4913 | otherwise scp will not work.]) |
| 4914 | fi |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 4915 | AC_RUN_IFELSE( |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4916 | [AC_LANG_PROGRAM([[ |
Tim Rice | 59ea0a0 | 2001-03-10 13:50:45 -0800 | [diff] [blame] | 4917 | /* find out what STDPATH is */ |
| 4918 | #include <stdio.h> |
Tim Rice | 59ea0a0 | 2001-03-10 13:50:45 -0800 | [diff] [blame] | 4919 | #ifdef HAVE_PATHS_H |
| 4920 | # include <paths.h> |
| 4921 | #endif |
| 4922 | #ifndef _PATH_STDPATH |
Tim Rice | 1c9e688 | 2002-11-22 13:29:01 -0800 | [diff] [blame] | 4923 | # ifdef _PATH_USERPATH /* Irix */ |
| 4924 | # define _PATH_STDPATH _PATH_USERPATH |
| 4925 | # else |
| 4926 | # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" |
| 4927 | # endif |
Tim Rice | 59ea0a0 | 2001-03-10 13:50:45 -0800 | [diff] [blame] | 4928 | #endif |
| 4929 | #include <sys/types.h> |
| 4930 | #include <sys/stat.h> |
| 4931 | #include <fcntl.h> |
| 4932 | #define DATA "conftest.stdpath" |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4933 | ]], [[ |
Tim Rice | 59ea0a0 | 2001-03-10 13:50:45 -0800 | [diff] [blame] | 4934 | FILE *fd; |
| 4935 | int rc; |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 4936 | |
Tim Rice | 59ea0a0 | 2001-03-10 13:50:45 -0800 | [diff] [blame] | 4937 | fd = fopen(DATA,"w"); |
| 4938 | if(fd == NULL) |
| 4939 | exit(1); |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 4940 | |
Tim Rice | 59ea0a0 | 2001-03-10 13:50:45 -0800 | [diff] [blame] | 4941 | if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0) |
| 4942 | exit(1); |
| 4943 | |
| 4944 | exit(0); |
Darren Tucker | 314d89e | 2005-10-17 23:29:23 +1000 | [diff] [blame] | 4945 | ]])], |
| 4946 | [ user_path=`cat conftest.stdpath` ], |
Tim Rice | 59ea0a0 | 2001-03-10 13:50:45 -0800 | [diff] [blame] | 4947 | [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ], |
| 4948 | [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ] |
| 4949 | ) |
| 4950 | # make sure $bindir is in USER_PATH so scp will work |
Damien Miller | 77eab7b | 2012-07-06 11:49:28 +1000 | [diff] [blame] | 4951 | t_bindir="${bindir}" |
| 4952 | while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do |
| 4953 | t_bindir=`eval echo ${t_bindir}` |
| 4954 | case $t_bindir in |
| 4955 | NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;; |
| 4956 | esac |
| 4957 | case $t_bindir in |
| 4958 | NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;; |
| 4959 | esac |
| 4960 | done |
Tim Rice | 59ea0a0 | 2001-03-10 13:50:45 -0800 | [diff] [blame] | 4961 | echo $user_path | grep ":$t_bindir" > /dev/null 2>&1 |
| 4962 | if test $? -ne 0 ; then |
| 4963 | echo $user_path | grep "^$t_bindir" > /dev/null 2>&1 |
| 4964 | if test $? -ne 0 ; then |
| 4965 | user_path=$user_path:$t_bindir |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4966 | AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work]) |
Tim Rice | 59ea0a0 | 2001-03-10 13:50:45 -0800 | [diff] [blame] | 4967 | fi |
| 4968 | fi |
Tim Rice | 43a1c13 | 2002-04-17 21:19:14 -0700 | [diff] [blame] | 4969 | fi ] |
Damien Miller | 5a3e683 | 1999-12-27 09:48:56 +1100 | [diff] [blame] | 4970 | ) |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 4971 | if test "x$external_path_file" != "x/etc/login.conf" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4972 | AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH]) |
| 4973 | AC_SUBST([user_path]) |
Tim Rice | 43a1c13 | 2002-04-17 21:19:14 -0700 | [diff] [blame] | 4974 | fi |
Damien Miller | 5a3e683 | 1999-12-27 09:48:56 +1100 | [diff] [blame] | 4975 | |
Damien Miller | a18bbd3 | 2002-05-13 10:48:57 +1000 | [diff] [blame] | 4976 | # Set superuser path separately to user path |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4977 | AC_ARG_WITH([superuser-path], |
Damien Miller | a18bbd3 | 2002-05-13 10:48:57 +1000 | [diff] [blame] | 4978 | [ --with-superuser-path= Specify different path for super-user], |
| 4979 | [ |
Tim Rice | 35cc69d | 2005-03-17 16:44:25 -0800 | [diff] [blame] | 4980 | if test -n "$withval" && test "x$withval" != "xno" && \ |
| 4981 | test "x${withval}" != "xyes"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4982 | AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4983 | [Define if you want a different $PATH |
| 4984 | for the superuser]) |
Damien Miller | a18bbd3 | 2002-05-13 10:48:57 +1000 | [diff] [blame] | 4985 | superuser_path=$withval |
| 4986 | fi |
| 4987 | ] |
| 4988 | ) |
| 4989 | |
| 4990 | |
Damien Miller | 61e50f1 | 2000-05-08 20:49:37 +1000 | [diff] [blame] | 4991 | AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses]) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 4992 | IPV4_IN6_HACK_MSG="no" |
Damien Miller | 7bcb089 | 2000-03-11 20:45:40 +1100 | [diff] [blame] | 4993 | AC_ARG_WITH(4in6, |
| 4994 | [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses], |
| 4995 | [ |
| 4996 | if test "x$withval" != "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 4997 | AC_MSG_RESULT([yes]) |
| 4998 | AC_DEFINE([IPV4_IN_IPV6], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 4999 | [Detect IPv4 in IPv6 mapped addresses |
| 5000 | and treat as IPv4]) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 5001 | IPV4_IN6_HACK_MSG="yes" |
Damien Miller | 7bcb089 | 2000-03-11 20:45:40 +1100 | [diff] [blame] | 5002 | else |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5003 | AC_MSG_RESULT([no]) |
Damien Miller | 7bcb089 | 2000-03-11 20:45:40 +1100 | [diff] [blame] | 5004 | fi |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5005 | ], [ |
Damien Miller | 7bcb089 | 2000-03-11 20:45:40 +1100 | [diff] [blame] | 5006 | if test "x$inet6_default_4in6" = "xyes"; then |
| 5007 | AC_MSG_RESULT([yes (default)]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5008 | AC_DEFINE([IPV4_IN_IPV6]) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 5009 | IPV4_IN6_HACK_MSG="yes" |
Damien Miller | 7bcb089 | 2000-03-11 20:45:40 +1100 | [diff] [blame] | 5010 | else |
| 5011 | AC_MSG_RESULT([no (default)]) |
| 5012 | fi |
| 5013 | ] |
| 5014 | ) |
| 5015 | |
Damien Miller | 60396b0 | 2001-02-18 17:01:00 +1100 | [diff] [blame] | 5016 | # Whether to enable BSD auth support |
Damien Miller | 6c21c51 | 2002-01-22 21:57:53 +1100 | [diff] [blame] | 5017 | BSD_AUTH_MSG=no |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5018 | AC_ARG_WITH([bsd-auth], |
Damien Miller | 60396b0 | 2001-02-18 17:01:00 +1100 | [diff] [blame] | 5019 | [ --with-bsd-auth Enable BSD auth support], |
| 5020 | [ |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 5021 | if test "x$withval" != "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5022 | AC_DEFINE([BSD_AUTH], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 5023 | [Define if you have BSD auth support]) |
Damien Miller | 6c21c51 | 2002-01-22 21:57:53 +1100 | [diff] [blame] | 5024 | BSD_AUTH_MSG=yes |
Damien Miller | 60396b0 | 2001-02-18 17:01:00 +1100 | [diff] [blame] | 5025 | fi |
| 5026 | ] |
| 5027 | ) |
| 5028 | |
Damien Miller | a22ba01 | 2000-03-02 23:09:20 +1100 | [diff] [blame] | 5029 | # Where to place sshd.pid |
Damien Miller | b13c73e | 2000-01-17 22:02:17 +1100 | [diff] [blame] | 5030 | piddir=/var/run |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 5031 | # make sure the directory exists |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 5032 | if test ! -d $piddir ; then |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 5033 | piddir=`eval echo ${sysconfdir}` |
| 5034 | case $piddir in |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 5035 | NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;; |
Damien Miller | 78315eb | 2000-09-29 23:01:36 +1100 | [diff] [blame] | 5036 | esac |
| 5037 | fi |
| 5038 | |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5039 | AC_ARG_WITH([pid-dir], |
Darren Tucker | 075e258 | 2018-02-13 17:36:43 +1100 | [diff] [blame] | 5040 | [ --with-pid-dir=PATH Specify location of sshd.pid file], |
Tim Rice | 88f2ab5 | 2002-03-17 12:17:34 -0800 | [diff] [blame] | 5041 | [ |
Tim Rice | 35cc69d | 2005-03-17 16:44:25 -0800 | [diff] [blame] | 5042 | if test -n "$withval" && test "x$withval" != "xno" && \ |
| 5043 | test "x${withval}" != "xyes"; then |
Tim Rice | 88f2ab5 | 2002-03-17 12:17:34 -0800 | [diff] [blame] | 5044 | piddir=$withval |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 5045 | if test ! -d $piddir ; then |
Tim Rice | 88f2ab5 | 2002-03-17 12:17:34 -0800 | [diff] [blame] | 5046 | AC_MSG_WARN([** no $piddir directory on this system **]) |
| 5047 | fi |
| 5048 | fi |
| 5049 | ] |
| 5050 | ) |
| 5051 | |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 5052 | AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"], |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5053 | [Specify location of ssh.pid]) |
| 5054 | AC_SUBST([piddir]) |
Damien Miller | 5eed6a2 | 2000-01-16 12:05:18 +1100 | [diff] [blame] | 5055 | |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5056 | dnl allow user to disable some login recording features |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5057 | AC_ARG_ENABLE([lastlog], |
andre | 43ca7e2 | 2000-06-19 08:23:46 +0000 | [diff] [blame] | 5058 | [ --disable-lastlog disable use of lastlog even if detected [no]], |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5059 | [ |
| 5060 | if test "x$enableval" = "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5061 | AC_DEFINE([DISABLE_LASTLOG]) |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5062 | fi |
| 5063 | ] |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5064 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5065 | AC_ARG_ENABLE([utmp], |
andre | 43ca7e2 | 2000-06-19 08:23:46 +0000 | [diff] [blame] | 5066 | [ --disable-utmp disable use of utmp even if detected [no]], |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5067 | [ |
| 5068 | if test "x$enableval" = "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5069 | AC_DEFINE([DISABLE_UTMP]) |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5070 | fi |
| 5071 | ] |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5072 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5073 | AC_ARG_ENABLE([utmpx], |
andre | 43ca7e2 | 2000-06-19 08:23:46 +0000 | [diff] [blame] | 5074 | [ --disable-utmpx disable use of utmpx even if detected [no]], |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5075 | [ |
| 5076 | if test "x$enableval" = "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5077 | AC_DEFINE([DISABLE_UTMPX], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 5078 | [Define if you don't want to use utmpx]) |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5079 | fi |
| 5080 | ] |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5081 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5082 | AC_ARG_ENABLE([wtmp], |
andre | 43ca7e2 | 2000-06-19 08:23:46 +0000 | [diff] [blame] | 5083 | [ --disable-wtmp disable use of wtmp even if detected [no]], |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5084 | [ |
| 5085 | if test "x$enableval" = "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5086 | AC_DEFINE([DISABLE_WTMP]) |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5087 | fi |
| 5088 | ] |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5089 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5090 | AC_ARG_ENABLE([wtmpx], |
andre | 43ca7e2 | 2000-06-19 08:23:46 +0000 | [diff] [blame] | 5091 | [ --disable-wtmpx disable use of wtmpx even if detected [no]], |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5092 | [ |
| 5093 | if test "x$enableval" = "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5094 | AC_DEFINE([DISABLE_WTMPX], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 5095 | [Define if you don't want to use wtmpx]) |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5096 | fi |
| 5097 | ] |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5098 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5099 | AC_ARG_ENABLE([libutil], |
andre | 43ca7e2 | 2000-06-19 08:23:46 +0000 | [diff] [blame] | 5100 | [ --disable-libutil disable use of libutil (login() etc.) [no]], |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5101 | [ |
| 5102 | if test "x$enableval" = "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5103 | AC_DEFINE([DISABLE_LOGIN]) |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5104 | fi |
| 5105 | ] |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5106 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5107 | AC_ARG_ENABLE([pututline], |
andre | 43ca7e2 | 2000-06-19 08:23:46 +0000 | [diff] [blame] | 5108 | [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]], |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5109 | [ |
| 5110 | if test "x$enableval" = "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5111 | AC_DEFINE([DISABLE_PUTUTLINE], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 5112 | [Define if you don't want to use pututline() |
| 5113 | etc. to write [uw]tmp]) |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5114 | fi |
| 5115 | ] |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5116 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5117 | AC_ARG_ENABLE([pututxline], |
andre | 43ca7e2 | 2000-06-19 08:23:46 +0000 | [diff] [blame] | 5118 | [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]], |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5119 | [ |
| 5120 | if test "x$enableval" = "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5121 | AC_DEFINE([DISABLE_PUTUTXLINE], [1], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 5122 | [Define if you don't want to use pututxline() |
| 5123 | etc. to write [uw]tmpx]) |
Darren Tucker | a3020db | 2003-06-28 12:54:33 +1000 | [diff] [blame] | 5124 | fi |
| 5125 | ] |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5126 | ) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5127 | AC_ARG_WITH([lastlog], |
andre | 43ca7e2 | 2000-06-19 08:23:46 +0000 | [diff] [blame] | 5128 | [ --with-lastlog=FILE|DIR specify lastlog location [common locations]], |
Damien Miller | 709528a | 2001-01-31 09:57:55 +1100 | [diff] [blame] | 5129 | [ |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 5130 | if test "x$withval" = "xno" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5131 | AC_DEFINE([DISABLE_LASTLOG]) |
Tim Rice | 35cc69d | 2005-03-17 16:44:25 -0800 | [diff] [blame] | 5132 | elif test -n "$withval" && test "x${withval}" != "xyes"; then |
Damien Miller | 709528a | 2001-01-31 09:57:55 +1100 | [diff] [blame] | 5133 | conf_lastlog_location=$withval |
| 5134 | fi |
| 5135 | ] |
| 5136 | ) |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5137 | |
| 5138 | dnl lastlog, [uw]tmpx? detection |
| 5139 | dnl NOTE: set the paths in the platform section to avoid the |
| 5140 | dnl need for command-line parameters |
| 5141 | dnl lastlog and [uw]tmp are subject to a file search if all else fails |
| 5142 | |
| 5143 | dnl lastlog detection |
| 5144 | dnl NOTE: the code itself will detect if lastlog is a directory |
| 5145 | AC_MSG_CHECKING([if your system defines LASTLOG_FILE]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5146 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5147 | #include <sys/types.h> |
| 5148 | #include <utmp.h> |
| 5149 | #ifdef HAVE_LASTLOG_H |
| 5150 | # include <lastlog.h> |
| 5151 | #endif |
Damien Miller | 2994e08 | 2000-06-04 15:51:47 +1000 | [diff] [blame] | 5152 | #ifdef HAVE_PATHS_H |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5153 | # include <paths.h> |
| 5154 | #endif |
Ben Lindstrom | 19d7b8d | 2001-08-16 00:09:49 +0000 | [diff] [blame] | 5155 | #ifdef HAVE_LOGIN_H |
| 5156 | # include <login.h> |
| 5157 | #endif |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5158 | ]], [[ char *lastlog = LASTLOG_FILE; ]])], |
| 5159 | [ AC_MSG_RESULT([yes]) ], |
| 5160 | [ |
| 5161 | AC_MSG_RESULT([no]) |
Damien Miller | 2994e08 | 2000-06-04 15:51:47 +1000 | [diff] [blame] | 5162 | AC_MSG_CHECKING([if your system defines _PATH_LASTLOG]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5163 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Damien Miller | 2994e08 | 2000-06-04 15:51:47 +1000 | [diff] [blame] | 5164 | #include <sys/types.h> |
| 5165 | #include <utmp.h> |
| 5166 | #ifdef HAVE_LASTLOG_H |
| 5167 | # include <lastlog.h> |
| 5168 | #endif |
| 5169 | #ifdef HAVE_PATHS_H |
| 5170 | # include <paths.h> |
| 5171 | #endif |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5172 | ]], [[ char *lastlog = _PATH_LASTLOG; ]])], |
| 5173 | [ AC_MSG_RESULT([yes]) ], |
Damien Miller | 2994e08 | 2000-06-04 15:51:47 +1000 | [diff] [blame] | 5174 | [ |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5175 | AC_MSG_RESULT([no]) |
Damien Miller | 2994e08 | 2000-06-04 15:51:47 +1000 | [diff] [blame] | 5176 | system_lastlog_path=no |
| 5177 | ]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5178 | ]) |
Damien Miller | 2994e08 | 2000-06-04 15:51:47 +1000 | [diff] [blame] | 5179 | |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5180 | if test -z "$conf_lastlog_location"; then |
| 5181 | if test x"$system_lastlog_path" = x"no" ; then |
| 5182 | for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do |
Damien Miller | edb8292 | 2000-06-20 13:25:52 +1000 | [diff] [blame] | 5183 | if (test -d "$f" || test -f "$f") ; then |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5184 | conf_lastlog_location=$f |
| 5185 | fi |
| 5186 | done |
| 5187 | if test -z "$conf_lastlog_location"; then |
andre | 45cad51 | 2000-06-12 23:27:31 +0000 | [diff] [blame] | 5188 | AC_MSG_WARN([** Cannot find lastlog **]) |
| 5189 | dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5190 | fi |
| 5191 | fi |
| 5192 | fi |
| 5193 | |
| 5194 | if test -n "$conf_lastlog_location"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5195 | AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 5196 | [Define if you want to specify the path to your lastlog file]) |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 5197 | fi |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5198 | |
| 5199 | dnl utmp detection |
| 5200 | AC_MSG_CHECKING([if your system defines UTMP_FILE]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5201 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5202 | #include <sys/types.h> |
| 5203 | #include <utmp.h> |
Damien Miller | 2994e08 | 2000-06-04 15:51:47 +1000 | [diff] [blame] | 5204 | #ifdef HAVE_PATHS_H |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5205 | # include <paths.h> |
| 5206 | #endif |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5207 | ]], [[ char *utmp = UTMP_FILE; ]])], |
| 5208 | [ AC_MSG_RESULT([yes]) ], |
| 5209 | [ AC_MSG_RESULT([no]) |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 5210 | system_utmp_path=no |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5211 | ]) |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5212 | if test -z "$conf_utmp_location"; then |
| 5213 | if test x"$system_utmp_path" = x"no" ; then |
| 5214 | for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do |
| 5215 | if test -f $f ; then |
| 5216 | conf_utmp_location=$f |
| 5217 | fi |
| 5218 | done |
| 5219 | if test -z "$conf_utmp_location"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5220 | AC_DEFINE([DISABLE_UTMP]) |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5221 | fi |
| 5222 | fi |
| 5223 | fi |
| 5224 | if test -n "$conf_utmp_location"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5225 | AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 5226 | [Define if you want to specify the path to your utmp file]) |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 5227 | fi |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5228 | |
| 5229 | dnl wtmp detection |
| 5230 | AC_MSG_CHECKING([if your system defines WTMP_FILE]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5231 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5232 | #include <sys/types.h> |
| 5233 | #include <utmp.h> |
Damien Miller | 2994e08 | 2000-06-04 15:51:47 +1000 | [diff] [blame] | 5234 | #ifdef HAVE_PATHS_H |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5235 | # include <paths.h> |
| 5236 | #endif |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5237 | ]], [[ char *wtmp = WTMP_FILE; ]])], |
| 5238 | [ AC_MSG_RESULT([yes]) ], |
| 5239 | [ AC_MSG_RESULT([no]) |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 5240 | system_wtmp_path=no |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5241 | ]) |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5242 | if test -z "$conf_wtmp_location"; then |
| 5243 | if test x"$system_wtmp_path" = x"no" ; then |
| 5244 | for f in /usr/adm/wtmp /var/log/wtmp; do |
| 5245 | if test -f $f ; then |
| 5246 | conf_wtmp_location=$f |
| 5247 | fi |
| 5248 | done |
| 5249 | if test -z "$conf_wtmp_location"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5250 | AC_DEFINE([DISABLE_WTMP]) |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5251 | fi |
| 5252 | fi |
| 5253 | fi |
| 5254 | if test -n "$conf_wtmp_location"; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5255 | AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 5256 | [Define if you want to specify the path to your wtmp file]) |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 5257 | fi |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5258 | |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5259 | dnl wtmpx detection |
| 5260 | AC_MSG_CHECKING([if your system defines WTMPX_FILE]) |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5261 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5262 | #include <sys/types.h> |
| 5263 | #include <utmp.h> |
| 5264 | #ifdef HAVE_UTMPX_H |
| 5265 | #include <utmpx.h> |
| 5266 | #endif |
Damien Miller | 2994e08 | 2000-06-04 15:51:47 +1000 | [diff] [blame] | 5267 | #ifdef HAVE_PATHS_H |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5268 | # include <paths.h> |
| 5269 | #endif |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5270 | ]], [[ char *wtmpx = WTMPX_FILE; ]])], |
| 5271 | [ AC_MSG_RESULT([yes]) ], |
| 5272 | [ AC_MSG_RESULT([no]) |
Tim Rice | e1d9370 | 2016-05-31 11:13:22 -0700 | [diff] [blame] | 5273 | system_wtmpx_path=no |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5274 | ]) |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5275 | if test -z "$conf_wtmpx_location"; then |
| 5276 | if test x"$system_wtmpx_path" = x"no" ; then |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5277 | AC_DEFINE([DISABLE_WTMPX]) |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5278 | fi |
| 5279 | else |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5280 | AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"], |
Tim Rice | 7df8d39 | 2005-09-19 09:33:39 -0700 | [diff] [blame] | 5281 | [Define if you want to specify the path to your wtmpx file]) |
Tim Rice | eae17cc | 2005-03-17 16:52:20 -0800 | [diff] [blame] | 5282 | fi |
andre | 2ff7b5d | 2000-06-03 14:57:40 +0000 | [diff] [blame] | 5283 | |
Damien Miller | 4018c19 | 2000-04-30 09:30:44 +1000 | [diff] [blame] | 5284 | |
Damien Miller | 29ea30d | 2000-03-17 10:54:15 +1100 | [diff] [blame] | 5285 | if test ! -z "$blibpath" ; then |
Damien Miller | eab4bae | 2003-04-29 23:22:40 +1000 | [diff] [blame] | 5286 | LDFLAGS="$LDFLAGS $blibflags$blibpath" |
| 5287 | AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile]) |
Damien Miller | 29ea30d | 2000-03-17 10:54:15 +1100 | [diff] [blame] | 5288 | fi |
| 5289 | |
Damien Miller | a2438bb | 2013-03-15 10:23:07 +1100 | [diff] [blame] | 5290 | AC_CHECK_MEMBER([struct lastlog.ll_line], [], [ |
Tim Rice | aa86c39 | 2013-03-16 20:55:46 -0700 | [diff] [blame] | 5291 | if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then |
Damien Miller | a2438bb | 2013-03-15 10:23:07 +1100 | [diff] [blame] | 5292 | AC_DEFINE([DISABLE_LASTLOG]) |
Tim Rice | aa86c39 | 2013-03-16 20:55:46 -0700 | [diff] [blame] | 5293 | fi |
Damien Miller | a2438bb | 2013-03-15 10:23:07 +1100 | [diff] [blame] | 5294 | ], [ |
| 5295 | #ifdef HAVE_SYS_TYPES_H |
| 5296 | #include <sys/types.h> |
| 5297 | #endif |
| 5298 | #ifdef HAVE_UTMP_H |
| 5299 | #include <utmp.h> |
| 5300 | #endif |
| 5301 | #ifdef HAVE_UTMPX_H |
| 5302 | #include <utmpx.h> |
| 5303 | #endif |
| 5304 | #ifdef HAVE_LASTLOG_H |
| 5305 | #include <lastlog.h> |
| 5306 | #endif |
| 5307 | ]) |
| 5308 | |
| 5309 | AC_CHECK_MEMBER([struct utmp.ut_line], [], [ |
| 5310 | AC_DEFINE([DISABLE_UTMP]) |
| 5311 | AC_DEFINE([DISABLE_WTMP]) |
| 5312 | ], [ |
| 5313 | #ifdef HAVE_SYS_TYPES_H |
| 5314 | #include <sys/types.h> |
| 5315 | #endif |
| 5316 | #ifdef HAVE_UTMP_H |
| 5317 | #include <utmp.h> |
| 5318 | #endif |
| 5319 | #ifdef HAVE_UTMPX_H |
| 5320 | #include <utmpx.h> |
| 5321 | #endif |
| 5322 | #ifdef HAVE_LASTLOG_H |
| 5323 | #include <lastlog.h> |
| 5324 | #endif |
| 5325 | ]) |
| 5326 | |
Darren Tucker | 7da23cb | 2005-08-03 00:20:15 +1000 | [diff] [blame] | 5327 | dnl Adding -Werror to CFLAGS early prevents configure tests from running. |
| 5328 | dnl Add now. |
| 5329 | CFLAGS="$CFLAGS $werror_flags" |
| 5330 | |
Darren Tucker | 627337d | 2010-04-10 22:58:01 +1000 | [diff] [blame] | 5331 | if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then |
| 5332 | TEST_SSH_IPV6=no |
| 5333 | else |
| 5334 | TEST_SSH_IPV6=yes |
| 5335 | fi |
Tim Rice | 648f876 | 2011-01-26 12:38:57 -0800 | [diff] [blame] | 5336 | AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no]) |
| 5337 | AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6]) |
Darren Tucker | 47b8c99 | 2016-12-08 15:48:34 +1100 | [diff] [blame] | 5338 | AC_SUBST([TEST_SSH_UTF8], [$TEST_SSH_UTF8]) |
Darren Tucker | 882abfd | 2013-11-09 00:17:41 +1100 | [diff] [blame] | 5339 | AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS]) |
Darren Tucker | 6d8bd57 | 2013-06-11 11:26:10 +1000 | [diff] [blame] | 5340 | AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms]) |
Darren Tucker | 79c0e1d | 2017-12-11 14:38:33 +1100 | [diff] [blame] | 5341 | AC_SUBST([DEPEND], [$(cat $srcdir/.depend)]) |
Darren Tucker | 5d37690 | 2008-06-11 04:15:05 +1000 | [diff] [blame] | 5342 | |
Damien Miller | de35c38 | 2017-09-08 12:38:31 +1000 | [diff] [blame] | 5343 | CFLAGS="${CFLAGS} ${CFLAGS_AFTER}" |
| 5344 | LDFLAGS="${LDFLAGS} ${LDFLAGS_AFTER}" |
| 5345 | |
Damien Miller | 4438481 | 2019-11-29 15:10:21 +1100 | [diff] [blame] | 5346 | # Make a copy of CFLAGS/LDFLAGS without PIE options. |
| 5347 | LDFLAGS_NOPIE=`echo "$LDFLAGS" | sed 's/ -pie//'` |
Damien Miller | b218055 | 2019-11-29 12:32:23 +1100 | [diff] [blame] | 5348 | CFLAGS_NOPIE=`echo "$CFLAGS" | sed 's/ -fPIE//'` |
Damien Miller | 4438481 | 2019-11-29 15:10:21 +1100 | [diff] [blame] | 5349 | AC_SUBST([LDFLAGS_NOPIE]) |
Damien Miller | b218055 | 2019-11-29 12:32:23 +1100 | [diff] [blame] | 5350 | AC_SUBST([CFLAGS_NOPIE]) |
| 5351 | |
Damien Miller | bac2d8a | 2000-09-05 16:13:06 +1100 | [diff] [blame] | 5352 | AC_EXEEXT |
Damien Miller | 223897a | 2006-09-12 21:54:10 +1000 | [diff] [blame] | 5353 | AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \ |
| 5354 | openbsd-compat/Makefile openbsd-compat/regress/Makefile \ |
Damien Miller | f22019b | 2011-05-05 13:48:37 +1000 | [diff] [blame] | 5355 | survey.sh]) |
Tim Rice | 13aae5e | 2001-10-21 17:53:58 -0700 | [diff] [blame] | 5356 | AC_OUTPUT |
Damien Miller | 0437b33 | 2000-05-02 09:56:41 +1000 | [diff] [blame] | 5357 | |
Damien Miller | 7b22d65 | 2000-06-18 14:07:04 +1000 | [diff] [blame] | 5358 | # Print summary of options |
| 5359 | |
Damien Miller | 7b22d65 | 2000-06-18 14:07:04 +1000 | [diff] [blame] | 5360 | # Someone please show me a better way :) |
| 5361 | A=`eval echo ${prefix}` ; A=`eval echo ${A}` |
| 5362 | B=`eval echo ${bindir}` ; B=`eval echo ${B}` |
| 5363 | C=`eval echo ${sbindir}` ; C=`eval echo ${C}` |
| 5364 | D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}` |
Kevin Steves | e0f4914 | 2000-10-14 17:51:48 +0000 | [diff] [blame] | 5365 | E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}` |
Ben Lindstrom | bc70992 | 2001-04-18 18:04:21 +0000 | [diff] [blame] | 5366 | F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}` |
Damien Miller | 7b22d65 | 2000-06-18 14:07:04 +1000 | [diff] [blame] | 5367 | G=`eval echo ${piddir}` ; G=`eval echo ${G}` |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 5368 | H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}` |
| 5369 | I=`eval echo ${user_path}` ; I=`eval echo ${I}` |
| 5370 | J=`eval echo ${superuser_path}` ; J=`eval echo ${J}` |
Damien Miller | 7b22d65 | 2000-06-18 14:07:04 +1000 | [diff] [blame] | 5371 | |
| 5372 | echo "" |
Kevin Steves | 393d2f7 | 2001-04-08 22:50:43 +0000 | [diff] [blame] | 5373 | echo "OpenSSH has been configured with the following options:" |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 5374 | echo " User binaries: $B" |
| 5375 | echo " System binaries: $C" |
| 5376 | echo " Configuration files: $D" |
| 5377 | echo " Askpass program: $E" |
| 5378 | echo " Manual pages: $F" |
| 5379 | echo " PID file: $G" |
| 5380 | echo " Privilege separation chroot path: $H" |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 5381 | if test "x$external_path_file" = "x/etc/login.conf" ; then |
| 5382 | echo " At runtime, sshd will use the path defined in $external_path_file" |
| 5383 | echo " Make sure the path to scp is present, otherwise scp will not work" |
Tim Rice | 43a1c13 | 2002-04-17 21:19:14 -0700 | [diff] [blame] | 5384 | else |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 5385 | echo " sshd default user PATH: $I" |
Tim Rice | b925b4b | 2003-09-15 22:40:49 -0700 | [diff] [blame] | 5386 | if test ! -z "$external_path_file"; then |
Darren Tucker | e1a790d | 2003-09-16 11:52:19 +1000 | [diff] [blame] | 5387 | echo " (If PATH is set in $external_path_file it will be used instead. If" |
| 5388 | echo " used, ensure the path to scp is present, otherwise scp will not work.)" |
| 5389 | fi |
Tim Rice | 43a1c13 | 2002-04-17 21:19:14 -0700 | [diff] [blame] | 5390 | fi |
Damien Miller | a18bbd3 | 2002-05-13 10:48:57 +1000 | [diff] [blame] | 5391 | if test ! -z "$superuser_path" ; then |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 5392 | echo " sshd superuser user PATH: $J" |
Damien Miller | a18bbd3 | 2002-05-13 10:48:57 +1000 | [diff] [blame] | 5393 | fi |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 5394 | echo " Manpage format: $MANTYPE" |
Damien Miller | 7abe09b | 2003-05-15 10:53:49 +1000 | [diff] [blame] | 5395 | echo " PAM support: $PAM_MSG" |
Damien Miller | 1b06dc3 | 2006-08-31 03:24:41 +1000 | [diff] [blame] | 5396 | echo " OSF SIA support: $SIA_MSG" |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 5397 | echo " KerberosV support: $KRB5_MSG" |
Damien Miller | 73b42d2 | 2006-04-22 21:26:08 +1000 | [diff] [blame] | 5398 | echo " SELinux support: $SELINUX_MSG" |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 5399 | echo " MD5 password support: $MD5_MSG" |
Darren Tucker | 16bcc1c | 2004-11-07 20:14:34 +1100 | [diff] [blame] | 5400 | echo " libedit support: $LIBEDIT_MSG" |
Damien Miller | 523db85 | 2017-02-03 16:01:22 +1100 | [diff] [blame] | 5401 | echo " libldns support: $LDNS_MSG" |
Damien Miller | 1b06dc3 | 2006-08-31 03:24:41 +1000 | [diff] [blame] | 5402 | echo " Solaris process contract support: $SPC_MSG" |
Darren Tucker | 9752835 | 2010-11-05 12:03:05 +1100 | [diff] [blame] | 5403 | echo " Solaris project support: $SP_MSG" |
Damien Miller | 4626cba | 2016-01-08 14:24:56 +1100 | [diff] [blame] | 5404 | echo " Solaris privilege support: $SPP_MSG" |
Damien Miller | 903e115 | 2002-05-13 14:41:31 +1000 | [diff] [blame] | 5405 | echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" |
Damien Miller | f58c672 | 2002-05-13 13:15:42 +1000 | [diff] [blame] | 5406 | echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" |
| 5407 | echo " BSD Auth support: $BSD_AUTH_MSG" |
| 5408 | echo " Random number source: $RAND_MSG" |
Damien Miller | 69ff1df | 2011-06-23 08:30:03 +1000 | [diff] [blame] | 5409 | echo " Privsep sandbox style: $SANDBOX_STYLE" |
Damien Miller | 764d51e | 2019-11-01 13:34:49 +1100 | [diff] [blame] | 5410 | echo " PKCS#11 support: $enable_pkcs11" |
| 5411 | echo " U2F/FIDO support: $enable_sk" |
Damien Miller | 60396b0 | 2001-02-18 17:01:00 +1100 | [diff] [blame] | 5412 | |
Damien Miller | 7b22d65 | 2000-06-18 14:07:04 +1000 | [diff] [blame] | 5413 | echo "" |
| 5414 | |
Ben Lindstrom | 28bfc0d | 2000-12-18 19:58:57 +0000 | [diff] [blame] | 5415 | echo " Host: ${host}" |
| 5416 | echo " Compiler: ${CC}" |
| 5417 | echo " Compiler flags: ${CFLAGS}" |
| 5418 | echo "Preprocessor flags: ${CPPFLAGS}" |
| 5419 | echo " Linker flags: ${LDFLAGS}" |
Darren Tucker | 20e9f97 | 2007-03-25 18:26:01 +1000 | [diff] [blame] | 5420 | echo " Libraries: ${LIBS}" |
| 5421 | if test ! -z "${SSHDLIBS}"; then |
| 5422 | echo " +for sshd: ${SSHDLIBS}" |
| 5423 | fi |
Damien Miller | 71adf12 | 2011-01-25 12:16:15 +1100 | [diff] [blame] | 5424 | if test ! -z "${SSHLIBS}"; then |
| 5425 | echo " +for ssh: ${SSHLIBS}" |
| 5426 | fi |
Damien Miller | 7b22d65 | 2000-06-18 14:07:04 +1000 | [diff] [blame] | 5427 | |
| 5428 | echo "" |
| 5429 | |
Tim Rice | 6f1f758 | 2004-05-30 21:38:51 -0700 | [diff] [blame] | 5430 | if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then |
Darren Tucker | cf59d31 | 2004-08-29 21:18:09 +1000 | [diff] [blame] | 5431 | echo "SVR4 style packages are supported with \"make package\"" |
| 5432 | echo "" |
Tim Rice | 6f1f758 | 2004-05-30 21:38:51 -0700 | [diff] [blame] | 5433 | fi |
| 5434 | |
Damien Miller | 82cf0ce | 2000-12-20 13:34:48 +1100 | [diff] [blame] | 5435 | if test "x$PAM_MSG" = "xyes" ; then |
Damien Miller | 6c21c51 | 2002-01-22 21:57:53 +1100 | [diff] [blame] | 5436 | echo "PAM is enabled. You may need to install a PAM control file " |
| 5437 | echo "for sshd, otherwise password authentication may fail. " |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 5438 | echo "Example PAM control files can be found in the contrib/ " |
Damien Miller | 6c21c51 | 2002-01-22 21:57:53 +1100 | [diff] [blame] | 5439 | echo "subdirectory" |
Damien Miller | 6f9c337 | 2000-10-25 10:06:04 +1100 | [diff] [blame] | 5440 | echo "" |
| 5441 | fi |
Ben Lindstrom | 3ad650a | 2001-01-03 06:02:51 +0000 | [diff] [blame] | 5442 | |
Damien Miller | b409718 | 2004-05-23 14:09:40 +1000 | [diff] [blame] | 5443 | if test ! -z "$NO_PEERCHECK" ; then |
Darren Tucker | 164aa30 | 2007-03-21 21:39:57 +1100 | [diff] [blame] | 5444 | echo "WARNING: the operating system that you are using does not" |
| 5445 | echo "appear to support getpeereid(), getpeerucred() or the" |
| 5446 | echo "SO_PEERCRED getsockopt() option. These facilities are used to" |
| 5447 | echo "enforce security checks to prevent unauthorised connections to" |
| 5448 | echo "ssh-agent. Their absence increases the risk that a malicious" |
| 5449 | echo "user can connect to your agent." |
Damien Miller | b409718 | 2004-05-23 14:09:40 +1000 | [diff] [blame] | 5450 | echo "" |
| 5451 | fi |
| 5452 | |
Darren Tucker | d9f8891 | 2005-02-20 21:01:48 +1100 | [diff] [blame] | 5453 | if test "$AUDIT_MODULE" = "bsm" ; then |
| 5454 | echo "WARNING: BSM audit support is currently considered EXPERIMENTAL." |
| 5455 | echo "See the Solaris section in README.platform for details." |
| 5456 | fi |