Change 17715 by [EMAIL PROTECTED] on 2002/08/12 11:28:26
Subject: [PATCH] better modfl detection
From: Nicholas Clark <[EMAIL PROTECTED]>
Date: Sun, 11 Aug 2002 20:05:49 +0100
Message-id: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/Configure#475 edit
.... //depot/perl/config_h.SH#261 edit
.... //depot/perl/perl.h#466 edit
Differences ...
==== //depot/perl/Configure#475 (xtext) ====
Index: perl/Configure
--- perl/Configure#474~17698~ Thu Aug 8 07:52:45 2002
+++ perl/Configure Mon Aug 12 04:28:26 2002
@@ -6035,6 +6035,31 @@
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
@@ -6045,6 +6070,14 @@
$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;
@@ -9152,25 +9185,6 @@
EOSH
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
==== //depot/perl/config_h.SH#261 (text) ====
Index: perl/config_h.SH
--- perl/config_h.SH#260~17671~ Sat Aug 3 18:11:32 2002
+++ perl/config_h.SH Mon Aug 12 04:28:26 2002
@@ -2598,6 +2598,12 @@
* 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).
@@ -2606,6 +2612,7 @@
* 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:
==== //depot/perl/perl.h#466 (text) ====
Index: perl/perl.h
--- perl/perl.h#465~17695~ Thu Aug 8 07:40:41 2002
+++ perl/perl.h Mon Aug 12 04:28:26 2002
@@ -1241,6 +1241,11 @@
/* 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
End of Patch.