https://github.com/root-project/root
Raw File
Tip revision: b604d25f6fae57dca2b25814d36b078b31da26c4 authored by Unknown Author on 23 August 2002, 12:10:17 UTC
This commit was manufactured by cvs2svn to create tag 'v3-03-08'.
Tip revision: b604d25
root-config.in
#!/bin/sh
# -*- sh-indentation: 3 -*-
# This script returns the machine dependent compile options needed
# to compile and link applications using the ROOT libraries.
#
# Author: Fons Rademakers, 06/06/99

arch=@architecture@
libdir=@libdir@
incdir=@incdir@
features="@features@"
if test "$arch" = "win32gdk"; then
   arch="win32"
fi
if test "$arch" = "win32"; then
   incdir=`cygpath -u $incdir`
   libdir=`cygpath -u $libdir`
fi

### ROOT libraries ###

newlib="-lNew"
rootlibs="-lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint \
          -lPostscript -lMatrix -lPhysics"
rootglibs="-lGui"

### machine dependent settings ###

case $arch in
hpux)
   #HP-UX with CC
   auxcflags="+a1 +Z"
   auxlibs="-lm -ldld"
   auxglibs=${auxlibs}
   ;;
hpuxacc | hpuxia64acc)
   # HP-UX 10.x with aCC
   auxcflags=
   auxlibs="-lm -ldld"
   auxglibs=${auxlibs}
   ;;
hpuxegcs)
   # HP-UX 10.x with g++
   auxcflags=
   auxlibs="-lm -ldld"
   auxglibs=${auxlibs}
   ;;
hurddeb)
   # Debian GNU/Hurd
   auxcflags=
   auxlibs="-lnsl -lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
aix | aix5)
   # IBM AIX
   auxcflags="-qnoro -qnoroconst -qmaxmem=-1"
   auxlibs=
   auxglibs=${auxlibs}
   ;;
aixegcs)
   # IBM AIX with g++
   auxcflags="-fsigned-char"
   auxlibs=
   auxglibs=${auxlibs}
   ;;
solaris)
   # Solaris
   auxcflags=
   auxlibs="-L/usr/ccs/lib -lm -lsocket -lgen -ldl -lsunmath"
   auxglibs=${auxlibs}
   ;;
solarisegcs)
   # Solaris egcs
   auxcflags=
   auxlibs="-L/usr/ccs/lib -lm -lsocket -lgen -ldl"
   auxglibs=${auxlibs}
   ;;
solarisgcc)
   # Solaris g++ 2.8.x
   auxcflags=
   auxlibs="-L/usr/ccs/lib -lm -lsocket -lgen -ldl"
   auxglibs=${auxlibs}
   ;;
solarisCC5)
   # Solaris CC 5.0
   auxcflags=
   auxlibs="-lm -ldl -lnsl -lsocket"
   auxglibs=${auxlibs}
   ;;
solariskcc)
   # Solaris KCC
   auxcflags=
   auxlibs="-L/usr/ccs/lib -lgen -lm -ldl -lsocket -lnsl"
   auxglibs=${auxlibs}
   ;;
solarisx86)
   # Solaris CC on Intel
   auxcflags=
   auxlibs="-L/usr/ccs/lib -lm -lsocket -lgen -ldl"
   auxglibs=${auxlibs}
   ;;
sgicc)
   # SGI
   auxcflags="-LANG:std"
   auxlibs="-lm -ldl"
   auxglibs=${auxlibs}
   ;;
sgiegcs)
   # SGI 6.x with EGCS
   auxcflags="-fsigned-char"
   auxlibs="-lgen -lstdc++ -lm -ldl"
   auxglibs=${auxlibs}
   ;;
sgin32egcs)
   # SGI 6.x with EGCS with n32 ABI
   auxcflags="-fsigned-char"
   auxlibs="-lm -ldl"
   auxglibs=${auxlibs}
   ;;
sgikcc)
   # SGI with KCC
   auxcflags="--signed_chars --display_error_number \
              --diag_suppress 68 --diag_suppress 191 --diag_suppress 837"
   auxlibs="-lm -ldl"
   auxglibs=${auxlibs}
   ;;
alphagcc)
   # Alpha/OSF with g++
   auxcflags=
   auxlibs="-lg++ -lm"
   auxglibs=${auxlibs}
   ;;
alphaegcs)
   # Alpha/OSF with egcs
   auxcflags="-mcpu=ev5 -D__osf__ -D__alpha"
   auxlibs="-ltermcap -lm"
   auxglibs=${auxlibs}
   ;;
alphakcc)
   # Alpha/OSF with kai compiler (not yet valid)
   auxcflags="-mcpu=ev5 -D__osf__ -D__alpha"
   auxlibs="-ltermcap -lm"
   auxglibs=${auxlibs}
   ;;
alphacxx6)
   # Alpha/OSF with cxx6
   auxcflags="-tlocal -D__osf__ -D__alpha"
   auxlibs="-lm"
   auxglibs=${auxlibs}
   ;;
alphacxx)
   # Alpha/OSF with cxx5
   auxcflags="-oldcxx -D__osf__ -D__alpha"
   auxlibs="-lm"
   auxglibs=${auxlibs}
   ;;
linuxrh42 | linuxrh51)
   # Linux with gcc 2.7.2.x
   auxcflags=
   auxlibs="-lg++ -lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
linux)
   # Linux with egcs, gcc 2.9x, gcc 3.x
   auxcflags=
   auxlibs="-lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
linuxdeb | linuxsuse6)
   # Linux with egcs on Debian and SuSE
   auxcflags=
   auxlibs="-lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
linuxdeb2)
   # Linux with egcs (Debian 2)
   auxcflags=
   auxlibs="-lnsl -lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
linuxdeb2ppc)
   # Debian/Linux on PPC
   auxcflags=-fsigned-char
   auxlibs="-lnsl -lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
linuxkcc)
   # Linux with the KAI compiler
   auxcflags="--signed_chars -D_EXTERN_INLINE=inline --diag_suppress 191"
   auxlibs="-lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
linuxicc)
   # Linux with the Intel icc compiler
   auxcflags=
   auxlibs="-lm -ldl"
   auxglibs=${auxlibs}
   ;;
linuxppcegcs)
   # Linux/ppc with gcc/glibc
   auxcflags="-fsigned-char -I/usr/X11/include"
   auxlibs="-lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
linuxia64gcc)
   # Itanium Linux with gcc 2.x/3.x
   auxcflags=
   auxlibs="-lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
linuxia64sgi)
   # Itanium Linux with SGI compiler
   auxcflags=
   auxlibs="-lm -ldl"
   auxglibs=${auxlibs}
   ;;
linuxia64ecc)
   # Itanium Linux with Intel ecc compiler
   auxcflags=
   auxlibs="-lm -ldl"
   auxglibs=${auxlibs}
   ;;
linuxalphaegcs)
   # Alpha Linux with egcs
   auxcflags=
   auxlibs="-lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
linuxarm)
   # ARM Linux with egcs
   auxcflags="-fsigned-char"
   auxlibs="-lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
mklinux)
   # MkLinux with libc5
   auxcflags="-fsigned-char -I/usr/X11/include -I/usr/include/g++"
   auxlibs="-lg++ -lm -ldl -rdynamic"
   auxglibs=${auxlibs}
   ;;
freebsd)
   # FreeBSD with libc5
   auxcflags=
   auxlibs="-lm -lg++"
   auxglibs=${auxlibs}
   ;;
freebsd4)
   # FreeBSD with glibc
   auxcflags=
   auxlibs="-lm -lstdc++"
   auxglibs=${auxlibs}
   ;;
macosx)
   # MacOS X with cc (GNU cc v2.95.2.)
   auxcflags=
   auxlibs="-lm -ldl"
   auxglibs=${auxlibs}
   ;;
hiux)
   # Hitachi HIUX
   auxcflags=
   auxlibs="-lm -ldld"
   auxglibs=${auxlibs}
   ;;
win32)
   # Win32
   auxcflags="-MD"
   auxlibs=
   auxglibs=${auxlibs}
   ;;
*)
   echo "root-config: \"$arch\" invalid architecture"
   echo "Please report to rootdev@root.cern.ch"
   exit 1
   ;;
esac


### compiler dependent settings ###

case $arch in
*kcc)
   ex=""
   for f in $features ; do
      if test "x$f" = "xthread" ; then
	 auxcflags="--thread_safe $auxcflags"
	 auxldflags="--thread_safe $auxldflags"
      fi
      if test "x$f" = "xexceptions" ; then
	 ex="yes"
      fi
   done
   if test "x$ex" = "x" ; then
      auxcflags="--no_exceptions $auxcflags"
      auxldflags="--no_exceptions $auxldflags"
   else
      auxcflags="--exceptions $auxcflags"
      auxldflags="--exceptions $auxldflags"
   fi
   ;;
linux*)
   for f in $features ; do
      if test "x$f" = "xthread" ; then
	 auxcflags="-D_REENTRANT $auxcflags"
	 auxlibs="-lpthread $auxlibs"
      fi
   done
   ;;
esac

### end of machine and compiler dependent settings ###


prefix=@prefix@
if test "$arch" = "win32"; then
   prefix=`cygpath -u ${prefix}`
fi
exec_prefix=${prefix}
exec_prefix_set=no
new_set=no
libsout=no
cflags=""
noauxlibs=no
noauxcflags=no
noldflags=no

usage="\
Usage: root-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--new] [--nonew] [--libs] [--glibs] [--libdir] [--incdir] [--noauxcflags] [--noauxlibs] [--noldflags] [--has-<feature>] [--arch] [--help]"

if test $# -eq 0; then
   echo "${usage}" 1>&2
   exit 1
fi

out=""

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

  case $1 in
    --arch)
      ### Output the arcitecture
      out="$out $arch"
      ;;
    --has-*)
      ### Check for feature
      f=`echo $1 | sed 's/--has-//'`
      for c in $features ; do
         if test "x$c" = "x$f" ; then
            out="$out yes"
            break
         fi
         c=""
      done
      if test "x$c" = "x" ; then
         out="$out no"
      fi
      ;;
    --prefix=*)
      ### Set the prefix
      if test "$arch" = "win32"; then
         optarg=`cygpath -u $optarg`
      fi
      prefix=$optarg
      incdir=${prefix}/include
      libdir=${prefix}/lib
      ### We need to expand the path to backslash seperated path
      if test "$arch" = "win32"; then
         incdir=`cygpath -u $incdir`
         libdir=`cygpath -u $libdir`
      fi
      if test $exec_prefix_set = no ; then
         exec_prefix=$optarg
      fi
      ;;
    --prefix)
      ### Output the prefix
      out="$out $prefix"
      ;;
    --exec-prefix=*)
      ### Set the exec-prefix
      if test "$arch" = "win32"; then
         optarg=`cygpath -u $optarg`
      fi
      exec_prefix=$optarg
      exec_prefix_set=yes
      libdir=${exec_prefix}/lib
      ### We need to expand the path to backslash seperated path
      if test "$arch" = "win32"; then
         libdir=`cygpath -u $libdir`
      fi
      ;;
    --exec-prefix)
      ### Output the exec-prefix
      out="$out $prefix"
      ;;
    --nonew)
      ### Don't use the libNew library
      new_set="no"
      ;;
    --new)
      ### Use the libNew library
      new_set="yes"
      ;;
    --noauxlibs)
      noauxlibs="yes"
      ;;
    --noauxcflags)
      noauxcflags="yes"
      ;;
    --noldflags)
      noldflags="yes"
      ;;
    --version)
      ### Output the version number.  If RVersion.h can not be found, give up.
      if test -r ${incdir}/RVersion.h; then
         out="$out `sed -n 's,.*ROOT_RELEASE *\"\(.*\)\".*,\1,p' < ${incdir}/RVersion.h`"
      else
         echo "cannot read ${incdir}/RVersion.h"
         exit 1
      fi
      ;;
    --cflags)
      ### Output the compiler flags
      if test ${incdir} != /usr/include; then
         ### In case we're on a Win32 system, we need to expand the
         ### path to a backslash seperated path
         if test "$arch" = "win32"; then
            includes=-I\'`cygpath -w ${incdir}`\'
         else
            includes=-I${incdir}
         fi
      fi
      if test "x$noauxcflags" = "xyes" ; then
         out="$out $includes"
      else
         out="$out ${auxcflags} $includes"
      fi
      ;;
   --auxcflags)
      ### output auxiliary compiler flags
      out="$out $auxcflags"
      ;;
    --libs)
      ### Output regular ROOT libraries.  If the user said --glibs --libs,
      ### We've already output the libraries, so we skip this section
      if test "x$libsout" = "xyes" ; then
	 shift
	 continue
      fi
      ### Set the flag
      libsout="yes"
      ### See if we need the new library
      if test "x$new_set" = "xyes"; then
         libs="${newlib} ${rootlibs}"
      else
         libs=${rootlibs}
      fi
      ### If we're on a win32 system, we need to change the -l prefix
      ### into a .lib suffix, and expend the paths to a backslash
      ### separated path.
      if test "$arch" = "win32"; then
         nlibs=`echo $libs | sed "s@-l\([a-zA-Z0-9]*\)@${libdir}/lib\1.lib@g"`
         libs=
         for i in $nlibs; do
            libs="$libs '`cygpath -w $i`'"
         done
      else
         if test "x$noldflags" = "xno" ; then
	    out="$out -L${libdir}"
	 fi
      fi
      if test "x$noauxlibs" = "xyes" ; then
	 out="$out $libs"
      else
	 out="$out $libs ${auxlibs}"
      fi
      ;;
    --glibs)
      ### Output graphics an normal libraries
      ### If the user said --libs --glibs, we don't need to add the
      ### regular ROOT libraries.
      if test "x$libsout" = "xno" ; then
         ### Set the flag
         libsout="yes"
         if test "x$new_set" = "xyes" ; then
         glibs="${newlib} ${rootlibs} ${rootglibs}"
      else
         glibs="${rootlibs} ${rootglibs}"
      fi
      fi
      ### If we're on a win32 system, we need to change the -l prefix
      ### into a .lib suffix, and expend the paths to a backslash
      ### separated path.
      if test "$arch" = "win32"; then
         nlibs=`echo $glibs | sed "s@-l\([a-zA-Z0-9]*\)@${libdir}/lib\1.lib@g"`
         glibs=
         for i in $nlibs; do
            glibs="$glibs '`cygpath -w $i`'"
         done
      else
        if test "x$noldflags" = "xno" ; then
           out="$out -L${libdir}"
        fi
      fi
      if test "x$noauxlibs" = "xyes" ; then
         out="$out $glibs"
      else
         out="$out $glibs ${auxlibs}"
      fi
      ;;
    --auxlibs)
      ### output the auxiliary libraries
      out="$out $auxlibs"
      ;;
    --libdir)
      ### output the library directory
      out="$out $libdir"
      ;;
    --incdir)
      ### output the header directory
      out="$out $incdir"
      ;;
    --help)
      ### Print a help message
      echo "Usage: `basename $0` [options]"
      echo ""
      echo "  --arch                Print the architecture"
      echo "  --prefix[=dir]        Print or set prefix"
      echo "  --exec-prefix[=dir]   Print or set execution prefix"
      echo "  --libs                Print regular ROOT libraries"
      echo "  --glibs               Print regular + GUI ROOT libraries"
      echo "  --cflags              Print compiler flags and header path"
      echo "  --libdir              Print the library directory"
      echo "  --incdir              Print the header directory"
      echo "  --auxlibs             Print auxiliary libraries"
      echo "  --auxcflags           Print auxiliary compiler flags"
      echo "  --[no]new             Turn on[off] use of libNew.so"
      echo "  --noauxlibs           Do not print auxiliary/system libraries"
      echo "  --noauxcflags         Do not print auxiliary compiler flags"
      echo "  --noldflags           Do not print linker flags"
      echo "  --has-<feature>       Test if <feature> is compiled in"
      echo "  --version             Print the ROOT version"
      exit 0
      ;;
    *)
      ### Give an error
      echo "${usage}" 1>&2
      exit 1
      ;;
  esac
  shift
done

### Output the stuff
echo $out
back to top