summaryrefslogtreecommitdiff
path: root/modules/fftw/etc/fftw.start
blob: e1866d19c5bf912f04bf1682742459ae88bc429a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2009-2011  - DIGITEO - Allan CORNET
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt

function startModule()
  if %fftw then
    if getos() == "Windows" then
      librarynamefftw = SCI+"/bin/fftw/libfftw3-3"+getdynlibext();
      librarynamefftw3 = "";
    else
      librarynamefftw = "libfftw3"+getdynlibext();
      // Some distribs/os are not adding the .3 extension...
      librarynamefftw3 = librarynamefftw+".3";
    end

    if ( loadfftwlibrary(librarynamefftw3) | loadfftwlibrary(librarynamefftw)) then
      // replace scilab fft function by fftw
      clearfun('fft');
      newfun('fft', funptr('fftw'));

    else  // if ( loadfftwlibrary(librarynamefftw) )
      settings_file = pathconvert(SCIHOME+"/.scilab_settings", %f, %t)
      w = fileinfo(settings_file);
      show = %t;
      if w <> [] then
        show = grep(mgetl(SCIHOME+"/.scilab_settings"),"displayWarningFFTW=no")==[]
      end
      if show then
        MSG_FTTW = [_("You choose to install scilab with fftw module.");
                  _("This module requires : "+librarynamefftw+" (GPL licence).");
                  _("Scilab will use standard fft by default until you install this library.");
                  _("See help fftw for more information.")];

        if getscilabmode() == "STD" then
          messagebox(MSG_FTTW,"","info");
        else
          warning(MSG_FTTW);
        end
        mputl("displayWarningFFTW=no",SCIHOME+"/.scilab_settings")
      end
    end // if ( loadfftwlibrary(librarynamefftw) )
  end

endfunction

startModule();
clear startModule;