Merge remote-tracking branch 'refs/remotes/origin/master' into preferences
[scilab.git] / scilab / configure.ac
1 #
2 # Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 # Copyright (C) INRIA - 2006-2008 - Sylvestre Ledru
4 # Copyright (C) DIGITEO - 2009-2011 - Sylvestre Ledru
5 # Copyright (C) DIGITEO - 2009 - Pierre MARECHAL <pierre.marechal@scilab.org>
6 #
7 # This file must be used under the terms of the CeCILL.
8 # This source file is licensed as described in the file COPYING, which
9 # you should have received as part of this distribution.  The terms
10 # are also available at
11 # http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
12 #
13
14 dnl Process this file with autoconf to produce a configure script.
15
16
17 AC_REVISION($Revision$)dnl
18 AC_INIT([Scilab],[5],[http://bugzilla.scilab.org/])
19 AC_PREREQ(2.62)
20 AC_CONFIG_MACRO_DIR([m4/])
21
22 SCI_BUILDDIR="`pwd`"
23 SCI_SRCDIR="$srcdir"
24 SCI_SRCDIR_FULL="`cd $SCI_SRCDIR && pwd`"
25
26 SCILAB_VERSION_MAJOR=5
27 SCILAB_VERSION_MINOR=4
28 SCILAB_VERSION_MAINTENANCE=0
29 AC_SUBST(SCILAB_VERSION_MAJOR)
30 AC_SUBST(SCILAB_VERSION_MINOR)
31 AC_SUBST(SCILAB_VERSION_MAINTENANCE)
32
33
34 SCILAB_LIBRARY_VERSION=$SCILAB_VERSION_MAJOR:$SCILAB_VERSION_MINOR:$SCILAB_VERSION_MAINTENANCE
35 AC_SUBST(SCILAB_LIBRARY_VERSION)
36
37 SCILAB_BINARY_VERSION=$SCILAB_VERSION_MAJOR.$SCILAB_VERSION_MINOR.$SCILAB_VERSION_MAINTENANCE
38 AC_SUBST(SCILAB_BINARY_VERSION)
39
40 #shared library versioning
41 #GENERIC_LIBRARY_VERSION=1:2:0
42 #                       | | |
43 #                +------+ | +---+
44 #                |        |     |
45 #             current:revision:age
46 #                |        |     |
47 #                |        |     +- increment if interfaces have been added
48 #                |        |        set to zero if interfaces have been removed
49 #                                  or changed
50 #                |        +- increment if source code has changed
51 #                |           set to zero if current is incremented
52 #                +- increment if interfaces have been added, removed or changed
53
54 # Check if we have a space in the path to the source tree
55 SPACE_IN_PATH=`echo "$SCI_SRCDIR_FULL"|grep " " > /dev/null; echo $?`
56 if test "$SPACE_IN_PATH" = "0"; then
57    AC_MSG_WARN([=====================================])
58    AC_MSG_WARN([Configure thinks that there is a space in the path to the source. This may cause problem with libtool and some other things...])
59    AC_MSG_WARN([=====================================])
60    sleep 180
61 fi
62
63 AC_CONFIG_AUX_DIR(config)
64 AC_CONFIG_HEADERS([modules/core/includes/machine.h])
65
66 # strip executable
67 AM_PROG_INSTALL_STRIP
68 AC_PROG_LN_S
69
70 AC_CUSTOM_LARGE_FILE
71
72 # In order to be able to change the scilab directory
73 # See http://wiki.debian.org/RpathIssue
74 AC_RELOCATABLE
75 AC_RELOCATABLE_LIBRARY
76 AC_LIB_RPATH
77
78 # If configure detect that timestamp changed,
79 # it tries to rebuild configure & makefile which can be a painmaker
80 # if the version is different
81 AM_MAINTAINER_MODE
82
83 AM_INIT_AUTOMAKE([-Wall foreign]) # Not using -Werror because we override {C,F}FLAGS in order to disable optimisation
84
85 AC_CANONICAL_HOST
86
87 #################################
88 ## all the --with-* argument help
89 #################################
90
91
92 AC_ARG_ENABLE(debug,
93    AC_HELP_STRING([--enable-debug],[Do not optimize and print warning messages (C/C++/Fortran/Java code)]))
94
95 AC_ARG_ENABLE(debug-C,
96    AC_HELP_STRING([--enable-debug-C],[Do not optimize and print warning messages (C code)]))
97
98 AC_ARG_ENABLE(debug-CXX,
99    AC_HELP_STRING([--enable-debug-CXX],[Do not optimize and print warning messages (C++ code)]))
100
101 AC_ARG_ENABLE(debug-java,
102    AC_HELP_STRING([--enable-debug-java],[Print warning messages and line numbers (Java code)]))
103
104 AC_ARG_ENABLE(debug-fortran,
105    AC_HELP_STRING([--enable-debug-fortran],[Do not optimize and print warning messages (Fortran code)]))
106
107 AC_ARG_ENABLE(debug-linker,
108    AC_HELP_STRING([--enable-debug-linker],[Print warning messages from the linker (ld)]))
109
110 AC_ARG_ENABLE(code-coverage,
111    AC_HELP_STRING([--enable-code-coverage],[Enable code coverage]))
112
113 AC_ARG_ENABLE(stop-on-warning,
114    AC_HELP_STRING([--enable-stop-on-warning],[Stop the compilation on the first warning found in the C/C++ code]))
115
116 AC_ARG_WITH(gcc,
117     AC_HELP_STRING([--with-gcc],[Use gcc C compiler ]))
118
119 AC_ARG_WITH(gfortran,
120     AC_HELP_STRING([--with-gfortran],[Use gfortran, GNU Fortran 95 compiler]))
121
122 AC_ARG_WITH(intelcompilers,
123     AC_HELP_STRING([--with-intelcompilers],[Use Intel C (icc) and Fortran (ifort) proprietary compilers (GNU/Linux only) ]))
124
125 AC_ARG_WITH(tk,
126     AC_HELP_STRING([--without-tk],[Disable the interface to Tcl/Tk ]))
127
128 AC_ARG_WITH(javasci,
129     AC_HELP_STRING([--without-javasci],[Disable the Java/Scilab interface (javasci)]))
130
131 AC_ARG_ENABLE(compilation-tests,
132     AC_HELP_STRING([--enable-compilation-tests],[Enable unitary tests and checks at compilation time]))
133
134 AC_ARG_WITH(gui,
135     AC_HELP_STRING([--without-gui],[Disable the Scilab Graphical User Interface (GUI). Intended for embedded/clustering/grid Scilab ]))
136
137 AC_ARG_ENABLE(build-swig,
138     AC_HELP_STRING([--enable-build-swig],[Regenerate Java => C wrappers produces by Swig (A Java Development Kit (JDK) is mandatory for this option)]))
139
140 AC_ARG_ENABLE(build-giws,
141     AC_HELP_STRING([--enable-build-giws],[Regenerate C/C++ => Java wrappers produces by Giws (A Java Development Kit (JDK) is mandatory for this option)]))
142
143
144 ################################################
145 ########## compilator & misc programs detection
146 ################################################
147
148 AC_PROG_CPP
149 AC_PROG_GREP
150
151 ######
152 #### Mac OS X set of fink path with provided
153 ######
154
155 AC_ARG_WITH(fink_prefix,
156 AC_HELP_STRING([--with-fink-prefix],[Provide a fink prefix. Default: /sw/ ]))
157
158 case "$host" in
159      *darwin*)
160      if test -n "$with_fink_prefix"; then
161         # If with-fink-prefix is provided, use the provided path to make sure that we will
162     # use it to detect dependencies (for example, gfortran is not provided in xcode.
163     # Therefor, we use the one in fink)
164     FINK_PREFIX="$with_fink_prefix/"
165
166     # Exec the init script of fink to make sure that the env is set
167     if test -f $with_fink_prefix/bin/init.sh; then
168        echo "source $with_fink_prefix/bin/init.sh executed to set the env"
169        source $with_fink_prefix/bin/init.sh
170         else
171        AC_MSG_WARN([Could not find the fink init.sh script: $with_fink_prefix/bin/init.sh])
172     fi
173      else
174     FINK_PREFIX="/sw/"
175      fi
176      ;;
177 esac
178
179 #####################################################
180 ## Look for pkg-config
181 #####################################################
182 PKG_PROG_PKG_CONFIG
183
184 #####################################################
185 ## check if options are correct (or not)
186 #####################################################
187
188 if test "$with_intelcompilers" = yes -a "$with_gcc" = yes; then
189     AC_MSG_ERROR([Conflicting options : you specified two compiler series])
190 fi
191
192 ######## fortran ########
193
194 if test "$with_gfortran" = yes; then
195    AC_PROG_F77(gfortran)
196    if test -z "$F77"; then
197      AC_MSG_ERROR([You asked me to use gfortran but i haven't been able to find it])
198     fi
199 fi
200
201 if test "$with_intelcompilers" = yes; then
202    AC_PROG_F77(ifc ifort)
203    if test -z "$F77"; then
204      AC_MSG_ERROR([You asked me to use ifc (intel fortran compiler) but i haven't been able to find it])
205     fi
206 fi
207
208 if test -z "$F77"; then
209 ## No Fortran compiler specified... Prefer gfortran and intel compilers
210    AC_PROG_F77([gfortran ifc ifort])
211    if test -z "$F77"; then
212         # Best effort to find a compiler (might be g77)
213         AC_PROG_F77
214    fi
215 fi
216
217
218 # case statements were introduced in fortran 90 so we can use that
219 # as a test to see if our compiler is fortran 90 compatible.
220 f90compatible=false
221 if test -z "$F77"; then
222   AC_MSG_ERROR([No fortran compiler found. Cannot compile scilab without a fortran compiler])
223 fi
224
225 AC_MSG_CHECKING([if $F77 is a fortran 90 compatible compiler])
226  f90compatible=false
227 AC_LANG_PUSH([Fortran 77])
228 AC_COMPILE_IFELSE([
229       PROGRAM hello
230         do 50 i = 1, 5
231            select case ( i )
232               case (1)
233                  print*, "case is 1, i is ", i
234               case ( 2 : 3 )
235                  print*, "case is 2 to 3, i is ", i
236               case default
237                  print*, "default case, i is ", i
238               end select
239  50           continue
240       END
241     ],
242     [AC_MSG_RESULT([yes])
243      AC_DEFINE([G95_FORTRAN],[],[uses G95 fortran])
244      f90compatible=true
245     ],
246     [AC_MSG_RESULT([no])]
247 )
248 AC_LANG_POP([Fortran 77])
249
250 ############ C ###############
251
252
253 if test "$with_gcc" = yes; then
254    AC_PROG_CC(gcc)
255    if test -z "$CC"; then
256      AC_MSG_ERROR([You asked me to use gcc but i haven't been able to find it])
257     fi
258 fi
259
260 if test "$with_intelcompilers" = yes; then
261    AC_PROG_CC(icc ecc)
262    if test -z "$CC"; then
263      AC_MSG_ERROR([You asked me to use icc (intel C compiler) but I haven't been able to find it])
264     fi
265 fi
266
267 if test -z "$CC"; then
268 # No C compiler specified... We rely on Autoconf to find the best
269    AC_PROG_CC
270 fi
271
272 if test -z "$CC"; then
273   AC_MSG_ERROR([No C Compiler found. Cannot compile Scilab without a C compiler])
274 fi
275
276 AC_CHECK_SIZEOF([int])
277 AC_CHECK_SIZEOF([long])
278
279 ### C++ ###
280 AC_PROG_CXX
281 # we can't just do something like
282 # AC_CHECK_PROG(cxx_present, $CXX, "yes", "no")
283 # because if the user has specified the full path of the desired C++ compiler then AC_CHECK_PROG
284 # will fail.  If AC_PROG_CXX fails to find a c++ compiler it will set CXX=g++ so just run AC_CHECK_PROG
285 # in this special case
286 case $CXX in
287     g++)
288         AC_CHECK_PROG([cxx_present], [$CXX], [yes], [no])
289         if test "x$cxx_present" != "xyes"; then
290             AC_MSG_ERROR([No C++ compiler found. Cannot compile scilab without a C++ compiler])
291         fi
292         ;;
293 esac
294
295 # for "subdir-objects"
296
297 AM_PROG_CC_C_O
298 AC_PROG_F77_C_O
299
300
301 # If this option is provided, enable the debug on C & C++
302 if test "$enable_stop_on_warning" = yes; then
303    enable_debug_C=yes
304    enable_debug_CXX=yes
305 fi
306
307 if test "$enable_debug" = yes; then
308    enable_debug_fortran=yes
309    enable_debug_C=yes
310    enable_debug_CXX=yes
311    enable_debug_java=yes
312 else
313    enable_debug=no
314 fi
315
316 if test "$enable_debug_fortran" = yes; then
317    FFLAGS="`echo "$FFLAGS"| sed -e 's|-O[0-9+]|-O0|'`"
318 else
319    enable_debug_fortran=no
320 fi
321
322 if test "$enable_debug_C" = yes; then
323    CFLAGS="`echo "$CFLAGS"| sed -e 's|-O[0-9+]|-O0|'`"
324 else
325    enable_debug_C=no
326 fi
327
328 if test "$enable_debug_CXX" = yes; then
329    CXXFLAGS="`echo "$CXXFLAGS"| sed -e 's|-O[0-9+]|-O0|'`"
330 else
331    enable_debug_CXX=no
332 fi
333
334 if test "$enable_debug_java" = yes; then
335    LOGGING_LEVEL="ALL"
336 else
337    LOGGING_LEVEL="INFO"
338 fi
339 AC_SUBST(LOGGING_LEVEL)
340
341 if test "x${prefix}" = "xNONE"; then
342   prefix="${ac_default_prefix}"
343 fi
344
345
346 if test "$enable_largefile" = "yes"; then
347    CFLAGS="$CFLAGS $LARGEFILE_CFLAGS"
348    CXXFLAGS="$CXXFLAGS $LARGEFILE_CFLAGS"
349    FFLAGS="$FFLAGS $LARGEFILE_CFLAGS"
350 fi
351
352 ###############################
353 ## get the version
354 ###############################
355
356 SCIVERSION=`cat $SCI_SRCDIR/Version.incl | sed -e "s/SCIVERSION=//" `
357
358 #############################################
359 ## Compilers and options according to machine
360 #############################################
361
362 ######################
363 ######## Set compilation options for intel C/Fortran compilers
364 ######################
365
366 if test "$with_intelcompilers" = yes; then
367    SCI_INTEL_COMPILER()
368 fi
369
370 ########### FORTRAN ######################
371
372
373 ######################
374 ######## With gfortran ...
375 ######################
376 if test -n "$F77"; then
377    case "$F77" in
378      gfortran*)
379         ## With GNU Compiler enable the code coverage
380         if test "$enable_code_coverage" = yes; then
381             FFLAGS="$FFLAGS -fprofile-arcs -ftest-coverage"
382         fi
383      ;;
384      g77*)
385         AC_MSG_ERROR([g77 is no longer supported. Please consider switching to gfortran])
386      ;;
387    esac
388
389    if test "$enable_debug_fortran" = yes; then
390     AC_LANG_PUSH([Fortran 77])
391     for flag in -g -Wall -Wsurprising; do
392         case " ${FFLAGS} " in
393             *\ ${flag}\ *)
394                 # flag is already present
395                 ;;
396
397             *)
398                 AC_MSG_CHECKING([if the Fortran compiler accepts ${flag}])
399                 ac_save_FFLAGS="$FFLAGS"
400                 FFLAGS="$FFLAGS ${flag}"
401                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
402                     [AC_MSG_RESULT([yes])],
403                     [AC_MSG_RESULT([no])
404                     FFLAGS="$ac_save_FFLAGS"
405                     ]
406                 )
407                 ;;
408         esac
409     done
410     AC_LANG_POP([Fortran 77])
411    else
412       FFLAGS="$FFLAGS -DNDEBUG"
413    fi
414       case "$host" in
415          x86_64-*-linux*)
416             FFLAGS="$FFLAGS -m64 -fPIC"
417                     ;;
418         # Dec Alpha OSF 4
419         alpha*-dec-osf4.*)
420           FFLAGS="$FFLAGS -fpe3"
421         ;;
422         alpha*-dec-osf*)
423             FFLAGS="$FFLAGS -fpe3 -switch nosqrt_recip"
424         ;;
425         rs6000-*-*)
426             FFLAGS="$FFLAGS -qcharlen=4096"
427             ;;
428         mips-*-ultrix*)
429             FFLAGS="-O0 -fpe1"
430         ;;
431           *-*-hpux9.*)
432             FFLAGS="$FFLAGS +Obb1200 +E4 -Dhpux"
433         ;;
434           *-*-hpux10.*)
435             if test "$enable_debug_fortran" = yes; then
436                 FFLAGS="+E4 +Z +DAportable -Dhpux"
437             else
438                    FFLAGS="+O2 +E4 +Z +DAportable -Dhpux"
439             fi
440 #            F77_LDFLAGS="-Wl,+vnocompatwarnings,-E /usr/lib/libdld.sl"
441
442             ;;
443           *-*-hpux11.*)
444            if test "$enable_debug_fortran" = yes; then
445               FFLAGS=" +Z +DAportable -Dhpux"
446              else
447               FFLAGS="+O2 +Z +DAportable -Dhpux"
448            fi
449               FLIBS="-ldld -lnsl -lU77 -lm"
450
451      ;;
452       esac
453
454 fi
455
456 #########################
457 # setting parameters according to system types
458 #########################
459
460 case "$host" in
461     *-*-hpux9.*|*-*-hpux10.*|*-*-hpux11.*)
462         HPUX=1
463     ;;
464     sparc-*)
465         SPARC=1
466     ;;
467     mips-sgi-irix*)
468       MIPS_SGI_IRIX=1
469     ;;
470      *-*-solaris*)
471      SOLARIS=1
472      ;;
473     *darwin*)
474       MACOSX=1
475     ;;
476 esac
477
478 AM_CONDITIONAL(IS_MACOSX, test -n "$MACOSX")
479 AM_CONDITIONAL(IS_HPUX, test -n "$HPUX")
480 AM_CONDITIONAL(IS_SPARC, test -n "$SPARC")
481 AM_CONDITIONAL(IS_SOLARIS, test -n "$SOLARIS")
482 AM_CONDITIONAL(IS_MIPS_SGI_IRIX, test -n "$MIPS_SGI_IRIX")
483
484
485
486 ############
487 ## C++
488 ############
489
490
491 if test -z "$CXX"; then
492   AC_MSG_ERROR([No C++ compiler found. Cannot compile scilab without a C++ compiler])
493 fi
494
495 case "$CXX" in
496      g++-* | g++ | ccache*g++ | ccache*g++-* )
497    ## With GNU C++ Compiler
498
499    # enable the code coverage
500    if test "$enable_code_coverage" = yes; then
501     CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
502    fi
503
504    if test "$enable_debug_CXX" = yes; then
505       CXXFLAGS="$CXXFLAGS -pipe -Wshadow -Wpointer-arith -Wcast-align -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -Wno-strict-aliasing -Wextra -Wall -g3 -Wunsafe-loop-optimizations"
506           case "$host" in
507           *-linux-gnu )
508           # Only doing that under Linux
509                   CXXFLAGS="$CXXFLAGS -fdiagnostics-show-option -Werror=format-security"
510           ;;
511       esac
512    else
513       CXXFLAGS="$CXXFLAGS -DNDEBUG"
514    fi
515    CXXFLAGS="$CXXFLAGS -fno-stack-protector" # bug 3131
516    ;;
517    clang-* | clang)
518            # clang expect an explict declaration
519            LDFLAGS="$LDFLAGS -lstdc++"
520    ;;
521 esac
522
523 #### 64 bits detection
524 IS_64_BITS_CPU=false
525 case "$host" in
526          x86_64-*-linux-gnu | x86_64-linux-gnu | ia64-*-linux-gnu | alpha-*-linux-gnu | alpha-*-netbsd* | x86_64-*-netbsd* | sparc64-*-netbsd*)
527                 IS_64_BITS_CPU=true
528     ;;
529 esac
530
531 ##########"
532
533 case "$CC" in
534      gcc-* | gcc | ccache*gcc | ccache*gcc-* )
535    ## With GNU Compiler
536
537    # enable the code coverage
538    if test "$enable_code_coverage" = yes; then
539     CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
540    fi
541
542    if test "$enable_debug_C" = yes; then
543       CFLAGS="$CFLAGS -pipe -Wformat -Wshadow -Wfloat-equal -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations  -Wstrict-prototypes  -Wmissing-noreturn -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wwrite-strings -Winline -Wredundant-decls -Wall -Wchar-subscripts -Wextra  -Wuninitialized -Wno-format-y2k -Wmissing-format-attribute -Wno-missing-field-initializers -Wno-strict-aliasing  -Wold-style-definition -g3 -Wunsafe-loop-optimizations"
544       # used to be -O
545       # -D_FORTIFY_SOURCE=2
546       case "$host" in
547       *-linux-gnu )
548       # Only doing that under Linux
549         if test "$enable_debugLinker" = yes; then
550             LDFLAGS="$LDFLAGS -Wl,--warn-common,-x"
551         fi
552           CFLAGS="$CFLAGS -fdiagnostics-show-option -Werror=format-security"
553           ;;
554           esac
555    else
556       CFLAGS="$CFLAGS  -DNDEBUG"
557    fi
558    CFLAGS="$CFLAGS -fno-stack-protector" # bug 3131
559
560    # Explictly disable the as needed. It was disable by default but Ubuntu
561    # activated it by default since release 11.04. See bug #8961.
562    # Once all cyclic dependencies have been dropped, this line could be removed.
563    # Check if linker supports --as-needed and --no-as-needed options
564    if $LD --help 2>/dev/null | grep no-as-needed > /dev/null; then
565       LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
566    fi
567
568
569    case "$host" in
570      x86_64-*-linux-gnu | x86_64-linux-gnu)
571         CFLAGS="$CFLAGS -DNARROWPROTO -m64"
572     ;;
573      i*86-*-linux-gnu | *-pc-linux-gnu | i*86-*-linux )
574         CFLAGS="$CFLAGS  -DNARROWPROTO"
575     ;;
576      ia64-*-linux-gnu )
577         CFLAGS="$CFLAGS -DNARROWPROTO"
578     ;;
579      alpha-*-linux-gnu)
580         CFLAGS="$CFLAGS  -mieee-with-inexact"
581         LDFLAGS="$LDFLAGS -mieee-with-inexact"
582     ;;
583      powerpc-*-linux-gnu)
584         CFLAGS="$CFLAGS -D_GNU_SOURCE"
585     ;;
586      *-*-solaris*)
587         CFLAGS="$CFLAGS -DSVR4 -DSYSV -Dsolaris"
588     ;;
589    *-*-freebsd*)
590      CFLAGS="$CFLAGS -Dfreebsd"
591      LDFLAGS="$LDFLAGS -lm"
592      ;;
593
594   alpha-*-netbsd*)
595     CFLAGS="$CFLAGS -Dnetbsd -mieee"
596     FFLAGS="$FFLAGS -Dnetbsd -mieee"
597     ;;
598
599   *-*-netbsd*)
600     CFLAGS="$CFLAGS -Dnetbsd"
601     ;;
602
603   *-*-darwin*)
604     CFLAGS="$CFLAGS -no_compact_linkedit -mmacosx-version-min=10.5"
605     CXXFLAGS="$CXXFLAGS -no_compact_linkedit -mmacosx-version-min=10.5"
606     FFLAGS="$FFLAGS -mmacosx-version-min=10.5"
607     case "$F77" in
608          gfortran-*|gfortran)
609              # Extract from gfortran -v the version it has been built for
610                MAC_DETECTED_ARCH="`$F77 -v 2>&1|grep "Target:"|sed -e "s/Target: \([[a-z0-9A-Z_]]*\).*/\1/g"`"
611          ;;
612          *)
613         AC_MSG_WARN([gfortran not used. Could not detect the architecture. Switch to the default case: x86_64])
614         MAC_DETECTED_ARCH="x86_64"
615          ;;
616     esac
617     CC="$CC -arch $MAC_DETECTED_ARCH"
618     CXX="$CXX -arch $MAC_DETECTED_ARCH"
619     LDFLAGS="-L$FINK_PREFIX/lib/ $LDFLAGS"
620     CFLAGS=" $CFLAGS -I$FINK_PREFIX/include "
621     CXXFLAGS=" $CXXFLAGS -I$FINK_PREFIX/include "
622     ;;
623 esac
624 ;; # end of the gcc case on the $CC
625    *)
626
627         ## CC compiler (not GCC)
628         if test "$enable_debug_C" != yes; then
629              CFLAGS="$CFLAGS -DNDEBUG"
630         fi
631
632 case "$host" in
633 # Dec Alpha OSF 4
634   alpha*-dec-osf4.*)
635       CFLAGS="$CFLAGS -std -ieee_with_inexact"
636       LDFLAGS="$LDFLAGS -ieee_with_inexact"
637       ;;
638   alpha*-dec-osf*)
639       CFLAGS="$CFLAGS -ieee_with_inexact"
640       LDFLAGS="$LDFLAGS -ieee_with_inexact"
641       ;;
642   rs6000-*-*) # IBM AIX RS 6000 (NO LONGER SUPPORTED)
643     CFLAGS="-Daix -DSYSV"
644   ;;
645   mips-sgi-irix*) # SGI
646     CFLAGS="$CFLAGS -DSYSV -DSVR4"
647   ;;
648   *-*-hpux9.*)
649     CFLAGS="$CFLAGS -DSYSV -Dhpux"
650   ;;
651   *-*-hpux10.*) # HP 10
652     if test "$enable_debug_C" = yes; then
653       CFLAGS="$CFLAGS -DSYSV -Dhpux"
654     else
655       CFLAGS="$CFLAGS -DSYSV -Dhpux +Z +DAportable"
656     fi
657   ;;
658
659   *-*-hpux11.*) # HP 11
660     CFLAGS="$CFLAGS -DSYSV -Dhpux -Dhppa +Z +DAportable"
661   ;;
662   *-*-solaris*) # SUN SOLARIS
663     CFLAGS="$CFLAGS -DSVR4 -DSYSV -Dsolaris -I/usr/local/include/"
664     LDFLAGS="$LDFLAGS  -L/usr/local/lib/"
665   ;;
666 esac
667 ;; # end of not a gcc compiler
668 esac
669
670 # enable the code coverage
671 if test "$enable_code_coverage" = yes; then
672    AC_PATH_PROG(LCOV, lcov)
673    if test -z "$LCOV" ; then
674         AC_MSG_ERROR([Cannot find lcov. Please install it (package lcov under Debian) or remove the option --enable-code-coverage])
675    fi
676    AC_PATH_PROG(GENHTML, genhtml)
677    if test -z "$GENHTML" ; then
678         AC_MSG_ERROR([Cannot find genhtml. Please install it (package lcov under Debian) or remove the option --enable-code-coverage])
679    fi
680    LDFLAGS="$LDFLAGS -coverage"
681 fi
682 AM_CONDITIONAL(CODE_COVERAGE, test "$enable_code_coverage" = yes)
683
684 # flag for possible compilations in configure
685 CFLAGS="$CFLAGS "'-I$(top_srcdir)/modules/core/includes/ -I$(top_srcdir)/libs/MALLOC/includes/ -I$(top_srcdir)/modules/localization/includes/'
686 CXXFLAGS="$CXXFLAGS "'-I$(top_srcdir)/modules/core/includes/ -I$(top_srcdir)/libs/MALLOC/includes/ -I$(top_srcdir)/modules/localization/includes/'
687 FFLAGS="$FFLAGS "'-I$(top_srcdir)/modules/core/includes/'
688
689 if test $IS_64_BITS_CPU = true -o "$MACOSX" = "1"; then
690    if test $f90compatible = false; then
691       AC_MSG_ERROR([64 bits support needs a fortran 90 compiler (try --with-gfortran).])
692    fi
693    AC_DEFINE([USE_DYNAMIC_STACK], [], [If we are building a 64 bits version])
694 fi
695
696 AM_CONDITIONAL(IS_64_BITS_CPU, test $IS_64_BITS_CPU = true)
697 AM_CONDITIONAL(USE_DYNAMIC_STACK, test $IS_64_BITS_CPU = true -o "$MACOSX" = "1")
698
699 ################
700 ## SSE
701 ## By default, for x86 CPU, enable the SSE.
702 ## Note that it is already the case with 64 bits CPU
703 ## (these extensions are enabled by default by gcc)
704 ################
705
706 case "$host" in
707      i*86-linux-gnu|i*86-*-linux-gnu)
708         CFLAGS="$CFLAGS -msse"
709         FFLAGS="$FFLAGS -msse"
710         CPPFLAGS="$CPPFLAGS -msse"
711      ;;
712 esac
713
714 #######################
715 ## test for underscores (name mangling issues between C and fortran)
716 #######################
717 AC_CHECK_UNDERSCORE_FORTRAN()
718
719
720 #################
721 ## HDF5
722 #################
723
724 AC_ARG_WITH(hdf5,
725     AC_HELP_STRING([--without-hdf5],[Disable the interface to the HDF5 library]))
726
727 HDF5_ENABLE=no
728
729 if test "$with_hdf5" != no; then
730    AC_HDF5()
731 # TODO: check if the JNI JHDF5 library are available
732    HDF5_ENABLE=yes
733 fi
734
735 AC_SUBST(HDF5_ENABLE)
736 AM_CONDITIONAL(HDF5, test "$with_hdf5" != no)
737
738 #################
739 ## XCOS
740 #################
741
742 AC_ARG_WITH(xcos,
743     AC_HELP_STRING([--without-xcos],[Disable Xcos]))
744
745 AC_ARG_WITH(modelica,
746     AC_HELP_STRING([--without-modelica],[Disable the OCaml module (modelica)]))
747
748
749 if test "$with_gui" = no; then
750    AC_MSG_WARN([GUI is disabled. Disabling then xcos])
751    with_xcos=no
752 fi
753
754 XCOS_ENABLE=no
755
756 if test "$with_xcos" != no -a "$with_gui" != no; then
757    AC_DEFINE([WITH_XCOS], [], [With XCOS])
758
759    save_LIBS="$LIBS"
760
761    AC_CHECK_LIB([rt], [clock_gettime],
762               [RT_LIB="-lrt";
763               AC_DEFINE([HAVE_CLOCK_GETTIME], [1],[Whether clock_gettime is available]) ],
764         [AC_MSG_WARN([librt: library missing (Cannot find symbol clock_gettime). Check if librt is installed (it is usually provided by the libc) and if the version is correct])]
765    )
766    LIBS="$save_LIBS"
767    AC_SUBST(RT_LIB)
768
769
770 #################
771 ## ocaml which only called when using Xcos
772 #################
773
774    if test "$with_modelica" != no; then
775       AC_CHECK_PROG_OCAML()
776    fi
777    XCOS_ENABLE=yes
778
779 fi
780
781 AC_SUBST(XCOS_ENABLE)
782
783 AM_CONDITIONAL(OCAML, test "$with_modelica" != no -a "$OCAMLC" != no -a "$OCAMLOPT" != no)
784 AM_CONDITIONAL(XCOS, test "$XCOS_ENABLE" != no)
785
786 ###########################
787 ## test for JAVA compiler
788 ###########################
789
790 if test "$with_javasci" != no -o "$with_gui" != no -o "$enable_build_help" != no; then
791    # Need MacosX Version to specify some path.
792    case "$host_os" in
793                    *Darwin* | *darwin*)
794                    AC_GET_MACOSX_VERSION;;
795   esac
796
797    # See if --with-jdk command line argument is given
798      # Try to detect the installed JVM, this could be controlled
799      # by the above --with options
800      AC_JAVA_WITH_JDK
801      AC_JAVA_DETECT_JVM
802      case "$ac_java_jvm_version" in
803         1.6 | 1.7)
804         ;;
805         *)
806             AC_MSG_ERROR([Wrong version of Java. Expected at least 1.6. Found $ac_java_jvm_version])
807         ;;
808      esac
809
810    if test "$ac_java_jvm_name" = "jdk"; then
811         JAVA_HOME=$ac_java_jvm_dir
812         JAVA_VERSION=$ac_java_jvm_version
813 #     AC_JAVA_TOOLS
814         AC_JAVA_JNI_INCLUDE
815         JAVA_JNI_INCLUDE=$ac_java_jvm_jni_include_flags
816
817         case "$host_os" in
818              *Darwin* | *darwin*)
819                # Mac OS X does not link against the lib but uses -framework
820                JAVA_JNI_LIBS="-framework JavaVM"
821              ;;
822              *)
823                AC_JAVA_JNI_LIBS
824                JAVA_JNI_LIBS=$ac_java_jvm_jni_lib_flags
825                JAVA_JNI_LIBS_PRELOAD=$ac_java_jvm_ld_preload
826              ;;
827         esac
828
829         AC_JAVA_CLASSPATH
830         JAVA_CLASSPATH=$ac_java_classpath
831         AC_JAVA_TOOLS
832         AC_JAVA_ANT
833
834         case "$host_os" in
835              *Darwin* | *darwin*)
836                   JAVA_HOME=""
837              ;;
838         esac
839
840
841         if test "$with_gui" != no; then
842
843                 if test $XCOS_ENABLE = yes; then
844                    # jgraphx
845                    AC_JAVA_CHECK_PACKAGE([jgraphx],[com.mxgraph.model.mxCell],[Diagram design])
846                    JGRAPHX=$PACKAGE_JAR_FILE
847                    AC_SUBST(JGRAPHX)
848
849                    AC_JAVA_CHECK_VERSION_PACKAGE([jgraphx],[import com.mxgraph.view.mxGraph;],$JGRAPHX,[1.8.0.0],[mxGraph.VERSION],[],[])
850
851                    # Java HDF5 is only needed for Xcos
852                    if test $HDF5_ENABLE = yes -a "$with_xcos" != no -a "$with_gui" != no;  then
853                       AC_JAVA_HDF5()
854                       if test "$MACOSX" = 1; then
855                          echo "Check of the presence of libjhdf5.jnilib disabled under Mac OS X"
856                       else
857                          AC_JNI_HDF5()
858                       fi
859                    fi #HDF5_ENABLE
860
861                 fi
862
863                 # Docking system
864                 AC_JAVA_CHECK_PACKAGE([flexdock],[org.flexdock.docking.DockingManager],[Scilab Gui])
865                 FLEXDOCK=$PACKAGE_JAR_FILE
866                 AC_SUBST(FLEXDOCK)
867
868                 AC_JAVA_CHECK_VERSION_PACKAGE([flexdock],[import org.flexdock.util.Utilities;],$FLEXDOCK,[1.0],[Utilities.VERSION])
869
870                 # Swing look&feel implementations
871                 AC_JAVA_CHECK_PACKAGE([looks],[com.jgoodies.looks.common.MenuItemRenderer],[Scilab Gui - Look and feel],"yes")
872                 LOOKS=$PACKAGE_JAR_FILE
873
874                 # Named differently under ArchLinux or Fedora
875                 if test -z "$LOOKS"; then
876                     AC_JAVA_CHECK_PACKAGE([jgoodies-looks],[com.jgoodies.looks.common.MenuItemRenderer],[Scilab Gui - Look and feel])
877                     LOOKS=$PACKAGE_JAR_FILE
878                 fi
879                 AC_SUBST(LOOKS)
880
881                 #  Skin Look and Feel
882                 AC_JAVA_CHECK_PACKAGE([skinlf],[com.l2fprod.util.AccessUtils],[Scilab Gui - Skin Look and Feel])
883                 SKINLF=$PACKAGE_JAR_FILE
884                 AC_SUBST(SKINLF)
885
886                 # JOGL
887                 AC_JAVA_CHECK_PACKAGE([jogl],[javax.media.opengl.glu.GLUnurbs],[Scilab 3D rendering - Version 1.1.1])
888                 JOGL=$PACKAGE_JAR_FILE
889                 AC_SUBST(JOGL)
890
891                 if test "$MACOSX" = 1; then
892                    echo "Check of the presence of libjogl.jnilib and libjogl_awt.jnilib disabled under Mac OS X"
893                 else
894                    LDFLAGS_save=$LDFLAGS
895                    # Provide known paths where distribs/OS can store JNI libs
896                    LDFLAGS="$LDFLAGS -L/usr/lib/jni -L/usr/lib64/jni"                   # Debian
897                    LDFLAGS="$LDFLAGS -L/usr/lib/jogl -L/usr/lib64/jogl"                 # RedHat
898                    LDFLAGS="$LDFLAGS -L$SCI_SRCDIR/thirdparty -L$SCI_SRCDIR/bin"        # Scilab thirdparties
899                    AC_CHECK_LIB([jogl], [glTexParameterf], [JOGL_LIBS="-ljogl"],[AC_MSG_WARN([Could not link against -ljogl. Will try against -ljogl -lGL])])
900                    if test -z "$JOGL_LIBS"; then # The previous test failed add more options to the LDFLAGS
901                        # the space after "jogl" in the following line is on
902                        # purpose to disable the cache
903                           AC_CHECK_LIB([jogl ], [glTexParameterf],
904                        [JOGL_LIBS="-ljogl -lGL"],
905                        [AC_MSG_ERROR(["libjogl: Library
906 missing (Cannot find symbol glTexParameterf). Check if libjogl - C/Java (JNI)
907 interface for JOGL - or libGL are installed and if the version is correct. Note
908 that you might have to update etc/librarypath.xml to provide the actual path
909 the the JNI libraries."])],
910                        [-lGL])
911                    fi
912
913                    LDFLAGS=$LDFLAGS_save
914                 fi
915
916                 # JoGL Native <=> Java connector
917                 AC_JAVA_CHECK_PACKAGE([gluegen-rt],[com.sun.gluegen.runtime.CPU],[Scilab 3D rendering])
918                 GLUEGEN_RT=$PACKAGE_JAR_FILE
919                 AC_SUBST(GLUEGEN_RT)
920
921                 if test "$MACOSX" = 1; then
922                    echo "Check of the presence of libgluegen-rt.jnilib disabled under Mac OS X"
923                 else
924                    LDFLAGS_save=$LDFLAGS
925                    # Provide known paths where distribs/OS can store JNI libs
926                    LDFLAGS="$LDFLAGS -L/usr/lib/jni -L/usr/lib64/jni"                   # Debian
927                    LDFLAGS="$LDFLAGS -L/usr/lib/gluegen -L/usr/lib64/gluegen"           # RedHat
928                    LDFLAGS="$LDFLAGS -L$SCI_SRCDIR/thirdparty -L$SCI_SRCDIR/bin"        # Scilab thirdparties
929                    symbol="Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlclose__J"
930                    AC_CHECK_LIB([gluegen-rt], [$symbol], [GLUEGEN_RT_LIBS="-lgluegen-rt"],
931                    [AC_MSG_ERROR([libgluegen-rt: Library missing (Cannot find symbol glTexParameterf). Check if libgluegen-rt - C/Java (JNI) interface for GLUEGEN - is installed and if the version is correct. Note that you might have to update etc/librarypath.xml to provide the actual path the the JNI libraries.])],
932                    [-ldl])
933                    LDFLAGS=$LDFLAGS_save
934                 fi
935
936                 # Jhall
937                 AC_JAVA_CHECK_PACKAGE([jhall],[javax.help.JHelp],[Scilab Help Browser],"yes")
938                 JHALL=$PACKAGE_JAR_FILE
939
940                 # Named differently under Mandriva or Fedora
941                 if test -z "$JHALL"; then
942                     AC_JAVA_CHECK_PACKAGE([javahelp2],[javax.help.JHelp],[Scilab Help Browser])
943                     JHALL=$PACKAGE_JAR_FILE
944                 fi
945                 AC_SUBST(JHALL)
946
947                 # Console API
948                 AC_JAVA_CHECK_PACKAGE([jrosetta-API],[com.artenum.rosetta.interfaces.core.ConsoleConfiguration],[JRosetta : Console API Artenum / Scilab],"yes")
949                 JROSETTA_API=$PACKAGE_JAR_FILE
950                 if test -z "$JROSETTA_API"; then
951                         AC_JAVA_CHECK_PACKAGE([jrosetta-api],[com.artenum.rosetta.interfaces.core.ConsoleConfiguration],[JRosetta : Console API Artenum / Scilab])
952                         JROSETTA_API=$PACKAGE_JAR_FILE
953                 fi
954                 AC_SUBST(JROSETTA_API)
955
956                 # Console Core
957                 AC_JAVA_CHECK_PACKAGE([jrosetta-engine],[com.artenum.rosetta.core.action.AbstractConsoleAction],[JRosetta : Console Core Artenum / Scilab])
958                 JROSETTA_ENGINE=$PACKAGE_JAR_FILE
959                 AC_SUBST(JROSETTA_ENGINE)
960                 AC_JAVA_CHECK_VERSION_PACKAGE([jrosetta-engine],[import com.artenum.rosetta.util.ConfigurationBuilder;],$JROSETTA_ENGINE,[1.0.4],[ConfigurationBuilder.getVersion()])
961
962
963                 # MathML rendering solution
964                 # Used in both graphic & help
965                 AC_JAVA_CHECK_PACKAGE([jeuclid-core],[net.sourceforge.jeuclid.LayoutContext],[MathML rendering solution (at least version 3.1.X)])
966                 JEUCLID_CORE=$PACKAGE_JAR_FILE
967                 AC_SUBST(JEUCLID_CORE)
968
969
970                 ################ Mandatory for graphic_export features #####
971                 # XML to PDF/other Translator
972                 AC_JAVA_CHECK_PACKAGE([fop],[org.apache.fop.pdf.PDFInfo],[XML to PDF Translator (fop)])
973                 FOP=$PACKAGE_JAR_FILE
974                 AC_SUBST(FOP)
975
976                 # xml.apache.org SVG Library (under mandriva for example)
977                 AC_JAVA_CHECK_PACKAGE([batik-all],[org.apache.batik.parser.Parser],[Apache SVG Library],"yes")
978                 BATIK=$PACKAGE_JAR_FILE
979
980                 if test -z "$BATIK"; then
981                    # Other other distribs
982                    AC_JAVA_CHECK_PACKAGE([batik],[org.apache.batik.parser.Parser],[Apache SVG Library])
983                    BATIK=$PACKAGE_JAR_FILE
984                 fi
985                 AC_SUBST(BATIK)
986                 AC_JAVA_CHECK_VERSION_PACKAGE([batik],[import org.apache.batik.Version;],$BATIK,[1.7],[Version.getVersion()])
987
988                 # Commons I/O library
989                 AC_JAVA_CHECK_PACKAGE([commons-io],[org.apache.commons.io.output.CountingOutputStream],[Commons I/O library])
990                 COMMONS_IO=$PACKAGE_JAR_FILE
991                 AC_SUBST(COMMONS_IO)
992
993                 # XML graphics common
994                 AC_JAVA_CHECK_PACKAGE([xmlgraphics-commons],[org.apache.xmlgraphics.util.Service],[Commons graphics library])
995                 XMLGRAPHICS_COMMONS=$PACKAGE_JAR_FILE
996                 AC_SUBST(XMLGRAPHICS_COMMONS)
997
998                 # Avalon Framework (PDF)
999                 AC_JAVA_CHECK_PACKAGE([avalon-framework],[org.apache.avalon.framework.configuration.ConfigurationException],[Common framework for Java server application])
1000                 AVALON_FRAMEWORK=$PACKAGE_JAR_FILE
1001                 AC_SUBST(AVALON_FRAMEWORK)
1002
1003                 # XML API EXT (conversion of a SVG => PNG)
1004                 AC_JAVA_CHECK_PACKAGE([xml-apis-ext],[org.w3c.dom.svg.SVGDocument],[XML Commons external code],"yes")
1005                 XML_APIS_EXT=$PACKAGE_JAR_FILE
1006
1007                 if test -z "$XML_APIS_EXT"; then
1008                     # Other other distribs (Ex: Fedora/Redhat)
1009                     AC_JAVA_CHECK_PACKAGE([xml-commons-apis-ext],[org.w3c.dom.svg.SVGDocument],[XML Commons external code])
1010                     XML_APIS_EXT=$PACKAGE_JAR_FILE
1011                 fi
1012                 AC_SUBST(XML_APIS_EXT)
1013
1014                 ################ END Mandatory for graphic_export features #####
1015
1016
1017                 # Logging (flexdock dep)
1018                 AC_JAVA_CHECK_PACKAGE([commons-logging],[org.apache.commons.logging.LogFactory],[Apache logging])
1019                 COMMONS_LOGGING=$PACKAGE_JAR_FILE
1020                 AC_SUBST(COMMONS_LOGGING)
1021
1022                 # JLaTeXMath
1023                 AC_JAVA_CHECK_PACKAGE([jlatexmath],[org.scilab.forge.jlatexmath.TeXFormula],[LaTex Rendering])
1024                 JLATEXMATH=$PACKAGE_JAR_FILE
1025                 AC_SUBST(JLATEXMATH)
1026
1027                 AC_JAVA_CHECK_VERSION_PACKAGE([jlatexmath],[import org.scilab.forge.jlatexmath.TeXFormula;],$JLATEXMATH,[0.9.4],[TeXFormula.VERSION])
1028
1029                 AC_DEFINE([WITH_GUI],[],[With the JAVA stuff (GUI, Console, JOGL...)])
1030
1031         fi
1032
1033         # Checkstyle (code checking)
1034         AC_JAVA_CHECK_PACKAGE([checkstyle],[com.puppycrawl.tools.checkstyle.CheckStyleTask],[Checkstyle - code checking],"yes")
1035         CHECKSTYLE=$PACKAGE_JAR_FILE
1036         AC_SUBST(CHECKSTYLE)
1037
1038         # Commons beanutils (dependency of checkstyle)
1039         AC_JAVA_CHECK_PACKAGE([commons-beanutils],[org.apache.commons.beanutils.Converter],[Bean utility],"yes")
1040         COMMONS_BEANUTILS=$PACKAGE_JAR_FILE
1041         AC_SUBST(COMMONS_BEANUTILS)
1042
1043         # antlr (dependency of checkstyle)
1044         AC_JAVA_CHECK_PACKAGE([antlr],[antlr.TokenStreamException],[language tool for constructing recognizers],"yes")
1045         ANTLR=$PACKAGE_JAR_FILE
1046         AC_SUBST(ANTLR)
1047
1048         # Test NG (java unitary test)
1049         AC_JAVA_CHECK_PACKAGE([testng],[org.testng.TestNG],[TestNG - Unit tests],"yes")
1050         TESTNG=$PACKAGE_JAR_FILE
1051         AC_SUBST(TESTNG)
1052
1053         # JCommander - dependency of TestNG >= 6
1054         AC_JAVA_CHECK_PACKAGE([beust-jcommander],[com.beust.jcommander.JCommander],[JCommander - Parse java options],"yes")
1055         JCOMMANDER=$PACKAGE_JAR_FILE
1056         AC_SUBST(JCOMMANDER)
1057
1058         # Qdox (parses declarations and Javadoc) - dependency of TestNG
1059         AC_JAVA_CHECK_PACKAGE([qdox],[com.thoughtworks.qdox.tools.QDoxTester],[Parses declarations and Javadoc ],"yes")
1060         QDOX=$PACKAGE_JAR_FILE
1061         AC_SUBST(QDOX)
1062
1063                 # bsh (Java scripting environment) - dependency of TestNG
1064                 AC_JAVA_CHECK_PACKAGE([bsh],[bsh.Console],[Java scripting environment],"yes")
1065                 BSH=$PACKAGE_JAR_FILE
1066                 AC_SUBST(BSH)
1067
1068                 # Junit - dependency of TestNG
1069                 AC_JAVA_CHECK_PACKAGE([junit],[junit.framework.Assert],[Unitary tests],"yes")
1070                 JUNIT=$PACKAGE_JAR_FILE
1071                 AC_SUBST(JUNIT)
1072
1073
1074     else
1075         AC_MSG_WARN([Sun javac not found: I will not build the java interface])
1076         if test "$ac_java_jvm_name" != ""; then
1077             AC_MSG_WARN([We do not support $ac_java_jvm_name yet])
1078         fi
1079     fi
1080     AC_SUBST(JAVA_JNI_INCLUDE)
1081     AC_SUBST(JAVA_JNI_LIBS)
1082     AC_SUBST(JAVA_HOME)
1083
1084
1085     if test "$enable_debug_java" = yes; then
1086         JAVAC_DEBUG="on"
1087     else
1088         JAVAC_DEBUG="off"
1089     fi
1090     AC_SUBST(JAVAC_DEBUG)
1091
1092     if test "$enable_build_swig" != no -a "$enable_build_swig" != ""; then
1093         SWIG_PROG()
1094         SWIG_ENABLE_JAVA()
1095         AC_SUBST(SWIG_BIN)
1096         AC_SUBST(SWIG_JAVA)
1097
1098     fi
1099
1100     # Giws is the equivalent of Swig developped by the Scilab team
1101     # in order to provide a wrapper to Java from C/C++
1102     if test "$enable_build_giws" != no -a "$enable_build_giws" != ""; then
1103         AC_GIWS([1.3.0])
1104     fi
1105 fi
1106
1107 JAVA_ENABLE=yes
1108
1109 if test -z "$JAVAC"; then
1110    JAVA_ENABLE=no
1111 fi
1112
1113 AC_SUBST(JAVA_ENABLE)
1114
1115 # Xcos is not checked here because gui=no disables it
1116 AM_CONDITIONAL(NEED_JAVA, test "$with_javasci" != no -o "$with_gui" != no -o "$enable_build_help" != no)
1117 AM_CONDITIONAL(GUI, test "$with_gui" != no)
1118 AM_CONDITIONAL(JAVASCI, test "$with_javasci" != no)
1119 AM_CONDITIONAL(SWIG, test "$enable_build_swig" != no -a "$enable_build_swig" != "")
1120 AM_CONDITIONAL(GIWS, test "$enable_build_giws" != no  -a "$enable_build_giws" != "")
1121
1122 ##############################################################
1123 ## GUI module
1124 ##############################################################
1125
1126 GUI_ENABLE=no
1127
1128 if test "$JAVA_ENABLE" != no; then
1129    GUI_ENABLE=yes
1130 fi
1131
1132 if test "$with_gui" != no; then
1133    GUI_ENABLE=yes
1134 fi
1135
1136 AC_SUBST(GUI_ENABLE)
1137
1138 ##############################################################
1139 ## test for functions in standard C library and C math library
1140 ##############################################################
1141
1142 # Provided by unistd.h
1143 AC_CHECK_FUNCS([sleep] [usleep] [dup2] [getcwd] [getpagesize] [getpass])
1144 AC_CHECK_FUNCS([rmdir])
1145
1146 AC_CHECK_FUNC([getwd],AC_DEFINE([HAVE_GETWD],[1],[Define to 1 if you have the `getwd' function.]),[AC_DEFINE([getwd(x)],[getcwd(x,1024)],[Don't use getwd but getcwd])])
1147
1148 # Provided by <regex.h>
1149 AC_CHECK_FUNCS([regcomp])
1150
1151 # Provided by stdlib.h
1152 AC_CHECK_FUNCS([atexit] [putenv] [setenv])
1153
1154 # Provided by String.h
1155 AC_CHECK_FUNCS([bzero] [memmove] [memset] [strcasecmp] [strerror] [strchr] [strdup] [strpbrk] [strrchr] [strstr] [strtol])
1156
1157 # Provided by select.h
1158 AC_CHECK_FUNCS([select])
1159
1160 # Provided by pwd.h
1161 AC_CHECK_FUNCS([endpwent])
1162
1163 # Provided by netdb.h
1164 AC_CHECK_FUNCS([gethostbyaddr] [gethostbyname] [gethostname])
1165
1166 # Provided by time.h
1167 AC_CHECK_FUNCS([gettimeofday])
1168
1169 # Provided by ctype.h
1170 AC_CHECK_FUNCS([isascii])
1171
1172 # Provided by wctype.h
1173 AC_CHECK_FUNCS([iswprint])
1174
1175 # Provided by types.h
1176 AC_CHECK_FUNCS([mkdir])
1177
1178 # Provided by mman.h
1179 AC_CHECK_FUNCS([munmap])
1180
1181 # Provided by signal.h
1182 AC_CHECK_FUNCS([strsignal])
1183
1184
1185 # Check of the libm (lib math). Macro provided by libtool.
1186 save_LDFLAGS="$LDFLAGS"
1187 LT_LIB_M()
1188
1189 # Provided by math.h
1190
1191 LDFLAGS="$LDFLAGS $LIBM"
1192 AC_CHECK_FUNCS([pow] [sqrt] [finite] [floor] [exp10])
1193
1194 ### If isinf exists or not (used to not be the case under Solaris)
1195 ### See bug #4164
1196 AC_CHECK_FUNC([isinf],,[
1197         AC_DEFINE([isinf(x)],[(!finite(x) && x==x)],[Provide a macro to do isinf])
1198 ])
1199 LIBS="$LIBS $LIBM"
1200 LDFLAGS="$save_LDFLAGS"
1201
1202 # Provided by regex.h
1203 AC_CHECK_FUNCS([re_comp])
1204
1205 # Provided by socket.h
1206 AC_CHECK_FUNCS([socket])
1207
1208 # Provided by utsname.h
1209 AC_CHECK_FUNCS([uname])
1210
1211 # Provided by wtloop.c
1212 AC_CHECK_FUNCS([setlocale])
1213
1214 # Function memcmp used in modules/fileio/src/c/xls.c
1215 AC_FUNC_MEMCMP
1216
1217 # function stat used in modules/core/src/c/link_std.c
1218 AC_FUNC_STAT
1219
1220 # function strtod used in modules/core/src/c/getval.c
1221 AC_FUNC_STRTOD
1222
1223 ########################
1224 ## test for header files
1225 ########################
1226
1227 AC_CHECK_HEADERS([limits.h values.h])
1228
1229 AC_CHECK_HEADERS([fcntl.h float.h libintl.h locale.h malloc.h netdb.h netinet/in.h nlist.h sgtty.h stddef.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/timeb.h sys/utsname.h syslog.h term.h termcap.h termio.h termios.h wchar.h wctype.h time.h])
1230
1231 # check header dirent
1232 AC_HEADER_DIRENT
1233
1234 # static struct timeval defined or not | used in modules/core/src/c/timer.c
1235 AC_HEADER_TIME
1236
1237 # check if the specific header is available or not | used in modules/core/src/c/link_SYSV.c
1238 AC_HEADER_SYS_WAIT
1239
1240
1241 #######################
1242 ## Test for structures ##
1243 #######################
1244 AC_CHECK_MEMBERS([struct stat.st_blksize])
1245 AC_CHECK_MEMBERS([struct stat.st_rdev])
1246
1247
1248 #######################
1249 ## MISC Test
1250 #######################
1251
1252 # gettext.  See http://www.gnu.org/software/hello/manual/gettext/AM_005fGNU_005fGETTEXT.html
1253 AM_GNU_GETTEXT([external])
1254 AM_GNU_GETTEXT_VERSION([0.16])
1255
1256 # function closedir used in modules/metanet/src/c/files.c
1257 AC_FUNC_CLOSEDIR_VOID
1258
1259 # Signals used in modules/core/src/c/realmain.c
1260 AC_TYPE_SIGNAL
1261
1262 # struct tm used in modules/core/src/c/history.c
1263 AC_STRUCT_TM
1264
1265 # st_blocks in the struct in modules/io/sci_gateway/c/intfilestat.c
1266 AC_STRUCT_ST_BLOCKS
1267
1268
1269 ##################
1270 ## termcap library
1271 ##################
1272
1273 # some systems may have a system curses implementation as well as ncurses
1274 # installed.  We need to be consistent in making sure we get the correct
1275 # library to go with the correct header and also provide a way for the user
1276 # to have some control over which is picked when both are available.
1277 #
1278 # For now, just check for -lcurses and then -lncurses.  The user control
1279 # may need to be revisited
1280
1281 TERMCAP_LIB=no
1282
1283 # Various observations:
1284 #
1285 #  ncurses
1286 #    - installs ncurses.h and possibly curses.h as a link to ncurses.h
1287 #    - installs -lncurses.
1288 #    - need to include term.h for tgetent() but tgetent() is in -lncurses.a
1289 #
1290 # curses as found in NetBSD-4 and NetBSD-5
1291 #    - installs curses.h
1292 #    - need to include termcap.h and link with -ltermcap for tgetent()
1293 #
1294
1295 AC_CHECK_LIB([curses],[main])
1296 if test $ac_cv_lib_curses_main = no ; then
1297     AC_CHECK_LIB([ncurses],[main])
1298 fi
1299
1300 # make sure we have what we need for tgetent
1301 AC_SEARCH_LIBS([tgetent],[termcap])
1302
1303 AC_CHECK_HEADERS([ncurses.h curses.h])
1304
1305 if test "x$ac_cv_lib_curses_main" = "xyes" -o "x$ac_cv_lib_ncurses_main" = "xyes" ; then
1306   AC_DEFINE([HAVE_TERMCAP],[],[Have Term Cap])
1307 else
1308  AC_MSG_ERROR([No termcap library detected. Please install ncurses dev library (or termcap library)])
1309 fi
1310
1311 ##################
1312 ## other libraries
1313 ##################
1314
1315 AC_CHECK_LIB(dl, dlopen)
1316
1317 AC_SEARCH_LIBS([pthread_join],[pthread])
1318
1319 #################
1320 ## FFTW
1321 #################
1322
1323 AC_ARG_WITH(fftw,
1324     AC_HELP_STRING([--without-fftw],[Disable the interface to the FFTW 3 library]))
1325
1326 FFTW_ENABLE=no
1327 if test "$with_fftw" != no; then
1328    AC_FFTW()
1329    FFTW_ENABLE=yes
1330 fi
1331
1332 AC_SUBST(FFTW_ENABLE)
1333 AM_CONDITIONAL(FFTW, test "$with_fftw" != no)
1334
1335
1336 #################
1337 ## MPI
1338 #################
1339
1340 # Not in Scilab 5.0
1341 #AC_ARG_WITH(mpi,
1342 #    [  --with-mpi               compile with MPI library])
1343 #
1344 #if test "$with_mpi" = yes; then
1345 #   AC_OPENMPI()
1346 #   # We will have to detect other implementation of OpenMPI
1347 #fi
1348 #AM_CONDITIONAL(MPI, test "$with_mpi" = yes)
1349
1350 #################
1351 ## OpenMP
1352 #################
1353
1354 AC_ARG_WITH(openmp,
1355     AC_HELP_STRING([--without-openmp],[Disable the usage of OpenMP (parallelization of some algoritms)]))
1356
1357 OPENMP_ENABLE=no
1358 if test "$with_openmp" != no; then
1359 #   AC_OPENMP
1360     OPENMP_CFLAGS="-fopenmp"
1361     OPENMP_CXXFLAGS="-fopenmp"
1362     OPENMP_LIBS="-lgomp"
1363
1364     AC_CHECK_HEADERS([omp.h], [],
1365      [AC_MSG_ERROR([Could not find omp.h])])
1366
1367     OPENMP_ENABLE=yes
1368 fi
1369 AC_SUBST(OPENMP_ENABLE)
1370 AC_SUBST(OPENMP_CFLAGS)
1371 AC_SUBST(OPENMP_CXXFLAGS)
1372 AC_SUBST(OPENMP_LIBS)
1373
1374 AM_CONDITIONAL(OPENMP, test "$with_openmp" != no)
1375
1376
1377 #######################
1378 ## Test for libxml
1379 #######################
1380
1381 AC_LIBXML2()
1382
1383 #######################
1384 ## Test for gettext
1385 #######################
1386
1387 ALL_LINGUAS="fr_FR zh_CN zh_TW ru_RU ca_ES de_DE es_ES pt_BR ja_JP it_IT uk_UA pl_PL cs_CZ"
1388 ALL_LINGUAS_DOC="en_US fr_FR pt_BR ja_JP"
1389
1390 AC_ARG_ENABLE(build-localization,
1391         AC_HELP_STRING([--disable-build-localization],[Disable the localization build])
1392         )
1393 BUILD_LOCALIZATION_ENABLE=no
1394
1395 if test "$enable_build_localization" != no; then
1396
1397    AC_SUBST(ALL_LINGUAS)
1398    AC_SUBST(ALL_LINGUAS_DOC)
1399    AC_CHECK_FUNCS([bind_textdomain_codeset])
1400
1401    AC_PATH_PROG(MSGCAT, msgcat, no)
1402 #   AC_PATH_PROG(MSGFMT, msgfmt, no)
1403 #   AC_PATH_PROG(XGETTEXT, xgettext, no)
1404
1405    if test x$MSGFMT = xno; then
1406       AC_ERROR([The msgfmt command is required to build Scilab.  If it is installed on your system, ensure that it is in your path.  If it is not, install GNU gettext to continue or use the option --disable-build-localization ])
1407       fi
1408     if test x$MSGCAT = xno; then
1409       AC_ERROR([The msgcat command is required to build Scilab.  If it is installed on your system, ensure that it is in your path.  If it is not, install GNU gettext to continue or use the option --disable-build-localization ])
1410     fi
1411     BUILD_LOCALIZATION_ENABLE=yes
1412 fi
1413 AM_CONDITIONAL(GENERATE_LOCALIZATION_FILES, test "$BUILD_LOCALIZATION_ENABLE" = yes)
1414
1415 #######################
1416 ## Test for blas/Atlas and lapack
1417 #######################
1418 AC_MSG_CHECKING([if BLAS, ATLAS or MKL is available])
1419 echo ""
1420 ACX_BLAS(
1421         [AC_MSG_RESULT([$BLAS_TYPE found])]
1422         ,
1423         AC_MSG_ERROR([Impossible to find a BLAS compatible library (see BLAS or ATLAS).])
1424         )
1425
1426 AC_MSG_CHECKING([if LAPACK is available])
1427 echo ""
1428 ACX_LAPACK(
1429         [AC_MSG_RESULT([$LAPACK_TYPE found])],
1430         AC_MSG_ERROR([Impossible to find the LAPACK library.])
1431         )
1432
1433 AC_MSG_CHECKING([if ARPACK-ng is available])
1434 echo ""
1435 ACX_ARPACK(
1436         [AC_MSG_RESULT([arpack library found])],
1437         AC_MSG_ERROR([Impossible to find the ARPACK library. Please note that arpack was bundled with version prior to 5.4.0 and Scilab requires arpack-ng ( http://forge.scilab.org/index.php/p/arpack-ng/ ).])
1438         )
1439
1440 CHECK_ARPACK_OK(
1441 [AC_MSG_RESULT([Working ARPACK library found (probably arpack-ng or a patched version of arpack)])],
1442 [AC_MSG_ERROR([ARPACK library found, but seems not to work properly. Please make sure you are using arpack-ng])
1443 ])
1444 #################
1445 ## UMFPACK
1446 #################
1447
1448 AC_ARG_WITH(umfpack,
1449     AC_HELP_STRING([--without-umfpack],[Disable the interface to the UMFPACK library]))
1450
1451 UMFPACK_ENABLE=no
1452 if test "$with_umfpack" != no; then
1453    AC_UMFPACK([$BLAS_LIBS])
1454    UMFPACK_ENABLE=yes
1455 fi
1456
1457 AC_SUBST(UMFPACK_ENABLE)
1458 AM_CONDITIONAL(UMFPACK, test "$with_umfpack" != no)
1459
1460 #######################
1461 ## Test for PCRE
1462 #######################
1463
1464 AC_PCRE()
1465
1466 #################
1467 ## Tcl/Tk library
1468 #################
1469
1470 WITH_TKSCI=no
1471 if test "$with_tk" != no; then
1472    if test "$MACOSX" = "1"; then
1473       AC_MSG_ERROR([Due to technical constraints, Tcl/Tk must be disabled under Mac OS X (--without-tk)])
1474    fi
1475
1476     # check user arguments
1477     USER_TCL_LIB_PATH=""
1478     USER_TCL_INC_PATH=""
1479     AC_ARG_WITH(tcl-library,
1480         AC_HELP_STRING([--with-tcl-library=DIR],[Set the path to the TCL library]),
1481         [  USER_TCL_LIB_PATH=$withval
1482     ])
1483     AC_ARG_WITH(tcl-include,
1484         AC_HELP_STRING([--with-tcl-include=DIR],[Set the path to the TCL headers]),
1485         [  USER_TCL_INC_PATH=$withval
1486     ])
1487
1488     USER_TK_LIB_PATH=$USER_TCL_LIB_PATH
1489     USER_TK_INC_PATH=$USER_TCL_INC_PATH
1490
1491     AC_ARG_WITH(tk-library,
1492         AC_HELP_STRING([--with-tk-library=DIR],[Set the path to the TK library]),
1493         [  USER_TK_LIB_PATH=$withval
1494     ])
1495
1496     AC_ARG_WITH(tk-include,
1497         AC_HELP_STRING([--with-tk-include=DIR],[Set the path to the TK headers]),
1498         [  USER_TK_INC_PATH=$withval
1499     ])
1500
1501 ###########################
1502 ########## X11 checks
1503 ###########################
1504         ## This check is mandatory since tk needs Xlib headers and libs
1505         AC_PATH_XTRA
1506         ##
1507
1508     saved_cflags="$CFLAGS"
1509     saved_ldflags="$LDFLAGS"
1510     saved_cppflags="$CXXFLAGS"
1511
1512     AC_CHECK_LIB([dl], [main], [TCLTK_LIBS=" -ldl"])
1513     AC_CHECK_TCLTK
1514
1515     # set variables
1516     if test "$WITH_TKSCI" = yes; then
1517         AC_DEFINE([WITH_TK], [], [With TK])
1518     else
1519         AC_MSG_ERROR([TCL/TK not found. Use --without-tk or specify the librairies and include paths manually])
1520     fi
1521
1522     AC_SUBST(TCLTK_LIBS)
1523     AC_SUBST(TCL_INC_PATH)
1524     AC_SUBST(TK_INC_PATH)
1525
1526 fi
1527 AC_SUBST(WITH_TKSCI)
1528 AM_CONDITIONAL(TCLTK, test "$WITH_TKSCI" = yes)
1529
1530 #################
1531 ## MATIO LIBRARY (MAT File I/O Library)
1532 #################
1533
1534
1535 AC_ARG_WITH(matio,
1536     AC_HELP_STRING([--without-matio],[Disable the interface to Matio (MAT File I/O library)]))
1537
1538 AC_ARG_WITH(matio_include,
1539         AC_HELP_STRING([--with-matio-include=DIR],[Set the path to the MATIO headers]),
1540         [with_matio_include="-I$withval"], [])
1541
1542 AC_ARG_WITH(matio_library,
1543         AC_HELP_STRING([--with-matio-library=DIR],[Set the path to the MATIO libraries]),
1544         [with_matio_library="-L$withval"], [])
1545
1546 MATIO_ENABLE=no
1547
1548 if test "$with_matio" != no; then
1549    if test -n "$with_matio_include" -o -n "$with_matio_library" ; then
1550       MATIO_CFLAGS="$with_matio_include"
1551       MATIO_LIBS="$with_matio_library -lm -lz -lmatio"
1552    else
1553       PKG_CHECK_MODULES(MATIO, [matio >= 1.3.3])
1554    fi
1555
1556    save_CFLAGS="$CFLAGS"
1557    save_LIBS="$LIBS"
1558
1559    CFLAGS="$CFLAGS $MATIO_CFLAGS"
1560    LIBS="$LIBS $MATIO_LIBS"
1561
1562    AC_CHECK_HEADERS([matio.h matioConfig.h], [],
1563      [AC_MSG_ERROR([Invalid MATIO_CFLAGS returned by pkg-config. Try to define MATIO_CFLAGS.])])
1564    AC_CHECK_LIB([matio], [Mat_Open], [],
1565      [AC_MSG_ERROR([Invalid MATIO_LIBS returned by pkg-config. Try to define MATIO_LIBS.])])
1566
1567    LIBS="$save_LIBS"
1568    CFLAGS="$save_CFLAGS"
1569
1570    AC_DEFINE([WITH_MATIO], [], [With the MATIO library])
1571    MATIO_ENABLE=yes
1572 fi
1573
1574
1575 AC_SUBST(MATIO_ENABLE)
1576 AM_CONDITIONAL(MATIO, test "$with_matio" != no)
1577
1578 #############################
1579 ## Documentation management #
1580 #############################
1581
1582 HELP_ENABLE=yes
1583
1584 AC_ARG_ENABLE(build-help,
1585         AC_HELP_STRING([--disable-build-help],[Disable the help build])
1586         )
1587
1588 if test "$enable_build_help" != no; then
1589     AC_DOCBOOK()
1590 else
1591     HELP_ENABLE=no
1592 fi
1593
1594 if test "$JAVA_ENABLE" = no; then
1595     HELP_ENABLE=no
1596 fi
1597
1598 AC_SUBST(HELP_ENABLE)
1599
1600 AM_CONDITIONAL(BUILD_HELP, test $HELP_ENABLE = yes)
1601
1602 ## Install XML help files ###
1603
1604 AC_ARG_WITH(install-help-xml,
1605         AC_HELP_STRING([--with-install-help-xml],[make install will install XML files])
1606         )
1607 HELP_INSTALL_ENABLE=no
1608 if test "$with_install_help_xml" != no -a "$with_install_help_xml" != ""; then
1609    HELP_INSTALL_ENABLE=yes
1610 fi
1611 AM_CONDITIONAL(INSTALL_HELP_XML, test "$HELP_INSTALL_ENABLE" != "")
1612
1613 ##############################################################
1614 ## Javasci module
1615 ##############################################################
1616
1617 JAVASCI_ENABLE=yes
1618
1619 if test "$JAVA_ENABLE" = no -o "$JAVASCI" = no; then
1620    JAVASCI_ENABLE=no
1621 fi
1622
1623 AC_SUBST(JAVASCI_ENABLE)
1624
1625
1626 ##############################################################
1627 ## Enable test a compilation time
1628 ##############################################################
1629
1630 COMPILATION_TESTS=no
1631 if test "$enable_compilation_tests" != no -a "$enable_compilation_tests" != ""; then
1632    COMPILATION_TESTS=yes
1633 fi
1634
1635 if test COMPILATION_TESTS=yes -a "$TESTNG" == ""; then
1636    AC_MSG_WARN([--enable-compilation-tests deactivated: Could not find TestNG"])
1637    COMPILATION_TESTS=no
1638 fi
1639
1640 AM_CONDITIONAL(COMPILATION_TESTS, test "$COMPILATION_TESTS" != "no")
1641
1642 ##############################################################
1643 ## demo_tools module
1644 ##############################################################
1645
1646 DEMOTOOLS_ENABLE=yes
1647
1648 if test "$GUI_ENABLE" = no; then
1649    DEMOTOOLS_ENABLE=no
1650 fi
1651
1652 AC_SUBST(DEMOTOOLS_ENABLE)
1653
1654 ##############################################################
1655 ## graphics/renderer/graphic_export module
1656 ##############################################################
1657
1658 GRAPHICS_ENABLE=yes
1659
1660 if test "$GUI_ENABLE" = no; then
1661    GRAPHICS_ENABLE=no
1662 fi
1663
1664 AC_SUBST(GRAPHICS_ENABLE)
1665
1666 #########################
1667 ## libtool
1668 #########################
1669
1670 AM_DISABLE_STATIC
1671 AC_PROG_LIBTOOL([shared dlopen])
1672 AM_PROG_LIBTOOL
1673
1674
1675 # Avoid to link all the dep from others libraries (*.la included by LIBADD)
1676 link_all_deplibs=no
1677
1678 # Check to see if building shared libraries
1679 libtool_build_shared_libs=no
1680 if test "$enable_shared" = "yes"; then
1681   libtool_build_shared_libs=yes
1682 fi
1683
1684 # Check to see if building static libraries
1685 libtool_build_static_libs=no
1686 if test "$enable_static" = "yes"; then
1687   libtool_build_static_libs=yes
1688 fi
1689
1690 # AM_CONDITIONAL(ENABLE_STATIC, test "$libtool_build_static_libs" = yes)
1691 # Fake to disable the static build
1692 AM_CONDITIONAL(ENABLE_STATIC, test "$libtool_build_static_libs" = xxxx)
1693
1694 AC_C_CONST()
1695 AC_C_INLINE()
1696
1697 AC_BACKTRACE()
1698
1699 ##########
1700 ##### Code quality
1701 ##########
1702 AC_PATH_PROG(SPLINT, splint, no)
1703
1704 ##########
1705 ##### Detect ccache and use it by default if available
1706 ##########
1707
1708 AC_PATH_PROG(CCACHE, ccache)
1709
1710 if test x"$CCACHE" != x; then
1711   CC="ccache $CC"
1712   CXX="ccache $CXX"
1713 fi
1714
1715 #######################
1716 ###### Creation of the header file (machine.h)
1717 #######################
1718
1719 AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ["$PATH_SEPARATOR"],
1720 [The default path separator character.])
1721
1722 AH_TOP([#ifndef MACHINE_H
1723 #define MACHINE_H
1724 /* This file defines global element configuration of the build host */
1725 ])
1726
1727 AH_BOTTOM([
1728
1729 #ifdef DIR_SEPARATOR
1730        #undef DIR_SEPARATOR
1731 #endif
1732 #define DIR_SEPARATOR "/"
1733
1734 #endif /* MACHINE_H  */
1735 ])
1736
1737 # Define the standard extension of a dynamic library
1738 AC_DEFINE_UNQUOTED([SHARED_LIB_EXT],["$shrext_cmds"],[Extension of a shared library])
1739
1740 #################
1741 ## stop on warning
1742 #################
1743
1744 # Stop to compile scilab when a warning is found ...
1745 # This stuff is at the end of the configure.ac because it causes some
1746 # problem with AC_COMPILE (the -Werror is added to the test)
1747 #
1748 dnl @TODO : -O0 is only to bypass Stack shit... Must be removed.
1749 if test "$enable_stop_on_warning" = yes; then
1750    CFLAGS="$CFLAGS -Werror=implicit-function-declaration -O0"
1751    CXXFLAGS="$CXXFLAGS -Werror=implicit-function-declaration -O0"
1752 fi
1753
1754 AC_CONFIG_FILES([
1755 libs/MALLOC/Makefile
1756 libs/dynamiclibrary/Makefile
1757 libs/doublylinkedlist/Makefile
1758 libs/hashtable/Makefile
1759 libs/libst/Makefile
1760 contrib/Makefile
1761 desktop/images/icons/Makefile
1762 desktop/Makefile
1763 modules/helptools/Makefile
1764 modules/data_structures/Makefile
1765 modules/differential_equations/Makefile
1766 modules/optimization/Makefile
1767 modules/elementary_functions/Makefile
1768 modules/special_functions/Makefile
1769 modules/io/Makefile
1770 modules/completion/Makefile
1771 modules/history_manager/Makefile
1772 modules/jvm/Makefile
1773 modules/commons/Makefile
1774 modules/sound/Makefile
1775 modules/statistics/Makefile
1776 modules/mexlib/Makefile
1777 modules/sparse/Makefile
1778 modules/linear_algebra/Makefile
1779 modules/polynomials/Makefile
1780 modules/symbolic/Makefile
1781 modules/signal_processing/Makefile
1782 modules/arnoldi/Makefile
1783 modules/interpolation/Makefile
1784 modules/intersci/Makefile
1785 modules/localization/Makefile
1786 modules/cacsd/Makefile
1787 modules/boolean/Makefile
1788 modules/integer/Makefile
1789 modules/double/Makefile
1790 modules/fileio/Makefile
1791 modules/spreadsheet/Makefile
1792 modules/string/Makefile
1793 modules/time/Makefile
1794 modules/graphics/Makefile
1795 modules/graphic_export/Makefile
1796 modules/renderer/Makefile
1797 modules/action_binding/Makefile
1798 modules/gui/Makefile
1799 modules/randlib/Makefile
1800 modules/tclsci/Makefile
1801 modules/windows_tools/Makefile
1802 modules/core/Makefile
1803 modules/prebuildjava/Makefile
1804 modules/libscilab-cli/Makefile
1805 modules/api_scilab/Makefile
1806 modules/call_scilab/Makefile
1807 modules/types/Makefile
1808 modules/hdf5/Makefile
1809 modules/fftw/Makefile
1810 modules/umfpack/Makefile
1811 modules/scicos/Makefile
1812 modules/scicos_blocks/Makefile
1813 modules/functions/Makefile
1814 modules/dynamic_link/Makefile
1815 modules/overloading/Makefile
1816 modules/javasci/Makefile
1817 modules/m2sci/Makefile
1818 modules/compatibility_functions/Makefile
1819 modules/development_tools/Makefile
1820 modules/output_stream/Makefile
1821 modules/console/Makefile
1822 modules/demo_tools/Makefile
1823 modules/genetic_algorithms/Makefile
1824 modules/simulated_annealing/Makefile
1825 modules/parameters/Makefile
1826 modules/matio/Makefile
1827 modules/atoms/Makefile
1828 modules/xcos/Makefile
1829 modules/scinotes/Makefile
1830 modules/ui_data/Makefile
1831 modules/graph/Makefile
1832 modules/parallel/Makefile
1833 modules/modules_manager/Makefile
1834 modules/history_browser/Makefile
1835 modules/preferences/Makefile
1836 modules/xml/Makefile
1837 modules/Makefile
1838 libs/Makefile
1839 Makefile
1840 scilab.pc
1841 etc/modules.xml
1842 etc/classpath.xml
1843 etc/Info.plist
1844 etc/logging.properties
1845 scilab.properties
1846 scilab-lib.properties
1847 scilab-lib-doc.properties
1848 modules/helptools/etc/SciDocConf.xml
1849 modules/core/includes/version.h
1850 ])
1851
1852 # Detection of the module for the future version of Scilab 6
1853 # ie we detect module which ends with _yasp
1854
1855 if test "$enable_yasp" = yes; then
1856    AC_CONFIG_FILES([
1857    modules/development_tools/src/fake/Makefile
1858   ])
1859 fi
1860
1861 # This script is used by Xcos in order to regenerate the function/block list
1862 AC_CONFIG_COMMANDS_POST([chmod +x $SCI_SRCDIR_FULL/modules/scicos_blocks/src/scripts/GenBlocks.sh $SCI_SRCDIR_FULL/modules/dynamic_link/src/scripts/scicompile.sh $SCI_SRCDIR_FULL/modules/dynamic_link/src/scripts/compilerDetection.sh $SCI_SRCDIR_FULL/modules/dynamic_link/src/scripts/configure])
1863
1864
1865 #MAN_FR MAN_ENG
1866 #modules/mpi/Makefile
1867 #for top_builddir in . .. ../.. $ac_auxdir $ac_auxdir/..; do
1868 #  test -f $top_builddir/configure && break
1869 #done
1870
1871
1872 #if test "$with_mpi" = yes; then
1873 #AC_CONFIG_FILES([modules/mpi/Makefile])
1874 #fi
1875
1876 # Generate stack.h
1877 if test "$IS_64_BITS_CPU" = true -o "$MACOSX" = "1"; then
1878    stack_h_cpp_flags=-DUSE_DYNAMIC_STACK
1879 else
1880    stack_h_cpp_flags=
1881 fi
1882
1883 AC_CONFIG_COMMANDS([modules/core/includes/stack.h],
1884   [if ! $CPP $stack_h_cpp_flags - < $srcdir/modules/core/includes/stack.h.in |\
1885               $GREP -v '^#' > $srcdir/modules/core/includes/stack.h ; then
1886      AC_MSG_ERROR([stack.h generation failed])
1887    fi],
1888   [CPP="$CPP"
1889    GREP="$GREP"
1890    stack_h_cpp_flags="$stack_h_cpp_flags"
1891   ])
1892
1893 AC_OUTPUT
1894
1895 # To distribution packager, you can uncomment this stuff is you want to
1896 # disable the rpath issue
1897 # However, you will have to set all the LD_LIBRARY_PATH to .libs/ directory
1898 # since scilab is compiling macros and help into the source tree (ie before
1899 # the "make install")
1900 # You should consider using chrpath:
1901 # http://directory.fsf.org/project/chrpath/
1902 # to remove it before the make install
1903
1904 #case ${host} in
1905 #  *-pc-linux-gnu)
1906 #    AC_MSG_RESULT([Fixing libtool for -rpath problems.])
1907 #    sed < libtool > libtool-2 \
1908 #    's/^hardcode_libdir_flag_spec.*$/hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/'
1909 #    mv libtool-2 libtool
1910 #    chmod 755 libtool
1911 #  ;;
1912 #esac
1913 #
1914
1915 echo ""
1916
1917 echo "Scilab is configured as follows. Please verify that this configuration"
1918 echo "matches your expectations."
1919 echo ""
1920 echo "Host system type : $host"
1921 echo ""
1922 echo "                  Option                        Value"
1923 echo "-------------------------------------------------------------------------"
1924 echo "Shared libraries.......      --enable-shared=$libtool_build_shared_libs"
1925 echo "Static libraries.......      --enable-static=$libtool_build_static_libs"
1926 echo "GNU ld.................      --with-gnu-ld=$with_gnu_ld"
1927 echo "Enable debug ..........      --enable-debug=$enable_debug"
1928 echo "Enable debug C.........      --enable-debug-C=$enable_debug_C"
1929 echo "Enable debug C++.......      --enable-debug-CXX=$enable_debug_CXX"
1930 echo "Enable debug Java......      --enable-debug-java=$enable_debug_java"
1931 echo "Enable debug Fortran...      --enable-debug-fortran=$enable_debug_fortran"
1932 echo "Enable stop on warning.      --enable-stop-on-warning=$enable_stop_on_warning"
1933
1934 echo ""
1935 echo "Compiler Configuration:"
1936 echo "  Intel (--with-intelcompilers) .... =        $with_intelcompilers"
1937 echo "  GNU gcc (--with-gcc) ............. =        $with_gcc"
1938 echo "  GNU Fortran 95 (--with-gfortran) . =        $with_gfortran"
1939 echo ""
1940 echo "Options:"
1941 echo "  Do not use TCL/TK (--without-tk) ................. = $with_tk"
1942 echo "  TCL include (--with-tcl-include) ................. = $USER_TCL_INC_PATH"
1943 echo "  TCL library (--with-tcl-library) ................. = $USER_TCL_LIB_PATH"
1944 echo "  TK include (--with-tk-include) ................... = $USER_TK_INC_PATH"
1945 echo "  TK library (--with-tk-library) ................... = $USER_TK_LIB_PATH"
1946 echo "  Install XML Help (--with-install-help-xml) ....... = $with_install_help_xml"
1947 echo "  Compilation tests (--enable-compilation-tests) ... = $COMPILATION_TESTS"
1948 echo "  Make the package relocatable (--enable-relocatable)= $RELOCATABLE"
1949 echo "  Use FFTW (--without-fftw) ........................ = $with_fftw"
1950 echo "  Use MATIO (--without-matio) ...................... = $with_matio"
1951
1952 echo ""
1953 if test "$with_gui" = no; then
1954    echo "Not using Xcos because of the option --without-gui"
1955 else
1956 if test $XCOS_ENABLE = yes; then
1957    echo "Xcos enable"
1958    echo "Build modelica compiler (--without-modelica) ....... = $with_modelica"
1959    echo ""
1960    if test "$with_ocaml" != no -a "$OCAMLC" != no -a "$OCAMLOPT" != no; then
1961      echo "Ocaml Configuration (for Modelica compiler):"
1962      echo "  OCAMLC ............. = $OCAMLC"
1963      echo "  OCAMLOPT ........... = $OCAMLOPT"
1964      echo "  OCAMLDEP ........... = $OCAMLDEP"
1965    else
1966      echo "Will not build Modelica compiler"
1967    fi
1968 else
1969    echo "Not using Xcos"
1970 fi
1971 fi
1972
1973 echo ""
1974 if test "$enable_code_coverage" = yes;  then
1975    echo "Code coverage configuration:"
1976    echo "  LCOV .............. = $LCOV"
1977    echo "  GENHTML ........... = $GENHTML"
1978 else
1979    echo "Not using code coverage"
1980 fi
1981
1982 echo ""
1983 if test $OPENMP_ENABLE = yes; then
1984    echo "OpenMP Configuration:"
1985    echo "OpenMP CFLAGS ...... = $OPENMP_CFLAGS"
1986    echo "OpenMP CXXFLAGS .... = $OPENMP_CXXFLAGS"
1987    echo "OpenMP LIBS ........ = $OPENMP_LIBS"
1988    echo "OpenMP FFLAGS ...... = $OPENMP_LDFLAGS"
1989 else
1990    echo "Not using OpenMP"
1991 fi
1992
1993 echo ""
1994 if test $FFTW_ENABLE = yes;  then
1995    echo "FFTW Configuration:"
1996    echo "  FFTW LIBS .......... = $FFTW3_LIB"
1997    echo "  FFTW CFLAGS ........ = $FFTW3_CFLAGS"
1998 else
1999    echo "Not using FFTW"
2000 fi
2001
2002 echo ""
2003 if test $MATIO_ENABLE = yes;  then
2004    echo "MATIO Configuration:"
2005    echo "  MATIO LIBS .......... = $MATIO_LIBS"
2006    echo "  MATIO CFLAGS ........ = $MATIO_CFLAGS"
2007 else
2008    echo "Not using MATIO"
2009 fi
2010
2011 echo ""
2012 if test $UMFPACK_ENABLE = yes;  then
2013    echo "UMFPACK Configuration:"
2014    echo "  UMFPACK LIBS ....... = $UMFPACK_LIB"
2015    echo "  UMFPACK CFLAGS ..... = $UMFPACK_CFLAGS"
2016    if test $SUITESPARSE = yes; then
2017       echo "  UMFPACK SUITESPARSE  = Yes"
2018    else
2019       echo "  UMFPACK SUITESPARSE  = No"
2020    fi
2021 else
2022    echo "Not using UMFPACK"
2023 fi
2024
2025
2026 echo ""
2027 echo "BLAS/LAPACK/ATLAS Configuration:"
2028 echo "  BLAS LIBS ............. = $BLAS_LIBS"
2029 echo "  BLAS TYPE ............. = $BLAS_TYPE"
2030 echo "  LAPACK LIBS ........... = $LAPACK_LIBS"
2031 echo "  LAPACK TYPE ........... = $LAPACK_TYPE"
2032 echo "  ARPACK LIBS ........... = $ARPACK_LIBS"
2033 echo ""
2034
2035 #if test "$with_mpi" = yes; then
2036 #   echo "MPI Configuration:"
2037 #   echo "  MPI LIBS ........... = $MPILIBS"
2038 #   echo "  MPI C Compiler ..... = $MPICC"
2039 #   echo "  MPI C++ Compiler ... = $MPICXX"
2040 #   echo "  MPI F77 Compiler ... = $MPIF77"
2041 #else
2042 #   echo "Not using MPI"
2043 #fi
2044
2045 #if test "$with_openmpi" != "no"; then
2046 #   echo "OpenMPI Configuration:"
2047 #   echo "  OpenMPI LIBS ........... = $OPENMPI_LIBS"
2048 #   echo "  OpenMPI C Compiler ..... = $OPENMPI_CC"
2049 #   echo "  OpenMPI F77 Compiler ... = $MPIF77"
2050 #else
2051 #   echo "Not using MPI"
2052 #fi
2053
2054 echo ""
2055 if test $BUILD_LOCALIZATION_ENABLE != no; then
2056    echo "Gettext/localization configuration:"
2057    echo "  xgettext ............... = $XGETTEXT"
2058    echo "  msgfmt  ................ = $MSGFMT"
2059    echo "  msgfmt_opts ............ = $MSGFMT_OPTS"
2060    echo "  msgcat  ................ = $MSGCAT"
2061 else
2062    echo "Won't generate localization files"
2063 fi
2064
2065 echo ""
2066 if test $HELP_ENABLE = yes; then
2067    echo "Documentation building configuration:"
2068    echo "  Docbook XSL path ....... = $DOCBOOK_ROOT"
2069    echo "  Saxon XSLT ............. = $SAXON"
2070    echo "  XML commons external ... = $XML_APIS_EXT"
2071 else
2072    echo "No documentation generated"
2073 fi
2074
2075 echo ""
2076 echo "Java Configuration:"
2077 if test ! -z "$JAVAC"; then
2078 echo "  JAVA_HOME ........... = $JAVA_HOME"
2079 echo "  JAVAC ............... = $JAVAC"
2080 echo "  JAVA_CLASSPATH ...... = $JAVA_CLASSPATH"
2081 echo "  JAVA_VERSION ........ = $JAVA_VERSION"
2082 echo "  JAVAC_FLAGS ......... = $JAVAC_FLAGS"
2083 echo "  JAVA_JNI_INCLUDE .... = $JAVA_JNI_INCLUDE"
2084 echo "  JAVA_JNI_LIBS ....... = $JAVA_JNI_LIBS"
2085 echo "  JAVA_JNI_LIBS_PRELOAD = $JAVA_JNI_LIBS_PRELOAD"
2086 echo "  JAVA ................ = $JAVA"
2087 echo "  JAVADOC ............. = $JAVADOC"
2088 echo "  JAR ................. = $JAR"
2089 echo "  ANT ................. = $ANT"
2090 else
2091 echo "  JAVA disabled"
2092 fi
2093
2094
2095 echo ""
2096 echo "Java dependencies:"
2097 if test ! -z "$JAVAC"; then
2098 echo "  Flexdock ............ = $FLEXDOCK"
2099 echo "  JOGL ................ = $JOGL"
2100 echo "  JOGL LIBS (JNI) ..... = $JOGL_LIBS"
2101 echo "  Gluegen ............. = $GLUEGEN_RT"
2102 echo "  Gluegen LIBS (JNI) .. = $GLUEGEN_RT_LIBS"
2103 echo "  Jeuclid (MathML) .... = $JEUCLID_CORE"
2104 echo "  Jhall  .............. = $JHALL"
2105 echo "  Jrosetta (API) ...... = $JROSETTA_API"
2106 echo "  Jrosetta (Engine) ... = $JROSETTA_ENGINE"
2107 echo "  Commons Logging ..... = $COMMONS_LOGGING"
2108 echo "  JGraph X ............ = $JGRAPHX"
2109 echo "  JLaTeXMath .......... = $JLATEXMATH"
2110 fi
2111
2112 echo ""
2113 if test ! -z "$JAVAC"; then
2114 echo "Documentation, graphic export:"
2115 echo "  FOP (XML => PDF) .... = $FOP"
2116 echo "  JLaTeXMath Fop ...... = $JLATEXMATH_FOP"
2117 echo "  Batik (SVG) ......... = $BATIK"
2118 echo "  Avalon Framework .... = $AVALON_FRAMEWORK"
2119 echo "  Commons I/O ......... = $COMMONS_IO"
2120 echo "  XML graphics commons  = $XMLGRAPHICS_COMMONS"
2121 fi
2122
2123
2124 echo ""
2125 echo "Code quality (optional):"
2126 echo "  Checkstyle .......... = $CHECKSTYLE"
2127 echo "  Commons-beanutils ... = $COMMONS_BEANUTILS"
2128 echo "  Antlr ............... = $ANTLR"
2129 echo "  TestNG .............. = $TESTNG"
2130 echo "  splint .............. = $SPLINT"
2131
2132 echo ""
2133 echo "TCL/TK configuration:"
2134 echo "  TK_INC_PATH ........ = $TK_INC_PATH"
2135 echo "  TCL_INC_PATH ....... = $TCL_INC_PATH"
2136 echo "  TCLTK_LIBS ......... = $TCLTK_LIBS"
2137 echo "  TCL_SERIAL_VERSION . = $TCL_SERIAL_VERSION"
2138 echo "  TK_SERIAL_VERSION .. = $TK_SERIAL_VERSION"
2139
2140 echo ""
2141 echo "XML configuration:"
2142 echo "  XML_FLAGS .......... = $XML_FLAGS"
2143 echo "  XML_LIBS ........... = $XML_LIBS"
2144 echo "  XML_VERSION ........ = $XML_VERSION"
2145
2146 echo ""
2147 if test $HDF5_ENABLE = yes;  then
2148    echo "HDF5 configuration:"
2149    echo "  HDF5 CFLAGS ......... = $HDF5_CFLAGS"
2150    echo "  HDF5 LIBS ........... = $HDF5_LIBS"
2151    echo "  HDF5 Java ........... = $JHDF5"
2152    echo "  JHDF5 LIBS (JNI) .... = $JHDF5_LIBS"
2153 else
2154    echo "Not using HDF5"
2155 fi
2156
2157 echo ""
2158 echo "PCRE configuration:"
2159 echo "  PCRE_CFLAGS ........ = $PCRE_CFLAGS"
2160 echo "  PCRE_LIBS .......... = $PCRE_LIBS"
2161 echo "  PCRE_VERSION ....... = $PCRE_VERSION"
2162
2163
2164 echo ""
2165 echo "SWIG Configuration:"
2166 if test ! -z "$SWIG_BIN"; then
2167 echo "  SWIG_BIN ........... = $SWIG_BIN"
2168 echo "  SWIG_JAVA .......... = $SWIG_JAVA"
2169 else
2170 echo "  SWIG generation disabled"
2171 fi
2172
2173 echo ""
2174 echo "GIWS Configuration:"
2175 if test ! -z "$GIWS_BIN"; then
2176 echo "  GIWS_BIN ........... = $GIWS_BIN"
2177 else
2178 echo "  GIWS generation disabled"
2179 fi
2180
2181 echo ""
2182 echo "Libtool config:"
2183 echo "  objext .............. = $objext"
2184 echo "  libext (static) ..... = $libext"
2185 echo "  shrext_cmds ......... = $shrext_cmds"
2186 echo "  exeext .............. = $exeext"
2187
2188 echo ""
2189
2190 echo "Compilation paths:"
2191 echo "  srcdir .............. = $SCI_SRCDIR"
2192 echo "  srcdir_full ......... = $SCI_SRCDIR_FULL"
2193 echo "  builddir ............ = $SCI_BUILDDIR"
2194 if test "$SCI_SRCDIR_FULL" != "$SCI_BUILDDIR"; then
2195 echo "  VPATH build ......... = Activated"
2196 fi
2197
2198 echo ""
2199 echo "Platform informations:"
2200 echo "  host ........... = $host"
2201 echo "  host_cpu ....... = $host_cpu"
2202 echo "  host_vendor .... = $host_vendor"
2203 echo "  host_os ... .... = $host_os"
2204 echo "  hostname ....... = $ac_hostname"
2205 echo "  CPU 64 bits .... = $IS_64_BITS_CPU"
2206 if test -n "$MAC_DETECTED_ARCH"; then
2207 echo "  Mac OS X arch .. = $MAC_DETECTED_ARCH"
2208 echo "  Mac OS X version = $macosx_version"
2209 fi
2210
2211 echo ""
2212 echo "Options used to compile and link:"
2213 echo "  prefix ......... = $prefix"
2214 echo "  localedir ...... = $localedir"
2215 echo "  VERSION ........ = $PACKAGE_VERSION"
2216 echo "  CC ............. = $CC"
2217 echo "  CFLAGS ......... = $CFLAGS"
2218 echo "  PCFLAGS ........ = $PCFLAGS"
2219 echo "  DEFS ........... = $DEFS"
2220 echo "  LD ............. = $LD"
2221 echo "  LDFLAGS ........ = $LDFLAGS"
2222 echo "  LIBS ........... = $LIBS"
2223 echo "  CXX ............ = $CXX"
2224 echo "  CXXFLAGS ....... = $CXXFLAGS"
2225 echo "  F77 ............ = $F77"
2226 echo "  FFLAGS ......... = $FFLAGS"
2227 echo "  F77_LDFLAGS .... = $F77_LDFLAGS"
2228 echo "  TERMCAP_LIB .... = $TERMCAP_LIB"
2229 echo ""