Description: backport: NTL error handler
 Move error handler for factory,NTL to the non-libSingular part.
 (See forum: "NTL error handling", for SAGE).
Comment: Singular commit: 502cf86d0b
Origin: upstream
Author: Hans Schoenemann <hannes@mathematik.uni-kl.de>
Last-Update: 2018-10-06

--- a/Singular/cntrlc.cc
+++ b/Singular/cntrlc.cc
@@ -20,6 +20,14 @@
 #include "Singular/links/silink.h"
 #include "Singular/links/ssiLink.h"
 
+#ifdef HAVE_NTL
+#include <NTL/version.h>
+#include <NTL/tools.h>
+#ifdef NTL_CLIENT
+NTL_CLIENT
+#endif
+#endif
+
 /* undef, if you don't want GDB to come up on error */
 
 #define CALL_GDB
@@ -549,11 +557,20 @@
 
 #  endif /* !__OPTIMIZE__ */
 
-/*2
-* init signal handlers
-*/
+/// init signal handlers and error handling for libraries: NTL, factory
 void init_signals()
 {
+// NTL error handling (>= 9.3.0) ----------------------------------------
+#ifdef HAVE_NTL
+#if (((NTL_MAJOR_VERSION==9)&&(NTL_MINOR_VERSION>=3))||(NTL_MAJOR_VERSION>=10))
+  ErrorMsgCallback=WerrorS;
+  ErrorCallback=HALT;
+#endif
+#endif
+// factory error handling: -----------------------------------------------
+  factoryError=WerrorS;
+
+// signal handler -------------------------------------------------------
   #ifdef SIGSEGV
   si_set_signal(SIGSEGV,(si_hdl_typ)sigsegv_handler);
   #endif
--- a/Singular/misc_ip.cc
+++ b/Singular/misc_ip.cc
@@ -1316,16 +1316,6 @@
   On(SW_USE_EZGCD_P);
   On(SW_USE_QGCD);
   Off(SW_USE_NTL_SORT); // may be changed by an command line option
-  factoryError=WerrorS;
-
-// NTL error handling (>= 9.3.0)
-#ifdef HAVE_NTL
-#if (((NTL_MAJOR_VERSION==9)&&(NTL_MINOR_VERSION>=3))||(NTL_MAJOR_VERSION>=10))
-  ErrorMsgCallback=WerrorS;
-  ErrorCallback=HALT;
-#endif
-#endif
-
 // memory initialization: -----------------------------------------------
     om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;
 #ifndef OM_NDEBUG
