Skip to content
Snippets Groups Projects
configure 85.7 KiB
Newer Older
# A (not so) simple configure script.
#
# Authors: Christian Holm Christensen and Fons Rademakers
#
# To help with debugging the script, some comments are preprended with
# 3 '#' echo and 3 '%' - replace that pattern with echo and 3 '%' to
# get printouts.  When done replace the pattern echo and 3 '%' with the
# original pattern of 3 '#' echo and 3 '%'.  Emacs command M-C-% does
# this easily.
#
######################################################################
#
### echo %%% Some global variables
#
found_lib=no
found_dir=no
found_hdr=no
Fons Rademakers's avatar
Fons Rademakers committed
nohowto="no"
options="                 \
   enable_afs             \
   enable_alien           \
   enable_asimage         \
   enable_cern            \
   enable_chirp           \
   enable_dcache          \
   enable_exceptions      \
   enable_explicitlink    \
   enable_globus          \
   enable_krb5            \
   enable_ldap            \
   enable_mysql           \
   enable_opengl          \
   enable_openiv          \
   enable_pgsql           \
   enable_pythia          \
   enable_pythia6         \
   enable_qt              \
   enable_rfio            \
   enable_rpath           \
   enable_sapdb           \
   enable_shadowpw        \
   enable_shared          \
   enable_soversion       \
   enable_srp             \
   enable_table           \
   enable_thread          \
   enable_venus           \
"

#
# This sets all options to "yes" - we turn off those we don't want
# on per default explictly afterwards.
#
for c in $options ; do eval $c="yes" ; done

enable_table=no
enable_thread=           # must be set explicitely via --enable-thread
#
# ./configure arguments and defaults set via supported env vars
#
envvars="
THREAD           \
OPENGL           \
IVROOT           \
MYSQL            \
PGSQL            \
QTDIR            \
SAPDB            \
RFIO             \
CERNLIB          \
PYTHIA           \
PYTHIA6          \
VENUS            \
DCACHE           \
CHIRP            \
ALIEN            \
ASIMAGE          \
LDAP             \
GLOBUS_LOCATION  \
SRP              \
AFS              \
TABLE            \
"
configenvvars=
for c in $envvars ; do
   cc=`eval echo "$"$c`
   if test ! "x$cc" = "x" ; then
      if test ! "x$configenvvars" = "x" ; then
         configenvvars="$configenvvars $c=$cc"
      else
         configenvvars="$c=$cc"
      fi
   fi
done
Fons Rademakers's avatar
Fons Rademakers committed
# don't write --nohowto to config.h
configargs=`echo $configargs|sed 's, *--nohowto,,g'`

configoptions=
if test ! "x$configenvvars" = "x" ; then
   configoptions=$configenvvars
fi
if test ! "x$configargs" = "x" ; then
   if test ! "x$configoptions" = "x" ; then
      configoptions="$configoptions $configargs"
   else
      configoptions=$configargs
   fi
fi

######################################################################
#
### echo %%% Some common functions
#
#_____________________________________________________________________
message() {
    # Write a simple message to std out
    if test $# -lt 1 ; then
	echo "message: Too few arguments"
	return 1
    fi
    echo $ac_n "$* ... $ac_c"
}

#_____________________________________________________________________
checking_msg() {
    # Write a simple "checking" message to std out.
    if test $# -lt 1 ; then
	echo "checking_msg: Too few arguments"
	return 1
    fi
    echo $ac_n "Checking for$ac_c"
    while test $# -gt 1  ; do
	echo $ac_n " $1,$ac_c"
	shift
	if test $# -eq 1 ; then
	    echo $ac_n " or$ac_c"
	fi
    done
    echo $ac_n " $1 ... $ac_c"
}
#_____________________________________________________________________
check_library() {
    # This function will try to locate a library [$1] in the specific
    # directory [$3] or in a default path [$*].  If the second argument
    # [$2] is not "no", then shared libraries are favoured.
    # The result of the search is stored in found_lib and found_dir,
    # which should be immediately copied, since the variables value will
    # be overwritten at next invocation of this function.

    # Assert that we got enough arguments
    if test $# -lt 4 ; then
	echo "check_library: Too few arguments"
	return 1
    fi

    libdirs="$*"

    # Write a message
    checking_msg $lib

    # check if we got a specific argument as to where the library
    # is to be found
    if test ! "x$libdirl" = "x" ; then
        libdirs=$libdirl
    fi
    found_lib=no
    found_dir=no

    # Make list of libraries to search for. The .lib extension is for
    # Windoze - note $shared is always "no" on windoze, since we need
    # the .lib export library to link.
    libs=""
    for i in $lib ; do
	for ext in .a .lib "" ; do     # lib without extension for MacOS X
    slibs=""
    for i in $lib ; do
        for ext in .so .sl .dylib .dll.a ; do      # .dll.a for cygwin gcc
            slibs="$slibs $i$ext"
        done
    done
    if test ! "x$shared" = "xno" ; then
	libs="$slibs $libs"
    fi

    # Loop over the list of possible directories, and see if we can
    # find any of the library files as determind above.
        # look first in the lib32 directories
        if test "x$checklib32" = "xyes" ; then
            i32=`echo $i | sed 's|lib*|lib32|'`
            i="$i32 $i"
        fi
        # look first in the lib64 directories
        if test "x$checklib64" = "xyes" ; then
            i64=`echo $i | sed 's|lib*|lib64|'`
            i="$i64 $i"
        fi
        for l in $i ; do
            for j in ${libs} ; do
	        # if we found the file (it's readable by user), we set the
	        # logical variables and are on our way, otherwise we continue
                liblist=`echo $l/$j`    # expands wildcard in $l/$j
                for n in ${liblist} ; do
                        found_dir=$l
                        found_lib=$j
                        break 4
                    fi
                done
    # skip cygwin libraries when in pure Win32 mode
    if test "x$platform" = "xwin32"; then
        case $found_dir in
           /lib|/usr/*) found_dir="no" ;;
        esac
    fi

    echo $found_dir
    unset libs
    unset slibs
    unset libdirs

    if test "x$found_dir" = "xno" || test "$found_lib" = "xno" ; then
	found_dir=""
	found_lib=""
    else
	flib=""
	for i in $lib ; do
	    for ext in .a .lib "" ; do     # lib without extension for MacOS X
		if test "x$found_lib" = "x$i$ext" ; then
		    flib=$i$ext
		fi
	    done
	done
	if test "x$found_lib" = "x$flib" ; then
	    found_lib=${found_dir}/${found_lib}
	    found_dir=""
	else
	    found_lib=`echo $found_lib | sed 's|^lib\(.*\)\..*|-l\1|'`
	    found_dir=-L${found_dir}
            # Avoid inclusion of /usr/lib, which is always included anyway
            if test "x$found_dir" = "x-L/usr/lib"   || \
               test "x$found_dir" = "x-L/usr/lib32" || \
               test "x$found_dir" = "x-L/usr/lib64" ; then

        # Correct path for win32
        if test "x$platform" = "xwin32"; then
            if test ! "x$found_lib" = "x" ; then
                found_lib=`cygpath -m $found_lib`
            fi
            if test ! "x$found_dir" = "x" ; then
               found_dir=`cygpath -m $found_dir`
            fi
        fi
#_____________________________________________________________________
check_header()  {
    # This function will try to locate a header [$1] in the specific
    # directory [$2] or in a default path [$*].
    # The result of the search is stored in found_hdr and found_dir,
    # which should be immediately copied, since the variables value will
    # be overwritten at next invocation of this function.

    # Assert that we got enough arguments
    if test $# -lt 3 ; then
	echo "check_header: Too few arguments"
	return 1
    fi

    # Save arguments in logical names
    hdrs=$1     ; shift
    hdrdir=$1   ; shift
    hdrdirs="$*"

    # Write a message
    checking_msg $hdrs

    # Check if we got a specific argument as to where the library
    # is to be found
    if test ! "x$hdrdir" = "x" ; then
        hdrdirs=$hdrdir
    fi
    found_hdr=no
    found_dir=no

    # Loop over the list of possible directories, and see if we can
    # find any of the library files as determind above.
    for i in $hdrdirs; do
        for j in ${hdrs} ; do
	    # if we found the file (it's readable by user), we set the
	    # logical variables and are on our way, otherwise we continue
            if test -r $i/$j ; then
                found_dir=$i
                found_hdr=$j
                break 2
            fi
        done
    done

    # skip cygwin headers when in pure Win32 mode
    if test "x$platform" = "xwin32"; then
        case $found_dir in
           /usr/*) found_dir="no" ;;
        esac
    fi

    echo $found_dir

    if test "x$found_hdr" = "xno" || test "$found_dir" = "xno" ; then
	found_hdr=""
	found_dir=""
    fi

    # Avoid inclusion of /usr/include, which is always included anyway
    if test "x$found_dir" = "x/usr/include" ; then
	found_dir="include"
    fi

    if test "x$platform" = "xwin32"; then
        if test ! "x$found_hdr" = "x" ; then
           found_hdr=`cygpath -m $found_hdr`
        fi
        if test ! "x$found_dir" = "x" ; then
           found_dir=`cygpath -m $found_dir`
        fi
    fi

#_____________________________________________________________________
check_symbol() {
    # This function will try to locate a symbol [$1] in a specific
    # library [$2] and in a given directory [$3].
    # The result of the check is stored in found_symbol, 1 if true,
    # 0 otherwise, which should be immediately copied, since the variable
    # will be overwritten at next invocation of this function.

    # Assert that we got enough arguments
    if test $# -ne 3 ; then
	echo "check_symbol: Not 3 arguments"
	return 1
    fi

    # Save arguments in logical names
    symbol=$1     ; shift
    symbollib=$1  ; shift
    symboldir=$1

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

    if test "x$symbolfile" = "x" || test ! -r $symbolfile ; then
       found_symbol=0
       return 1
    fi

    symbol_in_lib=`nm $symbolfile | grep $symbol > /dev/null 2>&1`
    if test $? -eq 0 ; then
        found_symbol=1
    else
        found_symbol=0
    fi
}

#_____________________________________________________________________
guess_architecture () {
    # Try to guess the architecture of the host system
    # Note, that there's no attempt at guessing the compiler.
    # The `native' compiler is used in all cases.
    # If a user really want a specifific compiler, s/he better use the
    # first argument to do so.
    arch=`uname -s | tr '[A-Z]' '[a-z]'`
    chip=`uname -m | tr '[A-Z]' '[a-z]'`
    rele=`uname -r`
    case "$arch:$chip:$rele" in
        aix*)                  arch=aix5            ;;
        osf1*:alpha:*)         arch=alphacxx6       ;;
Fons Rademakers's avatar
Fons Rademakers committed
        freebsd*:*:5*)         arch=freebsd5        ;;
        freebsd*:*:4*)         arch=freebsd4        ;;
        freebsd*:*:*)          arch=freebsd         ;;
        hp-ux:ia64:*)          arch=hpuxia64acc     ;;
        hp-ux:*:*)             arch=hpuxacc         ;;
        hurd*:*:*)             arch=hurddeb         ;;
        linux:ia64:*)          arch=linuxia64gcc    ;;
        linux:x86_64:*)        arch=linuxx8664gcc   ;;
        linux:alpha:*)         arch=linuxalphaegcs  ;;
        linux:arm*:*)          arch=linuxarm        ;;
        linux:ppc*:*)          arch=linuxppcegcs    ;;
        linux:i*86:*)          arch=linux           ;;
        lynx:*:*)              arch=lynxos          ;;
        darwin:power*:*)       arch=macosx          ;;
        irix*:sgi*:*)          arch=sgicc           ;;
        sunos:sun*:6*)         arch=solarisCC5      ;;
        sunos:sun*:5*)         arch=solarisCC5      ;;
        sunos:sun*:4*)         arch=solaris         ;;
        cygwin_*:*86:*)        arch=win32gdk        ;;
        cygwin_*:pentium:*)    arch=win32gdk        ;;
        cygwin_*:ia64)         arch=win32gdk        ;;
        *)
            echo "Attempts at guessing your architecture failed."
            echo "Please specify the architecture as the first argument."
            echo "Do '$0 --help' for a list of avaliable architectures."
            exit 1
            ;;
   esac
}

###################################################################
#
### echo %%% Some skeleton and config files
#
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
ROOTAUTHRCIN=config/rootauthrc.in
ROOTAUTHRCOUT=etc/system.rootauthrc
ROOTDAEMONRCIN=config/rootdaemonrc.in
ROOTDAEMONRCOUT=etc/system.rootdaemonrc
MEMPROBEIN=config/memprobe.in
MEMPROBEOUT=bin/memprobe
MIMEUNIXIN=config/mimes.unix.in
MIMEWIN32IN=config/mimes.win32.in
MIMEOUT=etc/root.mimes
######################################################################
#
### echo %%% Testing the echo features
#
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


######################################################################
#
### echo %%% Help function
#
\`configure' configures ROOT $vers to adapt to many kind of systems.

Usage:     $0 [architecture] [flag=value]

The architecture to build for will be guessed from the output of 'uname'.
If, however, that fails, or you don't want the 'native' compiler on the
host platform, you can specify the architecture to use by passing as the
FIRST argument one of the architecures given at the end of this message.

   FLAG            DESCRIPTION               DEFAULT
   --aclocaldir    Autoconf macro install dir(<prefix>/share/aclocal)
   --bindir        Binary installation dir   (<prefix>/bin)
   --build         Build configuration [debug, exceptions, ...],
                   overrides the ROOTBUILD shell variable
   --cintincdir    CINT interpeted headers   (<libdir>/cint)
   --datadir       Data installation dir     (<prefix>/share/root)
   --docdir        Documentation             (<prefix>/share/doc/root)
   --elispdir      Where to put Emacs Lisp   (<prefix>/share/emacs/site-lisp)
   --etcdir        Config installation dir   (/etc/root)
   --fontdir       Font installation dir     (<datadir>/fonts)
   --iconpath      Icon installation dir     (<datadir>/icons)
   --incdir        Header installation dir   (<prefix>/include/root)
   --libdir        Library installation dir  (<prefix>/lib/root)
   --macrodir      Macro installation dir    (<datadir>/macros)
   --mandir        Manpages installation dir (<prefix>/share/man/man1)
   --no-create     Do not create output files, dry run
   --prefix        Installation prefix       (/usr/local)
   --proofdir      PROOF utils dir           (<datadir>/proof)
   --srcdir        Sources installation dir  (<datadir>/src)
   --testdir       Tests                     (<docdir>/test)
   --tutdir        Tutorials                 (<docdir>/tutorial)

If any of the flags --cintincdir, --datadir, --docdir, --etcdir, --iconpath
--incdir, --libdir, --macrodir, --mandir, --prefix, or --proofdir is given,
ROOT will be compiled with static directory names, and you should not set
the ROOTSYS environment variable.

enable/disable options, prefix with either --enable- or --disable-
   afs             AFS support, requires AFS libs and objects
Fons Rademakers's avatar
Fons Rademakers committed
   alien           AliEn support, requires libAliEnAPI++ from ALICE
   asimage         Image processing support, requires libAfterImage
   cern            CERNLIB usage, build h2root and g2root
   chirp           Chirp support (Condor remote I/O), requires libchirp_client
   dcache          dCache support, requires libdcap from DESY
   exceptions      Turn on compiler exception handling capability
   explicitlink    Explicitly link with all dependent libraries
   globus          Globus authentication support, requires Globus toolkit
   krb5            Kerberos5 support, requires Kerberos libs
   ldap            LDAP support, requires (Open)LDAP libs
   mysql           MySQL support, requires libmysqlclient
   opengl          OpenGL support, requires libGL and libGLU
   openiv          OpenInventor support, requires libInventor and libInventorXt
Fons Rademakers's avatar
Fons Rademakers committed
   python          PyROOT python bindings, requires python >= 2.1
   pgsql           PostgreSQL support, requires libpq
   pythia          Pythia5 EG support, requires libPythia
   pythia6         Pythia6 EG support, requires libPythia6
   rfio            SHIFT support, requires libshift from CERN
   rpath           Set run-time library load path on executables
   sapdb           SapDB support, requires libsqlod and libsqlrte
   shadowpw        Shadow password support
   shared          Use shared 3rd party libraries if possible
   soversion       Set version number in sonames (recommended)
   srp             SRP support, requires SRP source tree
   table           Build libTable contrib library
   thread          Thread support (currently only POSIX threads)
   venus           Venus EG support, requires libVenus
with options, prefix with --with-, enables corresponding support
   afs             AFS support, location of AFS distribution
Fons Rademakers's avatar
Fons Rademakers committed
   alien-incdir    AliEn support, location of AliEnAPI++.h
   alien-libdir    AliEn support, location of libAliEnAPI++
   cern-libdir     HBOOK converter, location of CERNLIB libraries
   chirp-incdir    Chirp support, location of chirp_client.h
   chirp-libdir    Chirp support, location of libchirp_client
   dcap-incdir     dCache support, location of dcap.h
   dcap-libdir     dCache support, location of libdcap
   krb5            Kerberos5 support, location of Kerberos distribution
   krb5-incdir     Kerberos5 support, location of krb5.h
   krb5-libdir     Kerberos5 support, location of libkrb5
   globus          Globus support, path to what should be GLOBUS_LOCATION
Fons Rademakers's avatar
Fons Rademakers committed
   globus-patch    Globus support, source dir for patch to versions 2.2.x (experimental, see README.GLOBUS)
   ldap-incdir     LDAP support, location of ldap.h
   ldap-libdir     LDAP support, location of libldap
   mysql-incdir    MySQL support, location of mysql.h
   mysql-libdir    MySQL support, location of libmysqlclient
   opengl-incdir   OpenGL support, location of GL/gl.h
   opengl-libdir   OpenGL support, location of libGL
   openiv-incdir   OpenInventor support, location of Inventor/SoType.h
   openiv-libdir   OpenInventor support, location of libInventor
   pgsql-incdir    PostgreSQL support, location of libpq-fe.h
   pgsql-libdir    PostgreSQL support, location of libpq
   pythia-libdir   PYHTIA support, location of libPythia
   pythia6-libdir  PYHTIA6 support, location of libPythia6
   sapdb-incdir    SapDB support, location of sql.h
   sapdb-libdir    SapDB support, location of libsqlod
   shift-incdir    RFIO support, location of rfio_api.h
   shift-libdir    RFIO support, location of libshift
   srp             Secure Remote Passwd support, location of SRP distribution
   srp-incdir      SRP support, location header of t_server.h
   srp-libdir      SRP support, location header of libsrp.a
   sys-iconpath    Extra icon path
   thread-libdir   Thread support, path to libpthread
   venus-libdir    VENUS support, location of libVenus
   xpm-libdir      XPM support, path to libXpm

Supported Architectures:

EOF
   cat config/ARCHS | sed -e 's/^/   /'
cat <<EOF

Help output is rather long, so you may want to pipe it through a pager, like
for example

  $0 --help | more

Report bugs to <rootdev@root.cern.ch>
######################################################################
#
### echo %%% See if we got the architecture
#
if test $# -lt 1 ; then
      -h|--help) confhelp ; exit 0 ;;
      -*) # in case the first argument wasn't an architecure but an option
          guess_architecture
          ;;
       *)
          arch=$1
          shift
          ;;
# check that we got a valid architecture
if test "$arch" = "linuxegcs" ; then
    arch="linux"
fi

if `awk '{ print $1 }' $ARCHS | grep "^$arch$" > /dev/null  2>&1` ; then
   echo "Configuring for $arch"
else
   echo "Invalid architecture. Try $0 --help"
   exit 1
fi

if test "x$arch" = "xwin32" || test "x$arch" = "xwin32gdk" ; then
   platform="win32"
else
   platform=$arch
fi
if test "x$arch" = "xsgicc" ; then
   checklib32="yes"
fi
if test "x$arch" = "xlinuxx8664gcc" || test "x$arch" = "xsgicc64" ; then
   checklib64="yes"
fi

######################################################################
#
### echo %%% Some clean up
#
trap "rm -f Makefile.tmp config.tmp root-config.tmp rootrc.tmp \
      rootauthrc.tmp rootdaemonrc.tmp memprobe.tmp; exit 1" 1 2 3 15
######################################################################
#
### echo %%% Command line arguments
#
if test $# -gt 0 ; then
   while test ! "x$1" = "x" ; 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
      #
Fons Rademakers's avatar
Fons Rademakers committed
      --nohowto)               nohowto="yes"         ;;
      --with-afs=*)            afsdir=$optarg        ; enable_afs="yes"     ;;
      --with-alien-incdir=*)   alienincdir=$optarg   ; enable_alien="yes"   ;;
      --with-alien-libdir=*)   alienlibdir=$optarg   ; enable_alien="yes"   ;;
      --with-cern-libdir=*)    cernlibdir=$optarg    ; enable_cern="yes"    ;;
      --with-chirp-incdir=*)   chirpincdir=$optarg   ; enable_chirp="yes"   ;;
      --with-chirp-libdir=*)   chirplibdir=$optarg   ; enable_chirp="yes"   ;;
      --with-dcap-incdir=*)    dcapincdir=$optarg    ; enable_dcache="yes"  ;;
      --with-dcap-libdir=*)    dcaplibdir=$optarg    ; enable_dcache="yes"  ;;
      --with-globus=*)         globusdir=$optarg     ; enable_globus="yes"  ;;
      --with-krb5=*)           krb5dir=$optarg       ; enable_krb5="yes"    ;;
      --with-krb5-incdir=*)    krb5incdir=$optarg    ; enable_krb5="yes"    ;;
      --with-krb5-libdir=*)    krb5libdir=$optarg    ; enable_krb5="yes"    ;;
      --with-ldap-incdir=*)    ldapincdir=$optarg    ; enable_ldap="yes"    ;;
      --with-ldap-libdir=*)    ldaplibdir=$optarg    ; enable_ldap="yes"    ;;
      --with-mysql-incdir=*)   mysqlincdir=$optarg   ; enable_mysql="yes"   ;;
      --with-mysql-libdir=*)   mysqllibdir=$optarg   ; enable_mysql="yes"   ;;
      --with-opengl-incdir=*)  openglincdir=$optarg  ; enable_opengl="yes"  ;;
      --with-opengl-libdir=*)  opengllibdir=$optarg  ; enable_opengl="yes"  ;;
      --with-openiv-incdir=*)  openivincdir=$optarg  ; enable_openiv="yes"  ;;
      --with-openiv-libdir=*)  openivlibdir=$optarg  ; enable_openiv="yes"  ;;
      --with-pgsql-incdir=*)   pgsqlincdir=$optarg   ; enable_pgsql="yes"   ;;
      --with-pgsql-libdir=*)   pgsqllibdir=$optarg   ; enable_pgsql="yes"   ;;
      --with-pythia-libdir=*)  pythialibdir=$optarg  ; enable_pythia="yes"  ;;
      --with-pythia6-libdir=*) pythia6libdir=$optarg ; enable_pythia6="yes" ;;
      --with-python-incdir=*)  pythonincdir=$optarg  ; enable_python="yes"  ;;
      --with-python-libdir=*)  pythonlibdir=$optarg  ; enable_python="yes"  ;;
      --with-qt-incdir=*)      qtincdir=$optarg      ; enable_qt="yes"      ;;
      --with-qt-libdir=*)      qtlibdir=$optarg      ; enable_qt="yes"      ;;
      --with-sapdb-incdir=*)   sapdbincdir=$optarg   ; enable_sapdb="yes"   ;;
      --with-sapdb-libdir=*)   sapdblibdir=$optarg   ; enable_sapdb="yes"   ;;
      --with-shift-incdir=*)   shiftincdir=$optarg   ; enable_rfio="yes"    ;;
      --with-shift-libdir=*)   shiftlibdir=$optarg   ; enable_rfio="yes"    ;;
      --with-srp=*)            srpdir=$optarg        ; enable_srp="yes"     ;;
      --with-srp-incdir=*)     srpincdir=$optarg     ; enable_srp="yes"     ;;
      --with-srp-libdir=*)     srplibdir=$optarg     ; enable_srp="yes"     ;;
      --with-sys-iconpath=*)   extraiconpath=$optarg ;;
      --with-thread-libdir=*)  threadlibdir=$optarg  ; enable_thread="yes"  ;;
      --with-venus-libdir=*)   venuslibdir=$optarg   ; enable_venus="yes"   ;;
      --with-x11-libdir=*)     x11libdir=$optarg     ;;
      --with-xpm-libdir=*)     xpmlibdir=$optarg     ;;
      ################################################################
      #
      # Enable/disable to turn on/off third party software linkage and
      # features
      #
      --enable-*)
	f=`echo $1 | sed -e 's/--//' -e 's/-/_/'`
	eval $f=yes
	for c in $options ; do
	   if test "x$c" = "x$f" ; then
	      f=""
	   fi
	done
	if test "x$f" != "x" ; then
	   echo "Invalid option '$1'. Try $0 --help" ; exit 1 ;
	fi
	;;
      --disable-*)
	f=`echo $1 | sed -e 's/--disable/enable/' -e 's/-/_/'`
	eval $f=no
	for c in $options ; do
	   if test "x$c" = "x$f" ; then
	      f=""
	   fi
	done
	if test "x$f" != "x" ; then
	   echo "Invalid option '$1'. Try $0 --help" ; exit 1 ;
	fi
	;;
      ################################################################
      #
      # Build steering option
      #
      --build=*)      rootbuild="ROOTBUILD      := $optarg"  ;;
      ################################################################
      #
      # Install path options
      #
      --aclocaldir=*) haveconfig=-DHAVE_CONFIG ; aclocaldir=$optarg  ;;
      --bindir=*)     haveconfig=-DHAVE_CONFIG ; bindir=$optarg      ;;
      --cintincdir=*) haveconfig=-DHAVE_CONFIG ; cintincdir=$optarg  ;;
      --datadir=*)    haveconfig=-DHAVE_CONFIG ; datadir=$optarg     ;;
      --docdir=*)     haveconfig=-DHAVE_CONFIG ; docdir=$optarg      ;;
      --elispdir=*)   haveconfig=-DHAVE_CONFIG ; elispdir=$optarg    ;;
      --etcdir=*)     haveconfig=-DHAVE_CONFIG ; etcdir=$optarg      ;;
      --fontdir=*)    haveconfig=-DHAVE_CONFIG ; fontdir=$optarg     ;;
      --iconpath=*)   haveconfig=-DHAVE_CONFIG ; iconpath=$optarg    ;;
      --incdir=*)     haveconfig=-DHAVE_CONFIG ; incdir=$optarg      ;;
      --libdir=*)     haveconfig=-DHAVE_CONFIG ; libdir=$optarg      ;;
      --macrodir=*)   haveconfig=-DHAVE_CONFIG ; macrodir=$optarg    ;;
      --mandir=*)     haveconfig=-DHAVE_CONFIG ; mandir=$optarg      ;;
      --pkglist*)     show_pkglist="yes"       ; noact="yes"         ;;
      --prefix*)      haveconfig=-DHAVE_CONFIG ; prefix=$optarg      ;;
      --proofdir=*)   haveconfig=-DHAVE_CONFIG ; proofdir=$optarg    ;;
      --srcdir=*)     haveconfig=-DHAVE_CONFIG ; srcdir=$optarg      ;;
      --testdir=*)    haveconfig=-DHAVE_CONFIG ; testdir=$optarg     ;;
      --tutdir=*)     haveconfig=-DHAVE_CONFIG ; tutdir=$optarg      ;;
      *)  echo "Invalid option '$1'. Try $0 --help" ; exit 1 ;;
######################################################################
#
### echo %%% Copy skeletons to temporary files
#
if test "x$noact" = "xno"; then
    cp -f $MAKEIN Makefile.tmp
    cp -f $CONFIN config.tmp
    cp -f $RCONFIN root-config.tmp
    cp -f $ROOTRCIN rootrc.tmp
    cp -f $ROOTAUTHRCIN rootauthrc.tmp
    cp -f $ROOTDAEMONRCIN rootdaemonrc.tmp
    cp -f $MEMPROBEIN memprobe.tmp
fi

######################################################################
#
### echo %%% Should sonames contain version numbers
if test "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

######################################################################
#
### echo %%% On Windoze always set enable_shared to no; need .lib
#
if test "x$platform" = "xwin32"; then
    enable_shared="no"
fi

######################################################################
#
### echo %%% X11 and XPM Library - Mandatory lib on Unix
# Check for X11 and Xpm library (for X11 use always shared lib)
if test ! "$platform" = "win32"; then
    check_library "libX11" "yes" "$x11libdir" \
	/usr/lib /usr/X11R6/lib /usr/lib/X11 /usr/openwin/lib \
	/usr/local/lib /usr/local/lib/X11 /use/local/X11R6/lib \
Rene Brun's avatar
Rene Brun committed
	/usr/X11/lib /usr/lib/X11R5
Fons Rademakers's avatar
Fons Rademakers committed
    if test "x$found_lib" = "x" ; then
	echo "`basename $0`: libX11 MUST be installed"
        exit 1
    fi

    check_library "libXpm" "$enable_shared" "$xpmlibdir" \
	$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
    xpmlib=$found_lib
    xpmlibdir=$found_dir
    if test "x$xpmlib" = "x" ; then
	echo "`basename $0`: libXpm MUST be installed"
######################################################################
#
### echo %%% Exceptions - compiler feature
#
if test "x$EXCEPTIONS" = "xno" ; then
    enable_exceptions=no
fi
e=`echo $rootbuild | sed 's/.*exceptions.*/1/'`
if test "x$e" = "x1" ; then
    enable_exceptions=no
fi

######################################################################
#
### echo %%% Posix Thread Library
linux|linuxdeb|linuxicc|linuxia64*|linuxx8664*|win32gcc|macosx*)
    if test "x$enable_thread" = "x"; then
        enable_thread="yes"
    fi
    ;;
Fons Rademakers's avatar
Fons Rademakers committed
freebsd*)
    if test "x$enable_thread" = "xyes"; then
       threadlib="-pthread"
       threadlibdir=
    fi
    ;;
Fons Rademakers's avatar
Fons Rademakers committed
if test "x$enable_thread" = "xyes" && \
   test ! "$platform" = "win32"    && \
   test ! "$platform" = "freebsd4" ; then
    check_library "libpthread" "$enable_shared" "$threadlibdir" \
	$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
    threadlib=$found_lib
    threadlibdir=$found_dir

    if test "x$threadlib" = "x" ; then

######################################################################
#
### echo %%% OpenGL Support - Third party libraries
if test ! "x$enable_opengl" = "xno" && test ! "$platform" = "win32" ; then
    # Check for OpenGL compatible include and library
    check_header "GL/gl.h" "$openglincdir" $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 /opt/graphics/OpenGL/include
    openglinc=$found_hdr
    openglincdir=$found_dir

    opengllibdirs="$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 /opt/graphics/OpenGL/lib/hpux64 /opt/graphics/OpenGL/lib"

    keep=$opengllibdir
    check_library "libGL libMesaGL" "$enable_shared" \
	"$opengllibdir" $opengllibdirs
    opengllib=$found_lib
    opengllibdir=$found_dir

    check_library "libGLU libMesaGLU" "$enable_shared" \
	"$keep" $opengllibdirs
    openglulib=$found_lib
    openglulibdir=$found_dir

    if test "x$openglincdir" = "x" || \
       test "x$opengllib" = "x" || \
       test "x$openglulib" = "x" ; then
######################################################################
#
### echo %%% OpenInventor Support - Third party libraries
#
# (see http://oss.sgi.com/projects/inventor/)
#
if test "x$enable_opengl" = "xno" ; then
if test ! "x$enable_openiv" = "xno" ; then
    # Check for OpenInventor compatible include and library
    check_header "Inventor/SoType.h" "$openivincdir" $IVROOT $IVROOT/include \
	$IVROOT/usr/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/inventor /usr/local/include/inventor \
	/usr/inventor/include /usr/local/inventor/include \
	/usr/inventor/usr/include /usr/local/inventor/usr/include \
	/usr/local/inventor /opt/inventor /opt/inventor/include \
	/opt/inventor/usr/include
    openivinc=$found_hdr
    openivincdir=$found_dir

    openivlibdirs="$IVROOT $IVROOT/lib $IVROOT/usr/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/inventor /usr/local/lib/inventor \
	/usr/inventor/lib /usr/inventor/usr/lib /usr/local/inventor/lib \
	/usr/local/inventor/usr/lib /usr/inventor /usr/local/inventor \
	/opt/inventor /opt/inventor/lib /opt/inventor/usr/lib"

    keep=$openivlibdir
    check_library "libInventor libCoin coin*" "$enable_shared" \
	"$openivlibdir" $openivlibdirs
    openivlib=$found_lib
    openivlibdir=$found_dir

    check_library "libInventorXt libSoXt libSoQt soqt*" "$enable_shared" \
	"$keep" $openivlibdirs
    openivlib="$openivlib $found_lib"
    openivlibdir="$openivlibdir $found_dir"