]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
configure, Darwin: Set appropriate defaults for host-shared.
authorIain Sandoe <iain@sandoe.co.uk>
Fri, 12 Nov 2021 17:05:13 +0000 (17:05 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Tue, 16 Nov 2021 19:44:51 +0000 (19:44 +0000)
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.

configure
configure.ac

index 58979d6e3b119c426277139fca963f136440cef2..3062495da31ff15d1c69f03d23615e0de6f4d417 100755 (executable)
--- 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.
index 550e6993b59869740392a701dc194b8e66c062ad..bed60bcaf72cc651cc09876bc0d9e509b41260e8 100644 (file)
@@ -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.