]> www.ginac.de Git - cln.git/blobdiff - configure.in
- Fixed a logic error in the checks of gmp3.
[cln.git] / configure.in
index 5d4cd6ba69591eb70369e7572af30887acc47f6f..5576f36a4e86ad85a12f22e83cee1f97fc3ae9b2 100644 (file)
@@ -67,20 +67,20 @@ dnl
 PACKAGE=cln
 AM_DISABLE_SHARED
 AM_PROG_LIBTOOL
-dnl CLN library version information.
-dnl
+dnl Libtool's library version information for CLN.
+dnl (Not to be confused with CLN's release number.)
 dnl Making new releases:
-dnl   CLN_MICRO_VERSION += 1;
-dnl   CLN_INTERFACE_AGE += 1;
-dnl   CLN_BINARY_AGE += 1;
-dnl if any functions have been added, set CLN_INTERFACE_AGE to 0.
-dnl if backwards compatibility has been broken,
-dnl set CLN_BINARY_AGE and CLN_INTERFACE_AGE to 0.
-dnl CLN_MAJOR_VERSION=1
-dnl CLN_MINOR_VERSION=0
-dnl CLN_MICRO_VERSION=4
-dnl CLN_INTERFACE_AGE=1
-dnl CLN_BINARY_AGE=1
+dnl * increment CLN_REVISION,
+dnl * if any functions/classes have been added, removed or changed, increment
+dnl   CLN_CURRENT and set CLN_REVISION to 0,
+dnl * if any functions/classes have been added, increment CLN_AGE,
+dnl * if backwards compatibility has been broken, set CLN_AGE to 0.
+CLN_CURRENT=1
+CLN_REVISION=0
+CLN_AGE=1
+AC_SUBST(CLN_CURRENT)
+AC_SUBST(CLN_REVISION)
+AC_SUBST(CLN_AGE)
                       dnl sets variable LIBTOOL
 dnl
 dnl           checks for compiler characteristics
@@ -137,14 +137,30 @@ dnl           interfacing to GNU gmp (must be at least version 3)
 dnl
 AC_ARG_WITH(gmp, [  --with-gmp              use external fast GNU gmp low-level functions])
 if test "$with_gmp" = yes; then
-  AC_CHECK_HEADER(gmp.h, , with_gmp="no")
-dnl mpn_divexact_by3 was introduced in gmp3 and the symbol has a leading `__g':
-  AC_CHECK_LIB(gmp, __gmpn_divexact_by3, , with_gmp="no")
+dnl Is the gmp header file new enough? (i.e. >= 3.0)
+  AC_CACHE_CHECK([for recent enough gmp.h], cl_cv_new_gmp_h, [
+    AC_TRY_CPP([#include <gmp.h>
+#if !defined(__GNU_MP_VERSION) || (__GNU_MP_VERSION < 3)
+ #error "ancient gmp.h"
+#endif],
+cl_cv_new_gmp_h="yes", cl_cv_new_gmp_h="no")
+])
+if test "$cl_cv_new_gmp_h" = no; then with_gmp="no"; fi
+if test "$with_gmp" = yes; then
+dnl Does the library match the header file have 3.0 features?
+  AC_CACHE_CHECK([for working libgmp], cl_cv_new_libgmp, [
+    SAVELIBS=$LIBS
+    LIBS="$LIBS -lgmp"
+    AC_TRY_LINK([#include <gmp.h>],[mpn_divexact_by3(0,0,0)],
+cl_cv_new_libgmp="yes", cl_cv_new_libgmp="no"; LIBS=$SAVELIBS)
+])
+if test "$cl_cv_new_libgmp" = no; then with_gmp="no"; fi
+fi
 fi
 if test "$with_gmp" = yes; then
   AC_DEFINE(CL_USE_GMP)
 else
-  AC_MSG_WARN([disabling external gmp])
+  AC_MSG_WARN([disabling external GNU MP library])
 fi
 dnl
 dnl           That's it.