set modfl d_modfl
eval $inlibc
+
+hasproto='varname=$1; func=$2; shift; shift;
+while $test $# -ge 2; do
+ case "$1" in
+ $define) echo "#include <$2>";;
+ esac ;
+ shift 2;
+done > try.c;
+$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
+if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
+ echo "$func() prototype found.";
+ val="$define";
+else
+ echo "$func() prototype NOT found.";
+ val="$undef";
+fi;
+set $varname;
+eval $setvar;
+$rm -f try.c tryout.c'
+
+: see if prototype for modfl is available
+echo " "
+set d_modflproto modfl math.h
+eval $hasproto
+
d_modfl_pow32_bug="$undef"
case "$d_longdbl$d_modfl" in
$cat >try.c <<EOCP
#include <math.h>
#include <stdio.h>
+EOCP
+if $test "X$d_modflproto" != "X$define"; then
+ $cat >>try.c <<EOCP
+/* Sigh. many current glibcs provide the function, but do not prototype it. */
+long double modfl (long double, long double *);
+EOCP
+fi
+$cat >>try.c <<EOCP
int main() {
long double nv = 4294967303.15;
long double v, w;
chmod +x protochk
$eunicefix protochk
-hasproto='varname=$1; func=$2; shift; shift;
-while $test $# -ge 2; do
- case "$1" in
- $define) echo "#include <$2>";;
- esac ;
- shift 2;
-done > try.c;
-$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
-if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
- echo "$func() prototype found.";
- val="$define";
-else
- echo "$func() prototype NOT found.";
- val="$undef";
-fi;
-set $varname;
-eval $setvar;
-$rm -f try.c tryout.c'
-
: see if sys/types.h has to be included
set sys/types.h i_systypes
eval $inhdr
* available to split a long double x into a fractional part f and
* an integer part i such that |f| < 1.0 and (f + i) = x.
*/
+/* HAS_MODFL_PROTO:
+ * This symbol, if defined, indicates that the system provides
+ * a prototype for the modfl() function. Otherwise, it is up
+ * to the program to supply one. C99 says it should be
+ * long double modfl(long double, long double *);
+ */
/* HAS_MODFL_POW32_BUG:
* This symbol, if defined, indicates that the modfl routine is
* broken for long doubles >= pow(2, 32).
* release 2.2.2 is known to be okay.
*/
#$d_modfl HAS_MODFL /**/
+#$d_modflproto HAS_MODFL_PROTO /**/
#$d_modfl_pow32_bug HAS_MODFL_POW32_BUG /**/
/* HAS_MPROTECT:
/* e.g. libsunmath doesn't have modfl and frexpl as of mid-March 2000 */
# ifdef HAS_MODFL
# define Perl_modf(x,y) modfl(x,y)
+/* eg glibc 2.2 series seems to provide modfl on ppc and arm, but has no
+ prototype in <math.h> */
+# ifndef HAS_MODFL_PROTO
+long double modfl(long double, long double *);
+# endif
# else
# define Perl_modf(x,y) ((long double)modf((double)(x),(double*)(y)))
# endif