Added checks for GMP

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8149 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 2000-11-18 08:54:32 +00:00
parent 49cf1be712
commit 4965c4a8f2
6 changed files with 440 additions and 239 deletions

View file

@ -5,6 +5,11 @@
* Source/GSHTTPURLHandle.m: Implemented ([-writeData:]). Rewrote * Source/GSHTTPURLHandle.m: Implemented ([-writeData:]). Rewrote
posting mechanism using new implementation. Modified so that old posting mechanism using new implementation. Modified so that old
method of writing bodyn properties still works for the moment. method of writing bodyn properties still works for the moment.
* configure.in: Added tests for GMP library - needed in future.
* Headers/Foundation/NSDecimal.h: include GSConfig.h for HAVE_GMP
* Source/NSDecimal.m: test for truth value of HAVE_GMP
* Headers/Foundation/GSConfig.h.in: add HAVE_GMP support, but
override to '0' until GMP support is fully implemented.
2000-11-17 Richard Frith-Macdonald <rfm@gnu.org> 2000-11-17 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -136,6 +136,12 @@ typedef @GS_ADDR@ gsaddr;
#define GS_HAVE_I64 @GS_HAVE_I64@ #define GS_HAVE_I64 @GS_HAVE_I64@
#define GS_HAVE_I128 @GS_HAVE_I128@ #define GS_HAVE_I128 @GS_HAVE_I128@
/*
* Do we have the GNU Multiple-precision library for NSDecimal?
*/
//#define HAVE_GMP @HAVE_GMP@
#define HAVE_GMP 0
/* /*
* Macros to deal with hiding an object from the garbage collector * Macros to deal with hiding an object from the garbage collector
* This macro employs the procesor-dependent knowledge that a pointer to an * This macro employs the procesor-dependent knowledge that a pointer to an

View file

@ -26,7 +26,9 @@
#ifndef STRICT_OPENSTEP #ifndef STRICT_OPENSTEP
#ifdef HAVE_GMP #include <Foundation/GSConfig.h>
#if HAVE_GMP
#include <gmp.h> #include <gmp.h>
#endif #endif
@ -60,7 +62,7 @@ typedef struct {
signed char exponent; /* Signed exponent - -128 to 127 */ signed char exponent; /* Signed exponent - -128 to 127 */
BOOL isNegative; /* Is this negative? */ BOOL isNegative; /* Is this negative? */
BOOL validNumber; /* Is this a valid number? */ BOOL validNumber; /* Is this a valid number? */
#ifdef HAVE_GMP #if HAVE_GMP
mp_size_t size; mp_size_t size;
mp_limb_t lMantissa[NSDecimalMaxSize]; mp_limb_t lMantissa[NSDecimalMaxSize];
#else #else

View file

@ -59,7 +59,7 @@
*/ */
#ifdef HAVE_GMP #if HAVE_GMP
// Define GSDecimal as using a character vector // Define GSDecimal as using a character vector
typedef struct { typedef struct {
@ -1021,7 +1021,7 @@ GSDecimalFromString(GSDecimal *result, NSString *numberValue,
GSDecimalCompact(result); GSDecimalCompact(result);
} }
#ifdef HAVE_GMP #if HAVE_GMP
static void CharvecToDecimal(const GSDecimal *m, NSDecimal *n) static void CharvecToDecimal(const GSDecimal *m, NSDecimal *n)
{ {

607
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -834,7 +834,7 @@ if test "$HAVE_LIBXML" = "0"; then
fi fi
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Check OpenSSL for HTTPS support in future. # Check OpenSSL for HTTPS support.
#-------------------------------------------------------------------- #--------------------------------------------------------------------
echo "Checking for OpenSSL" echo "Checking for OpenSSL"
AC_ARG_WITH(openssl-include, AC_ARG_WITH(openssl-include,
@ -883,6 +883,55 @@ if test "$HAVE_LIBCRYPTO" = "0"; then
fi fi
#--------------------------------------------------------------------
# Check GMP for NSDecimal
#--------------------------------------------------------------------
echo "Checking for GMP"
AC_ARG_WITH(gmp-include,
[ --with-gmp-include=PATH include path for gmp headers],
gmp_incdir="$withval", gmp_incdir="no")
AC_ARG_WITH(gmp-library,
[ --with-gmp-library=PATH library path for gmp libraries],
gmp_libdir="$withval", gmp_libdir="no")
cppflags_temp=$CFLAGS
libs_temp=$LIBS
if test "$gmp_incdir" != "no"; then
CPPFLAGS="$CPPFLAGS -I$gmp_incdir"
fi
if test "$gmp_libdir" != "no"; then
LIBS="$LIBS -L$gmp_libdir"
fi
HAVE_GMP=0
AC_CHECK_HEADERS(gmp.h)
if test $ac_cv_header_gmp_h = no; then
echo "Could not find gmp headers"
echo "Check to make sure you have gmp installed"
AC_MSG_WARN(Could not find gmp headers)
else
AC_CHECK_LIB(gmp, mpf_abs, gmp_ok=yes, gmp_ok=no)
if test "$gmp_ok" = yes; then
base_libs="$LIBS"
LIBS="$LIBS -lgmp"
AC_SUBST(LIBS)
HAVE_GMP=1
else
echo "Could not find gmp library"
echo "Check to make sure you have gmp installed"
AC_MSG_WARN(Could not find gmp library)
fi
fi
if test "$HAVE_GMP" = "0"; then
CPPFLAGS="$cppflags_temp";
LIBS="$libs_temp";
fi
AC_SUBST(HAVE_GMP)
AC_SUBST(whole_archive) AC_SUBST(whole_archive)
AC_SUBST(no_whole_archive) AC_SUBST(no_whole_archive)