diff options
author | john haque <j.eh@mchsi.com> | 2012-02-19 08:44:00 -0600 |
---|---|---|
committer | john haque <j.eh@mchsi.com> | 2012-02-19 08:44:00 -0600 |
commit | cb17a712ea65f6510e0000374cce4efbf4ffb902 (patch) | |
tree | 3b82a95607edb6adba2bbd49934851c6547d7703 /m4/mpfr.m4 | |
parent | 0221eb79f43f4ef5c8d74759679a501607936d19 (diff) | |
download | egawk-cb17a712ea65f6510e0000374cce4efbf4ffb902.tar.gz egawk-cb17a712ea65f6510e0000374cce4efbf4ffb902.tar.bz2 egawk-cb17a712ea65f6510e0000374cce4efbf4ffb902.zip |
Finish builtins for MPFR.
Diffstat (limited to 'm4/mpfr.m4')
-rw-r--r-- | m4/mpfr.m4 | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/m4/mpfr.m4 b/m4/mpfr.m4 new file mode 100644 index 00000000..11cfe106 --- /dev/null +++ b/m4/mpfr.m4 @@ -0,0 +1,62 @@ +dnl Check for MPFR and dependencies +dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc. +dnl +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl Defines HAVE_MPFR to 1 if a working MPFR/GMP setup is +dnl found, and sets @LIBMPFR@ to the necessary libraries. + +AC_DEFUN([GNUPG_CHECK_MPFR], +[ + AC_ARG_WITH([mpfr], + AC_HELP_STRING([--with-mpfr=DIR], + [look for the mpfr and gmp libraries in DIR]), + [_do_mpfr=$withval],[_do_mpfr=yes]) + + if test "$_do_mpfr" != "no" ; then + if test -d "$withval" ; then + CPPFLAGS="${CPPFLAGS} -I$withval/include" + LDFLAGS="${LDFLAGS} -L$withval/lib" + fi + + _mpfr_save_libs=$LIBS + _combo="-lmpfr -lgmp" + LIBS="$LIBS $_combo" + + AC_MSG_CHECKING([whether mpfr via \"$_combo\" is present and usable]) + + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +#include <stdio.h> +#include <mpfr.h> +#include <gmp.h> +],[ +mpfr_t p; +mpz_t z; +mpfr_init(p); +mpz_init(z); +mpfr_printf("%Rf%Zd", p, z); +mpfr_clear(p); +mpz_clear(z); +])],_found_mpfr=yes,_found_mpfr=no) + + AC_MSG_RESULT([$_found_mpfr]) + + LIBS=$_mpfr_save_libs + + if test $_found_mpfr = yes ; then + AC_DEFINE(HAVE_MPFR,1, + [Define to 1 if you have a fully functional mpfr and gmp library.]) + AC_SUBST(LIBMPFR,$_combo) + break + fi + + unset _mpfr_save_libs + unset _combo + unset _found_mpfr + fi +])dnl |