From 3313f5ef886ab2dad287d18103398e6648223f94 Mon Sep 17 00:00:00 2001
From: Fons Rademakers <Fons.Rademakers@cern.ch>
Date: Mon, 11 Apr 2005 14:35:41 +0000
Subject: [PATCH] From Christian Holm: Patch to configure in which I fixed the
 problem about building the Debian packages on ia64, and a mistype that
 prevented Clarens from being build on Debian. Also, I changed the
 `check_symbol' function. First of all, it would always fail if the library
 was in `/usr/lib' as that was never prepended to the file name. Secondly, it
 would always fail if you had a stripped shared library, which is the common
 thing if the library is in `/usr/lib'. I introduced a test that uses the
 compiler/linker (via `config/Makefile.<arch>') to do a simple test program
 that calls the specified function, and then tries to link to the specified
 library. If that succeeds, the test succeeds. Note, this is more or less what
 Autoconf does for you. Plus added the template `build/misc/html.C.in' which
 will generate `macros/html.C' according to the optional packages that were
 built.

git-svn-id: http://root.cern.ch/svn/root/trunk@11550 27541ba8-7e3a-0410-8455-c3a389f83636
---
 config/html.C.in | 119 +++++++++++++++++++++++++++++++++++++++++++++++
 configure        | 107 ++++++++++++++++++++++++++++++++----------
 2 files changed, 201 insertions(+), 25 deletions(-)
 create mode 100644 config/html.C.in

diff --git a/config/html.C.in b/config/html.C.in
new file mode 100644
index 00000000000..02fdd62c009
--- /dev/null
+++ b/config/html.C.in
@@ -0,0 +1,119 @@
+// -*- mode: C++ -*-
+Bool_t enable_afs               = @enable_afs@;
+Bool_t enable_alien             = @enable_alien@;
+Bool_t enable_asimage           = @enable_asimage@;
+Bool_t enable_cern              = @enable_cern@;
+Bool_t enable_chirp             = @enable_chirp@;
+Bool_t enable_clarens           = @enable_clarens@;
+Bool_t enable_dcache            = @enable_dcache@;
+Bool_t enable_globus            = @enable_globus@;
+Bool_t enable_krb5              = @enable_krb5@;
+Bool_t enable_ldap              = @enable_ldap@;
+Bool_t enable_mysql             = @enable_mysql@;
+Bool_t enable_opengl            = @enable_opengl@;
+Bool_t enable_oracle            = @enable_oracle@;
+Bool_t enable_peac              = @enable_peac@;
+Bool_t enable_pgsql             = @enable_pgsql@;
+Bool_t enable_pythia            = @enable_pythia@;
+Bool_t enable_pythia6           = @enable_pythia6@;
+Bool_t enable_python            = @enable_python@;
+Bool_t enable_qt                = @enable_qt@;
+Bool_t enable_ruby              = @enable_ruby@;
+Bool_t enable_rfio              = @enable_rfio@;
+Bool_t enable_sapdb             = @enable_sapdb@;
+Bool_t enable_srp               = @enable_srp@;
+Bool_t enable_ssl               = @enable_ssl@;
+Bool_t enable_table             = @enable_table@;
+Bool_t enable_thread            = @enable_thread@;
+Bool_t enable_venus             = @enable_venus@;
+Bool_t enable_xml               = @enable_xml@;
+Bool_t enable_xrootd            = @enable_xrootd@;
+
+void html()
+{
+   gSystem->Load("libEG");
+   gSystem->Load("libFumili.so");
+   gSystem->Load("libGX11.so");
+   gSystem->Load("libGX11TTF.so");
+   gSystem->Load("libGed.so");
+   gSystem->Load("libGedOld.so");
+   gSystem->Load("libGeom.so");
+   gSystem->Load("libGeomPainter.so");
+   gSystem->Load("libGpad.so");
+   gSystem->Load("libGraf.so");
+   gSystem->Load("libGraf3d.so");
+   gSystem->Load("libGui.so");
+   gSystem->Load("libGuiBld.so");
+   gSystem->Load("libHist");
+   gSystem->Load("libHist.so");
+   gSystem->Load("libHistPainter");
+   gSystem->Load("libHtml.so");
+   gSystem->Load("libMLP.so");
+   gSystem->Load("libMatrix.so");
+   gSystem->Load("libMinuit.so");
+   gSystem->Load("libNew.so");
+   gSystem->Load("libPhysics");
+   gSystem->Load("libPostscript.so");
+   gSystem->Load("libProof");
+   gSystem->Load("libQuadp.so");
+   gSystem->Load("libRGL");
+   gSystem->Load("libRint.so");
+   gSystem->Load("libSrvAuth.so");
+   gSystem->Load("libThread");
+   gSystem->Load("libTree.so");
+   gSystem->Load("libTreePlayer");
+   gSystem->Load("libTreeViewer");
+   gSystem->Load("libTreeViewer.so");
+   gSystem->Load("libVMC.so");
+   gSystem->Load("libX3d");
+   gSystem->Load("libX3d.so");
+   gSystem->Load("libXMLIO.so");
+
+   if (enable_alien)             gSystem->Load("libRAliEn");
+   if (enable_asimage)           gSystem->Load("libASImage");
+   if (enable_cern)              gSystem->Load("libHbook");
+   if (enable_chirp)             gSystem->Load("libChirp");
+   if (enable_clarens) {
+      gSystem->Load("libClarens");
+      if (enable_peac) {
+         gSystem->Load("libPeacGui");
+         gSystem->Load("libPeac");
+      }
+   }
+   if (enable_dcache)            gSystem->Load("libDCache");
+   if (enable_globus)            gSystem->Load("libGlobusAuth");
+   if (enable_krb5)              gSystem->Load("libKrb5Auth");
+   if (enable_ldap)              gSystem->Load("libRLDAP");
+   if (enable_mysql)             gSystem->Load("libMySQL");
+   if (enable_opengl)            gSystem->Load("libRGL");
+   if (enable_oracle)            gSystem->Load("libOracle");
+   if (enable_pgsql)             gSystem->Load("libPgSQL");
+   if (enable_pythia)            gSystem->Load("libEGPythia");
+   if (enable_pythia6)           gSystem->Load("libEGPythia6");
+   if (enable_python)            gSystem->Load("libPyROOT");
+   if (enable_qt) {
+      gSystem->Load("libGQt");
+      gSystem->Load("libQtRoot");
+   }
+   if (enable_ruby)              gSystem->Load("libRuby");
+   if (enable_rfio)              gSystem->Load("libRFIO");
+   if (enable_sapdb)             gSystem->Load("libSapDB");
+   if (enable_srp)               gSystem->Load("libSRPAuth");
+   if (enable_table)             gSystem->Load("libTable");
+   if (enable_thread)            gSystem->Load("libThread");
+   if (enable_venus)             gSystem->Load("libEGVenus");
+   if (enable_xml)               gSystem->Load("libXMLParser");
+   if (enable_xrootd) {
+      gSystem->Load("libNetx.so");
+      gSystem->Load("libXrdOfs");
+      gSystem->Load("libXrdRootd");
+      gSystem->Load("libXrdSec.so");
+      if (enable_krb5) {
+         gSystem->Load("libXrdSeckrb4");
+         gSystem->Load("libXrdSeckrb5");
+      }
+   }
+
+   THtml html;
+   html.MakeAll();
+}
diff --git a/configure b/configure
index 6da636fc4cb..d21409ad95c 100755
--- a/configure
+++ b/configure
@@ -423,29 +423,63 @@ check_symbol() {
     # Check if we got a specific argument as to where the library
     # is to be found
     symbolfile=$symbollib
-    if test ! "x$symboldir" = "x" ; then
-        symbolfile=$symboldir/$symbollib
-        if test ! -r $symbolfile ; then
-            for i in .a .so .lib ; do
-                if test -r $symbolfile$i ; then
-                    symbolfile=$symbolfile$i
-                    break
+    exts=".so .lib"
+    if test ! "x$shared" = "xno" ; then
+	exts="$exts .a"
+    else
+	exts=".a $exts"
+    fi
+    for d in "$symboldir" /usr/lib ; do
+	if test ! -r $d/$symbollib ; then
+	    for i in $exts ; do
+		if test -r $d/$symbollib$i ; then
+		    symbolfile=$d/$symbollib$i
+		    break 2
                 fi
              done
         fi
-    fi
+    done
 
     if test "x$symbolfile" = "x" || test ! -r $symbolfile ; then
        found_symbol=0
        return 1
     fi
 
+    checking_msg "$symbol in $symbolfile"
     symbol_in_lib=`nm $symbolfile 2> /dev/stdout | grep $symbol > /dev/null 2>&1`
     if test $? -eq 0 ; then
         found_symbol=1
     else
+	nm $symbolfile 2> /dev/stdout | grep "no symbols" > /dev/null 2>&1
+	if test $? -eq 0 ; then
+	    # stripped library - only safe test is to link against the
+	    # library!  However, we do not know what compiler to use
+	    # so we can not do the test.  Assume the symbol is in
+	    cat <<EOF > conftest.mk
+include config/Makefile.${arch}
+conftest:conftest.c $symbolfile
+	\$(CC) \$(CFLAGS) \$(LDFLAGS) $symbolfile \$< -o \$@
+
+conftest.c:
+	echo "extern int $symbol (); " > \$@
+	echo "int main() { $symbol (); return 0; }" >> \$@
+EOF
+	    $gnumake -f conftest.mk > /dev/null 2>&1
+	    rm -rf conftest.c conftest.mk conftest
+	    if test $? -eq 0 ; then
+		found_symbol=1
+	    else
         found_symbol=0
     fi
+	else
+	    found_symbol=0
+	fi
+    fi
+    if test $found_symbol -eq 1 ; then
+	echo "ok"
+    else
+	echo "no"
+    fi
 }
 
 #_____________________________________________________________________
@@ -517,6 +551,10 @@ MIMEWIN32IN=config/mimes.win32.in
 MIMEOUT=etc/root.mimes
 ROOTDIN=config/rootd.in
 ROOTDOUT=etc/rootd
+ROOTHELPIN=config/root-help.el.in
+ROOTHELPOUT=build/misc/root-help.el
+HTMLIN=config/html.C.in
+HTMLOUT=macros/html.C
 
 ######################################################################
 #
@@ -726,6 +764,13 @@ hpuxia64acc)
    checkhpux64="yes" ;;
 esac
 
+case $platform in
+win32|linux|macosx)
+   gnumake="make" ;;
+*)
+   gnumake="gmake" ;;
+esac
+
 if test "x$platform" = "xmacosx" ; then
    finkdir=`which fink 2>&1 | sed -ne "s/\/bin\/fink//p"`
 fi
@@ -736,7 +781,7 @@ fi
 #
 trap "rm -f Makefile.tmp config.tmp root-config.tmp rootrc.tmp \
       rootauthrc.tmp rootdaemonrc.tmp memprobe.tmp rootd.tmp \
-      conftest.c conftest; exit 1" 1 2 3 15
+      conftest.mk conftest.c conftest; exit 1" 1 2 3 15
 
 ######################################################################
 #
@@ -2640,7 +2685,7 @@ if test ! "x$enable_clarens" = "xno" ; then
         clarenslibs=`xmlrpc-c-config curl-client --ldadd 2> /dev/null`
 	if test "x$clarensincdir" = "x" ; then
 	    clarensincdir=`xmlrpc-c-config --cflags 2> /dev/null`
-	    clarenslibdir=`xmlrpc-c-config --ldadd 2> /dev/null`
+	    clarenslibs=`xmlrpc-c-config --ldadd 2> /dev/null`
 	fi
     else
         clarensincdir=""
@@ -2714,9 +2759,9 @@ if test "x$show_pkglist" = "xyes" ; then
     test "x$enable_srp"     = "xyes" && pkglist="$pkglist root-plugin-srp"
     test "x$enable_venus"   = "xyes" && pkglist="$pkglist root-plugin-venus"
     test "x$enable_xml"     = "xyes" && pkglist="$pkglist root-plugin-xml"
-    test "x$enable_xrootd"  = "xyes" && pkglist="$pkglist root-xrootd"
+    test "x$enable_xrootd"  = "xyes" && pkglist="$pkglist root-xrootd root-plugin-netx"
 
-    pkglist="$pkglist root-plugin-fumili root-plugin-minuit root-plugin-mlp root-plugin-netx root-plugin-proof root-proofd root-plugin-quadp root-rootd root-cint root-doc libroot-dev root-bin libroot ttf-root ttf-root-installer"
+    pkglist="$pkglist root-plugin-fumili root-plugin-minuit root-plugin-mlp root-plugin-proof root-proofd root-plugin-quadp root-rootd root-cint root-doc libroot-dev root-bin libroot ttf-root ttf-root-installer"
     # If we're called from the package preparation script, then
     # print out the package list and exit
     echo "packages: $pkglist"
@@ -3212,12 +3257,32 @@ echo "done"
 #---------------------------------------------------------------------
 # build/misc/root-help.el
 #
-message "Writing build/misc/root-help.el"
+message "Writing $ROOTHELPOUT"
 sed -e "s|@bindir@|$bindir|"           \
     -e "s|@incdir@|$incdir|"           \
-    < config/root-help.el.in > build/misc/root-help.el
+    < $ROOTHELPIN > $ROOTHELPOUT
 echo "done"
 
+#---------------------------------------------------------------------
+# macros/html.C
+#
+message "Writing $HTMLOUT"
+sed_args=
+i=0
+for opt in $options; do
+   sed_args="${sed_args} -e s/@$opt@/"
+   if eval "test x$`eval echo $opt` = xyes"; then
+      sed_args="${sed_args}kTRUE"
+   else
+      sed_args="${sed_args}kFALSE"
+   fi
+   sed_args="${sed_args}/g"
+   # if test $i -eq 0 ; then break ; fi
+   let i=$i+1
+done
+sed $sed_args < $HTMLIN > $HTMLOUT
+echo done
+
 #---------------------------------------------------------------------
 # config.status
 #
@@ -3293,17 +3358,9 @@ fi
 
 echo "To build ROOT type:"
 echo ""
-if test "x$platform" = "xwin32" || test "x$platform" = "xlinux" ||
-   test "x$platform" = "xmacosx" ; then
-    echo "   make"
-    if test ! "x$haveconfig" = "x" ; then
-        echo "   make install"
-    fi
-else
-    echo "   gmake"
-    if test ! "x$haveconfig" = "x" ; then
-        echo "   gmake install"
-    fi
+echo "   $gnumake"
+if test ! "x$haveconfig" = "x" ; then
+    echo "   $gnumake install"
 fi
 echo ""
 
-- 
GitLab