Implement functionwrapper

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11242 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Baozeng Ding 2009-05-30 07:10:19 +00:00
commit 4aa72f9b01
16 changed files with 739 additions and 12 deletions

175
Doc/Manual/Scilab.html Normal file
View file

@ -0,0 +1,175 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>SWIG and Scilab</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body bgcolor="#ffffff">
<H1><a name="Scilab"></a>36 SWIG and Scilab</H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="#Scilab_nn2">Preliminaries</a>
<li><a href="#Scilab_nn3">Running SWIG</a>
<ul>
<li><a href="#Scilab_nn5">Compiling a dynamic module</a>
<li><a href="#Scilab_nn6">Using your module</a>
</ul>
<li><a href="#Scilab_nn7">A tour of basic C/C++ wrapping</a>
<ul>
<li><a href="#Scilab_nn8">Modules</a>
<li><a href="#Scilab_nn9">Functions</a>
</ul>
</ul>
</div>
<!-- INDEX -->
<p>
Scilab is a scientific software package for numerical computations providing a powerful open computing environment for engineering and scientific applications that is mostly compatible with MATLAB.More information can be found at <a href="http://www.scilab.org">www.scilab.org</a>.
</p>
<p>
This chapter is intended to give an introduction to using the module. You should also read the SWIG documentation that is not specific to Scilab.Also, there are a dozen or so examples in the Examples/Scilab directory.
</p>
<H2><a name="Scilab_nn2"></a>36.1 Preliminaries</H2>
<p>
The current SWIG implemention is based on Scilab 5.1.1. Support for other higher versions has not been tested, nor has support for any OS other than Linux.
</p>
<H2><a name="Scilab_nn3"></a>36.2 Running SWIG</H2>
<p>
Let's start with a very simple SWIG interface file:
</p>
<div class="code"><pre>%module example
%{
#include "example.h"
%}
int gcd(int x, int y);
extern double Foo; </pre></div>
<p>
To build an Scilab module, run SWIG using the <tt>-scilab</tt> option.
</p>
<div class="shell"><pre>$ swig -scilab example.i </pre></div>
<p>
This creates a C source file <tt>example_wrap.c</tt>and a interface file <tt>builder.sce</tt>. The generated C source file contains the low-level wrappers that need to be compiled and linked with the rest of your C application (in this case, the gcd implementation) to create an extension module. And the builder.sce is used to generate the *.so file.
</p>
<p>
The swig command line has a number of options you can use, like to redirect it's output. Use <tt>swig --help</tt> to learn about these.
</p>
<H3><a name="Scilab_nn5"></a>36.2.1 Compiling a dynamic module</H3>
<p>
Scilab modules are shared objects having the ".so" suffix.
Building such a file is usually done with the "exec" command (within Scilab itself) For example,
</p>
<div class="shell"><pre>
$ ./scilab
--> exec builder.sce
</pre></div>
<p>
where builder.sce is the interface file generated by the swig. It looks like the following:
</p>
<div class="shell"><pre>
ilib_name = "examplelib";
files = ["example_wrap.c","example.o"];
libs = [];
table = ["gcd","_wrap_gcd";"Foo_set","_wrap_Foo_set";"Foo_get","_wrap_Foo_get";];
ilib_build(ilib_name,table,files,libs);
</pre></div>
<p>
"ilib_name" is the name of the lib we want to build. "table" contains the name of the C file and its wrapper file. "files" represent the .o file we want to compile, and"libs" is other libs we want to use.
</p>
<p>
"exec builder.sce" will produce *.so,and a file called "loader.sce" which contains how to load the module. Loading it into Scilab is then a matter of invoking
</p>
<div class="targetlang"><pre>Scilab:1&gt; exec loader.sce</pre></div>
<H3><a name="Scilab_nn6"></a>36.2.2 Using your module</H3>
<p>
Assuming all goes well, you will be able to do this:
<br>
</p>
<div class="targetlang"><pre>
Scilab:2&gt;gcd(4,6)
ans = 2
Scilab:3&gt;Foo_get
ans = 3
Scilab:4&gt;Foo_set(4);
Scilab:5&gt;Foo_get
ans = 4 </pre></div>
<H2><a name="Scilab_nn7"></a>36.3 A tour of basic C wrapping</H2>
<H3><a name="Scilab_nn8"></a>36.3.1 Modules</H3>
<p>
The SWIG module directive specifies the name of the Scilab module. If you want to load the module, you'll need a file called "loader.sce" which is usually generated by the command "exec builder.sce". The loader.sce looks as following:
</p>
<div class="targetlang"><pre>
// ------------------------------------------------------
// generated by builder.sce: Please do not edit this file
// ------------------------------------------------------
libexamplelib_path = get_file_path('loader.sce');
list_functions = [ 'gcd';
'Foo_set';
'Foo_get';
];
addinter(libexamplelib_path+'/libexamplelib.so','libexamplelib',list_functions);
// remove temp. variables on stack
clear libexamplelib_path;
clear list_functions;
clear get_file_path;
// ------------------------------------------------------
</pre></div>
<p>
After you run the command "exec loader.sce", you could use the module.
</pre>
<H3><a name="Scilab_nn9"></a>36.3.2 Functions</H3>
<p>
Global functions are wrapped as new Scilab built-in functions. For example,
</p>
<div class="code"><pre>&#037;module example
int fact(int n); </pre></div>
<p>
creates a built-in function <tt>fact(n)</tt> that works exactly like you think it does:
</p>
<div class="targetlang"><pre>Scilab:1&gt;fact(4)
ant=24 </pre></div>

View file

@ -0,0 +1,18 @@
/* File : example.c */
/* A global variable */
double Foo = 3.0;
/* Compute the greatest common divisor of positive integers */
int gcd(int x, int y) {
int g;
g = y;
while (x > 0) {
g = x;
x = y % x;
y = g;
}
return g;
}

View file

@ -0,0 +1,7 @@
/* File : example.i */
%module example
%inline %{
extern int gcd(int x, int y);
extern double Foo;
%}

View file

@ -0,0 +1,23 @@
// builder the *.so
exec builder.sce;
//loader the *.so
exec loader.sce;
// Call our gcd() function
x = 42;
y = 105;
g = gcd(x,y);
printf("The gcd of %d and %d is %d\n",x,y,g);
//Manipulate the Foo global variable
// Output its current value
Foo_get()
// Change its value
Foo_set = 3.1415926
//See if the change took effect
Foo_get

View file

4
Lib/scilab/scilab.swg Normal file
View file

@ -0,0 +1,4 @@
%include <typemaps/swigmacros.swg>
%include <typemaps/fragments.swg>
%include <scitypemaps.swg>

123
Lib/scilab/scitypemaps.swg Normal file
View file

@ -0,0 +1,123 @@
// Include fundamental fragemt definitions
%include <typemaps/fragments.swg>
// Look for user fragments file.
%include <scifragments.swg>
// Scilab fragments for primitive types
%include <sciprimtypes.swg>
// Include the unified typemap library
//%include <typemaps/swigtypemaps.swg>
%typemap(in) char (int m, int n,int l),
signed char (int m,int n,int l),
unsigned char(int m,int n,int l)
{
if (GetType($argnum) == sci_strings)
{
GetRhsVar($argnum,STRING_DATATYPE,&m,&n,&l);
$1=($1_ltype)(*cstk(l));
}
else
Scierror(999,"error ...\n");
}
%typemap(in) short (int m, int n,int l),
unsigned short (int m,int n,int l),
int(int m,int n,int l),
unsigned int(int m, int n,int l),
long(int m,int n,int l),
unsigned long(int m,int n,int l),
double(int m,int n,int l)
{
if (GetType($argnum) == sci_matrix)
{
GetRhsVar($argnum,MATRIX_OF_DOUBLE_DATATYPE,&m,&n,&l);
$1=($1_ltype)(*stk(l));
}
else
Scierror(999,"error ...\n");
}
%typemap(in) float (int m, int n,int l)
{
if (GetType($argnum) == sci_matrix)
{
GetRhsVar($argnum,MATRIX_OF_DOUBLE_DATATYPE,&m,&n,&l);
$1=($1_ltype)(*stk(l));
}
else
Scierror(999,"error ...\n");
}
%typemap(in) char *(int m,int n,int l)
{
if (GetType($argnum) == sci_strings)
{
GetRhsVar($argnum,STRING_DATATYPE,&m,&n,&l);
$1=($1_ltype)strdup(cstk(l));
}
else
Scierror(999,"error ...\n");
}
%typemap(out) char (int m, int n,int l),
signed char (int m,int n,int l),
unsigned char(int m,int n,int l)
{
m=1,n=1;
CreateVar(Rhs+1,STRING_DATATYPE,&m,&n,&l);
*cstk(l)=$1;
LhsVar(1)=Rhs+1;
}
%typemap(out) short (int m, int n,int l),
unsigned short (int m,int n,int l),
int(int m,int n,int l),
unsigned int(int m, int n,int l),
long(int m,int n,int l),
unsigned long(int m,int n,int l),
double(int m,int n,int l)
{
m=1,n=1;
CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&m,&n,&l);
*stk(l)=(double)$1;
LhsVar(1)=Rhs+1;
}
%typemap(out) float (int m, int n,int l)
{
m=1,n=1;
CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&m,&n,&l);
*stk(l)=(double)$1;
LhsVar(1)=Rhs+1;
}
%typemap(out) char *(int m,int n, int l)
{
m=1;
if ($1)
n = (int)strlen($1);
else
n = (int)strlen("");
CreateVar(Rhs+1,STRING_DATATYPE ,&m,&n,&l);
if ($1) strcpy(cstk(l),$1);
else strcpy(cstk(l),"");
LhsVar(1) = Rhs+1;
}
%typemap(out,noblock=1) void
{
}

1
Lib/scilab/std_string.i Normal file
View file

@ -0,0 +1 @@
%include <typemaps/std_string.swg>

10
Lib/scilab/std_vector.i Normal file
View file

@ -0,0 +1,10 @@
%fragment("StdVectorTraits","header")
%{
%}
#define %swig_vector_methods(Type...) %swig_sequence_methods(Type)
#define %swig_vector_methods_val(Type...) %swig_sequence_methods_val(Type);
%include <std/std_vector.i>

8
Lib/scilab/stl.i Normal file
View file

@ -0,0 +1,8 @@
/* initial STL definition. extended as needed in each language */
%include std_common.i
%include std_vector.i
%include std_string.i

View file

@ -75,6 +75,7 @@ skip-clisp = test -n "@SKIP_CLISP@"
skip-cffi = test -n "@SKIP_CFFI@"
skip-uffi = test -n "@SKIP_UFFI@"
skip-r = test -n "@SKIP_R@"
skip-scilab = test -n "@SKIP_SCILAB@"
# Additional dependencies for some tests
skip-gcj = test -n "@SKIP_GCJ@"
@ -110,7 +111,7 @@ check-aliveness:
@$(skip-modula3) || ./$(TARGET) -modula3 -help
@$(skip-lua) || ./$(TARGET) -lua -help
@$(skip-r) || ./$(TARGET) -r -help
@$(skip-scilab) || ./$(TARGET) -scilab -help
check-ccache:
test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) check)
@ -135,8 +136,8 @@ check-examples: \
check-clisp-examples \
check-uffi-examples \
check-cffi-examples \
check-r-examples
check-r-examples \
check-scilab-examples
tcl_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/tcl/check.list)
perl5_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/perl5/check.list)
python_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/python/check.list)
@ -157,6 +158,7 @@ clisp_examples :=
uffi_examples :=
cffi_examples :=
r_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/r/check.list)
scilab_examples :=
# all examples
check-%-examples :
@ -203,8 +205,8 @@ check-gifplot: \
check-chicken-gifplot \
# check-lua-gifplot \
# check-csharp-gifplot \
# check-modula3-gifplot
# check-modula3-gifplot \
check-scilab-gifplot
check-%-gifplot: gifplot-library
@if test -z "$(skip-$*)"; then \
echo $* unknown; \
@ -250,8 +252,8 @@ check-test-suite: \
check-uffi-test-suite \
check-cffi-test-suite \
check-chicken-test-suite \
check-r-test-suite
check-r-test-suite \
check-scilab-test-suite
check-%-test-suite:
@if test -z "$(skip-$*)"; then \
echo $* unknown; \
@ -301,8 +303,8 @@ all-test-suite: \
all-uffi-test-suite \
all-cffi-test-suite \
all-chicken-test-suite \
all-r-test-suite
all-r-test-suite \
all-scilab-test-suite
all-%-test-suite:
@$(MAKE) -k -s check-$*-test-suite ACTION=all
@ -328,7 +330,8 @@ broken-test-suite: \
broken-uffi-test-suite \
broken-cffi-test-suite \
broken-chicken-test-suite \
broken-r-test-suite
broken-r-test-suite \
broken-scilab-test-suite
broken-%-test-suite:
@$(MAKE) -k -s check-$*-test-suite ACTION=broken
@ -442,7 +445,7 @@ install-main:
@$(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(BIN_DIR)/`echo $(TARGET_NOEXE) | sed '$(transform)'`@EXEEXT@
lib-languages = gcj typemaps tcl perl5 python guile java mzscheme ruby php ocaml octave \
pike chicken csharp modula3 allegrocl clisp lua cffi uffi r
pike chicken csharp modula3 allegrocl clisp lua cffi uffi r scilab
lib-modules = std

2
README
View file

@ -59,7 +59,7 @@ Major contributors include:
Martin Froehlich <MartinFroehlich@ACM.org> (Guile)
Marcio Luis Teixeira <marciot@holly.colostate.edu> (Guile)
Duncan Temple Lang (R)
Baozeng Ding <sploving1@163.com> (Scilab)
Baozeng Ding <sploving1@163.com> (Scilab)
Past contributors include:
James Michael DuPont, Clark McGrew, Dustin Mitchell, Ian Cooke, Catalin Dumitrescu, Baran

View file

@ -63,6 +63,7 @@ eswig_SOURCES = CParse/cscanner.c \
Modules/r.cxx \
Modules/ruby.cxx \
Modules/s-exp.cxx \
Modules/scilab.cxx \
Modules/swigmain.cxx \
Modules/tcl8.cxx \
Modules/typepass.cxx \

288
Source/Modules/scilab.cxx Normal file
View file

@ -0,0 +1,288 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* scilab.cxx
*
* Scilab language module for SWIG.
* ----------------------------------------------------------------------------- */
char cvsroot_scilab_cxx[] = "$Id$";
#include "swigmod.h"
static const char *usage = (char *) "\
Scilab Options (available with -scilab)\n\
(none yet)\n\n";
class SCILAB:public Language {
private:
File *f_begin;
File *f_runtime;
File *f_header;
File *f_wrappers;
File *f_init;
File *f_builder;
public:
SCILAB():f_begin(0), f_runtime(0), f_header(0),f_wrappers(0),
f_init(0) {}
/* ------------------------------------------------------------
* main()
* ------------------------------------------------------------ */
virtual void main(int argc, char *argv[]) {
for (int i = 1; i < argc; i++) {
if (argv[i]) {
if (strcmp(argv[i], "-help") == 0) {
fputs(usage, stderr);
}
}
}
//Set language-specific subdirectory in SWIG library
SWIG_library_directory("scilab");
// Add a symbol to the parser for conditional compilation
Preprocessor_define("SWIGSCILAB 1", 0);
// Set scilab configuration file
SWIG_config_file("scilab.swg");
//Set typemap for scilab
SWIG_typemap_lang("scilab");
}
/* ---------------------------------------------------------------------
* top()
* --------------------------------------------------------------------- */
virtual int top(Node *n) {
Node *mod = Getattr(n, "module");
/*Get the name of the module*/
String *module = Getattr(n, "name");
/*One output file for as the wrapper file*/
String *outfile = Getattr(n, "outfile");
f_begin = NewFile(outfile, "w", SWIG_output_files());
/*Another output file to generate the .so or .dll */
String *builder = NewString("builder.sce");
f_builder=NewFile(builder,"w",SWIG_output_files());
/* Initialize all of the output files */
if (!f_begin) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
f_init = NewString("");
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("init", f_init);
/*Insert the banner at the beginning */
Swig_banner(f_begin);
/*Include some header file of scilab*/
Printf(f_runtime, "#include \"stack-c.h\"\n");
Printf(f_runtime, "#include \"sciprint.h\"\n");
Printf(f_runtime, "#include \"Scierror.h\"\n");
/*Initialize the builder.sce file*/
Printf(f_builder,"ilib_name = \"%slib\";\n",module);
Printf(f_builder,"files = [\"%s\",\"%s.o\"];\n", outfile,module);
Printf(f_builder,"libs = [];\n");
Printf(f_builder, "table = [");
/*Emit code for children*/
Language::top(n);
/*Finish off the builder.sce file*/
Printf(f_builder,"];\n");
Printf(f_builder,"ilib_build(ilib_name,table,files,libs);");
/*Dump out all the files*/
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin);
/* Close all of the files */
Delete(f_init);
Delete(f_wrappers);
Delete(f_header);
Delete(f_runtime);
Close(f_begin);
Close(f_builder);
Delete(f_begin);
Delete(f_builder);
return SWIG_OK;
}
/* ----------------------------------------------------------------------
* functionWrapper()
* ---------------------------------------------------------------------- */
virtual int functionWrapper(Node *n) {
// A new wrapper function object
Wrapper *f = NewWrapper();
Parm *p;
String *tm;
int j;
//Get the useful information from the node
String *nodeType = Getattr(n, "nodeType");
int constructor = (!Cmp(nodeType, "constructor"));
int destructor = (!Cmp(nodeType, "destructor"));
String *storage = Getattr(n, "storage");
bool overloaded = !!Getattr(n, "sym:overloaded");
bool last_overload = overloaded && !Getattr(n, "sym:nextSibling");
String *iname = Getattr(n, "sym:name");
String *wname = Swig_name_wrapper(iname);
String *overname = Copy(wname);
SwigType *d = Getattr(n, "type");
ParmList *l = Getattr(n, "parms");
if (!overloaded && !addSymbol(iname, n))
return SWIG_ERROR;
if (overloaded)
Append(overname, Getattr(n, "sym:overname"));
Printv(f->def, "int ", overname, " (char *fname){", NIL);
// Emit all of the local variables for holding arguments
emit_parameter_variables(l, f);
//Attach typemaps to the parameter list
emit_attach_parmmaps(l, f);
Setattr(n, "wrap:parms", l);
// Get number of required and total arguments
int num_arguments = emit_num_arguments(l);
int num_required = emit_num_required(l);
int varargs = emit_isvarargs(l);
if (constructor && num_arguments == 1 && num_required == 1) {
if (Cmp(storage, "explicit") == 0) {
Node *parent = Swig_methodclass(n);
if (GetFlag(parent, "feature:implicitconv")) {
String *desc = NewStringf("SWIGTYPE%s", SwigType_manglestr(Getattr(n, "type")));
Printf(f->code, "if (SWIG_CheckImplicit(%s)) SWIG_fail;\n", desc);
Delete(desc);
}
}
}
//Walk the function parameter list and generate code to get arguments
for (j = 0, p = l; j < num_arguments; ++j) {
while (checkAttribute(p, "tmap:in:numinputs", "0")) {
p = Getattr(p, "tmap:in:next");
}
SwigType *pt = Getattr(p, "type");
// Get typemap for this argument
String *tm = Getattr(p, "tmap:in");
if (tm) {
if (!tm || checkAttribute(p, "tmap:in:numinputs", "0")) {
p = nextSibling(p);
continue;
}
String *getargs = NewString("");
Printv(getargs, tm, NIL);
Printv(f->code, getargs, "\n", NIL);
Delete(getargs);
p = Getattr(p, "tmap:in:next");
continue;
} else {
Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0));
break;
}
}
Setattr(n, "wrap:name", overname);
// Now write code to make the function call
Swig_director_emit_dynamic_cast(n, f);
String *actioncode = emit_action(n);
//Insert the return variable
emit_return_variable(n, d, f);
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
Printf(f->code, "%s\n", tm);
}
else {
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(d, 0), iname);
}
/* Insert argument output code */
String *outarg = NewString("");
for (p = l; p;) {
if ((tm = Getattr(p, "tmap:argout"))) {
Replaceall(tm, "$result", "_outp");
//Replaceall(tm, "$arg", Getattr(p, "emit:input"));
//Replaceall(tm, "$input", Getattr(p, "emit:input"));
Printv(outarg, tm, "\n", NIL);
p = Getattr(p, "tmap:argout:next");
} else {
p = nextSibling(p);
}
}
Printv(f->code, outarg, NIL);
/* Finish the the code for the function */
Printf(f->code, "return 0;\n");
Printf(f->code, "}\n");
Replaceall(f->code, "$symname", iname);
/* Dump the wrapper function */
Wrapper_print(f, f_wrappers);
DelWrapper(f);
Printf(f_builder, "\"%s\",\"%s\";",iname,wname);
Delete(overname);
Delete(wname);
Delete(outarg);
return SWIG_OK;
}
/* -----------------------------------------------------------------------
* variableWrapper()
* ----------------------------------------------------------------------- */
virtual int variableWrapper(Node *n) {
Language::variableWrapper(n); /* Default to functions */
return SWIG_OK;
}
};
extern "C" Language *swig_scilab(void) {
return new SCILAB();
}

View file

@ -47,6 +47,7 @@ extern "C" {
Language *swig_cffi(void);
Language *swig_uffi(void);
Language *swig_r(void);
Language *swig_scilab(void);
}
struct swig_module {
@ -81,6 +82,7 @@ static swig_module modules[] = {
{"-python", swig_python, "Python"},
{"-r", swig_r, "R (aka GNU S)"},
{"-ruby", swig_ruby, "Ruby"},
{"-scilab",swig_scilab,"Scilab"},
{"-sexp", swig_sexp, "Lisp S-Expressions"},
{"-tcl", swig_tcl, "Tcl"},
{"-tcl8", swig_tcl, 0},

View file

@ -915,6 +915,70 @@ AC_SUBST(OCTAVEDYNAMICLINKING)
AC_SUBST(OCTAVELIB)
AC_SUBST(OCTAVECCFLAGS)
#----------------------------------------------------------------
# Look for Scilab
#----------------------------------------------------------------
SCILABBIN=
SCILABDYNAMICLINKING=
AC_ARG_WITH(scilab, AS_HELP_STRING([--without-scilab], [Disable Scilab])
AS_HELP_STRING([--with-scilab=path], [Set location of Scilab executable]),[SCILABBIN="$withval"], [SCILABBIN=yes])
# First, check for "--without-scilab" or "--with-scilab=no".
if test x"${SCILABBIN}" = xno -o x"${with_alllang}" = xno ; then
AC_MSG_NOTICE([Disabling Scilab])
SCILAB=
else
# First figure out what the name of Scilab is
if test "x$SCILABBIN" = xyes; then
AC_CHECK_PROGS(SCILAB, scilab)
else
SCILAB="$SCILABBIN"
fi
AC_MSG_CHECKING(for Scilab header files)
if test -n "$SCILAB"; then
SCILABDIR="/usr/include"
if test "$SCILABDIR" != ""; then
dirs="$SCILABDIR"
SCILABEXT=""
for i in $dirs; do
if test -r $i/scilab/stack.h; then
SCILABEXT="$i"
break;
fi
if test -r $i/scilab/scialab/stack.h; then
SCILABEXT="$i/scilab"
break;
fi
done
if test "$SCILABEXT" = "" ; then
AC_MSG_RESULT(not found)
else
AC_MSG_RESULT($SCILABEXT)
fi
AC_MSG_CHECKING(for Scilab compiler options)
SCILABCCFLAGS=""
AC_MSG_RESULT($SCILABCCFLAGS)
fi
else
AC_MSG_RESULT(could not figure out how to run scilab)
fi
fi
AC_SUBST(SCILAB)
AC_SUBST(SCILABEEXT)
AC_SUBST(SCILABDYNAMICLINKING)
AC_SUBST(SCILABLIB)
AC_SUBST(SCILABCCFLAGS)
#----------------------------------------------------------------
# Look for java
#----------------------------------------------------------------