summaryrefslogtreecommitdiff
path: root/gcc/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r--gcc/configure.ac60
1 files changed, 60 insertions, 0 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 140b9f9ac90..998499ed82d 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -274,6 +274,11 @@ AC_ARG_WITH(gnu-ld,
gnu_ld_flag="$with_gnu_ld",
gnu_ld_flag=no)
+case $target in
+ *darwin*) ld64_flag=yes;; # Darwin can only use a ld64-compatible linker.
+ *) ld64_flag=no;;
+esac
+
# With pre-defined ld
AC_ARG_WITH(ld,
[AS_HELP_STRING([--with-ld], [arrange to use the specified ld (full pathname)])],
@@ -283,6 +288,8 @@ if test x"${DEFAULT_LINKER+set}" = x"set"; then
AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
gnu_ld_flag=yes
+ elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep ld64- > /dev/null; then
+ ld64_flag=yes
fi
AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
[Define to enable the use of a default linker.])
@@ -5266,6 +5273,59 @@ AC_DEFINE_UNQUOTED(LD_COMPRESS_DEBUG_OPTION, "$gcc_cv_ld_compress_debug_option",
[Define to the linker option to enable compressed debug sections.])
AC_MSG_RESULT($gcc_cv_ld_compress_debug)
+if test x"$ld64_flag" = x"yes"; then
+
+ # Set defaults for possibly untestable items.
+ gcc_cv_ld64_export_dynamic=0
+
+ if test "$build" = "$host"; then
+ darwin_try_test=1
+ else
+ darwin_try_test=0
+ fi
+
+ # On Darwin, because of FAT library support, it is often possible to execute
+ # exes from compatible archs even when the host differs from the build system.
+ case "$build","$host" in
+ x86_64-*-darwin*,i?86-*-darwin* | powerpc64*-*-darwin*,powerpc*-*-darwin*)
+ darwin_try_test=1;;
+ *) ;;
+ esac
+
+ # If the configurer specified a minimum ld64 version to be supported, then use
+ # that to determine feature support.
+ if test x"${gcc_cv_ld64_version}" != x; then
+ AC_MSG_CHECKING(ld64 major version)
+ IFS=. read gcc_cv_ld64_major gcc_cv_ld64_minor <<< "${gcc_cv_ld64_version}"
+ AC_MSG_RESULT($gcc_cv_ld64_major)
+ if test "$gcc_cv_ld64_major" -ge 236; then
+ gcc_cv_ld64_export_dynamic=1
+ fi
+ elif test -x "$gcc_cv_ld" -a "$darwin_try_test" -eq 1; then
+ # If the version was not specified, try to find it.
+ AC_MSG_CHECKING(linker version)
+ if test x"${gcc_cv_ld64_version}" = x; then
+ gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | grep ld64 | sed s/.*ld64-// | awk '{print $1}'`
+ fi
+ AC_MSG_RESULT($gcc_cv_ld64_version)
+
+ AC_MSG_CHECKING(linker for -export_dynamic support)
+ gcc_cv_ld64_export_dynamic=1
+ if $gcc_cv_ld -export_dynamic < /dev/null 2>&1 | grep 'unknown option' > /dev/null; then
+ gcc_cv_ld64_export_dynamic=0
+ fi
+ AC_MSG_RESULT($gcc_cv_ld64_export_dynamic)
+ fi
+
+ if test x"${gcc_cv_ld64_version}" != x; then
+ AC_DEFINE_UNQUOTED(LD64_VERSION, "${gcc_cv_ld64_version}",
+ [Define to ld64 version.])
+ fi
+
+ AC_DEFINE_UNQUOTED(LD64_HAS_EXPORT_DYNAMIC, $gcc_cv_ld64_export_dynamic,
+ [Define to 1 if ld64 supports '-export_dynamic'.])
+fi
+
# --------
# UNSORTED
# --------