#!/bin/sh
# generated on Tue Jun 14 02:53:52 UTC 2016 by FLU configure script v1.3


print_help_and_exit()
{
echo "
Use: flu-config [options]
Options:
  --help                 this message
  --local                use local build instead of system install
  --use-gl               use OpenGL
  --cxxflags             return flags to compile against FLU using C++
  --ldflags              return flags to link against FLU
  --libs                 return the necessary libs to link to FLU
"
exit
}

#########################
# process the command line

if test $# -eq 0
then
    print_help_and_exit
fi    

USE_GL=""
GL_LIB=""
GL_DSO=""
LOCAL=0
# first check for "--help" or "-h" or "--use-gl"
for i in $*
do
  if test "$i" = "--help" -o "$i" = "-h"
  then
    print_help_and_exit
  fi
  if test "$i" = "--local"
  then
    LOCAL=1
    shift
  fi
  if test "$i" = "--use-gl"
  then
    USE_GL="--use-gl"
  fi
done

if test $LOCAL -eq 1
then
  if test -f lib/fltk-config
  then
    chmod +x lib/fltk-config
  fi
  FLTK_CONFIG=lib/fltk-config
else
  FLTK_CONFIG=`which fltk-config`
  if test -z "$FLTK_CONFIG"
  then
    echo "Cannot find fltk-config. Be sure FLTK is installed."
    exit
  fi
fi

if ! test -z "$USE_GL"
then
    if test $LOCAL -eq 1
    then
      GL_DSO="-lflu_gl"
      GL_LIB="-lflu_gl"
    else
      GL_DSO="-lflu_gl"
      GL_LIB=/usr/lib/libflu_gl.a
    fi
fi

# now process all remaining options
for i in $*
do
  case $i in
      "--cxxflags")
          if test $LOCAL -eq 1
          then
	    echo -n -I/home/abuild/rpmbuild/BUILD/FLU_2.14 -Ilib `$FLTK_CONFIG $USE_GL --cxxflags`
          else
	    echo -n -I/usr/include `$FLTK_CONFIG $USE_GL --cxxflags`
          fi
	  ;;
      "--ldstaticflags")
            echo "The static libraries were disabled at build time. Please link dynamically"
            exit 1
      ;;
      "--ldflags")
          if test $LOCAL -eq 1
          then
            echo -n -L/home/abuild/rpmbuild/BUILD/FLU_2.14/src -Llib/src $GL_DSO -lflu `$FLTK_CONFIG $USE_GL --ldflags`
          else
            echo -n -L/usr/lib $GL_DSO -lflu `$FLTK_CONFIG $USE_GL --ldflags`
          fi
	  ;;
      "--libs")
          echo -n $GL_LIB /usr/lib/libflu.a
	  ;;
      "--use-gl")
          ;;
      *)
	  echo "Unknown option $i"
	  print_help_and_exit
	  ;;
  esac
done
echo

