summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-06-24 13:21:23 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-24 13:21:23 +0000
commitc77b533b28c0662914d761b264c2238f98d272a4 (patch)
tree82eb19c8936475bee43cb1755354fe92e5a8a108
parent9faf41b626b963edb80798c7c7738bc20834dda2 (diff)
downloadperl-c77b533b28c0662914d761b264c2238f98d272a4.tar.gz
Factor the PERL_SYS_INIT() code, from Hugo van der Sanden.
p4raw-id: //depot/perl@10888
-rw-r--r--hints/freebsd.sh1
-rw-r--r--hints/posix-bc.sh5
-rw-r--r--hints/sco.sh2
-rw-r--r--mpeix/mpeixish.h7
-rw-r--r--perl.h16
-rw-r--r--unixish.h18
6 files changed, 23 insertions, 26 deletions
diff --git a/hints/freebsd.sh b/hints/freebsd.sh
index 8eb6ac47b0..6a105fd170 100644
--- a/hints/freebsd.sh
+++ b/hints/freebsd.sh
@@ -123,6 +123,7 @@ case "$osvers" in
0*|1*|2*|3*) ;;
*)
+ ccflags="${ccflags} -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H"
if /usr/bin/file -L /usr/lib/libc.so | /usr/bin/grep -vq "not stripped" ; then
usenm=false
fi
diff --git a/hints/posix-bc.sh b/hints/posix-bc.sh
index 79742af02a..8a4f289a0b 100644
--- a/hints/posix-bc.sh
+++ b/hints/posix-bc.sh
@@ -19,10 +19,11 @@ esac
# -DPOSIX_BC
# -DUSE_PURE_BISON
# -D_XOPEN_SOURCE_EXTENDED alters system headers.
+# -DPERL_IGNORE_FPUSIG=SIGFPE
# Prepend your favorites with Configure -Dccflags=your_favorites
case "$ccflags" in
-'') ccflags='-K enum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED' ;;
-*) ccflags='$ccflags -Kenum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED' ;;
+'') ccflags='-K enum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -DPERL_IGNORE_FPUSIG=SIGFPE' ;;
+*) ccflags='$ccflags -Kenum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -DPERL_IGNORE_FPUSIG=SIGFPE' ;;
esac
# ccdlflags have yet to be determined.
diff --git a/hints/sco.sh b/hints/sco.sh
index 079ab78035..1d1d5c2788 100644
--- a/hints/sco.sh
+++ b/hints/sco.sh
@@ -112,7 +112,7 @@ then
else
###############################################################
# Need this in release 5 because of changed fpu exeption rules
- ccflags="$ccflags -D PERL_SCO5"
+ ccflags="$ccflags -D HAS_FPSETMASK"
###############################################################
# In Release 5, always compile ELF objects
diff --git a/mpeix/mpeixish.h b/mpeix/mpeixish.h
index 821d593162..dc8cb1939a 100644
--- a/mpeix/mpeixish.h
+++ b/mpeix/mpeixish.h
@@ -113,12 +113,7 @@
#define Mkdir(path,mode) mkdir((path),(mode))
#ifndef PERL_SYS_INIT
-#ifdef PERL_SCO5
-/* this should be set in a hint file, not here */
-# define PERL_SYS_INIT(c,v) fpsetmask(0); MALLOC_INIT
-#else
-# define PERL_SYS_INIT(c,v) MALLOC_INIT
-#endif
+# define PERL_SYS_INIT(c,v) PERL_FPU_INIT MALLOC_INIT
#endif
#ifndef PERL_SYS_TERM
diff --git a/perl.h b/perl.h
index 4c82ca7d56..72348287c3 100644
--- a/perl.h
+++ b/perl.h
@@ -1752,6 +1752,22 @@ typedef struct ptr_tbl PTR_TBL_t;
# define NEED_ENVIRON_DUP_FOR_MODIFY
#endif
+/*
+ * initialise to avoid floating-point exceptions from overflow, etc
+ */
+#ifndef PERL_FPU_INIT
+# ifdef HAS_FPSETMASK
+# if HAS_FLOATINGPOINT_H
+# include <floatingpoint.h>
+# endif
+# define PERL_FPU_INIT fpsetmask(0);
+# elif PERL_IGNORE_FPUSIG
+# define PERL_FPU_INIT signal(PERL_IGNORE_FPUSIG, SIG_IGN);
+# else
+# define PERL_FPU_INIT
+# endif
+#endif
+
#ifndef PERL_SYS_INIT3
# define PERL_SYS_INIT3(argvp,argcp,envp) PERL_SYS_INIT(argvp,argcp)
#endif
diff --git a/unixish.h b/unixish.h
index a7e9a08f74..fb3a995b60 100644
--- a/unixish.h
+++ b/unixish.h
@@ -118,24 +118,8 @@
#define Fflush(fp) fflush(fp)
#define Mkdir(path,mode) mkdir((path),(mode))
-/* these should be set in a hint file, not here */
#ifndef PERL_SYS_INIT
-#if defined(PERL_SCO5) || defined(__FreeBSD__)
-# ifdef __FreeBSD__
-# include <floatingpoint.h>
-# endif
-# define PERL_SYS_INIT(c,v) fpsetmask(0); MALLOC_INIT
-#else
-# ifdef POSIX_BC
-# define PERL_SYS_INIT(c,v) sigignore(SIGFPE); MALLOC_INIT
-# else
-# ifdef UTS
-# define PERL_SYS_INIT(c,v) signal(SIGFPE, SIG_IGN); MALLOC_INIT
-# else
-# define PERL_SYS_INIT(c,v) MALLOC_INIT
-# endif
-# endif
-#endif
+# define PERL_SYS_INIT(c,v) PERL_FPU_INIT MALLOC_INIT
#endif
#ifndef PERL_SYS_TERM