directly, and only if GUILE_I was defined by the configure step.
(scm_log, scm_log10, scm_exp, scm_sqrt): Use SCM_COMPLEX_VALUE
code only if SCM_COMPLEX_VALUE is defined.
* configure.in (--without-64-calls): Use AC_MSG_CHECKING and
AC_MSG_RESULT instead of just echo.
(GUILE_I): New programs to try using _Complex_I or 1.0fi for the
imaginary unit.
+2008-02-11 Neil Jerram <neil@ossau.uklinux.net>
+
+ * configure.in (--without-64-calls): Use AC_MSG_CHECKING and
+ AC_MSG_RESULT instead of just echo.
+ (GUILE_I): New programs to try using _Complex_I or 1.0fi for the
+ imaginary unit.
+
2008-02-06 Neil Jerram <neil@ossau.uklinux.net>
* configure.in: Default to --without-64-calls for
** Fixed wrong-type-arg errors when creating zero length SRFI-4
uniform vectors on AIX.
** Fixed a deadlock that occurs upon GC with multiple threads.
+** Fixed compile problem with GCC on Solaris and AIX (use of _Complex_I)
* New modules (see the manual for details)
dnl missing out on that. If so, someone can work on that in the future.
dnl For now, --without-64-calls allows Guile to build on OSs where it
dnl wasn't building before.
+AC_MSG_CHECKING([whether to use system and library "64" calls])
AC_ARG_WITH([64-calls],
AC_HELP_STRING([--without-64-calls],
[don't attempt to use system and library calls with "64" in their names]),
use_64_calls=no
;;
esac])
-echo "use_64_calls=$use_64_calls"
+AC_MSG_RESULT($use_64_calls)
case "$use_64_calls" in
y* )
AC_DEFINE(GUILE_USE_64_CALLS, 1,
[AC_DEFINE(HAVE_CRYPT,1,
[Define to 1 if you have the `crypt' function.])])
+# When compiling with GCC on some OSs (Solaris, AIX), _Complex_I doesn't work;
+# in the reported cases so far, 1.0fi works well instead.
+if test "$ac_cv_type_complex_double" = yes; then
+ AC_MSG_CHECKING([for i])
+ AC_TRY_COMPILE([
+#if HAVE_COMPLEX_H
+#include <complex.h>
+#endif
+complex double z;
+],[
+z = _Complex_I;
+],[AC_DEFINE(GUILE_I,_Complex_I,[The imaginary unit (positive square root of -1).])
+ AC_MSG_RESULT([_Complex_I])],[AC_TRY_COMPILE([
+#if HAVE_COMPLEX_H
+#include <complex.h>
+#endif
+complex double z;
+],[
+z = 1.0fi;
+],[AC_DEFINE(GUILE_I,1.0fi)
+ AC_MSG_RESULT([1.0fi])],[ac_cv_type_complex_double=no
+ AC_MSG_RESULT([not available])])])
+fi
+
# glibc 2.3.6 (circa 2006) and various prior versions had a bug where
# csqrt(-i) returned a negative real part, when it should be positive
# for the principal root.
+2008-02-11 Neil Jerram <neil@ossau.uklinux.net>
+
+ * numbers.c (SCM_COMPLEX_VALUE): Use GUILE_I instead of _Complex_I
+ directly, and only if GUILE_I was defined by the configure step.
+ (scm_log, scm_log10, scm_exp, scm_sqrt): Use SCM_COMPLEX_VALUE
+ code only if SCM_COMPLEX_VALUE is defined.
+
2008-02-07 Ludovic Courtès <ludo@gnu.org>
Fix bug #21378.
#endif
}
-
+#if defined (GUILE_I)
/* For an SCM object Z which is a complex number (ie. satisfies
SCM_COMPLEXP), return its value as a C level "complex double". */
#define SCM_COMPLEX_VALUE(z) \
- (SCM_COMPLEX_REAL (z) + _Complex_I * SCM_COMPLEX_IMAG (z))
+ (SCM_COMPLEX_REAL (z) + GUILE_I * SCM_COMPLEX_IMAG (z))
+#endif
/* Convert a C "complex double" to an SCM value. */
#if HAVE_COMPLEX_DOUBLE
{
if (SCM_COMPLEXP (z))
{
-#if HAVE_COMPLEX_DOUBLE && HAVE_CLOG
+#if HAVE_COMPLEX_DOUBLE && HAVE_CLOG && defined (SCM_COMPLEX_VALUE)
return scm_from_complex_double (clog (SCM_COMPLEX_VALUE (z)));
#else
double re = SCM_COMPLEX_REAL (z);
/* Mingw has clog() but not clog10(). (Maybe it'd be worth using
clog() and a multiply by M_LOG10E, rather than the fallback
log10+hypot+atan2.) */
-#if HAVE_COMPLEX_DOUBLE && HAVE_CLOG10
+#if HAVE_COMPLEX_DOUBLE && HAVE_CLOG10 && defined (SCM_COMPLEX_VALUE)
return scm_from_complex_double (clog10 (SCM_COMPLEX_VALUE (z)));
#else
double re = SCM_COMPLEX_REAL (z);
{
if (SCM_COMPLEXP (z))
{
-#if HAVE_COMPLEX_DOUBLE && HAVE_CEXP
+#if HAVE_COMPLEX_DOUBLE && HAVE_CEXP && defined (SCM_COMPLEX_VALUE)
return scm_from_complex_double (cexp (SCM_COMPLEX_VALUE (z)));
#else
return scm_c_make_polar (exp (SCM_COMPLEX_REAL (z)),
{
if (SCM_COMPLEXP (x))
{
-#if HAVE_COMPLEX_DOUBLE && HAVE_USABLE_CSQRT
+#if HAVE_COMPLEX_DOUBLE && HAVE_USABLE_CSQRT && defined (SCM_COMPLEX_VALUE)
return scm_from_complex_double (csqrt (SCM_COMPLEX_VALUE (x)));
#else
double re = SCM_COMPLEX_REAL (x);