#!/bin/sh

prefix=/usr/local
exec_prefix=${prefix}
libdir=/usr/local/lib
includedir=${prefix}/include
LIBSUF=la
exec_prefix_set=no
libs="-L/usr/local/lib -L/usr/local/lib -lderiv -lr12 -lint -lmpich -lmpl -pthread -lmpl -pthread -lfl -lm -pthread  -lblas   -L/usr/local/lib -L/usr/local/lib/gcc46/gcc/sparc64-portbld-freebsd9.0/4.6.4 -L/usr/local/lib/gcc46/gcc/sparc64-portbld-freebsd9.0/4.6.4/../../../../../sparc64-portbld-freebsd9.0/lib -L/usr/local/lib/gcc46/gcc/sparc64-portbld-freebsd9.0/4.6.4/../../.. -lgfortran -lm -llapack -lblas   -L/usr/local/lib -L/usr/local/lib/gcc46/gcc/sparc64-portbld-freebsd9.0/4.6.4 -L/usr/local/lib/gcc46/gcc/sparc64-portbld-freebsd9.0/4.6.4/../../../../../sparc64-portbld-freebsd9.0/lib -L/usr/local/lib/gcc46/gcc/sparc64-portbld-freebsd9.0/4.6.4/../../.. -lgfortran -lm"
all_sclibs="libSCoptions.la libSCpsi.la libSCmbptr12.la libSCmbpt.la libSCintcca.la libSCdft.la libSCscf.la libSCwfn.la libSCsolvent.la libSCcints.la libSCintv3.la libSCoint3.la libSCbasis.la libSCmolecule.la libSCisosurf.la libSCoptimize.la libSCsymmetry.la libSCrender.la libSCscmat.la libSCgroup.la libSCmisc.la libSCstate.la libSCkeyval.la libSCclass.la libSCcontainer.la libSCref.la cca/libSCchemistry.la"
cppdefines="-DHAVE_CONFIG_H -D_REENTRANT "
cxxflags="-O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing "
cppflags="-I/usr/local/include -I/work/a/ports/science/mpqc-mpich/work -I/usr/local/include"
cflags=" "
f77flags="-O -Wl,-rpath=/usr/local/lib/gcc46"
cxx="g++46"
cc="gcc46"
f77="gfortran46"
version="2.3.1"
soversion="8:0:1"
buildid=""
scdatadir=/usr/local/share/mpqc/2.3.1
enableshared=yes

# set up libtool related variables
if [ X$enableshared = Xyes ]; then
  libtool=${prefix}/bin/sc-libtool
  ltlink="$libtool --mode=link"
  if [ -n "$buildid" ]; then
    ltlinklibopts="-rpath $libdir -release $buildid -version-info $soversion"
  else
    ltlinklibopts="-rpath $libdir -version-info $soversion"
  fi
  ltlinkbinopts=
  ltcomp="$libtool --mode=compile"
  ltinst="$libtool --mode=install"
else
  libtool=
  ltlink=
  ltlinklibopts=
  ltlinkbinopts=
  ltcomp=
  ltinst=
fi

sclibs=""
for i in $all_sclibs; do
  if [ -f $libdir/$i ]; then
    li=`echo $i | sed "s/^lib\([a-zA-Z0-9]*\).$LIBSUF/-l\1/g"`
    sclibs="$sclibs $li"
  fi
done

usage="\
Usage: sc-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--buildid] [--so-version] [--datadir] [--libs] [--libdir] [--cppflags] [--cc] [--cflags] [--cxx] [--cxxflags] [--f77] [--f77flags] [--libtool] [--ltlink] [--ltlinklibopts] [--ltlinkbinopts] [--ltcomp] [--ltinst]"

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

if test ${includedir} != /usr/include ; then
  includes=-I${includedir}
fi

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

  case $1 in
    --prefix=*)
      prefix=$optarg
      if test $exec_prefix_set = no ; then
        exec_prefix=$optarg
      fi
      ;;
    --prefix)
      echo $prefix
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      exec_prefix_set=yes
      ;;
    --exec-prefix)
      echo $exec_prefix
      ;;
    --version)
      echo $version
      ;;
    --so-version)
      echo $soversion | sed s/:/./g
      ;;
    --scdatadir)
      echo $scdatadir
      ;;
    --buildid)
      echo $buildid
      ;;
    --cppflags)
      echo $includes $cppflags
      ;;
    --cflags)
      echo $cflags
      ;;
    --cxxflags)
      echo $cxxflags
      ;;
    --cc)
      echo $cc
      ;;
    --f77flags)
      echo $f77flags
      ;;
    --f77)
      echo $f77
      ;;
    --cxx)
      echo $cxx
      ;;
    --libdir)
      echo $libdir
      ;;
    --libs)
      echo -L${libdir} $sclibs $libs
      ;;
    --libtool)
      echo $libtool
      ;;
    --ltlink)
      echo $ltlink
      ;;
    --ltlinklibopts)
      echo $ltlinklibopts
      ;;
    --ltlinkbinopts)
      echo $ltlinkbinopts
      ;;
    --ltcomp)
      echo $ltcomp
      ;;
    --ltinst)
      echo $ltinst
      ;;
    *)
      echo "${usage}" 1>&2
      exit 1
      ;;
  esac
  shift
done

