mirror of
https://github.com/gnustep/tools-make.git
synced 2025-04-23 22:33:28 +00:00
If the gnustep-2.0 ABI is used, emit a warning if a suspicious linker is found.
This commit is contained in:
parent
b458b0eb87
commit
94b77396ce
6 changed files with 125 additions and 2 deletions
1
aclocal.m4
vendored
1
aclocal.m4
vendored
|
@ -289,6 +289,7 @@ AS_VAR_IF([$1], [""], [$5], [$4])dnl
|
|||
])dnl PKG_CHECK_VAR
|
||||
|
||||
m4_include([m4/gs_cc_is_clang.m4])
|
||||
m4_include([m4/gs_check_abi20_linker.m4])
|
||||
m4_include([m4/gs_gcc_version.m4])
|
||||
m4_include([m4/gs_library_combo.m4])
|
||||
m4_include([m4/gs_objc_runtime.m4])
|
||||
|
|
30
configure
vendored
30
configure
vendored
|
@ -7200,6 +7200,36 @@ else
|
|||
fi
|
||||
|
||||
|
||||
# If we determined that the user wants the gnustep-2.0 ABI, check for potential linker problems.
|
||||
if test $gs_cv_runtime_abi = 'gnustep-2.0'; then
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an gnustep-2.0 ABI compatible linker" >&5
|
||||
$as_echo_n "checking for an gnustep-2.0 ABI compatible linker... " >&6; }
|
||||
if ${gs_cv_abi20_linker+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
gs_cv_abi20_linker="unkown"
|
||||
|
||||
gs_cv_abi20_linker_prog=$($CC --print-prog-name=ld)
|
||||
if $gs_cv_abi20_linker_prog --version | $GREP -q 'GNU ld'; then
|
||||
gs_cv_abi20_linker="unlikely (GNU ld)"
|
||||
elif $gs_cv_abi20_linker_prog --version | $GREP -q 'GNU gold'; then
|
||||
gs_cv_abi20_linker="yes (GNU gold)"
|
||||
elif $gs_cv_abi20_linker_prog --version | $GREP -q 'LLD'; then
|
||||
gs_cv_abi20_linker="yes (LLD)"
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gs_cv_abi20_linker" >&5
|
||||
$as_echo "$gs_cv_abi20_linker" >&6; }
|
||||
if echo "$gs_cv_abi20_linker" | $GREP -q -v '^yes'; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The detected linker might not produce working Objective-C binaries using the gnustep-2.0 ABI. Consider using gold or LLD." >&5
|
||||
$as_echo "$as_me: WARNING: The detected linker might not produce working Objective-C binaries using the gnustep-2.0 ABI. Consider using gold or LLD." >&2;}
|
||||
fi
|
||||
|
||||
fi
|
||||
# Do not restore LIBS and CFLAGS yet as we need to test if the
|
||||
# compiler supports native exceptions.
|
||||
|
||||
|
|
|
@ -1323,6 +1323,10 @@ GS_CHECK_GCC_VERSION()
|
|||
|
||||
|
||||
GS_RUNTIME_ABI()
|
||||
# If we determined that the user wants the gnustep-2.0 ABI, check for potential linker problems.
|
||||
if test $gs_cv_runtime_abi = 'gnustep-2.0'; then
|
||||
GS_CHECK_ABI20_LINKER()
|
||||
fi
|
||||
# Do not restore LIBS and CFLAGS yet as we need to test if the
|
||||
# compiler supports native exceptions.
|
||||
|
||||
|
|
33
m4/gs_check_abi20_linker.m4
Normal file
33
m4/gs_check_abi20_linker.m4
Normal file
|
@ -0,0 +1,33 @@
|
|||
# SYNOPSIS
|
||||
#
|
||||
# GS_CHECK_ABI20_LINKER([run-if-true],[run-if-false])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro checks whether we are using a linker that has known problems with the gnustep-2.0 ABI.
|
||||
# If so, we currently just print a warning because we don't have a 100% accurate way of checking yet.
|
||||
#
|
||||
AC_DEFUN([GS_CHECK_ABI20_LINKER], [dnl
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_PROG_GREP])
|
||||
AC_CACHE_CHECK([for an gnustep-2.0 ABI compatible linker],[gs_cv_abi20_linker], [dnl
|
||||
gs_cv_abi20_linker="unkown"
|
||||
AS_VAR_PUSHDEF([LD], [gs_cv_abi20_linker_prog])
|
||||
LD=$($CC --print-prog-name=ld)
|
||||
if $LD --version | $GREP -q 'GNU ld'; then
|
||||
gs_cv_abi20_linker="unlikely (GNU ld)"
|
||||
elif $LD --version | $GREP -q 'GNU gold'; then
|
||||
gs_cv_abi20_linker="yes (GNU gold)"
|
||||
elif $LD --version | $GREP -q 'LLD'; then
|
||||
gs_cv_abi20_linker="yes (LLD)"
|
||||
fi
|
||||
AS_VAR_POPDEF([LD])
|
||||
])
|
||||
if echo "$gs_cv_abi20_linker" | $GREP -q '^yes'; then
|
||||
_gs_abi20_linker=yes
|
||||
else
|
||||
_gs_abi20_linker=no
|
||||
AC_MSG_WARN([The detected linker might not produce working Objective-C binaries using the gnustep-2.0 ABI. Consider using gold or LLD.])
|
||||
fi
|
||||
AS_VAR_IF([_gs_abi20_linker], ["yes"], [$1], [$2])
|
||||
])
|
|
@ -1,3 +1,12 @@
|
|||
# SYNOPSIS
|
||||
#
|
||||
# GS_OBJ_DIR()
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro may only be used after general gnustep-make configuration has completed. It will return the object directory
|
||||
# required for a non-flattened setup.
|
||||
#
|
||||
AC_DEFUN([GS_OBJ_DIR], [
|
||||
AC_CACHE_CHECK([for object subdirectory],[_gs_cv_obj_dir], [
|
||||
if test "$GNUSTEP_IS_FLATTENED" != yes; then
|
||||
|
@ -11,6 +20,15 @@ AC_DEFUN([GS_OBJ_DIR], [
|
|||
AS_VAR_IF([_gs_cv_obj_dir], ["(none)"], AS_UNSET(gs_cv_obj_dir), [AS_VAR_SET([gs_cv_obj_dir], [${_gs_cv_obj_dir}])])
|
||||
])
|
||||
|
||||
|
||||
# SYNOPSIS
|
||||
#
|
||||
# GS_DOMAIN_DIR([installation-domain],[HEADERS or LIBRARIES])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Expands to the variable pointing to the correct headers or libraries directory in that domain
|
||||
#
|
||||
AC_DEFUN([GS_DOMAIN_DIR],[
|
||||
AC_REQUIRE([GS_OBJ_DIR])
|
||||
m4_pushdef([search_dir], [m4_join([],[gs_cv_], $1, [_], $2, [_dir])])
|
||||
|
@ -24,6 +42,16 @@ AC_DEFUN([GS_DOMAIN_DIR],[
|
|||
m4_popdef([search_dir])
|
||||
])
|
||||
|
||||
|
||||
# SYNOPSIS
|
||||
#
|
||||
# GS_DOMAIN_DIR([prefix],[HEADERS or LIBRARIES],[comma separated list of file names])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macros performs a search for the mentioned files in all installation domains and returns
|
||||
# a list of which domains the file(s) were found in as `$prefix_DOMAINS'. If more than file is
|
||||
# specified the search will succeed if one of the files is found.
|
||||
AC_DEFUN([GS_DOMAINS_FOR_FILES],[
|
||||
m4_pushdef([cache_var], [m4_join([], [gs_cv_], $1, [_domains])])
|
||||
AC_REQUIRE([GS_OBJ_DIR])
|
||||
|
@ -49,14 +77,17 @@ AC_DEFUN([GS_DOMAINS_FOR_FILES],[
|
|||
m4_popdef([cache_var])
|
||||
])
|
||||
|
||||
# Helper macro for finding the installation domain of a pre-installed libobjc library
|
||||
AC_DEFUN([_GS_LIBOJC_DOMAINS],[
|
||||
GS_DOMAINS_FOR_FILES([LIBOBJC], [LIBRARIES], [libobjc.a, libobjc.so, libobjc.dll.a, libobjc-gnu.dylib])
|
||||
])
|
||||
|
||||
# Helper macro for finding the installation domain of the pre-installed libobjc headers
|
||||
AC_DEFUN([_GS_OBJC_HEADER_DOMAINS],[
|
||||
GS_DOMAINS_FOR_FILES([OBJC_HEADERS], [HEADERS], [objc/objc.h])
|
||||
])
|
||||
|
||||
# Helper macro to detect in which installation domain (if any) a custom libobjc library is installed.
|
||||
AC_DEFUN([GS_CUSTOM_OBJC_RUNTIME_DOMAIN], [
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
AC_REQUIRE([_GS_LIBOJC_DOMAINS])
|
||||
|
@ -77,6 +108,8 @@ AC_DEFUN([GS_CUSTOM_OBJC_RUNTIME_DOMAIN], [
|
|||
])
|
||||
])
|
||||
|
||||
# Helper macro to find libobjc via package config. In addition to the usual pkg-config flags, this will
|
||||
# also set libobjc_SUPPORTS_ABI20 to `yes' or `no' depending on whether the version has support for it.
|
||||
AC_DEFUN([GS_LIBOBJC_PKG], [
|
||||
AC_REQUIRE([GS_OBJC_LIB_FLAG])
|
||||
libobjc_SUPPORTS_ABI20=""
|
||||
|
@ -92,7 +125,7 @@ AC_DEFUN([GS_LIBOBJC_PKG], [
|
|||
fi
|
||||
])
|
||||
|
||||
|
||||
# Helper macro to implement the --with-objc-lib-flag commandline parameter
|
||||
AC_DEFUN([GS_OBJC_LIB_FLAG], [
|
||||
AC_MSG_CHECKING(for the flag to link libobjc)
|
||||
AC_ARG_WITH([objc-lib-flag],
|
||||
|
@ -117,6 +150,19 @@ AC_DEFUN([GS_OBJC_LIB_FLAG], [
|
|||
AC_MSG_RESULT(${effective_flag})
|
||||
])
|
||||
|
||||
# SYNOPSIS
|
||||
#
|
||||
# GS_CHECK_OBJC_RUNTIME()
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Configure the installed Objective-C runtime, if it is installed. This sets up CFLAGS/LDFLAGS/LD_LIBRARY_PATH
|
||||
# as required. Additionally, following variables are set after execution of this macro:
|
||||
# * OBJC_CPPFLAGS
|
||||
# * OBCJ_LDFLAGS
|
||||
# * OBJC_FINAL_LIB_FLAG
|
||||
# * OBJCRT
|
||||
#
|
||||
AC_DEFUN([GS_CHECK_OBJC_RUNTIME], [
|
||||
AC_REQUIRE([AC_CANONICAL_TARGET])
|
||||
AC_REQUIRE([GS_OBJ_DIR])
|
||||
|
@ -191,11 +237,20 @@ AC_DEFUN([GS_CHECK_OBJC_RUNTIME], [
|
|||
OBJCRT="$OBJC_FINAL_LIB_FLAG"
|
||||
])
|
||||
|
||||
|
||||
# Helper macro for checking gnustep-2.0 ABI support in libobjc via the __objc_load macro
|
||||
AC_DEFUN([_GS_HAVE_OBJC_LOAD], [
|
||||
AC_REQUIRE([GS_CHECK_OBJC_RUNTIME])
|
||||
AC_CHECK_FUNC([__objc_load])
|
||||
])
|
||||
|
||||
# SYNOPSIS
|
||||
#
|
||||
# GS_CHECK_RUNTIME_ABI20_SUPPORT()
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Checks for support for the gnustep-2.0 ABI in the runtime library. Sets the `libobjc_SUPPORTS_ABI20' variable.
|
||||
AC_DEFUN([GS_CHECK_RUNTIME_ABI20_SUPPORT], [
|
||||
AC_REQUIRE([GS_CHECK_OBJC_RUNTIME])
|
||||
AC_REQUIRE([_GS_HAVE_OBJC_LOAD])
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro determine the correct runtime ABI to use.
|
||||
# This macro determine the correct runtime ABI to use.
|
||||
#
|
||||
AC_DEFUN([GS_RUNTIME_ABI],dnl
|
||||
[AC_REQUIRE([GS_LIBRARY_COMBO])
|
||||
|
|
Loading…
Reference in a new issue