[PATCH v2] Fix libgfortran cross compile configury w.r.t newlib

Marcus Shawcroft marcus.shawcroft@arm.com
Tue Oct 1 11:40:00 GMT 2013


On 30/09/13 13:40, Marcus Shawcroft wrote:

>> Well, I thought this patch would work for me, but it does not.  It looks
>> like gcc_no_link is set to 'no' on my target because, technically, I can
>> link even if I don't use a linker script.  I just can't find any
>> functions.
>>

> In which case gating on gcc_no_link could be replaced with a test that
> looks to see if we can link with the library.  Perhaps looking for
> exit() or some such that might reasonably be expected to be present.
>
> For example:
>
> AC_CHECK_FUNC(exit)
> if test "x${with_newlib}" = "xyes" -a "x${ac_cv_func_exit}" = "xno"; then
>
> /Marcus
>
>
>
>


Patch attached.

/Marcus

2013-10-01  Marcus Shawcroft  <marcus.shawcroft@arm.com>

         * configure.ac (AC_CHECK_FUNCS_ONCE): Add for exit() then make
         existing AC_CHECK_FUNCS_ONCE dependent on outcome.
-------------- next part --------------
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 4609eba..ac0c02f 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -261,7 +261,8 @@ GCC_HEADER_STDINT(gstdint.h)
 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev])
 
 # Check for library functions.
-if test "x${with_newlib}" = "xyes"; then
+AC_CHECK_FUNC(exit)
+if test "x${with_newlib}" = "xyes" -a "x${ac_cv_func_exit}" = "xno"; then
    # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
    # may not work correctly, because the compiler may not be able to
    # link executables.


More information about the Fortran mailing list