#! /bin/sh
#
# Initially written by John Wu <John.Wu at acm.org> on Jun 1 2009
# Copyright 2009 the Regents of the University of California
#
# This file is part of FastBit project distributed under the terms of
# LGPL.  By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.

prefix=/usr
includedir=/usr/include
libdir=/usr/usr/lib64

usage()
{
  cat <<EOF
Usage: fastbit-config [OPTION]...
Get FastBit ibis1.3.5.1 compilation and linking information.

Options:
  --prefix               display \`--prefix' value used for building the
                         FastBit library
  --version              display FastBit version number
  --libs                 display flags for linking with the FastBit library
  --cflags               display flags for compiling with the FastBit
                         library
EOF
  exit $1
}

if test $# -eq 0 ; then
  usage 1 1>&2
fi

while test $# -gt 0 ; do
  case $1 in
  --prefix)
    echo_prefix=yes
    ;;
  --version)
    echo_fb_version=yes
    ;;
  --cflags)
    echo_cflags=yes
    ;;
  --libs)
    echo_libs=yes
    ;;
  *)
    usage 1 1>&2
    ;;
  esac
  shift
done

if test "$echo_prefix" = "yes" ; then
  echo $prefix
fi

if test "$echo_exec_prefix" = "yes" ; then
  echo $exec_prefix
fi

if test "$echo_fb_version" = "yes" ; then
  echo "FastBit ibis1.3.5.1"
fi

if test "$echo_cflags" = "yes" ; then
  cflags="-DHAVE_CONFIG_H  -I /usr/src/RPM/BUILD/fastbit-ibis1.3.5.1/win -pthread"
  if test "$includedir" != "/usr/include" ; then
    echo $cflags -I$includedir
  else
    echo $cflags
  fi
fi

if test "$echo_libs" = "yes" ; then
  libs="-lfastbit  -lrt -lm  "
  if test "$libdir" != "/usr/lib" && test "$libdir" != "/usr/lib64"; then
    echo -L$libdir $libs
  else
    echo $libs
  fi
fi
 
# EOF
