Skip to content
Snippets Groups Projects
configure 50.6 KiB
Newer Older
#! /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
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 "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
      if [ "$arch" = "win32" -o "$arch" = "win32gdk" ]; then
         platform="win32"
      else
         platform=$arch
      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 $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

######################################################################
#
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

######################################################################
#
# XPM Library (Mandatory lib on Unix)
#
# Mandetory test, must succeed
# Check for Xpm library
#
if [ "$platform" != "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
        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

######################################################################
#
# Posix Thread Library
#
# Check for posix thread library
#
if [ "$arch" = "linux" -a "x$enable_thread" = "x" ]; then
if [ "x$enable_thread" = "xyes" -a "$platform" != "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"
    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
        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

######################################################################
#
# FreeType Support (Third party libraries)
#
# (see freetype.org)
#
if [ "x$enable_ttf" != "xno" -a "$platform" != "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 /usr/include/freetype1/freetype"
    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
    echo $ac_n "Checking for libttf ... $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
        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
        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 \
        enable_ttf="no"
        unset ttflibdir
        unset ttflib
        unset ttfincdir
        unset ttffontdir
        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

######################################################################
#
# OpenGL Support (Third party libraries)
#
# (see mesa3dt.org)
if [ "x$enable_opengl" != "xno" -a "$platform" != "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
        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
        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
######################################################################
#
# OpenGL support on Windoze
#
# On win32 we always have OpenGL available (is this true?)
#
if [ "$platform" = "win32" ]; then
   enable_opengl="yes"
   openglincdir="include"
######################################################################
#
# 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
    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
Fons Rademakers's avatar
Fons Rademakers committed
    # 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
    unset libdirs
    if [ "x$mysqlincdir" = "xno" -o "x$mysqllibdir" = "xno" ]; then
        unset mysqllib
        unset mysqlincdir
        unset mysqllibdir
        enable_mysql="no"
    else
        if [ "$platform" = "win32" ];then
Fons Rademakers's avatar
Fons Rademakers committed
            mysqllib=${mysqllibdir}/${mysqllib}
        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
######################################################################
#
# 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 [ "$platform" = "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
######################################################################
#
# 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 [ "$platform" = "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 [ "$platform" = "win32" ]; then
Fons Rademakers's avatar
Fons Rademakers committed
            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
######################################################################
#
# Pythia5 Usage (Third party libraries)
#
# (See http://root.cern.ch and Lund)
#
#
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 [ "$platform" = "win32" ]; then
Fons Rademakers's avatar
Fons Rademakers committed
            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
######################################################################
#
# Pythia6  Usage (Third party libraries)
#