Skip to content

Commit

Permalink
Add option for gmp
Browse files Browse the repository at this point in the history
  • Loading branch information
mathk committed Apr 6, 2011
1 parent d8cd678 commit cba77c4
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -9,7 +9,6 @@ configure
*.star
*.tmp
*.frag
m4
libtool
ltmain.sh
missing
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Expand Up @@ -17,6 +17,8 @@ dnl ------------------------------- PROGRAMS ------------------
AC_PROG_LIBTOOL
PKG_PROG_PKG_CONFIG

GST_HAVE_GMP

PKG_CHECK_MODULES([LIBFFI], [libffi], [HAVE_LIBFFI=yes])
if test "no$HAVE_LIBFFI" == no
then
Expand Down
48 changes: 48 additions & 0 deletions m4/gmp.m4
@@ -0,0 +1,48 @@
dnl I'd like this to be edited in -*- Autoconf -*- mode...
dnl
AC_DEFUN([GST_HAVE_GMP], [
AC_ARG_WITH(gmp,
[ --with-gmp=path set path to the GMP library
--without-gmp don't try to detect and use GMP])
if test "$with_gmp" != no; then
AC_CACHE_CHECK(how to link with GMP, gst_cv_gmp_libs, [
if test "$with_gmp" && test -d "$with_gmp"; then
gst_cv_gmp_libs="-L$with_gmp -lgmp"
CPPFLAGS="$CPPFLAGS -I$with_gmp/../include"
else
gst_cv_gmp_libs="-lgmp"
fi
ac_save_LIBS="$LIBS"
LIBS="$ac_save_LIBS $gst_cv_gmp_libs"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <gmp.h>
]], [[
#if __GNU_MP_VERSION < 4
you lose
#endif
mpz_t z;
mp_limb_t n[10];
mpn_tdiv_qr (n, n, 10, n, 10, n, 10);
mpz_init_set_str (z, "123456", 0);
]])],[],[gst_cv_gmp_libs="not found"])
LIBS="$ac_save_LIBS"
])
if test "$gst_cv_gmp_libs" != "not found"; then
LIBGMP="$gst_cv_gmp_libs"
AC_SUBST(LIBGMP)
AC_DEFINE(HAVE_GMP, 1,
[Define if your system has the GNU MP library.])
AC_CHECK_SIZEOF(mp_limb_t, , [
#include <gmp.h>
#include <stdio.h> ])
fi
fi
])dnl

0 comments on commit cba77c4

Please sign in to comment.