From dfb86eba12271ac04ae59efb5450f07d5b15f232 Mon Sep 17 00:00:00 2001
From: Fons Rademakers <Fons.Rademakers@cern.ch>
Date: Fri, 10 Mar 2006 21:54:51 +0000
Subject: [PATCH] From Axel: revert for all platforms except win32 to the old
 ROOTBUILD behaviour. For Win32 introduce a new winrtdebug flag that is turned
 on during ./configure --build=debug OR when ROOTBUILD contains "debug" during
 ./configure.

git-svn-id: http://root.cern.ch/svn/root/trunk@14229 27541ba8-7e3a-0410-8455-c3a389f83636
---
 config/Makefile.in    |  3 ++-
 config/Makefile.win32 |  4 ++--
 config/root-config.in |  5 ++---
 configure             | 23 +++++++++++++++++++----
 4 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/config/Makefile.in b/config/Makefile.in
index 734a834965e..3da035d27dc 100644
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -3,13 +3,14 @@
 # Makefile definitions included by the top Makefile
 
 ARCH           := @architecture@
-ROOTBUILD      := @rootbuild@
+@rootbuild@
 USECONFIG      := @useconfig@
 MKLIBOPTIONS   := @mkliboption@
 
 EXTRA_CFLAGS   := -Iinclude @cflags@
 EXTRA_CXXFLAGS := -Iinclude @cflags@
 EXTRA_LDFLAGS  := @ldflags@
+WINRTDEBUG     := @winrtdebug@
 
 GLBPATCHFLAGS  := @glbpatchcflags@
 EXTRA_AUTHFLAGS:= @srpextracflags@ @krb5extracflags@ @glbextracflags@ @sslextracflags@
diff --git a/config/Makefile.win32 b/config/Makefile.win32
index b66a77ef352..a37f7b42bbf 100644
--- a/config/Makefile.win32
+++ b/config/Makefile.win32
@@ -19,7 +19,7 @@ endif
 
 # these define the build compatibility
 
-ifeq (debug,$(findstring debug,$(ROOTBUILD)))
+ifeq (yes,$(WINRTDEBUG))
   BLDCXXFLAGS = -MDd -GR
   BLDCFLAGS   = -MDd
   BLDF77FLAGS = -MDd
@@ -49,7 +49,7 @@ endif
 endif
 endif
 
-ifeq (debug,$(findstring debug,$(ROOTBUILD)))
+ifeq (yes,$(WINRTDEBUG))
 OPT           = $(DEBUGFLAGS)
 LDOPT         = -debug
 F77OPT        = -debug -nopdbfile -MDd
diff --git a/config/root-config.in b/config/root-config.in
index d3a58bc7bc1..586c4aae669 100755
--- a/config/root-config.in
+++ b/config/root-config.in
@@ -339,12 +339,11 @@ hiux)
 win32)
    # Win32
    auxcflags="-MD"
-   ROOTBUILD="@rootbuild@"
-   if [ "`echo $ROOTBUILD | sed 's,debug,,'`" != "$ROOTBUILD" ]; then
+   if test "x@winrtdebug@" = "xyes"; then
 	  auxcflags="-MDd"
    fi
    VC_MAJOR=`unset VS_UNICODE_OUTPUT; cl.exe 2>&1 | awk '{ if (NR==1) print $8 }' | cut -d'.' -f1`
-   if [ "$VC_MAJOR" != "" -a $VC_MAJOR -gt 13 ]; then
+   if test "$VC_MAJOR" != "" -a $VC_MAJOR -gt 13; then
       auxcflags="$auxcflags -EHs -GR"
    else
       auxcflags="$auxcflags -GX -G5"
diff --git a/configure b/configure
index 872546943b4..d2371ba41a9 100755
--- a/configure
+++ b/configure
@@ -21,7 +21,6 @@ show_pkglist=no
 noact="no"
 nohowto="no"
 logfile=config.log
-rootbuild=$ROOTBUILD
 
 options="                    \
    enable_afs                \
@@ -69,6 +68,7 @@ options="                    \
    enable_table              \
    enable_thread             \
    enable_venus              \
+   enable_winrtdebug         \
    enable_xml                \
    enable_xrootd             \
 "
@@ -95,6 +95,7 @@ enable_shadowpw=
 enable_soversion=no
 enable_table=no
 enable_thread=           # must be set explicitely via --enable-thread
+enable_winrtdebug=
 enable_xrootd=           # must be set explicitely via --enable-xrootd
 
 # Remove old log file
@@ -836,6 +837,7 @@ enable/disable options, prefix with either --enable- or --disable-
   table              Build libTable contrib library
   thread             Thread support
   venus              Venus EG support, requires libVenus
+  winrtdebug         Link against the Windows debug runtime library
   xml                XML parser interface
   xrootd             Build xrootd file server and its client (if supported)
 
@@ -1093,7 +1095,7 @@ if test $# -gt 0 ; then
       #
       # Build steering option
       #
-      --build=*)      rootbuild=$optarg  ;;
+      --build=*)      rootbuild="ROOTBUILD      := $optarg"  ;;
       ################################################################
       #
       # Install path options
@@ -1219,6 +1221,19 @@ if test "x$e" = "x1" ; then
     enable_exceptions=no
 fi
 
+######################################################################
+#
+### echo %%% Windows Debug Runtime (-MDd)
+#
+if test "x$enable_winrtdebug" = "x" ; then
+    e=`echo $rootbuild | sed 's/.*debug.*/1/'`
+    if test "x$e" = "x1"; then
+        enable_winrtdebug=yes
+    else
+        enable_winrtdebug=no
+    fi
+fi
+
 ######################################################################
 #
 ### echo %%% Posix Thread Library
@@ -3673,6 +3688,7 @@ sed -e "s|@srcdir@|$srcdir|"                    \
     -e "s|@tutdir@|$tutdir|"                    \
     -e "s|@venuslib@|$venuslib|"                \
     -e "s|@venuslibdir@|$venuslibdir|"          \
+    -e "s|@winrtdebug@|$enable_winrtdebug|"     \
     -e "s|@xmlincdir@|$xmlincdir|"              \
     -e "s|@xmllib@|$xmllib|"                    \
     -e "s|@xmllibdir@|$xmllibdir|"              \
@@ -3765,7 +3781,6 @@ for f in $options ; do
        features="$features $feat"
     fi
 done
-
 sed -e "s|@architecture@|$arch|"           \
     -e "s|@platform@|$platform|"           \
     -e "s|@prefix@|$prefix2|"              \
@@ -3773,7 +3788,7 @@ sed -e "s|@architecture@|$arch|"           \
     -e "s|@libdir@|$libdir2|"              \
     -e "s|@incdir@|$incdir2|"              \
     -e "s|@features@|$features|"           \
-    -e "s|@rootbuild@|$rootbuild|"         \
+    -e "s|@winrtdebug@|$enable_winrtdebug|"\
     -e "s|@configargs@|$configargs|"       \
     -e "s|@dicttype@|$dicttype|"           \
    < root-config.tmp > $RCONFOUT
-- 
GitLab