public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain D Sandoe <iains@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5321] configure, Darwin: Set appropriate defaults for host-shared.
Date: Tue, 16 Nov 2021 19:45:22 +0000 (GMT)	[thread overview]
Message-ID: <20211116194522.58EB8385781A@sourceware.org> (raw)

https://gcc.gnu.org/g:a1d2b16202601e597fac1c0e6af6ee8cd09b52c0

commit r12-5321-ga1d2b16202601e597fac1c0e6af6ee8cd09b52c0
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Fri Nov 12 17:05:13 2021 +0000

    configure, Darwin: Set appropriate defaults for host-shared.
    
    Darwin x86_64 and aarch64 platforms are PIC (shared) by default,
    and user-space code must be built in this mode.  The patch
    ensures that this is set correctly and applies a default when
    --enable-host-shared is not set.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    
    ChangeLog:
    
            * configure: Regenerate.
            * configure.ac: Ensure that PIC (shared) defaults are set
            correctly for Darwin.

Diff:
---
 configure    | 16 +++++++++++++++-
 configure.ac | 15 ++++++++++++++-
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 58979d6e3b1..3062495da31 100755
--- a/configure
+++ b/configure
@@ -8447,8 +8447,20 @@ fi
 # Check whether --enable-host-shared was given.
 if test "${enable_host_shared+set}" = set; then :
   enableval=$enable_host_shared; host_shared=$enableval
+ case $target in
+   x86_64-*-darwin* | aarch64-*-darwin*)
+     if test x$host_shared != xyes ; then
+       # PIC is the default, and actually cannot be switched off.
+       echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2
+       host_shared=yes
+     fi ;;
+  *) ;;
+ esac
 else
-  host_shared=no
+  case $target in
+  x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;;
+  *) host_shared=no ;;
+ esac
 fi
 
 
@@ -10083,6 +10095,8 @@ done
 
 
 
+
+
 # Generate default definitions for YACC, M4, LEX and other programs that run
 # on the build machine.  These are used if the Makefile can't locate these
 # programs in objdir.
diff --git a/configure.ac b/configure.ac
index 550e6993b59..bed60bcaf72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1859,7 +1859,20 @@ AC_SUBST(extra_linker_plugin_flags)
 AC_ARG_ENABLE(host-shared,
 [AS_HELP_STRING([--enable-host-shared],
 		[build host code as shared libraries])],
-[host_shared=$enableval], [host_shared=no])
+[host_shared=$enableval
+ case $target in
+   x86_64-*-darwin* | aarch64-*-darwin*)
+     if test x$host_shared != xyes ; then
+       # PIC is the default, and actually cannot be switched off.
+       echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2
+       host_shared=yes
+     fi ;;
+  *) ;;
+ esac],
+[case $target in
+  x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;;
+  *) host_shared=no ;;
+ esac])
 AC_SUBST(host_shared)
 
 # By default, C and C++ are the only stage 1 languages.


                 reply	other threads:[~2021-11-16 19:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211116194522.58EB8385781A@sourceware.org \
    --to=iains@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).