summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac106
1 files changed, 61 insertions, 45 deletions
diff --git a/configure.ac b/configure.ac
index c2878e3d4..889f50637 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,13 +109,10 @@ AC_CHECK_DECL([PR_SET_NO_NEW_PRIVS], [have_linux_no_new_privs=1], , [
109]) 109])
110 110
111openssl=yes 111openssl=yes
112ssh1=no
113COMMENT_OUT_RSA1="#no ssh1#"
114AC_ARG_WITH([openssl], 112AC_ARG_WITH([openssl],
115 [ --without-openssl Disable use of OpenSSL; use only limited internal crypto **EXPERIMENTAL** ], 113 [ --without-openssl Disable use of OpenSSL; use only limited internal crypto **EXPERIMENTAL** ],
116 [ if test "x$withval" = "xno" ; then 114 [ if test "x$withval" = "xno" ; then
117 openssl=no 115 openssl=no
118 ssh1=no
119 fi 116 fi
120 ] 117 ]
121) 118)
@@ -127,31 +124,6 @@ else
127 AC_MSG_RESULT([no]) 124 AC_MSG_RESULT([no])
128fi 125fi
129 126
130AC_ARG_WITH([ssh1],
131 [ --with-ssh1 Enable support for SSH protocol 1],
132 [
133 if test "x$withval" = "xyes" ; then
134 if test "x$openssl" = "xno" ; then
135 AC_MSG_ERROR([Cannot enable SSH protocol 1 with OpenSSL disabled])
136 fi
137 ssh1=yes
138 COMMENT_OUT_RSA1=""
139 elif test "x$withval" = "xno" ; then
140 ssh1=no
141 else
142 AC_MSG_ERROR([unknown --with-ssh1 argument])
143 fi
144 ]
145)
146AC_MSG_CHECKING([whether SSH protocol 1 support is enabled])
147if test "x$ssh1" = "xyes" ; then
148 AC_MSG_RESULT([yes])
149 AC_DEFINE_UNQUOTED([WITH_SSH1], [1], [include SSH protocol version 1 support])
150 AC_SUBST([COMMENT_OUT_RSA1])
151else
152 AC_MSG_RESULT([no])
153fi
154
155use_stack_protector=1 127use_stack_protector=1
156use_toolchain_hardening=1 128use_toolchain_hardening=1
157AC_ARG_WITH([stackprotect], 129AC_ARG_WITH([stackprotect],
@@ -179,6 +151,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])],
179CFLAGS="$saved_CFLAGS" 151CFLAGS="$saved_CFLAGS"
180 152
181if test "$GCC" = "yes" || test "$GCC" = "egcs"; then 153if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
154 OSSH_CHECK_CFLAG_COMPILE([-pipe])
182 OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments]) 155 OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments])
183 OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option]) 156 OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option])
184 OSSH_CHECK_CFLAG_COMPILE([-Wall]) 157 OSSH_CHECK_CFLAG_COMPILE([-Wall])
@@ -190,8 +163,8 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
190 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign]) 163 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
191 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result]) 164 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
192 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing]) 165 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
193 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
194 if test "x$use_toolchain_hardening" = "x1"; then 166 if test "x$use_toolchain_hardening" = "x1"; then
167 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
195 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,relro]) 168 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,relro])
196 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,now]) 169 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,now])
197 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,noexecstack]) 170 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,noexecstack])
@@ -316,6 +289,16 @@ AC_ARG_WITH([cflags],
316 fi 289 fi
317 ] 290 ]
318) 291)
292
293AC_ARG_WITH([cflags-after],
294 [ --with-cflags-after Specify additional flags to pass to compiler after configure],
295 [
296 if test -n "$withval" && test "x$withval" != "xno" && \
297 test "x${withval}" != "xyes"; then
298 CFLAGS_AFTER="$withval"
299 fi
300 ]
301)
319AC_ARG_WITH([cppflags], 302AC_ARG_WITH([cppflags],
320 [ --with-cppflags Specify additional flags to pass to preprocessor] , 303 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
321 [ 304 [
@@ -334,6 +317,15 @@ AC_ARG_WITH([ldflags],
334 fi 317 fi
335 ] 318 ]
336) 319)
320AC_ARG_WITH([ldflags-after],
321 [ --with-ldflags-after Specify additional flags to pass to linker after configure],
322 [
323 if test -n "$withval" && test "x$withval" != "xno" && \
324 test "x${withval}" != "xyes"; then
325 LDFLAGS_AFTER="$withval"
326 fi
327 ]
328)
337AC_ARG_WITH([libs], 329AC_ARG_WITH([libs],
338 [ --with-libs Specify additional libraries to link with], 330 [ --with-libs Specify additional libraries to link with],
339 [ 331 [
@@ -397,7 +389,6 @@ AC_CHECK_HEADERS([ \
397 sys/audit.h \ 389 sys/audit.h \
398 sys/bitypes.h \ 390 sys/bitypes.h \
399 sys/bsdtty.h \ 391 sys/bsdtty.h \
400 sys/capability.h \
401 sys/cdefs.h \ 392 sys/cdefs.h \
402 sys/dir.h \ 393 sys/dir.h \
403 sys/mman.h \ 394 sys/mman.h \
@@ -429,6 +420,13 @@ AC_CHECK_HEADERS([ \
429 wchar.h \ 420 wchar.h \
430]) 421])
431 422
423# sys/capsicum.h requires sys/types.h
424AC_CHECK_HEADERS([sys/capsicum.h], [], [], [
425#ifdef HAVE_SYS_TYPES_H
426# include <sys/types.h>
427#endif
428])
429
432# lastlog.h requires sys/time.h to be included first on Solaris 430# lastlog.h requires sys/time.h to be included first on Solaris
433AC_CHECK_HEADERS([lastlog.h], [], [], [ 431AC_CHECK_HEADERS([lastlog.h], [], [], [
434#ifdef HAVE_SYS_TIME_H 432#ifdef HAVE_SYS_TIME_H
@@ -1007,6 +1005,7 @@ mips-sony-bsd|mips-sony-newsos4)
1007 AC_DEFINE([BROKEN_SETREUID]) 1005 AC_DEFINE([BROKEN_SETREUID])
1008 AC_DEFINE([BROKEN_SETREGID]) 1006 AC_DEFINE([BROKEN_SETREGID])
1009 AC_DEFINE([PASSWD_NEEDS_USERNAME]) 1007 AC_DEFINE([PASSWD_NEEDS_USERNAME])
1008 AC_DEFINE([BROKEN_TCGETATTR_ICANON])
1010 TEST_SHELL=$SHELL # let configure find us a capable shell 1009 TEST_SHELL=$SHELL # let configure find us a capable shell
1011 case "$host" in 1010 case "$host" in
1012 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x 1011 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
@@ -1332,7 +1331,17 @@ AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
1332AC_SEARCH_LIBS([inet_ntop], [resolv nsl]) 1331AC_SEARCH_LIBS([inet_ntop], [resolv nsl])
1333AC_SEARCH_LIBS([gethostbyname], [resolv nsl]) 1332AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
1334 1333
1334# "Particular Function Checks"
1335# see https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Functions.html
1335AC_FUNC_STRFTIME 1336AC_FUNC_STRFTIME
1337AC_FUNC_MALLOC
1338AC_FUNC_REALLOC
1339# autoconf doesn't have AC_FUNC_CALLOC so fake it if malloc returns NULL;
1340if test "x$ac_cv_func_malloc_0_nonnull" != "xyes"; then
1341 AC_DEFINE(HAVE_CALLOC, 0, [calloc(x, 0) returns NULL])
1342 AC_DEFINE(calloc, rpl_calloc,
1343 [Define to rpl_calloc if the replacement function should be used.])
1344fi
1336 1345
1337# Check for ALTDIRFUNC glob() extension 1346# Check for ALTDIRFUNC glob() extension
1338AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support]) 1347AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
@@ -1486,6 +1495,7 @@ AC_ARG_WITH(ldns,
1486 else 1495 else
1487 LIBS="$LIBS `$LDNSCONFIG --libs`" 1496 LIBS="$LIBS `$LDNSCONFIG --libs`"
1488 CPPFLAGS="$CPPFLAGS `$LDNSCONFIG --cflags`" 1497 CPPFLAGS="$CPPFLAGS `$LDNSCONFIG --cflags`"
1498 ldns=yes
1489 fi 1499 fi
1490 elif test "x$withval" != "xno" ; then 1500 elif test "x$withval" != "xno" ; then
1491 CPPFLAGS="$CPPFLAGS -I${withval}/include" 1501 CPPFLAGS="$CPPFLAGS -I${withval}/include"
@@ -1696,6 +1706,7 @@ AC_CHECK_FUNCS([ \
1696 fchmod \ 1706 fchmod \
1697 fchown \ 1707 fchown \
1698 freeaddrinfo \ 1708 freeaddrinfo \
1709 freezero \
1699 fstatfs \ 1710 fstatfs \
1700 fstatvfs \ 1711 fstatvfs \
1701 futimes \ 1712 futimes \
@@ -1704,6 +1715,7 @@ AC_CHECK_FUNCS([ \
1704 getgrouplist \ 1715 getgrouplist \
1705 getnameinfo \ 1716 getnameinfo \
1706 getopt \ 1717 getopt \
1718 getpagesize \
1707 getpeereid \ 1719 getpeereid \
1708 getpeerucred \ 1720 getpeerucred \
1709 getpgid \ 1721 getpgid \
@@ -1734,6 +1746,7 @@ AC_CHECK_FUNCS([ \
1734 readpassphrase \ 1746 readpassphrase \
1735 reallocarray \ 1747 reallocarray \
1736 recvmsg \ 1748 recvmsg \
1749 recallocarray \
1737 rresvport_af \ 1750 rresvport_af \
1738 sendmsg \ 1751 sendmsg \
1739 setdtablesize \ 1752 setdtablesize \
@@ -1767,6 +1780,7 @@ AC_CHECK_FUNCS([ \
1767 strnlen \ 1780 strnlen \
1768 strnvis \ 1781 strnvis \
1769 strptime \ 1782 strptime \
1783 strsignal \
1770 strtonum \ 1784 strtonum \
1771 strtoll \ 1785 strtoll \
1772 strtoul \ 1786 strtoul \
@@ -2535,7 +2549,11 @@ if test "x$openssl" = "xyes" ; then
2535 10000*|0*) 2549 10000*|0*)
2536 AC_MSG_ERROR([OpenSSL >= 1.0.1 required (have "$ssl_library_ver")]) 2550 AC_MSG_ERROR([OpenSSL >= 1.0.1 required (have "$ssl_library_ver")])
2537 ;; 2551 ;;
2538 *) ;; 2552 100*) ;; # 1.0.x
2553 200*) ;; # LibreSSL
2554 *)
2555 AC_MSG_ERROR([OpenSSL >= 1.1.0 is not yet supported (have "$ssl_library_ver")])
2556 ;;
2539 esac 2557 esac
2540 AC_MSG_RESULT([$ssl_library_ver]) 2558 AC_MSG_RESULT([$ssl_library_ver])
2541 ], 2559 ],
@@ -2768,9 +2786,6 @@ if test "x$openssl" = "xyes" ; then
2768 #include <openssl/evp.h> 2786 #include <openssl/evp.h>
2769 #include <openssl/objects.h> 2787 #include <openssl/objects.h>
2770 #include <openssl/opensslv.h> 2788 #include <openssl/opensslv.h>
2771 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2772 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2773 #endif
2774 ]], [[ 2789 ]], [[
2775 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); 2790 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2776 const EVP_MD *m = EVP_sha256(); /* We need this too */ 2791 const EVP_MD *m = EVP_sha256(); /* We need this too */
@@ -2789,9 +2804,6 @@ if test "x$openssl" = "xyes" ; then
2789 #include <openssl/evp.h> 2804 #include <openssl/evp.h>
2790 #include <openssl/objects.h> 2805 #include <openssl/objects.h>
2791 #include <openssl/opensslv.h> 2806 #include <openssl/opensslv.h>
2792 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2793 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2794 #endif
2795 ]], [[ 2807 ]], [[
2796 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1); 2808 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2797 const EVP_MD *m = EVP_sha384(); /* We need this too */ 2809 const EVP_MD *m = EVP_sha384(); /* We need this too */
@@ -2810,9 +2822,6 @@ if test "x$openssl" = "xyes" ; then
2810 #include <openssl/evp.h> 2822 #include <openssl/evp.h>
2811 #include <openssl/objects.h> 2823 #include <openssl/objects.h>
2812 #include <openssl/opensslv.h> 2824 #include <openssl/opensslv.h>
2813 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2814 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2815 #endif
2816 ]], [[ 2825 ]], [[
2817 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1); 2826 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2818 const EVP_MD *m = EVP_sha512(); /* We need this too */ 2827 const EVP_MD *m = EVP_sha512(); /* We need this too */
@@ -3197,7 +3206,8 @@ AC_RUN_IFELSE(
3197 select_works_with_rlimit=yes], 3206 select_works_with_rlimit=yes],
3198 [AC_MSG_RESULT([no]) 3207 [AC_MSG_RESULT([no])
3199 select_works_with_rlimit=no], 3208 select_works_with_rlimit=no],
3200 [AC_MSG_WARN([cross compiling: assuming yes])] 3209 [AC_MSG_WARN([cross compiling: assuming yes])
3210 select_works_with_rlimit=yes]
3201) 3211)
3202 3212
3203AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works]) 3213AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
@@ -3223,7 +3233,8 @@ AC_RUN_IFELSE(
3223 rlimit_nofile_zero_works=yes], 3233 rlimit_nofile_zero_works=yes],
3224 [AC_MSG_RESULT([no]) 3234 [AC_MSG_RESULT([no])
3225 rlimit_nofile_zero_works=no], 3235 rlimit_nofile_zero_works=no],
3226 [AC_MSG_WARN([cross compiling: assuming yes])] 3236 [AC_MSG_WARN([cross compiling: assuming yes])
3237 rlimit_nofile_zero_works=yes]
3227) 3238)
3228 3239
3229AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works]) 3240AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
@@ -3286,10 +3297,10 @@ elif test "x$sandbox_arg" = "xseccomp_filter" || \
3286 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter]) 3297 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
3287elif test "x$sandbox_arg" = "xcapsicum" || \ 3298elif test "x$sandbox_arg" = "xcapsicum" || \
3288 ( test -z "$sandbox_arg" && \ 3299 ( test -z "$sandbox_arg" && \
3289 test "x$ac_cv_header_sys_capability_h" = "xyes" && \ 3300 test "x$ac_cv_header_sys_capsicum_h" = "xyes" && \
3290 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then 3301 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then
3291 test "x$ac_cv_header_sys_capability_h" != "xyes" && \ 3302 test "x$ac_cv_header_sys_capsicum_h" != "xyes" && \
3292 AC_MSG_ERROR([capsicum sandbox requires sys/capability.h header]) 3303 AC_MSG_ERROR([capsicum sandbox requires sys/capsicum.h header])
3293 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \ 3304 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \
3294 AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function]) 3305 AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function])
3295 SANDBOX_STYLE="capsicum" 3306 SANDBOX_STYLE="capsicum"
@@ -3845,6 +3856,8 @@ OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3845OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX]) 3856OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
3846 3857
3847AC_CHECK_MEMBERS([struct stat.st_blksize]) 3858AC_CHECK_MEMBERS([struct stat.st_blksize])
3859AC_CHECK_MEMBERS([struct stat.st_mtim])
3860AC_CHECK_MEMBERS([struct stat.st_mtime])
3848AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class, 3861AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3849struct passwd.pw_change, struct passwd.pw_expire], 3862struct passwd.pw_change, struct passwd.pw_expire],
3850[], [], [[ 3863[], [], [[
@@ -5044,6 +5057,9 @@ AC_SUBST([TEST_SSH_UTF8], [$TEST_SSH_UTF8])
5044AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS]) 5057AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
5045AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms]) 5058AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
5046 5059
5060CFLAGS="${CFLAGS} ${CFLAGS_AFTER}"
5061LDFLAGS="${LDFLAGS} ${LDFLAGS_AFTER}"
5062
5047AC_EXEEXT 5063AC_EXEEXT
5048AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \ 5064AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
5049 openbsd-compat/Makefile openbsd-compat/regress/Makefile \ 5065 openbsd-compat/Makefile openbsd-compat/regress/Makefile \