Fix checking for round()

Old check fails on current GCC/glibc with
"error: statement cannot resolve address of overloaded function"
This commit is contained in:
Paul Cornett
2018-09-21 08:25:31 -07:00
parent fa1af3405c
commit 99565d0619
2 changed files with 28 additions and 44 deletions

58
configure vendored
View File

@@ -30801,68 +30801,36 @@ _ACEOF
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for round" >&5
$as_echo_n "checking for round... " >&6; }
if ${wx_cv_func_round+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_ext=cpp ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS' ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
for wx_func in round
do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $wx_func" >&5
$as_echo_n "checking for $wx_func... " >&6; }
if eval \${wx_cv_func_$wx_func+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <math.h> #include <math.h>
$ac_includes_default
int int
main () main ()
{ {
return int(round(0.0))
#ifndef $wx_func
&$wx_func;
#endif
; ;
return 0; return 0;
} }
_ACEOF _ACEOF
if ac_fn_cxx_try_link "$LINENO"; then : if ac_fn_cxx_try_link "$LINENO"; then :
eval wx_cv_func_$wx_func=yes wx_cv_func_round=yes
else else
eval wx_cv_func_$wx_func=no wx_cv_func_round=no
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$wx_cv_func_$wx_func
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \$wx_cv_func_$wx_func = yes
then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$wx_func" | $as_tr_cpp` 1
_ACEOF
else
:
fi
done
ac_ext=c ac_ext=c
ac_cpp='$CPP $CPPFLAGS' ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -30870,6 +30838,14 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_func_round" >&5
$as_echo "$wx_cv_func_round" >&6; }
if test "$wx_cv_func_round" = yes; then
$as_echo "#define HAVE_ROUND 1" >>confdefs.h
fi
if test "$TOOLKIT" != "MSW"; then if test "$TOOLKIT" != "MSW"; then
if test "$wxUSE_LIBICONV" != "no" ; then if test "$wxUSE_LIBICONV" != "no" ; then

View File

@@ -4193,9 +4193,17 @@ fi
dnl at least under IRIX with mipsPro the C99 round() function is available when dnl at least under IRIX with mipsPro the C99 round() function is available when
dnl building using the C compiler but not when using C++ one dnl building using the C compiler but not when using C++ one
AC_CACHE_CHECK([for round], wx_cv_func_round, [
AC_LANG_PUSH(C++) AC_LANG_PUSH(C++)
WX_CHECK_FUNCS(round,,,[#include <math.h>]) AC_TRY_LINK(
[#include <math.h>],
[return int(round(0.0))],
wx_cv_func_round=yes, wx_cv_func_round=no)
AC_LANG_POP() AC_LANG_POP()
])
if test "$wx_cv_func_round" = yes; then
AC_DEFINE(HAVE_ROUND)
fi
dnl the following tests are for Unix(like) systems only dnl the following tests are for Unix(like) systems only
if test "$TOOLKIT" != "MSW"; then if test "$TOOLKIT" != "MSW"; then