From e051fae36f0c3a27051b04ed4f7c5ca68c51afa7 Mon Sep 17 00:00:00 2001
From: Fons Rademakers <Fons.Rademakers@cern.ch>
Date: Fri, 22 Mar 2002 14:26:26 +0000
Subject: [PATCH] root-config has new options --arch and --has-<feature> where
 feature can be any of the ./configure --has-<features>, e.g. root-config
 --has-mysql returns "yes" if mysql was enabled during the ROOT installation
 and "no" otherwise. By Christian Holm.

git-svn-id: http://root.cern.ch/svn/root/trunk@4222 27541ba8-7e3a-0410-8455-c3a389f83636
---
 config/root-config.in | 38 ++++++++++++++++++--
 configure             | 81 ++++++++++++++++++++++---------------------
 2 files changed, 77 insertions(+), 42 deletions(-)

diff --git a/config/root-config.in b/config/root-config.in
index 976b4ea4822..866e73cb884 100755
--- a/config/root-config.in
+++ b/config/root-config.in
@@ -8,6 +8,7 @@
 arch=@architecture@
 libdir=@libdir@
 incdir=@incdir@
+features="@features@"
 if test "$arch" = "win32gdk"; then
    arch="win32"
 fi
@@ -268,7 +269,20 @@ win32)
    ;;
 esac
 
-### end of machine dependent settings ###
+
+### compiler dependent settings ###
+
+case $arch in
+*kcc)
+   for f in $features ; do
+      if test "x$f" = "xthread" ; then
+	 auxcflags="--thread_safe $auxcflags"
+	 auxldflags="--thread_safe $auxldflags"
+      fi
+   done
+esac
+
+### end of machine and compiler dependent settings ###
 
 
 prefix=@prefix@
@@ -285,7 +299,7 @@ noauxcflags=no
 noldflags=no
 
 usage="\
-Usage: root-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--new] [--nonew] [--libs] [--glibs] [--libdir] [--incdir] [--noauxcflags] [--noauxlibs] [--noldflags] [--help]"
+Usage: root-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--new] [--nonew] [--libs] [--glibs] [--libdir] [--incdir] [--noauxcflags] [--noauxlibs] [--noldflags] [--has-<feature>] [--arch] [--help]"
 
 if test $# -eq 0; then
    echo "${usage}" 1>&2
@@ -301,6 +315,24 @@ while test $# -gt 0; do
   esac
 
   case $1 in
+    --arch)
+      ### Output the arcitecture
+      out="$out $arch"
+      ;;
+    --has-*)
+      ### Check for feature
+      f=`echo $1 | sed 's/--has-//'`
+      for c in $features ; do
+         if test "x$c" = "x$f" ; then
+            out="$out yes"
+            break
+         fi
+         c=""
+      done
+      if test "x$c" = "x" ; then
+         out="$out no"
+      fi
+      ;;
     --prefix=*)
       ### Set the prefix
       if test "$arch" = "win32"; then
@@ -470,6 +502,7 @@ while test $# -gt 0; do
       ### Print a help message
       echo "Usage: `basename $0` [options]"
       echo ""
+      echo "  --arch                Print the architecture"
       echo "  --prefix[=dir]        Print or set prefix"
       echo "  --exec-prefix[=dir]   Print or set execution prefix"
       echo "  --libs                Print regular ROOT libraries"
@@ -483,6 +516,7 @@ while test $# -gt 0; do
       echo "  --noauxlibs           Do not print auxiliary/system libraries"
       echo "  --noauxcflags         Do not print auxiliary compiler flags"
       echo "  --noldflags           Do not print linker flags"
+      echo "  --has-<feature>       Test if <feature> is compiled in"
       echo "  --version             Print the ROOT version"
       exit 0
       ;;
diff --git a/configure b/configure
index 07f3775b86a..b86f88d3467 100755
--- a/configure
+++ b/configure
@@ -41,6 +41,12 @@ enable_ttf=yes
 enable_venus=yes
 show_pkglist=no
 
+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"
+
 
 ######################################################################
 #
@@ -295,6 +301,7 @@ confhelp() {
     echo "   dcache          dCache support, requires dcap library from DESY"
     echo "   srp             SRP support, requires SRP source tree"
     echo "   afs             AFS support, requires AFS libs and objects"
+    echo "   krb5            Kerberos5 support, requires Kerberos libs"
     echo "   shadowpw        Shadow password support"
     echo "   pythia          Pythia5 EG support, requires libPythia"
     echo "   pythia6         Pythia6 EG support, requires libPythia6"
@@ -324,6 +331,7 @@ confhelp() {
     echo "   srp-incdir      SRP support, location header of t_server.h"
     echo "   srp-libdir      SRP support, location header of libsrp.a"
     echo "   afs             AFS support, location of AFS distribution"
+    echo "   krb5            Kerberos5 support, location of Kerberos distribution"
     echo "   sys-iconpath    Extra icon path"
     echo ""
     cat config/ARCHS
@@ -415,46 +423,30 @@ if test $# -gt 0 ; then
       # Enable/disable to turn on/off third party software linkage and
       # features
       #
-      --enable-shared)        enable_shared=yes     ;;
-      --disable-shared)       enable_shared=no      ;;
-      --enable-rpath)         enable_rpath=yes      ;;
-      --disable-rpath)        enable_rpath=no       ;;
-      --enable-star)          enable_star=yes       ;;
-      --disable-star)         enable_star=no        ;;
-      --enable-ttf)           enable_ttf=yes        ;;
-      --disable-ttf)          enable_ttf=no         ;;
-      --enable-opengl)        enable_opengl=yes     ;;
-      --disable-opengl)       enable_opengl=no      ;;
-      --enable-cern)          enable_cern=yes       ;;
-      --disable-cern)         enable_cern=no        ;;
-      --enable-mysql)         enable_mysql=yes      ;;
-      --disable-mysql)        enable_mysql=no       ;;
-      --enable-pgsql)         enable_pgsql=yes      ;;
-      --disable-pgsql)        enable_pgsql=no       ;;
-      --enable-sapdb)         enable_sapdb=yes      ;;
-      --disable-sapdb)        enable_sapdb=no       ;;
-      --enable-rfio)          enable_rfio=yes       ;;
-      --disable-rfio)         enable_rfio=no        ;;
-      --enable-dcache)        enable_dcache=yes     ;;
-      --disable-dcache)       enable_dcache=no      ;;
-      --enable-thread)        enable_thread=yes     ;;
-      --disable-thread)       enable_thread=no      ;;
-      --enable-srp)           enable_srp=yes        ;;
-      --disable-srp)          enable_srp=no         ;;
-      --enable-afs)           enable_afs=yes        ;;
-      --disable-afs)          enable_afs=no         ;;
-      --enable-krb5)          enable_krb5=yes       ;;
-      --disable-krb5)         enable_krb5=no        ;;
-      --enable-shadowpw)      enable_shadowpw=yes   ;;
-      --disable-shadowpw)     enable_shadowpw=no    ;;
-      --enable-pythia)        enable_pythia=yes     ;;
-      --disable-pythia)       enable_pythia=no      ;;
-      --enable-pythia6)       enable_pythia6=yes    ;;
-      --disable-pythia6)      enable_pythia6=no     ;;
-      --enable-venus)         enable_venus=yes      ;;
-      --disable-venus)        enable_venus=no       ;;
-      --enable-soversion)     enable_soversion=yes  ;;
-      --disable-soversion)    enable_soversion=no   ;;
+      --enable-*)
+	f=`echo $1 | sed -e 's/--//' -e 's/-/_/'`
+	eval $f=yes
+	for c in $options ; do
+	   if test "x$c" = "x$f" ; then
+	      f=""
+	   fi
+	done
+	if test "x$f" != "x" ; then
+	   echo "Invalid option '$1'. Try $0 --help" ; exit 1 ;
+	fi
+	;;
+      --disable-*)
+	f=`echo $1 | sed -e 's/--disable/enable/' -e 's/-/_/'`
+	eval $f=no
+	for c in $options ; do
+	   if test "x$c" = "x$f" ; then
+	      f=""
+	   fi
+	done
+	if test "x$f" != "x" ; then
+	   echo "Invalid option '$1'. Try $0 --help" ; exit 1 ;
+	fi
+	;;
       ################################################################
       #
       # Build steering option
@@ -1392,10 +1384,19 @@ if test "$prefix2" = "\$(ROOTSYS)" ; then
     libdir2=\$ROOTSYS/lib
     incdir2=\$ROOTSYS/include
 fi
+features=""
+for f in $options ; do
+    bar="$`echo $f`"
+    if test "x`eval echo $bar`" = "xyes" ; then
+       feat=`echo $f | sed 's/enable_//'`
+       features="$features $feat"
+    fi
+done
 sed -e "s|@architecture@|$arch|"           \
     -e "s|@prefix@|$prefix2|"              \
     -e "s|@incdir@|$incdir2|"              \
     -e "s|@libdir@|$libdir2|"              \
+    -e "s|@features@|$features|"           \
    < root-config.tmp > $RCONFOUT
 rm -f root-config.tmp
 chmod 755 $RCONFOUT
-- 
GitLab