summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2011-02-22 10:09:55 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2011-02-22 10:09:55 +0000
commit149205a442038420ebc84c0016b948b2ef4ca336 (patch)
treefda7e228909929ebd9cc96eec29cabf6ffa0acc0 /configure.ac
parent1eeb3d432190fa973860627e131ee0743a91a177 (diff)
downloadmpc-149205a442038420ebc84c0016b948b2ef4ca336.tar.gz
configure.ac: check whether libm is needed for creal and cimag
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@938 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac21
1 files changed, 19 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index ffbcfbc..375dd69 100644
--- a/configure.ac
+++ b/configure.ac
@@ -122,18 +122,35 @@ esac
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([complex.h locale.h inttypes.h stdint.h limits.h unistd.h sys/time.h])
+AC_HEADER_TIME
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
-AC_HEADER_TIME
# Checks for libraries.
-AC_CHECK_LIB([m], [creal])
+AC_CHECK_HEADERS(
+ [complex.h],
+ [
+ AC_MSG_CHECKING(whether creal and cimag can be used without libm)
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <complex.h>]],
+ [[complex double x = 1.0 + 2.0 * I; return (creal (x) + cimag (x));]]
+ )],
+ [AC_MSG_RESULT([yes])],
+ [
+ AC_MSG_RESULT([no])
+ AC_CHECK_LIB([m], [creal])
+ ]
+ )
+ ]
+ )
AC_CHECK_LIB([gmp], [__gmpz_init],
[LIBS="-lgmp $LIBS"],
[AC_MSG_ERROR([libgmp not found or uses a different ABI.])])
+
AC_MSG_CHECKING(for MPFR)
LIBS="-lmpfr $LIBS"
AC_LINK_IFELSE(