Patch ping: [patch, libgfortran, configure] Cross-compile support for libgfortran

Tobias Burnus burnus@net-b.de
Fri Jun 21 21:49:00 GMT 2013


Steve Ellcey wrote:
> Ping...  These libgfortran changes are done the same way as libstdc++
> so I hope they are OK.

OK - Thanks for the patch. (I was hoping that some configure maintainer 
would do the deed.)

Tobias

> >From sellcey@mips.com Tue Jun  4 12:49:55 2013
>
> This patch allows me to build libgfortran for a cross-compiling toolchain
> using newlib.  Currently the checks done by AC_CHECK_FUNCS_ONCE fail with
> my toolchain because the compile/link fails due to the configure script not
> using the needed linker script in the link command.  The check for with_newlib
> is how libjava deals with the problem and it fixes my build problems.
>
> My only concern is defining HAVE_STRTOLD, strtold exists in my newlib but
> I am not sure if that is true for all newlib builds.  I didn't see any
> flags that I could easily use to check for long double support in the
> libgfortran configure.ac, but it seems to assume that the type exists.
>
> OK to checkin?
>
> Steve Ellcey
> sellcey@mips.com
>
>
> 2013-06-04  Steve Ellcey  <sellcey@mips.com>
>
> 	* configure.ac (AC_CHECK_FUNCS_ONCE): Put into if statement.
>
> diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
> index 7d97fed..4a00470 100644
> --- a/libgfortran/configure.ac
> +++ b/libgfortran/configure.ac
> @@ -261,13 +261,27 @@ GCC_HEADER_STDINT(gstdint.h)
>   AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev])
>   
>   # Check for library functions.
> -AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \
> -ftruncate chsize chdir getlogin gethostname kill link symlink sleep ttyname \
> -alarm access fork execl wait setmode execve pipe dup2 close \
> -strcasestr getrlimit gettimeofday stat fstat lstat getpwuid vsnprintf dup \
> -getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \
> -readlink getgid getpid getppid getuid geteuid umask getegid \
> -secure_getenv __secure_getenv)
> +if test "x${with_newlib}" = "xyes"; 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.
> +   AC_DEFINE(HAVE_MKSTEMP, 1, [Define if you have mkstemp.])
> +   AC_DEFINE(HAVE_STRTOF, 1, [Define if you have strtof.])
> +   AC_DEFINE(HAVE_STRTOLD, 1, [Define if you have strtold.])
> +   AC_DEFINE(HAVE_SNPRINTF, 1, [Define if you have snprintf.])
> +   AC_DEFINE(HAVE_STRCASESTR, 1, [Define if you have strcasestr.])
> +   AC_DEFINE(HAVE_VSNPRINTF, 1, [Define if you have vsnprintf.])
> +   AC_DEFINE(HAVE_LOCALTIME_R, 1, [Define if you have localtime_r.])
> +   AC_DEFINE(HAVE_GMTIME_R, 1, [Define if you have gmtime_r.])
> +else
> +   AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \
> +   ftruncate chsize chdir getlogin gethostname kill link symlink sleep ttyname \
> +   alarm access fork execl wait setmode execve pipe dup2 close \
> +   strcasestr getrlimit gettimeofday stat fstat lstat getpwuid vsnprintf dup \
> +   getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \
> +   readlink getgid getpid getppid getuid geteuid umask getegid \
> +   secure_getenv __secure_getenv)
> +fi
>   
>   # Check strerror_r, cannot be above as versions with two and three arguments exist
>   LIBGFOR_CHECK_STRERROR_R
>
>
>



More information about the Fortran mailing list