d__fwalk=''
d_access=''
d_accessx=''
+d_aintl=''
d_alarm=''
asctime_r_proto=''
d_asctime_r=''
d_void_closedir=''
d_cmsghdr_s=''
d_const=''
+d_copysign=''
cryptlib=''
d_crypt=''
crypt_r_proto=''
gnulibc_version=''
d_hasmntopt=''
d_htonl=''
+d_ilogbl=''
d_inetaton=''
d_int64_t=''
d_isascii=''
d_safemcpy=''
d_sanemcmp=''
d_sbrkproto=''
+d_scalbnl=''
d_select=''
d_sem=''
d_semctl=''
'') firstmakefile='makefile';;
esac
+case "$ccflags" in
+*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
+esac
+
+case "$uselongdouble" in
+$define|true|[yY]*) dflt='y';;
+*) dflt='n';;
+esac
+cat <<EOM
+
+Perl can be built to take advantage of long doubles which
+(if available) may give more accuracy and range for floating point numbers.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Try to use long doubles if available?'
+. ./myread
+case "$ans" in
+y|Y) val="$define" ;;
+*) val="$undef" ;;
+esac
+set uselongdouble
+eval $setvar
+
+case "$uselongdouble" in
+true|[yY]*) uselongdouble="$define" ;;
+esac
+
+case "$uselongdouble" in
+$define)
+: Look for a hint-file generated 'call-back-unit'. If the
+: user has specified that long doubles should be used,
+: we may need to set or change some other defaults.
+ if $test -f uselongdouble.cbu; then
+ echo "Your platform has some specific hints for long doubles, using them..."
+ . ./uselongdouble.cbu
+ else
+ $cat <<EOM
+(Your platform doesn't have any specific hints for long doubles.)
+EOM
+ fi
+ ;;
+esac
+
: Looking for optional libraries
echo " "
echo "Checking for optional libraries..." >&4
echo "Checking your choice of C compiler and flags for coherency..." >&4
$cat > try.c <<'EOF'
#include <stdio.h>
-int main() { printf("Ok\n"); exit(0); }
+int main() { printf("Ok\n"); return(0); }
EOF
set X $cc -o try $optimize $ccflags $ldflags try.c $libs
shift
set modfl d_modfl
eval $inlibc
+: see if aintl exists - used along with copysignl if modfl is missing
+set aintl d_aintl
+eval $inlibc
+
+: see if copysignl exists - used along with aintl if modfl is missing
+set copysign d_copysignl
+eval $inlibc
+
: see if prototype for modfl is available
echo " "
set d_modflproto modfl math.h
;;
esac
-case "$ccflags" in
-*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
-esac
-
-case "$uselongdouble" in
-$define|true|[yY]*) dflt='y';;
-*) dflt='n';;
-esac
-cat <<EOM
-
-Perl can be built to take advantage of long doubles which
-(if available) may give more accuracy and range for floating point numbers.
-
-If this doesn't make any sense to you, just accept the default '$dflt'.
-EOM
-rp='Try to use long doubles if available?'
-. ./myread
-case "$ans" in
-y|Y) val="$define" ;;
-*) val="$undef" ;;
-esac
-set uselongdouble
-eval $setvar
-
-case "$uselongdouble" in
-true|[yY]*) uselongdouble="$define" ;;
-esac
-
-case "$uselongdouble" in
-$define)
-: Look for a hint-file generated 'call-back-unit'. If the
-: user has specified that long doubles should be used,
-: we may need to set or change some other defaults.
- if $test -f uselongdouble.cbu; then
- echo "Your platform has some specific hints for long doubles, using them..."
- . ./uselongdouble.cbu
- else
- $cat <<EOM
-(Your platform doesn't have any specific hints for long doubles.)
-EOM
- fi
- ;;
-esac
-
-message=X
-case "$uselongdouble:$d_sqrtl:$d_modfl" in
-$define:$define:$define)
+if $test "$uselongdouble" = "$define"; then
+ message=X
+ case "$d_sqrtl:$d_modfl" in
+ $define:$define)
: You have both
;;
-$define:$define:$undef)
- message="I could not find modfl"
+ $define:$undef)
+ if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
+ echo "You have both aintl and copysignl, so I can emulate modfl"
+ else
+ message="I could not find modfl"
+ fi
;;
-$define:$undef:$define)
+ $undef:$define)
message="I could not find sqrtl"
;;
-$define:$undef:$undef)
+ $undef:$undef)
message="I found neither sqrtl nor modfl"
;;
-esac
+ esac
-if $test "$message" != X; then
+ if $test "$message" != X; then
$cat <<EOM >&4
*** You requested the use of long doubles but you do not seem to have
EOM
uselongdouble=$undef
+ fi
fi
: determine the architecture name
: Cruising for prototypes
echo " "
echo "Checking out function prototypes..." >&4
-$cat >prototype.c <<'EOCP'
+$cat >prototype.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
int main(int argc, char *argv[]) {
exit(0);}
EOCP
EOM
case "$ld" in
- '') $cat >try.c <<'EOM'
+ '') $cat >try.c <<EOM
/* Test for whether ELF binaries are produced */
#include <fcntl.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
#include <stdlib.h>
+#endif
int main() {
char b[4];
int i = open("a.out",O_RDONLY);
fpossize="$ans"
fi
-
-
# Backward compatibility (uselfs is deprecated).
case "$uselfs" in
"$define"|true|[yY]*)
$cat > try.c <<EOCP
#include <sys/types.h>
#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
int main() {
printf("%d\n", (int)sizeof($fpostype));
return(0);
case "$d_access" in
"$define")
echo " "
- $cat >access.c <<'EOCP'
+ $cat >access.c <<EOCP
#include <sys/types.h>
#ifdef I_FCNTL
#include <fcntl.h>
#ifdef I_UNISTD
#include <unistd.h>
#endif
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
int main() {
exit(R_OK);
}
if test "X$timeincl" = X; then
echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
$echo $n "I'm now running the test program...$c"
- $cat >try.c <<'EOCP'
+ $cat >try.c <<EOCP
#include <sys/types.h>
#ifdef I_TIME
#include <time.h>
#ifdef I_SYSSELECT
#include <sys/select.h>
#endif
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
int main()
{
struct tm foo;
#ifdef I_UNISTD
# include <unistd.h>
#endif
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
int main()
{
if (getuid() == 0) {
#ifdef I_UNISTD
# include <unistd.h>
#endif
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
int main()
{
if (getuid() == 0) {
if set vprintf val -f d_vprintf; eval $csym; $val; then
echo 'vprintf() found.' >&4
val="$define"
- $cat >try.c <<'EOF'
+ $cat >try.c <<EOF
#include <varargs.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
int main() { xxx("foo"); }
echo " "
$cat >dirfd.c <<EOM
#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#$i_dirent I_DIRENT /**/
#$i_sysdir I_SYS_DIR /**/
#$i_sysndir I_SYS_NDIR /**/
$cat >fred.c<<EOM
#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#$i_dlfcn I_DLFCN
#ifdef I_DLFCN
#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
: Locate the flags for 'open()'
echo " "
-$cat >try.c <<'EOCP'
+$cat >try.c <<EOCP
#include <sys/types.h>
#ifdef I_FCNTL
#include <fcntl.h>
#ifdef I_SYS_FILE
#include <sys/file.h>
#endif
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
int main() {
if(O_RDONLY);
#ifdef O_TRUNC
$cat head.c > try.c
$cat >>try.c <<EOCP
#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
#include <stdlib.h>
+#endif
#$i_fcntl I_FCNTL
#ifdef I_FCNTL
#include <fcntl.h>
#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
-#include <stdlib.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#$i_fcntl I_FCNTL
#ifdef I_FCNTL
#include <fcntl.h>
echo " "
: See if fcntl-based locking works.
$cat >try.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
#include <stdlib.h>
+#endif
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
Checking to see how well your C compiler handles fd_set and friends ...
EOM
$cat >try.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#$i_systime I_SYS_TIME
#$i_sysselct I_SYS_SELECT
#$d_socket HAS_SOCKET
set frexpl d_frexpl
eval $inlibc
+: see if ilogbl exists - used along with scalbnl if frexpl is missing
+set ilogbl d_ilogbl
+eval $inlibc
+
+: see if scalbnl exists - used along with ilogbl if frexpl is missing
+set scalbnl d_scalbnl
+eval $inlibc
+
: see if this is a sys/param system
set sys/param.h i_sysparam
eval $inhdr
$cat >isascii.c <<'EOCP'
#include <stdio.h>
#include <ctype.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
int main() {
int c = 'A';
if (isascii(c))
fi
$cat <<EOP >try.c
#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#include <sys/types.h>
#include <signal.h>
#ifdef SIGFPE
# include <memory.h>
#endif
#ifdef I_STDLIB
-# include <stdlib.h>
+#include <stdlib.h>
#endif
#ifdef I_STRING
# include <string.h>
echo "Checking how std your stdio is..." >&4
$cat >try.c <<EOP
#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#define FILE_ptr(fp) $stdio_ptr
#define FILE_cnt(fp) $stdio_cnt
int main() {
/* Can we scream? */
/* Eat dust sed :-) */
/* In the buffer space, no one can hear you scream. */
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#define FILE_ptr(fp) $stdio_ptr
#define FILE_cnt(fp) $stdio_cnt
#include <sys/types.h>
$define)
$cat >try.c <<EOP
#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#define FILE_base(fp) $stdio_base
#define FILE_bufsiz(fp) $stdio_bufsiz
int main() {
EOM
$cat >try.c <<EOCP
#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#include <sys/types.h>
typedef $uvtype UV;
int main()
#endif
#include <sys/types.h>
#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#include <db.h>
int main(int argc, char *argv[])
{
esac
$cat >>try.c <<EOCP
#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#$i_unistd I_UNISTD
#ifdef I_UNISTD
# include <unistd.h>
echo "Checking how to generate random libraries on your machine..." >&4
echo 'int bar1() { return bar2(); }' > bar1.c
echo 'int bar2() { return 2; }' > bar2.c
-$cat > foo.c <<'EOP'
+$cat > foo.c <<EOP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
int main() { printf("%d\n", bar1()); exit(0); }
EOP
$cc $ccflags -c bar1.c >/dev/null 2>&1
xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
: generate a few handy files for later
-$cat > signal.c <<'EOCP'
+$cat > signal.c <<EOCP
#include <sys/types.h>
#include <signal.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
#include <stdio.h>
int main() {
d__fwalk='$d__fwalk'
d_access='$d_access'
d_accessx='$d_accessx'
+d_aintl='$d_aintl'
d_alarm='$d_alarm'
d_archlib='$d_archlib'
d_asctime_r='$d_asctime_r'
d_closedir='$d_closedir'
d_cmsghdr_s='$d_cmsghdr_s'
d_const='$d_const'
+d_copysignl='$d_copysignl'
d_crypt='$d_crypt'
d_crypt_r='$d_crypt_r'
d_csh='$d_csh'
d_grpasswd='$d_grpasswd'
d_hasmntopt='$d_hasmntopt'
d_htonl='$d_htonl'
+d_ilogbl='$d_ilogbl'
d_index='$d_index'
d_inetaton='$d_inetaton'
d_int64_t='$d_int64_t'
d_safemcpy='$d_safemcpy'
d_sanemcmp='$d_sanemcmp'
d_sbrkproto='$d_sbrkproto'
+d_scalbnl='$d_scalbnl'
d_sched_yield='$d_sched_yield'
d_scm_rights='$d_scm_rights'
d_seekdir='$d_seekdir'
*/
#$d_frexpl HAS_FREXPL /**/
+/* HAS_ILOGBL
+ * This symbol, if defined, indicates that the ilogbl function is
+ * available. If scalbnl is also present we can emulate frexpl
+ */
+/* HAS_SCALBNL
+ * This symbol, if defined, indicates that the scalbnl function is
+ * available. If ilogbl is also present we can emulate frexpl
+ */
+#$d_ilogbl HAS_ILOGBL /**/
+#$d_scalbnl HAS_SCALBNL /**/
+
/* HAS_STRUCT_FS_DATA:
* This symbol, if defined, indicates that the struct fs_data
* to do statfs() is supported.
#$d_modflproto HAS_MODFL_PROTO /**/
#$d_modfl_pow32_bug HAS_MODFL_POW32_BUG /**/
+/* HAS_AINTL
+ * This symbol, if defined, indicates that the aintl function is
+ * available. If copysignl is also present we can emulate modfl
+ */
+/* HAS_COPYSIGNL
+ * This symbol, if defined, indicates that the copysignl function is
+ * available. If aintl is also present we can emulate modfl
+ */
+#$d_aintl HAS_AINTL /**/
+#$d_copysignl HAS_COPYSIGNL /**/
+
/* HAS_MPROTECT:
* This symbol, if defined, indicates that the mprotect system call is
* available to modify the access protection of a memory mapped file.
# hints/solaris_2.sh
-# Last modified: Mon Jan 29 12:52:28 2001
-# Lupe Christoph <lupe@lupe-christoph.de>
-# Based on version by:
-# Andy Dougherty <doughera@lafayette.edu>
-# Which was based on input from lots of folks, especially
-# Dean Roehrich <roehrich@ironwood-fddi.cray.com>
-# Additional input from Alan Burlison, Jarkko Hietaniemi,
-# and Richard Soderberg.
+# Contributions by (in alphabetical order) Alan Burlison, Andy Dougherty,
+# Dean Roehrich, Jarkko Hietaniemi, Lupe Christoph, Richard Soderberg and
+# many others.
#
# See README.solaris for additional information.
#
# gcc will occasionally emit warnings about "unused prefix", but
# these ought to be harmless. See below for more details.
-# See man vfork.
-usevfork=${usevfork:-false}
-
# Solaris has secure SUID scripts
d_suidsafe=${d_suidsafe:-define}
;;
esac
-cat > UU/workshoplibpth.cbu << 'EOCBU'
-# This script UU/workshoplibpth.cbu will get 'called-back'
-# by other CBUs this script creates.
-case "$workshoplibpth_done" in
- '') if test `uname -p` = "sparc"; then
- case "$use64bitall" in
- "$define"|true|[yY]*)
- # add SPARC-specific 64 bit libraries
- loclibpth="$loclibpth /usr/lib/sparcv9"
- if test -n "$workshoplibs"; then
- loclibpth=`echo $loclibpth | sed -e "s% $workshoplibs%%" `
- for lib in $workshoplibs; do
- # Logically, it should be sparcv9.
- # But the reality fights back, it's v9.
- loclibpth="$loclibpth $lib/sparcv9 $lib/v9"
- done
- fi
- ;;
- *) loclibpth="$loclibpth $workshoplibs"
- ;;
- esac
- else
- loclibpth="$loclibpth $workshoplibs"
- fi
- workshoplibpth_done="$define"
- ;;
-esac
-EOCBU
+#
+# This extracts the library directories that will be searched by the Sun
+# Workshop compiler, given the command-line supplied in $tryworkshopcc.
+# Use thusly: loclibpth="`$getworkshoplibs` $loclibpth"
+#
+ getworkshoplibs=`cat <<'END'
+eval $tryworkshopcc -### 2>&1 | \
+sed -n '/ -Y /s!.* -Y "P,\([^"]*\)".*!\1!p' | tr ':' ' ' | \
+sed -e 's!/usr/lib/sparcv9!!' -e 's!/usr/ccs/lib/sparcv9!!' \
+ -e 's!/usr/lib!!g' -e 's!/usr/ccs/lib!!g'
+END
+`
case "$cc" in
'') if test -f /opt/SUNWspro/bin/cc; then
# Check that /dev/fd is mounted. If it is not mounted, let the
# user know that suid scripts may not work.
-df /dev/fd 2>&1 > /dev/null
+mount | grep '^/dev/fd ' 2>&1 > /dev/null
case $? in
0) ;;
*)
# Tue Apr 13 17:19:43 EDT 1999
# Get gcc to share its secrets.
-echo 'main() { return 0; }' > try.c
+echo 'int main() { return 0; }' > try.c
# Indent to avoid propagation to config.sh
verbose=`${cc:-cc} -v -o try try.c 2>&1`
#
# Using gcc.
#
+ ccversion='gcc'
# See if as(1) is GNU as(1). GNU as(1) might not work for this job.
if echo "$verbose" | grep ' /usr/ccs/bin/as ' >/dev/null 2>&1; then
#
# Not using gcc.
#
-
- ccversion="`${cc:-cc} -V 2>&1|sed -n -e '1s/^cc: //p'`"
- case "$ccversion" in
- *WorkShop*) ccname=workshop ;;
- *) ccversion='' ;;
- esac
-
- case "$ccname" in
- workshop)
- cat >try.c <<EOM
-#include <sunmath.h>
-int main() { return(0); }
+ cat > try.c << 'EOM'
+#include <stdio.h>
+int main() {
+#ifdef __SUNPRO_C
+ printf("workshop\n");
+#else
+ printf("\n");
+#endif
+return(0);
+}
EOM
- workshoplibs=`cc -### try.c -lsunmath -o try 2>&1|sed -n '/ -Y /s%.* -Y "P,\(.*\)".*%\1%p'|tr ':' '\n'|grep '/SUNWspro/'`
- . ./workshoplibpth.cbu
- ;;
- esac
+ tryworkshopcc="${cc:-cc} try.c -o try"
+ if $tryworkshopcc >/dev/null 2>&1; then
+ ccversion=`./try`
+ if test "$ccversion" = "workshop" -a ! "$use64bitall_done"; then
+ loclibpth="/usr/lib /usr/ccs/lib `$getworkshoplibs` $loclibpth"
+ fi
+ fi
# See if as(1) is GNU as(1). GNU might not work for this job.
case `as --version < /dev/null 2>&1` in
END
fi
-
fi
-
# as --version or ld --version might dump core.
-rm -f try try.c
-rm -f core
-
-# XXX
+rm -f try try.c core
EOCBU
cat > UU/usethreads.cbu <<'EOCBU'
/* Test for sig(set|long)jmp bug. */
#include <setjmp.h>
- main()
+ int main()
{
sigjmp_buf env;
int ret;
EOM
exit 1
fi
- . ./workshoplibpth.cbu
case "$cc -v 2>/dev/null" in
*gcc*)
- echo 'main() { return 0; }' > try.c
+ echo 'int main() { return 0; }' > try.c
case "`${cc:-cc} -mcpu=v9 -m64 -S try.c 2>&1 | grep 'm64 is not supported by this configuration'`" in
*"m64 is not supported"*)
cat >&4 <<EOM
exit 1
;;
esac
+ loclibpth="/usr/lib/sparcv9 $loclibpth"
ccflags="$ccflags -mcpu=v9 -m64"
if test X`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null` != X; then
ccflags="$ccflags -Wa,`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
ccflags="$ccflags `getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
ldflags="$ldflags `getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`"
lddlflags="$lddlflags -G `getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`"
+ echo "int main() { return(0); } " > try.c
+ tryworkshopcc="${cc:-cc} try.c -o try $ccflags"
+ loclibpth="/usr/lib/sparcv9 /usr/ccs/lib/sparcv9 `$getworkshoplibs` $loclibpth"
;;
esac
- libscheck='case "`/usr/bin/file $xxx`" in
-*64-bit*|*SPARCV9*) ;;
-*) xxx=/no/64-bit$xxx ;;
-esac'
use64bitall_done=yes
;;
# after it has prompted the user for whether to use long doubles.
case "$uselongdouble" in
"$define"|true|[yY]*)
- if test -f /opt/SUNWspro/lib/libsunmath.so; then
- # Unfortunately libpth has already been set and
- # searched, so we need to add in everything manually.
- libpth="$libpth /opt/SUNWspro/lib"
- libs="$libs -lsunmath"
- ldflags="$ldflags -L/opt/SUNWspro/lib -R/opt/SUNWspro/lib"
- d_sqrtl=define
+ if test "$ccversion" = "workshop"; then
+ cat > try.c << 'EOM'
+#include <sunmath.h>
+int main() { (void) powl(2, 256); return(0); }
+EOM
+ if cc try.c -lsunmath -o try > /dev/null 2>&1 && ./try; then
+ libswanted="$libswanted sunmath"
+ fi
else
cat >&4 <<EOM
-The Sun Workshop math library is not installed; therefore I do not
-know how to do long doubles, sorry. I'm disabling the use of long
-doubles.
+The Sun Workshop math library is either not available or not working,
+so I do not know how to do long doubles, sorry.
+I'm therefore disabling the use of long doubles.
EOM
uselongdouble="$undef"
fi
return s;
}
+#if ! defined(HAS_MODFL) && defined(HAS_AINTL) && defined(HAS_COPYSIGNL)
+long double
+Perl_my_modfl(long double x, long double *ip)
+{
+ *ip = aintl(x);
+ return (x == *ip ? copysignl(0.0L, x) : x - *ip);
+}
+#endif
+
+#if ! defined(HAS_FREXPL) && defined(HAS_ILOGBL) && defined(HAS_SCALBNL)
+long double
+Perl_my_frexpl(long double x, int *e) {
+ *e = x == 0.0L ? 0 : ilogbl(x) + 1;
+ return (scalbnl(x, -*e));
+}
+#endif
# 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)))
+# else if defined(HAS_AINTL) && defined(HAS_COPYSIGNL)
+ extern long double Perl_my_modfl(long double x, long double *ip);
+# define Perl_modf(x,y) Perl_my_modfl(x,y)
# endif
# ifdef HAS_FREXPL
# define Perl_frexp(x,y) frexpl(x,y)
-# else
-# define Perl_frexp(x,y) ((long double)frexp((double)(x),y))
+# else if defined(HAS_ILOGBL) && defined(HAS_SCALBNL)
+ extern long double Perl_my_frexpl(long double x, int *e);
+# define Perl_frexp(x,y) Perl_my_frexpl(x,y)
# endif
# ifndef Perl_isnan
# ifdef HAS_ISNANL
SETu(U_V(value));
} else {
#if defined(SPARC64_MODF_WORKAROUND)
- (void)sparc64_workaround_modf(value, &value);
-#else
-# if defined(HAS_MODFL) || defined(LONG_DOUBLE_EQUALS_DOUBLE)
-# ifdef HAS_MODFL_POW32_BUG
+ (void)sparc64_workaround_modf(value, &value);
+#elif defined(HAS_MODFL_POW32_BUG)
/* some versions of glibc split (i + d) into (i-1, d+1) for 2^32 <= i < 2^64 */
- {
- NV offset = Perl_modf(value, &value);
- (void)Perl_modf(offset, &offset);
- value += offset;
- }
-# else
- (void)Perl_modf(value, &value);
-# endif
-# else
- double tmp = (double)value;
- (void)Perl_modf(tmp, &tmp);
- value = (NV)tmp;
-# endif
+ NV offset = Perl_modf(value, &value);
+ (void)Perl_modf(offset, &offset);
+ value += offset;
+#else
+ (void)Perl_modf(value, &value);
#endif
SETn(value);
}
if (value > (NV)IV_MIN - 0.5) {
SETi(I_V(value));
} else {
-#if defined(HAS_MODFL) || defined(LONG_DOUBLE_EQUALS_DOUBLE)
-# ifdef HAS_MODFL_POW32_BUG
+#if defined(SPARC64_MODF_WORKAROUND)
+ (void)sparc64_workaround_modf(-value, &value);
+#elif defined(HAS_MODFL_POW32_BUG)
/* some versions of glibc split (i + d) into (i-1, d+1) for 2^32 <= i < 2^64 */
- {
- NV offset = Perl_modf(-value, &value);
- (void)Perl_modf(offset, &offset);
- value += offset;
- }
-# else
- (void)Perl_modf(-value, &value);
-# endif
- value = -value;
+ NV offset = Perl_modf(-value, &value);
+ (void)Perl_modf(offset, &offset);
+ value += offset;
#else
- double tmp = (double)value;
- (void)Perl_modf(-tmp, &tmp);
- value = -(NV)tmp;
+ (void)Perl_modf(-value, &value);
#endif
- SETn(value);
+ SETn(-value);
}
}
}