summaryrefslogtreecommitdiff
path: root/libgfortran/m4
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/m4')
-rw-r--r--libgfortran/m4/all.m44
-rw-r--r--libgfortran/m4/any.m44
-rw-r--r--libgfortran/m4/count.m44
-rw-r--r--libgfortran/m4/cshift1.m44
-rw-r--r--libgfortran/m4/dotprod.m44
-rw-r--r--libgfortran/m4/dotprodc.m44
-rw-r--r--libgfortran/m4/dotprodl.m44
-rw-r--r--libgfortran/m4/eoshift1.m44
-rw-r--r--libgfortran/m4/eoshift3.m44
-rw-r--r--libgfortran/m4/exponent.m46
-rw-r--r--libgfortran/m4/fraction.m46
-rw-r--r--libgfortran/m4/in_pack.m43
-rw-r--r--libgfortran/m4/in_unpack.m43
-rw-r--r--libgfortran/m4/matmul.m44
-rw-r--r--libgfortran/m4/matmull.m44
-rw-r--r--libgfortran/m4/maxloc0.m44
-rw-r--r--libgfortran/m4/maxloc1.m44
-rw-r--r--libgfortran/m4/maxval.m44
-rw-r--r--libgfortran/m4/minloc0.m44
-rw-r--r--libgfortran/m4/minloc1.m44
-rw-r--r--libgfortran/m4/minval.m44
-rw-r--r--libgfortran/m4/mtype.m43
-rw-r--r--libgfortran/m4/nearest.m46
-rw-r--r--libgfortran/m4/pow.m44
-rw-r--r--libgfortran/m4/product.m44
-rw-r--r--libgfortran/m4/reshape.m44
-rw-r--r--libgfortran/m4/set_exponent.m46
-rw-r--r--libgfortran/m4/shape.m44
-rw-r--r--libgfortran/m4/specific.m428
-rw-r--r--libgfortran/m4/specific2.m416
-rw-r--r--libgfortran/m4/sum.m45
-rw-r--r--libgfortran/m4/transpose.m44
32 files changed, 167 insertions, 3 deletions
diff --git a/libgfortran/m4/all.m4 b/libgfortran/m4/all.m4
index 5e20473676d..3af195552cb 100644
--- a/libgfortran/m4/all.m4
+++ b/libgfortran/m4/all.m4
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA. */
include(iparm.m4)dnl
include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
ARRAY_FUNCTION(1,
` /* Return true only if all the elements are set. */
result = 1;',
@@ -44,3 +47,4 @@ ARRAY_FUNCTION(1,
break;
}')
+#endif
diff --git a/libgfortran/m4/any.m4 b/libgfortran/m4/any.m4
index 8c78b3444ca..918c9f0eedb 100644
--- a/libgfortran/m4/any.m4
+++ b/libgfortran/m4/any.m4
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA. */
include(iparm.m4)dnl
include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
ARRAY_FUNCTION(0,
` result = 0;',
` /* Return true if any of the elements are set. */
@@ -44,3 +47,4 @@ ARRAY_FUNCTION(0,
break;
}')
+#endif
diff --git a/libgfortran/m4/count.m4 b/libgfortran/m4/count.m4
index 59580febb02..983dbb71bfa 100644
--- a/libgfortran/m4/count.m4
+++ b/libgfortran/m4/count.m4
@@ -35,8 +35,12 @@ Boston, MA 02110-1301, USA. */
include(iparm.m4)dnl
include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
ARRAY_FUNCTION(0,
` result = 0;',
` if (*src)
result++;')
+#endif
diff --git a/libgfortran/m4/cshift1.m4 b/libgfortran/m4/cshift1.m4
index 5c3d0b01324..28494d8f8b9 100644
--- a/libgfortran/m4/cshift1.m4
+++ b/libgfortran/m4/cshift1.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'atype_name`)'
+
static void
cshift1 (gfc_array_char * ret, const gfc_array_char * array,
const atype * h, const atype_name * pwhich, index_type size)
@@ -220,3 +222,5 @@ cshift1_`'atype_kind`'_char (gfc_array_char * ret,
{
cshift1 (ret, array, h, pwhich, array_length);
}
+
+#endif
diff --git a/libgfortran/m4/dotprod.m4 b/libgfortran/m4/dotprod.m4
index 1410a1a3f3a..af41fcc8e85 100644
--- a/libgfortran/m4/dotprod.m4
+++ b/libgfortran/m4/dotprod.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'rtype_name`)'
+
typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
extern rtype_name dot_product_`'rtype_code (rtype * a, rtype * b);
@@ -75,3 +77,5 @@ sinclude(`dotprod_asm_'rtype_code`.m4')dnl
return res;
}
+
+#endif
diff --git a/libgfortran/m4/dotprodc.m4 b/libgfortran/m4/dotprodc.m4
index 806dd798255..36740b077ce 100644
--- a/libgfortran/m4/dotprodc.m4
+++ b/libgfortran/m4/dotprodc.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'rtype_name`)'
+
typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
extern rtype_name dot_product_`'rtype_code (rtype * a, rtype * b);
@@ -78,3 +80,5 @@ sinclude(`dotprod_asm_'rtype_code`.m4')dnl
return res;
}
+
+#endif
diff --git a/libgfortran/m4/dotprodl.m4 b/libgfortran/m4/dotprodl.m4
index 56365f03c3d..946fe228519 100644
--- a/libgfortran/m4/dotprodl.m4
+++ b/libgfortran/m4/dotprodl.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'rtype_name`)'
+
extern rtype_name dot_product_`'rtype_code (gfc_array_l4 *, gfc_array_l4 *);
export_proto(dot_product_`'rtype_code);
@@ -84,3 +86,5 @@ dot_product_`'rtype_code (gfc_array_l4 * a, gfc_array_l4 * b)
return 0;
}
+
+#endif
diff --git a/libgfortran/m4/eoshift1.m4 b/libgfortran/m4/eoshift1.m4
index b5245ee42ea..cd7a1d852ff 100644
--- a/libgfortran/m4/eoshift1.m4
+++ b/libgfortran/m4/eoshift1.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'atype_name`)'
+
static void
eoshift1 (gfc_array_char *ret, const gfc_array_char *array, const atype *h,
const char *pbound, const atype_name *pwhich, index_type size,
@@ -246,3 +248,5 @@ eoshift1_`'atype_kind`'_char (gfc_array_char *ret,
{
eoshift1 (ret, array, h, pbound, pwhich, array_length, ' ');
}
+
+#endif
diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4
index aa4d8ddd333..318d67f2741 100644
--- a/libgfortran/m4/eoshift3.m4
+++ b/libgfortran/m4/eoshift3.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'atype_name`)'
+
static void
eoshift3 (gfc_array_char *ret, const gfc_array_char *array, const atype *h,
const gfc_array_char *bound, const atype_name *pwhich,
@@ -268,3 +270,5 @@ eoshift3_`'atype_kind`'_char (gfc_array_char *ret,
{
eoshift3 (ret, array, h, bound, pwhich, array_length, ' ');
}
+
+#endif
diff --git a/libgfortran/m4/exponent.m4 b/libgfortran/m4/exponent.m4
index 62217937899..ca0d13081dd 100644
--- a/libgfortran/m4/exponent.m4
+++ b/libgfortran/m4/exponent.m4
@@ -27,11 +27,15 @@ You should have received a copy of the GNU General Public
License along with libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+
+#include "config.h"
#include <math.h>
#include "libgfortran.h"'
include(`mtype.m4')dnl
+`#if defined (HAVE_'real_type`) && defined (HAVE_FREXP'Q`)'
+
extern GFC_INTEGER_4 exponent_r`'kind (real_type s);
export_proto(exponent_r`'kind);
@@ -42,3 +46,5 @@ exponent_r`'kind (real_type s)
frexp`'q (s, &ret);
return ret;
}
+
+#endif
diff --git a/libgfortran/m4/fraction.m4 b/libgfortran/m4/fraction.m4
index 9f33c59e304..07f8337c624 100644
--- a/libgfortran/m4/fraction.m4
+++ b/libgfortran/m4/fraction.m4
@@ -27,11 +27,15 @@ You should have received a copy of the GNU General Public
License along with libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+
+#include "config.h"
#include <math.h>
#include "libgfortran.h"'
include(`mtype.m4')dnl
+`#if defined (HAVE_'real_type`) && defined (HAVE_FREXP'Q`)'
+
extern real_type fraction_r`'kind (real_type s);
export_proto(fraction_r`'kind);
@@ -41,3 +45,5 @@ fraction_r`'kind (real_type s)
int dummy_exp;
return frexp`'q (s, &dummy_exp);
}
+
+#endif
diff --git a/libgfortran/m4/in_pack.m4 b/libgfortran/m4/in_pack.m4
index 1e6fdf57484..cb5be529e7c 100644
--- a/libgfortran/m4/in_pack.m4
+++ b/libgfortran/m4/in_pack.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'rtype_name`)'
+
/* Allocates a block of memory with internal_malloc if the array needs
repacking. */
@@ -124,3 +126,4 @@ rtype_name *
return destptr;
}
+#endif
diff --git a/libgfortran/m4/in_unpack.m4 b/libgfortran/m4/in_unpack.m4
index 1d2a609c007..131eb5d842a 100644
--- a/libgfortran/m4/in_unpack.m4
+++ b/libgfortran/m4/in_unpack.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'rtype_name`)'
+
dnl Only the kind (ie size) is used to name the function for integers,
dnl reals and logicals. For complex, it's c4 and c8.
void
@@ -112,3 +114,4 @@ void
}
}
+#endif
diff --git a/libgfortran/m4/matmul.m4 b/libgfortran/m4/matmul.m4
index 02297b935fa..aca2da06bab 100644
--- a/libgfortran/m4/matmul.m4
+++ b/libgfortran/m4/matmul.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'rtype_name`)'
+
/* This is a C version of the following fortran pseudo-code. The key
point is the loop order -- we access all arrays column-first, which
improves the performance enough to boost galgel spec score by 50%.
@@ -217,3 +219,5 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
}
}
+
+#endif
diff --git a/libgfortran/m4/matmull.m4 b/libgfortran/m4/matmull.m4
index c36949c2d81..9632a6ab76d 100644
--- a/libgfortran/m4/matmull.m4
+++ b/libgfortran/m4/matmull.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'rtype_name`)'
+
/* Dimensions: retarray(x,y) a(x, count) b(count,y).
Either a or b can be rank 1. In this case x or y is 1. */
@@ -192,3 +194,5 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
dest += rystride - (rxstride * xcount);
}
}
+
+#endif
diff --git a/libgfortran/m4/maxloc0.m4 b/libgfortran/m4/maxloc0.m4
index e0ea06132f2..8708a781609 100644
--- a/libgfortran/m4/maxloc0.m4
+++ b/libgfortran/m4/maxloc0.m4
@@ -38,6 +38,8 @@ Boston, MA 02110-1301, USA. */
include(iparm.m4)dnl
include(iforeach.m4)dnl
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
FOREACH_FUNCTION(
` atype_name maxval;
@@ -61,3 +63,5 @@ MASKED_FOREACH_FUNCTION(
for (n = 0; n < rank; n++)
dest[n * dstride] = count[n] + 1;
}')
+
+#endif
diff --git a/libgfortran/m4/maxloc1.m4 b/libgfortran/m4/maxloc1.m4
index 103e15ad9a4..d1ea9dcc9b5 100644
--- a/libgfortran/m4/maxloc1.m4
+++ b/libgfortran/m4/maxloc1.m4
@@ -37,6 +37,9 @@ Boston, MA 02110-1301, USA. */
include(iparm.m4)dnl
include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
ARRAY_FUNCTION(0,
` atype_name maxval;
maxval = atype_min;
@@ -57,3 +60,4 @@ MASKED_ARRAY_FUNCTION(0,
result = (rtype_name)n + 1;
}')
+#endif
diff --git a/libgfortran/m4/maxval.m4 b/libgfortran/m4/maxval.m4
index be0613c362c..9bdf0d07cdd 100644
--- a/libgfortran/m4/maxval.m4
+++ b/libgfortran/m4/maxval.m4
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA. */
include(iparm.m4)dnl
include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
ARRAY_FUNCTION(atype_min,
` result = atype_min;',
` if (*src > result)
@@ -46,3 +49,4 @@ MASKED_ARRAY_FUNCTION(atype_min,
` if (*msrc && *src > result)
result = *src;')
+#endif
diff --git a/libgfortran/m4/minloc0.m4 b/libgfortran/m4/minloc0.m4
index d2186679cf5..10fb3a9119d 100644
--- a/libgfortran/m4/minloc0.m4
+++ b/libgfortran/m4/minloc0.m4
@@ -38,6 +38,8 @@ Boston, MA 02110-1301, USA. */
include(iparm.m4)dnl
include(iforeach.m4)dnl
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
FOREACH_FUNCTION(
` atype_name minval;
@@ -61,3 +63,5 @@ MASKED_FOREACH_FUNCTION(
for (n = 0; n < rank; n++)
dest[n * dstride] = count[n] + 1;
}')
+
+#endif
diff --git a/libgfortran/m4/minloc1.m4 b/libgfortran/m4/minloc1.m4
index d2eaff9fc96..a224b732592 100644
--- a/libgfortran/m4/minloc1.m4
+++ b/libgfortran/m4/minloc1.m4
@@ -37,6 +37,9 @@ Boston, MA 02110-1301, USA. */
include(iparm.m4)dnl
include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
ARRAY_FUNCTION(0,
` atype_name minval;
minval = atype_max;
@@ -57,3 +60,4 @@ MASKED_ARRAY_FUNCTION(0,
result = (rtype_name)n + 1;
}')
+#endif
diff --git a/libgfortran/m4/minval.m4 b/libgfortran/m4/minval.m4
index 2fea1cdd74a..9bd37f4d1fb 100644
--- a/libgfortran/m4/minval.m4
+++ b/libgfortran/m4/minval.m4
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA. */
include(iparm.m4)dnl
include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
ARRAY_FUNCTION(atype_max,
` result = atype_max;',
` if (*src < result)
@@ -46,3 +49,4 @@ MASKED_ARRAY_FUNCTION(atype_max,
` if (*msrc && *src < result)
result = *src;')
+#endif
diff --git a/libgfortran/m4/mtype.m4 b/libgfortran/m4/mtype.m4
index 84bf39f3561..8e7e889bf0e 100644
--- a/libgfortran/m4/mtype.m4
+++ b/libgfortran/m4/mtype.m4
@@ -2,4 +2,5 @@ dnl Get type kind from filename.
define(kind,regexp(file, `_.\([0-9]+\).c$', `\1'))dnl
define(complex_type, `GFC_COMPLEX_'kind)dnl
define(real_type, `GFC_REAL_'kind)dnl
-define(q,ifelse(kind,4,f,ifelse(kind,8,`',`_'kind)))dnl
+define(q,ifelse(kind,4,f,ifelse(kind,8,`',ifelse(kind,10,l,ifelse(kind,16,l,`_'kind)))))dnl
+define(Q,translit(q,`a-z',`A-Z'))dnl
diff --git a/libgfortran/m4/nearest.m4 b/libgfortran/m4/nearest.m4
index ce83dc500ff..598ba4e3c94 100644
--- a/libgfortran/m4/nearest.m4
+++ b/libgfortran/m4/nearest.m4
@@ -27,12 +27,16 @@ You should have received a copy of the GNU General Public
License along with libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+
+#include "config.h"
#include <math.h>
#include <float.h>
#include "libgfortran.h"'
include(`mtype.m4')dnl
+`#if defined (HAVE_'real_type`) && defined (HAVE_COPYSIGN'Q`) && defined (HAVE_NEXTAFTER'Q`)'
+
extern real_type nearest_r`'kind (real_type s, real_type dir);
export_proto(nearest_r`'kind);
@@ -49,3 +53,5 @@ nearest_r`'kind (real_type s, real_type dir)
else
return nextafter`'q (s, dir);
}
+
+#endif
diff --git a/libgfortran/m4/pow.m4 b/libgfortran/m4/pow.m4
index c7ed7664c3e..ae490040c65 100644
--- a/libgfortran/m4/pow.m4
+++ b/libgfortran/m4/pow.m4
@@ -37,6 +37,8 @@ include(iparm.m4)dnl
Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
of Computer Programming", 3rd Edition, 1998. */
+`#if defined (HAVE_'rtype_name`) && defined (HAVE_'atype_name`)'
+
rtype_name `pow_'rtype_code`_'atype_code (rtype_name a, atype_name b);
export_proto(pow_`'rtype_code`_'atype_code);
@@ -78,3 +80,5 @@ ifelse(rtype_letter,i,`dnl
}
return pow;
}
+
+#endif
diff --git a/libgfortran/m4/product.m4 b/libgfortran/m4/product.m4
index 6e9581d6fba..df77372e8b0 100644
--- a/libgfortran/m4/product.m4
+++ b/libgfortran/m4/product.m4
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA. */
include(iparm.m4)dnl
include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
ARRAY_FUNCTION(1,
` result = 1;',
` result *= *src;')
@@ -44,3 +47,4 @@ MASKED_ARRAY_FUNCTION(1,
` if (*msrc)
result *= *src;')
+#endif
diff --git a/libgfortran/m4/reshape.m4 b/libgfortran/m4/reshape.m4
index adc6df0bbda..c43828ca50a 100644
--- a/libgfortran/m4/reshape.m4
+++ b/libgfortran/m4/reshape.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'rtype_name`)'
+
typedef GFC_ARRAY_DESCRIPTOR(1, index_type) shape_type;
/* The shape parameter is ignored. We can currently deduce the shape from the
@@ -258,3 +260,5 @@ reshape_`'rtype_ccode (rtype * ret, rtype * source, shape_type * shape,
}
}
}
+
+#endif
diff --git a/libgfortran/m4/set_exponent.m4 b/libgfortran/m4/set_exponent.m4
index 797906c97b5..91ba9523b98 100644
--- a/libgfortran/m4/set_exponent.m4
+++ b/libgfortran/m4/set_exponent.m4
@@ -27,11 +27,15 @@ You should have received a copy of the GNU General Public
License along with libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+
+#include "config.h"
#include <math.h>
#include "libgfortran.h"'
include(`mtype.m4')dnl
+`#if defined (HAVE_'real_type`) && defined (HAVE_SCALBN'Q`) && defined (HAVE_FREXP'Q`)'
+
extern real_type set_exponent_r`'kind (real_type s, GFC_INTEGER_4 i);
export_proto(set_exponent_r`'kind);
@@ -41,3 +45,5 @@ set_exponent_r`'kind (real_type s, GFC_INTEGER_4 i)
int dummy_exp;
return scalbn`'q (frexp`'q (s, &dummy_exp), i);
}
+
+#endif
diff --git a/libgfortran/m4/shape.m4 b/libgfortran/m4/shape.m4
index 5481ba07cb6..1b9e10077c0 100644
--- a/libgfortran/m4/shape.m4
+++ b/libgfortran/m4/shape.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'rtype_name`)'
+
extern void shape_`'rtype_kind (rtype * ret, const rtype * array);
export_proto(shape_`'rtype_kind);
@@ -53,3 +55,5 @@ shape_`'rtype_kind (rtype * ret, const rtype * array)
array->dim[n].ubound + 1 - array->dim[n].lbound;
}
}
+
+#endif
diff --git a/libgfortran/m4/specific.m4 b/libgfortran/m4/specific.m4
index a6cea730a79..e473effb566 100644
--- a/libgfortran/m4/specific.m4
+++ b/libgfortran/m4/specific.m4
@@ -1,5 +1,5 @@
include(head.m4)
-define(atype_code,regexp(file,`_\([ircl][0-9]+\).f90',`\1'))dnl
+define(atype_code,regexp(file,`_\([ircl][0-9]+\).[fF]90',`\1'))dnl
define(atype_letter,substr(atype_code, 0, 1))dnl
define(atype_kind,substr(atype_code, 1))dnl
define(get_typename2, `$1 (kind=$2)')dnl
@@ -8,9 +8,35 @@ define(atype_name, get_typename(atype_letter,atype_kind))dnl
define(name, regexp(regexp(file, `[^/]*$', `\&'), `^_\([^_]*\)_', `\1'))dnl
define(function_name,`specific__'name`_'atype_code)dnl
+define(type,ifelse(atype_letter,l,LOGICAL,ifelse(atype_letter,i,INTEGER,ifelse(atype_letter,r,REAL,ifelse(atype_letter,c,COMPLEX,UNKNOW)))))dnl
+define(Q,ifelse(atype_kind,4,F,ifelse(atype_kind,8,`',ifelse(atype_kind,10,L,ifelse(atype_kind,16,L,`_'atype_kind)))))dnl
+
+dnl A few specifics require a function other than their name, or
+dnl nothing. The list is currently:
+dnl - integer and logical specifics require no libm function
+dnl - AINT requires the trunc() family functions
+dnl - ANINT requires round()
+dnl - CONJG, DIM, SIGN require no libm function
+define(needed,ifelse(atype_letter,i,`none',ifelse(atype_letter,l,`none',ifelse(name,aint,trunc,ifelse(name,anint,round,ifelse(name,conjg,none,ifelse(name,dim,none,ifelse(name,sign,none,ifelse(name,abs,fabs,name)))))))))dnl
+define(prefix,ifelse(atype_letter,c,C,`'))dnl
+
+dnl Special case for fabs, for which the corresponding complex function
+dnl is not cfabs but cabs.
+define(NEEDED,translit(ifelse(prefix`'needed,`Cfabs',`abs',needed),`a-z',`A-Z'))dnl
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+`#if defined (HAVE_GFC_'type`_'atype_kind`)'
+ifelse(NEEDED,NONE,`',`#ifdef HAVE_'prefix`'NEEDED`'Q)
+
elemental function function_name (parm)
atype_name, intent (in) :: parm
atype_name :: function_name
function_name = name (parm)
end function
+
+ifelse(NEEDED,NONE,`',`#endif')
+#endif
diff --git a/libgfortran/m4/specific2.m4 b/libgfortran/m4/specific2.m4
index dab90b0aeb0..fa26f397698 100644
--- a/libgfortran/m4/specific2.m4
+++ b/libgfortran/m4/specific2.m4
@@ -1,5 +1,5 @@
include(head.m4)
-define(atype_code,regexp(file,`_\([ircl][0-9]+\).f90',`\1'))dnl
+define(atype_code,regexp(file,`_\([ircl][0-9]+\).[fF]90',`\1'))dnl
define(atype_letter,substr(atype_code, 0, 1))dnl
define(atype_kind,substr(atype_code, 1))dnl
define(get_typename2, `$1 (kind=$2)')dnl
@@ -8,9 +8,23 @@ define(atype_name, get_typename(atype_letter,atype_kind))dnl
define(name, regexp(regexp(file, `[^/]*$', `\&'), `^_\([^_]*\)_', `\1'))dnl
define(function_name,`specific__'name`_'atype_code)dnl
+define(Q,ifelse(atype_kind,4,F,ifelse(atype_kind,8,`',ifelse(atype_kind,10,L,ifelse(atype_kind,16,L,`_'atype_kind)))))dnl
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+`#if defined (HAVE_GFC_'ifelse(atype_letter,l,LOGICAL,ifelse(atype_letter,i,INTEGER,ifelse(atype_letter,r,REAL,ifelse(atype_letter,c,COMPLEX,UNKNOW))))`_'atype_kind`)'
+
+ifelse(name,atan2,`#ifdef HAVE_ATAN2'Q,)
+
elemental function function_name (p1, p2)
atype_name, intent (in) :: p1, p2
atype_name :: function_name
function_name = name (p1, p2)
end function
+
+ifelse(name,atan2,`#endif',)
+
+#endif
diff --git a/libgfortran/m4/sum.m4 b/libgfortran/m4/sum.m4
index 8dcc7aac242..1d91c0d5100 100644
--- a/libgfortran/m4/sum.m4
+++ b/libgfortran/m4/sum.m4
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA. */
include(iparm.m4)dnl
include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
ARRAY_FUNCTION(0,
` result = 0;',
` result += *src;')
@@ -43,3 +46,5 @@ MASKED_ARRAY_FUNCTION(0,
` result = 0;',
` if (*msrc)
result += *src;')
+
+#endif
diff --git a/libgfortran/m4/transpose.m4 b/libgfortran/m4/transpose.m4
index cfd817576aa..56669cecef1 100644
--- a/libgfortran/m4/transpose.m4
+++ b/libgfortran/m4/transpose.m4
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA. */
#include "libgfortran.h"'
include(iparm.m4)dnl
+`#if defined (HAVE_'rtype_name`)'
+
extern void transpose_`'rtype_code (rtype * ret, rtype * source);
export_proto(transpose_`'rtype_code);
@@ -97,3 +99,5 @@ transpose_`'rtype_code (rtype * ret, rtype * source)
rptr += rxstride - (rystride * xcount);
}
}
+
+#endif