diff options
author | Damien Miller <djm@mindrot.org> | 2014-01-22 16:31:18 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2014-01-22 16:31:18 +1100 |
commit | 852472a54b8a0dc3e53786b313baaa86850a4273 (patch) | |
tree | c3a94be9ee37fd1cf27af35a82e5f24f166b39ed /configure.ac | |
parent | ee87838786cef0194db36ae0675b3e7c4e8ec661 (diff) |
- (djm) [configure.ac] Unless specifically requested, only attempt
to build Position Independent Executables on gcc >= 4.x; ok dtucker
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index e5bb68409..b738f4e60 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: configure.ac,v 1.556 2014/01/21 01:48:52 dtucker Exp $ | 1 | # $Id: configure.ac,v 1.557 2014/01/22 05:31:18 djm Exp $ |
2 | # | 2 | # |
3 | # Copyright (c) 1999-2004 Damien Miller | 3 | # Copyright (c) 1999-2004 Damien Miller |
4 | # | 4 | # |
@@ -15,7 +15,7 @@ | |||
15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | 16 | ||
17 | AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) | 17 | AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) |
18 | AC_REVISION($Revision: 1.556 $) | 18 | AC_REVISION($Revision: 1.557 $) |
19 | AC_CONFIG_SRCDIR([ssh.c]) | 19 | AC_CONFIG_SRCDIR([ssh.c]) |
20 | AC_LANG([C]) | 20 | AC_LANG([C]) |
21 | 21 | ||
@@ -555,7 +555,7 @@ case "$host" in | |||
555 | AC_DEFINE([BROKEN_SETREGID]) | 555 | AC_DEFINE([BROKEN_SETREGID]) |
556 | ;; | 556 | ;; |
557 | *-*-darwin*) | 557 | *-*-darwin*) |
558 | use_pie=1 | 558 | use_pie=auto |
559 | AC_MSG_CHECKING([if we have working getaddrinfo]) | 559 | AC_MSG_CHECKING([if we have working getaddrinfo]) |
560 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h> | 560 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h> |
561 | main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) | 561 | main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) |
@@ -694,7 +694,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) | |||
694 | ;; | 694 | ;; |
695 | *-*-linux*) | 695 | *-*-linux*) |
696 | no_dev_ptmx=1 | 696 | no_dev_ptmx=1 |
697 | use_pie=1 | 697 | use_pie=auto |
698 | check_for_libcrypt_later=1 | 698 | check_for_libcrypt_later=1 |
699 | check_for_openpty_ctty_bug=1 | 699 | check_for_openpty_ctty_bug=1 |
700 | AC_DEFINE([PAM_TTY_KLUDGE], [1], | 700 | AC_DEFINE([PAM_TTY_KLUDGE], [1], |
@@ -791,7 +791,7 @@ mips-sony-bsd|mips-sony-newsos4) | |||
791 | AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT]) | 791 | AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT]) |
792 | ;; | 792 | ;; |
793 | *-*-openbsd*) | 793 | *-*-openbsd*) |
794 | use_pie=1 | 794 | use_pie=auto |
795 | AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel]) | 795 | AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel]) |
796 | AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded]) | 796 | AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded]) |
797 | AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way]) | 797 | AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way]) |
@@ -1566,15 +1566,34 @@ AC_ARG_WITH([audit], | |||
1566 | AC_ARG_WITH([pie], | 1566 | AC_ARG_WITH([pie], |
1567 | [ --with-pie Build Position Independent Executables if possible], [ | 1567 | [ --with-pie Build Position Independent Executables if possible], [ |
1568 | if test "x$withval" = "xno"; then | 1568 | if test "x$withval" = "xno"; then |
1569 | use_pie=0 | 1569 | use_pie=no |
1570 | fi | 1570 | fi |
1571 | if test "x$withval" = "xyes"; then | 1571 | if test "x$withval" = "xyes"; then |
1572 | use_pie=1 | 1572 | use_pie=yes |
1573 | fi | 1573 | fi |
1574 | ] | 1574 | ] |
1575 | ) | 1575 | ) |
1576 | 1576 | if test "x$use_pie" = "x"; then | |
1577 | if test "x$use_toolchain_hardening" = "x1" && test "x$use_pie" = "x1"; then | 1577 | use_pie=no |
1578 | fi | ||
1579 | if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then | ||
1580 | # Turn off automatic PIE when toolchain hardening is off. | ||
1581 | use_pie=no | ||
1582 | fi | ||
1583 | if test "x$use_pie" == "xauto"; then | ||
1584 | # Automatic PIE requires gcc >= 4.x | ||
1585 | AC_MSG_CHECKING([for gcc >= 4.x]) | ||
1586 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ | ||
1587 | #if !defined(__GNUC__) || __GNUC__ < 4 | ||
1588 | #error gcc is too old | ||
1589 | #endif | ||
1590 | ]])], | ||
1591 | [ AC_MSG_RESULT([yes]) ], | ||
1592 | [ AC_MSG_RESULT([no]) | ||
1593 | use_pie=no ] | ||
1594 | ) | ||
1595 | fi | ||
1596 | if test "x$use_pie" != "xno"; then | ||
1578 | OSSH_CHECK_CFLAG_COMPILE([-fPIE]) | 1597 | OSSH_CHECK_CFLAG_COMPILE([-fPIE]) |
1579 | OSSH_CHECK_LDFLAG_LINK([-pie]) | 1598 | OSSH_CHECK_LDFLAG_LINK([-pie]) |
1580 | fi | 1599 | fi |