mirror of
https://github.com/gnustep/tools-make.git
synced 2025-04-23 22:33:28 +00:00
automatically upgrade to gnustep-2.0 abi if supported by compiler and runtime
This commit is contained in:
parent
02e014a5f1
commit
b458b0eb87
3 changed files with 184 additions and 11 deletions
158
configure
vendored
158
configure
vendored
|
@ -1930,6 +1930,119 @@ fi
|
|||
as_fn_set_status $ac_retval
|
||||
|
||||
} # ac_fn_c_try_run
|
||||
|
||||
# ac_fn_c_try_link LINENO
|
||||
# -----------------------
|
||||
# Try to link conftest.$ac_ext, and return whether this succeeded.
|
||||
ac_fn_c_try_link ()
|
||||
{
|
||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { { ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo"; } >&5
|
||||
(eval "$ac_link") 2>conftest.err
|
||||
ac_status=$?
|
||||
if test -s conftest.err; then
|
||||
grep -v '^ *+' conftest.err >conftest.er1
|
||||
cat conftest.er1 >&5
|
||||
mv -f conftest.er1 conftest.err
|
||||
fi
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext && {
|
||||
test "$cross_compiling" = yes ||
|
||||
test -x conftest$ac_exeext
|
||||
}; then :
|
||||
ac_retval=0
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_retval=1
|
||||
fi
|
||||
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
|
||||
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
|
||||
# interfere with the next link command; also delete a directory that is
|
||||
# left behind by Apple's compiler. We do this before executing the actions.
|
||||
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
|
||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||
as_fn_set_status $ac_retval
|
||||
|
||||
} # ac_fn_c_try_link
|
||||
|
||||
# ac_fn_c_check_func LINENO FUNC VAR
|
||||
# ----------------------------------
|
||||
# Tests whether FUNC exists, setting the cache variable VAR accordingly
|
||||
ac_fn_c_check_func ()
|
||||
{
|
||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
|
||||
$as_echo_n "checking for $2... " >&6; }
|
||||
if eval \${$3+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
|
||||
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
||||
#define $2 innocuous_$2
|
||||
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $2 (); below.
|
||||
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
<limits.h> exists even on freestanding compilers. */
|
||||
|
||||
#ifdef __STDC__
|
||||
# include <limits.h>
|
||||
#else
|
||||
# include <assert.h>
|
||||
#endif
|
||||
|
||||
#undef $2
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char $2 ();
|
||||
/* The GNU C library defines this for functions which it implements
|
||||
to always fail with ENOSYS. Some functions are actually named
|
||||
something starting with __ and the normal name is an alias. */
|
||||
#if defined __stub_$2 || defined __stub___$2
|
||||
choke me
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return $2 ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
eval "$3=yes"
|
||||
else
|
||||
eval "$3=no"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
eval ac_res=\$$3
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||
|
||||
} # ac_fn_c_check_func
|
||||
cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
@ -6109,6 +6222,7 @@ $as_echo "no" >&6; }
|
|||
fi
|
||||
|
||||
|
||||
libobjc_SUPPORTS_ABI20=""
|
||||
if test x"$GNUSTEP_HAS_PKGCONFIG" = x"yes" -a x"$OBJC_LIB_FLAG" = x""; then
|
||||
|
||||
pkg_failed=no
|
||||
|
@ -6267,8 +6381,6 @@ else
|
|||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
|
||||
libobjc_SUPPORTS_ABI2="no"
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
@ -6374,8 +6486,6 @@ else
|
|||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
|
||||
libobjc_SUPPORTS_ABI2="no"
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
@ -6386,7 +6496,7 @@ else
|
|||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
|
||||
libobjc_SUPPORTS_ABI2="yes"
|
||||
libobjc_SUPPORTS_ABI20="yes"
|
||||
|
||||
fi
|
||||
fi
|
||||
|
@ -6401,7 +6511,7 @@ fi
|
|||
|
||||
if test ! x"$libobjc_LIBS" = x""; then
|
||||
OBJC_CPPFLAGS=$libobjc_CFLAGS
|
||||
OBJC_LDFLAGS=$libobjc_LIBS
|
||||
OBCJ_LDFLAGS=""
|
||||
OBJC_FINAL_LIB_FLAG=$libobjc_LIBS
|
||||
elif test ! x"$gs_cv_libobjc_domain" = x""; then
|
||||
if test x"$gs_cv_libobjc_domain" = x"SYSTEM"; then
|
||||
|
@ -6425,6 +6535,8 @@ fi
|
|||
GNUSTEP_LDIR="$GNUSTEP_LDIR/$gs_cv_obj_dir"
|
||||
GNUSTEP_HDIR="$GNUSTEP_HDIR/$LIBRARY_COMBO"
|
||||
fi
|
||||
gs_cv_objc_incdir=$GNUSTEP_HDIR
|
||||
gs_cv_objc_libdir=$GNUSTEP_LDIR
|
||||
# The following are needed to compile the test programs
|
||||
OBJC_CPPFLAGS="$CPPFLAGS $INCLUDES -I$gs_cv_objc_incdir"
|
||||
OBJC_LDFLAGS="$LDFLAGS $LIB_DIR -L$gs_cv_objc_libdir"
|
||||
|
@ -6444,6 +6556,7 @@ fi
|
|||
if test x"$OBJC_FINAL_LIB_FLAG" = x""; then
|
||||
OBJC_FINAL_LIB_FLAG="-lobjc"
|
||||
fi
|
||||
OBJC_LDFLAGS="$OBJC_LDFLAGS $OBJC_FINAL_LIB_FLAG"
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
saved_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS -x objective-c -I$srcdir $OBJC_CPPFLAGS $OBJC_LDFLAGS"
|
||||
|
@ -7020,6 +7133,37 @@ fi
|
|||
|
||||
|
||||
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "__objc_load" "ac_cv_func___objc_load"
|
||||
if test "x$ac_cv_func___objc_load" = xyes; then :
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether runtime library supports the gnustep-2.0 ABI" >&5
|
||||
$as_echo_n "checking whether runtime library supports the gnustep-2.0 ABI... " >&6; }
|
||||
if ${gs_cv_libobjc_abi_20+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
if test x"$libobjc_SUPPORTS_ABI20" = x""; then
|
||||
gs_cv_libobjc_abi_20=$ac_cv_func___objc_load
|
||||
else
|
||||
gs_cv_libobjc_abi_20=$libobjc_SUPPORTS_ABI20
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gs_cv_libobjc_abi_20" >&5
|
||||
$as_echo "$gs_cv_libobjc_abi_20" >&6; }
|
||||
libobjc_SUPPORTS_ABI20=${gs_cv_libobjc_abi_20}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case "$OBJC_RUNTIME_LIB" in
|
||||
gnu) default_runtime_abi=gcc ;;
|
||||
ng) default_runtime_abi=gnustep-1.8 ;;
|
||||
|
@ -7027,6 +7171,8 @@ fi
|
|||
esac
|
||||
if test ! x"" = x""; then
|
||||
default_runtime_abi=""
|
||||
elif test x"$OBJC_RUNTIME_LIB" = x"ng" -a x"$libobjc_SUPPORTS_ABI20" = x"yes" -a x"$CLANG_CC" = x"yes" -a "${gs_cv_gcc_major_version}" -ge "8"; then
|
||||
default_runtime_abi=gnustep-2.0
|
||||
fi
|
||||
|
||||
# Check whether --with-runtime-abi was given.
|
||||
|
|
|
@ -79,14 +79,14 @@ AC_DEFUN([GS_CUSTOM_OBJC_RUNTIME_DOMAIN], [
|
|||
|
||||
AC_DEFUN([GS_LIBOBJC_PKG], [
|
||||
AC_REQUIRE([GS_OBJC_LIB_FLAG])
|
||||
libobjc_SUPPORTS_ABI20=""
|
||||
if test x"$GNUSTEP_HAS_PKGCONFIG" = x"yes" -a x"$OBJC_LIB_FLAG" = x""; then
|
||||
PKG_CHECK_MODULES([libobjc], [libobjc >= 2], [
|
||||
AS_VAR_SET([libobjc_SUPPORTS_ABI2], ["yes"])
|
||||
dnl we already know that this
|
||||
AS_VAR_SET([libobjc_SUPPORTS_ABI20], ["yes"])
|
||||
], [
|
||||
PKG_CHECK_EXISTS([libobjc], [
|
||||
PKG_CHECK_MODULES([libobjc], [libobjc], [
|
||||
AS_VAR_SET([libobjc_SUPPORTS_ABI2], ["no"])
|
||||
])
|
||||
PKG_CHECK_MODULES([libobjc], [libobjc])
|
||||
])
|
||||
])
|
||||
fi
|
||||
|
@ -128,7 +128,7 @@ AC_DEFUN([GS_CHECK_OBJC_RUNTIME], [
|
|||
dnl pkg-config makes it easy for us to configure the flags
|
||||
if test ! x"$libobjc_LIBS" = x""; then
|
||||
OBJC_CPPFLAGS=$libobjc_CFLAGS
|
||||
OBJC_LDFLAGS=$libobjc_LIBS
|
||||
OBCJ_LDFLAGS=""
|
||||
OBJC_FINAL_LIB_FLAG=$libobjc_LIBS
|
||||
dnl we need to invest more smarts if
|
||||
elif test ! x"$gs_cv_libobjc_domain" = x""; then
|
||||
|
@ -153,6 +153,8 @@ AC_DEFUN([GS_CHECK_OBJC_RUNTIME], [
|
|||
GNUSTEP_LDIR="$GNUSTEP_LDIR/$gs_cv_obj_dir"
|
||||
GNUSTEP_HDIR="$GNUSTEP_HDIR/$LIBRARY_COMBO"
|
||||
fi
|
||||
gs_cv_objc_incdir=$GNUSTEP_HDIR
|
||||
gs_cv_objc_libdir=$GNUSTEP_LDIR
|
||||
# The following are needed to compile the test programs
|
||||
OBJC_CPPFLAGS="$CPPFLAGS $INCLUDES -I$gs_cv_objc_incdir"
|
||||
OBJC_LDFLAGS="$LDFLAGS $LIB_DIR -L$gs_cv_objc_libdir"
|
||||
|
@ -172,6 +174,7 @@ AC_DEFUN([GS_CHECK_OBJC_RUNTIME], [
|
|||
if test x"$OBJC_FINAL_LIB_FLAG" = x""; then
|
||||
OBJC_FINAL_LIB_FLAG="-lobjc"
|
||||
fi
|
||||
OBJC_LDFLAGS="$OBJC_LDFLAGS $OBJC_FINAL_LIB_FLAG"
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
saved_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS -x objective-c -I$srcdir $OBJC_CPPFLAGS $OBJC_LDFLAGS"
|
||||
|
@ -186,4 +189,23 @@ AC_DEFUN([GS_CHECK_OBJC_RUNTIME], [
|
|||
CFLAGS="$CFLAGS -DAPPLE_RUNTIME"
|
||||
fi
|
||||
OBJCRT="$OBJC_FINAL_LIB_FLAG"
|
||||
])
|
||||
|
||||
AC_DEFUN([_GS_HAVE_OBJC_LOAD], [
|
||||
AC_REQUIRE([GS_CHECK_OBJC_RUNTIME])
|
||||
AC_CHECK_FUNC([__objc_load])
|
||||
])
|
||||
|
||||
AC_DEFUN([GS_CHECK_RUNTIME_ABI20_SUPPORT], [
|
||||
AC_REQUIRE([GS_CHECK_OBJC_RUNTIME])
|
||||
AC_REQUIRE([_GS_HAVE_OBJC_LOAD])
|
||||
AC_CACHE_CHECK([whether runtime library supports the gnustep-2.0 ABI],
|
||||
[gs_cv_libobjc_abi_20], [
|
||||
if test x"$libobjc_SUPPORTS_ABI20" = x""; then
|
||||
gs_cv_libobjc_abi_20=$ac_cv_func___objc_load
|
||||
else
|
||||
gs_cv_libobjc_abi_20=$libobjc_SUPPORTS_ABI20
|
||||
fi
|
||||
])
|
||||
AS_VAR_SET([libobjc_SUPPORTS_ABI20], [${gs_cv_libobjc_abi_20}])
|
||||
])
|
|
@ -8,6 +8,9 @@
|
|||
#
|
||||
AC_DEFUN([GS_RUNTIME_ABI],dnl
|
||||
[AC_REQUIRE([GS_LIBRARY_COMBO])
|
||||
AC_REQUIRE([GS_CHECK_RUNTIME_ABI20_SUPPORT])
|
||||
AC_REQUIRE([GS_CHECK_CC_IS_CLANG])
|
||||
AC_REQUIRE([GS_CHECK_GCC_VERSION])
|
||||
case "$OBJC_RUNTIME_LIB" in
|
||||
gnu) default_runtime_abi=gcc ;;
|
||||
ng) default_runtime_abi=gnustep-1.8 ;;
|
||||
|
@ -15,6 +18,8 @@ AC_DEFUN([GS_RUNTIME_ABI],dnl
|
|||
esac
|
||||
if test ! x"$1" = x""; then
|
||||
default_runtime_abi="$1"
|
||||
elif test x"$OBJC_RUNTIME_LIB" = x"ng" -a x"$libobjc_SUPPORTS_ABI20" = x"yes" -a x"$CLANG_CC" = x"yes" -a "${gs_cv_gcc_major_version}" -ge "8"; then
|
||||
default_runtime_abi=gnustep-2.0
|
||||
fi
|
||||
AC_ARG_WITH([runtime-abi],
|
||||
[AS_HELP_STRING([--with-runtime-abi], [
|
||||
|
|
Loading…
Reference in a new issue