swh:1:snp:af87cd67498ef4fe47c76ed3e7caffe5b61facaf
Raw File
Tip revision: 61a29734b74db7d5677d2f57ca30be9c81ffa6f4 authored by Unknown Author on 06 February 2002, 11:51:11 UTC
This commit was manufactured by cvs2svn to create tag 'v3-02-01'.
Tip revision: 61a2973
configure
#! /bin/sh

# Simple configure script.
#
# Authors: Christian Holm Christensen and Fons Rademakers


ARCHS=config/ARCHS
MAKEIN=config/Makefile.in
MAKEOUT=config/Makefile.config
CONFIN=config/config.in
CONFOUT=include/config.h
RCONFIN=config/root-config.in
RCONFOUT=bin/root-config
ROOTRCIN=config/rootrc.in
ROOTRCOUT=etc/system.rootrc
MEMPROBEIN=config/memprobe.in
MEMPROBEOUT=bin/memprobe
TMAKEIN=test/Makefile.in
TMAKEOUT=test/Makefile


if  `(echo "testing\c"; echo 1,2,3) | grep c > /dev/null` ; then
  if `(echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn > /dev/null`; then
    ac_n= ac_c='
' ac_t='	'
  else
    ac_n=-n ac_c= ac_t=
  fi
else
  ac_n= ac_c='\c' ac_t=
fi


confhelp() {
    echo "Usage:     $0 <architecture> [flag=value] "
    echo ""
    echo "   FLAG            DESCRIPTION               DEFAULT"
    echo "   --prefix        Installation prefix       (/usr/local)"
    echo "   --bindir        Binary installation dir   (<prefix>/bin)"
    echo "   --libdir        Library installation dir  (<prefix>/lib/root)"
    echo "   --incdir        Header installation dir   (<prefix>/include/root)"
    echo "   --mandir        Manpages installation dir (<prefix>/share/man/man1)"
    echo "   --etcdir        Config installation dir   (/etc/root)"
    echo "   --datadir       Data installation dir     (<prefix>/share/root)"
    echo "   --proofdir      PROOF utils dir           (<datadir>/proof)"
    echo "   --macrodir      Macro installation dir    (<datadir>/macros)"
    echo "   --cintincdir    CINT interpeted headers   (<datadir>/cint)"
    echo "   --iconpath      Icon installation dir     (<datadir>/icons)"
    echo "   --srcdir        Sources installation dir  (<datadir>/src)"
    echo "   --docdir        Documentation             (<prefix>/doc/root)"
    echo "   --testdir       Tests                     (<docdir>/test)"
    echo "   --tutdir        Tutorials                 (<docdir>/tutorial)"
    echo "   --build         Build configuration [debug, exception, ...],"
    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"
    echo "   rpath           Set library path on executables"
    echo "   thread          Thread support"
    echo "   star            Build STAR contrib library"
    echo "   ttf             True Type Font support, requires libtff"
    echo "   opengl          OpenGL support, requires libGL and libGLU"
    echo "   cern            CERNLIB usage, build h2root and g2root"
    echo "   mysql           MySQL support, requires libmysqlclient"
    echo "   pgsql           PostgreSQL support, requires libpq"
    echo "   sapdb           SapDB support, requires libsqlod and libsqlrte"
    echo "   rfio            SHIFT support, requires libshift.a from CERN"
    echo "   srp             SRP support, requires SRP source tree"
    echo "   afs             AFS support, requires AFS libs and objects"
    echo "   pythia          Pythia5 EG support, requires libPythia"
    echo "   pythia6         Pythia6 EG support, requires libPythia6"
    echo "   venus           Venus EG support, requires libVenus"
    echo "   soversion       Set version number in sonames"
    echo "with options, prefix with --with-, enables corresponding support"
    echo "   xpm-libdir      XPM support, path to libXpm"
    echo "   thread-libdir   Thread support, path to libpthread"
    echo "   ttf-incdir      TTF support, location of freetype.h"
    echo "   ttf-libdir      TTF support, location of libttf"
    echo "   ttf-fontdir     TTF support, location of TTF fonts"
    echo "   opengl-incdir   OpenGL support, location of GL/gl.h"
    echo "   opengl-libdir   OpenGL support, location of libGL"
    echo "   mysql-incdir    MySQL support, location of mysql.h"
    echo "   mysql-libdir    MySQL support, location of libmysqlclient"
    echo "   pgsql-incdir    PostgreSQL support, location of libpq-fe.h"
    echo "   pgsql-libdir    PostgreSQL support, location of libpq"
    echo "   sapdb-incdir    SapDB support, location of sql.h"
    echo "   sapdb-libdir    SapDB support, location of libsqlod"
    echo "   pythia-libdir   PYHTIA support, location of libPythia"
    echo "   pythia6-libdir  PYHTIA6 support, location of libPythia6"
    echo "   venus-libdir    VENUS support, location of libVenus"
    echo "   cern-libdir     HBOOK converter, location of CERNLIB libraries"
    echo "   shift-libdir    RFIO support, location of libshift"
    echo "   srp             Secure Remote Passwd support, location of SRP distribution"
    echo "   afs             AFS support, location of AFS distribution"
    echo "   sys-iconpath    Extra icon path"
    echo ""
    cat config/ARCHS
}

if [ $# -lt 1 ]; then
   echo "You must give architecture as first argument - try $0 --help"
   exit 1
else
   case $1 in
   -h|--help) confhelp ; exit 0 ;;
   *) arch1=$1
      if [ "$arch1" = "linuxegcs" ]; then
         arch1="linux"
      fi
      if `grep "^$arch1 " $ARCHS >/dev/null 2>&1` ; then
         arch=$arch1
         echo "Configuring for $arch"
         shift
      else
         echo "Invalid architecture. Try $0 --help"
         exit 1
      fi
      ;;
   esac
fi

trap "rm -f Makefile.tmp config.tmp root-config.tmp TMakefile.tmp rootrc.tmp \
      memprobe.tmp; exit 1" 1 2 3 15

cp -f $MAKEIN Makefile.tmp
cp -f $CONFIN config.tmp
cp -f $RCONFIN root-config.tmp
cp -f $TMAKEIN TMakefile.tmp
cp -f $ROOTRCIN rootrc.tmp
cp -f $MEMPROBEIN memprobe.tmp

if [ $# -gt 0 ]; then
   while [ "$1" != "" ]; do
      case "$1" in
      -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
      *) optarg= ;;
      esac

      case $1 in
      --help|-h) confhelp ;   exit 0 ;;
      ################################################################
      #
      # With options to specifiy third part software
      #
      --with-xpm-libdir=*)     xpmlibdir=$optarg     ;;
      --with-thread-libdir=*)  threadlibdir=$optarg  ; enable_thread="yes"  ;;
      --with-ttf-incdir=*)     ttfincdir=$optarg     ; enable_ttf="yes"     ;;
      --with-ttf-libdir=*)     ttflibdir=$optarg     ; enable_ttf="yes"     ;;
      --with-ttf-fontdir=*)    ttffontdir=$optarg    ; enable_ttf="yes"     ;;
      --with-opengl-incdir=*)  openglincdir=$optarg  ; enable_opengl="yes"  ;;
      --with-opengl-libdir=*)  opengllibdir=$optarg  ; enable_opengl="yes"  ;;
      --with-mysql-incdir=*)   mysqlincdir=$optarg   ; enable_mysql="yes"   ;;
      --with-mysql-libdir=*)   mysqllibdir=$optarg   ; enable_mysql="yes"   ;;
      --with-pgsql-incdir=*)   pgsqlincdir=$optarg   ; enable_pgsql="yes"   ;;
      --with-pgsql-libdir=*)   pgsqllibdir=$optarg   ; enable_pgsql="yes"   ;;
      --with-sapdb-incdir=*)   sapdbincdir=$optarg   ; enable_sapdb="yes"   ;;
      --with-sapdb-libdir=*)   sapdblibdir=$optarg   ; enable_sapdb="yes"   ;;
      --with-pythia-libdir=*)  pythialibdir=$optarg  ; enable_pythia="yes"  ;;
      --with-pythia6-libdir=*) pythia6libdir=$optarg ; enable_pythia6="yes" ;;
      --with-venus-libdir=*)   venuslibdir=$optarg   ; enable_venus="yes"   ;;
      --with-cern-libdir=*)    cernlibdir=$optarg    ; enable_cern="yes"    ;;
      --with-shift-libdir=*)   shiftlibdir=$optarg   ; enable_rfio="yes"    ;;
      --with-srp=*)            srpdir=$optarg        ; enable_srp="yes"     ;;
      --with-afs=*)            afsdir=$optarg        ; enable_afs="yes"     ;;
      --with-sys-iconpath=*)   extraiconpath=$optarg ;;
      ################################################################
      #
      # 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-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-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   ;;
      ################################################################
      #
      # Build steering option
      #
      --build=*)              rootbuild="ROOTBUILD      := $optarg"  ;;
      ################################################################
      #
      # Install path options
      #
      --prefix*)      haveconfig=-DHAVE_CONFIG ; prefix=$optarg      ;;
      --bindir=*)     haveconfig=-DHAVE_CONFIG ; bindir=$optarg      ;;
      --libdir=*)     haveconfig=-DHAVE_CONFIG ; libdir=$optarg      ;;
      --incdir=*)     haveconfig=-DHAVE_CONFIG ; incdir=$optarg      ;;
      --etcdir=*)     haveconfig=-DHAVE_CONFIG ; etcdir=$optarg      ;;
      --mandir=*)     haveconfig=-DHAVE_CONFIG ; mandir=$optarg      ;;
      --datadir=*)    haveconfig=-DHAVE_CONFIG ; datadir=$optarg     ;;
      --macrodir=*)   haveconfig=-DHAVE_CONFIG ; macrodir=$optarg    ;;
      --cintincdir=*) haveconfig=-DHAVE_CONFIG ; cintincdir=$optarg  ;;
      --iconpath=*)   haveconfig=-DHAVE_CONFIG ; iconpath=$optarg    ;;
      --srcdir=*)     haveconfig=-DHAVE_CONFIG ; srcdir=$optarg      ;;
      --docdir=*)     haveconfig=-DHAVE_CONFIG ; docdir=$optarg      ;;
      --testdir=*)    haveconfig=-DHAVE_CONFIG ; testdir=$optarg     ;;
      --tutdir=*)     haveconfig=-DHAVE_CONFIG ; tutdir=$optarg      ;;
      *)  echo "Invalid option. Try $0 --help" ; exit 1 ;;
      esac
      shift
   done
fi

######################################################################
#
# Sonames contain version numbers?
#
if [ "x$enable_soversion" = "xyes" ]; then
    major=`sed 's|\(.*\)\..*/.*|\1|' < build/version_number`
    minor=`sed 's|.*\.\(.*\)/.*|\1|' < build/version_number`
    revis=`sed 's|.*\..*/\(.*\)|\1|' < build/version_number`

    mkliboption="-v $major $minor $revis "
    unset major
    unset minor
    unset revis
fi

######################################################################
#
# XPM Library (Mandatory lib on Unix)
#
# Mandetory test, must succeed
# Check for Xpm library
#
if [ "$arch" != "win32" ]; then
    echo $ac_n "Checking for libXpm ... $ac_c"
    if [ "x$xpmlibdir" != "x" ]; then
        libdirs=$xpmlibdir
    else
        libdirs="$XPM $XPM/lib /usr/lib /usr/local/lib \
                    /usr/lib/X11 /usr/local/lib/X11 /usr/X11R6/lib \
                    /use/local/X11R6/lib /usr/X11/lib"
    fi
    xpmlib=no
    xpmdir=no
    if [ "x$enable_shared" != "xno" ]; then
        libs="libXpm.so libXpm.sl libXpm.a"
    else
        libs="libXpm.a"
    fi
    for i in $libdirs; do
        for j in ${libs} ; do
            if [  -r $i/$j ]; then
                xpmlibdir=$i
                xpmlib=$j
                break 2
            fi
        done
    done
    echo $xpmlibdir
    unset libs
    unset libdirs

    if [ "x$xpmlib" = "xno" ]; then
        echo "libXpm must be on the system - Aborting"
        exit 1
    fi

    if [ "x$enable_shared" = "xno" -o "x$xpmlib" = "xlibXpm.a" ]; then
        xpmlib=${xpmlibdir}/${xpmlib}
        unset xpmlibdir
    else
        xpmlib=`echo $xpmlib | sed 's|lib\(.*\)\..*|-l\1|'`
        xpmlibdir=-L${xpmlibdir}
    fi
fi

######################################################################
#
# Posix Thread Library
#
# Check for posix thread library
#
if [ "$arch" = "linux" -a "x$enable_thread" = "x" ]; then
   enable_thread="yes"
fi
if [ "x$enable_thread" = "xyes" -a "$arch" != "win32" ]; then
    echo $ac_n "Checking for libpthread ... $ac_c"
    if [ "x$threadlibdir" != "x" ]; then
        libdirs=$threadlibdir
    else
        libdirs="$THREAD $THREAD/lib /usr/lib /usr/local/lib \
                    /usr/lib/X11 /usr/local/lib/X11 /usr/X11R6/lib \
                    /usr/local/X11R6/lib /usr/X11/lib /usr/shlib"
    fi
    threadlib=no
    threadlibdir=no
    if [ "x$enable_shared" != "xno" ]; then
        libs="libpthread.so libpthread.sl libpthread.a"
    else
        libs="libpthread.a"
    fi
    for i in $libdirs; do
        for j in ${libs} ; do
            if [  -r $i/$j ]; then
                threadlibdir=$i
                threadlib=$j
                break 2
            fi
        done
    done
    echo $threadlibdir
    unset libs
    unset libdirs

    if [ "x$threadlib" = "xno" ]; then
        unset threadlib
        unset threadlibdir
        enable_thread="no"
    else
        if [ "x$enable_shared" = "xno" -o \
             "x$threadlib" = "xlibthread.a" ]; then
            threadlib=${threadlibdir}/${threadlib}
            unset threadlibdir
        else
            threadlib=`echo $threadlib | sed 's|lib\(.*\)\..*|-l\1|'`
            threadlibdir=-L${threadlibdir}
        fi
    fi
fi

######################################################################
#
# FreeType Support (Third party libraries)
#
# (see freetype.org)
#
if [ "x$enable_ttf" != "xno" -a "$arch" != "win32" ]; then
    # Check for FreeType TTF include, library and fonts
    echo $ac_n "Checking for freetype.h ... $ac_c"
    if [ "x$ttfincdir" != "x" ]; then
        # If the user gave an explicit path, then we check if it's correct.
        ttfincdirs=$ttfincdir
    else
        # Otherwise, we search some canonical paths
        ttfincdirs="$TTF $TTF/include /usr/include /usr/local/include \
                    /usr/include/freetype /usr/local/include/freetype \
                    /usr/freetype/include /usr/local/freetype/include \
                    /usr/freetype /usr/local/freetype /opt/freetype \
                    /opt/freetype/include /usr/local/ttf/include \
                    /opt/ttf/include"
    fi
    ttfincdir=no
    ttfheaders="freetype.h"
    for i in ${ttfincdirs}; do
        for j in ${ttfheaders}; do
            if [ -r $i/$j ]; then
                ttfincdir=$i
                break 2
            fi
        done
    done
    echo $ttfincdir
    unset ttfheaders
    unset ttfincdirs

    echo $ac_n "Checking for ttf library ... $ac_c"
    if [ "x$ttflibdir" != "x" ]; then
        # If the user gave an explixit path, then check it
        libdirs=$ttflibdir
    else
        # Otherwise, search canonical paths
        libdirs="$TTF $TTF/lib /usr/lib /usr/local/lib \
                 /usr/lib/freetype /usr/local/lib/freetype \
                 /usr/freetype/lib /usr/local/freetype/lib \
                 /usr/freetype /usr/local/freetype \
                 /opt/freetype /opt/freetype/lib \
                 /usr/local/ttf/lib /opt/ttf/lib"
    fi
    if [ "x$enable_shared" != "xno" ]; then
        libs="libttf.so libttf.sl libttf.a"
    else
        libs="libttf.a"
    fi
    ttflibdir=no
    for i in $libdirs; do
        for j in ${libs}; do
            if [ -r "$i/$j" ]; then
                ttflibdir=$i
                ttflib=$j
                break 2
            fi
        done
    done
    echo $ttflibdir
    unset libs
    unset libdirs

    echo $ac_n "Checking for ttf fonts (arial.ttf) ... $ac_c"
    if [ "x$ttffontdir" != "x" ]; then
        ttffontdirs=$ttffontdir
    else
        ttffontdirs="$TTF $TTF/fonts /usr/lib/X11/fonts \
                    /usr/lib/X11/fonts/ttf /usr/share /usr/share/fonts \
                    /usr/share/fonts/ttf /usr/share/ttf /usr/local/share \
                    /usr/local/share/fonts /usr/local/share/fonts/ttf \
                    /usr/local/share/ttf /opt/fonts /opt/fonts/ttf \
                    /opt/ttf /opt/ttf/fonts /usr/local/ttf/fonts"
    fi
    ttffontdir=no
    ttffonts=arial.ttf
    for i in $ttffontdirs; do
        for j in ${ttffonts}; do
            if [ -r "$i/$j" ]; then
                ttffontdir=$i
                break 2
            fi
        done
    done
    echo $ttffontdir
    unset ttffontdirs
    unset ttffonts

    # Give up if none of the above found
    if [ "x$ttflibdir"  = "xno" -o \
         "x$ttfincdir"  = "xno" -o \
         "x$ttffontdir" = "xno" ]; then
        enable_ttf="no"
        unset ttflibdir
        unset ttflib
        unset ttfincdir
        unset ttffontdir
    else
        if [ "x$enable_shared" = "xno" -o "x$ttflib" = "xlibttf.a" ]; then
            ttflib=${ttflibdir}/${ttflib}
            unset ttflibdir
        else
            ttflib=`echo $ttflib | sed 's|lib\(.*\)\..*|-l\1|'`
            ttflibdir=-L${ttflibdir}
        fi
        if [ "x$ttfincdir" = "x/usr/include" ]; then
            ttfincdir="include"
        fi
    fi
fi

######################################################################
#
# OpenGL Support (Third party libraries)
#
# (see mesa3dt.org)
#
if [ "x$enable_opengl" != "xno" -a "$arch" != "win32" ]; then
    # Check for Mesa OpenGL compatible include and library
    echo $ac_n "Checking for GL/gl.h ... $ac_c"
    if [ "x$openglincdir" != "x" ]; then
        openglincdirs=$openglincdir
    else
        openglincdirs="$OPENGL $OPENGL/include /usr/include \
                        /usr/include/X11 /usr/X11/include /usr/X11R6/include \
                        /usr/local/include/X11 /usr/local/X11R6/include \
                        /usr/local/include /usr/include/Mesa \
                        /usr/local/include/Mesa /usr/Mesa/include \
                        /usr/local/Mesa/include /usr/Mesa \
                        /usr/local/Mesa /opt/Mesa /opt/Mesa/include"
    fi
    openglincdir=no
    openglheaders="GL/gl.h"
    for i in $openglincdirs; do
        for j in ${openglheaders}; do
            if [ -r "$i/$j" ]; then
                openglincdir=$i
                break 2
            fi
        done
    done
    echo $openglincdir
    unset openglincdirs
    unset openglheaders

    echo $ac_n "Checking for libGL ... $ac_c"
    if [ "x$opengllibdir" != "x" ]; then
        libdirs=$opengllibdir
    else
        libdirs="$OPENGL $OPENGL/lib /usr/lib /usr/local/lib \
                        /usr/lib/X11 /usr/X11R6/lib \
                        /usr/local/lib/X11 /usr/local/X11R6/lib \
                        /usr/X11/lib /usr/lib/Mesa \
                        /usr/local/lib/Mesa /usr/Mesa/lib \
                        /usr/local/Mesa/lib /usr/Mesa /usr/local/Mesa \
                        /opt/Mesa /opt/Mesa/lib"
    fi
    if [ "x$enable_shared" != "xno" ]; then
        libs="libGL.so libGL.sl libMesaGL.so libMesaGL.sl libGL.a libMesaGL.a"
    else
        libs="libGL.a libMesaGL.a"
    fi
    opengllib=no
    opengllibdir=no
    for i in $libdirs; do
        for j in $libs; do
            if [ -r "$i/$j" ]; then
                opengllibdir=$i
                opengllib=$j
                break 2
            fi
        done
    done
    echo $opengllibdir
    unset libs

    echo $ac_n "Checking for libGLU ... $ac_c"
    if [ "x$enable_shared" != "xno" ]; then
        libs="libGLU.so libGLU.sl libMesaGLU.so libMesaGLU.sl libGLU.a \
              libMesaGLU.a"
    else
        libs="libGLU.a libMesaGLU.a"
    fi
    openglulib=no
    for i in $libdirs; do
        for j in $libs; do
            if [ -r "$i/$j" ]; then
                opengllibdir=$i
                openglulib=$j
                break 2
            fi
        done
    done
    echo $opengllibdir
    unset libs
    unset libdirs


    if [ "x$openglincdir" = "xno" -o \
         "x$opengllibdir" = "xno" -o \
         "x$openglulib" = "xno" ]; then
        enable_opengl="no"
        unset openglincdir
        unset opengllibdir
        unset opengllib
        unset openglulib
    else
        if [ "x$enable_shared" = "xno" ]; then
            opengllib=${opengllibdir}/${opengllib}
            openglulib=${opengllibdir}/${openglulib}
            unset opengllibdir
        else
            opengllib=`echo $opengllib | sed 's|lib\(.*\)\..*|-l\1|'`
            openglulib=`echo $openglulib | sed 's|lib\(.*\)\..*|-l\1|'`
            opengllibdir=-L${opengllibdir}
        fi
        if [ "x$openglincdir" = "x/usr/include" ]; then
            openglincdir="include"
        fi
    fi
fi

######################################################################
#
# OpenGL support on Windoze
#
# On win32 we always have OpenGL available (is this true?)
#
if [ "$arch" = "win32" ]; then
   enable_opengl="yes"
   openglincdir="include"
fi

######################################################################
#
# MySQL Support (Third party libraries)
#
# (See mysql.org)
#
# If the user has set the flags "--disable-mysql", we don't check for
# MySQL at all.
#
if [ "x$enable_mysql" != "xno" ]; then
# Check for MySQL include and library
    echo $ac_n "Checking for mysql.h ... $ac_c"
    if [ "x$mysqlincdir" != "x" ]; then
        # If the user has given an explict path, then we check to see if
        # the mysql.h header file really is where it's supposed to be.
        mysqlincdirs=$mysqlincdir
    else
        # Othewise, search canonical paths
        mysqlincdirs="$MYSQL $MYSQL/include /usr/include \
                    /usr/local/include /usr/include/mysql \
                    /usr/local/include/mysql /usr/mysql/include \
                    /usr/local/mysql/include /usr/mysql \
                    /usr/local/mysql /opt/mysql /opt/mysql/include"
    fi
    mysqlheaders="mysql.h"
    mysqlincdir=no
    for i in ${mysqlincdirs}; do
        for j in ${mysqlheaders}; do
            if [ -r "$i/$j" ]; then
                 mysqlincdir=$i
                 break 2
             fi
        done
    done
    echo $mysqlincdir
    unset mysqlincdirs
    unset mysqlheaders

    echo $ac_n "Checking for libmysqlclient ... $ac_c"
    if [ "x$mysqllibdir" != "x" ]; then
        # If the user gave an explicit path, check to see if the client
        # library really is where it's supposed to be
        libdirs=$mysqllibdir
    else
        libdirs="$MYSQL $MYSQL/lib /usr/lib /usr/local/lib \
                    /usr/lib/mysql /usr/local/lib/mysql /usr/mysql/lib \
                    /usr/local/mysql/lib /usr/mysql /usr/local/mysql \
                    /opt/mysql /opt/mysql/lib"
    fi
    # If the "--enable-shared" flag is set, we first look for the
    # shared library then the static one.
    if [ "x$enable_shared" != "xno" ]; then
        libs="libmysqlclient.so libmysqlclient.sl libmysqlclient.a \
              libmysqlclient.lib"
    else
        libs="libmysqlclient.a libmysqlclient.lib"
    fi
    mysqllibdir=no
    for i in $libdirs; do
        for j in ${libs} ; do
            if [ -r "$i/$j" ]; then
                mysqllibdir=$i
                mysqllib=$j
                break 2
            fi
        done
    done
    echo ${mysqllibdir}
    unset libdirs
    unset libs

    if [ "x$mysqlincdir" = "xno" -o "x$mysqllibdir" = "xno" ]; then
        unset mysqllib
        unset mysqlincdir
        unset mysqllibdir
        enable_mysql="no"
    else
        if [ "$arch" = "win32" ];then
            mysqllib=${mysqllibdir}/${mysqllib}
            unset mysqllibdir
        elif [ "x$enable_shared" = "xno" -o \
               "x$mysqllib" = "xlibmysqlclient.a" ]; then
            mysqllib=${mysqllibdir}/${mysqllib}
            unset mysqllibdir
        else
            mysqllib=`echo $mysqllib | sed 's|lib\(.*\)\..*|-l\1|'`
            mysqllibdir=-L${mysqllibdir}
        fi
        if [ "x$mysqlincdir" = "x/usr/include" ]; then
            mysqlincdir="include"
        fi
    fi
fi

######################################################################
#
# PostgreSQL Support (Third party libraries)
#
# (See postgresql.org)
#
# If the user has set the flags "--disable-pgsql", we don't check for
# PostgreSQL at all.
#
if [ "x$enable_pgsql" != "xno" ]; then
# Check for PgSQL include and library
    echo $ac_n "Checking for libpq-fe.h ... $ac_c"
    if [ "x$pgsqlincdir" != "x" ]; then
        # If the user has given an explict path, then we check to see if
        # the libpq-fe.h header file really is where it's supposed to be.
        pgsqlincdirs=$pgsqlincdir
    else
        # Othewise, search canonical paths
        pgsqlincdirs="$PGSQL $PGSQL/include /usr/include \
                    /usr/local/include /usr/local/pgsql/include \
                    /usr/include/pgsql /usr/pgsql/include \
                    /usr/local/include/pgsql /usr/pgsql \
                    /usr/local/pgsql /opt/pgsql /opt/pgsql/include"
    fi
    pgsqlheaders="libpq-fe.h"
    pgsqlincdir=no
    for i in ${pgsqlincdirs}; do
        for j in ${pgsqlheaders}; do
            if [ -r "$i/$j" ]; then
                 pgsqlincdir=$i
                 break 2
             fi
        done
    done
    echo $pgsqlincdir
    unset pgsqlincdirs
    unset pgsqlheaders

    echo $ac_n "Checking for libpq ... $ac_c"
    if [ "x$pgsqllibdir" != "x" ]; then
        # If the user gave an explicit path, check to see if the client
        # library really is where it's supposed to be
        libdirs=$pgsqllibdir
    else
        libdirs="$PGSQL $PGSQL/lib /usr/local/pgsql/lib /usr/local/lib \
                    /usr/lib/pgsql /usr/local/lib/pgsql /usr/pgsql/lib \
                    /usr/lib /usr/pgsql /usr/local/pgsql \
                    /opt/pgsql /opt/pgsql/lib"
    fi
    # If the "--enable-shared" flag is set, we first look for the
    # shared library then the static one.
    if [ "x$enable_shared" != "xno" ]; then
        libs="libpq.so libpq.sl libpq.a \
              libpq.lib"
    else
        libs="libpq.a libpq.lib"
    fi
    pgsqllibdir=no
    for i in $libdirs; do
        for j in ${libs} ; do
            if [ -r "$i/$j" ]; then
                pgsqllibdir=$i
                pgsqllib=$j
                break 2
            fi
        done
    done
    echo ${pgsqllibdir}
    unset libdirs
    unset libs

    if [ "x$pgsqlincdir" = "xno" -o "x$pgsqllibdir" = "xno" ]; then
        unset pgsqllib
        unset pgsqlincdir
        unset pgsqllibdir
        enable_pgsql="no"
    else
        if [ "$arch" = "win32" ];then
            pgsqllib=${pgsqllibdir}/${pgsqllib}
            unset pgsqllibdir
        elif [ "x$enable_shared" = "xno" -o \
               "x$pgsqllib" = "xlibpq.a" ]; then
            pgsqllib=${pgsqllibdir}/${pgsqllib}
            unset pgsqllibdir
        else
            pgsqllib=`echo $pgsqllib | sed 's|lib\(.*\)\..*|-l\1|'`
            pgsqllibdir=-L${pgsqllibdir}
        fi
        if [ "x$pgsqlincdir" = "x/usr/include" ]; then
            pgsqlincdir="include"
        fi
    fi
fi

######################################################################
#
# SapDB Support (Third party libraries)
#
# (See www.sapdb.org)
#
# If the user has set the flags "--disable-sapdb", we don't check for
# SapDB at all.
#
if [ "x$enable_sapdb" != "xno" ]; then
# Check for SapDB include and library
    echo $ac_n "Checking for sql.h ... $ac_c"
    if [ "x$sapdbincdir" != "x" ]; then
        # If the user has given an explict path, then we check to see if
        # the sql.h header file really is where it's supposed to be.
        sapdbincdirs=$sapdbincdir
    else
        # Othewise, search canonical paths
        sapdbincdirs="$SAPDB $SAPDB/include /opt/sapdb/interfaces/odbc/incl \
                      /usr/sapdb/interfaces/odbc/incl /usr/sapdb/include \
                      /usr/local/sapdb/interfaces/odbc/incl \
                      /usr/sapdb/web/incl /usr/include/sapdb \
                      /usr/local/include/sapdb /usr/local/sapdb/include \
                      /usr/local/sapdb/web/incl /usr/sapdb \
                      /usr/local/sapdb /opt/sapdb /opt/sapdb/include \
                      /opt/sapdb/web/incl"
    fi
    sapdbheaders="sql.h"
    sapdbincdir=no
    for i in ${sapdbincdirs}; do
        for j in ${sapdbheaders}; do
            if [ -r "$i/$j" ]; then
                 sapdbincdir=$i
                 break 2
             fi
        done
    done
    echo $sapdbincdir
    unset sapdbincdirs
    unset sapdbheaders

    echo $ac_n "Checking for libsqlod ... $ac_c"
    if [ "x$sapdblibdir" != "x" ]; then
        # If the user gave an explicit path, check to see if the client
        # library really is where it's supposed to be
        libdirs=$sapdblibdir
    else
        libdirs="$SAPDB $SAPDB/lib /opt/sapdb/interfaces/odbc/lib \
                 /usr/sapdb/interfaces/odbc/lib /usr/spadb/lib \
                 /usr/local/sapdb/interfaces/odbc/lib /usr/local/sapdb/lib \
                 /usr/lib/sapdb /usr/local/lib/sapdb /usr/sapdb/lib \
                 /usr/local/sapdb/lib /usr/sapdb /usr/local/sapdb \
                 /opt/sapdb /opt/sapdb/lib /usr/sapdb/web/lib \
                 /usr/local/sapdb/web/lib /opt/sapdb/web/lib"
    fi
    # If the "--enable-shared" flag is set, we first look for the
    # shared library then the static one.
    if [ "x$enable_shared" != "xno" ]; then
        libs="libsqlod.so libsqlod.sl libsqlod.a \
              libsqlod.lib"
    else
        libs="libsqlod.a libsqlod.lib"
    fi
    sapdblibdir=no
    for i in $libdirs; do
        for j in ${libs} ; do
            if [ -r "$i/$j" ]; then
                sapdblibdir=$i
                sapdblib=$j
                break 2
            fi
        done
    done
    echo ${sapdblibdir}
    unset libdirs
    unset libs

    if [ "x$sapdbincdir" = "xno" -o "x$sapdblibdir" = "xno" ]; then
        unset sapdblib
        unset sapdbincdir
        unset sapdblibdir
        enable_sapdb="no"
    else
        if [ "$arch" = "win32" ];then
            sapdblib="${sapdblibdir}/${sapdblib} ${sapdblibdir}/libsqlrte.lib"
            unset sapdblibdir
        elif [ "x$enable_shared" = "xno" -o \
               "x$sapdblib" = "xlibsqlod.a" ]; then
            sapdblib="${sapdblibdir}/${sapdblib} ${sapdblibdir}/libsqlrte.a"
            unset sapdblibdir
        else
            sapdblib1=`echo $sapdblib | sed 's|lib\(.*\)\..*|-l\1|'`
            sapdblib2=`echo libsqlrte.so | sed 's|lib\(.*\)\..*|-l\1|'`
            sapdblib="${sapdblib1} ${sapdblib2}"
            sapdblibdir=-L${sapdblibdir}
        fi
        if [ "x$sapdbincdir" = "x/usr/include" ]; then
            sapdbincdir="include"
        fi
    fi
fi

######################################################################
#
# CERNLIB Usage (Third party libraries)
#
# (See http://www.cern.ch)
#
# Check for CERN libs (libpacklib and libkernlib)
#
if [ "x$enable_cern" != "xno" ]; then
    echo $ac_n "Checking for libpacklib ... $ac_c"
    if [ "x${cernlibdir}" != "x" ]; then
        libdirs="$cernlibdir"
    else
        libdirs="$CERNLIB $CERNLIB/lib ${CERN}/${CERN_LEVEL}/lib \
                    /cern/pro/lib /cern/new/lib /cern/new/lib \
                    /opt/cern/pro/lib /opt/cern/new/lib /opt/cern/new/lib \
                    /usr/local/cern/pro/lib /usr/local/cern/new/lib \
                    /usr/local/cern/old/lib /usr/lib /usr/lib/cern"
    fi
    if [ "x$enable_shared" != "xno" ]; then
        libs="libpacklib.so libpacklib.sl libpacklib.a packlib.lib"
    else
        libs="libpacklib.a packlib.lib"
    fi
    cernlibdir=no
    for i in $libdirs; do
        for j in $libs; do
            if [ -r "$i/$j" ]; then
                cernlibdir=$i
                break 2
            fi
        done
    done
    echo $cernlibdir
    unset libs
    unset libdirs

    if [ "x$cernlibdir" = "xno" ]; then
        enable_cern="no"
        unset cernlibdir;
        unset cernlib
    else
        if [ "$arch" = "win32" ]; then
            cernlib="${cernlibdir}/packlib.lib ${cernlibdir}/kernlib.lib"
            unset cernlibdir
        elif [ "x$enable_shared" = "xno" ]; then
            cernlib="${cernlibdir}/libpacklib.a ${cernlibdir}/libkernlib.a"
            unset cernlibdir
        else
            cernlib="-lpacklib -lkernlib"
            cernlibdir=-L${cernlibdir}
        fi
    fi
fi

######################################################################
#
# Pythia5 Usage (Third party libraries)
#
# (See http://root.cern.ch and Lund)
#
# Check for libPythia
#
if [ "x$enable_pythia" != "xno" ]; then
    echo $ac_n "Checking for libPythia ... $ac_c"
    if [ "x$pythialibdir" != "x" ]; then
        libdirs=${pythialibdir}
    else
        libdirs="$PYTHIA $PYTHIA/lib /cern/pro/lib \
                /opt/pythia /opt/pythia5 \
                /usr/lib/pythia /usr/local/lib/pythia \
                /usr/lib/pythia5 /usr/local/lib/pythia5 \
                /usr/lib /usr/local/lib"
    fi
    if [ "x$enable_shared" != "xno" ]; then
        libs="libPythia.so libPythia.sl libPythia.a libPythia.lib"
    else
        libs="libPythia.a libPythia.lib"
    fi
    pythialib=no
    pythialibdir=no
    for i in $libdirs; do
        for j in $libs; do
            if [ -r "$i/$j" ]; then
                pythialibdir=$i
                pythialib=$j
                break 2
            fi
        done
    done
    echo $pythialibdir
    unset libs
    unset libdirs

    if [ "x$pythialibdir" = "xno" ]; then
        unset pythialib
        unset pythialibdir
        enable_pythia=no
    else
        if [ "$arch" = "win32" ]; then
            pythialib=${pythialibdir}/${pythialib}
            unset pythialibdir
        elif [ "x$enable_shared" = "xno" ]; then
            pythialib=${pythialibdir}/${pythialib}
            unset pythialibdir
        else
            pythialib=`echo $pythialib | sed 's|lib\(.*\)\..*|-l\1|'`
            pythialibdir=-L${pythialibdir}
        fi
    fi
fi

######################################################################
#
# Pythia6  Usage (Third party libraries)
#
# (See http://root.cern.ch and Lund)
#
# Check for libPythia6
#
if [ "x$enable_pythia6" != "xno" ]; then
    echo $ac_n "Checking for libPythia6 ... $ac_c"
    if [ "x$pythia6libdir" != "x" ]; then
        libdirs=${pythia6libdir}
    else
        libdirs="$PYTHIA6 $PYTHIA6/lib /cern/pro/lib \
                /opt/pythia /opt/pythia6 \
                /usr/lib/pythia /usr/local/lib/pythia \
                /usr/lib/pythia6 /usr/local/lib/pythia6 \
                /usr/lib /usr/local/lib"
    fi
    if [ "x$enable_shared" != "xno" ]; then
        libs="libPythia6.so libPythia6.sl libPythia6.a libPythia6.lib"
    else
        libs="libPythia6.a libPythia6.lib"
    fi
    pythia6lib=no
    pythia6libdir=no
    for i in $libdirs; do
        for j in $libs; do
            if [ -r "$i/$j" ]; then
                pythia6libdir=$i
                pythia6lib=$j
                break 2
            fi
        done
    done
    echo $pythia6libdir
    unset libs
    unset libdirs

    if [ "x$pythia6libdir" = "xno" ]; then
        unset pythia6lib
        unset pythia6libdir
        enable_pythia6=no
    else
        if [ "$arch" = "win32" ]; then
            pythia6lib=${pythia6libdir}/${pythia6lib}
            unset pythia6libdir
        elif [ "x$enable_shared" = "xno" ]; then
            pythia6lib=${pythia6libdir}/${pythia6lib}
            unset pythia6libdir
        else
            pythia6lib=`echo $pythia6lib | sed 's|lib\(.*\)\..*|-l\1|'`
            pythia6libdir=-L${pythia6libdir}
        fi
    fi
fi


######################################################################
#
# Venus  Usage (Third party libraries)
#
# (See http://root.cern.ch)
#
# Check for libVenus
#
if [ "x$enable_venus" != "xno" ]; then
    echo $ac_n "Checking for libVenus ... $ac_c"
    if [ "x$venuslibdir" != "x" ]; then
        libdirs=${venuslibdir}
    else
        libdirs="$VENUS $VENUS/lib /cern/pro/lib \
                /opt/venus /usr/lib/venus /usr/local/lib/venus \
                /usr/lib /usr/local/lib"
    fi
    if [ "x$enable_shared" != "xno" ]; then
        libs="libVenus.so libVenus.sl libVenus.a libVenus.lib"
    else
        libs="libVenus.a libVenus.lib"
    fi
    venuslib=no
    venuslibdir=no
    for i in $libdirs; do
        for j in $libs; do
            if [ -r "$i/$j" ]; then
                venuslibdir=$i
                venuslib=$j
                break 2
            fi
        done
    done
    echo $venuslibdir
    unset libs
    unset libdirs

    if [ "x$venuslibdir" = "xno" ]; then
        unset venuslib
        unset venuslibdir
        enable_venus=no
    else
        if [ "$arch" = "win32" ]; then
            venuslib=${venuslibdir}/${venuslib}
            unset venuslibdir
        elif [ "x$enable_shared" = "xno" ]; then
            venuslib=${venuslibdir}/${venuslib}
            unset venuslibdir
        else
            venuslib=`echo $venuslib | sed 's|lib\(.*\)\..*|-l\1|'`
            venuslibdir=-L${venuslibdir}
        fi
    fi
fi

######################################################################
#
# SHIFT Support (Third party libraries)
#
# (See http://www.cern.ch)
#
# Check for libshift.a
#
if [ "x$enable_rfio" != "xno" ]; then
    echo $ac_n "Checking for libshift ... $ac_c"
    if [ "x$shiftlibdir" != "x" ]; then
        libdirs=$shiftlibdir
    else
        libdirs="$RFIO $RFIO/lib /cern/pro/lib /cern/new/lib /cern/old/lib \
                    /opt/shift/lib /usr/local/shift/lib /usr/lib/shift \
                    /usr/local/lib/shift /usr/lib /usr/local/lib"
    fi
    if [ "x$enable_shared" != "xno" ]; then
        libs="libshift.so libshift.sl libshift.a shift.lib"
    else
        libs="libshift.a shift.lib"
    fi
    shiftlibdir="no"
    shiftlib="no"
    for i in $libdirs ; do
        for j in $libs; do
            if [ -r "$i/$j" ]; then
                shiftlibdir=$i
                shiftlib=$j
                break 2
            fi
        done
    done
    echo $shiftlibdir
    unset libdirs
    unset libs

    if [ "x$shiftlib" = "xno" ]; then
        enable_rfio="no"
        unset shiftlibdir
        unset shiftlib
    else
        if [ "$arch" = "win32" ]; then
            shiftlib=${shiftlibdir}/${shiftlib}
            unset shiftlibdir
        elif [ "x$enable_shared" = "xno" ]; then
            shiftlib=${shiftlibdir}/${shiftlib}
            unset shiftlibdir
        else
            shiftlib=`echo $shiftlib | sed 's|lib\(.*\)\..*|-l\1|'`
            shiftlibdir=-L${shiftlibdir}
        fi
    fi
    if [ "x$enable_rfio" != "xno" ]; then
        case $arch in
           linux*) shiftlib="$shiftlib -lnsl" ;;
        esac
    fi
fi

######################################################################
#
# SRP Support (Third party libraries)
#
# (see  http://srp.stanford.edu/srp)
# Note: You can not make do with the libsrp package. You need the full
# source for this add-on.
#
# Check for SRP (libsrp.a)
#
if [ "x$enable_srp" != "xno" ]; then
    echo $ac_n "Checking for SRP (libsrp.a)... $ac_c"
    if [ "x$srpdir" != "x" ]; then
        srpdirs="$srpdir/lib"
    else
        srpdirs="$SRP/lib /usr/srp/lib /usr/local/srp/lib \
                 /usr/lib/srp /usr/local/lib/srp /usr/lib /usr/local/lib"
    fi
    libs="libsrp.a"
    srpdir=no
    for i in $srpdirs; do
        for j in ${libs}; do
            if [ -r "$i/$j" ]; then
                srpdir=`echo $i | sed 's|^\(.*\)/lib$|\1|'`
                break 2
            fi
        done
    done
    echo $srpdir
    unset srpdirs
    unset libs

    if [ "x$srpdir" = "xno" ]; then
        enable_srp="no"
        unset srpdir
    fi
fi

######################################################################
#
# AFS Support (Third party libraries)
#
# (See http://oss.software.ibm.com/developerworks/opensource/afs )
#
# Check for AFS (libdes.a)
#
if [ "x$enable_afs" = "xyes" ]; then
    echo $ac_n "Checking for AFS (libdes.a)... $ac_c"
    if [ "x$afsdir" != "x" ]; then
        afsdirs="$afsdir/lib"
    else
        afsdirs="$AFS/lib /usr/afsws/lib /usr/local/afsws/lib \
                    /usr/athena/lib /usr/local/athena/lib \
                    /opt/afs/lib /usr/local/afs"
    fi
    afsdir=no
    libs="libdes.a"
    for i in $afsdirs; do
        for j in ${libs}; do
            if [ -r "$i/$j" ]; then
                afsdir=`echo $i | sed 's|^\(.*\)/lib$|\1|'`
                break 2
            fi
        done
    done
    echo $afsdir
    unset afsdirs
    unset libs

    if [ "x$afsdir" = "xno" ]; then
        enable_afs="no"
        unset afsdir
    fi
fi

######################################################################
#
# STAR Library (Contributed library)
#
if [ "x$enable_star" = "xyes" -o "$STAR" ]; then
    enable_star="1"
    echo "Building libStar ... yes"
else
    enable_star=""
fi

######################################################################
#
# Create needed directories
#
if [ ! -d include ]; then
   echo $ac_n "Creating include ... $ac_c"
   mkdir include
   echo "done"
fi
if [ ! -d bin ]; then
    echo $ac_n "Creating bin ... $ac_c"
    mkdir bin
    echo "done"
fi
if [ ! -d lib ]; then
    echo $ac_n "Creating lib ... $ac_c"
    mkdir lib
    echo "done"
fi

######################################################################
#
# Cleanup obsolete links and files
#
if [ -h opengl ]; then
   rm -f opengl
fi
if [ -h ttf ]; then
   rm -f ttf
fi
if [ -f system.rootrc ]; then
   rm -f system.rootrc
fi

######################################################################
#
# Fleshin out paths
#
# First win32 does not support -L in ldflags, so remove @ldflags@.
#
if [ "$arch" = "win32" ]; then
    sed -e "s|@ldflags@||"        \
        < Makefile.tmp > Makefile.tmpp
    mv Makefile.tmpp Makefile.tmp
fi

if [ -n "$haveconfig" ]; then
    ##################################################################
    #
    # Static directory build.
    #
    if [ -z "$prefix" ];       then prefix=/usr/local; fi
    if [ -z "$bindir" ];       then bindir=$prefix/bin; fi
    if [ -z "$libdir" ];       then libdir=$prefix/lib/root; fi
    if [ -z "$incdir" ];       then incdir=$prefix/include/root; fi
    if [ -z "$etcdir" ];       then etcdir=/etc/root; fi
    if [ -z "$mandir" ];       then mandir=$prefix/share/man/man1; fi
    if [ -z "$datadir" ];      then datadir=$prefix/share/root; fi
    if [ -z "$proofdir" ];     then proofdir=$datadir/proof; fi
    if [ -z "$macrodir" ];     then macrodir=$datadir/macros; fi
    if [ -z "$cintincdir" ];   then cintincdir=$datadir/cint; fi
    if [ -z "$iconpath" ];     then iconpath=$datadir/icons; fi
    if [ -z "$srcdir" ];       then srcdir=$datadir/src; fi
    if [ -z "$ttflibdir" ];    then ttflibdir=$libdir; fi
    if [ -z "$ttffontdir" ];   then ttffontdir=$datadir/fonts; fi
    if [ -z "$docdir" ];       then docdir=$prefix/doc/root; fi
    if [ -z "$testdir" ];      then testdir=$docdir/test; fi
    if [ -z "$tutdir" ];       then tutdir=$docdir/tutorials; fi

    sed -e "s|@useconfig@|TRUE|"                       \
        -e "s|@cflags@|-DHAVE_CONFIG|"                  \
                < Makefile.tmp > Makefile.tmpp
    mv Makefile.tmpp Makefile.tmp

    if [ "x$enable_rpath" = "xyes" ]; then
        sed -e "s|@ldflags@|-Wl,-rpath,$libdir @ldflags@|" \
                < Makefile.tmp > Makefile.tmpp
        mv Makefile.tmpp Makefile.tmp
    fi
else
    ##################################################################
    #
    # Environment driven build. Escape sequences very important
    #
    prefix=\$\(ROOTSYS\)
    bindir=\$\(ROOTSYS\)/bin
    libdir=\$\(ROOTSYS\)/lib
    incdir=\$\(ROOTSYS\)/include
    etcdir=\$\(ROOTSYS\)/etc
    datadir=\$\(ROOTSYS\)
    mandir=\$\(ROOTSYS\)/man/man1
    proofdir=\$\(ROOTSYS\)/proof
    macrodir=\$\(ROOTSYS\)/macros
    cintincdir=\$\(ROOTSYS\)/cint
    iconpath=\$\(ROOTSYS\)/icons
    srcdir=\$\(ROOTSYS\)/src
    docdir=\$\(ROOTSYS\)
    testdir=\$\(ROOTSYS\)/test
    tutdir=\$\(ROOTSYS\)/tutorials

    sed -e "s|@useconfig@|FALSE|" \
        -e "s|@cflags@||"         \
        -e "s|@ldflags@||"        \
        < Makefile.tmp > Makefile.tmpp
    mv Makefile.tmpp Makefile.tmp
fi

######################################################################
#
# Writing files
#
#---------------------------------------------------------------------
# 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|@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|@srpdir@|$srpdir|"               \
    -e "s|@afsdir@|$afsdir|"               \
    -e "s|@pythialibdir@|$pythialibdir|"   \
    -e "s|@pythialib@|$pythialib|"         \
    -e "s|@pythia6libdir@|$pythia6libdir|" \
    -e "s|@pythia6lib@|$pythia6lib|"       \
    -e "s|@venuslibdir@|$venuslibdir|"     \
    -e "s|@venuslib@|$venuslib|"           \
    < Makefile.tmp > $MAKEOUT
rm -f Makefile.tmp
echo "done"

#---------------------------------------------------------------------
# test/Makefile
#
echo $ac_n "Writing $TMAKEOUT ... $ac_c"
sed -e "s|@architecture@|$arch|"         \
    < TMakefile.tmp > $TMAKEOUT
rm -f TMakefile.tmp
echo "done"

#---------------------------------------------------------------------
# include/config.h
#
echo $ac_n "Writing $CONFOUT ... $ac_c"
sed -e "s|@architecture@|$arch|"           \
    -e "s|@prefix@|$prefix|"               \
    -e "s|@bindir@|$bindir|"               \
    -e "s|@libdir@|$libdir|"               \
    -e "s|@incdir@|$incdir|"               \
    -e "s|@etcdir@|$etcdir|"               \
    -e "s|@datadir@|$datadir|"             \
    -e "s|@macrodir@|$macrodir|"           \
    -e "s|@cintincdir@|$cintincdir|"       \
    -e "s|@iconpath@|$iconpath|"           \
    -e "s|@srcdir@|$srcdir|"               \
    -e "s|@ttffontdir@|$ttffontdir|"       \
    -e "s|@ttflibdir@|$ttflibdir|"         \
    -e "s|@extraiconpath@|$extraiconpath|" \
    < config.tmp > $CONFOUT
rm -f config.tmp
echo "done"

#---------------------------------------------------------------------
# bin/root-config
#
echo $ac_n "Writing $RCONFOUT ... $ac_c"
prefix2=$prefix
incdir2=$incdir
libdir2=$libdir
if [ "$prefix2" = "\$(ROOTSYS)" ]; then
    prefix2=\$ROOTSYS
    libdir2=\$ROOTSYS/lib
    incdir2=\$ROOTSYS/include
fi
sed -e "s|@architecture@|$arch|"           \
    -e "s|@prefix@|$prefix2|"              \
    -e "s|@incdir@|$incdir2|"              \
    -e "s|@libdir@|$libdir2|"              \
   < root-config.tmp > $RCONFOUT
rm -f root-config.tmp
chmod 755 $RCONFOUT
echo "done"

#---------------------------------------------------------------------
# etc/system.rootrc
#
echo $ac_n "Writing $ROOTRCOUT ... $ac_c"
if [ "$ttffontdir" = "$HOME/ttf" ]; then
   ttffontdir=\$\(HOME\)/ttf
fi
if [ "$ttffontdir" = "$HOME/ttf/fonts" ]; then
   ttffontdir=\$\(HOME\)/ttf/fonts
fi
sed -e "s|@libdir@|$libdir|"               \
    -e "s|@macrodir@|$macrodir|"           \
    -e "s|@bindir@|$bindir|"               \
    -e "s|@ttffontdir@|$ttffontdir|"       \
    -e "s|@iconpath@|$iconpath|"           \
   < rootrc.tmp > $ROOTRCOUT
rm -f rootrc.tmp
echo "done"

#---------------------------------------------------------------------
# bin/memprobe
#
echo $ac_n "Writing $MEMPROBEOUT ... $ac_c"
if [ -x /usr/bin/env ]; then
   perlexe="/usr/bin/env perl"
else
   perlexe=`which perl`
fi
sed -e "s|@perl@|$perlexe|"                \
   < memprobe.tmp > $MEMPROBEOUT
rm -f memprobe.tmp
chmod 755 $MEMPROBEOUT
echo "done"

######################################################################
#
# FAT conversion in test/tutorials
#
# On win32 convert all files in tutorials and test to \r\n convention
# (only if CVS directory does not exist, otherwise cvs will already
# have made the conversion).
#
if [ "$arch" = "win32" ] && [ ! -d CVS ]; then
   echo $ac_n "Converting files in tutorials and test to DOS format ... $ac_c"
   for i in tutorials/*.C tutorials/*.sql test/*.cxx test/*.h \
            test/Makefile* test/README etc/system.rootrc
   do
      sed 's/$//' $i > r__tmp
      touch -r $i r__tmp
      mv -f r__tmp $i
   done
   echo "done"
fi

######################################################################
#
# Warning about recommended build options
#
echo ""
if [ "x$enable_$ttf" = "xno" -o "x$enable_opengl" = "xno" ]; then
    if [ "x$enable_$ttf" = "xno" -a "$arch" != "win32" ]; then
        echo "To build the ROOT TrueType font add-on library see README/INSTALL."
    fi
    if [ "x$enable_opengl" = "xno" ]; then
        echo "To build the ROOT OpenGL add-on library see README/INSTALL."
    fi
    echo ""
    echo ""
fi

######################################################################
#
# Final instructions
#
# List the possible Makefiles
#
echo "To build ROOT type:"
echo ""
echo "   gmake"
echo "   gmake install"
echo ""

exit 0
back to top