From cea09e0713db224430e33be771647b195f261d6d Mon Sep 17 00:00:00 2001
From: Fons Rademakers <Fons.Rademakers@cern.ch>
Date: Tue, 9 Apr 2002 14:46:03 +0000
Subject: [PATCH] add exceptions case in the configure script. This is mainly
 used by Fermilab experiments using KCC compilers. Use:   ./configure linuxkcc
 --build=noexceptions to build ROOT without exception handling, or set env var
 EXCEPTIONS=no. Also reflected in root-config --has-exceptions and --clfags.

git-svn-id: http://root.cern.ch/svn/root/trunk@4333 27541ba8-7e3a-0410-8455-c3a389f83636
---
 config/Makefile.alphakcc   |   4 +-
 config/Makefile.in         |   2 +
 config/Makefile.linuxkcc   |   4 +-
 config/Makefile.sgikcc     |   4 +-
 config/Makefile.solariskcc |   4 +-
 config/root-config.in      |   8 ++
 configure                  | 152 ++++++++++++++++++++-----------------
 test/Makefile.in           |   4 +-
 8 files changed, 103 insertions(+), 79 deletions(-)

diff --git a/config/Makefile.alphakcc b/config/Makefile.alphakcc
index 2849b824b71..68215171332 100644
--- a/config/Makefile.alphakcc
+++ b/config/Makefile.alphakcc
@@ -1,5 +1,5 @@
 # -*- mode: makefile -*-
-# 
+#
 # Makefile of ROOT for DEC OSF1 with KCC compiler
 
 PLATFORM      = alpha
@@ -16,7 +16,7 @@ CXXOPT        = +K3
 NOOPT         =
 endif
 
-ifeq (exception,$(findstring exception,$(ROOTBUILD)))
+ifeq (EXCEPTIONS,yes)
 EXCEPTION     = --exceptions -DG__EXCEPTIONWRAPPER
 else
 EXCEPTION     = --no_exceptions
diff --git a/config/Makefile.in b/config/Makefile.in
index 76ee9eeedb9..8475c7f9e2c 100644
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -30,6 +30,8 @@ ACLOCALDIR     := @aclocaldir@
 XPMLIBDIR      := @xpmlibdir@
 XPMLIB         := @xpmlib@
 
+EXCEPTIONS     := @exceptions@
+
 OSTHREADLIBDIR := @threadlibdir@
 OSTHREADLIB    := @threadlib@
 
diff --git a/config/Makefile.linuxkcc b/config/Makefile.linuxkcc
index 75a3e538a67..b0aa92c0c81 100644
--- a/config/Makefile.linuxkcc
+++ b/config/Makefile.linuxkcc
@@ -1,5 +1,5 @@
 # -*- mode: makefile -*-
-# 
+#
 # Makefile of ROOT for Linux with glibc and KCC compiler
 
 # When changing OPT to -O you can also change +K0 to +K1
@@ -20,7 +20,7 @@ CXXOPT        = +K3 --backend -m486 --backend -malign-loops=4 --backend \
 NOOPT         =
 endif
 
-ifeq (exception,$(findstring exception,$(ROOTBUILD)))
+ifeq (EXCEPTIONS,yes)
 EXCEPTION     = --exceptions -DG__EXCEPTIONWRAPPER
 else
 EXCEPTION     = --no_exceptions
diff --git a/config/Makefile.sgikcc b/config/Makefile.sgikcc
index b9dbf0999bc..4dc4ad97a3c 100644
--- a/config/Makefile.sgikcc
+++ b/config/Makefile.sgikcc
@@ -1,5 +1,5 @@
 # -*- mode: makefile -*-
-# 
+#
 # Makefile of ROOT for SGI IRIX 6.x with KCC compiler
 
 # You can steer the build with the variable ROOTBUILD
@@ -20,7 +20,7 @@ OPT           = -O2
 NOOPT         =
 endif
 
-ifeq (exception,$(findstring exception,$(ROOTBUILD)))
+ifeq (EXCEPTIONS,yes)
 EXCEPTION     = --exceptions -DG__EXCEPTIONWRAPPER
 else
 EXCEPTION     = --no_exceptions
diff --git a/config/Makefile.solariskcc b/config/Makefile.solariskcc
index a63e50539b3..6529f439022 100644
--- a/config/Makefile.solariskcc
+++ b/config/Makefile.solariskcc
@@ -1,5 +1,5 @@
 # -*- mode: makefile -*-
-# 
+#
 # Makefile of ROOT for Solaris with KCC
 
 PLATFORM      = solaris
@@ -14,7 +14,7 @@ CXXOPT        = +K1
 NOOPT         =
 endif
 
-ifeq (exception,$(findstring exception,$(ROOTBUILD)))
+ifeq (EXCEPTIONS,yes)
 EXCEPTION     = --exceptions -DG__EXCEPTIONWRAPPER
 else
 EXCEPTION     = --no_exceptions
diff --git a/config/root-config.in b/config/root-config.in
index 866e73cb884..b830c9634e6 100755
--- a/config/root-config.in
+++ b/config/root-config.in
@@ -274,12 +274,20 @@ esac
 
 case $arch in
 *kcc)
+   ex=""
    for f in $features ; do
       if test "x$f" = "xthread" ; then
 	 auxcflags="--thread_safe $auxcflags"
 	 auxldflags="--thread_safe $auxldflags"
       fi
+      if test "x$f" = "xexceptions" ; then
+	 ex="yes"
+      fi
    done
+   if test "x$ex" = "x" ; then
+      auxcflags="--no_exceptions $auxcflags"
+      auxldflags="--no_exceptions $auxldflags"
+   fi
 esac
 
 ### end of machine and compiler dependent settings ###
diff --git a/configure b/configure
index 19d7aaa1060..cd44166a7f0 100755
--- a/configure
+++ b/configure
@@ -36,7 +36,8 @@ enable_shared=yes
 enable_soversion=no
 enable_srp=yes
 enable_star=no
-enable_thread=        # must be set explicitely via --enable-thread
+enable_thread=           # must be set explicitely via --enable-thread
+enable_exceptions=yes
 enable_ttf=yes
 enable_venus=yes
 show_pkglist=no
@@ -45,7 +46,7 @@ options="enable_afs enable_cern enable_mysql enable_opengl enable_pgsql \
          enable_pythia enable_pythia6 enable_rfio enable_dcache enable_rpath \
          enable_sapdb enable_shadowpw enable_shared enable_soversion \
          enable_srp enable_star enable_thread enable_ttf enable_venus \
-         enable_krb5"
+         enable_krb5 enable_exceptions"
 
 
 ######################################################################
@@ -284,7 +285,7 @@ confhelp() {
     echo "   --testdir       Tests                     (<docdir>/test)"
     echo "   --tutdir        Tutorials                 (<docdir>/tutorial)"
     echo "   --aclocaldir    Autoconf macro install dir(<prefix>/share/aclocal)"
-    echo "   --build         Build configuration [debug, exception, ...],"
+    echo "   --build         Build configuration [debug, exceptions, ...],"
     echo "                   overrides the ROOTBUILD shell variable"
     echo "enable/disable options, prefix with either --enable- or --disable-"
     echo "   shared          Use shared 3rd party libraries if possible"
@@ -537,6 +538,18 @@ if test ! "$platform" = "win32"; then
     fi
 fi
 
+######################################################################
+#
+### echo %%% Exceptions - compiler feature
+#
+if test "x$EXCEPTIONS" = "xno" ; then
+    enable_exceptions=no
+fi
+e=`echo $rootbuild | sed 's/.*exceptions.*/1/'`
+if test "x$e" = "x1" ; then
+    enable_exceptions=no
+fi
+
 ######################################################################
 #
 ### echo %%% Posix Thread Library
@@ -1315,72 +1328,73 @@ fi
 # config/Makefile.config
 #
 echo $ac_n "Writing $MAKEOUT ... $ac_c"
-sed -e "s|@architecture@|$arch|"           \
-    -e "s|@rootbuild@|$rootbuild|"         \
-    -e "s|@mkliboption@|$mkliboption|"     \
-    -e "s|@ldflags@||"                     \
-    -e "s|@bindir@|$bindir|"               \
-    -e "s|@libdir@|$libdir|"               \
-    -e "s|@incdir@|$incdir|"               \
-    -e "s|@etcdir@|$etcdir|"               \
-    -e "s|@mandir@|$mandir|"               \
-    -e "s|@datadir@|$datadir|"             \
-    -e "s|@proofdir@|$proofdir|"           \
-    -e "s|@macrodir@|$macrodir|"           \
-    -e "s|@cintincdir@|$cintincdir|"       \
-    -e "s|@iconpath@|$iconpath|"           \
-    -e "s|@docdir@|$docdir|"               \
-    -e "s|@testdir@|$testdir|"             \
-    -e "s|@tutdir@|$tutdir|"               \
-    -e "s|@aclocaldir@|$aclocaldir|"       \
-    -e "s|@srcdir@|$srcdir|"               \
-    -e "s|@xpmlibdir@|$xpmlibdir|"         \
-    -e "s|@xpmlib@|$xpmlib|"               \
-    -e "s|@enable_star@|$enable_star|"     \
-    -e "s|@threadlibdir@|$threadlibdir|"   \
-    -e "s|@threadlib@|$threadlib|"         \
-    -e "s|@ttfincdir@|$ttfincdir|"         \
-    -e "s|@ttflibdir@|$ttflibdir|"         \
-    -e "s|@ttflib@|$ttflib|"               \
-    -e "s|@ttffontdir@|$ttffontdir|"       \
-    -e "s|@openglincdir@|$openglincdir|"   \
-    -e "s|@opengllibdir@|$opengllibdir|"   \
-    -e "s|@openglulib@|$openglulib|"       \
-    -e "s|@opengllib@|$opengllib|"         \
-    -e "s|@mysqlincdir@|$mysqlincdir|"     \
-    -e "s|@mysqllibdir@|$mysqllibdir|"     \
-    -e "s|@mysqllib@|$mysqllib|"           \
-    -e "s|@pgsqlincdir@|$pgsqlincdir|"     \
-    -e "s|@pgsqllibdir@|$pgsqllibdir|"     \
-    -e "s|@pgsqllib@|$pgsqllib|"           \
-    -e "s|@sapdbincdir@|$sapdbincdir|"     \
-    -e "s|@sapdblibdir@|$sapdblibdir|"     \
-    -e "s|@sapdblib@|$sapdblib|"           \
-    -e "s|@cernlibdir@|$cernlibdir|"       \
-    -e "s|@cernlibs@|$cernlib|"            \
-    -e "s|@shiftlibdir@|$shiftlibdir|"     \
-    -e "s|@shiftlib@|$shiftlib|"           \
-    -e "s|@dcapincdir@|$dcapincdir|"       \
-    -e "s|@dcaplibdir@|$dcaplibdir|"       \
-    -e "s|@dcaplib@|$dcaplib|"             \
-    -e "s|@srplib@|$srplib|"               \
-    -e "s|@srpincdir@|$srpincdir|"         \
-    -e "s|@srplibdir@|$srplibdir|"         \
-    -e "s|@srputillib@|$srputillib|"       \
-    -e "s|@srputillibdir@|$srputillibdir|" \
-    -e "s|@srputilincdir@|$srputilincdir|" \
-    -e "s|@afslibdir@|$afslibdir|"         \
-    -e "s|@afslib@|$afslib|"               \
-    -e "s|@krb5incdir@|$krb5incdir|"       \
-    -e "s|@krb5libdir@|$krb5libdir|"       \
-    -e "s|@krb5lib@|$krb5lib|"             \
-    -e "s|@shadowpw@|$shadowpw|"           \
-    -e "s|@pythialibdir@|$pythialibdir|"   \
-    -e "s|@pythialib@|$pythialib|"         \
-    -e "s|@pythia6libdir@|$pythia6libdir|" \
-    -e "s|@pythia6lib@|$pythia6lib|"       \
-    -e "s|@venuslibdir@|$venuslibdir|"     \
-    -e "s|@venuslib@|$venuslib|"           \
+sed -e "s|@architecture@|$arch|"            \
+    -e "s|@rootbuild@|$rootbuild|"          \
+    -e "s|@mkliboption@|$mkliboption|"      \
+    -e "s|@ldflags@||"                      \
+    -e "s|@bindir@|$bindir|"                \
+    -e "s|@libdir@|$libdir|"                \
+    -e "s|@incdir@|$incdir|"                \
+    -e "s|@etcdir@|$etcdir|"                \
+    -e "s|@mandir@|$mandir|"                \
+    -e "s|@datadir@|$datadir|"              \
+    -e "s|@proofdir@|$proofdir|"            \
+    -e "s|@macrodir@|$macrodir|"            \
+    -e "s|@cintincdir@|$cintincdir|"        \
+    -e "s|@iconpath@|$iconpath|"            \
+    -e "s|@docdir@|$docdir|"                \
+    -e "s|@testdir@|$testdir|"              \
+    -e "s|@tutdir@|$tutdir|"                \
+    -e "s|@aclocaldir@|$aclocaldir|"        \
+    -e "s|@srcdir@|$srcdir|"                \
+    -e "s|@xpmlibdir@|$xpmlibdir|"          \
+    -e "s|@xpmlib@|$xpmlib|"                \
+    -e "s|@enable_star@|$enable_star|"      \
+    -e "s|@threadlibdir@|$threadlibdir|"    \
+    -e "s|@threadlib@|$threadlib|"          \
+    -e "s|@ttfincdir@|$ttfincdir|"          \
+    -e "s|@ttflibdir@|$ttflibdir|"          \
+    -e "s|@ttflib@|$ttflib|"                \
+    -e "s|@ttffontdir@|$ttffontdir|"        \
+    -e "s|@openglincdir@|$openglincdir|"    \
+    -e "s|@opengllibdir@|$opengllibdir|"    \
+    -e "s|@openglulib@|$openglulib|"        \
+    -e "s|@opengllib@|$opengllib|"          \
+    -e "s|@mysqlincdir@|$mysqlincdir|"      \
+    -e "s|@mysqllibdir@|$mysqllibdir|"      \
+    -e "s|@mysqllib@|$mysqllib|"            \
+    -e "s|@pgsqlincdir@|$pgsqlincdir|"      \
+    -e "s|@pgsqllibdir@|$pgsqllibdir|"      \
+    -e "s|@pgsqllib@|$pgsqllib|"            \
+    -e "s|@sapdbincdir@|$sapdbincdir|"      \
+    -e "s|@sapdblibdir@|$sapdblibdir|"      \
+    -e "s|@sapdblib@|$sapdblib|"            \
+    -e "s|@cernlibdir@|$cernlibdir|"        \
+    -e "s|@cernlibs@|$cernlib|"             \
+    -e "s|@shiftlibdir@|$shiftlibdir|"      \
+    -e "s|@shiftlib@|$shiftlib|"            \
+    -e "s|@dcapincdir@|$dcapincdir|"        \
+    -e "s|@dcaplibdir@|$dcaplibdir|"        \
+    -e "s|@dcaplib@|$dcaplib|"              \
+    -e "s|@srplib@|$srplib|"                \
+    -e "s|@srpincdir@|$srpincdir|"          \
+    -e "s|@srplibdir@|$srplibdir|"          \
+    -e "s|@srputillib@|$srputillib|"        \
+    -e "s|@srputillibdir@|$srputillibdir|"  \
+    -e "s|@srputilincdir@|$srputilincdir|"  \
+    -e "s|@afslibdir@|$afslibdir|"          \
+    -e "s|@afslib@|$afslib|"                \
+    -e "s|@krb5incdir@|$krb5incdir|"        \
+    -e "s|@krb5libdir@|$krb5libdir|"        \
+    -e "s|@krb5lib@|$krb5lib|"              \
+    -e "s|@shadowpw@|$shadowpw|"            \
+    -e "s|@pythialibdir@|$pythialibdir|"    \
+    -e "s|@pythialib@|$pythialib|"          \
+    -e "s|@pythia6libdir@|$pythia6libdir|"  \
+    -e "s|@pythia6lib@|$pythia6lib|"        \
+    -e "s|@venuslibdir@|$venuslibdir|"      \
+    -e "s|@venuslib@|$venuslib|"            \
+    -e "s|@exceptions@|$enable_exceptions|" \
     < Makefile.tmp > $MAKEOUT
 rm -f Makefile.tmp
 echo "done"
diff --git a/test/Makefile.in b/test/Makefile.in
index 827210ffc03..3aa77481f0c 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -196,9 +196,9 @@ endif
 
 ifeq ($(ARCH),sgikcc)
 # SGI with KCC
-CXX           = KCC -n32 --no_exceptions --one_instantiation_per_object
+CXX           = KCC -n32 --one_instantiation_per_object
 CXXFLAGS      = -O
-LD            = KCC -n32 --no_exceptions
+LD            = KCC -n32
 LDFLAGS       = -O
 SOFLAGS       =
 endif
-- 
GitLab