diff --git a/ChangeLog b/ChangeLog index 92919938217..a95d6516871 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-01-19 Uros Bizjak + + PR target/78478 + * config/ax_check_define.m4: New file. + 2017-01-17 Jakub Jelinek PR other/79046 diff --git a/config/ax_check_define.m4 b/config/ax_check_define.m4 new file mode 100644 index 00000000000..4bc694861c0 --- /dev/null +++ b/config/ax_check_define.m4 @@ -0,0 +1,92 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_define.html +# =========================================================================== +# +# SYNOPSIS +# +# AC_CHECK_DEFINE([symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT]) +# AX_CHECK_DEFINE([includes],[symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT]) +# +# DESCRIPTION +# +# Complements AC_CHECK_FUNC but it does not check for a function but for a +# define to exist. Consider a usage like: +# +# AC_CHECK_DEFINE(__STRICT_ANSI__, CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500") +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 8 + +AU_ALIAS([AC_CHECK_DEFINED], [AC_CHECK_DEFINE]) +AC_DEFUN([AC_CHECK_DEFINE],[ +AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$1])dnl +AC_CACHE_CHECK([for $1 defined], ac_var, +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ + #ifdef $1 + int ok; + #else + choke me + #endif +]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)])) +AS_IF([test AS_VAR_GET(ac_var) != "no"], [$2], [$3])dnl +AS_VAR_POPDEF([ac_var])dnl +]) + +AU_ALIAS([AX_CHECK_DEFINED], [AX_CHECK_DEFINE]) +AC_DEFUN([AX_CHECK_DEFINE],[ +AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$2_$1])dnl +AC_CACHE_CHECK([for $2 defined in $1], ac_var, +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$1>]], [[ + #ifdef $2 + int ok; + #else + choke me + #endif +]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)])) +AS_IF([test AS_VAR_GET(ac_var) != "no"], [$3], [$4])dnl +AS_VAR_POPDEF([ac_var])dnl +]) + +AC_DEFUN([AX_CHECK_FUNC], +[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$2])dnl +AC_CACHE_CHECK([for $2], ac_var, +dnl AC_LANG_FUNC_LINK_TRY +[AC_LINK_IFELSE([AC_LANG_PROGRAM([$1 + #undef $2 + char $2 ();],[ + char (*f) () = $2; + return f != $2; ])], + [AS_VAR_SET(ac_var, yes)], + [AS_VAR_SET(ac_var, no)])]) +AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl +AS_VAR_POPDEF([ac_var])dnl +])# AC_CHECK_FUNC diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 6d252be9186..ad4f65b7fb2 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,12 @@ +2017-01-19 Uros Bizjak + + PR target/78478 + * acinclude.m4: Include ../config/ax_check_define.m4 + * configure.ac: Check if _SOFT_FLOAT is defined. + * configure.host (i?86 | x86_64): Use fpu-generic when + have_soft_float is set. + * configure: Regenerate. + 2017-01-19 Jakub Jelinek PR target/79127 diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4 index 34e14071aeb..ceb80a12a18 100644 --- a/libgfortran/acinclude.m4 +++ b/libgfortran/acinclude.m4 @@ -1,6 +1,7 @@ m4_include(../config/acx.m4) m4_include(../config/no-executables.m4) m4_include(../config/math.m4) +m4_include(../config/ax_check_define.m4) dnl Check that we have a working GNU Fortran compiler AC_DEFUN([LIBGFOR_WORKING_GFORTRAN], [ diff --git a/libgfortran/configure b/libgfortran/configure index 20b5e681712..81238fcb79c 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -25822,6 +25822,43 @@ $as_echo "#define HAVE_FP_ENABLE 1" >>confdefs.h fi +# Check if _SOFT_FLOAT is defined + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _SOFT_FLOAT defined" >&5 +$as_echo_n "checking for _SOFT_FLOAT defined... " >&6; } +if test "${ac_cv_defined__SOFT_FLOAT+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + #ifdef _SOFT_FLOAT + int ok; + #else + choke me + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_defined__SOFT_FLOAT=yes +else + ac_cv_defined__SOFT_FLOAT=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_defined__SOFT_FLOAT" >&5 +$as_echo "$ac_cv_defined__SOFT_FLOAT" >&6; } +if test $ac_cv_defined__SOFT_FLOAT != "no"; then : + have_soft_float=yes +fi + # Runs configure.host to set up necessary host-dependent shell variables. # We then display a message about it, and propagate them through the # build chain. diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac index 66a84625e52..37b12d2998f 100644 --- a/libgfortran/configure.ac +++ b/libgfortran/configure.ac @@ -556,6 +556,9 @@ AC_CHECK_FUNC([fpresetsticky],[have_fpresetsticky=yes AC_DEFINE([HAVE_FPRESETSTI AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])]) AC_CHECK_FUNC([fp_enable],[have_fp_enable=yes AC_DEFINE([HAVE_FP_ENABLE],[1],[fp_enable is present])]) +# Check if _SOFT_FLOAT is defined +AC_CHECK_DEFINE([_SOFT_FLOAT],[have_soft_float=yes]) + # Runs configure.host to set up necessary host-dependent shell variables. # We then display a message about it, and propagate them through the # build chain. diff --git a/libgfortran/configure.host b/libgfortran/configure.host index 0a12a32fc8a..5824f253e2f 100644 --- a/libgfortran/configure.host +++ b/libgfortran/configure.host @@ -40,7 +40,11 @@ fi # the x86 denormal exception. case "${host_cpu}" in i?86 | x86_64) - fpu_host='fpu-387' + if test "x${have_soft_float}" = "xyes"; then + fpu_host='fpu-generic' + else + fpu_host='fpu-387' + fi ieee_support='yes' ;; esac