OSDN Git Service

2004-08-29 Steven G. Kargl <kargls@comcast.net>
authorpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 29 Aug 2004 15:58:16 +0000 (15:58 +0000)
committerpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 29 Aug 2004 15:58:16 +0000 (15:58 +0000)
Paul Brook  <paul@codesourcery.com>

* check.c (gfc_check_besn, gfc_check_g77_math1): New functions.
* f95-lang.c (DO_DEFINE_MATH_BUILTIN): Define.
(DEFINE_MATH_BUILTIN, DEFINE_MATH_BUILTIN_C): Use it.
(build_builtin_fntypes): New function.
(gfc_init_builtin_functions): Use it.
* gfortran.h (enum gfc_generic_isym_id): Add GFC_ISYM_{J,Y}{0,1,N}
and GFC_ISYM_ERF{,C}.
(gfc_c_int_kind): Declare.
* intrinsic.c (add_functions): Add [d]bes* and [d]erf*.
* intrinsic.h (gfc_check_besn, gfc_check_g77_math1, gfc_resolve_besn,
gfc_resolve_g77_math1): Add prototypes.
* resolve.c (gfc_resolve_besn, gfc_resolve_g77_math1): New functions.
* mathbuiltins.def: Add comment.  Change third argument.  Use
DEFINE_MATH_BUILTIN_C.  Add bessel and error functions.
* trans-intrinsic.c (BUILT_IN_FUNCTION): Define.
(DEFINE_MATH_BUILTIN, DEFINE_MATH_BUILTIN_C): Use it.
* trans-types.c (gfc_c_int_kind): Declare.
(gfc_init_kinds): Set it.
testsuite/
* gfortran.dg/g77/README: Update.
* gfortran.dg/g77/erfc.f: Copy from g77.f-torture.
* gfortran.dg/g77/intrinsic-unix-bessel.f: Ditto.
* gfortran.dg/g77/intrinsic-unix-erf.f: Ditto.
libgfortran/
* intrinsics/bessel.c: New file.
* intrinsics/erf.c: New file.
* Makefie.am: Add intrinsics/bessel.c and intrinsics/erf.c.
* configure.ac: Test for C99 Bessel and Error functions.
* Makefile.in: Regenerate.
* config.h.in: Regenerate.
* configure: Regenerate.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86727 138bc75d-0d04-0410-961f-82ee72b054a4

21 files changed:
gcc/fortran/ChangeLog
gcc/fortran/check.c
gcc/fortran/f95-lang.c
gcc/fortran/gfortran.h
gcc/fortran/intrinsic.c
gcc/fortran/intrinsic.h
gcc/fortran/iresolve.c
gcc/fortran/mathbuiltins.def
gcc/fortran/trans-intrinsic.c
gcc/fortran/trans-types.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/g77/README
gcc/testsuite/gfortran.dg/g77/erfc.f [new file with mode: 0644]
gcc/testsuite/gfortran.dg/g77/intrinsic-unix-bessel.f [new file with mode: 0644]
gcc/testsuite/gfortran.dg/g77/intrinsic-unix-erf.f [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/Makefile.am
libgfortran/Makefile.in
libgfortran/config.h.in
libgfortran/configure
libgfortran/configure.ac

index 85c4d23..fd405fe 100644 (file)
@@ -1,6 +1,28 @@
 2004-08-29  Steven G. Kargl  <kargls@comcast.net>
        Paul Brook  <paul@codesourcery.com>
 
+       * check.c (gfc_check_besn, gfc_check_g77_math1): New functions.
+       * f95-lang.c (DO_DEFINE_MATH_BUILTIN): Define.
+       (DEFINE_MATH_BUILTIN, DEFINE_MATH_BUILTIN_C): Use it.
+       (build_builtin_fntypes): New function.
+       (gfc_init_builtin_functions): Use it.
+       * gfortran.h (enum gfc_generic_isym_id): Add GFC_ISYM_{J,Y}{0,1,N}
+       and GFC_ISYM_ERF{,C}.
+       (gfc_c_int_kind): Declare.
+       * intrinsic.c (add_functions): Add [d]bes* and [d]erf*.
+       * intrinsic.h (gfc_check_besn, gfc_check_g77_math1, gfc_resolve_besn,
+       gfc_resolve_g77_math1): Add prototypes.
+       * resolve.c (gfc_resolve_besn, gfc_resolve_g77_math1): New functions.
+       * mathbuiltins.def: Add comment.  Change third argument.  Use
+       DEFINE_MATH_BUILTIN_C.  Add bessel and error functions.
+       * trans-intrinsic.c (BUILT_IN_FUNCTION): Define.
+       (DEFINE_MATH_BUILTIN, DEFINE_MATH_BUILTIN_C): Use it.
+       * trans-types.c (gfc_c_int_kind): Declare.
+       (gfc_init_kinds): Set it.
+
+2004-08-29  Steven G. Kargl  <kargls@comcast.net>
+       Paul Brook  <paul@codesourcery.com>
+
        * gfortran.h (enum gfc_generic_isym_id): Add GFC_ISYM_GET?ID.
        (gfc_check_f, gfc_simplify_f): Add f0.
        * intrinsic.c (do_check): Call f0.  Flatten.
index a010dce..6bc9e09 100644 (file)
@@ -525,6 +525,28 @@ gfc_check_atan2 (gfc_expr * y, gfc_expr * x)
 }
 
   
+/* BESJN and BESYN functions.  */
+
+try
+gfc_check_besn (gfc_expr * n, gfc_expr * x)
+{
+
+  if (scalar_check (n, 0) == FAILURE)
+    return FAILURE;
+
+  if (type_check (n, 0, BT_INTEGER) == FAILURE)
+    return FAILURE;
+
+  if (scalar_check (x, 1) == FAILURE)
+    return FAILURE;
+
+  if (type_check (x, 1, BT_REAL) == FAILURE)
+    return FAILURE;
+
+  return SUCCESS;
+}
+
+
 try
 gfc_check_btest (gfc_expr * i, gfc_expr * pos)
 {
@@ -728,6 +750,22 @@ gfc_check_eoshift (gfc_expr * array, gfc_expr * shift, gfc_expr * boundary,
 }
 
 
+/* This is used for the g77 one-argument Bessel functions, and the
+   error function.  */
+
+try
+gfc_check_g77_math1 (gfc_expr * x)
+{
+
+  if (scalar_check (x, 0) == FAILURE)
+    return FAILURE;
+
+  if (type_check (x, 0, BT_REAL) == FAILURE)
+    return FAILURE;
+
+  return SUCCESS;
+}
+
 
 try
 gfc_check_huge (gfc_expr * x)
index 673e208..b822a89 100644 (file)
@@ -712,38 +712,64 @@ gfc_define_builtin (const char * name,
 }
 
 
-#define DEFINE_MATH_BUILTIN(code, name, nargs) \
-    gfc_define_builtin ("__builtin_" name, mfunc_double[nargs-1], \
+#define DO_DEFINE_MATH_BUILTIN(code, name, argtype, tbase) \
+    gfc_define_builtin ("__builtin_" name, tbase##double[argtype], \
                        BUILT_IN_ ## code, name, true); \
-    gfc_define_builtin ("__builtin_" name "f", mfunc_float[nargs-1], \
+    gfc_define_builtin ("__builtin_" name "f", tbase##float[argtype], \
                        BUILT_IN_ ## code ## F, name "f", true);
 
+#define DEFINE_MATH_BUILTIN(code, name, argtype) \
+    DO_DEFINE_MATH_BUILTIN (code, name, argtype, mfunc_)
+
+/* The middle-end is missing builtins for some complex math functions, so
+   we don't use them yet.  */
+#define DEFINE_MATH_BUILTIN_C(code, name, argtype) \
+    DO_DEFINE_MATH_BUILTIN (code, name, argtype, mfunc_)
+/*    DO_DEFINE_MATH_BUILTIN (C##code, "c" name, argtype, mfunc_c)*/
+
+
+/* Create function types for builtin functions.  */
+
+static void
+build_builtin_fntypes (tree * fntype, tree type)
+{
+  tree tmp;
+
+  /* type (*) (type) */
+  tmp = tree_cons (NULL_TREE, float_type_node, void_list_node);
+  fntype[0] = build_function_type (type, tmp);
+  /* type (*) (type, type) */
+  tmp = tree_cons (NULL_TREE, float_type_node, tmp);
+  fntype[1] = build_function_type (type, tmp);
+  /* type (*) (int, type) */
+  tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node);
+  tmp = tree_cons (NULL_TREE, type, tmp);
+  fntype[2] = build_function_type (type, tmp);
+}
+
+
 /* Initialisation of builtin function nodes.  */
+
 static void
 gfc_init_builtin_functions (void)
 {
-  tree mfunc_float[2];
-  tree mfunc_double[2];
+  tree mfunc_float[3];
+  tree mfunc_double[3];
+  tree mfunc_cfloat[3];
+  tree mfunc_cdouble[3];
   tree func_cfloat_float;
   tree func_cdouble_double;
   tree ftype;
   tree tmp;
 
-  tmp = tree_cons (NULL_TREE, float_type_node, void_list_node);
-  mfunc_float[0] = build_function_type (float_type_node, tmp);
-  tmp = tree_cons (NULL_TREE, float_type_node, tmp);
-  mfunc_float[1] = build_function_type (float_type_node, tmp);
-  
+  build_builtin_fntypes (mfunc_float, float_type_node);
+  build_builtin_fntypes (mfunc_double, double_type_node);
+  build_builtin_fntypes (mfunc_cfloat, complex_float_type_node);
+  build_builtin_fntypes (mfunc_cdouble, complex_double_type_node);
+
   tmp = tree_cons (NULL_TREE, complex_float_type_node, void_list_node);
   func_cfloat_float = build_function_type (float_type_node, tmp);
-  
 
-  tmp = tree_cons (NULL_TREE, double_type_node, void_list_node);
-  mfunc_double[0] = build_function_type (double_type_node, tmp);
-  tmp = tree_cons (NULL_TREE, double_type_node, tmp);
-  mfunc_double[1] = build_function_type (double_type_node, tmp);
-  
-  
   tmp = tree_cons (NULL_TREE, complex_double_type_node, void_list_node);
   func_cdouble_double = build_function_type (double_type_node, tmp);
 
@@ -835,6 +861,7 @@ gfc_init_builtin_functions (void)
                      "alloca", false);
 }
 
+#undef DEFINE_MATH_BUILTIN_C
 #undef DEFINE_MATH_BUILTIN
 
 #include "gt-fortran-f95-lang.h"
index a633603..89c182d 100644 (file)
@@ -286,6 +286,12 @@ enum gfc_generic_isym_id
   GFC_ISYM_ASSOCIATED,
   GFC_ISYM_ATAN,
   GFC_ISYM_ATAN2,
+  GFC_ISYM_J0,
+  GFC_ISYM_J1,
+  GFC_ISYM_JN,
+  GFC_ISYM_Y0,
+  GFC_ISYM_Y1,
+  GFC_ISYM_YN,
   GFC_ISYM_BTEST,
   GFC_ISYM_CEILING,
   GFC_ISYM_CHAR,
@@ -301,6 +307,8 @@ enum gfc_generic_isym_id
   GFC_ISYM_DOT_PRODUCT,
   GFC_ISYM_DPROD,
   GFC_ISYM_EOSHIFT,
+  GFC_ISYM_ERF,
+  GFC_ISYM_ERFC,
   GFC_ISYM_ETIME,
   GFC_ISYM_EXP,
   GFC_ISYM_EXPONENT,
@@ -1518,6 +1526,7 @@ extern int gfc_default_double_kind;
 extern int gfc_default_character_kind;
 extern int gfc_default_logical_kind;
 extern int gfc_default_complex_kind;
+extern int gfc_c_int_kind;
 
 /* symbol.c */
 void gfc_clear_new_implicit (void);
index 4e68090..414cc1a 100644 (file)
@@ -969,6 +969,68 @@ add_functions (void)
 
   make_generic ("atan2", GFC_ISYM_ATAN2);
 
+  /* Bessel and Neumann functions for G77 compatibility.  */
+
+  add_sym_1 ("besj0", 1, 0, BT_REAL, dr,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dr, 0);
+
+  add_sym_1 ("dbesj0", 1, 0, BT_REAL, dd,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dd, 0);
+
+  make_generic ("besj0", GFC_ISYM_J0);
+
+  add_sym_1 ("besj1", 1, 0, BT_REAL, dr,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dr, 1);
+
+  add_sym_1 ("dbesj1", 1, 0, BT_REAL, dd,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dd, 1);
+
+  make_generic ("besj1", GFC_ISYM_J1);
+
+  add_sym_2 ("besjn", 1, 0, BT_REAL, dr,
+            gfc_check_besn, NULL, gfc_resolve_besn, n, BT_INTEGER, di, 1,
+         x, BT_REAL, dr, 1);
+
+  add_sym_2 ("dbesjn", 1, 0, BT_REAL, dd,
+            gfc_check_besn, NULL, gfc_resolve_besn, n, BT_INTEGER, di, 1,
+         x, BT_REAL, dd, 1);
+
+  make_generic ("besjn", GFC_ISYM_JN);
+
+  add_sym_1 ("besy0", 1, 0, BT_REAL, dr,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dr, 0);
+
+  add_sym_1 ("dbesy0", 1, 0, BT_REAL, dd,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dd, 0);
+
+  make_generic ("besy0", GFC_ISYM_Y0);
+
+  add_sym_1 ("besy1", 1, 0, BT_REAL, dr,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dr, 1);
+
+  add_sym_1 ("dbesy1", 1, 0, BT_REAL, dd,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dd, 1);
+
+  make_generic ("besy1", GFC_ISYM_Y1);
+
+  add_sym_2 ("besyn", 1, 0, BT_REAL, dr,
+            gfc_check_besn, NULL, gfc_resolve_besn, n, BT_INTEGER, di, 1,
+         x, BT_REAL, dr, 1);
+
+  add_sym_2 ("dbesyn", 1, 0, BT_REAL, dd,
+            gfc_check_besn, NULL, gfc_resolve_besn, n, BT_INTEGER, di, 1,
+         x, BT_REAL, dd, 1);
+
+  make_generic ("besyn", GFC_ISYM_YN);
+
   add_sym_1 ("bit_size", 0, 1, BT_INTEGER, di,
             gfc_check_i, gfc_simplify_bit_size, NULL,
             i, BT_INTEGER, di, 0);
@@ -1113,6 +1175,27 @@ add_functions (void)
 
   make_generic ("epsilon", GFC_ISYM_NONE);
 
+  /* G77 compatibility for the ERF() and ERFC() functions.  */
+  add_sym_1 ("erf", 1, 0, BT_REAL, dr,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dr, 0);
+
+  add_sym_1 ("derf", 1, 0, BT_REAL, dd,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dd, 0);
+
+  make_generic ("erf", GFC_ISYM_ERF);
+
+  add_sym_1 ("erfc", 1, 0, BT_REAL, dr,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dr, 0);
+
+  add_sym_1 ("derfc", 1, 0, BT_REAL, dd,
+            gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+            x, BT_REAL, dd, 0);
+
+  make_generic ("erfc", GFC_ISYM_ERFC);
+
   /* G77 compatibility */
   add_sym_1 ("etime", 0, 1, BT_REAL, 4,
             gfc_check_etime, NULL, NULL,
index cff8a53..b2ffb15 100644 (file)
@@ -35,6 +35,7 @@ try gfc_check_all_any (gfc_expr *, gfc_expr *);
 try gfc_check_allocated (gfc_expr *);
 try gfc_check_associated (gfc_expr *, gfc_expr *);
 try gfc_check_atan2 (gfc_expr *, gfc_expr *);
+try gfc_check_besn (gfc_expr *, gfc_expr *);
 try gfc_check_btest (gfc_expr *, gfc_expr *);
 try gfc_check_char (gfc_expr *, gfc_expr *);
 try gfc_check_cmplx (gfc_expr *, gfc_expr *, gfc_expr *);
@@ -47,6 +48,7 @@ try gfc_check_dot_product (gfc_expr *, gfc_expr *);
 try gfc_check_eoshift (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
 try gfc_check_etime (gfc_expr *);
 try gfc_check_etime_sub (gfc_expr *, gfc_expr *);
+try gfc_check_g77_math1 (gfc_expr *);
 try gfc_check_huge (gfc_expr *);
 try gfc_check_i (gfc_expr *);
 try gfc_check_iand (gfc_expr *, gfc_expr *);
@@ -231,6 +233,7 @@ void gfc_resolve_any (gfc_expr *, gfc_expr *, gfc_expr *);
 void gfc_resolve_asin (gfc_expr *, gfc_expr *);
 void gfc_resolve_atan (gfc_expr *, gfc_expr *);
 void gfc_resolve_atan2 (gfc_expr *, gfc_expr *, gfc_expr *);
+void gfc_resolve_besn (gfc_expr *, gfc_expr *, gfc_expr *);
 void gfc_resolve_btest (gfc_expr *, gfc_expr *, gfc_expr *);
 void gfc_resolve_ceiling (gfc_expr *, gfc_expr *, gfc_expr *);
 void gfc_resolve_char (gfc_expr *, gfc_expr *, gfc_expr *);
@@ -252,6 +255,7 @@ void gfc_resolve_exp (gfc_expr *, gfc_expr *);
 void gfc_resolve_exponent (gfc_expr *, gfc_expr *);
 void gfc_resolve_floor (gfc_expr *, gfc_expr *, gfc_expr *);
 void gfc_resolve_fraction (gfc_expr *, gfc_expr *);
+void gfc_resolve_g77_math1 (gfc_expr *, gfc_expr *);
 void gfc_resolve_getgid (gfc_expr *);
 void gfc_resolve_getpid (gfc_expr *);
 void gfc_resolve_getuid (gfc_expr *);
index eef424f..6df9583 100644 (file)
@@ -269,6 +269,24 @@ gfc_resolve_atan2 (gfc_expr * f, gfc_expr * x,
 }
 
 
+/* Resolve the BESYN and BESJN intrinsics.  */
+
+void
+gfc_resolve_besn (gfc_expr * f, gfc_expr * n, gfc_expr * x)
+{
+  gfc_typespec ts;
+  
+  f->ts = x->ts;
+  if (n->ts.kind != gfc_c_int_kind)
+    {
+      ts.type = BT_INTEGER;
+      ts.kind = gfc_c_int_kind;
+      gfc_convert_type (n, &ts, 2);
+    }
+  f->value.function.name = gfc_get_string ("<intrinsic>");
+}
+
+
 void
 gfc_resolve_btest (gfc_expr * f, gfc_expr * i, gfc_expr * pos)
 {
@@ -544,6 +562,16 @@ gfc_resolve_fraction (gfc_expr * f, gfc_expr * x)
 }
 
 
+/* Resolve single-argument g77 math intrinsics, eg BESY0, ERF.  */
+
+void
+gfc_resolve_g77_math1 (gfc_expr * f, gfc_expr * x)
+{
+  f->ts = x->ts;
+  f->value.function.name = gfc_get_string ("<intrinsic>");
+}
+
+
 void
 gfc_resolve_getgid (gfc_expr * f)
 {
index c46c1d5..0bbf8d9 100644 (file)
@@ -1,14 +1,29 @@
-DEFINE_MATH_BUILTIN (ACOS,  "acos", 1)
-DEFINE_MATH_BUILTIN (ASIN,  "asin", 1)
-DEFINE_MATH_BUILTIN (ATAN, "atan", 1)
-DEFINE_MATH_BUILTIN (ATAN2, "atan2", 2)
-DEFINE_MATH_BUILTIN (COS, "cos", 1)
-DEFINE_MATH_BUILTIN (COSH,  "cosh", 1)
-DEFINE_MATH_BUILTIN (EXP, "exp", 1)
-DEFINE_MATH_BUILTIN (LOG, "log", 1)
-DEFINE_MATH_BUILTIN (LOG10, "log10", 1)
-DEFINE_MATH_BUILTIN (SIN, "sin", 1)
-DEFINE_MATH_BUILTIN (SINH,  "sinh", 1)
-DEFINE_MATH_BUILTIN (SQRT, "sqrt", 1)
-DEFINE_MATH_BUILTIN (TAN, "tan", 1)
-DEFINE_MATH_BUILTIN (TANH,  "tanh", 1)
+/* DEFINE_MATH_BUILTIN (CODE, NAME, ARGTYPE)
+   NAME          The name of the builtin
+   SNAME  The name of the builtin as a string
+   ARGTYPE The type of the arguments.  See f95-lang.c
+
+   Use DEFINE_MATH_BUILTIN_C if the complex versions of the builtin are
+   also available.  */
+DEFINE_MATH_BUILTIN_C (ACOS,  "acos",   0)
+DEFINE_MATH_BUILTIN_C (ASIN,  "asin",   0)
+DEFINE_MATH_BUILTIN_C (ATAN,  "atan",   0)
+DEFINE_MATH_BUILTIN   (ATAN2, "atan2",  1)
+DEFINE_MATH_BUILTIN_C (COS,   "cos",    0)
+DEFINE_MATH_BUILTIN_C (COSH,  "cosh",   0)
+DEFINE_MATH_BUILTIN_C (EXP,   "exp",    0)
+DEFINE_MATH_BUILTIN_C (LOG,   "log",    0)
+DEFINE_MATH_BUILTIN_C (LOG10, "log10",  0)
+DEFINE_MATH_BUILTIN_C (SIN,   "sin",    0)
+DEFINE_MATH_BUILTIN_C (SINH,  "sinh",   0)
+DEFINE_MATH_BUILTIN_C (SQRT,  "sqrt",   0)
+DEFINE_MATH_BUILTIN_C (TAN,   "tan",    0)
+DEFINE_MATH_BUILTIN_C (TANH,  "tanh",   0)
+DEFINE_MATH_BUILTIN   (J0,    "j0",     0)
+DEFINE_MATH_BUILTIN   (J1,    "j1",     0)
+DEFINE_MATH_BUILTIN   (JN,    "jn",     2)
+DEFINE_MATH_BUILTIN   (Y0,    "y0",     0)
+DEFINE_MATH_BUILTIN   (Y1,    "y1",     0)
+DEFINE_MATH_BUILTIN   (YN,    "yn",     2)
+DEFINE_MATH_BUILTIN   (ERF,   "erf",    0)
+DEFINE_MATH_BUILTIN   (ERFC,  "erfc",   0)
index 43e1e94..ec56895 100644 (file)
@@ -85,9 +85,16 @@ gfc_intrinsic_map_t;
 /* ??? The NARGS==1 hack here is based on the fact that (c99 at least)
    defines complex variants of all of the entries in mathbuiltins.def
    except for atan2.  */
-#define DEFINE_MATH_BUILTIN(ID, NAME, NARGS) \
+#define BUILT_IN_FUNCTION(ID, NAME, HAVE_COMPLEX) \
   { GFC_ISYM_ ## ID, BUILT_IN_ ## ID ## F, BUILT_IN_ ## ID, true, \
-    NARGS == 1, true, NAME, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE},
+    HAVE_COMPLEX, true, NAME, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE},
+
+#define DEFINE_MATH_BUILTIN(id, name, argtype) \
+  BUILT_IN_FUNCTION (id, name, false)
+
+/* TODO: Use builtin function for complex intrinsics.  */
+#define DEFINE_MATH_BUILTIN_C(id, name, argtype) \
+  BUILT_IN_FUNCTION (id, name, true)
 
 #define LIBM_FUNCTION(ID, NAME, HAVE_COMPLEX) \
   { GFC_ISYM_ ## ID, END_BUILTINS, END_BUILTINS, true, HAVE_COMPLEX, true, \
@@ -117,6 +124,8 @@ static GTY(()) gfc_intrinsic_map_t gfc_intrinsic_map[] =
   LIBF_FUNCTION (NONE, NULL, false)
 };
 #undef DEFINE_MATH_BUILTIN
+#undef DEFINE_MATH_BUILTIN_C
+#undef BUILT_IN_FUNCTION
 #undef LIBM_FUNCTION
 #undef LIBF_FUNCTION
 
index e247fb3..d1ace6d 100644 (file)
@@ -84,6 +84,7 @@ int gfc_default_double_kind;
 int gfc_default_character_kind;
 int gfc_default_logical_kind;
 int gfc_default_complex_kind;
+int gfc_c_int_kind;
 
 /* Query the target to determine which machine modes are available for
    computation.  Choose KIND numbers for them.  */
@@ -232,6 +233,8 @@ gfc_init_kinds (void)
 
   /* Choose the integer kind the same size as "void*" for our index kind.  */
   gfc_index_integer_kind = POINTER_SIZE / 8;
+  /* Pick a kind the same size as the C "int" type.  */
+  gfc_c_int_kind = INT_TYPE_SIZE / 8;
 }
 
 /* Make sure that a valid kind is present.  Returns an index into the
index beb4aa1..84c03ab 100644 (file)
@@ -1,3 +1,11 @@
+2004-08-29  Steven G. Kargl  <kargls@comcast.net>
+       Paul Brook  <paul@codesourcery.com>
+
+       * gfortran.dg/g77/README: Update.
+       * gfortran.dg/g77/erfc.f: Copy from g77.f-torture.
+       * gfortran.dg/g77/intrinsic-unix-bessel.f: Ditto.
+       * gfortran.dg/g77/intrinsic-unix-erf.f: Ditto.
+
 2004-08-28  Paul Brook  <paul@codesourcery.com>
 
        PR libfortran/17195
index f5d6c35..2605369 100755 (executable)
@@ -167,15 +167,15 @@ cpp.F     (Renamed cpp3.F)        Y
 cpp2.F                         - Compiler warnings
 dcomplex.f                     Y
 dnrm2.f                                Y Add dg-warning as required
-erfc.f                           Link errors
+erfc.f                         Y
 exp.f                            Compiler warnings and fails
 f90-intrinsic-bit.f             F 16581 Compile errors
 f90-intrinsic-mathematical.f   Y 
 f90-intrinsic-numeric.f                Y
 int8421.f                      Y
 intrinsic-f2c-z.f              F Execution fail
-intrinsic-unix-bessel.f                  Link errors
-intrinsic-unix-erf.f             Link erros
+intrinsic-unix-bessel.f                Y
+intrinsic-unix-erf.f           Y
 intrinsic-vax-cd.f             F Execution fail
 intrinsic77.f                  F PR 16580 Compiler ICE
 io0.f & io0.x
diff --git a/gcc/testsuite/gfortran.dg/g77/erfc.f b/gcc/testsuite/gfortran.dg/g77/erfc.f
new file mode 100644 (file)
index 0000000..0ab0aee
--- /dev/null
@@ -0,0 +1,39 @@
+c { dg-do run }
+c============================================== test.f
+                real x, y
+               real*8 x1, y1
+               x=0.
+               y = erfc(x)
+               if (y .ne. 1.) call abort
+
+               x=1.1
+               y = erfc(x)
+               if (abs(y - .1197949) .ge. 1.e-6) call abort
+
+* modified from x=10, y .gt. 1.5e-44 to avoid lack of -mieee on Alphas.
+               x=8
+               y = erfc(x)
+               if (y .gt. 1.2e-28) call abort
+
+               x1=0.
+               y1 = erfc(x1)
+               if (y1 .ne. 1.) call abort
+
+               x1=1.1d0
+               y1 = erfc(x1)
+               if (abs(y1 - .1197949d0) .ge. 1.d-6) call abort
+
+               x1=10
+               y1 = erfc(x1)
+               if (y1 .gt. 1.5d-44) call abort
+               end
+c=================================================
+!output:
+!  0.  1.875
+!  1.10000002  1.48958981
+!  10.  5.00220949E-06
+!
+!The values should be:
+!erfc(0)=1
+!erfc(1.1)= 0.1197949
+!erfc(10)<1.543115467311259E-044
diff --git a/gcc/testsuite/gfortran.dg/g77/intrinsic-unix-bessel.f b/gcc/testsuite/gfortran.dg/g77/intrinsic-unix-bessel.f
new file mode 100644 (file)
index 0000000..0b5789d
--- /dev/null
@@ -0,0 +1,109 @@
+c { dg-do run }
+c  intrinsic-unix-bessel.f
+c
+c Test Bessel function intrinsics.  
+c These functions are only available if provided by system
+c
+c     David Billinghurst <David.Billinghurst@riotinto.com>
+c
+      real x, a
+      double precision dx, da
+      integer i
+      integer*2 j
+      integer*1 k
+      integer*8 m
+      logical fail
+      common /flags/ fail
+      fail = .false.
+
+      x = 2.0
+      dx = x 
+      i = 2
+      j = i
+      k = i
+      m = i
+c     BESJ0  - Bessel function of first kind of order zero
+      a = 0.22389077
+      da = a
+      call c_r(BESJ0(x),a,'BESJ0(real)')
+      call c_d(BESJ0(dx),da,'BESJ0(double)')
+      call c_d(DBESJ0(dx),da,'DBESJ0(double)')
+
+c     BESJ1  - Bessel function of first kind of order one
+      a = 0.57672480
+      da = a
+      call c_r(BESJ1(x),a,'BESJ1(real)')
+      call c_d(BESJ1(dx),da,'BESJ1(double)')
+      call c_d(DBESJ1(dx),da,'DBESJ1(double)')
+
+c     BESJN  - Bessel function of first kind of order N
+      a = 0.3528340
+      da = a
+      call c_r(BESJN(i,x),a,'BESJN(integer,real)')
+      call c_r(BESJN(j,x),a,'BESJN(integer*2,real)')
+      call c_r(BESJN(k,x),a,'BESJN(integer*1,real)')
+      call c_d(BESJN(i,dx),da,'BESJN(integer,double)')
+      call c_d(BESJN(j,dx),da,'BESJN(integer*2,double)')
+      call c_d(BESJN(k,dx),da,'BESJN(integer*1,double)')
+      call c_d(DBESJN(i,dx),da,'DBESJN(integer,double)')
+      call c_d(DBESJN(j,dx),da,'DBESJN(integer*2,double)')
+      call c_d(DBESJN(k,dx),da,'DBESJN(integer*1,double)')
+
+c     BESY0  - Bessel function of second kind of order zero
+      a = 0.51037567
+      da = a
+      call c_r(BESY0(x),a,'BESY0(real)')
+      call c_d(BESY0(dx),da,'BESY0(double)')
+      call c_d(DBESY0(dx),da,'DBESY0(double)')
+
+c     BESY1  - Bessel function of second kind of order one
+      a = 0.-0.1070324
+      da = a
+      call c_r(BESY1(x),a,'BESY1(real)')
+      call c_d(BESY1(dx),da,'BESY1(double)')
+      call c_d(DBESY1(dx),da,'DBESY1(double)')
+
+c     BESYN  - Bessel function of second kind of order N
+      a = -0.6174081
+      da = a
+      call c_r(BESYN(i,x),a,'BESYN(integer,real)')
+      call c_r(BESYN(j,x),a,'BESYN(integer*2,real)')
+      call c_r(BESYN(k,x),a,'BESYN(integer*1,real)')
+      call c_d(BESYN(i,dx),da,'BESYN(integer,double)')
+      call c_d(BESYN(j,dx),da,'BESYN(integer*2,double)')
+      call c_d(BESYN(k,dx),da,'BESYN(integer*1,double)')
+      call c_d(DBESYN(i,dx),da,'DBESYN(integer,double)')
+      call c_d(DBESYN(j,dx),da,'DBESYN(integer*2,double)')
+      call c_d(DBESYN(k,dx),da,'DBESYN(integer*1,double)')
+
+      if ( fail ) call abort()
+      end
+
+      subroutine failure(label)
+c     Report failure and set flag
+      character*(*) label
+      logical fail
+      common /flags/ fail
+      write(6,'(a,a,a)') 'Test ',label,' FAILED'
+      fail = .true.
+      end
+
+      subroutine c_r(a,b,label)
+c     Check if REAL a equals b, and fail otherwise
+      real a, b
+      character*(*) label
+      if ( abs(a-b) .gt. 1.0e-5 ) then
+         call failure(label)
+         write(6,*) 'Got ',a,' expected ', b
+      end if
+      end
+
+      subroutine c_d(a,b,label)
+c     Check if DOUBLE PRECISION a equals b, and fail otherwise
+      double precision a, b
+      character*(*) label
+      if ( abs(a-b) .gt. 1.0d-5 ) then
+         call failure(label)
+         write(6,*) 'Got ',a,' expected ', b
+      end if
+      end
diff --git a/gcc/testsuite/gfortran.dg/g77/intrinsic-unix-erf.f b/gcc/testsuite/gfortran.dg/g77/intrinsic-unix-erf.f
new file mode 100644 (file)
index 0000000..460ddee
--- /dev/null
@@ -0,0 +1,61 @@
+c { dg-do run }
+c  intrinsic-unix-erf.f
+c
+c Test Bessel function intrinsics.  
+c These functions are only available if provided by system
+c
+c     David Billinghurst <David.Billinghurst@riotinto.com>
+c
+      real x, a
+      double precision dx, da
+      logical fail
+      common /flags/ fail
+      fail = .false.
+
+      x = 0.6
+      dx = x 
+c     ERF  - error function
+      a = 0.6038561
+      da = a
+      call c_r(ERF(x),a,'ERF(real)')
+      call c_d(ERF(dx),da,'ERF(double)')
+      call c_d(DERF(dx),da,'DERF(double)')
+
+c     ERFC  - complementary error function
+      a = 1.0 - a
+      da = a
+      call c_r(ERFC(x),a,'ERFC(real)')
+      call c_d(ERFC(dx),da,'ERFC(double)')
+      call c_d(DERFC(dx),da,'DERFC(double)')
+
+      if ( fail ) call abort()
+      end
+
+      subroutine failure(label)
+c     Report failure and set flag
+      character*(*) label
+      logical fail
+      common /flags/ fail
+      write(6,'(a,a,a)') 'Test ',label,' FAILED'
+      fail = .true.
+      end
+
+      subroutine c_r(a,b,label)
+c     Check if REAL a equals b, and fail otherwise
+      real a, b
+      character*(*) label
+      if ( abs(a-b) .gt. 1.0e-5 ) then
+         call failure(label)
+         write(6,*) 'Got ',a,' expected ', b
+      end if
+      end
+
+      subroutine c_d(a,b,label)
+c     Check if DOUBLE PRECISION a equals b, and fail otherwise
+      double precision a, b
+      character*(*) label
+      if ( abs(a-b) .gt. 1.0d-5 ) then
+         call failure(label)
+         write(6,*) 'Got ',a,' expected ', b
+      end if
+      end
index c40d255..097e356 100644 (file)
@@ -1,6 +1,17 @@
 2004-08-29  Steven G. Kargl  <kargls@comcast.net>
        Paul Brook  <paul@codesourcery.com>
 
+       * intrinsics/bessel.c: New file.
+       * intrinsics/erf.c: New file.
+       * Makefie.am: Add intrinsics/bessel.c and intrinsics/erf.c.
+       * configure.ac: Test for C99 Bessel and Error functions.
+       * Makefile.in: Regenerate.
+       * config.h.in: Regenerate.
+       * configure: Regenerate.
+
+2004-08-29  Steven G. Kargl  <kargls@comcast.net>
+       Paul Brook  <paul@codesourcery.com>
+
        * Makefile.am: Add intrinsics/getXid.c.
        * configure.ac: Add tests for get{g,p,u}id.
        * config.h.in: Regenerate.
index 7027a5d..f07f1b5 100644 (file)
@@ -39,11 +39,13 @@ gfor_helper_src= \
 intrinsics/associated.c \
 intrinsics/abort.c \
 intrinsics/args.c \
+intrinsics/bessel.c \
 intrinsics/c99_functions.c \
 intrinsics/cpu_time.c \
 intrinsics/cshift0.c \
 intrinsics/date_and_time.c \
 intrinsics/env.c \
+intrinsics/erf.c \
 intrinsics/eoshift0.c \
 intrinsics/eoshift2.c \
 intrinsics/etime.c \
index 63e317c..e83388d 100644 (file)
@@ -118,14 +118,14 @@ am__objects_31 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \
 am__objects_32 = backspace.lo close.lo endfile.lo format.lo inquire.lo \
        list_read.lo lock.lo open.lo read.lo rewind.lo transfer.lo \
        unit.lo unix.lo write.lo
-am__objects_33 = associated.lo abort.lo args.lo c99_functions.lo \
-       cpu_time.lo cshift0.lo date_and_time.lo env.lo eoshift0.lo \
-       eoshift2.lo etime.lo getXid.lo ishftc.lo pack_generic.lo \
-       size.lo spread_generic.lo string_intrinsics.lo rand.lo \
-       random.lo reshape_generic.lo reshape_packed.lo \
-       selected_kind.lo system_clock.lo transpose_generic.lo \
-       unpack_generic.lo in_pack_generic.lo in_unpack_generic.lo \
-       normalize.lo
+am__objects_33 = associated.lo abort.lo args.lo bessel.lo \
+       c99_functions.lo cpu_time.lo cshift0.lo date_and_time.lo \
+       env.lo erf.lo eoshift0.lo eoshift2.lo etime.lo getXid.lo \
+       ishftc.lo pack_generic.lo size.lo spread_generic.lo \
+       string_intrinsics.lo rand.lo random.lo reshape_generic.lo \
+       reshape_packed.lo selected_kind.lo system_clock.lo \
+       transpose_generic.lo unpack_generic.lo in_pack_generic.lo \
+       in_unpack_generic.lo normalize.lo
 am__objects_34 =
 am__objects_35 = _abs_c4.lo _abs_c8.lo _abs_i4.lo _abs_i8.lo \
        _abs_r4.lo _abs_r8.lo _exp_r4.lo _exp_r8.lo _exp_c4.lo \
@@ -311,11 +311,13 @@ gfor_helper_src = \
 intrinsics/associated.c \
 intrinsics/abort.c \
 intrinsics/args.c \
+intrinsics/bessel.c \
 intrinsics/c99_functions.c \
 intrinsics/cpu_time.c \
 intrinsics/cshift0.c \
 intrinsics/date_and_time.c \
 intrinsics/env.c \
+intrinsics/erf.c \
 intrinsics/eoshift0.c \
 intrinsics/eoshift2.c \
 intrinsics/etime.c \
@@ -1992,6 +1994,15 @@ args.obj: intrinsics/args.c
 args.lo: intrinsics/args.c
        $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o args.lo `test -f 'intrinsics/args.c' || echo '$(srcdir)/'`intrinsics/args.c
 
+bessel.o: intrinsics/bessel.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bessel.o `test -f 'intrinsics/bessel.c' || echo '$(srcdir)/'`intrinsics/bessel.c
+
+bessel.obj: intrinsics/bessel.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bessel.obj `if test -f 'intrinsics/bessel.c'; then $(CYGPATH_W) 'intrinsics/bessel.c'; else $(CYGPATH_W) '$(srcdir)/intrinsics/bessel.c'; fi`
+
+bessel.lo: intrinsics/bessel.c
+       $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bessel.lo `test -f 'intrinsics/bessel.c' || echo '$(srcdir)/'`intrinsics/bessel.c
+
 c99_functions.o: intrinsics/c99_functions.c
        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o c99_functions.o `test -f 'intrinsics/c99_functions.c' || echo '$(srcdir)/'`intrinsics/c99_functions.c
 
@@ -2037,6 +2048,15 @@ env.obj: intrinsics/env.c
 env.lo: intrinsics/env.c
        $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o env.lo `test -f 'intrinsics/env.c' || echo '$(srcdir)/'`intrinsics/env.c
 
+erf.o: intrinsics/erf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o erf.o `test -f 'intrinsics/erf.c' || echo '$(srcdir)/'`intrinsics/erf.c
+
+erf.obj: intrinsics/erf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o erf.obj `if test -f 'intrinsics/erf.c'; then $(CYGPATH_W) 'intrinsics/erf.c'; else $(CYGPATH_W) '$(srcdir)/intrinsics/erf.c'; fi`
+
+erf.lo: intrinsics/erf.c
+       $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o erf.lo `test -f 'intrinsics/erf.c' || echo '$(srcdir)/'`intrinsics/erf.c
+
 eoshift0.o: intrinsics/eoshift0.c
        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o eoshift0.o `test -f 'intrinsics/eoshift0.c' || echo '$(srcdir)/'`intrinsics/eoshift0.c
 
index 5d15121..c3d0d0b 100644 (file)
 /* libm includes coshf */
 #undef HAVE_COSHF
 
+/* libm includes erf */
+#undef HAVE_ERF
+
+/* libm includes erfc */
+#undef HAVE_ERFC
+
+/* libm includes erfcf */
+#undef HAVE_ERFCF
+
+/* libm includes erff */
+#undef HAVE_ERFF
+
 /* libm includes expf */
 #undef HAVE_EXPF
 
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* libm includes j0 */
+#undef HAVE_J0
+
+/* libm includes j0f */
+#undef HAVE_J0F
+
+/* libm includes j1 */
+#undef HAVE_J1
+
+/* libm includes j1f */
+#undef HAVE_J1F
+
+/* libm includes jn */
+#undef HAVE_JN
+
+/* libm includes jnf */
+#undef HAVE_JNF
+
 /* libm includes log10f */
 #undef HAVE_LOG10F
 
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* libm includes y0 */
+#undef HAVE_Y0
+
+/* libm includes y0f */
+#undef HAVE_Y0F
+
+/* libm includes y1 */
+#undef HAVE_Y1
+
+/* libm includes y1f */
+#undef HAVE_Y1F
+
+/* libm includes yn */
+#undef HAVE_YN
+
+/* libm includes ynf */
+#undef HAVE_YNF
+
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
 
index b026a5b..b119308 100755 (executable)
@@ -6895,6 +6895,7 @@ fi
 
 
 # Check for C99 (and other IEEE) math functions
+# ??? This list seems awful long. Is there a better way to test for these?
 echo "$as_me:$LINENO: checking for acosf in -lm" >&5
 echo $ECHO_N "checking for acosf in -lm... $ECHO_C" >&6
 if test "${ac_cv_lib_m_acosf+set}" = set; then
@@ -8599,6 +8600,1142 @@ _ACEOF
 
 fi
 
+echo "$as_me:$LINENO: checking for erf in -lm" >&5
+echo $ECHO_N "checking for erf in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_erf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char erf ();
+int
+main ()
+{
+erf ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_erf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_erf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_erf" >&5
+echo "${ECHO_T}$ac_cv_lib_m_erf" >&6
+if test $ac_cv_lib_m_erf = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ERF 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for erfc in -lm" >&5
+echo $ECHO_N "checking for erfc in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_erfc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char erfc ();
+int
+main ()
+{
+erfc ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_erfc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_erfc=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_erfc" >&5
+echo "${ECHO_T}$ac_cv_lib_m_erfc" >&6
+if test $ac_cv_lib_m_erfc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ERFC 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for erfcf in -lm" >&5
+echo $ECHO_N "checking for erfcf in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_erfcf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char erfcf ();
+int
+main ()
+{
+erfcf ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_erfcf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_erfcf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_erfcf" >&5
+echo "${ECHO_T}$ac_cv_lib_m_erfcf" >&6
+if test $ac_cv_lib_m_erfcf = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ERFCF 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for erff in -lm" >&5
+echo $ECHO_N "checking for erff in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_erff+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char erff ();
+int
+main ()
+{
+erff ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_erff=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_erff=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_erff" >&5
+echo "${ECHO_T}$ac_cv_lib_m_erff" >&6
+if test $ac_cv_lib_m_erff = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ERFF 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for j0 in -lm" >&5
+echo $ECHO_N "checking for j0 in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_j0+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char j0 ();
+int
+main ()
+{
+j0 ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_j0=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_j0=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_j0" >&5
+echo "${ECHO_T}$ac_cv_lib_m_j0" >&6
+if test $ac_cv_lib_m_j0 = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_J0 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for j0f in -lm" >&5
+echo $ECHO_N "checking for j0f in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_j0f+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char j0f ();
+int
+main ()
+{
+j0f ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_j0f=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_j0f=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_j0f" >&5
+echo "${ECHO_T}$ac_cv_lib_m_j0f" >&6
+if test $ac_cv_lib_m_j0f = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_J0F 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for j1 in -lm" >&5
+echo $ECHO_N "checking for j1 in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_j1+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char j1 ();
+int
+main ()
+{
+j1 ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_j1=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_j1=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_j1" >&5
+echo "${ECHO_T}$ac_cv_lib_m_j1" >&6
+if test $ac_cv_lib_m_j1 = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_J1 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for j1f in -lm" >&5
+echo $ECHO_N "checking for j1f in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_j1f+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char j1f ();
+int
+main ()
+{
+j1f ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_j1f=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_j1f=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_j1f" >&5
+echo "${ECHO_T}$ac_cv_lib_m_j1f" >&6
+if test $ac_cv_lib_m_j1f = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_J1F 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for jn in -lm" >&5
+echo $ECHO_N "checking for jn in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_jn+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char jn ();
+int
+main ()
+{
+jn ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_jn=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_jn=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_jn" >&5
+echo "${ECHO_T}$ac_cv_lib_m_jn" >&6
+if test $ac_cv_lib_m_jn = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_JN 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for jnf in -lm" >&5
+echo $ECHO_N "checking for jnf in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_jnf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char jnf ();
+int
+main ()
+{
+jnf ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_jnf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_jnf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_jnf" >&5
+echo "${ECHO_T}$ac_cv_lib_m_jnf" >&6
+if test $ac_cv_lib_m_jnf = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_JNF 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for y0 in -lm" >&5
+echo $ECHO_N "checking for y0 in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_y0+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char y0 ();
+int
+main ()
+{
+y0 ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_y0=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_y0=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_y0" >&5
+echo "${ECHO_T}$ac_cv_lib_m_y0" >&6
+if test $ac_cv_lib_m_y0 = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_Y0 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for y0f in -lm" >&5
+echo $ECHO_N "checking for y0f in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_y0f+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char y0f ();
+int
+main ()
+{
+y0f ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_y0f=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_y0f=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_y0f" >&5
+echo "${ECHO_T}$ac_cv_lib_m_y0f" >&6
+if test $ac_cv_lib_m_y0f = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_Y0F 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for y1 in -lm" >&5
+echo $ECHO_N "checking for y1 in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_y1+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char y1 ();
+int
+main ()
+{
+y1 ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_y1=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_y1=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_y1" >&5
+echo "${ECHO_T}$ac_cv_lib_m_y1" >&6
+if test $ac_cv_lib_m_y1 = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_Y1 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for y1f in -lm" >&5
+echo $ECHO_N "checking for y1f in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_y1f+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char y1f ();
+int
+main ()
+{
+y1f ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_y1f=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_y1f=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_y1f" >&5
+echo "${ECHO_T}$ac_cv_lib_m_y1f" >&6
+if test $ac_cv_lib_m_y1f = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_Y1F 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for yn in -lm" >&5
+echo $ECHO_N "checking for yn in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_yn+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char yn ();
+int
+main ()
+{
+yn ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_yn=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_yn=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_yn" >&5
+echo "${ECHO_T}$ac_cv_lib_m_yn" >&6
+if test $ac_cv_lib_m_yn = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_YN 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for ynf in -lm" >&5
+echo $ECHO_N "checking for ynf in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_ynf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char ynf ();
+int
+main ()
+{
+ynf ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_ynf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_ynf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_ynf" >&5
+echo "${ECHO_T}$ac_cv_lib_m_ynf" >&6
+if test $ac_cv_lib_m_ynf = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_YNF 1
+_ACEOF
+
+fi
+
 
 # Let the user override this
 # Check whether --enable-cmath or --disable-cmath was given.
index 700070f..d1cf027 100644 (file)
@@ -166,6 +166,7 @@ AC_CHECK_LIB([c],[getpid],[AC_DEFINE([HAVE_GETPID],[1],[libc includes getpid])])
 AC_CHECK_LIB([c],[getuid],[AC_DEFINE([HAVE_GETUID],[1],[libc includes getuid])])
 
 # Check for C99 (and other IEEE) math functions
+# ??? This list seems awful long. Is there a better way to test for these?
 AC_CHECK_LIB([m],[acosf],[AC_DEFINE([HAVE_ACOSF],[1],[libm includes acosf])])
 AC_CHECK_LIB([m],[asinf],[AC_DEFINE([HAVE_ASINF],[1],[libm includes asinf])])
 AC_CHECK_LIB([m],[atan2f],[AC_DEFINE([HAVE_ATAN2F],[1],[libm includes atan2f])])
@@ -190,6 +191,22 @@ AC_CHECK_LIB([m],[sinhf],[AC_DEFINE([HAVE_SINHF],[1],[libm includes sinhf])])
 AC_CHECK_LIB([m],[sqrtf],[AC_DEFINE([HAVE_SQRTF],[1],[libm includes sqrtf])])
 AC_CHECK_LIB([m],[tanf],[AC_DEFINE([HAVE_TANF],[1],[libm includes tanf])])
 AC_CHECK_LIB([m],[tanhf],[AC_DEFINE([HAVE_TANHF],[1],[libm includes tanhf])])
+AC_CHECK_LIB([m],[erf],[AC_DEFINE([HAVE_ERF],[1],[libm includes erf])])
+AC_CHECK_LIB([m],[erfc],[AC_DEFINE([HAVE_ERFC],[1],[libm includes erfc])])
+AC_CHECK_LIB([m],[erfcf],[AC_DEFINE([HAVE_ERFCF],[1],[libm includes erfcf])])
+AC_CHECK_LIB([m],[erff],[AC_DEFINE([HAVE_ERFF],[1],[libm includes erff])])
+AC_CHECK_LIB([m],[j0],[AC_DEFINE([HAVE_J0],[1],[libm includes j0])])
+AC_CHECK_LIB([m],[j0f],[AC_DEFINE([HAVE_J0F],[1],[libm includes j0f])])
+AC_CHECK_LIB([m],[j1],[AC_DEFINE([HAVE_J1],[1],[libm includes j1])])
+AC_CHECK_LIB([m],[j1f],[AC_DEFINE([HAVE_J1F],[1],[libm includes j1f])])
+AC_CHECK_LIB([m],[jn],[AC_DEFINE([HAVE_JN],[1],[libm includes jn])])
+AC_CHECK_LIB([m],[jnf],[AC_DEFINE([HAVE_JNF],[1],[libm includes jnf])])
+AC_CHECK_LIB([m],[y0],[AC_DEFINE([HAVE_Y0],[1],[libm includes y0])])
+AC_CHECK_LIB([m],[y0f],[AC_DEFINE([HAVE_Y0F],[1],[libm includes y0f])])
+AC_CHECK_LIB([m],[y1],[AC_DEFINE([HAVE_Y1],[1],[libm includes y1])])
+AC_CHECK_LIB([m],[y1f],[AC_DEFINE([HAVE_Y1F],[1],[libm includes y1f])])
+AC_CHECK_LIB([m],[yn],[AC_DEFINE([HAVE_YN],[1],[libm includes yn])])
+AC_CHECK_LIB([m],[ynf],[AC_DEFINE([HAVE_YNF],[1],[libm includes ynf])])
 
 # Let the user override this
 AC_ARG_ENABLE(cmath,