summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-03-22 13:58:55 +0000
committerPádraig Brady <P@draigBrady.com>2013-03-24 02:28:38 +0000
commitdc4fbb99a98140d2287720aa277e89f21c9eb92f (patch)
tree94b633a3a740c2eac74e4a2c474eb8c94430dd25
parenta24e4a01cac38be198177acf5e704c70988ab1fb (diff)
downloadcoreutils-dc4fbb99a98140d2287720aa277e89f21c9eb92f.tar.xz
build: fix issues when building with GMP
* m4/gmp.m4 (cu_GMP): Add an extra check that gmp.h is available which is required on one Mac OS X 10.5.8 system at least, where the lib was available but the header wasn't. Also enable our GMP code on systems where GMP is not in a separate lib.
-rw-r--r--m4/gmp.m434
1 files changed, 21 insertions, 13 deletions
diff --git a/m4/gmp.m4 b/m4/gmp.m4
index 259209037..847da34b8 100644
--- a/m4/gmp.m4
+++ b/m4/gmp.m4
@@ -23,18 +23,26 @@ AC_DEFUN([cu_GMP],
[cu_use_gmp=auto])
if test $cu_use_gmp != no; then
- cu_saved_libs=$LIBS
- AC_SEARCH_LIBS([__gmpz_init], [gmp],
- [test "$ac_cv_search___gmpz_init" = "none required" ||
- {
- LIB_GMP=$ac_cv_search___gmpz_init
- AC_DEFINE([HAVE_GMP], [1],
- [Define if you have GNU libgmp (or replacement)])
- # This only available in GMP >= 5
- AC_CHECK_DECLS([mpz_inits], [], [], [[#include <gmp.h>]])
- }],
- [AC_MSG_WARN([libgmp development library was not found or not usable.])
- AC_MSG_WARN([AC_PACKAGE_NAME will be built without GMP support.])])
- LIBS=$cu_saved_libs
+ dnl It was noticed on one MacOS X 10.5.8 system at least
+ dnl that the libs were available but the header wasn't
+ HAVE_GMP=0
+ AC_CHECK_HEADERS_ONCE([gmp.h])
+ if test $ac_cv_header_gmp_h = yes; then
+ cu_saved_libs=$LIBS
+ AC_SEARCH_LIBS([__gmpz_init], [gmp],
+ [test "$ac_cv_search___gmpz_init" = "none required" ||
+ LIB_GMP=$ac_cv_search___gmpz_init
+ AC_DEFINE([HAVE_GMP], [1],
+ [Define if you have GNU libgmp (or replacement)])
+ HAVE_GMP=1
+ # This only available in GMP >= 5
+ AC_CHECK_DECLS([mpz_inits], [], [], [[#include <gmp.h>]])
+ ])
+ LIBS=$cu_saved_libs
+ fi
+ if test $HAVE_GMP != 1; then
+ AC_MSG_WARN([libgmp development library was not found or not usable.])
+ AC_MSG_WARN([AC_PACKAGE_NAME will be built without GMP support.])
+ fi
fi
])