Commit d8ef71e9 authored by Michael Pyne's avatar Michael Pyne

Add in proper configure check for mpfr.

svn path=/trunk/playground/utils/abakus/; revision=745805
parent 3603cf6b
......@@ -4,6 +4,24 @@ set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
FIND_PACKAGE(KDE4 REQUIRED)
include(KDE4Defaults)
include(CheckCXXSourceCompiles)
# Check for libmpfr and libgmp, and verify existence of _mpfr_struct
set(CMAKE_REQUIRED_LIBRARIES gmp mpfr)
check_cxx_source_compiles(
"#include <mpfr.h>
int main() {
mpfr_t a;
mpfr_ptr ptr;
__mpfr_struct debug;
mpfr_init(a);
return 0;
}
"
HAVE_MPFR
)
INCLUDE_DIRECTORIES(${KDE4_INCLUDES} ${QT4_INCLUDES})
ADD_DEFINITIONS(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
......
......@@ -123,8 +123,8 @@ set(abakus_SRCS
)
set(MPFR_LIBS)
set(HAVE_MPFR 0)
IF(HAVE_MPFR)
MESSAGE("Using the MPFR high-precision mathematics library")
SET(MPFR_LIBS mpfr gmp)
ELSE(HAVE_MPFR)
SET(abakus_SRCS ${abakus_SRCS} hmath.cpp number.c)
......
......@@ -260,7 +260,7 @@ public:
explicit number(const QByteArray &str)
{
m_t = (mpfr_ptr) new __mpfr_struct;
mpfr_init_set_str (m_tr, str.constData(), 10, RoundDirection);
mpfr_init_set_str (m_t, str.constData(), 10, RoundDirection);
}
explicit number(int i)
......
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