Blame m4/mpfr.m4

Packit 575503
dnl Check for MPFR and dependencies
Packit 575503
dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc.
Packit 575503
dnl
Packit 575503
dnl This file is free software, distributed under the terms of the GNU
Packit 575503
dnl General Public License.  As a special exception to the GNU General
Packit 575503
dnl Public License, this file may be distributed as part of a program
Packit 575503
dnl that contains a configuration script generated by Autoconf, under
Packit 575503
dnl the same distribution terms as the rest of that program.
Packit 575503
dnl
Packit 575503
dnl Defines HAVE_MPFR to 1 if a working MPFR/GMP setup is
Packit 575503
dnl found, and sets @LIBMPFR@ to the necessary libraries.
Packit 575503
Packit 575503
AC_DEFUN([GNUPG_CHECK_MPFR],
Packit 575503
[
Packit 575503
  AC_ARG_WITH([mpfr],
Packit 575503
     AC_HELP_STRING([--with-mpfr=DIR],
Packit 575503
	[look for the mpfr and gmp libraries in DIR]),
Packit 575503
     [_do_mpfr=$withval],[_do_mpfr=yes])
Packit 575503
Packit 575503
  if test "$_do_mpfr" != "no" ; then
Packit 575503
     if test -d "$withval" ; then
Packit 575503
        CPPFLAGS="${CPPFLAGS} -I$withval/include"
Packit 575503
        LDFLAGS="${LDFLAGS} -L$withval/lib"
Packit 575503
     fi
Packit 575503
Packit 575503
        _mpfr_save_libs=$LIBS
Packit 575503
        _combo="-lmpfr -lgmp"
Packit 575503
        LIBS="$LIBS $_combo"
Packit 575503
Packit 575503
        AC_MSG_CHECKING([whether mpfr via \"$_combo\" is present and usable])
Packit 575503
Packit 575503
        AC_LINK_IFELSE([
Packit 575503
	AC_LANG_PROGRAM([
Packit 575503
#include <stdio.h>
Packit 575503
#include <mpfr.h>
Packit 575503
#include <gmp.h>
Packit 575503
],[
Packit 575503
mpfr_t p;
Packit 575503
mpz_t z;
Packit 575503
mpfr_init(p);
Packit 575503
mpz_init(z);
Packit 575503
mpfr_printf("%Rf%Zd", p, z);
Packit 575503
mpfr_clear(p);
Packit 575503
mpz_clear(z);
Packit 575503
])],_found_mpfr=yes,_found_mpfr=no)
Packit 575503
Packit 575503
        AC_MSG_RESULT([$_found_mpfr])
Packit 575503
Packit 575503
        LIBS=$_mpfr_save_libs
Packit 575503
Packit 575503
        if test $_found_mpfr = yes ; then
Packit 575503
           AC_DEFINE(HAVE_MPFR,1,
Packit 575503
	      [Define to 1 if you have fully functional mpfr and gmp libraries.])
Packit 575503
           AC_SUBST(LIBMPFR,$_combo)
Packit 575503
           break
Packit 575503
        fi
Packit 575503
Packit 575503
     unset _mpfr_save_libs
Packit 575503
     unset _combo
Packit 575503
     unset _found_mpfr
Packit 575503
  fi
Packit 575503
])dnl