summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2011-07-13 12:13:04 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2011-07-13 12:13:04 +0000
commit3fe7c2612c5f6a3c5cb7b20f4b020ab52da6c598 (patch)
tree3e8bee7d77bd7883b289e82fced9764709768c37 /m4
parentc10f39f9a49de2630a535cb56327b259563cb864 (diff)
downloadmpc-3fe7c2612c5f6a3c5cb7b20f4b020ab52da6c598.tar.gz
configure.ac, mpc.m4: to test for complex.h, always compile a test programme
closes bug #12829 git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1013 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'm4')
-rw-r--r--m4/mpc.m460
1 files changed, 60 insertions, 0 deletions
diff --git a/m4/mpc.m4 b/m4/mpc.m4
index 586aa47..b99ed96 100644
--- a/m4/mpc.m4
+++ b/m4/mpc.m4
@@ -19,6 +19,66 @@ along with the MPC Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
+
+#
+# SYNOPSIS
+#
+#
+MPC_COMPLEX_H
+#
+# DESCRIPTION
+#
+# Check whether complex.h is usable; if yes, define HAVE_COMPLEX_H.
+# On solaris, one also needs the libm; in that case, it is added to LIB,
+# and HAVE_LIBM is defined.
+#
+AC_DEFUN([MPC_COMPLEX_H], [
+ AC_CHECK_HEADER(
+ [complex.h],
+ [
+ m4_define(
+ [MPC_CONFTEST],
+ [
+ AC_LANG_PROGRAM(
+ [[#include <complex.h>]],
+ [[complex double x = 1.0 + 2.0 * I; return (creal (x) + cimag (x));]]
+ )
+ ]
+ )
+
+ AC_MSG_CHECKING(whether creal and cimag can be used without libm)
+ AC_LINK_IFELSE(
+ [MPC_CONFTEST],
+ [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h present and usable])
+ ],
+ [
+ AC_MSG_RESULT([no])
+ AC_CHECK_LIB([m], [creal],
+ [
+ AC_MSG_CHECKING(whether creal and cimag can be used with libm)
+ AC_LINK_IFELSE(
+ [MPC_CONFTEST],
+ [
+ AC_MSG_RESULT([yes])
+ LIBS="-lm $LIBS"
+ AC_DEFINE([HAVE_LIBM], [1], [libm needed for creal])
+ AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h present and usable])
+ ],
+ [
+ AC_MSG_RESULT([no])
+ ]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
+])
+
+
#
# SYNOPSIS
#