#  Copyright (c) 1997-2006
#  Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
#  http://www.math.tu-berlin.de/polymake,  mailto:polymake@math.tu-berlin.de
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the
#  Free Software Foundation; either version 2, or (at your option) any
#  later version: http://www.gnu.org/licenses/gpl.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#-----------------------------------------------------------------------------
#  $Project: polymake $$Id: jreality_configure 7540 2006-12-21 21:04:18Z gawrilow $

package JReality::Viewer;

# path, where all necessary jReality packages are located
custom $jar_path;

# filename of the bean shell jar package
custom $bean_shell_jar;

# filenames of the necessary jar packages for launching jReality
custom @jars;

# 1 if jogl support is used, 0 otherwise
custom $jogl;

# path where jogl.jar is located
custom $jogl_path;

# path to jogl native libraries
custom $jogl_native_path;

CONFIGURE {
   return 0 unless defined($java);

   $bean_shell_jar ||= "bsh.jar";
   @jars=( $bean_shell_jar, qw( jReality.jar jtem-beans.jar sunflow.jar xpp3.jar xstream.jar jterm.jar vrData.jar vrExamples.jar ));

   -f "$jar_path/$_" or die "$_ not found\n" for @jars;

   if ($jogl && defined($jogl_path) && defined($jogl_native_path)) {
      -f "$jogl_path/jogl.jar"
         or die "jogl.jar not found in $jogl_path\n";
      -f "$jogl_native_path/libjogl.$Config::Config{dlext}" || -f "$jogl_native_path/libjogl.jnilib"
         or die "libjogl.$Config::Config{dlext} not found in $jogl_native_path\n";
   }

   1;	# success
}


# Local Variables:
# mode: perl
# c-basic-offset:3
# End:
