Merge branch '5.1' of git@git.scilab.org:scilab into 5.1
[scilab.git] / scilab / configure.ac
1 ##########
2 ### Sylvestre Ledru <sylvestre.ledru@inria.fr>
3 ### INRIA - Scilab 2006/2007/2008
4 ##########
5 dnl Process this file with autoconf to produce a configure script.
6
7
8 AC_REVISION($Revision$)dnl
9 AC_INIT([Scilab],[5],[http://bugzilla.scilab.org/])
10 AC_PREREQ(2.60)
11
12 SCI_BUILDDIR="`pwd`"
13 SCI_SRCDIR="$srcdir"
14 SCI_SRCDIR_FULL="`cd $SCI_SRCDIR && pwd`"
15
16 SCILAB_LIBRARY_VERSION=5:1:0
17 AC_SUBST(SCILAB_LIBRARY_VERSION)
18
19 #shared library versioning
20 #GENERIC_LIBRARY_VERSION=1:2:0
21 #                       | | |
22 #                +------+ | +---+
23 #                |        |     |
24 #             current:revision:age
25 #                |        |     |
26 #                |        |     +- increment if interfaces have been added
27 #                |        |        set to zero if interfaces have been removed
28 #                                  or changed
29 #                |        +- increment if source code has changed
30 #                |           set to zero if current is incremented
31 #                +- increment if interfaces have been added, removed or changed
32
33 # Check if we have a space in the path to the source tree
34 SPACE_IN_PATH=`echo "$SCI_SRCDIR_FULL"|grep " " > /dev/null; echo $?`
35 if test "$SPACE_IN_PATH" = "0"; then
36    AC_MSG_WARN([=====================================])
37    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...])
38    AC_MSG_WARN([=====================================])
39    sleep 180
40 fi
41
42 AC_CONFIG_AUX_DIR(config)
43 AC_CONFIG_HEADERS([modules/core/includes/machine.h])
44
45 # strip executable
46 AM_PROG_INSTALL_STRIP
47 AC_PROG_LN_S
48
49 AC_SYS_LARGEFILE
50
51 # In order to be able to change the scilab directory
52 # See http://wiki.debian.org/RpathIssue
53 AC_RELOCATABLE
54 AC_RELOCATABLE_LIBRARY
55
56
57 # If configure detect that timestamp changed,
58 # it tries to rebuild configure & makefile which can be a painmaker
59 # if the version is different
60 AM_MAINTAINER_MODE
61
62 AM_INIT_AUTOMAKE([-Wall foreign]) # Not using -Werror because we override {C,F}FLAGS in order to disable optimisation
63
64 AC_CANONICAL_HOST
65
66 #################################
67 ## all the --with-* argument help
68 #################################
69
70
71 AC_ARG_ENABLE(debug,
72    AC_HELP_STRING([--enable-debug],[Do not optimize and print warning messages (C/C++/Fortran code)]))
73
74 AC_ARG_ENABLE(debug-C,
75    AC_HELP_STRING([--enable-debug-C],[Do not optimize and print warning messages (C code)]))
76
77 AC_ARG_ENABLE(debug-CXX,
78    AC_HELP_STRING([--enable-debug-CXX],[Do not optimize and print warning messages (C++ code)]))
79
80 AC_ARG_ENABLE(debug-java,
81    AC_HELP_STRING([--enable-debug-java],[Print warning messages and line numbers (Java code)]))
82
83 AC_ARG_ENABLE(debug-fortran,
84    AC_HELP_STRING([--enable-debug-fortran],[Do not optimize and print warning messages (Fortran code)]))
85
86 AC_ARG_ENABLE(debug-linker,
87    AC_HELP_STRING([--enable-debug-linker],[Print warning messages from the linker (ld)]))
88
89 AC_ARG_ENABLE(stopOnWarning,
90    AC_HELP_STRING([--enable-stop-on-warning],[Stop the compilation on the first warning found in the C/C++ code]))
91
92 AC_ARG_WITH(gcc,
93     AC_HELP_STRING([--with-gcc],[Use gcc C compiler ]))
94
95 AC_ARG_WITH(g77,
96     AC_HELP_STRING([--with-g77],[Use g77, GNU Fortran 77 compiler ]))
97
98 AC_ARG_WITH(gfortran,
99     AC_HELP_STRING([--with-gfortran],[Use gfortran, GNU Fortran 95 compiler ]))
100
101 AC_ARG_WITH(intelcompilers,
102     AC_HELP_STRING([--with-intelcompilers],[Use Intel C (icc) and Fortran (ifort) proprietary compilers (GNU/Linux only) ]))
103
104 AC_ARG_WITH(tk,
105     AC_HELP_STRING([--without-tk],[Disable the interface to Tcl/Tk ]))
106
107 AC_ARG_WITH(javasci,
108     AC_HELP_STRING([--without-javasci],[Disable the Java/Scilab interface (javasci)]))
109
110 AC_ARG_WITH(gui,
111     AC_HELP_STRING([--without-gui],[Disable the Scilab Graphical User Interface (GUI). Intended for embedded/clustering/grid Scilab ]))
112
113 AC_ARG_ENABLE(build-swig,
114     AC_HELP_STRING([--enable-build-swig],[Regenerate Java => C wrappers produces by Swig (A Java Development Kit (JDK) is mandatory for this option)]))
115
116 AC_ARG_ENABLE(build-giws,
117     AC_HELP_STRING([--enable-build-giws],[Regenerate C/C++ => Java wrappers produces by Giws (A Java Development Kit (JDK) is mandatory for this option)]))
118
119
120 ################################################
121 ########## compilator & misc programs detection
122 ################################################
123
124 AC_PROG_CPP
125 AC_PROG_GREP
126 PKG_PROG_PKG_CONFIG
127
128 #####################################################
129 ## check if options are correct (or not)
130 #####################################################
131
132 if test "$with_g77" = yes -a "$with_gfortran" = yes; then
133         AC_MSG_ERROR([Conflicting options : you specified two fortran compiler])
134 fi
135
136 if test "$with_intelcompilers" = yes -a "$with_gcc" = yes; then
137         AC_MSG_ERROR([Conflicting options : you specified two compiler series])
138 fi
139
140 ######## fortran ########
141 if test "$with_g77" = yes; then
142    AC_PROG_F77(g77)
143    if test -z "$F77"; then
144      AC_MSG_ERROR([You asked me to use g77 but i haven't been able to find it])
145         fi
146 fi
147
148 if test "$with_gfortran" = yes; then
149    AC_PROG_F77(gfortran)
150    if test -z "$F77"; then
151      AC_MSG_ERROR([You asked me to use gfortran but i haven't been able to find it])
152         fi
153 fi
154
155 if test "$with_intelcompilers" = yes; then
156    AC_PROG_F77(ifc ifort)
157    if test -z "$F77"; then
158      AC_MSG_ERROR([You asked me to use ifc (intel fortran compiler) but i haven't been able to find it])
159         fi
160 fi
161
162 if test -z "$F77"; then
163 ## No Frotran compiler specified... We rely on Autoconf to find the best
164    AC_PROG_F77
165 fi
166
167
168 # case statements were introduced in fortran 90 so we can use that
169 # as a test to see if our compiler is fortran 90 compatible.
170 f90compatible=false
171 if test -z "$F77"; then
172   AC_MSG_ERROR([No fortran compiler found. Cannot compile scilab without a fortran compiler])
173 fi
174
175 AC_MSG_CHECKING([if $F77 is a fortran 90 compatible compiler])
176  f90compatible=false
177 AC_LANG_PUSH([Fortran 77])
178 AC_COMPILE_IFELSE([
179       PROGRAM hello
180         do 50 i = 1, 5
181            select case ( i )
182               case (1)
183                  print*, "case is 1, i is ", i
184               case ( 2 : 3 )
185                  print*, "case is 2 to 3, i is ", i
186               case default
187                  print*, "default case, i is ", i
188               end select
189  50           continue
190       END
191         ],
192         [AC_MSG_RESULT([yes])
193          AC_DEFINE([G95_FORTRAN],[],[uses G95 fortran])
194          f90compatible=true
195         ],
196         [AC_MSG_RESULT([no])]
197 )
198 AC_LANG_POP([Fortran 77])
199
200 ############ C ###############
201
202
203 if test "$with_gcc" = yes; then
204    AC_PROG_CC(gcc)
205    if test -z "$CC"; then
206      AC_MSG_ERROR([You asked me to use gcc but i haven't been able to find it])
207         fi
208 fi
209
210 if test "$with_intelcompilers" = yes; then
211    AC_PROG_CC(icc ecc)
212    if test -z "$CC"; then
213      AC_MSG_ERROR([You asked me to use icc (intel C compiler) but I haven't been able to find it])
214         fi
215 fi
216
217 if test -z "$CC"; then
218 # No C compiler specified... We rely on Autoconf to find the best
219    AC_PROG_CC
220 fi
221
222 if test -z "$CC"; then
223   AC_MSG_ERROR([No C Compiler found. Cannot compile Scilab without a C compiler])
224 fi
225
226 AC_CHECK_SIZEOF([int])
227 AC_CHECK_SIZEOF([long])
228
229 ### C++ ###
230 AC_PROG_CXX
231 # we can't just do something like
232 # AC_CHECK_PROG(cxx_present, $CXX, "yes", "no")
233 # because if the user has specified the full path of the desired C++ compiler then AC_CHECK_PROG
234 # will fail.  If AC_PROG_CXX fails to find a c++ compiler it will set CXX=g++ so just run AC_CHECK_PROG
235 # in this special case
236 case $CXX in
237         g++)
238                 AC_CHECK_PROG([cxx_present], [$CXX], [yes], [no])
239                 if test "x$cxx_present" != "xyes"; then
240                     AC_MSG_ERROR([No C++ compiler found. Cannot compile scilab without a C++ compiler])
241                 fi
242                 ;;
243 esac
244
245 # for "subdir-objects"
246
247 AM_PROG_CC_C_O
248 AC_PROG_F77_C_O
249
250 # If this option is provided, enable the debug on C & C++
251 if test "$enable_stop_on_warning" = yes; then
252    enable_debug_C=yes
253    enable_debug_CXX=yes
254 fi
255
256 if test "$enable_debug" = yes; then
257    enable_debug_fortran=yes
258    enable_debug_C=yes
259    enable_debug_CXX=yes
260 else
261    enable_debug=no
262 fi
263
264 if test "$enable_debug_fortran" = yes; then
265    FFLAGS="`echo "$FFLAGS"| sed -e 's|-O[0-9+]|-O0|'`"
266 else
267    enable_debug_fortran=no
268 fi
269
270 if test "$enable_debug_C" = yes; then
271    CFLAGS="`echo "$CFLAGS"| sed -e 's|-O[0-9+]|-O0|'`"
272 else
273    enable_debug_C=no
274 fi
275
276 if test "$enable_debug_CXX" = yes; then
277    CXXFLAGS="`echo "$CXXFLAGS"| sed -e 's|-O[0-9+]|-O0|'`"
278 else
279    enable_debug_CXX=no
280 fi
281
282 if test "x${prefix}" = "xNONE"; then
283   prefix="${ac_default_prefix}"
284 fi
285
286 ###############################
287 ## get the version
288 ###############################
289
290 SCIVERSION=`cat $SCI_SRCDIR/Version.incl | sed -e "s/SCIVERSION=//" `
291
292 #############################################
293 ## Compilers and options according to machine
294 #############################################
295
296 ######################
297 ######## Set compilation options for intel C/Fortran compilers
298 ######################
299
300 if test "$with_intelcompilers" = yes; then
301    SCI_INTEL_COMPILER()
302 fi
303
304 ########### FORTRAN ######################
305
306
307 ######################
308 ######## With F77 / G77 / GFortran ...
309 ######################
310
311 if test -n "$F77"; then
312 dnl @TODO : Maybe we should check that it is actually gfortran
313    if test "$enable_debug_fortran" = yes; then
314         # -D_FORTIFY_SOURCE=2
315         AC_LANG_PUSH([Fortran 77])
316         for flag in -g -Wall -Wimplicit -Wsurprising ; do
317                 case " ${FFLAGS} " in
318                         *\ ${flag}\ *)
319                                 # flag is already present
320                                 ;;
321
322                         *)
323                                 AC_MSG_CHECKING([if the Fortran compiler accepts ${flag}])
324                                 ac_save_FFLAGS="$FFLAGS"
325                                 FFLAGS="$FFLAGS ${flag}"
326                                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
327                                         [AC_MSG_RESULT([yes])],
328                                         [AC_MSG_RESULT([no])
329                                         FFLAGS="$ac_save_FFLAGS"
330                                         ]
331                                 )
332                                 ;;
333                 esac
334         done
335         AC_LANG_POP([Fortran 77])
336    else
337           FFLAGS="$FFLAGS -DNDEBUG"
338    fi
339           case "$host" in
340                  x86_64-*-linux*)
341                         FFLAGS="$FFLAGS -m64 -fPIC"
342                                         ;;
343                 # Dec Alpha OSF 4
344                 alpha*-dec-osf4.*)
345               FFLAGS="$FFLAGS -fpe3"
346                 ;;
347                 alpha*-dec-osf*)
348                     FFLAGS="$FFLAGS -fpe3 -switch nosqrt_recip"
349                 ;;
350                 rs6000-*-*)
351                     FFLAGS="$FFLAGS -qcharlen=4096"
352                         ;;
353                 mips-*-ultrix*)
354                     FFLAGS="-O0 -fpe1"
355                 ;;
356                   *-*-hpux9.*)
357                         FFLAGS="$FFLAGS +Obb1200 +E4 -Dhpux"
358                 ;;
359                   *-*-hpux10.*)
360                         if test "$enable_debug_fortran" = yes; then
361                             FFLAGS="+E4 +Z +DAportable -Dhpux"
362                         else
363                             FFLAGS="+O2 +E4 +Z +DAportable -Dhpux"
364                         fi
365 #                   F77_LDFLAGS="-Wl,+vnocompatwarnings,-E /usr/lib/libdld.sl"
366
367                         ;;
368                   *-*-hpux11.*)
369                    if test "$enable_debug_fortran" = yes; then
370                           FFLAGS=" +Z +DAportable -Dhpux"
371                          else
372                       FFLAGS="+O2 +Z +DAportable -Dhpux"
373                    fi
374                           FLIBS="-ldld -lnsl -lU77 -lm"
375     #do not call AC_F77_LIBRARY_LDFLAGS because if assumes PA2.0 while Scilab is built with
376     #DAportable=PA1.1
377     #AC_F77_LIBRARY_LDFLAGS
378         # @TODO : check why and if it is still the case
379
380 #    F77_LDFLAGS="-Wl,+vnocompatwarnings,-E /usr/lib/libdld.sl"
381          ;;
382           esac
383 #          FFLAGS_O0=`echo $FFLAGS | sed 's/-O[0-9]*//g'`
384 fi
385
386 #########################
387 # setting parameters according to system types
388 #########################
389
390 case "$host" in
391         *-*-hpux9.*|*-*-hpux10.*|*-*-hpux11.*)
392                 HPUX=1
393         ;;
394         sparc-*)
395                 SPARC=1
396         ;;
397         mips-sgi-irix*)
398           MIPS_SGI_IRIX=1
399         ;;
400          *-*-solaris*)
401          SOLARIS=1
402          ;;
403         *darwin*)
404           MACOSX=1
405         ;;
406 esac
407
408 AM_CONDITIONAL(IS_MACOSX, test -n "$MACOSX")
409 AM_CONDITIONAL(IS_HPUX, test -n "$HPUX")
410 AM_CONDITIONAL(IS_SPARC, test -n "$SPARC")
411 AM_CONDITIONAL(IS_SOLARIS, test -n "$SOLARIS")
412 AM_CONDITIONAL(IS_MIPS_SGI_IRIX, test -n "$MIPS_SGI_IRIX")
413
414
415
416 ############
417 ## C++
418 ############
419
420
421 if test -z "$CXX"; then
422   AC_MSG_ERROR([No C++ compiler found. Cannot compile scilab without a C++ compiler])
423 fi
424
425 case "$CXX" in
426          g++-* | g++ | ccache*g++ | ccache*g++-* )
427    ## With GNU C++ Compiler
428    if test "$enable_debug_CXX" = yes; then
429           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 -Wold-style-cast -g3 -Weffc++"
430           case "$host" in
431           *-linux-gnu )
432           # Only doing that under Linux
433                   CXXFLAGS="$CXXFLAGS -fdiagnostics-show-option -Werror=format-security"
434           ;;
435           esac
436    else
437           CXXFLAGS="$CXXFLAGS -DNDEBUG"
438    fi
439    CXXFLAGS="$CXXFLAGS -fno-stack-protector" # bug 3131
440    ;;
441 esac
442
443 #### 64 bits detection
444 IS_64_BITS_CPU=false
445 case "$host" in
446          x86_64-*-linux-gnu | x86_64-linux-gnu | ia64-*-linux-gnu | alpha-*-linux-gnu | alpha-*-netbsd* | x86_64-*-netbsd* | sparc64-*-netbsd*)
447                 IS_64_BITS_CPU=true
448         ;;
449 esac
450
451 ##########"
452 # not useful under Linux (and was only defined here with scilab 4)
453 #AC_CHECK_LIB(ieee,main,[LIEEE="-lieee"])
454
455 #LDFLAGS="$LIEEE $LDFLAGS"
456 #F77_LDFLAGS="$F77_LDFLAGS $LIEEE"
457 case "$CC" in
458          gcc-* | gcc | ccache*gcc | ccache*gcc-* )
459    ## With GNU Compiler
460    if test "$enable_debug_C" = yes; then
461           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"
462           # used to be -O
463           # -D_FORTIFY_SOURCE=2
464           case "$host" in
465           *-linux-gnu )
466           # Only doing that under Linux
467                 if test "$enable_debugLinker" = yes; then
468                   LDFLAGS="$LDFLAGS -Wl,--warn-common,-x"
469                 fi
470                   CFLAGS="$CFLAGS -fdiagnostics-show-option -Werror=format-security"
471                   ;;
472                   esac
473    else
474           CFLAGS="$CFLAGS  -DNDEBUG"
475    fi
476    CFLAGS="$CFLAGS -fno-stack-protector" # bug 3131
477
478    case "$host" in
479    # Linux sparc | Linux, old binary format a.out (NO LONGER SUPPORTED)
480          sparc-*-linux-gnu|*-pc-linux-gnuaout)
481             CFLAGS="$CFLAGS -fwritable-strings"
482         ;;
483          x86_64-*-linux-gnu | x86_64-linux-gnu)
484                 CFLAGS="$CFLAGS -DNARROWPROTO -m64"
485     ;;
486          i*86-*-linux-gnu | *-pc-linux-gnu | i*86-*-linux )
487                 CFLAGS="$CFLAGS  -DNARROWPROTO"
488         ;;              
489          ia64-*-linux-gnu )
490                 CFLAGS="$CFLAGS -DNARROWPROTO"
491     ;;
492          alpha-*-linux-gnu)
493                 CFLAGS="$CFLAGS  -mieee-with-inexact -fwritable-strings"
494                 LDFLAGS="$LDFLAGS -mieee-with-inexact"
495         ;;
496          powerpc-*-linux-gnu)
497                 CFLAGS="$CFLAGS -D_GNU_SOURCE -fwritable-strings"
498         ;;
499          *-*-solaris*)
500         if test "$enable_debug_C" = yes; then
501                          CFLAGS="$CFLAGS -DSVR4 -DSYSV -Dsolaris"
502                 else
503                          CFLAGS="-O2 -DNDEBUG -DSVR4 -DSYSV -Dsolaris"
504                 fi
505         ;;
506    *-*-freebsd*)
507      CFLAGS="$CFLAGS -Dfreebsd"
508          LDFLAGS="$LDFLAGS -lm"
509          ;;
510
511   alpha-*-netbsd*)
512     CFLAGS="$CFLAGS -Dnetbsd -mieee"
513     FFLAGS="$FFLAGS -Dnetbsd -mieee"
514         ;;
515
516   *-*-netbsd*)
517     CFLAGS="$CFLAGS -Dnetbsd"
518         ;;
519
520   *-*-darwin*)
521          CFLAGS=" $CFLAGS -I/sw/include "
522          CPPFLAGS=" $CPPFLAGS -I/sw/include "
523          LDFLAGS=" $LDFLAGS -L/sw/lib/ "
524         ;;
525 esac
526 ;; # end of the gcc case on the $CC
527    *)
528
529                 ## CC compiler (not GCC)
530         if test "$enable_debug_C" = yes; then
531                      CFLAGS="$CFLAGS -g"
532                 else
533                      CFLAGS="$CFLAGS -DNDEBUG"
534                 fi
535
536 case "$host" in
537 # Dec Alpha OSF 4
538   alpha*-dec-osf4.*)
539       CFLAGS="$CFLAGS -std -ieee_with_inexact"
540       LDFLAGS="$LDFLAGS -ieee_with_inexact"
541           ;;
542   alpha*-dec-osf*)
543       CFLAGS="$CFLAGS -ieee_with_inexact"
544       LDFLAGS="$LDFLAGS -ieee_with_inexact"
545       ;;
546   rs6000-*-*) # IBM AIX RS 6000 (NO LONGER SUPPORTED)
547     CFLAGS="-Daix -DSYSV"
548   ;;
549   mips-sgi-irix*) # SGI
550         CFLAGS="$CFLAGS -DSYSV -DSVR4"
551   ;;
552   *-*-hpux9.*)
553         CFLAGS="$CFLAGS -DSYSV -Dhpux"
554   ;;
555   *-*-hpux10.*) # HP 10
556     if test "$enable_debug_C" = yes; then
557           CFLAGS="$CFLAGS -DSYSV -Dhpux"
558     else
559           CFLAGS="$CFLAGS -DSYSV -Dhpux +Z +DAportable"
560     fi
561   ;;
562
563   *-*-hpux11.*) # HP 11
564     CFLAGS="$CFLAGS -DSYSV -Dhpux -Dhppa +Z +DAportable"
565   ;;
566   *-*-solaris*) # SUN SOLARIS
567     CFLAGS="$CFLAGS -DSVR4 -DSYSV -Dsolaris -I/usr/local/include/"
568         LDFLAGS="$LDFLAGS  -L/usr/local/lib/"
569   ;;
570 esac
571 ;; # end of not a gcc compiler
572 esac
573
574
575 # flag for possible compilations in configure
576 CFLAGS="$CFLAGS "'-I$(top_srcdir)/modules/core/includes/ -I$(top_srcdir)/libs/MALLOC/includes/ -I$(top_srcdir)/modules/localization/includes/'
577 CXXFLAGS="$CXXFLAGS "'-I$(top_srcdir)/modules/core/includes/ -I$(top_srcdir)/libs/MALLOC/includes/ -I$(top_srcdir)/modules/localization/includes/'
578 FFLAGS="$FFLAGS "'-I$(top_srcdir)/modules/core/includes/'
579
580 if test $IS_64_BITS_CPU = true -o "$MACOSX" = "1"; then
581    if test $f90compatible = false; then
582       AC_MSG_ERROR([64 bits support needs a fortran 90 compiler (try --with-gfortran).])
583    fi
584    AC_DEFINE([USE_DYNAMIC_STACK], [], [If we are building a 64 bits version])
585 fi
586
587 AM_CONDITIONAL(IS_64_BITS_CPU, test $IS_64_BITS_CPU = true)
588 AM_CONDITIONAL(USE_DYNAMIC_STACK, test $IS_64_BITS_CPU = true -o "$MACOSX" = "1")
589
590 #######################
591 ## test for underscores (name mangling issues between C and fortran)
592 #######################
593 AC_CHECK_UNDERSCORE_FORTRAN()
594
595 ###########################
596 ## test for JAVA compiler
597 ###########################
598
599 if test "$with_javasci" != no -o "$with_gui" != no -o "$enable_build_help" != no; then
600    # See if --with-jdk command line argument is given
601      # Try to detect the installed JVM, this could be controlled
602          # by the above --with options
603          AC_JAVA_WITH_JDK
604          AC_JAVA_DETECT_JVM
605    if test "$ac_java_jvm_name" = "jdk"; then
606                 JAVA_HOME=$ac_java_jvm_dir
607             JAVA_VERSION=$ac_java_jvm_version
608 #     AC_JAVA_TOOLS
609                 AC_JAVA_JNI_INCLUDE
610                 JAVA_JNI_INCLUDE=$ac_java_jvm_jni_include_flags
611
612                 AC_JAVA_JNI_LIBS
613                 JAVA_JNI_LIBS=$ac_java_jvm_jni_lib_flags
614                 JAVA_JNI_LIBS_PRELOAD=$ac_java_jvm_ld_preload
615                 AC_JAVA_CLASSPATH
616                 JAVA_CLASSPATH=$ac_java_classpath
617                 AC_JAVA_TOOLS
618                 AC_JAVA_ANT
619
620                 if test "$with_gui" != no; then
621
622                                 # Docking system
623                                 AC_JAVA_CHECK_PACKAGE([flexdock],[org.flexdock.docking.DockingManager],[Scilab Gui])
624                                 FLEXDOCK=$PACKAGE_JAR_FILE
625                                 AC_SUBST(FLEXDOCK)
626
627                                 # Swing look&feel implementations
628                                 AC_JAVA_CHECK_PACKAGE([looks],[com.jgoodies.looks.common.RenderingUtils],[Scilab Gui - Look and feel],"yes")
629                                 LOOKS=$PACKAGE_JAR_FILE
630
631                                 # Named differently under Opensuse
632                                 if test -z "$LOOKS"; then
633                                     AC_JAVA_CHECK_PACKAGE([looks2],[com.jgoodies.looks.common.RenderingUtils],[Scilab Gui - Look and feel])
634                                         LOOKS=$PACKAGE_JAR_FILE
635                                 fi
636                                 AC_SUBST(LOOKS)
637
638                                 AC_SUBST(LOOKS)
639
640                                 #  Skin Look and Feel 
641                                 AC_JAVA_CHECK_PACKAGE([skinlf],[com.l2fprod.util.AccessUtils],[Scilab Gui - Skin Look and Feel])
642                                 SKINLF=$PACKAGE_JAR_FILE
643                                 AC_SUBST(SKINLF)
644
645                                 # JOGL
646                                 AC_JAVA_CHECK_PACKAGE([jogl],[javax.media.opengl.glu.GLUnurbs],[Scilab 3D rendering - Version 1.1.1])
647                                 JOGL=$PACKAGE_JAR_FILE
648                                 AC_SUBST(JOGL)
649
650                                 # Jhall
651                                 AC_JAVA_CHECK_PACKAGE([jhall],[javax.help.JHelp],[Scilab Help Browser],"yes")
652                                 JHALL=$PACKAGE_JAR_FILE
653
654                                 # Named differently under Mandriva
655                                 if test -z "$JHALL"; then
656                                         AC_JAVA_CHECK_PACKAGE([javahelp2],[javax.help.JHelp],[Scilab Help Browser])
657                                         JHALL=$PACKAGE_JAR_FILE
658                                 fi
659                                 AC_SUBST(JHALL)
660
661                                 # JoGL Native <=> Java connector
662                                 AC_JAVA_CHECK_PACKAGE([gluegen-rt],[com.sun.gluegen.runtime.CPU],[Scilab 3D rendering])
663                                 GLUEGEN_RT=$PACKAGE_JAR_FILE
664                                 AC_SUBST(GLUEGEN_RT)
665
666                                 # Console API
667                                 AC_JAVA_CHECK_PACKAGE([jrosetta-API],[com.artenum.rosetta.interfaces.core.ConsoleConfiguration],[JRosetta : Console API Artenum / Scilab])
668                                 JROSETTA_API=$PACKAGE_JAR_FILE
669                                 AC_SUBST(JROSETTA_API)
670
671                                 # Console Core
672                                 AC_JAVA_CHECK_PACKAGE([jrosetta-engine],[com.artenum.rosetta.core.action.AbstractConsoleAction],[JRosetta : Console Core Artenum / Scilab])
673                                 JROSETTA_ENGINE=$PACKAGE_JAR_FILE
674                                 AC_SUBST(JROSETTA_ENGINE)
675
676                                 # Logging (flexdock dep)
677                                 AC_JAVA_CHECK_PACKAGE([commons-logging],[org.apache.commons.logging.LogFactory],[Apache logging])
678                                 COMMONS_LOGGING=$PACKAGE_JAR_FILE
679                                 AC_SUBST(COMMONS_LOGGING)
680
681                                 AC_DEFINE([WITH_GUI],[],[With the JAVA stuff (GUI, Console, JOGL...)])
682                 fi
683         else
684                 AC_MSG_WARN([Sun javac not found: I will not build the java interface])
685                 if test "$ac_java_jvm_name" != ""; then
686                         AC_MSG_WARN([We do not support $ac_java_jvm_name yet])
687                 fi
688         fi
689         AC_SUBST(JAVA_JNI_INCLUDE)
690     AC_SUBST(JAVA_JNI_LIBS)
691     AC_SUBST(JAVA_HOME)
692
693
694     if test "$enable_debug_java" = yes; then
695            JAVA_DEBUG_OPTIONS="<option value='-verbose:jni'/>
696            <option value='-Xcheck:jni'/>"
697            AC_SUBST(JAVA_DEBUG_OPTIONS)
698         fi
699
700         if test "$enable_build_swig" != no -a "$enable_build_swig" != ""; then
701                 SWIG_PROG()
702                 SWIG_ENABLE_JAVA()
703                 AC_SUBST(SWIG_BIN)
704         AC_SUBST(SWIG_JAVA)
705
706         fi
707
708         # Giws is the equivalent of Swig developped by the Scilab team
709         # in order to provide a wrapper to Java from C/C++
710         if test "$enable_build_giws" != no -a "$enable_build_giws" != ""; then
711                 AC_GIWS()
712         fi
713 fi
714
715 AM_CONDITIONAL(NEED_JAVA, test "$with_javasci" != no -o "$with_gui" != no -o "$enable_build_help" != no)
716 AM_CONDITIONAL(GUI, test "$with_gui" != no)
717 AM_CONDITIONAL(JAVASCI, test "$with_javasci" != no)
718 AM_CONDITIONAL(SWIG, test "$enable_build_swig" != no -a "$enable_build_swig" != "")
719 AM_CONDITIONAL(GIWS, test "$enable_build_giws" != no  -a "$enable_build_giws" != "")
720
721 ##############################################################
722 ## test for functions in standard C library and C math library
723 ##############################################################
724
725 # Provided by unistd.h
726 AC_CHECK_FUNCS([sleep] [usleep] [dup2] [getcwd] [getpagesize] [getpass])
727 AC_CHECK_FUNCS([rmdir])
728
729 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])])
730
731 # Provided by <regex.h>
732 AC_CHECK_FUNCS([regcomp])
733
734 # Provided by stdlib.h
735 AC_CHECK_FUNCS([atexit] [putenv] [setenv])
736
737 # Provided by String.h
738 AC_CHECK_FUNCS([bzero] [memmove] [memset] [strcasecmp] [strerror] [strchr] [strdup] [strpbrk] [strrchr] [strstr] [strtol])
739
740 # Provided by select.h
741 AC_CHECK_FUNCS([select])
742
743 # Provided by pwd.h
744 AC_CHECK_FUNCS([endpwent])
745
746 # Provided by netdb.h
747 AC_CHECK_FUNCS([gethostbyaddr] [gethostbyname] [gethostname])
748
749 # Provided by time.h
750 AC_CHECK_FUNCS([gettimeofday])
751
752 # Provided by ctype.h
753 AC_CHECK_FUNCS([isascii])
754
755 # Provided by wctype.h
756 AC_CHECK_FUNCS([iswprint])
757
758 # Provided by types.h
759 AC_CHECK_FUNCS([mkdir])
760
761 # Provided by mman.h
762 AC_CHECK_FUNCS([munmap])
763
764 # Provided by math.h
765 save_LDFLAGS="$LDFLAGS"
766 LDFLAGS="$LDFLAGS -lm"
767
768 AC_CHECK_FUNCS([pow] [sqrt] [finite] [floor])
769
770 AC_CHECK_FUNC([exp10],,[
771                                 AC_DEFINE([log_10_],[2.3025850929940456840179914546844],[Provide a macro to do exp10])
772                                 AC_DEFINE([exp10(x)],[exp( (log_10_) * (x) )],[Provide a macro to do exp10])
773                                 ])
774
775 ### If isinf exists or not (used to not be the case under Solaris)
776 ### See bug #4164
777 AC_CHECK_FUNC([isinf],,[
778                 AC_DEFINE([isinf(x)],[(!finite(x) && x==x)],[Provide a macro to do isinf])
779 ])
780
781 LDFLAGS="$save_LDFLAGS"
782
783 # Provided by regex.h
784 AC_CHECK_FUNCS([re_comp])
785
786 # Provided by socket.h
787 AC_CHECK_FUNCS([socket])
788
789 # Provided by utsname.h
790 AC_CHECK_FUNCS([uname])
791
792 # Provided by wtloop.c
793 AC_CHECK_FUNCS([setlocale])
794
795 # Function memcmp used in modules/fileio/src/c/xls.c
796 AC_FUNC_MEMCMP
797
798 # function stat used in modules/core/src/c/link_std.c
799 AC_FUNC_STAT
800
801 # function strtod used in modules/core/src/c/getval.c
802 AC_FUNC_STRTOD
803
804 ########################
805 ## test for header files
806 ########################
807
808 AC_CHECK_HEADERS([limits.h values.h])
809
810 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])
811
812 # check header dirent
813 AC_HEADER_DIRENT
814
815 # static struct timeval defined or not | used in modules/core/src/c/timer.c
816 AC_HEADER_TIME
817
818 # check if the specific header is available or not | used in modules/core/src/c/link_SYSV.c
819 AC_HEADER_SYS_WAIT
820
821
822 #######################
823 ## Test for structures ##
824 #######################
825 AC_CHECK_MEMBERS([struct stat.st_blksize])
826 AC_CHECK_MEMBERS([struct stat.st_rdev])
827
828
829 #######################
830 ## MISC Test
831 #######################
832
833 # gettext.  See http://www.gnu.org/software/hello/manual/gettext/AM_005fGNU_005fGETTEXT.html
834 AM_GNU_GETTEXT([external])
835
836 # function closedir used in modules/metanet/src/c/files.c
837 AC_FUNC_CLOSEDIR_VOID
838
839 # Signals used in modules/core/src/c/realmain.c
840 AC_TYPE_SIGNAL
841
842 # struct tm used in modules/core/src/c/history.c
843 AC_STRUCT_TM
844
845 # st_blocks in the struct in modules/io/sci_gateway/c/intfilestat.c
846 AC_STRUCT_ST_BLOCKS
847
848
849 ##################
850 ## termcap library
851 ##################
852
853 # some systems may have a system curses implementation as well as ncurses
854 # installed.  We need to be consistent in making sure we get the correct
855 # library to go with the correct header and also provide a way for the user
856 # to have some control over which is picked when both are available.
857 #
858 # For now, just check for -lcurses and then -lncurses.  The user control
859 # may need to be revisited
860
861 TERMCAP_LIB=no
862
863 # Various observations:
864 #
865 #  ncurses 
866 #    - installs ncurses.h and possibly curses.h as a link to ncurses.h
867 #    - installs -lncurses.
868 #    - need to include term.h for tgetent() but tgetent() is in -lncurses.a
869 #
870 # curses as found in NetBSD-4 and NetBSD-5
871 #    - installs curses.h
872 #    - need to include termcap.h and link with -ltermcap for tgetent()
873 #
874
875 AC_CHECK_LIB([curses],[main])
876 if test $ac_cv_lib_curses_main = no ; then
877         AC_CHECK_LIB([ncurses],[main])
878 fi
879
880 # make sure we have what we need for tgetent
881 AC_SEARCH_LIBS([tgetent],[termcap])
882
883 AC_CHECK_HEADERS([ncurses.h curses.h])
884
885 if test "x$ac_cv_lib_curses_main" = "xyes" -o "x$ac_cv_lib_ncurses_main" = "xyes" ; then
886   AC_DEFINE([HAVE_TERMCAP],[],[Have Term Cap])
887 else
888  AC_MSG_ERROR([No termcap library detected. Please install ncurses dev library (or termcap library)])
889 fi
890
891 ##################
892 ## other libraries
893 ##################
894
895 AC_CHECK_LIB(dl, dlopen)
896
897 AC_SEARCH_LIBS([pthread_join],[pthread])
898
899 #################
900 ## SCICOS
901 #################
902
903 AC_ARG_WITH(scicos,
904     AC_HELP_STRING([--without-scicos],[Disable Scicos]))
905
906 AC_ARG_WITH(ocaml,
907     AC_HELP_STRING([--without-ocaml],[Disable the OCaml modules (modelica)]))
908
909
910 SCICOS_ENABLE=no
911 if test "$with_scicos" != no -a "$with_gui" != no; then
912    AC_DEFINE([WITH_SCICOS], [], [With SCICOS])
913
914    save_LIBS="$LIBS"
915
916    AC_CHECK_LIB([rt], [clock_gettime],
917                       [RT_LIB="-lrt";
918                       AC_DEFINE([HAVE_CLOCK_GETTIME], [1],[Whether clock_gettime is available]) ],
919         [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])]
920    )
921    LIBS="$save_LIBS"
922    AC_SUBST(RT_LIB)
923
924 #################
925 ## ocaml which only called with using Scicos
926 #################
927
928                 if test "$with_ocaml" != no; then
929                    AC_CHECK_PROG_OCAML()
930                 fi
931                 SCICOS_ENABLE=yes
932 fi
933 AC_SUBST(SCICOS_ENABLE)
934
935 AM_CONDITIONAL(OCAML, test "$with_ocaml" != no -a "$OCAMLC" != no -a "$OCAMLOPT" != no)
936 AM_CONDITIONAL(SCICOS, test "$with_scicos" != no -a "$with_gui" != no)
937
938
939 #################
940 ## FFTW
941 #################
942
943 AC_ARG_WITH(fftw,
944     AC_HELP_STRING([--without-fftw],[Disable the interface to the FFTW 3 library]))
945
946 FFTW_ENABLE=no
947 if test "$with_fftw" != no; then
948    AC_FFTW()
949    FFTW_ENABLE=yes
950 fi
951
952 AC_SUBST(FFTW_ENABLE)
953 AM_CONDITIONAL(FFTW, test "$with_fftw" != no)
954
955 #################
956 ## MPI
957 #################
958
959 # Not in Scilab 5.0
960 #AC_ARG_WITH(mpi,
961 #    [  --with-mpi                 compile with MPI library])
962 #
963 #if test "$with_mpi" = yes; then
964 #   AC_OPENMPI()
965 #   # We will have to detect other implementation of OpenMPI
966 #fi
967 #AM_CONDITIONAL(MPI, test "$with_mpi" = yes)
968
969 #################
970 ## PVM
971 #################
972
973 AC_ARG_WITH(pvm,
974     AC_HELP_STRING([--without-pvm],[Disable the interface to the PVM library]))
975
976 PVM_ENABLE=no
977 if test "$with_pvm" != no; then
978    AC_PVM()     
979    PVM_ENABLE=yes
980 fi
981 AC_SUBST(PVM_ENABLE)
982
983 AM_CONDITIONAL(PVM, test "$with_pvm" != no)
984
985 #######################
986 ## Test for libxml
987 #######################
988
989 AC_LIBXML2()
990
991 #######################
992 ## Test for gettext
993 #######################
994
995 ALL_LINGUAS="en_US fr_FR zh_CN zh_TW ru_RU ca_ES de_DE es_ES pt_BR"
996
997 AC_ARG_ENABLE(build-localization,
998                 AC_HELP_STRING([--disable-build-localization],[Disable the localization build])
999                 )
1000 BUILD_LOCALIZATION_ENABLE=no
1001
1002 if test "$enable_build_localization" != no; then
1003
1004    AC_SUBST(ALL_LINGUAS)
1005    AC_CHECK_FUNCS([bind_textdomain_codeset])
1006
1007    AC_PATH_PROG(MSGCAT, msgcat, no)
1008    AC_PATH_PROG(MSGFMT, msgfmt, no)
1009    AC_PATH_PROG(XGETTEXT, xgettext, no)
1010
1011    if test x$MSGFMT = xno; then
1012           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 ])
1013           fi
1014         if test x$MSGCAT = xno; then
1015           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 ])
1016         fi
1017         BUILD_LOCALIZATION_ENABLE=yes
1018 fi
1019 AM_CONDITIONAL(GENERATE_LOCALIZATION_FILES, test "$BUILD_LOCALIZATION_ENABLE" = yes)
1020
1021 #######################
1022 ## Test for blas/Atlas and lapack
1023 #######################
1024 AC_MSG_CHECKING([if BLAS, ATLAS or MKL is available])
1025 echo ""
1026 EMBEDDED_BLAS=0
1027 ACX_BLAS(
1028                 [AC_MSG_RESULT([$BLAS_TYPE found])]
1029                 ,
1030                 AC_MSG_WARN([Impossible to find a blas compatible library (see BLAS or ATLAS). Use the version of generic blas embedded])
1031                 EMBEDDED_BLAS=1
1032                 )
1033 AM_CONDITIONAL(USE_EMBEDDED_BLAS, test $EMBEDDED_BLAS = 1)
1034
1035
1036 AC_MSG_CHECKING([if LAPACK is available])
1037 echo ""
1038 EMBEDDED_LAPACK=0
1039 ACX_LAPACK(
1040                 [AC_MSG_RESULT([$LAPACK_TYPE found])],
1041                 AC_MSG_WARN([Impossible to find the LAPACK library. Use the version of lapack embedded])
1042                 EMBEDDED_LAPACK=1
1043                 )
1044 AM_CONDITIONAL(USE_EMBEDDED_LAPACK, test $EMBEDDED_LAPACK = 1)
1045
1046
1047
1048 #################
1049 ## UMFPACK
1050 #################
1051
1052 AC_ARG_WITH(umfpack,
1053     AC_HELP_STRING([--without-umfpack],[Disable the interface to the UMFPACK library]))
1054
1055 UMFPACK_ENABLE=no
1056 if test "$with_umfpack" != no; then
1057    AC_UMFPACK([$BLAS_LIBS])
1058    UMFPACK_ENABLE=yes
1059 fi
1060
1061 AC_SUBST(UMFPACK_ENABLE)
1062 AM_CONDITIONAL(UMFPACK, test "$with_umfpack" != no)
1063
1064 #######################
1065 ## Test for PCRE
1066 #######################
1067
1068 AC_PCRE()
1069                  
1070  #############################################
1071 #################
1072 ## Tcl/Tk library
1073 #################
1074
1075 WITH_TKSCI=no
1076 if test "$with_tk" != no; then
1077
1078         # check user arguments
1079         USER_TCL_LIB_PATH=""
1080         USER_TCL_INC_PATH=""
1081         AC_ARG_WITH(tcl-library,
1082                 AC_HELP_STRING([--with-tcl-library=DIR],[Set the path to the TCL library]),
1083                 [  USER_TCL_LIB_PATH=$withval
1084         ])
1085         AC_ARG_WITH(tcl-include,
1086                 AC_HELP_STRING([--with-tcl-include=DIR],[Set the path to the TCL headers]),
1087                 [  USER_TCL_INC_PATH=$withval
1088         ])
1089
1090         USER_TK_LIB_PATH=$USER_TCL_LIB_PATH
1091         USER_TK_INC_PATH=$USER_TCL_INC_PATH
1092
1093         AC_ARG_WITH(tk-library,
1094                 AC_HELP_STRING([--with-tk-library=DIR],[Set the path to the TK library]),
1095                 [  USER_TK_LIB_PATH=$withval
1096         ])
1097
1098         AC_ARG_WITH(tk-include,
1099                 AC_HELP_STRING([--with-tk-include=DIR],[Set the path to the TK headers]),
1100                 [  USER_TK_INC_PATH=$withval
1101         ])
1102
1103 ###########################
1104 ########## X11 checks
1105 ###########################      
1106                 ## This check is mandatory since tk needs Xlib headers and libs
1107                 AC_PATH_XTRA
1108                 ##
1109
1110         saved_cflags="$CFLAGS"
1111         saved_ldflags="$LDFLAGS"
1112         saved_cppflags="$CPPFLAGS"
1113
1114         AC_CHECK_LIB([dl], [main], [TCLTK_LIBS=" -ldl"])
1115         AC_CHECK_TCLTK
1116
1117         # set variables
1118         if test "$WITH_TKSCI" = yes; then
1119                 AC_DEFINE([WITH_TK], [], [With TK])
1120         else
1121                 AC_MSG_ERROR([TCL/TK not found. Use --without-tk or specify the librairies and include paths manually])
1122         fi
1123
1124         AC_SUBST(TCLTK_LIBS)
1125         AC_SUBST(TCL_INC_PATH)
1126         AC_SUBST(TK_INC_PATH)
1127
1128 fi
1129 AC_SUBST(WITH_TKSCI)
1130 AM_CONDITIONAL(TCLTK, test "$WITH_TKSCI" = yes)
1131
1132 #################
1133 ## MATIO LIBRARY (MAT File I/O Library)
1134 #################
1135
1136
1137 AC_ARG_WITH(matio,
1138     AC_HELP_STRING([--without-matio],[Disable the interface to Matio (MAT File I/O library)]))
1139
1140 AC_ARG_WITH(matio_include,
1141                 AC_HELP_STRING([--with-matio-include=DIR],[Set the path to the MATIO headers]),
1142                 [with_matio_include="-I$withval"], [])
1143
1144 AC_ARG_WITH(matio_library,
1145                 AC_HELP_STRING([--with-matio-library=DIR],[Set the path to the MATIO libraries]),
1146                 [with_matio_library="-L$withval"], [])
1147
1148 MATIO_ENABLE=no
1149
1150 if test "$with_matio" != no; then
1151    if test -n "$with_matio_include" -o -n "$with_matio_library" ; then
1152       MATIO_CFLAGS="$with_matio_include"
1153       MATIO_LIBS="$with_matio_library -lm -lz -lmatio"
1154    else
1155       PKG_CHECK_MODULES(MATIO, [matio >= 1.3.3])
1156    fi
1157    
1158    save_CFLAGS="$CFLAGS"
1159    save_LIBS="$LIBS"
1160
1161    CFLAGS="$CFLAGS $MATIO_CFLAGS"
1162    LIBS="$LIBS $MATIO_LIBS"
1163    
1164    AC_CHECK_HEADERS([matio.h matioConfig.h], [],
1165      [AC_MSG_ERROR([Invalid MATIO_CFLAGS returned by pkg-config. Try to define MATIO_CFLAGS.])])
1166    AC_CHECK_LIB([matio], [Mat_Open], [],
1167      [AC_MSG_ERROR([Invalid MATIO_LIBS returned by pkg-config. Try to define MATIO_LIBS.])])
1168    
1169    LIBS="$save_LIBS"
1170    CFLAGS="$save_CFLAGS"
1171    
1172    AC_DEFINE([WITH_MATIO], [], [With the MATIO library])
1173    MATIO_ENABLE=yes
1174 fi
1175
1176
1177 AC_SUBST(MATIO_ENABLE)
1178 AM_CONDITIONAL(MATIO, test "$with_matio" != no)
1179
1180 #############################
1181 ## Documentation management #
1182 #############################
1183
1184 AC_ARG_ENABLE(build-help,
1185                 AC_HELP_STRING([--disable-build-help],[Disable the help build])
1186                 )
1187 HELP_ENABLE=no
1188
1189 if test "$enable_build_help" != no; then
1190     AC_DOCBOOK()
1191         HELP_ENABLE=yes
1192
1193 fi 
1194 AM_CONDITIONAL(BUILD_HELP, test $HELP_ENABLE = yes)
1195
1196 ##¬†Install XML help files ###
1197 AC_ARG_WITH(install-help-xml,
1198                 AC_HELP_STRING([--with-install-help-xml],[make install will install XML files])
1199                 )
1200 HELP_INSTALL_ENABLE=no
1201 if test "$with_install_help_xml" != no -a "$with_install_help_xml" != ""; then
1202    HELP_INSTALL_ENABLE=yes
1203 fi 
1204 AM_CONDITIONAL(INSTALL_HELP_XML, test "$HELP_INSTALL_ENABLE" != "")
1205
1206
1207 #########################
1208 ## libtool
1209 #########################
1210
1211 AM_DISABLE_STATIC
1212 AC_PROG_LIBTOOL([shared dlopen])
1213 AM_PROG_LIBTOOL
1214
1215
1216 # Avoid to link all the dep from others libraries (*.la included by LIBADD)
1217 link_all_deplibs=no
1218
1219 # Check to see if building shared libraries
1220 libtool_build_shared_libs=no
1221 if test "$enable_shared" = "yes"; then
1222   libtool_build_shared_libs=yes
1223 fi
1224
1225 # Check to see if building static libraries
1226 libtool_build_static_libs=no
1227 if test "$enable_static" = "yes"; then
1228   libtool_build_static_libs=yes
1229 fi
1230
1231 # AM_CONDITIONAL(ENABLE_STATIC, test "$libtool_build_static_libs" = yes)
1232 # Fake to disable the static build
1233 AM_CONDITIONAL(ENABLE_STATIC, test "$libtool_build_static_libs" = xxxx)
1234
1235 AC_C_CONST()
1236 AC_C_INLINE()
1237
1238
1239 #######################
1240 ###### Creation of the header file (machine.h)
1241 #######################
1242
1243 AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ["$PATH_SEPARATOR"],
1244 [The default path separator character.])
1245
1246 AH_TOP([#ifndef MACHINE_H
1247 #define MACHINE_H
1248 /* This file defines global element configuration of the build host */
1249 ])
1250
1251 AH_BOTTOM([
1252
1253 #ifdef DIR_SEPARATOR
1254            #undef DIR_SEPARATOR
1255 #endif
1256 #define DIR_SEPARATOR "/"
1257
1258 #endif /* MACHINE_H  */
1259 ])
1260
1261 # Define the standard extension of a dynamic library
1262 AC_DEFINE_UNQUOTED([SHARED_LIB_EXT],["$shrext_cmds"],[Extension of a shared library])
1263
1264 #################
1265 ## stop on warning
1266 #################
1267
1268 # Stop to compile scilab when a warning is found ...
1269 # This stuff is at the end of the configure.ac because it causes some
1270 # problem with AC_COMPILE (the -Werror is added to the test)
1271 #
1272 dnl @TODO : -O0 is only to bypass Stack shit... Must be removed.
1273 if test "$enable_stop_on_warning" = yes; then
1274    CFLAGS="$CFLAGS -Werror -O0"
1275    CXXFLAGS="$CXXFLAGS -Werror -O0"
1276 fi
1277
1278 AC_CONFIG_FILES([
1279 libs/lapack/Makefile
1280 libs/blas/Makefile
1281 libs/MALLOC/Makefile
1282 libs/dynamiclibrary/Makefile
1283 libs/doublylinkedlist/Makefile
1284 libs/hashtable/Makefile
1285 libs/libst/Makefile
1286 contrib/Makefile
1287 modules/helptools/Makefile
1288 modules/helptools/macros/xmlfiletohtml.sci
1289 modules/data_structures/Makefile
1290 modules/differential_equations/Makefile
1291 modules/optimization/Makefile
1292 modules/elementary_functions/Makefile
1293 modules/special_functions/Makefile
1294 modules/io/Makefile
1295 modules/shell/Makefile
1296 modules/completion/Makefile
1297 modules/history_manager/Makefile
1298 modules/jvm/Makefile
1299 modules/sound/Makefile
1300 modules/statistics/Makefile
1301 modules/mexlib/Makefile
1302 modules/sparse/Makefile
1303 modules/linear_algebra/Makefile
1304 modules/polynomials/Makefile
1305 modules/symbolic/Makefile
1306 modules/signal_processing/Makefile
1307 modules/arnoldi/Makefile
1308 modules/interpolation/Makefile
1309 modules/intersci/Makefile
1310 modules/localization/Makefile
1311 modules/metanet/Makefile
1312 modules/cacsd/Makefile
1313 modules/boolean/Makefile
1314 modules/integer/Makefile
1315 modules/double/Makefile
1316 modules/fileio/Makefile
1317 modules/spreadsheet/Makefile
1318 modules/string/Makefile
1319 modules/time/Makefile
1320 modules/graphics/Makefile
1321 modules/graphic_export/Makefile
1322 modules/renderer/Makefile
1323 modules/action_binding/Makefile
1324 modules/gui/Makefile
1325 modules/pvm/Makefile
1326 modules/randlib/Makefile
1327 modules/tclsci/Makefile
1328 modules/windows_tools/Makefile
1329 modules/core/Makefile
1330 modules/call_scilab/Makefile
1331 modules/fftw/Makefile
1332 modules/umfpack/Makefile
1333 modules/scicos/Makefile
1334 modules/scicos_blocks/Makefile
1335 modules/functions/Makefile
1336 modules/dynamic_link/Makefile
1337 modules/overloading/Makefile
1338 modules/javasci/Makefile
1339 modules/maple2scilab/Makefile
1340 modules/m2sci/Makefile
1341 modules/compatibility_functions/Makefile
1342 modules/texmacs/Makefile
1343 modules/scipad/Makefile
1344 modules/scilab2fortran/Makefile
1345 modules/development_tools/Makefile
1346 modules/output_stream/Makefile
1347 modules/console/Makefile
1348 modules/demo_tools/Makefile
1349 modules/genetic_algorithms/Makefile
1350 modules/simulated_annealing/Makefile
1351 modules/parameters/Makefile
1352 modules/matio/Makefile
1353 modules/Makefile
1354 libs/Makefile
1355 Makefile
1356 scilab.pc
1357 etc/modules.xml
1358 etc/classpath.xml
1359 modules/jvm/etc/jvm_options.xml
1360 scilab-lib.properties
1361 scilab-lib-doc.properties
1362 ])
1363
1364 # Detection of the module for the future version of Scilab 6
1365 # ie we detect module which ends with _yasp
1366
1367 if test "$enable_yasp" = yes; then
1368    AC_CONFIG_FILES([
1369    modules/development_tools/src/fake/Makefile
1370   ])
1371 fi
1372
1373 # This script is used by Scicos in order to regenerate the function/block list
1374 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])
1375
1376
1377 #MAN_FR MAN_ENG
1378 #modules/mpi/Makefile
1379 #for top_builddir in . .. ../.. $ac_auxdir $ac_auxdir/..; do
1380 #  test -f $top_builddir/configure && break
1381 #done
1382
1383
1384 #if test "$with_mpi" = yes; then
1385 #AC_CONFIG_FILES([modules/mpi/Makefile])
1386 #fi
1387
1388 # Generate stack.h
1389 if test "$IS_64_BITS_CPU" = true -o "$MACOSX" = "1"; then
1390    stack_h_cpp_flags=-DUSE_DYNAMIC_STACK
1391 else
1392    stack_h_cpp_flags=
1393 fi
1394
1395 AC_CONFIG_COMMANDS([modules/core/includes/stack.h],
1396   [if ! $CPP $stack_h_cpp_flags - < $srcdir/modules/core/includes/stack.h.in |\
1397               $GREP -v '^#' > $srcdir/modules/core/includes/stack.h ; then
1398      AC_MSG_ERROR([stack.h generation failed])
1399    fi],
1400   [CPP="$CPP"
1401    GREP="$GREP"
1402    stack_h_cpp_flags="$stack_h_cpp_flags"
1403   ])
1404
1405 AC_OUTPUT
1406
1407 # To distribution packager, you can uncomment this stuff is you want to 
1408 # disable the rpath issue
1409 # However, you will have to set all the LD_LIBRARY_PATH to .libs/ directory
1410 # since scilab is compiling macros and help into the source tree (ie before
1411 # the "make install")
1412 # You should consider using chrpath:
1413 # http://directory.fsf.org/project/chrpath/
1414 # to remove it before the make install
1415
1416 #case ${host} in
1417 #  *-pc-linux-gnu)
1418 #    AC_MSG_RESULT([Fixing libtool for -rpath problems.])
1419 #    sed < libtool > libtool-2 \
1420 #    's/^hardcode_libdir_flag_spec.*$/hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/'
1421 #    mv libtool-2 libtool
1422 #    chmod 755 libtool
1423 #  ;;
1424 #esac
1425 #
1426
1427 echo ""
1428
1429 echo "Scilab is configured as follows. Please verify that this configuration"
1430 echo "matches your expectations."
1431 echo ""
1432 echo "Host system type : $host"
1433 echo ""
1434 echo "                  Option                        Value"
1435 echo "-------------------------------------------------------------------------"
1436 echo "Shared libraries.......      --enable-shared=$libtool_build_shared_libs   $libtool_build_shared_libs"
1437 echo "Static libraries.......      --enable-static=$libtool_build_static_libs   $libtool_build_static_libs"
1438 echo "GNU ld.................      --with-gnu-ld=$with_gnu_ld           $lt_cv_prog_gnu_ld"
1439 echo "Enable debug ..........      --enable-debug=$enable_debug $enable_debug"
1440 echo "Enable debug C.........      --enable-debug-C=$enable_debug_C     $enable_debug_C"
1441 echo "Enable debug C++.......      --enable-debug-CXX=$enable_debug_CXX $enable_debug_CXX"
1442 echo "Enable debug Java......      --enable-debug-java=$enable_debug_java       $enable_debug_java"
1443 echo "Enable debug Fortran...      --enable-debug-fortran=$enable_debug_fortran $enable_debug_fortran"
1444 echo "Enable stop on warning.      --enable-stop-on-warning=$enable_stop_on_warning     $enable_stop_on_warning"
1445
1446 echo ""
1447 echo "Compiler Configuration:"
1448 echo "Intel (--with-intelcompilers) .... =              $with_intelcompilers"
1449 echo "GNU gcc (--with-gcc) ............. =              $with_gcc"
1450 echo "GNU Fortran 77 (--with-g77) ...... =              $with_g77"
1451 echo "GNU Fortran 95 (--with-gfortran) . =              $with_gfortran"
1452 echo ""
1453 echo "Options:"
1454 echo "Use PVM (--without-pvm) .......................... = $with_pvm"
1455 echo "PVM include (--with-pvm-include) ................. = $PVMINCLUDE"
1456 echo "PVM library (--with-pvm-library) ................. = $PVMLIBDIR"
1457 echo "Compile with Ocaml (--without-ocaml) ............. = $with_ocaml"
1458 echo "Do not use TCL/TK (--without-tk) ................. = $with_tk"
1459 echo "TCL include (--with-tcl-include) ................. = $USER_TCL_INC_PATH"
1460 echo "TCL library (--with-tcl-library) ................. = $USER_TCL_LIB_PATH"
1461 echo "TK include (--with-tk-include) ................... = $USER_TK_INC_PATH"
1462 echo "TK library (--with-tk-library) ................... = $USER_TK_LIB_PATH"
1463 echo "Install XML Help (--with-install-help-xml) ....... = $with_install_help_xml"
1464 echo "Make the package relocatable (--enable-relocatable)= $RELOCATABLE"
1465 echo "Use FFTW (--without-fftw) ........................ = $with_fftw"
1466 echo "Use MATIO (--without-matio) ...................... = $with_matio"
1467
1468 echo ""
1469 if test "$with_gui" = no; then
1470    echo "Not using Scicos because of the option --without-gui"
1471 else
1472 if test $SCICOS_ENABLE = yes; then
1473    echo "Scicos enable"
1474    echo ""
1475 if test "$with_ocaml" != no -a "$OCAMLC" != no -a "$OCAMLOPT" != no; then
1476    echo "Ocaml Configuration (for Modelica compiler):"
1477    echo "OCAMLC ............. = $OCAMLC"
1478    echo "OCAMLOPT ........... = $OCAMLOPT"
1479    echo "OCAMLDEP ........... = $OCAMLDEP"
1480 else
1481         echo "Will not build Modelica compiler"
1482 fi
1483 else 
1484    echo "Not using Scicos"
1485 fi
1486 fi
1487
1488 echo ""
1489 if test $PVM_ENABLE = yes; then
1490    echo "PVM Configuration:"
1491    echo "PVM Architecture ... = $PVM_ARCH"
1492    echo "PVM INCLUDE ........ = $PVM_INCLUDE"
1493    echo "PVM LIBS ........... = $PVM_LIB"
1494 else
1495    echo "Not using PVM"
1496 fi
1497
1498 echo ""
1499 if test $FFTW_ENABLE = yes;  then
1500    echo "FFTW Configuration:"
1501    echo "FFTW LIBS .......... = $FFTW3_LIB"
1502    echo "FFTW CFLAGS ........ = $FFTW3_CFLAGS"
1503 else
1504    echo "Not using FFTW"
1505 fi
1506
1507 echo ""
1508 if test $MATIO_ENABLE = yes;  then
1509    echo "MATIO Configuration:"
1510    echo "MATIO LIBS .......... = $MATIO_LIBS"
1511    echo "MATIO CFLAGS ........ = $MATIO_CFLAGS"
1512 else
1513    echo "Not using MATIO"
1514 fi
1515
1516 echo ""
1517 if test $UMFPACK_ENABLE = yes;  then
1518    echo "UMFPACK Configuration:"
1519    echo "UMFPACK LIBS ....... = $UMFPACK_LIB"
1520    echo "UMFPACK CFLAGS ..... = $UMFPACK_CFLAGS"
1521    if test $SUITESPARSE = yes; then
1522       echo "UMFPACK SUITESPARSE  = Yes"
1523    else
1524       echo "UMFPACK SUITESPARSE  = No"
1525    fi
1526 else
1527    echo "Not using UMFPACK"
1528 fi
1529
1530
1531 echo ""
1532 echo "BLAS/LAPACK/ATLAS Configuration:"
1533 if test $EMBEDDED_BLAS = 0; then
1534    echo "BLAS LIBS ............. = $BLAS_LIBS"
1535    echo "BLAS TYPE ............. = $BLAS_TYPE"
1536 else
1537    echo "BLAS LIBS ............. = Use the generic version of BLAS embedded"
1538 fi
1539
1540 if test $EMBEDDED_LAPACK = 0; then
1541    echo "LAPACK LIBS ........... = $LAPACK_LIBS"
1542    echo "LAPACK TYPE ........... = $LAPACK_TYPE"
1543 else
1544    echo "LAPACK LIBS ........... = Use the LAPACK embedded"
1545 fi
1546
1547 echo ""
1548
1549 #if test "$with_mpi" = yes; then
1550 #   echo "MPI Configuration:"
1551 #   echo "MPI LIBS ........... = $MPILIBS"
1552 #   echo "MPI C Compiler ..... = $MPICC"
1553 #   echo "MPI C++ Compiler ... = $MPICXX"
1554 #   echo "MPI F77 Compiler ... = $MPIF77"
1555 #else
1556 #   echo "Not using MPI"
1557 #fi
1558
1559 #if test "$with_openmpi" != "no"; then
1560 #   echo "OpenMPI Configuration:"
1561 #   echo "OpenMPI LIBS ........... = $OPENMPI_LIBS"
1562 #   echo "OpenMPI C Compiler ..... = $OPENMPI_CC"
1563 #   echo "OpenMPI F77 Compiler ... = $MPIF77"
1564 #else
1565 #   echo "Not using MPI"
1566 #fi
1567
1568 echo ""
1569 if test $BUILD_LOCALIZATION_ENABLE != no; then
1570    echo "Gettext/localization configuration:"
1571    echo "xgettext ............... = $XGETTEXT"
1572    echo "msgfmt  ................ = $MSGFMT"
1573    echo "msgfmt_opts ............ = $MSGFMT_OPTS"
1574    echo "msgcat  ................ = $MSGCAT"
1575 else
1576    echo "Won't generate localization files"
1577 fi
1578
1579 echo ""
1580 if test $HELP_ENABLE = yes; then
1581    echo "Docbook XSL path ....... = $DOCBOOK_ROOT"
1582    echo "Batik (SVG) ............ = $BATIK"
1583    echo "Saxon XSLT ............. = $SAXON"
1584    echo "FOP (XML => PDF) ....... = $FOP"
1585    echo "Jeuclid (MathML) ....... = $JEUCLID_CORE"
1586    echo "Commons I/O ............ = $COMMONS_IO"
1587    echo "XML graphics commons ... = $XMLGRAPHICS_COMMONS"
1588    echo "XML commons external ... = $XML_APIS_EXT"
1589 else
1590    echo "No documentation generated"
1591 fi
1592
1593 echo ""
1594 echo "Java Configuration:"
1595 if test ! -z "$JAVAC"; then
1596 echo "  JAVA_HOME ........... = $JAVA_HOME"
1597 echo "  JAVAC ............... = $JAVAC"
1598 echo "  JAVA_CLASSPATH ...... = $JAVA_CLASSPATH"
1599 echo "  JAVA_VERSION ........ = $JAVA_VERSION"
1600 echo "  JAVAC_FLAGS ......... = $JAVAC_FLAGS"
1601 echo "  JAVA_JNI_INCLUDE .... = $JAVA_JNI_INCLUDE"
1602 echo "  JAVA_JNI_LIBS ....... = $JAVA_JNI_LIBS"
1603 echo "  JAVA_JNI_LIBS_PRELOAD = $JAVA_JNI_LIBS_PRELOAD"
1604 echo "  JAVA ................ = $JAVA"
1605 echo "  JAR ................. = $JAR"
1606 echo "  ANT ................. = $ANT"
1607 else
1608 echo "  JAVA disabled"
1609 fi
1610
1611 echo "" 
1612 echo "TCL/TK configuration:"
1613 echo "  TK_INC_PATH ........ = $TK_INC_PATH"
1614 echo "  TCL_INC_PATH ....... = $TCL_INC_PATH"
1615 echo "  TCLTK_LIBS ......... = $TCLTK_LIBS"
1616 echo "  TCL_SERIAL_VERSION . = $TCL_SERIAL_VERSION"
1617 echo "  TK_SERIAL_VERSION .. = $TK_SERIAL_VERSION"
1618
1619 echo "" 
1620 echo "XML configuration:"
1621 echo "  XML_FLAGS .......... = $XML_FLAGS"
1622 echo "  XML_LIBS ........... = $XML_LIBS"
1623 echo "  XML_VERSION ........ = $XML_VERSION"
1624
1625 echo "" 
1626 echo "PCRE configuration:"
1627 echo "  PCRE_CFLAGS ........ = $PCRE_CFLAGS"
1628 echo "  PCRE_LIBS .......... = $PCRE_LIBS"
1629 echo "  PCRE_VERSION ....... = $PCRE_VERSION"
1630
1631
1632 echo ""
1633 echo "SWIG Configuration:"
1634 if test ! -z "$SWIG_BIN"; then
1635 echo "  SWIG_BIN ........... = $SWIG_BIN"
1636 echo "  SWIG_JAVA .......... = $SWIG_JAVA"
1637 else
1638 echo "  SWIG generation disabled"
1639 fi
1640
1641 echo ""
1642 echo "GIWS Configuration:"
1643 if test ! -z "$GIWS_BIN"; then
1644 echo "  GIWS_BIN ........... = $GIWS_BIN"
1645 else
1646 echo "  GIWS generation disabled"
1647 fi
1648
1649 echo ""
1650 echo "Libtool config:"
1651 echo "  objext .............. = $objext"
1652 echo "  libext (static) ..... = $libext"
1653 echo "  shrext_cmds ......... = $shrext_cmds"
1654 echo "  exeext .............. = $exeext"
1655
1656 echo ""
1657
1658 echo "Compilation paths:"
1659 echo "  srcdir .............. = $SCI_SRCDIR"
1660 echo "  srcdir_full ......... = $SCI_SRCDIR_FULL"
1661 echo "  builddir ............ = $SCI_BUILDDIR"
1662 if test "$SCI_SRCDIR_FULL" != "$SCI_BUILDDIR"; then
1663 echo "  VPATH build ......... = Activated"
1664 fi
1665
1666 echo "" 
1667 echo "Platform informations:"
1668 echo "  host ........... = $host"
1669 echo "  host_cpu ....... = $host_cpu"
1670 echo "  host_vendor .... = $host_vendor"
1671 echo "  host_os ... .... = $host_os"
1672 echo "  hostname ....... = $ac_hostname"
1673 echo "  CPU 64 bits .... = $IS_64_BITS_CPU"
1674
1675 echo ""
1676 echo "Options used to compile and link:"
1677 echo "  prefix ......... = $prefix"
1678 echo "  localedir ...... = $localedir"
1679 echo "  VERSION ........ = $PACKAGE_VERSION"
1680 echo "  CC ............. = $CC"
1681 echo "  CFLAGS ......... = $CFLAGS"
1682 echo "  PCFLAGS ........ = $PCFLAGS"
1683 echo "  DEFS ........... = $DEFS"
1684 echo "  LD ............. = $LD"
1685 echo "  LDFLAGS ........ = $LDFLAGS"
1686 echo "  LIBS ........... = $LIBS"
1687 echo "  CXX ............ = $CXX"
1688 echo "  CXXFLAGS ....... = $CXXFLAGS"
1689 echo "  F77 ............ = $F77"
1690 echo "  FFLAGS ......... = $FFLAGS"
1691 echo "  F77_LDFLAGS .... = $F77_LDFLAGS"
1692 echo "  TERMCAP_LIB .... = $TERMCAP_LIB"
1693 echo "
1694 "