m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03-fyi-gmp.patch


From: Akim Demaille
Subject: 03-fyi-gmp.patch
Date: Mon, 01 Oct 2001 09:38:50 +0200

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * config/gmp.m4: Consult the user before using GMP: use
        --without-gmp.
        * configure.in: Adjust.
        * modules/gmp.c: No protection needed as the module is not built
        if GMP is not used.
        
        
Index: config-h.in
--- config-h.in Sat, 22 Sep 2001 12:59:08 +0200 akim
+++ config-h.in Sat, 29 Sep 2001 19:00:31 +0200 akim
@@ -376,7 +376,7 @@
 /* Define if your <sys/time.h> declares `struct tm'. */
 #undef TM_IN_SYS_TIME
 
-/* Define to 1 if using gmp library. */
+/* Define to 1 if using the GNU multiple precision library. */
 #undef USE_GMP
 
 /* Define to 1 if using stack overflow detection. */
Index: configure.in
--- configure.in Tue, 18 Sep 2001 22:54:14 +0200 akim
+++ configure.in Sat, 29 Sep 2001 18:59:27 +0200 akim
@@ -125,7 +125,7 @@
 AC_CHECK_FUNCS(setenv unsetenv putenv clearenv)
 
 AC_LIB_GMP
-AM_CONDITIONAL([USE_GMP], [test "x$LIB_GMP" != xno])
+AM_CONDITIONAL([USE_GMP], [test "x$USE_GMP" = xyes])
 
 AM_WITH_DMALLOC
 if test "$USE_INCLUDED_LIBINTL" = yes; then
Index: config/gmp.m4
--- config/gmp.m4 Sat, 22 Sep 2001 12:59:08 +0200 akim
+++ config/gmp.m4 Sat, 29 Sep 2001 18:57:58 +0200 akim
@@ -16,50 +16,54 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 # 02111-1307  USA
 
-# serial 5
+# serial 6
 
 m4_define([_AC_LIB_GMP],
-[case $LIBADD_GMP:$ac_cv_header_gmp_h in
-  :yes)
+[AC_ARG_WITH(gmp,
+[  --without-gmp           don't use GNU multiple precision arithmetic 
library],
+[use_gmp=$withval], [use_gmp=yes])
+
+case $use_gmp:$GMP_LIB:$ac_cv_header_gmp_h in
+  *::yes)
     AC_MSG_WARN([gmp library not found or does not appear to work
                  but `gmp.h' is present])
     ac_cv_using_lib_gmp=no
     ;;
-  -lgmp:no)
+  *:-lgmp:no)
     AC_MSG_WARN([gmp works but `gmp.h' is missing])
     ac_cv_using_lib_gmp=no
     ;;
-  *:yes)
+  yes:*:yes)
     ac_cv_using_lib_gmp=yes
     ;;
-  *)
+  no:*)
     ac_cv_using_lib_gmp=no
     ;;
 esac
 ])# _AC_LIB_GMP
 
+
 AC_DEFUN([AC_LIB_GMP],
 [AC_CHECK_HEADERS([gmp.h])
 # Some versions of gmp provide mpq_init as a macro, so we need to
 # include the header file, otherwise the detection will fail.
-gmp_save_LIBS="$LIBS"
+ac_gmp_save_LIBS="$LIBS"
 LIBS="$LIBS -lgmp"
 AC_TRY_LINK([#if HAVE_GMP_H
 #  include <gmp.h>
 #endif],
   [mpq_t n; mpq_init (n);],
   [LIBADD_GMP=-lgmp])
-LIBS="$gmp_save_LIBS"
+LIBS=$ac_gmp_save_LIBS
 
 AC_CACHE_CHECK([if using GNU multiple precision arithmetic library],
-                [ac_cv_using_lib_gmp],
-                [_AC_LIB_GMP])
+               [ac_cv_using_lib_gmp],
+               [_AC_LIB_GMP])
 
 # Don't try to link in libgmp if we are not using it after the last call
-if test "x$ac_cv_using_lib_gmp" = xyes; then
-  AC_DEFINE(USE_GMP, 1, [Define to 1 if using gmp library.])
-else
-  LIBADD_GMP=
+if test "$ac_cv_using_lib_gmp" = yes; then
+  AC_DEFINE(USE_GMP, 1,
+    [Define to 1 if using the GNU multiple precision library.])
 fi
 
 AC_SUBST([USE_GMP], [$ac_cv_using_lib_gmp])
Index: modules/mpeval.c
--- modules/mpeval.c Sat, 22 Sep 2001 12:59:08 +0200 akim
+++ modules/mpeval.c Sat, 29 Sep 2001 18:49:00 +0200 akim
@@ -1,5 +1,5 @@
 /* GNU m4 -- A simple macro processor
-   Copyright 2000 Free Software Foundation, Inc.
+   Copyright 2000, 2001 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -23,18 +23,6 @@
 
 #include <m4module.h>
 
-#if !USE_GMP
-
-M4INIT_HANDLER (mpeval)
-{
-  const char s[] = "libgmp support was not compiled in";
-
-  if (obs)
-    obstack_grow (obs, s, strlen(s));
-}
-
-#else /* USE_GMP */
-
 #if HAVE_GMP_H
 #  include <gmp.h>
 #endif
@@ -438,5 +426,3 @@
 
 #define m4_evaluate    builtin_mpeval
 #include "evalparse.c"
-
-#endif /* USE_GMP */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]