This is a simple package to show how the GNU Autotools may be used
to build a Scilab toolbox. Although this is a simple example, this
framework is very robust and flexible, allowing you to:
o Add tests for external libraries and system routines
o Make very portable toolboxes: they will work with almost all
Unix flavours, including MinGW and Cygwin under Windows
o Make your toolbox work with different versions of Scilab,
both installed from source and from binaries
o Have total control over the build process
This and other advantages enables the programmer to build complex
toolboxes in a robust easy-to-install way.
This will configure the toolbox to be installed at SCI/contrib/simple.
To install in another directory, say $HOME/temp:
$ mkdir $HOME/temp
$ configure --prefix=$HOME/temp
To compile and install the toolbox:
$ make install
Now enter inside scilab and execute the "loader.sce" script placed in
the directory where the toolbox was installed. There will be silly a
routine called "soma" that returns the sum of its two arguments. Of
course, the autoconf/automake setup is suited for complex projects,
not simple ones, but this is just an example.
MinGW (Minimallist GNU for Windows) is a set of development tools for
generating native Windows code. It enables you to compile this toolbox
using configure and make, similar to Unix.
There are some specific things that you must set up by hand in
order to compile this toolbox with MinGW. The whole process consists
in the following steps
1) Vist www.mingw.org, download and install the following packages:
MinGW, MSYS, and MSYS-DTK
2) Your scilab installation must be in c:\scilab (/c/scilab in MSYS),
because this path is hardcoded in the build process. Please move
your scilab installation to that place or else put an entry in the
/etc/fstab file inside MSYS. You can also alter the SCIDIR
variable in the configure.ac file but this was not tested.
3) Inside /c/scilab/bin (MSYS path), we must rename the libraries
"LibScilab.*" to lowercase. Even though Windows is case
insensitive, this causes problem to programs inside MSYS.
This step can be quickly done inside the MSYS shell typing this:
mv /c/scilab/bin/LibSci* /tmp/scilibs
for i in `ls Lib*`; do
mv $i /c/scilab/bin/`echo $i | tr A-Z a-z`;
4) Enter the toolbox's toplevel directory, and type:
5) For some versions of libtool/automake you may have to install the
DLL of the toolbox by hand:
cp src/.libs/libsimple*.dll /c/scilab/contrib/simple/libsimple.dll
Now enter Scilab and execute the "loader.sce" script placed in the
directory where the toolbox was installed.
To Adapt the Package for Yourself
First make sure you have the latest autoconf, automake and libtool
installed in your system. They can be downloaded respectively at:
Just in case you want to learn more about the GNU Autotools, the
following book is excellent:
But you don't need to read it to get started. Just you follow these steps:
1- Write your C routine. The sourcecode and inteface code are in
".c" files under the "src" directory. The soma_int.c contains a
very simple example of a routine called "soma" that returns the
sum of its two arguments.
2- define a name for your package, say "mypack".
3- edit config/lib_build.sce
a) The only variables that you need to customize for your package are
"lib_name", "sources", and "table". They are pretty intuitive,
just do something analogous to what's done for the "simple" toolbox.
4- edit configure.ac.
a) Change the lines:
AC_INIT([simple], [1.2], [email@example.com])
AC_INIT([mypack], [1.0], [firstname.lastname@example.org])
Of course I wrote example names. Put your real data instead of
"mypack", "email@example.com". The file "your_c_file.c" is
any one of your source files, but just one.
b) In the lines:
if test "x$prefix" = xNONE; then
replace "simple" by "mypack" (your package name).
7- Remove the "src/libsimple.c" file
8- Edit the file "config/loader.sce.in"
a) place any custom code to be executed when your toolbox loads
b) edit the lines specific to the SIMPLE toolbox. Put your specific
9- type ./bootstrap --all
If everything goes well, your package is ready and you will be able to type:
ABOUT THE BOOTSTRAP PROCESS
First, the script "bootstrap" gets your definitions in
config/lib_build.sce and generates a Makefile.am from
your Makefile.am.input (in the src dir), using the script
config/subst_input_files.sh. This is just for convenience, since
when your package grows you won't neet to enter the sources in both
Makefile.am and lib_build.sce, but only once.
After that, the script runs autoconf, automake and libtool, together
with any parameters that these packages need. This will create many
files, mainly the configure script and the final Makefiles.
You must run bootstrap when :
- a new ".c" source is added to "lib_build.sce". In this case, you
must use the "--all" parameter, as in step 9 above
- you edit Makefile.am.input of the src directory
When you edit "configure.ac" or the toplevel "Makefile.am", you must
run the "autoreconf" script.
For a more complex example, checkout the Scilab Image Processing
toolbox (SIP) at http://siptoolbox.sf.net
Please send comments and bugreports to the proper mailing list at: