[BACK]Return to acinclude.m4 CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / mpfr

Annotation of OpenXM_contrib/gmp/mpfr/acinclude.m4, Revision 1.1.1.1

1.1       ohara       1:
                      2: AC_DEFUN(AC_MY_LIBS,
                      3: [
                      4: if ` test "$1" `
                      5: then
                      6:   AC_MSG_CHECKING(gmp library)
                      7:        if  test -r "$1/lib$2.a"
                      8:        then
                      9:          LDADD="$LDADD $1/lib$2.a"
                     10:        else
                     11:           AC_MSG_ERROR($2 not found)
                     12:        fi
                     13:   AC_MSG_RESULT(yes)
                     14: else
                     15:   AC_CHECK_LIB($2, main, , AC_MSG_ERROR($2 not found))
                     16: fi
                     17: ]
                     18: )
                     19:
                     20: AC_DEFUN(AC_MY_HEADERS,
                     21: [
                     22: if  test "$1"
                     23: then
                     24:   AC_CHECK_HEADER($1/$2, INCLUDES="$INCLUDES -I$1",AC_MSG_ERROR(echo $2 not found in $1))
                     25: else
                     26:   AC_CHECK_HEADER($2,,           AC_MSG_ERROR($2 not found))
                     27: fi
                     28: ])
                     29:
                     30: AC_DEFUN(AC_CHECK_OS,
                     31: [
                     32: AC_CACHE_CHECK([OS type], mpfr_cv_os_type, [
                     33:   mpfr_cv_os_type=`uname -s`
                     34: ])
                     35: OS_TYPE=$mpfr_cv_os_type
                     36: ])
                     37:
                     38: AC_DEFUN(AC_CHECK_MACHTYPE,
                     39: [
                     40: AC_CACHE_CHECK([Mach type], mpfr_cv_mach_type, [
                     41:   mpfr_cv_mach_type=`uname -m`
                     42: ])
                     43: MACHTYPE=$mpfr_cv_mach_type
                     44: ])
                     45:
                     46: dnl ------------------------------------------------------------
                     47:
                     48: AC_DEFUN(MPFR_CONFIGS,
                     49: [
                     50: case $host in
                     51:        *-*-solaris*)
                     52:                LM9X="-lm9x"
                     53:                ;;
                     54: esac
                     55:
                     56: AC_REPLACE_FUNCS(strcasecmp)
                     57:
                     58: dnl Check for IEEE-754 switches on Alpha
                     59: case $host in
                     60: alpha*-*-*)
                     61:   saved_CFLAGS="$CFLAGS"
                     62:   AC_CACHE_CHECK([for IEEE-754 switches], mpfr_cv_ieee_switches, [
                     63:   if test -n "$GCC"; then
                     64:     mpfr_cv_ieee_switches="-mfp-rounding-mode=d -mieee-with-inexact"
                     65:   else
                     66:     mpfr_cv_ieee_switches="-fprm d -ieee_with_inexact"
                     67:   fi
                     68:   CFLAGS="$CFLAGS $mpfr_cv_ieee_switches"
                     69:   AC_TRY_COMPILE(,,, mpfr_cv_ieee_switches="none")
                     70:   ])
                     71:   if test "$mpfr_cv_ieee_switches" = "none"; then
                     72:     CFLAGS="$saved_CFLAGS"
                     73:   else
                     74:     CFLAGS="$saved_CFLAGS $mpfr_cv_ieee_switches"
                     75:   fi
                     76: esac
                     77:
                     78: AC_CHECK_HEADERS(fpu_control.h)
                     79:
                     80: dnl Check for fesetround
                     81: AC_CACHE_CHECK([for fesetround], mpfr_cv_have_fesetround, [
                     82: saved_LIBS="$LIBS"
                     83: LIBS="$LIBS $LM9X"
                     84: AC_TRY_LINK([#include <fenv.h>], [fesetround(FE_TONEAREST);],
                     85:   mpfr_cv_have_fesetround=yes, mpfr_cv_have_fesetround=no)
                     86: LIBS="$saved_LIBS"
                     87: ])
                     88: if test "$mpfr_cv_have_fesetround" = "yes"; then
                     89:   LIBS="$LIBS $LM9X"
                     90:   AC_DEFINE(MPFR_HAVE_FESETROUND,1,[Define if you have the `fesetround' function via the <fenv.h> header file.])
                     91: fi
                     92:
                     93: dnl Check random functions
                     94: AC_CHECK_FUNCS(lrand48)
                     95:
                     96: dnl Check whether 0/0, 1/0, -1/0, sqrt(-1) are valid expressions
                     97: AC_CACHE_CHECK([for valid NaN], mpfr_cv_valid_nan, [
                     98: AC_TRY_RUN([
                     99: #include <math.h>
                    100: int main()
                    101: {
                    102:   double x = (0.0/0.0) + sqrt(-1.0);
                    103:   return x == 1.0/0.0;
                    104: }
                    105: ], mpfr_cv_valid_nan=yes, mpfr_cv_valid_nan=no, mpfr_cv_valid_nan=no)
                    106: ])
                    107: if test "$mpfr_cv_valid_nan" = "yes"; then
                    108:    AC_DEFINE(HAVE_INFS,1,[Define if 0/0, 1/0, -1/0 and sqrt(-1) work to generate NaN/infinities.])
                    109: fi
                    110:
                    111: dnl Check for gcc float-conversion bug; if need be, -ffloat-store is used to
                    112: dnl force the conversion to the destination type when a value is stored to
                    113: dnl a variable (see ISO C99 standard 5.1.2.3#13, 6.3.1.5#2, 6.3.1.8#2). This
                    114: dnl is important concerning the exponent range. Note that this doesn't solve
                    115: dnl the double-rounding problem (x86 processors still have to be set to the
                    116: dnl IEEE-754 compatible rounding mode).
                    117: if test -n "$GCC"; then
                    118:   AC_CACHE_CHECK([for gcc float-conversion bug], mpfr_cv_gcc_floatconv_bug, [
                    119:   AC_TRY_RUN([
                    120: #include <float.h>
                    121: #ifdef MPFR_HAVE_FESETROUND
                    122: #include <fenv.h>
                    123: #endif
                    124: int main()
                    125: {
                    126:   double x = 0.5;
                    127:   int i;
                    128:   for (i = 1; i <= 11; i++)
                    129:     x *= x;
                    130:   if (x != 0)
                    131:     return 1;
                    132: #ifdef MPFR_HAVE_FESETROUND
                    133:   /* Useful test for the G4 PowerPC */
                    134:   fesetround(FE_TOWARDZERO);
                    135:   x = DBL_MAX;
                    136:   x *= 2.0;
                    137:   if (x != DBL_MAX)
                    138:     return 1;
                    139: #endif
                    140:   return 0;
                    141: }
                    142:   ], [mpfr_cv_gcc_floatconv_bug="no"],
                    143:      [mpfr_cv_gcc_floatconv_bug="yes, use -ffloat-store"],
                    144:      [mpfr_cv_gcc_floatconv_bug="cannot test, use -ffloat-store"])
                    145:   ])
                    146:   if test "$mpfr_cv_gcc_floatconv_bug" != "no"; then
                    147:     CFLAGS="$CFLAGS -ffloat-store"
                    148:   fi
                    149: fi
                    150:
                    151: dnl Check if denormalized numbers are supported
                    152: AC_CACHE_CHECK([for denormalized numbers], mpfr_cv_have_denorms, [
                    153: AC_TRY_RUN([
                    154: #include <math.h>
                    155: #include <stdio.h>
                    156: int main()
                    157: {
                    158:   double x = 2.22507385850720138309e-308;
                    159:   fprintf (stderr, "%e\n", x / 2.0);
                    160:   return 2.0 * (x / 2.0) != x;
                    161: }
                    162: ], mpfr_cv_have_denorms=yes, mpfr_cv_have_denorms=no, mpfr_cv_have_denorms=no)
                    163: ])
                    164: if test "$mpfr_cv_have_denorms" = "yes"; then
                    165:   AC_DEFINE(HAVE_DENORMS,1,[Define if denormalized floats work.])
                    166: fi
                    167:
                    168: ])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>