Commit b4b2a487 by Mark Mitchell Committed by Mark Mitchell

acinclude.m4 (GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT): Check for cabs, cabsf, and cabsl, too.

        * acinclude.m4 (GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT): Check
        for cabs, cabsf, and cabsl, too.
        * aclocal.m4: Regenerated.
        * config.h.in: Likewise.
        * configure: Likewise.
        * libmath/Makefile.am (libmath_la_SOURCES): Remove cabs.c and
        cabsf.c.
        * libmath/Makefile.in: Regenerated.
        * libmath/complex-stub.h (cabs): Don't declare if the system
        already provides this function.
        (cabsf): Likewise.
        (cabsl): Likewise.
        * src/complex.cc (abs): Directly use `hypot' since we can't call
        cabs on IRIX.

From-SVN: r37145
parent 747dcaf1
2000-10-30 Mark Mitchell <mark@codesourcery.com>
* acinclude.m4 (GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT): Check
for cabs, cabsf, and cabsl, too.
* aclocal.m4: Regenerated.
* config.h.in: Likewise.
* configure: Likewise.
* libmath/Makefile.am (libmath_la_SOURCES): Remove cabs.c and
cabsf.c.
* libmath/Makefile.in: Regenerated.
* libmath/complex-stub.h (cabs): Don't declare if the system
already provides this function.
(cabsf): Likewise.
(cabsl): Likewise.
* src/complex.cc (abs): Directly use `hypot' since we can't call
cabs on IRIX.
2000-10-30 Joseph S. Myers <jsm28@cam.ac.uk> 2000-10-30 Joseph S. Myers <jsm28@cam.ac.uk>
* acinclude.m4: Update URL on egcs.cygnus.com to point to * acinclude.m4: Update URL on egcs.cygnus.com to point to
......
...@@ -725,9 +725,11 @@ dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT ...@@ -725,9 +725,11 @@ dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
dnl Check for complex versions of math functions of platform. dnl Check for complex versions of math functions of platform.
AC_CHECK_HEADERS([complex.h]) AC_CHECK_HEADERS([complex.h])
AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \ AC_CHECK_LIB(m, main)
clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \ AC_REPLACE_MATHFUNCS(cabs cabsf ccos ccosf ccosh ccoshf cexp cexpf \
ctan ctanf ctanh ctanhf carg cargf nan hypot hypotf atan2f expf copysignf) c_log c_logf clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt \
csqrtf ctan ctanf ctanh ctanhf carg cargf nan hypot hypotf atan2f expf \
copysignf)
dnl Compile the long double complex functions only if the function dnl Compile the long double complex functions only if the function
dnl provides the non-complex long double functions that are needed. dnl provides the non-complex long double functions that are needed.
...@@ -737,7 +739,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [ ...@@ -737,7 +739,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
if test x$ac_cv_func_atan2l = x"yes" \ if test x$ac_cv_func_atan2l = x"yes" \
&& test x$ac_cv_func_copysignl = x"yes"; then && test x$ac_cv_func_copysignl = x"yes"; then
USE_COMPLEX_LONG_DOUBLE=yes USE_COMPLEX_LONG_DOUBLE=yes
AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \ AC_REPLACE_MATHFUNCS(cabsl ccoshl ccosl cexpl cpowl csinhl csinl \
csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l) csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l)
fi fi
......
...@@ -737,9 +737,11 @@ dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT ...@@ -737,9 +737,11 @@ dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
dnl Check for complex versions of math functions of platform. dnl Check for complex versions of math functions of platform.
AC_CHECK_HEADERS([complex.h]) AC_CHECK_HEADERS([complex.h])
AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \ AC_CHECK_LIB(m, main)
clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \ AC_REPLACE_MATHFUNCS(cabs cabsf ccos ccosf ccosh ccoshf cexp cexpf \
ctan ctanf ctanh ctanhf carg cargf nan hypot hypotf atan2f expf copysignf) c_log c_logf clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt \
csqrtf ctan ctanf ctanh ctanhf carg cargf nan hypot hypotf atan2f expf \
copysignf)
dnl Compile the long double complex functions only if the function dnl Compile the long double complex functions only if the function
dnl provides the non-complex long double functions that are needed. dnl provides the non-complex long double functions that are needed.
...@@ -749,7 +751,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [ ...@@ -749,7 +751,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
if test x$ac_cv_func_atan2l = x"yes" \ if test x$ac_cv_func_atan2l = x"yes" \
&& test x$ac_cv_func_copysignl = x"yes"; then && test x$ac_cv_func_copysignl = x"yes"; then
USE_COMPLEX_LONG_DOUBLE=yes USE_COMPLEX_LONG_DOUBLE=yes
AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \ AC_REPLACE_MATHFUNCS(cabsl ccoshl ccosl cexpl cpowl csinhl csinl \
csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l) csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l)
fi fi
......
...@@ -291,6 +291,15 @@ ...@@ -291,6 +291,15 @@
/* Define if you have the c_logl function. */ /* Define if you have the c_logl function. */
#undef HAVE_C_LOGL #undef HAVE_C_LOGL
/* Define if you have the cabs function. */
#undef HAVE_CABS
/* Define if you have the cabsf function. */
#undef HAVE_CABSF
/* Define if you have the cabsl function. */
#undef HAVE_CABSL
/* Define if you have the carg function. */ /* Define if you have the carg function. */
#undef HAVE_CARG #undef HAVE_CARG
...@@ -651,6 +660,9 @@ ...@@ -651,6 +660,9 @@
/* Define if you have the <unistd.h> header file. */ /* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* Define if you have the m library (-lm). */
#undef HAVE_LIBM
/* Name of package */ /* Name of package */
#undef PACKAGE #undef PACKAGE
......
...@@ -46,7 +46,7 @@ libmath_la_LIBADD = \ ...@@ -46,7 +46,7 @@ libmath_la_LIBADD = \
libmath_la_DEPENDENCIES = $(libmath_la_LIBADD) libmath_la_DEPENDENCIES = $(libmath_la_LIBADD)
libmath_la_SOURCES = \ libmath_la_SOURCES = \
signbit.c signbitf.c cabs.c cabsf.c signbit.c signbitf.c
LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
......
...@@ -120,7 +120,7 @@ libmath_la_LIBADD = @LIBMATHOBJS@ $(EXTRA_LONG_DOUBLE_$(USE_COMPLEX_LONG_DOUB ...@@ -120,7 +120,7 @@ libmath_la_LIBADD = @LIBMATHOBJS@ $(EXTRA_LONG_DOUBLE_$(USE_COMPLEX_LONG_DOUB
libmath_la_DEPENDENCIES = $(libmath_la_LIBADD) libmath_la_DEPENDENCIES = $(libmath_la_LIBADD)
libmath_la_SOURCES = signbit.c signbitf.c cabs.c cabsf.c libmath_la_SOURCES = signbit.c signbitf.c
LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
...@@ -147,7 +147,7 @@ CPPFLAGS = @CPPFLAGS@ ...@@ -147,7 +147,7 @@ CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ LIBS = @LIBS@
libmath_la_LDFLAGS = libmath_la_LDFLAGS =
libmath_la_OBJECTS = signbit.lo signbitf.lo cabs.lo cabsf.lo libmath_la_OBJECTS = signbit.lo signbitf.lo
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
......
...@@ -78,9 +78,17 @@ double carg (__complex__ double x); ...@@ -78,9 +78,17 @@ double carg (__complex__ double x);
float cargf (__complex__ float x); float cargf (__complex__ float x);
long double cargl (__complex__ long double x); long double cargl (__complex__ long double x);
/* Some systems (like IRIX 6.5) already define these functions in
<math.h>. */
#ifndef _GLIBCPP_HAVE_CABS
double cabs (__complex__ double x); double cabs (__complex__ double x);
#endif /* defined(_GLIBCPP_HAVE_CABS) */
#ifndef _GLIBCPP_HAVE_CABSF
float cabsf (__complex__ float x); float cabsf (__complex__ float x);
#endif /* defined(_GLIBCPP_HAVE_CABSF) */
#ifndef _GLIBCPP_HAVE_CABSL
long double cabsl (__complex__ long double x); long double cabsl (__complex__ long double x);
#endif /* defined(_GLIBCPP_HAVE_CABSL) */
#endif #endif
// The template and inlines for the -*- C++ -*- complex number classes. // The template and inlines for the -*- C++ -*- complex number classes.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -48,7 +48,11 @@ namespace std ...@@ -48,7 +48,11 @@ namespace std
template<> template<>
FLT FLT
abs(const complex<FLT>& __x) abs(const complex<FLT>& __x)
{ return cabs(__x._M_value); } {
// We don't use cabs here because some systems (IRIX 6.5, for
// example) define their own incompatible version.
return hypot (__real__ __x._M_value, __imag__ __x._M_value);
}
template<> template<>
FLT FLT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment