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