diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-08-06 14:53:08 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-08-06 14:53:27 -0700 |
commit | fef32067411958cf5b7300de0de92ab179bee149 (patch) | |
tree | 11595f5cd3353bde730690566012eaa75ea6e959 | |
parent | d6f8ef89919919b7cde9ac7ca8621ba2e76a2b85 (diff) | |
download | gnulib-fef32067411958cf5b7300de0de92ab179bee149.tar.gz gnulib-fef32067411958cf5b7300de0de92ab179bee149.tar.bz2 |
libgmp: add <gmp/gmp.h> support
* m4/libgmp.m4 (gl_LIBGMP):
* modules/libgmp (configure.ac, Makefile.am):
Support platforms requiring ‘#include <gmp/gmp.h>’ instead of
‘#include <gmp.h>’.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | m4/libgmp.m4 | 40 | ||||
-rw-r--r-- | modules/libgmp | 11 |
3 files changed, 39 insertions, 20 deletions
@@ -1 +1,9 @@ +2020-08-06 Paul Eggert <eggert@cs.ucla.edu> + + libgmp: add <gmp/gmp.h> support + * m4/libgmp.m4 (gl_LIBGMP): + * modules/libgmp (configure.ac, Makefile.am): + Support platforms requiring ‘#include <gmp/gmp.h>’ instead of + ‘#include <gmp.h>’. + 2020-08-06 Bruno Haible <bruno@clisp.org> diff --git a/m4/libgmp.m4 b/m4/libgmp.m4 index 82c065e2c2..1025f06a77 100644 --- a/m4/libgmp.m4 +++ b/m4/libgmp.m4 @@ -1,2 +1,2 @@ -# libgmp.m4 serial 4 +# libgmp.m4 serial 5 # Configure the GMP library or a replacement. @@ -20,4 +20,2 @@ AC_DEFUN([gl_LIBGMP], this is the default on systems lacking libgmp.])]) - case "$with_libgmp" in - no) HAVE_LIBGMP=no @@ -25,8 +23,14 @@ AC_DEFUN([gl_LIBGMP], LTLIBGMP= - ;; - *) + AS_IF([test "$with_libgmp" != no], + [AC_CHECK_HEADERS([gmp.h gmp/gmp.h], [break]) dnl Prefer AC_LIB_HAVE_LINKFLAGS if the havelib module is also in use. - m4_ifdef([gl_HAVE_MODULE_HAVELIB], + AS_IF([test "$ac_cv_header_gmp_h" = yes || + test "$ac_cv_header_gmp_gmp_h" = yes], + [m4_ifdef([gl_HAVE_MODULE_HAVELIB], [AC_LIB_HAVE_LINKFLAGS([gmp], [], - [#include <gmp.h>], + [#if HAVE_GMP_H + # include <gmp.h> + #else + # include <gmp/gmp.h> + #endif], [static const mp_limb_t x[2] = { 0x73, 0x55 }; @@ -41,12 +45,11 @@ AC_DEFUN([gl_LIBGMP], 'none needed') - HAVE_LIBGMP=yes LIBGMP=;; + HAVE_LIBGMP=yes;; -*) - HAVE_LIBGMP=yes LIBGMP=$ac_cv_search___gmpz_roinit_n;; - *) - HAVE_LIBGMP=no LIBGMP=;; + HAVE_LIBGMP=yes + LIBGMP=$ac_cv_search___gmpz_roinit_n + LTLIBGMP=$LIBGMP;; esac - LTLIBGMP=$LIBGMP AC_SUBST([HAVE_LIBGMP]) AC_SUBST([LIBGMP]) - AC_SUBST([LTLIBGMP])]) + AC_SUBST([LTLIBGMP])])]) if test "$with_libgmp,$HAVE_LIBGMP" = yes,no; then @@ -56,6 +59,4 @@ AC_DEFUN([gl_LIBGMP], [ Try specifying --with-libgmp-prefix=DIR.])]) - fi - ;; - esac - if test $HAVE_LIBGMP = yes; then + fi]) + if test $HAVE_LIBGMP = yes && test "$ac_cv_header_gmp_h" = yes; then GMP_H= @@ -65,3 +66,6 @@ AC_DEFUN([gl_LIBGMP], AC_SUBST([GMP_H]) - AM_CONDITIONAL([GL_GENERATE_GMP_H], [test -n "$GMP_H"]) + AM_CONDITIONAL([GL_GENERATE_MINI_GMP_H], + [test $HAVE_LIBGMP != yes]) + AM_CONDITIONAL([GL_GENERATE_GMP_GMP_H], + [test $HAVE_LIBGMP = yes && test "$ac_cv_header_gmp_h" != yes]) ]) diff --git a/modules/libgmp b/modules/libgmp index a0c77056d3..bfc62f8d86 100644 --- a/modules/libgmp +++ b/modules/libgmp @@ -13,3 +13,3 @@ configure.ac: gl_LIBGMP -if test -n "$GMP_H"; then +if test $HAVE_LIBGMP != yes; then AC_LIBOBJ([mini-gmp-gnulib]) @@ -20,4 +20,4 @@ BUILT_SOURCES += $(GMP_H) +if GL_GENERATE_MINI_GMP_H # Build gmp.h as a wrapper for mini-gmp.h when using mini-gmp. -if GL_GENERATE_GMP_H gmp.h: $(top_builddir)/config.status @@ -26,2 +26,8 @@ gmp.h: $(top_builddir)/config.status else +if GL_GENERATE_GMP_GMP_H +# Build gmp.h as a wrapper for gmp/gmp.h. +gmp.h: $(top_builddir)/config.status + echo '#include <gmp/gmp.h>' >$@-t + mv $@-t $@ +else gmp.h: $(top_builddir)/config.status @@ -29,2 +35,3 @@ gmp.h: $(top_builddir)/config.status endif +endif MOSTLYCLEANFILES += gmp.h gmp.h-t |