1dnl Process this file with autoconf to produce a configure script.
2dnl
3########################################################################
4##
5## Copyright (C) 1993-2021 The Octave Project Developers
6##
7## See the file COPYRIGHT.md in the top-level directory of this
8## distribution or <https://octave.org/copyright/>.
9##
10## This file is part of Octave.
11##
12## Octave is free software: you can redistribute it and/or modify it
13## under the terms of the GNU General Public License as published by
14## the Free Software Foundation, either version 3 of the License, or
15## (at your option) any later version.
16##
17## Octave is distributed in the hope that it will be useful, but
18## WITHOUT ANY WARRANTY; without even the implied warranty of
19## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20## GNU General Public License for more details.
21##
22## You should have received a copy of the GNU General Public License
23## along with Octave; see the file COPYING.  If not, see
24## <https://www.gnu.org/licenses/>.
25##
26########################################################################
27
28### Initialize Autoconf
29AC_PREREQ([2.65])
30AC_INIT([GNU Octave], [6.4.0], [https://octave.org/bugs.html], [octave],
31        [https://www.gnu.org/software/octave/])
32
33### Declare version numbers
34
35dnl Note that the version number is duplicated here and in AC_INIT because
36dnl AC_INIT requires it to be static, not computed from shell variables.
37
38## The description of the Octave version number in the etc/HACKING.md
39## explains how to update these numbers for release and development
40## versions.
41
42OCTAVE_MAJOR_VERSION=6
43OCTAVE_MINOR_VERSION=4
44OCTAVE_PATCH_VERSION=0
45
46dnl PACKAGE_VERSION is set by the AC_INIT VERSION argument.
47OCTAVE_VERSION="$PACKAGE_VERSION"
48
49OCTAVE_COPYRIGHT="Copyright (C) 2021 The Octave Project Developers."
50
51OCTAVE_RELEASE_DATE="2021-10-30"
52
53## The "API version" is used as a way of checking that interfaces in the
54## liboctave and libinterp libraries haven't changed in a backwardly
55## incompatible way when loading .oct files.  A better way to do this is with
56## library versioning, but not all systems support it.
57##
58## NOTE: This macro will be removed in a future version of Octave!
59## If you insist on checking for features using a version number, use the
60## OCTAVE_MAJOR_VERSION, OCTAVE_MINOR_VERSION, and OCTAVE_PATCH_VERSION
61## macros instead.
62dnl
63dnl FIXME: Since we also set libtool versions for liboctave and libinterp,
64dnl perhaps we should be computing the "api version" from those versions numbers
65dnl in some way instead of setting it independently here.
66OCTAVE_API_VERSION="api-v56"
67
68AC_SUBST(OCTAVE_MAJOR_VERSION)
69AC_SUBST(OCTAVE_MINOR_VERSION)
70AC_SUBST(OCTAVE_PATCH_VERSION)
71AC_SUBST(OCTAVE_VERSION)
72AC_SUBST(OCTAVE_COPYRIGHT)
73AC_SUBST(OCTAVE_RELEASE_DATE)
74AC_SUBST(OCTAVE_API_VERSION)
75
76dnl FIXME: We should auto-insert the Mercurial changeset ID into the
77dnl        AC_REVISION field whenever configure.ac is modified.
78dnl AC_REVISION($Revision: 1.603 $)
79AC_CONFIG_SRCDIR([libinterp/octave.cc])
80AC_CONFIG_HEADERS([config.h:config.in.h])
81AC_CONFIG_AUX_DIR([build-aux])
82AC_CONFIG_MACRO_DIR([m4])
83
84### Initialize Automake
85AM_INIT_AUTOMAKE([1.14 -Wno-portability -Wno-override tar-ustar subdir-objects dist-lzip dist-xz])
86
87## Add option to enable silent rules and make silent the default behavior.
88AM_SILENT_RULES([yes])
89
90OCTAVE_CANONICAL_HOST
91
92AC_DEFINE(OCTAVE_SOURCE, 1, [Define to 1 if this is Octave.])
93
94AC_USE_SYSTEM_EXTENSIONS
95
96### Make configure args available in variable form for other uses.
97
98config_opts=$ac_configure_args
99AC_SUBST(config_opts)
100
101### Set default file locations.
102
103## Where to install libraries like liboctave.a, liboctinterp.a, and other
104## architecture-dependent binaries.
105OCTAVE_SET_DEFAULT([octlibdir], '${libdir}/octave/${version}')
106
107## Where to put executables to be run by Octave, rather than the user.
108## This path usually includes the Octave version and configuration name, so
109## that configurations for multiple versions of Octave may be installed at once.
110OCTAVE_SET_DEFAULT([archlibdir],
111  '${libexecdir}/octave/${version}/exec/${canonical_host_type}')
112
113## Where to put executables to be run by Octave, rather than the user, that
114## are specific to this site.
115OCTAVE_SET_DEFAULT([localarchlibdir],
116  '${libexecdir}/octave/site/exec/${canonical_host_type}')
117
118OCTAVE_SET_DEFAULT([localapiarchlibdir],
119  '${libexecdir}/octave/${api_version}/site/exec/${canonical_host_type}')
120
121OCTAVE_SET_DEFAULT([localverarchlibdir],
122  '${libexecdir}/octave/${version}/site/exec/${canonical_host_type}')
123
124## Where to put object files that will by dynamically loaded.
125## This path includes the Octave version and configuration name, so that
126## configurations for multiple versions of Octave may be installed at once.
127OCTAVE_SET_DEFAULT([octfiledir],
128  '${libdir}/octave/${version}/oct/${canonical_host_type}')
129
130## Directories that Octave should search for object files that will be
131## dynamically loaded and that are specific to this site (i.e. customizations),
132## before consulting ${octfiledir}.  This should be a colon-separated list of
133## directories.
134OCTAVE_SET_DEFAULT([localoctfiledir],
135  '${libdir}/octave/site/oct/${canonical_host_type}')
136
137OCTAVE_SET_DEFAULT([localapioctfiledir],
138  '${libdir}/octave/site/oct/${api_version}/${canonical_host_type}')
139
140OCTAVE_SET_DEFAULT([localveroctfiledir],
141  '${libdir}/octave/${version}/site/oct/${canonical_host_type}')
142
143## Where to install Octave's include files.
144OCTAVE_SET_DEFAULT([octincludedir], '${includedir}/octave-${version}/octave')
145
146## Where to install the function files distributed with Octave.
147## This includes the Octave version, so that the function files for different
148## versions of Octave will be installed in separate directories.
149OCTAVE_SET_DEFAULT([fcnfiledir], '${datadir}/octave/${version}/m')
150
151## Directories that Octave should search for function files specific to this
152## site (i.e. customizations), before consulting ${fcnfiledir}.
153## This should be a colon-separated list of directories.
154OCTAVE_SET_DEFAULT([localfcnfiledir], '${datadir}/octave/site/m')
155
156OCTAVE_SET_DEFAULT([localapifcnfiledir],
157  '${datadir}/octave/site/${api_version}/m')
158
159OCTAVE_SET_DEFAULT([localverfcnfiledir], '${datadir}/octave/${version}/site/m')
160
161## Where to install extra files like NEWS and doc-cache.
162OCTAVE_SET_DEFAULT([octetcdir], '${datadir}/octave/${version}/etc')
163
164## Where to install the language files for the GUI.
165OCTAVE_SET_DEFAULT([octlocaledir], '${datadir}/octave/${version}/locale')
166
167## The full path to the default doc-cache file.
168OCTAVE_SET_DEFAULT([doc_cache_file], '${octetcdir}/doc-cache')
169
170## Where to install test files.
171OCTAVE_SET_DEFAULT([octtestsdir], '${octetcdir}/tests')
172
173## The full path to the default texi macros file.
174OCTAVE_SET_DEFAULT([texi_macros_file], '${octetcdir}/macros.texi')
175
176## Where Octave will search to find image files.
177OCTAVE_SET_DEFAULT([imagedir], '${datadir}/octave/${version}/imagelib')
178
179## Where Octave will search for example data files shipped with distribution.
180OCTAVE_SET_DEFAULT([octdatadir], '${datadir}/octave/${version}/data')
181
182## Where Octave will search for Qt help files shipped with distribution.
183OCTAVE_SET_DEFAULT([octdocdir], '${datadir}/octave/${version}/doc')
184
185## Where Octave will search for fallback font files shipped with distribution.
186OCTAVE_SET_DEFAULT([octfontsdir], '${datadir}/octave/${version}/fonts')
187
188## Where Octave will look for startup files.
189OCTAVE_SET_DEFAULT([startupfiledir], '${fcnfiledir}/startup')
190OCTAVE_SET_DEFAULT([localstartupfiledir], '${localfcnfiledir}/startup')
191
192## Where Octave will look for man and info files.
193OCTAVE_SET_DEFAULT([man1dir], '${mandir}/man1')
194OCTAVE_SET_DEFAULT([man1ext], '.1')
195OCTAVE_SET_DEFAULT([infofile], '${infodir}/octave.info')
196
197### Check for programs used in building, installing, and running Octave.
198
199## Programs used in configuring Octave.
200dnl Find pkg-config executable (sets $PKG_CONFIG)
201PKG_PROG_PKG_CONFIG
202## And where we will install our own .pc files.
203PKG_INSTALLDIR
204AC_SUBST([liboctave_pkgconfigdir], [$pkgconfigdir])
205AC_SUBST([libinterp_pkgconfigdir], [$pkgconfigdir])
206
207## Programs used in Makefiles.
208AC_PROG_AWK
209AC_PROG_GREP
210OCTAVE_PROG_FIND
211OCTAVE_PROG_SED
212OCTAVE_PROG_PERL
213
214## Programs used to build parts of Octave.
215OCTAVE_PROG_GPERF
216
217OCTAVE_PROG_FLEX
218AC_SUBST([LEX_OUTPUT_ROOT], [lex.octave_])
219
220OCTAVE_PROG_BISON
221
222OCTAVE_PROG_MAKEINFO
223OCTAVE_PROG_TEXI2DVI
224OCTAVE_PROG_TEXI2PDF
225
226OCTAVE_PROG_TAR_REPRODUCIBLE
227
228## Programs used when installing Octave.
229AC_PROG_LN_S
230AC_PROG_MKDIR_P
231
232AC_PROG_INSTALL
233INSTALL_SCRIPT="${INSTALL}"
234AC_SUBST(INSTALL_SCRIPT)
235
236## Programs used when running Octave.
237OCTAVE_PROG_GHOSTSCRIPT
238OCTAVE_PROG_GNUPLOT
239OCTAVE_PROG_PAGER
240OCTAVE_PROG_PYTHON
241
242## Programs used to generate icons file formats.
243OCTAVE_PROG_ICOTOOL
244OCTAVE_PROG_RSVG_CONVERT
245AM_CONDITIONAL([AMCOND_HAVE_ICON_TOOLS],
246  [test -n "$ICOTOOL" && test -n "$RSVG_CONVERT"])
247
248### Path separator.
249
250sepchar=':'
251AC_ARG_WITH([sepchar],
252  [AS_HELP_STRING([--with-sepchar=<char>],
253    [use <char> as the path separation character])])
254case $with_sepchar in
255  yes | "")
256    case $host_os in
257      mingw* | msdosmsvc)
258        sepchar=';' ;;
259    esac
260  ;;
261  no)
262    AC_MSG_ERROR([You are required to define a path separation character])
263    ;;
264  *)
265    sepchar=$with_sepchar
266  ;;
267esac
268AC_SUBST(sepchar)
269AC_DEFINE_UNQUOTED(SEPCHAR, ['$sepchar'],
270  [Define this to be the path separator for your system, as a character constant.])
271AC_DEFINE_UNQUOTED(SEPCHAR_STR, ["$sepchar"],
272  [Define this to be the path separator for your system, as a string.])
273
274### Define the path to the shell on the host system.
275### Most systems will ensure /bin/sh is the default shell so this can be safely
276### ignored by almost everyone.  However, when building for Android, for
277### example, this will need to be set.
278SHELL_PATH=/bin/sh
279AC_ARG_WITH([shell],
280  [AS_HELP_STRING([--with-shell=SHELL],
281    [use SHELL as the shell interpreter (default: /bin/sh)])])
282case $with_shell in
283  no)
284    AC_MSG_ERROR([A shell interpreter is required])
285  ;;
286  yes | "")
287  ;;
288  *)
289    SHELL_PATH=$with_shell
290  ;;
291esac
292AC_DEFINE_UNQUOTED([SHELL_PATH], ["$SHELL_PATH"],
293  [Define this to be the path to the shell command interpreter.])
294
295### Use the system-wide installation of GNU FreeFont if the user requests it.
296### By default, Octave includes its own copy of the FreeSans font, which it
297### installs in its own directory for use as a fallback default font.  If this
298### configuration option is used, then do not install our own copy of the fonts
299### and assume they can be found in the provided system directory.
300SYSTEM_FREEFONT_DIR=
301AC_ARG_WITH([system-freefont],
302  [AS_HELP_STRING([--with-system-freefont=DIR],
303    [use FreeSans fonts in DIR (default: install and use internal copy)])])
304case $with_system_freefont in
305  no | "")
306    SYSTEM_FREEFONT_DIR=
307    ;;
308  yes)
309    AC_MSG_ERROR([directory argument required for --with-system-freefont])
310    ;;
311  *)
312    SYSTEM_FREEFONT_DIR=$with_system_freefont
313    ;;
314esac
315if test -n "$SYSTEM_FREEFONT_DIR"; then
316  AC_MSG_NOTICE([configuring Octave to use system fonts in $SYSTEM_FREEFONT_DIR])
317  AC_DEFINE_UNQUOTED([SYSTEM_FREEFONT_DIR], ["$SYSTEM_FREEFONT_DIR"],
318    [Define this to be the system directory containing the GNU FreeFont fonts.])
319fi
320AM_CONDITIONAL([AMCOND_INSTALL_INTERNAL_FONT_FILES],
321  [test -z "$SYSTEM_FREEFONT_DIR"])
322
323### Determine which C++ compiler to use (we expect to find g++).
324
325AC_PROG_CXX
326AC_PROG_CXXCPP
327
328## Ensure that the C++ compiler fully supports C++11.
329dnl Test must occur after calling AC_PROG_CXX, which tests for language
330dnl features and sets the shell variable ac_cv_prog_cxx_cxx11 appropriately.
331
332if test x"$ac_cv_prog_cxx_cxx11" = xno; then
333  AC_MSG_ERROR([a compiler that fully supports C++11 is required to build Octave])
334fi
335
336### Determine which C compiler to use (we expect to find gcc).
337
338AC_PROG_CC
339AC_PROG_CPP
340AC_PROG_GCC_TRADITIONAL
341
342## Save and restore CFLAGS and CXXFLAGS globally.
343dnl These variables are for users, so we shouldn't be touching them.
344dnl Instead, we should set the corresponding AM_ flags (currently by way of the
345dnl XTRA_ variables).  However, for the duration of the configure script, we
346dnl may set CFLAGS and CXXFLAGS so that subsequent tests succeed.  Temporary
347dnl settings like this are currently done for pthreads and openmp, for example.
348original_octave_configure_CFLAGS="$CFLAGS"
349original_octave_configure_CXXFLAGS="$CXXFLAGS"
350
351## Check for MSVC
352have_msvc=no
353case $host_os in
354  msdosmsvc)
355    have_msvc=yes
356  ;;
357  mingw*)
358    AC_MSG_CHECKING([for MSVC compiler])
359    AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
360        #if ! defined (_MSC_VER)
361        #error "Not MSVC compiler"
362        #endif
363        ]])],
364      have_msvc=yes, have_msvc=no)
365    AC_MSG_RESULT([$have_msvc])
366  ;;
367esac
368
369### gnulib initialization: part 1
370dnl Must take place immediately after a compiler is determined
371
372gl_EARLY
373
374### Check version number when using g++.
375
376GXX_VERSION=
377if test "$GXX" = yes; then
378  AC_MSG_CHECKING([C++ compiler version number])
379  gxx_version=`$CXX -v 2>&1 | $GREP "^.*g.. version" | \
380    $SED -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'`
381
382  AX_COMPARE_VERSION([$gxx_version], [lt], [4.1],
383    [warn_gxx_version="g++ version $gxx_version is likely to cause problems"
384     OCTAVE_CONFIGURE_WARNING([warn_gxx_version])])
385
386  GXX_VERSION=$gxx_version
387  AC_MSG_RESULT([$GXX_VERSION])
388fi
389AC_SUBST(GXX_VERSION)
390
391## Workaround for broken STL algorithm library.
392OCTAVE_CHECK_BROKEN_STL_ALGO_H
393AM_CONDITIONAL([AMCOND_HAVE_BROKEN_STL_ALGO_H],
394  [test $octave_cv_broken_stl_algo_h = yes])
395
396if test $octave_cv_broken_stl_algo_h = yes; then
397  warn_stl_algo_h="Found nth_element broken in g++ $GXX_VERSION.  Attempting to repair by using local patched version of bits/stl_algo.h."
398  OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
399fi
400
401### Check version number when using gcc.
402dnl It might be different from the g++ version number.
403
404GCC_VERSION=
405if test "$GCC" = yes; then
406  AC_MSG_CHECKING([C compiler version number])
407  gcc_version=`$CC -v 2>&1 | $GREP "^.*gcc version" | \
408    $SED -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'`
409
410  AX_COMPARE_VERSION([$gcc_version], [lt], [3],
411    [warn_gcc_version="gcc version $gcc_version is likely to cause problems"
412     OCTAVE_CONFIGURE_WARNING([warn_gcc_version])])
413
414  GCC_VERSION=$gcc_version
415  AC_MSG_RESULT([$GCC_VERSION])
416fi
417AC_SUBST(GCC_VERSION)
418
419## It seems that there are some broken inline assembly functions in GNU libc.
420## Since it is uncertain how to test whether Octave is linked against GNU libc,
421## just disable them for all platforms.
422
423AC_MSG_NOTICE([defining __NO_MATH_INLINES avoids buggy GNU libc exp function])
424AC_DEFINE(__NO_MATH_INLINES, 1,
425  [Define to 1 if your version of GNU libc has buggy inline assembly code for math functions like exp.])
426
427### Determine the compiler flag necessary to create dependencies.
428
429## Assume GCC.
430INCLUDE_DEPS=yes
431DEPEND_FLAGS="-M"
432DEPEND_EXTRA_SED_PATTERN=""
433if test "$GCC" != yes; then
434  case $canonical_host_type in
435    sparc-sun-solaris2* | i386-pc-solaris2*)
436      DEPEND_FLAGS="-xM1"
437      DEPEND_EXTRA_SED_PATTERN="-e '/\/opt\/SUNWspro/d'"
438    ;;
439    *-*-msdosmsvc)
440    ;;
441    *-*-mingw*)
442      if test $have_msvc = no; then
443        INCLUDE_DEPS=no
444      fi
445    ;;
446    *)
447      INCLUDE_DEPS=no
448    ;;
449  esac
450fi
451AC_SUBST(INCLUDE_DEPS)
452AC_SUBST(DEPEND_FLAGS)
453AC_SUBST(DEPEND_EXTRA_SED_PATTERN)
454
455### Check for math library.
456dnl If found, this will add -lm to LIBS.
457
458dnl Keep this check before the check for the Fortran compiler,
459dnl in case -lm is needed to compile Fortran programs.
460AC_CHECK_LIB(m, sin)
461
462### Determine the Fortran compiler and how to invoke it
463
464## Prefer gfortran, but the user's F77 environment variable will override.
465AC_PROG_F77([gfortran])
466if test -z "$F77"; then
467  ## No gfortran found, search for any other installed compiler.
468  AC_PROG_F77
469fi
470if test "$F77" = g77; then
471  AC_MSG_ERROR([g77 is not a supported Fortran compiler.  Select another compiler by setting the environment variable F77 and re-running configure.])
472fi
473
474AC_MSG_CHECKING([whether a usable Fortran compiler was found])
475if test -n "$F77"; then
476  AC_MSG_RESULT(yes)
477else
478  AC_MSG_RESULT(no)
479  AC_MSG_ERROR([a Fortran compiler is required to build Octave])
480fi
481
482AC_F77_LIBRARY_LDFLAGS
483AC_F77_DUMMY_MAIN
484AC_F77_WRAPPERS
485
486### Must appear after checks for Fortran compiler.
487OCTAVE_CHECK_FORTRAN_SYMBOL_AND_CALLING_CONVENTIONS
488
489### Must appear after checks for compilers.
490OCTAVE_DEFINE_MKOCTFILE_DYNAMIC_LINK_OPTIONS
491
492### Use a 64-bit integer type for array dimensions and indexing, if possible.
493
494AC_CHECK_SIZEOF([void *])
495if test $ac_cv_sizeof_void_p -ge 8; then
496  ENABLE_64=yes
497else
498  ENABLE_64=no
499fi
500
501AC_ARG_ENABLE(64,
502  [AS_HELP_STRING([--disable-64],
503    [don't use 64-bit integers for array dimensions and indexing])],
504  [case $enableval in
505     yes) ENABLE_64=yes ;;
506     no) ENABLE_64=no ;;
507     *) AC_MSG_ERROR([bad value $enableval for --enable-64]) ;;
508   esac])
509
510if test $ENABLE_64 = yes; then
511  if test $ac_cv_sizeof_void_p -ge 8; then
512    OCTAVE_IDX_TYPE=int64_t
513  else
514    warn_64_bit="--enable-64 option given but pointers are less than 64-bits wide; disabling 64-bit indexing"
515    OCTAVE_CONFIGURE_WARNING([warn_64_bit])
516    OCTAVE_IDX_TYPE=int32_t
517    ENABLE_64=no
518  fi
519else
520  OCTAVE_IDX_TYPE=int32_t
521fi
522
523AC_SUBST(ENABLE_64)
524if test $ENABLE_64 = yes; then
525  octave_sizeof_octave_idx_type=8
526  AC_DEFINE(OCTAVE_ENABLE_64, 1,
527    [Define to 1 to use 64-bit integers for array dimensions and indexing.])
528else
529  octave_sizeof_octave_idx_type=4
530fi
531
532AC_DEFINE_UNQUOTED(OCTAVE_SIZEOF_IDX_TYPE, [$octave_sizeof_octave_idx_type],
533  [Define to the size of the octave_idx_type (8 or 4).])
534
535AC_SUBST(OCTAVE_IDX_TYPE)
536AC_DEFINE_UNQUOTED(OCTAVE_IDX_TYPE, [$OCTAVE_IDX_TYPE],
537  [Define to the type of octave_idx_type (64 or 32 bit signed integer).])
538
539### Enable bounds checking on element references within Octave's array and
540### matrix classes.
541dnl This slows down some operations a bit, so it is turned off by default.
542
543ENABLE_BOUNDS_CHECK=no
544AC_ARG_ENABLE([bounds-check],
545  [AS_HELP_STRING([--enable-bounds-check],
546    [OBSOLETE: use --enable-address-sanitizer-flags instead])],
547  [if test "$enableval" = yes; then ENABLE_BOUNDS_CHECK=yes; fi], [])
548if test $ENABLE_BOUNDS_CHECK = yes; then
549  warn_bounds_check="--enable-bounds-check is obsolete; use --enable-address-sanitizer-flags instead"
550  OCTAVE_CONFIGURE_WARNING([warn_bounds_check])
551fi
552
553### Check for pthread library
554
555AX_PTHREAD
556dnl Include pthread libs and flags early in case other config tests need them.
557dnl They seem to be required for the OpenGL tests on Debian systems.
558LIBS="$PTHREAD_LIBS $LIBS"
559XTRA_CFLAGS="$XTRA_CFLAGS $PTHREAD_CFLAGS"
560XTRA_CXXFLAGS="$XTRA_CXXFLAGS $PTHREAD_CFLAGS"
561dnl Set these for any other tests that may require them.
562dnl They will be reset before output files are generated.
563CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
564CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
565
566dnl Check if glibc uses wrong stack size
567OCTAVE_CHECK_BROKEN_PTHREAD_STACKSIZE
568AM_CONDITIONAL([OCTAVE_CHECK_BROKEN_PTHREAD_STACKSIZE],
569  [test $octave_cv_broken_pthread_stacksize = yes])
570
571
572### Test whether the compiler supports OpenMP.
573dnl This is enabled by default to allow the option of using OpenMP in
574dnl loadable modules.
575
576ENABLE_OPENMP=no
577check_for_openmp=yes
578AC_ARG_ENABLE([openmp],
579  [AS_HELP_STRING([--disable-openmp],
580    [disable OpenMP SMP multi-threading])],
581  [if test "$enableval" = no; then check_for_openmp=no; fi], [])
582if test $check_for_openmp = yes; then
583  AC_LANG_PUSH(C)
584  AX_OPENMP([XTRA_CFLAGS="$XTRA_CFLAGS $OPENMP_CFLAGS"; ENABLE_OPENMP=yes], [])
585  AC_LANG_POP(C)
586  AC_LANG_PUSH(C++)
587  AX_OPENMP([XTRA_CXXFLAGS="$XTRA_CXXFLAGS $OPENMP_CXXFLAGS"; ENABLE_OPENMP=yes], [])
588  AC_LANG_POP(C++)
589fi
590
591dnl Set these for any other tests that may require them.
592dnl They will be reset before output files are generated.
593CFLAGS="$CFLAGS $OPENMP_CFLAGS"
594CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
595
596dnl Define here since it is skipped if the first argument to AX_OPENMP
597dnl is not empty.
598if test $ENABLE_OPENMP = yes; then
599  AC_CHECK_HEADERS([omp.h])
600  AC_CHECK_FUNCS([omp_get_num_threads])
601  AC_DEFINE(OCTAVE_ENABLE_OPENMP, 1, [Define to 1 if OpenMP is enabled])
602fi
603
604### Start determination of shared vs. static libraries
605
606## Use -static if compiling on Alpha OSF/1 1.3 systems.
607case $canonical_host_type in
608  alpha*-dec-osf1.3)
609    LD_STATIC_FLAG=-static
610  ;;
611esac
612if test -n "$LD_STATIC_FLAG"; then
613  AC_MSG_NOTICE([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG])
614fi
615AC_SUBST(LD_STATIC_FLAG)
616
617## Check for programs necessary for shared libraries (ar, libtool)
618OCTAVE_PROG_AR
619
620ifdef([LT_INIT], [], [
621  errprint([error: you must have libtool 2.2.2 or a more recent version
622])
623  m4exit([1])])
624
625LT_PREREQ([2.2.2])
626LT_INIT([disable-static dlopen win32-dll])
627
628if test $enable_shared = yes; then
629  SHARED_LIBS=yes
630else
631  SHARED_LIBS=no
632fi
633AC_SUBST(SHARED_LIBS)
634
635if test $enable_static = yes; then
636  STATIC_LIBS=yes
637else
638  STATIC_LIBS=no
639fi
640AC_SUBST(STATIC_LIBS)
641
642XTRA_EXTERNAL_SH_LDFLAGS=
643if test $have_msvc = yes; then
644  FLIBS="$FLIBS -lkernel32"
645  XTRA_EXTERNAL_SH_LDFLAGS="-Wl,external/external.def"
646fi
647AC_SUBST(XTRA_EXTERNAL_SH_LDFLAGS)
648
649if test $STATIC_LIBS = no && test $SHARED_LIBS = no; then
650  AC_MSG_ERROR([You can't disable building both static AND shared libraries!])
651fi
652
653
654### More configure argument checking related to linking
655
656AC_ARG_ENABLE([no-undefined],
657  [AS_HELP_STRING([--disable-no-undefined],
658    [don't pass -no-undefined to libtool when linking Octave and its shared libraries])],
659  [case $enableval in
660     yes) NO_UNDEFINED_LDFLAG="-no-undefined" ;;
661     no)  NO_UNDEFINED_LDFLAG="" ;;
662     *) AC_MSG_ERROR([bad value $enableval for --disable-no-undefined]) ;;
663   esac],
664  [NO_UNDEFINED_LDFLAG="-no-undefined"])
665AC_SUBST(NO_UNDEFINED_LDFLAG)
666
667AC_ARG_ENABLE([link-all-dependencies],
668  [AS_HELP_STRING([--enable-link-all-dependencies],
669    [link Octave and its shared libraries with all dependencies, not just those immediately referenced (should not be needed on most systems)])],
670  [case $enableval in
671     yes) link_all_deps=yes ;;
672     no)  link_all_deps=no ;;
673     *) AC_MSG_ERROR([bad value $enableval for --enable-link-all-depenencies])
674     ;;
675   esac],
676  [case $host_os in
677    darwin*)
678      link_all_deps=yes
679    ;;
680    *)
681      link_all_deps=no
682    ;;
683  esac])
684AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS], [test $link_all_deps = yes])
685
686### Check for BLAS and LAPACK libraries:
687
688## Need to adjust FFLAGS to include correct integer size.
689save_FFLAGS="$FFLAGS"
690FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
691
692OCTAVE_BLAS_WITH_F77_FUNC([], [],
693  [ax_blas_ok=yes
694  AC_MSG_CHECKING([BLAS can be called from Fortran])
695  AC_MSG_RESULT([yes assumed for cross compilation])])
696AX_LAPACK
697
698## Restore FFLAGS.
699FFLAGS="$save_FFLAGS"
700
701## If necessary, try again with -ff2c in FFLAGS
702if test $ax_blas_ok = no; then
703  save_FFLAGS="$FFLAGS"
704  FFLAGS="-ff2c $FFLAGS $F77_INTEGER_8_FLAG"
705
706  OCTAVE_BLAS_WITH_F77_FUNC
707  AX_LAPACK
708
709  ## Restore FFLAGS, with -ff2c if that was helpful
710  if test $ax_blas_ok = yes; then
711    FFLAGS="-ff2c $save_FFLAGS"
712  else
713    FFLAGS="$save_FFLAGS"
714  fi
715fi
716
717## On OSX, try again with a wrapper library (without -ff2c!)
718if test $ax_blas_ok = no; then
719  case $host_os in
720    darwin*)
721      ## test if wrapper functions help
722      octave_blaswrap_save_CFLAGS="$CFLAGS"
723      CFLAGS="$CFLAGS -DUSE_BLASWRAP"
724      AC_LANG_PUSH(C)
725      AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
726          #include "liboctave/util/blaswrap.c"
727        ]])],
728        [mv conftest.$ac_objext blaswrap.$ac_objext
729         octave_blaswrap_save_BLAS_LIBS="$BLAS_LIBS"
730         BLAS_LIBS="blaswrap.$ac_objext -framework vecLib"
731
732         save_FFLAGS="$FFLAGS"
733         FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
734
735         OCTAVE_BLAS_WITH_F77_FUNC
736         AX_LAPACK
737
738         ## Restore FFLAGS.
739         FFLAGS="$save_FFLAGS"
740
741         dnl remove temp file
742         rm -f blaswrap.$ac_objext],
743        [AC_MSG_FAILURE([cannot compile liboctave/util/blaswrap.c])])
744      AC_LANG_POP(C)
745      CFLAGS="$octave_blaswrap_save_CFLAGS"
746
747      if test $ax_blas_ok = no; then
748        BLAS_LIBS="$octave_blaswrap_save_BLAS_LIBS"
749      else
750        ## wrapper in liboctave/util, remove from BLAS_LIBS
751        BLAS_LIBS=`echo $BLAS_LIBS | $SED -e 's/blaswrap.[[^ ]]* //g'`
752        AC_DEFINE(USE_BLASWRAP, 1,
753          [Define to 1 if BLAS functions need to be wrapped (potentially needed for 64-bit OSX only).])
754      fi
755    ;;
756  esac
757fi
758
759if test $ax_blas_ok = no || test $ax_lapack_ok = no; then
760  AC_MSG_ERROR([BLAS and LAPACK libraries are required])
761fi
762
763case $ax_blas_integer_size in
764  4)
765    HAVE_64_BIT_BLAS=no
766  ;;
767  8)
768    HAVE_64_BIT_BLAS=yes
769  ;;
770  *)
771    AC_MSG_ERROR([unrecognized BLAS library integer size])
772  ;;
773esac
774
775OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER
776if test $octave_cv_sizeof_fortran_integer -ne $ax_blas_integer_size; then
777  if test $ax_blas_integer_size -eq 8; then
778    case $F77 in
779      *gfortran*)
780        case $F77_INTEGER_8_FLAG in
781          *-fdefault-integer-8*)
782          ;;
783          *)
784            case $FFLAGS in
785              *-fdefault-integer-8*)
786                AC_MSG_NOTICE([setting -fdefault-integer-8 in F77_INTEGER_8_FLAG instead of FFLAGS])
787                FFLAGS=`echo $FFLAGS | $SED 's/-fdefault-integer-8//g'`
788                F77_INTEGER_8_FLAG="-fdefault-integer-8"
789              ;;
790              *)
791                AC_MSG_NOTICE([adding -fdefault-integer-8 to F77_INTEGER_8_FLAG])
792                F77_INTEGER_8_FLAG="-fdefault-integer-8"
793                ## Invalidate the cache and try again.
794                $as_unset octave_cv_sizeof_fortran_integer
795              ;;
796            esac
797          ;;
798        esac
799      ;;
800    esac
801    if test -z "$octave_cv_sizeof_fortran_integer"; then
802      OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER
803    fi
804  fi
805  ## We intentionally don't attempt to fix things up if the default
806  ## Fortran integer size is 8 but BLAS appears to use 4-byte integers.
807  if test $octave_cv_sizeof_fortran_integer -ne $ax_blas_integer_size; then
808    AC_MSG_ERROR([your Fortran compiler must have an option for setting the default integer size to be the same size as your BLAS library uses ($ax_blas_integer_size bytes).  See the file INSTALL for more information.])
809  fi
810fi
811AC_SUBST(F77_INTEGER_8_FLAG)
812
813case $octave_cv_sizeof_fortran_integer in
814  8)
815    OCTAVE_F77_INT_TYPE=int64_t
816  ;;
817  4)
818    OCTAVE_F77_INT_TYPE=int32_t
819  ;;
820esac
821AC_SUBST(OCTAVE_F77_INT_TYPE)
822AC_DEFINE_UNQUOTED(OCTAVE_F77_INT_TYPE, [$OCTAVE_F77_INT_TYPE],
823  [Define to the type of octave_f77_int_type (64 or 32 bit signed integer).])
824AC_DEFINE_UNQUOTED(OCTAVE_SIZEOF_F77_INT_TYPE,
825  [$octave_cv_sizeof_fortran_integer],
826  [Define to the size of the octave_f77_int_type (8 or 4).])
827
828OCTAVE_F77_FLAG([-ffloat-store], [
829  AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store])
830  F77_FLOAT_STORE_FLAG=-ffloat-store
831  AC_SUBST(F77_FLOAT_STORE_FLAG)
832])
833
834if test $ac_cv_f77_compiler_gnu = yes; then
835  OCTAVE_F77_FLAG([-std=legacy])
836fi
837
838BUILD_EXTERNAL_LIBXERBLA=
839case $host_os in
840  msdosmsvc | mingw*)
841    BUILD_EXTERNAL_LIBXERBLA=ues
842  ;;
843esac
844
845AM_CONDITIONAL([AMCOND_BUILD_EXTERNAL_LIBXERBLA],
846  [test -n "$BUILD_EXTERNAL_LIBXERBLA"])
847
848### Dynamic linking is now enabled only if we are building shared
849### libs and some API for dynamic linking has been detected.
850
851dnl FIXME: A lot of the following duplicates the functionality of
852dnl code generated by the dlopen option for LT_INIT.
853
854RDYNAMIC_FLAG=
855DL_API_MSG=""
856dlopen_api=no
857loadlibrary_api=no
858
859case $lt_cv_dlopen in
860  dlopen)
861    dlopen_api=yes
862    DL_API_MSG="dlopen"
863    AC_DEFINE(HAVE_DLOPEN_API, 1,
864      [Define to 1 if system has dlopen, dlsym, dlerror, and dlclose for dynamic linking.])
865    OCTAVE_CXX_FLAG([-rdynamic], [RDYNAMIC_FLAG=-rdynamic])
866  ;;
867  LoadLibrary)
868    loadlibrary_api=yes
869    DL_API_MSG="LoadLibrary"
870    AC_DEFINE(HAVE_LOADLIBRARY_API, 1,
871      [Define to 1 if system has LoadLibrary for dynamic linking.])
872  ;;
873  *)
874    AC_MSG_ERROR([Octave requires some way to perform dynamic linking.])
875  ;;
876esac
877
878DL_LIBS="$lt_cv_dlopen_libs"
879
880if test $SHARED_LIBS = yes; then
881  LIBOCTINTERP="-loctinterp"
882  LIBOCTAVE="-loctave"
883else
884  LIBOCTINTERP="${top_builddir}/libinterp/liboctinterp.a"
885  LIBOCTAVE="${top_builddir}/liboctave/liboctave.a"
886fi
887
888AC_SUBST(RDYNAMIC_FLAG)
889AC_SUBST(LIBOCTINTERP)
890AC_SUBST(LIBOCTAVE)
891
892if test "$cross_compiling" = yes && test -n "$ac_tool_prefix"; then
893  CROSS_TOOL_PREFIX="$ac_tool_prefix"
894  MKOCTFILE_AR=`echo "$AR" | $SED "s,$CROSS_TOOL_PREFIX,,"`
895  MKOCTFILE_CC=`echo "$CC" | $SED "s,$CROSS_TOOL_PREFIX,,"`
896  MKOCTFILE_CXX=`echo "$CXX" | $SED "s,$CROSS_TOOL_PREFIX,,"`
897  MKOCTFILE_F77=`echo "$F77" | $SED "s,$CROSS_TOOL_PREFIX,,"`
898  MKOCTFILE_RANLIB=`echo "$RANLIB" | $SED "s,$CROSS_TOOL_PREFIX,,"`
899else
900  MKOCTFILE_AR="$AR"
901  MKOCTFILE_CC="$CC"
902  MKOCTFILE_CXX="$CXX"
903  MKOCTFILE_F77="$F77"
904  MKOCTFILE_RANLIB="$RANLIB"
905fi
906AC_MSG_NOTICE([defining CROSS_TOOL_PREFIX to be $CROSS_TOOL_PREFIX])
907AC_MSG_NOTICE([defining MKOCTFILE_AR to be $MKOCTFILE_AR])
908AC_MSG_NOTICE([defining MKOCTFILE_CC to be $MKOCTFILE_CC])
909AC_MSG_NOTICE([defining MKOCTFILE_CXX to be $MKOCTFILE_CXX])
910AC_MSG_NOTICE([defining MKOCTFILE_F77 to be $MKOCTFILE_F77])
911AC_MSG_NOTICE([defining MKOCTFILE_RANLIB to be $MKOCTFILE_RANLIB])
912AC_SUBST(CROSS_TOOL_PREFIX)
913AC_SUBST(MKOCTFILE_AR)
914AC_SUBST(MKOCTFILE_CC)
915AC_SUBST(MKOCTFILE_CXX)
916AC_SUBST(MKOCTFILE_F77)
917AC_SUBST(MKOCTFILE_RANLIB)
918
919### Enable float truncation to work around issues with x87 co-processors
920
921dnl When compiling math for x87, problems may arise in some code comparing
922dnl floating-point intermediate results.  The root cause is the extra precision
923dnl (~80 bits) of x87 co-processor registers versus the IEEE standard 64 bits.
924dnl Generally, storing the result in a local volatile variable forces a
925dnl truncation back to 64 bits, but it also degrades performance.
926dnl However, this performance degradation is very minimal, if indeed measurable.
927dnl Therefore, it has been enabled for all platforms and compilers.
928dnl Reported bugs indicate that --enable-float-truncate is required for MinGW
929dnl and Cygwin platforms and for GCC compilers >= 5.0.  It should not be
930dnl necessary for non-x87 targets or when using modern SSE math.
931ENABLE_FLOAT_TRUNCATE=yes
932AC_ARG_ENABLE([float-truncate],
933  [AS_HELP_STRING([--disable-float-truncate],
934    [truncate intermediate FP results])],
935  [if test "$enableval" = no; then ENABLE_FLOAT_TRUNCATE=no; fi], [])
936if test $ENABLE_FLOAT_TRUNCATE = yes; then
937  AC_DEFINE(OCTAVE_ENABLE_FLOAT_TRUNCATE, 1,
938    [Define to 1 to truncate intermediate FP results.])
939fi
940
941### Determine extra CFLAGS, CXXFLAGS that may be necessary for Octave.
942
943## On Intel systems with gcc, we need to compile with -mieee-fp to get full
944## support for IEEE floating point.
945##
946## On Alpha/OSF systems, we require -mieee or -ieee for full support.
947
948ieee_fp_flag=
949case $canonical_host_type in
950  i[[3456789]]86-*-*)
951    if test "$GCC" = yes; then
952      OCTAVE_CC_FLAG([-mieee-fp], [
953        ieee_fp_flag=-mieee-fp
954        XTRA_CFLAGS="$XTRA_CFLAGS -mieee-fp"
955        AC_MSG_NOTICE([adding -mieee-fp to XTRA_CFLAGS])])
956    fi
957    if test "$GXX" = yes; then
958      OCTAVE_CXX_FLAG([-mieee-fp], [
959        ieee_fp_flag=-mieee-fp
960        XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee-fp"
961        AC_MSG_NOTICE([adding -mieee-fp to XTRA_CXXFLAGS])])
962    fi
963  ;;
964  alpha*-*-*)
965    if test "$GCC" = yes; then
966      OCTAVE_CC_FLAG([-mieee], [
967        ieee_fp_flag=-mieee
968        XTRA_CFLAGS="$XTRA_CFLAGS -mieee"
969        AC_MSG_NOTICE([adding -mieee to XTRA_CFLAGS])])
970    else
971      OCTAVE_CC_FLAG([-ieee], [
972        ieee_fp_flag=-ieee
973        XTRA_CFLAGS="$XTRA_CFLAGS -ieee"
974        AC_MSG_NOTICE([adding -ieee to XTRA_CFLAGS])])
975    fi
976    if test "$GXX" = yes; then
977      OCTAVE_CXX_FLAG([-mieee], [
978        ieee_fp_flag=-mieee
979        XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee"
980        AC_MSG_NOTICE([adding -mieee to XTRA_CXXFLAGS])])
981    else
982      OCTAVE_CXX_FLAG([-ieee], [
983        ieee_fp_flag=-ieee
984        XTRA_CXXFLAGS="$XTRA_CXXFLAGS -ieee"
985        AC_MSG_NOTICE([adding -ieee to XTRA_CXXFLAGS])])
986    fi
987  ;;
988  *ibm-aix4*)
989    OCTAVE_CC_FLAG([-mminimal-toc], [
990      XTRA_CFLAGS="$XTRA_CFLAGS -mminimal-toc"])
991
992    OCTAVE_CXX_FLAG([-mminimal-toc], [
993      XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mminimal-toc"])
994  ;;
995esac
996
997AC_SUBST(XTRA_CFLAGS)
998AC_SUBST(XTRA_CXXFLAGS)
999
1000### Defaults for cross compiling.
1001dnl BUILD_CC and BUILD_CXX are the compilers that we use for building tools
1002dnl on the build system.  For now, we assume that the only cross compiling we
1003dnl can do is with gcc on a Unixy system, but the dedicated hacker can
1004dnl override these.
1005
1006if test "$cross_compiling" = yes; then
1007  BUILD_CC="gcc"
1008  BUILD_CFLAGS="-O2 -g"
1009  BUILD_CXX="g++"
1010  BUILD_CXXFLAGS="-O2 -g -std=c++11"
1011  BUILD_LDFLAGS=""
1012  BUILD_EXEEXT=""
1013else
1014  BUILD_CC="${CC}"
1015  BUILD_CFLAGS="${CFLAGS}"
1016  BUILD_CXX="${CXX}"
1017  BUILD_CXXFLAGS="${CXXFLAGS}"
1018  BUILD_LDFLAGS="${LDFLAGS}"
1019  BUILD_EXEEXT="${EXEEXT}"
1020fi
1021
1022AC_ARG_VAR([BUILD_CC],
1023  [build system C compiler (used if cross compiling)])
1024AC_ARG_VAR([BUILD_CFLAGS],
1025  [build system C compiler flags (used if cross compiling)])
1026AC_ARG_VAR([BUILD_CXX],
1027  [build system C++ compiler (used if cross compiling)])
1028AC_ARG_VAR([BUILD_CXXFLAGS],
1029  [build system C++ compiler flags (used if cross compiling)])
1030AC_ARG_VAR([BUILD_LDFLAGS],
1031  [build system C++ compiler link flags (used if cross compiling)])
1032AC_ARG_VAR([BUILD_EXEEXT],
1033  [build system executable extension (used if cross compiling)])
1034
1035### Determine whether to create cross-mkoctfile and other cross-tools.
1036
1037cross_tools=no
1038AC_ARG_ENABLE([cross-tools],
1039  [AS_HELP_STRING([--enable-cross-tools],
1040    [build cross tools (mkoctfile, octave-config) if cross compiling])],
1041  [if test "$enableval" = yes; then cross_tools=yes; fi])
1042
1043if test "$cross_tools" = yes; then
1044  if test "$cross_compiling" = no; then
1045    AC_MSG_WARN([ignoring --enable-cross-tools when not cross compiling])
1046    cross_tools=no
1047  fi
1048fi
1049AM_CONDITIONAL([AMCOND_CROSS_TOOLS], [test $cross_tools = yes])
1050
1051### Check compiler characteristics.
1052dnl FIXME: How many of these are necessary now that C++11 is required?
1053
1054## Check if C++ compiler can auto allocate variable sized arrays.
1055OCTAVE_CXX_DYNAMIC_AUTO_ARRAYS
1056
1057## Check that C compiler and libraries support IEEE754 data format.
1058OCTAVE_IEEE754_DATA_FORMAT
1059
1060## Are bit_and, bit_or, and bit_xor defined as templated operators?
1061OCTAVE_CXX_BITWISE_OP_TEMPLATES
1062
1063## Can complex class set components independently?
1064OCTAVE_CXX_COMPLEX_SETTERS
1065
1066## Are there functions to access real/imag parts of numbers via references?
1067OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS
1068
1069## Does the C compiler handle alloca and const correctly?
1070AC_FUNC_ALLOCA
1071
1072## Does the C compiler support Automake subdir-objects option?
1073AM_PROG_CC_C_O
1074
1075### gnulib initialization: part 2
1076dnl Must take place after part 1, and after standard compiler options and
1077dnl search paths have been established, and at the same priority level as
1078dnl system library function and header checks, but before checks for all
1079dnl external library dependencies.
1080
1081gl_INIT
1082
1083### Checks for header files.
1084
1085AC_HEADER_SYS_WAIT
1086
1087## C headers
1088
1089dnl Use multiple AC_CHECKs to avoid line continuations '\' in list.
1090AC_CHECK_HEADERS([dlfcn.h floatingpoint.h fpu_control.h grp.h])
1091AC_CHECK_HEADERS([ieeefp.h pthread.h pwd.h sys/ioctl.h])
1092AC_CHECK_HEADERS([stropts.h sys/stropts.h])
1093
1094## Some versions of GCC fail when using -fopenmp and including
1095## stdatomic.h, so we try to work around that.  Use the compile_ifelse
1096## macro because we are trying to test the case of the header file
1097## existing but not being usable.  The default warning from the
1098## check_headers macro is not appropriate here.
1099AC_CACHE_CHECK([whether stdatomic.h can be compiled],
1100  [octave_cv_stdatomic_h_ok],
1101  [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1102    #include <stdatomic.h>
1103    ]])],
1104    octave_cv_stdatomic_h_ok=yes,
1105    octave_cv_stdatomic_h_ok=no)
1106  ])
1107if test $octave_cv_stdatomic_h_ok = yes; then
1108  AC_DEFINE(OCTAVE_STDATOMIC_H_OK, 1,
1109    [Define to 1 if stdatomic.h can be compiled.])
1110fi
1111
1112## Find a termio header to include.
1113
1114AC_CHECK_HEADERS([termios.h], have_termios_h=yes, have_termios_h=no)
1115AC_CHECK_HEADERS([termio.h], have_termio_h=yes, have_termio_h=no)
1116AC_CHECK_HEADERS([sgtty.h], have_sgtty_h=yes, have_sgtty_h=no)
1117AC_CHECK_HEADERS([conio.h], have_conio_h=yes, have_conio_h=no)
1118
1119if test $have_termios_h != yes \
1120    && test $have_termio_h != yes \
1121    && test $have_sgtty_h != yes; then
1122  AC_MSG_WARN([couldn't find one of termios.h, termio.h, or sgtty.h!])
1123fi
1124
1125## For MSVC compilers, avoid #define of min/max from windows.h header.
1126if test $have_msvc = yes; then
1127  AC_DEFINE(NOMINMAX, 1, [Define to 1 to avoid min/max macro definition in Windows headers.])
1128fi
1129
1130### Determine types and size of types.
1131
1132AC_TYPE_INT64_T
1133AC_TYPE_MODE_T
1134AC_TYPE_OFF_T
1135AC_TYPE_PID_T
1136AC_TYPE_SIZE_T
1137AC_TYPE_SSIZE_T
1138AC_TYPE_UID_T
1139AC_TYPE_UINT64_T
1140AC_CHECK_TYPES([dev_t, ino_t])
1141AC_CHECK_TYPES([ptrdiff_t])
1142
1143AC_CHECK_TYPES([long long int])
1144if test $ac_cv_type_long_long_int = yes; then
1145  AC_DEFINE(OCTAVE_HAVE_LONG_LONG_INT, 1,
1146    [Define to 1 if the system has the type 'long long int'.])
1147fi
1148
1149AC_CHECK_TYPES([unsigned long long int])
1150if test $ac_cv_type_unsigned_long_long_int = yes; then
1151  AC_DEFINE(OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT, 1,
1152    [Define to 1 if the system has the type 'unsigned long long int'.])
1153fi
1154
1155## Check for long double type (may be used for 64-bit integer computations).
1156AC_CHECK_SIZEOF([long double])
1157
1158### Check structures and existence of necessary members.
1159
1160AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks,
1161                  struct stat.st_rdev])
1162AC_CHECK_MEMBERS([struct group.gr_passwd])
1163
1164AC_STRUCT_TIMEZONE
1165
1166## Check if C++ compiler allows overload of char, int8_t, and uint8_t.
1167AC_CACHE_CHECK([whether ${CXX-g++} allows overload of char, int8_t, and uint8_t],
1168  [octave_cv_overload_char_int8_t],
1169  [AC_LANG_PUSH(C++)
1170  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1171    #include <stdint.h>
1172    void somefunc(char x) {};
1173    void somefunc(int8_t x) {};
1174    void somefunc(uint8_t x) {};
1175    ]])],
1176    octave_cv_overload_char_int8_t=yes,
1177    octave_cv_overload_char_int8_t=no)
1178  AC_LANG_POP(C++)
1179  ])
1180if test $octave_cv_overload_char_int8_t = yes; then
1181  AC_DEFINE(OCTAVE_HAVE_OVERLOAD_CHAR_INT8_TYPES, 1,
1182    [Define to 1 if C++ allows overload of char, int8_t, and uint8_t types.])
1183fi
1184
1185## Check for MIPS-specific non-standard encoding of NaN value
1186OCTAVE_MIPS_NAN
1187
1188### Checks for functions and variables.
1189
1190dnl The list of functions is short because we use gnulib to guarantee
1191dnl valid implementations for many common problematic functions.
1192
1193dnl These checks define/undefine HAVE_FUNCNAME in config.h.
1194dnl Code tests HAVE_FUNCNAME and either uses function or provides workaround.
1195dnl Use multiple AC_CHECKs to avoid line continuations '\' in list
1196AC_CHECK_FUNCS([ctermid dup2])
1197AC_CHECK_FUNCS([endgrent endpwent execvp fork])
1198AC_CHECK_FUNCS([getegid geteuid getgid getgrent getgrgid getgrnam])
1199AC_CHECK_FUNCS([getpgrp getpid getppid getpwent getpwuid getuid])
1200AC_CHECK_FUNCS([isascii kill])
1201AC_CHECK_FUNCS([lgamma_r lgammaf_r])
1202AC_CHECK_FUNCS([realpath resolvepath])
1203AC_CHECK_FUNCS([select setgrent setpwent setsid siglongjmp strsignal])
1204AC_CHECK_FUNCS([tcgetattr tcsetattr toascii])
1205AC_CHECK_FUNCS([umask waitpid])
1206AC_CHECK_FUNCS([_getch _kbhit])
1207
1208## Check for math defines such as M_LN2 in math.h
1209AC_CACHE_CHECK([for MATH DEFINES in math.h],
1210  [octave_cv_header_math_defines],
1211  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1212    #include <math.h>
1213    ]], [[
1214    double x = M_LN2;]])],
1215    octave_cv_header_math_defines=yes,
1216    octave_cv_header_math_defines=no)
1217  ])
1218
1219if test $octave_cv_header_math_defines = no; then
1220  ## Check again and try defining _USE_MATH_DEFINES
1221  AC_CACHE_CHECK([whether _USE_MATH_DEFINES needs to be defined],
1222    [octave_cv_header__use_math_defines],
1223    [save_CPPFLAGS="$CPPFLAGS"
1224    CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES"
1225    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1226      #include <math.h>
1227      ]], [[
1228      double x = M_LN2;]])],
1229      octave_cv_header__use_math_defines=yes,
1230      octave_cv_header__use_math_defines=no)
1231    CPPFLAGS="$save_CPPFLAGS"
1232    ])
1233  if test $octave_cv_header__use_math_defines = yes; then
1234    octave_cv_header_math_defines=yes
1235    AC_DEFINE(_USE_MATH_DEFINES, 1,
1236      [Define to 1 if _USE_MATH_DEFINES is required to get math constants like M_LN2.])
1237    CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES"
1238  fi
1239fi
1240
1241if test $octave_cv_header_math_defines = yes; then
1242  AC_DEFINE(HAVE_MATH_DEFINES, 1,
1243    [Define to 1 if defines such as M_PI are available in math.h])
1244else
1245  AC_MSG_ERROR([MATH DEFINES in math.h such as M_PI are required to build Octave])
1246fi
1247
1248## Windows-specific tests for extra #defines
1249case $host_os in
1250  msdosmsvc | mingw*)
1251    AC_MSG_CHECKING([for required _WIN32_WINNT])
1252    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1253        #include <windows.h>
1254        #if _WIN32_WINNT < 0x0403
1255        #error "Wrong version"
1256        #endif
1257        ]], [])],
1258      [AC_MSG_RESULT([none])],
1259      [AC_DEFINE(_WIN32_WINNT, 0x0403,
1260        [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.])
1261       AC_MSG_RESULT([0x0403])])
1262  ;;
1263esac
1264
1265## Windows-specific use of functions
1266case $host_os in
1267  msdosmsvc | mingw*)
1268    AC_CHECK_FUNCS([setvbuf], [],
1269                   [AC_MSG_ERROR([Missing function required to build Octave])])
1270
1271    ## We need this for GetDeviceCaps.  Should we actually check for
1272    ## the function and library?
1273    LIBS="-lgdi32 $LIBS"
1274  ;;
1275esac
1276
1277## Windows-specific module used for winqueryreg function
1278case $host_os in
1279  msdosmsvc | mingw*)
1280    AC_CHECK_HEADERS([psapi.h],
1281      [LIBS="-lpsapi $LIBS" CPPFLAGS="-DPSAPI_VERSION=1 $CPPFLAGS"],
1282      [AC_MSG_ERROR([Missing PSAPI required to build for Windows target.])],
1283      [#include <windows.h>])
1284  ;;
1285esac
1286
1287## Windows-specific module used for canonical UNC paths
1288case $host_os in
1289  msdosmsvc | mingw*)
1290    AC_CHECK_HEADERS([shlwapi.h],
1291      [LIBS="-lshlwapi $LIBS"],
1292      [AC_MSG_ERROR([Missing SHLWAPI required to build for Windows target.])],
1293      [#include <windows.h>])
1294  ;;
1295esac
1296
1297## Cygwin kluge for getrusage.
1298AC_CHECK_FUNCS([getrusage])
1299case $host_os in
1300  cygwin*)
1301    AC_DEFINE(RUSAGE_TIMES_ONLY, 1,
1302      [Define to 1 if the struct rusage only has time information.])
1303  ;;
1304esac
1305
1306AC_CHECK_FUNCS([getpwnam], [], [AC_CHECK_LIB([sun], [getpwnam])])
1307
1308AC_FUNC_CLOSEDIR_VOID
1309
1310## Check return type of matherr
1311AC_CACHE_CHECK([for struct exception in math.h],
1312  [octave_cv_func_matherr_type],
1313  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1314      #include <math.h>
1315      ]], [[
1316      struct exception *x;
1317      x->type;
1318      x->name;
1319      ]])],
1320    octave_cv_func_matherr_type=yes,
1321    octave_cv_func_matherr_type=no)
1322  ])
1323if test $octave_cv_func_matherr_type = yes; then
1324  AC_DEFINE(EXCEPTION_IN_MATH, 1,
1325    [Define to 1 if math.h declares struct exception for matherr.])
1326fi
1327
1328## Signal stuff.
1329
1330AC_CHECK_DECLS([sys_siglist], [], [],
1331[[#include <signal.h>
1332/* NetBSD declares sys_siglist in unistd.h.  */
1333#if HAVE_UNISTD_H
1334# include <unistd.h>
1335#endif
1336]])
1337
1338### Check for the Qhull library.
1339
1340OCTAVE_CHECK_LIB(qhull, QHull,
1341  [Qhull library not found.  This will result in loss of functionality for some geometry functions.],
1342  [libqhull/libqhull.h qhull/libqhull.h libqhull.h qhull/qhull.h qhull.h],
1343  [qh_qhull], [], [],
1344  [warn_qhull=
1345  OCTAVE_CHECK_QHULL_VERSION
1346  OCTAVE_CHECK_LIB_QHULL_OK(
1347    [AC_DEFINE(HAVE_QHULL, 1, [Define to 1 if Qhull is available.])],
1348    [warn_qhull="Qhull library found, but does not seem to work properly.  This will result in loss of functionality for some geometry functions.  Please try recompiling the library with -fno-strict-aliasing."])])
1349
1350### Check for PCRE regex library.
1351
1352OCTAVE_CHECK_LIB(pcre, PCRE,
1353  [], [pcre.h pcre/pcre.h], [pcre_compile], [], [],
1354  [OCTAVE_CHECK_LIB_PCRE_OK([],
1355    [AC_MSG_ERROR([PCRE library must be built with UTF support (--enable-utf)])])
1356  ],
1357  [libpcre], [REQUIRED])
1358
1359### Check for readline library.
1360
1361OCTAVE_ENABLE_READLINE
1362
1363## Find a termlib to use.
1364OCTAVE_CHECK_LIB_TERMLIB
1365
1366### Use push parser by default now.
1367
1368ENABLE_COMMAND_LINE_PUSH_PARSER=yes
1369AC_ARG_ENABLE([command-line-push-parser],
1370  [AS_HELP_STRING([--disable-command-line-push-parser],
1371    [don't use Bison's push parser interface in the command line REPL])],
1372  [if test "$enableval" = no; then ENABLE_COMMAND_LINE_PUSH_PARSER=no; fi], [])
1373if test $ENABLE_COMMAND_LINE_PUSH_PARSER = yes; then
1374  AC_DEFINE(OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER, 1,
1375    [Define to 1 to use Bison's push parser interface in the command line REPL.])
1376fi
1377
1378### Check for ZLIB library.
1379
1380OCTAVE_CHECK_LIB(z, ZLIB,
1381  [ZLIB library not found.  Octave will not be able to load or save compressed data files or HDF5 files.],
1382  [zlib.h], [gzclearerr])
1383
1384## Also define HAVE_ZLIB if libz is found.
1385if test -z "$warn_z"; then
1386  AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if ZLIB is available.])
1387fi
1388
1389### Check for BZIP2 library.
1390
1391OCTAVE_CHECK_LIB(bz2, BZIP2,
1392  [BZIP2 library not found.  Octave will not be able to compress or decompress bzip2 files.],
1393  [bzlib.h], [BZ2_bzCompressInit])
1394
1395### Check for the LLVM library (JIT compiler).
1396
1397ENABLE_JIT=no
1398AC_ARG_ENABLE([jit],
1399  [AS_HELP_STRING([--enable-jit],
1400    [(EXPERIMENTAL) enable JIT compiler])],
1401  [if test "$enableval" = yes; then ENABLE_JIT=yes; fi], [])
1402
1403LLVM_CPPFLAGS=
1404LLVM_LDFLAGS=
1405LLVM_LIBS=
1406
1407if test $ENABLE_JIT = yes; then
1408
1409  ## Find llvm-config program from environment variable or by searching
1410  AC_ARG_VAR([LLVM_CONFIG], [path to llvm-config utility])
1411  AC_CHECK_PROG([LLVM_CONFIG], llvm-config, llvm-config, [])
1412
1413  if test -z "$LLVM_CONFIG"; then
1414    warn_llvm="llvm-config utility not found.  JIT compiler is disabled."
1415  else
1416    dnl Preset warning message in case compile fails
1417    warn_llvm="LLVM was not found or is to old.  JIT compiler is disabled."
1418
1419    save_CPPFLAGS="$CPPFLAGS"
1420    save_LDFLAGS="$LDFLAGS"
1421
1422    dnl Use -isystem if available because we don't want to see warnings in LLVM
1423    LLVM_INCLUDE_FLAG=-I
1424    OCTAVE_CC_FLAG([-isystem .], [
1425      LLVM_INCLUDE_FLAG=-isystem
1426      AC_MSG_NOTICE([using -isystem for LLVM headers])])
1427
1428    dnl Use -isystem so we don't get warnings from llvm headers
1429    LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
1430    LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
1431
1432    LDFLAGS="$LDFLAGS $LLVM_LDFLAGS"
1433    LLVM_SO=LLVM-`$LLVM_CONFIG --version`
1434    AC_CHECK_LIB([$LLVM_SO], [LLVMBuildAdd], [LLVM_LIBS="-l$LLVM_SO"],
1435                 [LLVM_LIBS="`$LLVM_CONFIG --libs` `$LLVM_CONFIG --system-libs`"])
1436
1437    dnl Define some extra flags that LLVM requires in order to include headers.
1438    dnl Ideally we should get these from llvm-config, but llvm-config isn't
1439    dnl very helpful.
1440    CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS"
1441    AC_LANG_PUSH(C++)
1442    AC_CHECK_HEADER([llvm/Support/TargetSelect.h], [warn_llvm=""])
1443
1444    have_function_h=no
1445    AC_CHECK_HEADERS([llvm/IR/Function.h llvm/Function.h],
1446                     [have_function_h=yes; break])
1447    if test $have_function_h = no; then
1448      warn_llvm="Missing LLVM file Function.h.  JIT compiler is disabled."
1449    fi
1450
1451    have_irbuilder_h=no
1452    AC_CHECK_HEADERS([llvm/Support/IRBuilder.h llvm/IR/IRBuilder.h \
1453                      llvm/IRBuilder.h], [have_irbuilder_h=yes; break])
1454    if test $have_irbuilder_h = no; then
1455      warn_llvm="Missing LLVM file IRBuilder.h.  JIT compiler is disabled."
1456    fi
1457
1458    have_llvm_data_h=no
1459    AC_CHECK_HEADERS([llvm/Target/TargetData.h llvm/IR/DataLayout.h \
1460                      llvm/DataLayout.h], [have_llvm_data_h=yes; break])
1461    if test $have_llvm_data_h = no; then
1462      warn_llvm="Missing LLVM file TargetData.h.  JIT compiler is disabled."
1463    fi
1464
1465    AC_CHECK_HEADERS([llvm/IR/Verifier.h])
1466    AC_CHECK_HEADERS([llvm/Analysis/BasicAliasAnalysis.h])
1467    AC_CHECK_HEADERS([llvm/Transforms/Scalar/GVN.h])
1468    AC_CHECK_HEADERS([llvm/Bitcode/ReaderWriter.h])
1469
1470    OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API
1471    OCTAVE_LLVM_FUNCTION_ADDFNATTR_API
1472    OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API
1473    OCTAVE_LLVM_RAW_FD_OSTREAM_API
1474    OCTAVE_LLVM_LEGACY_PASSMANAGER_API
1475    OCTAVE_LLVM_IRBUILDER_API
1476    OCTAVE_LLVM_HAS_CREATEALWAYSINLINERPASS
1477    OCTAVE_LLVM_IRBUILDER_CREATECONSTINBOUNDSGEP1_32_API
1478
1479    AC_LANG_POP(C++)
1480    CPPFLAGS="$save_CPPFLAGS"
1481    LDFLAGS="$save_LDFLAGS"
1482  fi
1483
1484  if test -z "$warn_llvm"; then
1485    AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.])
1486  else
1487    ENABLE_JIT=no
1488    LLVM_CPPFLAGS=
1489    LLVM_LDFLAGS=
1490    LLVM_LIBS=
1491    OCTAVE_CONFIGURE_WARNING([warn_llvm])
1492  fi
1493dnl FIXME: Re-instate when JIT is enabled by default
1494dnl else
1495dnl   ## JIT build disabled
1496dnl   warn_llvm="JIT compiler disabled, some performance loss for loops"
1497dnl   OCTAVE_CONFIGURE_WARNING([warn_llvm])
1498fi
1499if test $ENABLE_JIT = yes; then
1500  AC_DEFINE(ENABLE_JIT, 1, [Define to 1 to enable JIT compiler.])
1501fi
1502
1503AC_SUBST(LLVM_CPPFLAGS)
1504AC_SUBST(LLVM_LDFLAGS)
1505AC_SUBST(LLVM_LIBS)
1506AM_CONDITIONAL([AMCOND_HAVE_LLVM], [test -z "$warn_llvm"])
1507
1508### Check for HDF5 library.
1509
1510save_CPPFLAGS="$CPPFLAGS"
1511save_LIBS="$LIBS"
1512CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
1513LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
1514OCTAVE_CHECK_LIB(hdf5, HDF5,
1515  [HDF5 library not found.  Octave will not be able to load or save HDF5 data files.],
1516  [hdf5.h], [H5Gget_num_objs], [], [],
1517  [warn_hdf5=
1518   OCTAVE_CHECK_HDF5_HAS_VER_16_API
1519   AC_DEFINE(HAVE_HDF5, 1,
1520     [Define to 1 if HDF5 is available and newer than version 1.6.])
1521   if test $have_msvc = yes; then
1522     OCTAVE_CHECK_LIB_HDF5_DLL
1523   fi
1524  ])
1525CPPFLAGS="$save_CPPFLAGS"
1526LIBS="$save_LIBS"
1527
1528dnl FIXME: Should we check for this now, or wait until some version of HDF5
1529dnl actually supports this feature?
1530have_hdf5_int2float_conversions=no
1531if test $have_hdf5_int2float_conversions = yes; then
1532  AC_DEFINE(HAVE_HDF5_INT2FLOAT_CONVERSIONS, 1,
1533    [Define to 1 if/when HDF5 supports automatic conversion between integer and floating-point binary data.])
1534fi
1535
1536### Check for FFTW library.
1537### Default to Fortran FFTPACK if it is not available.
1538
1539## Check for FFTW header and library.
1540OCTAVE_CHECK_LIB(fftw3, FFTW3,
1541  [FFTW3 library not found.  The slower FFTPACK library will be used instead.],
1542  [fftw3.h], [fftw_plan_dft_1d])
1543
1544OCTAVE_CHECK_LIB(fftw3f, FFTW3F,
1545  [FFTW3F library not found.  The slower FFTPACK library will be used instead.],
1546  [fftw3.h], [fftwf_plan_dft_1d])
1547
1548## Check command line for the option to disable multi-threaded FFTW.
1549build_fftw_threads=yes
1550AC_ARG_ENABLE([fftw-threads],
1551  [AS_HELP_STRING([--disable-fftw-threads],
1552    [disable Multi-threaded FFTW])],
1553  [if test "$enableval" = no; then
1554     build_fftw_threads=no
1555   fi],
1556  [])
1557
1558dnl Octave is currently unable to use FFTW unless both float and double
1559dnl versions are available.
1560
1561AM_CONDITIONAL([AMCOND_HAVE_FFTW],
1562  [test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"])
1563
1564if test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"; then
1565  AC_DEFINE(HAVE_FFTW, 1, [Define to 1 if both FFTW3 and FFTW3F libraries are available.])
1566else
1567  dnl --without-fftw3 given, or one of the FFTW3 libs not installed.
1568  dnl Don't check for FFTW threads as this is now pointless.
1569  build_fftw_threads=no
1570fi
1571
1572## Check for the multithreaded FFTW library.
1573## Fallback to singlethreaded if not found or disabled.
1574if test $build_fftw_threads = yes; then
1575  OCTAVE_CHECK_FFTW_THREADS(fftw3, fftw_plan_with_nthreads)
1576  OCTAVE_CHECK_FFTW_THREADS(fftw3f, fftwf_plan_with_nthreads)
1577fi
1578
1579## Collections of flags.
1580dnl These are here instead of just in the Makefile.am file because we
1581dnl substitute some of them into other source files like mkoctfile.
1582
1583## Order matters, at least on some systems (Cygwin, for example).
1584
1585FFTW_XCPPFLAGS="$FFTW3_CPPFLAGS $FFTW3F_CPPFLAGS"
1586
1587FFTW_XLDFLAGS="$FFTW3_LDFLAGS $FFTW3F_LDFLAGS"
1588
1589FFTW_XLIBS="$FFTW3_LIBS $FFTW3F_LIBS"
1590
1591AC_SUBST(FFTW_XCPPFLAGS)
1592AC_SUBST(FFTW_XLDFLAGS)
1593AC_SUBST(FFTW_XLIBS)
1594
1595## Subdirectory of liboctave/external to build if FFTW is not found.
1596FFT_DIR="fftpack"
1597AC_SUBST(FFT_DIR)
1598
1599### Check for GLPK library and header.
1600
1601save_CPPFLAGS="$CPPFLAGS"
1602save_LIBS="$LIBS"
1603CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
1604LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
1605OCTAVE_CHECK_LIB(glpk, GLPK,
1606  [GLPK library not found.  The glpk function for solving linear programs will be disabled.],
1607  [glpk/glpk.h glpk.h], [glp_simplex], [], [],
1608  [warn_glpk=
1609   OCTAVE_CHECK_LIB_GLPK_OK(
1610    [AC_DEFINE(HAVE_GLPK, 1, [Define to 1 if GLPK is available.])],
1611    [warn_glpk="GLPK library found, but does not seem to work properly; disabling glpk function"])])
1612LIBS="$save_LIBS"
1613CPPFLAGS="$save_CPPFLAGS"
1614
1615### Checks for cURL header and library.
1616
1617save_CPPFLAGS="$CPPFLAGS"
1618save_LIBS="$LIBS"
1619CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
1620LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
1621OCTAVE_CHECK_LIB(curl, cURL,
1622  [cURL library not found.  The ftp objects, urlread, and urlwrite functions will be disabled.],
1623  [curl/curl.h], [curl_easy_escape])
1624if test -z "$warn_curl"; then
1625  ## Additional check on cURL library that was found
1626  AC_CACHE_CHECK([for CURLOPT_DIRLISTONLY in curl/curl.h],
1627    [octave_cv_curl_has_curlopt_dirlistonly],
1628    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1629      #include <curl/curl.h>
1630      ]], [[
1631      curl_easy_setopt ((CURL*)NULL, CURLOPT_DIRLISTONLY, 0);
1632      ]])],
1633      [octave_cv_curl_has_curlopt_dirlistonly=yes],
1634      [octave_cv_curl_has_curlopt_dirlistonly=no])
1635    ])
1636  if test $octave_cv_curl_has_curlopt_dirlistonly = no; then
1637    AC_DEFINE(CURLOPT_DIRLISTONLY, CURLOPT_FTPLISTONLY,
1638      [Define to the legacy option name if using an older version of cURL.])
1639  fi
1640fi
1641LIBS="$save_LIBS"
1642CPPFLAGS="$save_CPPFLAGS"
1643
1644### Check for sndfile library.
1645
1646OCTAVE_CHECK_LIB(sndfile, sndfile,
1647  [sndfile library not found.  The audioinfo, audioread, and audiowrite functions will be disabled.],
1648  [sndfile.h], [sf_open],
1649  [], [don't use sndfile library, disable audio file I/O],
1650  [warn_sndfile=
1651   OCTAVE_CHECK_LIB_SNDFILE_OK(
1652    [AC_DEFINE(HAVE_SNDFILE, 1, [Define to 1 if sndfile is available.])],
1653    [warn_sndfile="sndfile library found, but does not seem to work properly; disabling audio file I/O functions"])])
1654
1655### Check for PortAudio
1656
1657OCTAVE_CHECK_LIB(portaudio, PortAudio,
1658  [PortAudio library not found.  The audioplayer, audiorecorder, and audiodevinfo functions will be disabled.],
1659  [portaudio.h], [Pa_GetDeviceCount],
1660  [], [don't use PortAudio library, disable audio playback and recording],
1661  [], [portaudio-2.0])
1662
1663### Check for either of Graphics/ImageMagick++ libraries.
1664
1665check_magick=yes
1666use_magick=no
1667AC_ARG_WITH([magick],
1668  [AS_HELP_STRING([--with-magick=LIB],
1669    [select library to use for image I/O (options: GraphicsMagick(default) or ImageMagick)])],
1670  [if test x"$withval" = xno; then
1671     check_magick=no
1672     warn_magick_disabled="--without-magick specified.  The imread, imwrite, and imfinfo functions for reading and writing image files will not be fully functional."
1673     OCTAVE_CONFIGURE_WARNING([warn_magick_disabled])
1674   else
1675     magick="$withval"
1676   fi], [magick="GraphicsMagick"])
1677
1678if test $check_magick = yes; then
1679
1680  MAGICK_CPPFLAGS=
1681  MAGICK_LDFLAGS=
1682  MAGICK_LIBS=
1683
1684  PKG_CHECK_EXISTS([$magick++], [
1685    dnl Make sure we only get -I, -L, and -l flags.
1686    dnl Some Graphics/ImageMagick++ dnl packages add extra flags that are
1687    dnl useful when building Graphics/ImageMagick++ extensions.  These extra
1688    dnl flags break the Octave build.
1689    MAGICK_CPPFLAGS="$($PKG_CONFIG --cflags-only-I $magick++ | $SED -e 's/^ *$//')"
1690    MAGICK_LDFLAGS="$($PKG_CONFIG --libs-only-L $magick++ | $SED -e 's/^ *$//')"
1691    MAGICK_LIBS="$($PKG_CONFIG --libs-only-l $magick++ | $SED -e 's/^ *$//')"
1692
1693    warn_magick="$magick++ library fails tests.  The imread, imwrite, and imfinfo functions for reading and writing image files will not be fully functional."
1694
1695    save_CPPFLAGS="$CPPFLAGS"
1696    save_LIBS="$LIBS"
1697    CPPFLAGS="$MAGICK_CPPFLAGS $CPPFLAGS"
1698    LIBS="$MAGICK_LDFLAGS $MAGICK_LIBS $LIBS"
1699    AC_LANG_PUSH(C++)
1700    AC_CHECK_HEADER([Magick++.h], [
1701      AC_CACHE_CHECK([for Magick::ColorRGB in Magick++.h],
1702        [octave_cv_func_magick_colorrgb],
1703        [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
1704          #include <Magick++.h>
1705          ]], [[
1706          Magick::ColorRGB c;
1707          ]])],
1708          octave_cv_func_magick_colorrgb=yes,
1709          octave_cv_func_magick_colorrgb=no)
1710        ])
1711      if test $octave_cv_func_magick_colorrgb = yes; then
1712        use_magick=yes
1713        warn_magick=
1714      fi
1715    ])
1716    AC_LANG_POP(C++)
1717    CPPFLAGS="$save_CPPFLAGS"
1718    LIBS="$save_LIBS"
1719  ],
1720  [use_magick=no
1721   warn_magick="$magick++ library not found.  The imread, imwrite, and imfinfo functions for reading and writing image files will not be fully functional."])
1722fi
1723
1724if test $use_magick = yes; then
1725  AC_DEFINE(HAVE_MAGICK, 1,
1726    [Define to 1 if Graphics/ImageMagick++ is available.])
1727else
1728  if test -n "$warn_magick"; then
1729    OCTAVE_CONFIGURE_WARNING([warn_magick])
1730  fi
1731  MAGICK_CPPFLAGS=
1732  MAGICK_LDFLAGS=
1733  MAGICK_LIBS=
1734fi
1735AC_SUBST(MAGICK_CPPFLAGS)
1736AC_SUBST(MAGICK_LDFLAGS)
1737AC_SUBST(MAGICK_LIBS)
1738
1739### Check for X11 libraries
1740
1741AC_PATH_X
1742if test "$have_x" = yes; then
1743  AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if X11 is available.])
1744
1745  if test "$x_includes" != "NONE"; then
1746    X11_INCFLAGS="$x_includes"
1747  fi
1748  AC_SUBST(X11_INCFLAGS)
1749
1750  if test -z "$x_libraries"; then
1751    AC_CHECK_LIB([X11], XrmInitialize, [X11_LIBS="-lX11"], [X11_LIBS=])
1752  elif test "$x_libraries" != "NONE"; then
1753    AC_CHECK_LIB([X11], XrmInitialize,
1754      [X11_LIBS="-L$x_libraries -lX11"], [X11_LIBS=], "-L$x_libraries")
1755  fi
1756  AC_SUBST(X11_LIBS)
1757fi
1758
1759### Check for the Carbon framework on macOS systems.
1760
1761OCTAVE_HAVE_FRAMEWORK([Carbon],
1762  [[#include <Carbon/Carbon.h>]], [[CGMainDisplayID ()]],
1763  [have_framework_carbon=yes], [have_framework_carbon=no])
1764if test $have_framework_carbon = yes; then
1765  AC_DEFINE(HAVE_FRAMEWORK_CARBON, 1,
1766    [Define to 1 if framework CARBON is available.])
1767  CARBON_LIBS="-framework Carbon"
1768  AC_MSG_NOTICE([adding -framework Carbon to CARBON_LIBS])
1769  AC_SUBST(CARBON_LIBS)
1770fi
1771
1772## Check for the CGDisplayBitsPerPixel function.
1773if test $have_framework_carbon = yes; then
1774  OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL
1775fi
1776
1777### Check for OpenGL and helper libraries used by OpenGL graphics renderer.
1778
1779check_opengl=yes
1780AC_ARG_WITH([opengl],
1781  [AS_HELP_STRING([--without-opengl],
1782    [don't use OpenGL libraries, disable OpenGL graphics])],
1783  [if test x"$withval" = xno; then
1784     check_opengl=no
1785     warn_opengl_disabled="--without-opengl specified.  OpenGL graphics will be disabled."
1786     OCTAVE_CONFIGURE_WARNING([warn_opengl_disabled])
1787   fi])
1788
1789## Check for OpenGL library
1790if test $check_opengl = yes; then
1791  OCTAVE_CHECK_LIB_OPENGL
1792  if test -z "$OPENGL_LIBS"; then
1793    warn_opengl_libs="OpenGL libs (GL and GLU) not found.  OpenGL graphics will be disabled."
1794    OCTAVE_CONFIGURE_WARNING([warn_opengl_libs])
1795  fi
1796fi
1797
1798## Check for FreeType 2 library
1799
1800check_freetype=yes
1801warn_freetype=
1802AC_ARG_WITH([freetype],
1803  [AS_HELP_STRING([--without-freetype],
1804    [don't use FreeType library, OpenGL graphics will not be fully functional])],
1805  [if test x"$withval" = xno; then
1806     check_freetype=no
1807     warn_freetype="--without-freetype specified.  OpenGL graphics will not be fully functional."
1808   fi])
1809
1810if test $check_freetype = yes; then
1811  PKG_CHECK_MODULES([FT2], [freetype2], [
1812    min_ft2_version=9.03
1813    AC_MSG_CHECKING([for FreeType2 version >= $min_ft2_version])
1814    $PKG_CONFIG freetype2 --atleast-version=$min_ft2_version
1815    ac_status=$?
1816    if test "$ac_status" = 0; then
1817      AC_MSG_RESULT(yes)
1818      AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if Freetype is available.])
1819      save_LIBS="$LIBS"
1820      LIBS="$FT2_LIBS $LIBS"
1821      AC_CHECK_FUNCS([FT_Reference_Face])
1822      LIBS="$save_LIBS"
1823    else
1824      AC_MSG_RESULT(no)
1825      warn_freetype="FreeType library >= 9.03 not found.  OpenGL graphics will not be fully functional."
1826    fi],
1827    [warn_freetype="FreeType library not found.  OpenGL graphics will not be fully functional."])
1828fi
1829
1830if test -n "$warn_freetype"; then
1831  FT2_CFLAGS=
1832  FT2_LIBS=
1833  OCTAVE_CONFIGURE_WARNING([warn_freetype])
1834else
1835  dnl Alias CPPFLAGS to CFLAGS.  This is closer to the true meaning
1836  dnl of `pkg-config --cflags` output.
1837  FT2_CPPFLAGS="$FT2_CFLAGS"
1838  AC_SUBST(FT2_CPPFLAGS)
1839fi
1840
1841## Check for fontconfig library
1842
1843OCTAVE_CHECK_LIB(fontconfig, fontconfig,
1844  [Fontconfig library not found.  OpenGL graphics will not be fully functional.],
1845  [fontconfig.h fontconfig/fontconfig.h], [FcInit],
1846  [], [don't use fontconfig library, OpenGL graphics will not be fully functional])
1847
1848## Check for gl2ps which is required for printing with OpenGL graphics.
1849
1850AC_CHECK_HEADERS([gl2ps.h],
1851  [GL2PS_LIBS="-lgl2ps"],
1852  [warn_gl2ps="gl2ps library not found.  Printing of OpenGL graphics will be disabled."])
1853
1854if test -n "$warn_gl2ps"; then
1855  OCTAVE_CONFIGURE_WARNING([warn_gl2ps])
1856else
1857  save_LIBS="$LIBS"
1858  LIBS="$GL2PS_LIBS $LIBS"
1859  AC_CHECK_FUNCS([gl2psLineJoin])
1860  LIBS="$save_LIBS"
1861fi
1862
1863AC_SUBST(GL2PS_LIBS)
1864
1865### GUI/Qt related tests.
1866
1867QT_VERSIONS="5 4"
1868
1869AC_ARG_WITH([qt],
1870  [AS_HELP_STRING([--with-qt=VER], [use the Qt major version VER])
1871dnl Second help string must not be indented for correct alignment
1872AS_HELP_STRING([--without-qt], [don't use Qt libraries, disable Qt GUI])],
1873  [case $withval in
1874     yes | "")
1875     ;;
1876     no)
1877       QT_VERSIONS=
1878       warn_qt_disabled="--without-qt specified.  The Qt GUI will be disabled."
1879       OCTAVE_CONFIGURE_WARNING([warn_qt_disabled])
1880     ;;
1881     *)
1882       QT_VERSIONS="$withval"
1883     ;;
1884   esac])
1885
1886check_qscintilla=yes
1887AC_ARG_WITH([qscintilla],
1888  [AS_HELP_STRING([--without-qscintilla], [disable QScintilla editor])],
1889  [if test x"$withval" = xno; then
1890     check_qscintilla=no
1891     warn_qscintilla_disabled="--without-qscintilla specified.  The GUI editor will be disabled."
1892     OCTAVE_CONFIGURE_WARNING([warn_qscintilla_disabled])
1893   fi])
1894
1895OCTAVE_CHECK_QT([$QT_VERSIONS])
1896
1897## Default terminal font for the GUI.
1898
1899case $host_os in
1900  mingw* | msdosmsvc)
1901    DEFAULT_TERMINAL_FONT="Lucida Console"
1902  ;;
1903  *)
1904    DEFAULT_TERMINAL_FONT="Courier"
1905  ;;
1906esac
1907DEFAULT_TERMINAL_FONT_SIZE=10
1908AC_SUBST(DEFAULT_TERMINAL_FONT)
1909AC_SUBST(DEFAULT_TERMINAL_FONT_SIZE)
1910
1911### Check for FLTK library
1912
1913check_fltk=yes
1914build_fltk_graphics=no
1915
1916AC_ARG_WITH([fltk],
1917  [AS_HELP_STRING([--without-fltk],
1918    [don't use FLTK libraries, disable OpenGL graphics with FLTK widgets])],
1919  [if test x"$withval" = xno; then
1920     check_fltk=no
1921   fi])
1922
1923FLTK_CPPFLAGS=
1924FLTK_LDFLAGS=
1925FLTK_LIBS=
1926
1927if test $check_fltk = yes; then
1928  AC_ARG_WITH([fltk-prefix],
1929    [AS_HELP_STRING([--with-fltk-prefix=PFX],
1930      [prefix where FLTK is installed (optional)])],
1931    [fltk_prefix="$withval"],
1932    [fltk_prefix=""])
1933
1934  AC_ARG_WITH([fltk-exec-prefix],
1935    [AS_HELP_STRING([--with-fltk-exec-prefix=PFX],
1936      [exec prefix where FLTK is installed (optional)])],
1937    [fltk_exec_prefix="$withval"],
1938    [fltk_exec_prefix=""])
1939
1940  if test "x$fltk_exec_prefix" != x; then
1941    fltk_args="$fltk_args --exec-prefix=$fltk_exec_prefix"
1942    if test "x${FLTK_CONFIG+set}" != xset ; then
1943      FLTK_CONFIG="$fltk_exec_prefix/bin/fltk-config"
1944    fi
1945  fi
1946
1947  if test "x$fltk_prefix" != x; then
1948    fltk_args="$fltk_args --prefix=$fltk_prefix"
1949    if test x${FLTK_CONFIG+set} != xset ; then
1950      FLTK_CONFIG="$fltk_prefix/bin/fltk-config"
1951    fi
1952  fi
1953
1954  AC_PATH_PROG([FLTK_CONFIG], [fltk-config], [no])
1955
1956  warn_fltk_config=
1957  warn_fltk_opengl=
1958
1959  if test "$FLTK_CONFIG" = no; then
1960    warn_fltk_config="FLTK config script not found.  FLTK toolkit will be disabled."
1961    OCTAVE_CONFIGURE_WARNING([warn_fltk_config])
1962  else
1963    ## Only include -I options in FLTK_CPPFLAGS
1964    fltk_cflags=`$FLTK_CONFIG $fltkconf_args --use-gl --cflags`
1965    for fltk_option in $fltk_cflags; do
1966      case $fltk_option in
1967        -I*)
1968          FLTK_CPPFLAGS="$FLTK_CPPFLAGS $fltk_option"
1969        ;;
1970      esac
1971    done
1972    FLTK_CPPFLAGS=`echo "$FLTK_CPPFLAGS" | $SED -e 's/^ \+//'`
1973
1974    ## Split -L and -l options into FLTK_LDFLAGS and FLTK_LIBS
1975    fltk_ldflags=`$FLTK_CONFIG $fltkconf_args --use-gl --ldflags`
1976    for fltk_option in $fltk_ldflags; do
1977      case $fltk_option in
1978        -l*)
1979          FLTK_LIBS="$FLTK_LIBS $fltk_option"
1980        ;;
1981        *)
1982          FLTK_LDFLAGS="$FLTK_LDFLAGS $fltk_option"
1983        ;;
1984      esac
1985    done
1986    FLTK_LIBS=`echo "$FLTK_LIBS" | $SED -e 's/^ \+//'`
1987    FLTK_LDFLAGS=`echo "$FLTK_LDFLAGS" | $SED -e 's/^ \+//'`
1988
1989    case $host_os in
1990      mingw*)
1991        FLTK_LDFLAGS=`echo $FLTK_LDFLAGS | $SED -e 's/-mwindows//g'`
1992      ;;
1993    esac
1994    AC_LANG_PUSH(C++)
1995    AC_CACHE_CHECK([for OpenGL support in FLTK],
1996      [octave_cv_fltk_opengl_support],
1997      [save_CPPFLAGS="$CPPFLAGS"
1998      CPPFLAGS="$CFLAGS $FLTK_CPPFLAGS"
1999      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2000        #include <FL/gl.h>
2001        ]], [[
2002        int nothing = 0;
2003        ]])],
2004        octave_cv_fltk_opengl_support=yes,
2005        octave_cv_fltk_opengl_support=no)
2006      CPPFLAGS="$save_CPPFLAGS"
2007      ])
2008    if test $octave_cv_fltk_opengl_support = no; then
2009      warn_fltk_opengl="FLTK does not have OpenGL support.  OpenGL graphics with FLTK widgets will be disabled."
2010    else
2011      build_fltk_graphics=yes
2012      AC_DEFINE(HAVE_FLTK, 1, [Define to 1 if FLTK is available.])
2013    fi
2014    AC_LANG_POP(C++)
2015
2016    if test -n "$warn_fltk_opengl"; then
2017      OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl])
2018    fi
2019  fi
2020fi
2021
2022AC_SUBST(FLTK_CPPFLAGS)
2023AC_SUBST(FLTK_LDFLAGS)
2024AC_SUBST(FLTK_LIBS)
2025
2026### Final determination of whether OpenGL graphics can be built
2027if test $build_qt_graphics = no && test $build_fltk_graphics = no; then
2028  opengl_graphics=no
2029else
2030  opengl_graphics=yes
2031fi
2032
2033### Check for the qrupdate library
2034
2035dnl No need to adjust FFLAGS because only link is attempted.
2036dnl Must supply proper LIBS, however.
2037save_LIBS="$LIBS"
2038LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
2039OCTAVE_CHECK_LIB(qrupdate, qrupdate,
2040  [qrupdate not found.  The QR & Cholesky updating functions will be slow.],
2041  [],
2042  [sqr1up],
2043  [Fortran 77], [don't use qrupdate, disable QR & Cholesky updating functions])
2044
2045## Additional check to see if qrupdate lib found supports LU updates
2046if test -z "$warn_qrupdate"; then
2047  AC_CACHE_CHECK([for slup1up in $QRUPDATE_LIBS],
2048    [octave_cv_func_slup1up],
2049    [LIBS="$LIBS $QRUPDATE_LIBS"
2050    AC_LANG_PUSH([Fortran 77])
2051    AC_LINK_IFELSE([AC_LANG_CALL([], [slup1up])],
2052      octave_cv_func_slup1up=yes, octave_cv_func_slup1up=no)
2053    AC_LANG_POP([Fortran 77])
2054  ])
2055  if test $octave_cv_func_slup1up = yes; then
2056    AC_DEFINE(HAVE_QRUPDATE_LUU, 1, [Define to 1 if qrupdate supports LU updates.])
2057  fi
2058fi
2059LIBS="$save_LIBS"
2060
2061if test $ENABLE_64 = yes; then
2062  CHOLMOD_TAG="_l_"
2063  CXSPARSE_TAG="_dl_"
2064  UMFPACK_TAG="_zl_"
2065else
2066  CHOLMOD_TAG="_"
2067  CXSPARSE_TAG="_di_"
2068  UMFPACK_TAG="_zi_"
2069fi
2070
2071## On some systems, explicitly linking with -lsuitesparseconfig is needed
2072## when using SuiteSparse libraries.  If so, the checks below for specific
2073## SuiteSparse libraries may fail without it.  Include LIB_CLOCK_GETTIME (from
2074## gnulib) on systems where needed.
2075
2076save_LIBS="$LIBS"
2077LIBS="$LIB_CLOCK_GETTIME $LIBS"
2078OCTAVE_CHECK_LIB(suitesparseconfig, SUITESPARSECONFIG,
2079  [], [], [SuiteSparse_time], [],
2080  [don't link directly with suitesparseconfig library])
2081LIBS="$save_LIBS"
2082
2083if test -n "$SUITESPARSECONFIG_LIBS" && test -n "$LIB_CLOCK_GETTIME"; then
2084  SUITESPARSECONFIG_LIBS="$SUITESPARSECONFIG_LIBS $LIB_CLOCK_GETTIME"
2085fi
2086
2087### Reset below, after all checks for SuiteSparse libraries.
2088suitesparse_save_LIBS="$LIBS"
2089LIBS="$SUITESPARSECONFIG_LIBS $LIBS"
2090
2091### Check for AMD library
2092
2093OCTAVE_CHECK_LIB(amd, AMD,
2094  [AMD library not found.  This will result in some lack of functionality for sparse matrices.],
2095  [suitesparse/amd.h ufsparse/amd.h amd/amd.h amd.h],
2096  [amd_postorder],
2097  [], [don't use AMD library, disable some sparse matrix functionality])
2098
2099### Check for CAMD library
2100
2101OCTAVE_CHECK_LIB(camd, CAMD,
2102  [CAMD library not found.  This will result in some lack of functionality for sparse matrices.],
2103  [suitesparse/camd.h ufsparse/camd.h camd/camd.h camd.h],
2104  [camd_postorder],
2105  [], [don't use CAMD library, disable some sparse matrix functionality])
2106
2107### Check for COLAMD library
2108
2109OCTAVE_CHECK_LIB(colamd, COLAMD,
2110  [COLAMD library not found.  This will result in some lack of functionality for sparse matrices.],
2111  [suitesparse/colamd.h ufsparse/colamd.h colamd/colamd.h colamd.h],
2112  [colamd],
2113  [], [don't use COLAMD library, disable some sparse matrix functionality])
2114
2115### Check for CCOLAMD library
2116
2117OCTAVE_CHECK_LIB(ccolamd, CCOLAMD,
2118  [CCOLAMD library not found.  This will result in some lack of functionality for sparse matrices.],
2119  [suitesparse/ccolamd.h ufsparse/ccolamd.h ccolamd/ccolamd.h ccolamd.h],
2120  [ccolamd],
2121  [], [don't use CCOLAMD library, disable some sparse matrix functionality])
2122
2123### Check for CHOLMOD library.
2124### If your cholmod library requires cblas, then you will need to configure
2125### with --with-cholmod="-lcholmod -lcblas".
2126
2127save_LIBS="$LIBS"
2128LIBS="$COLAMD_LDFLAGS $COLAMD_LIBS $AMD_LDFLAGS $AMD_LIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
2129OCTAVE_CHECK_LIB(cholmod, CHOLMOD,
2130  [CHOLMOD library not found.  This will result in some lack of functionality for sparse matrices.],
2131  [suitesparse/cholmod.h ufsparse/cholmod.h cholmod/cholmod.h cholmod.h],
2132  [cholmod${CHOLMOD_TAG}start],
2133  [], [don't use CHOLMOD library, disable some sparse matrix functionality])
2134LIBS="$save_LIBS"
2135
2136### Check for CXSparse library
2137
2138OCTAVE_CHECK_LIB(cxsparse, CXSparse,
2139  [CXSparse library not found.  This will result in some lack of functionality for sparse matrices.],
2140  [suitesparse/cs.h ufsparse/cs.h cxsparse/cs.h cs.h],
2141  [cs${CXSPARSE_TAG}sqr],
2142  [C++], [don't use CXSparse library, disable some sparse matrix functionality])
2143
2144if test -z "$warn_cxsparse"; then
2145  ## Additional check for CXSparse version >= 2.2
2146  if test $octave_cv_lib_cxsparse = yes; then
2147    OCTAVE_CHECK_CXSPARSE_VERSION_OK
2148    if test $octave_cv_cxsparse_version_ok = no; then
2149      AC_MSG_ERROR([CXSparse library is too old (< version 2.2).  Upgrade CXSparse (SuiteSparse) or configure Octave with --without-cxsparse"])
2150    fi
2151  fi
2152fi
2153
2154### Check for UMFPACK library.
2155
2156save_LIBS="$LIBS"
2157save_CPPFLAGS="$CPPFLAGS"
2158LIBS="$AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS"
2159CPPFLAGS="$AMD_CPPFLAGS $CPPFLAGS"
2160OCTAVE_CHECK_LIB([umfpack], UMFPACK,
2161  [UMFPACK not found.  This will result in some lack of functionality for sparse matrices.],
2162  [suitesparse/umfpack.h ufsparse/umfpack.h umfpack/umfpack.h umfpack.h],
2163  [umfpack${UMFPACK_TAG}get_determinant],
2164  [], [don't use UMFPACK, disable some sparse matrix functionality])
2165CPPFLAGS="$save_CPPFLAGS"
2166LIBS="$save_LIBS"
2167
2168if test -z "$UMFPACK_LIBS"; then
2169  ## Invalidate the cache and try again with -lcblas.
2170  $as_unset ac_cv_lib_umfpack_umfpack${UMFPACK_TAG}get_determinant
2171  $as_unset octave_cv_lib_umfpack
2172  save_LIBS="$LIBS"
2173  LIBS="-lcblas $AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS"
2174  OCTAVE_CHECK_LIB([umfpack], UMFPACK,
2175    [UMFPACK not found.  This will result in some lack of functionality for sparse matrices.],
2176    [suitesparse/umfpack.h ufsparse/umfpack.h umfpack/umfpack.h umfpack.h],
2177    [umfpack${UMFPACK_TAG}get_determinant],
2178    [], [don't use UMFPACK, disable some sparse matrix functionality])
2179  if test -n "$UMFPACK_LIBS"; then
2180    UMFPACK_LIBS="$UMFPACK_LIBS -lcblas"
2181  fi
2182  LIBS="$save_LIBS"
2183fi
2184
2185### Check for KLU library and header.
2186
2187OCTAVE_CHECK_LIB(klu, KLU,
2188  [KLU library not found.  This will result in some lack of functionality for sparse matrices.],
2189  [suitesparse/klu.h ufsparse/klu.h klu/klu.h klu.h], [klu_solve],
2190  [], [don't use KLU library, disable some sparse matrix functionality])
2191
2192### SUITESPARSECONFIG_LIBS added to LIBS above.
2193LIBS="$suitesparse_save_LIBS"
2194
2195## Collections of flags.
2196dnl These are here instead of just in the Makefile.am file because we
2197dnl substitute some of them into other source files like mkoctfile.
2198
2199## Order matters, at least on some systems (Cygwin, for example).
2200
2201SPARSE_XCPPFLAGS="$CHOLMOD_CPPFLAGS $UMFPACK_CPPFLAGS $AMD_CPPFLAGS $CAMD_CPPFLAGS $COLAMD_CPPFLAGS $CCOLAMD_CPPFLAGS $CXSPARSE_CPPFLAGS"
2202
2203SPARSE_XLDFLAGS="$CHOLMOD_LDFLAGS $UMFPACK_LDFLAGS $AMD_LDFLAGS $CAMD_LDFLAGS $COLAMD_LDFLAGS  $CCOLAMD_LDFLAGS $CXSPARSE_LDFLAGS"
2204
2205SPARSE_XLIBS="$CHOLMOD_LIBS $UMFPACK_LIBS $AMD_LIBS $CAMD_LIBS $COLAMD_LIBS $CCOLAMD_LIBS $CXSPARSE_LIBS $SUITESPARSECONFIG_LIBS"
2206
2207AC_SUBST(SPARSE_XCPPFLAGS)
2208AC_SUBST(SPARSE_XLDFLAGS)
2209AC_SUBST(SPARSE_XLIBS)
2210
2211## Check for UMFPACK separately split complex matrix and RHS.
2212if test -n "$UMFPACK_LIBS"; then
2213  save_CPPFLAGS="$CPPFLAGS"
2214  save_LDFLAGS="$LDFLAGS";
2215  save_LIBS="$LIBS";
2216
2217  CPPFLAGS="$SPARSE_XCPPFLAGS $CPPFLAGS"
2218  LDFLAGS="$SPARSE_XLDFLAGS $LDFLAGS"
2219  LIBS="$SPARSE_XLIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS $xtra_libs"
2220
2221  OCTAVE_UMFPACK_SEPARATE_SPLIT
2222
2223  CPPFLAGS="$save_CPPFLAGS"
2224  LDFLAGS="$save_LDFLAGS"
2225  LIBS="$save_LIBS"
2226fi
2227
2228### Check for SUNDIALS NVECTOR serial library and header.
2229
2230OCTAVE_CHECK_LIB(sundials_nvecserial, [SUNDIALS NVECTOR],
2231  [SUNDIALS NVECTOR serial library not found.  The solvers ode15i and ode15s will be disabled.],
2232  [nvector/nvector_serial.h nvector_serial.h ], [N_VNew_Serial],
2233  [], [don't use SUNDIALS NVECTOR library, disable solvers ode15i and ode15s])
2234
2235### Check for SUNDIALS IDA library and header.
2236
2237save_CPPFLAGS="$CPPFLAGS"
2238save_LDFLAGS="$LDFLAGS"
2239save_LIBS="$LIBS"
2240LIBS="$SUNDIALS_NVECSERIAL_LIBS $KLU_LIBS $BLAS_LIBS $FLIBS $LIBS"
2241LDFLAGS="$SUNDIALS_NVECSERIAL_LDFLAGS $KLU_LDFLAGS $BLAS_LDFLAGS $LDFLAGS"
2242CPPFLAGS="$SUNDIALS_NVECSERIAL_CPPFLAGS $KLU_CPPFLAGS $BLAS_CPPFLAGS $CPPFLAGS"
2243OCTAVE_CHECK_LIB(sundials_ida, [SUNDIALS IDA],
2244  [SUNDIALS IDA library not found.  The solvers ode15i and ode15s will be disabled.],
2245  [ida/ida.h ida.h], [IDAInit],
2246  [], [don't use SUNDIALS IDA library, disable solvers ode15i and ode15s])
2247CPPFLAGS="$save_CPPFLAGS"
2248LDFLAGS="$save_LDFLAGS"
2249LIBS="$save_LIBS"
2250
2251### Check for SUNDIALS library features, some required, some optional.
2252
2253CPPFLAGS="$SUNDIALS_IDA_CPPFLAGS $SUNDIALS_NVECSERIAL_CPPFLAGS $KLU_CPPFLAGS $BLAS_CPPFLAGS $CPPFLAGS"
2254LDFLAGS="$SUNDIALS_IDA_LDFLAGS $SUNDIALS_NVECSERIAL_LDFLAGS $KLU_LDFLAGS $BLAS_LDFLAGS $LDFLAGS"
2255LIBS="$SUNDIALS_IDA_LIBS $SUNDIALS_NVECSERIAL_LIBS $KLU_LIBS $BLAS_LIBS $FLIBS $LIBS"
2256if test -z "$warn_sundials_nvecserial" && test -z "$warn_sundials_ida"; then
2257  dnl Any of the following tests could determine that SUNDIALS is incompatible
2258  dnl and should be disabled. In that event, they all populate the same
2259  dnl variable with appropriate warning messages, and further tests should be
2260  dnl skipped if a warning message has already been generated that SUNDIALS is
2261  dnl disabled.
2262  warn_sundials_disabled=
2263  if test -z "$warn_sundials_disabled"; then
2264    OCTAVE_CHECK_SUNDIALS_COMPATIBLE_API
2265  fi
2266  if test -z "$warn_sundials_disabled"; then
2267    OCTAVE_CHECK_SUNDIALS_SIZEOF_REALTYPE
2268  fi
2269  if test -z "$warn_sundials_disabled"; then
2270    OCTAVE_CHECK_SUNDIALS_SUNLINSOL_DENSE
2271  fi
2272  dnl The following tests determine whether certain optional features are
2273  dnl present in the SUNDIALS libraries, but will not disable using SUNDIALS.
2274  if test -z "$warn_sundials_disabled"; then
2275    OCTAVE_CHECK_SUNDIALS_SUNLINSOL_KLU
2276  fi
2277fi
2278CPPFLAGS="$save_CPPFLAGS"
2279LDFLAGS="$save_LDFLAGS"
2280LIBS="$save_LIBS"
2281
2282dnl Define this way instead of with an #if in oct-conf-post.h so that
2283dnl the build features script will get the correct value.
2284dnl
2285dnl The test on the sunlinsol_klu.h header is a bit of a kluge.
2286dnl How can we do a better job here?  Do we need to disable sundials
2287dnl any tests fail, or can we fix __ode15__.cc so that it still partially
2288dnl works when some things are missing (for example, KLU)?
2289if test -n "$SUNDIALS_IDA_LIBS" \
2290    && test -n "$SUNDIALS_NVECSERIAL_LIBS" \
2291    && test "x$octave_cv_sundials_sunlinsol_dense" = xyes \
2292    && test "x$octave_cv_sundials_realtype_is_double" = xyes \
2293    && test "x$octave_have_sundials_compatible_api" = xyes; then
2294  AC_DEFINE(HAVE_SUNDIALS, 1, [Define to 1 if SUNDIALS is available.])
2295
2296  ## Collections of options needed to build with SUNDIALS and its dependencies.
2297  SUNDIALS_XCPPFLAGS="$SUNDIALS_IDA_CPPFLAGS $SUNDIALS_SUNLINSOLKLU_CPPFLAGS $SUNDIALS_NVECSERIAL_CPPFLAGS $KLU_CPPFLAGS"
2298  SUNDIALS_XLDFLAGS="$SUNDIALS_IDA_LDFLAGS $SUNDIALS_SUNLINSOLKLU_LDFLAGS $SUNDIALS_NVECSERIAL_LDFLAGS $KLU_LDFLAGS"
2299  SUNDIALS_XLIBS="$SUNDIALS_IDA_LIBS $SUNDIALS_SUNLINSOLKLU_LIBS $SUNDIALS_NVECSERIAL_LIBS $KLU_LIBS"
2300else
2301  SUNDIALS_IDA_CPPFLAGS=
2302  SUNDIALS_IDA_LDFLAGS=
2303  SUNDIALS_IDA_LIBS=
2304  SUNDIALS_SUNLINSOLKLU_CPPFLAGS=
2305  SUNDIALS_SUNLINSOLKLU_LDFLAGS=
2306  SUNDIALS_SUNLINSOLKLU_LIBS=
2307  SUNDIALS_NVECSERIAL_CPPFLAGS=
2308  SUNDIALS_NVECSERIAL_LDFLAGS=
2309  SUNDIALS_NVECSERIAL_LIBS=
2310  SUNDIALS_XCPPFLAGS=
2311  SUNDIALS_XLDFLAGS=
2312  SUNDIALS_XLIBS=
2313  dnl Emit a fallback warning message in case SUNDIALS has been disabled for
2314  dnl some reason that hasn't already generated one of these known warnings.
2315  if test -z "$warn_sundials_nvecserial" && test -z "$warn_sundials_ida" \
2316      && test -z "$warn_sundials_disabled"; then
2317    warn_sundials_disabled="SUNDIALS libraries are missing some feature.  The solvers ode15i and ode15s will be disabled."
2318    OCTAVE_CONFIGURE_WARNING([warn_sundials_disabled])
2319  fi
2320fi
2321
2322AC_SUBST(SUNDIALS_XCPPFLAGS)
2323AC_SUBST(SUNDIALS_XLDFLAGS)
2324AC_SUBST(SUNDIALS_XLIBS)
2325
2326### Check for ARPACK library.
2327
2328save_LIBS="$LIBS"
2329LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
2330OCTAVE_CHECK_LIB([arpack], ARPACK,
2331  [ARPACK not found.  The eigs function will be disabled.],
2332  [],
2333  [dseupd],
2334  [Fortran 77], [don't use the ARPACK library, disable eigs function],
2335  [warn_arpack=
2336   OCTAVE_CHECK_LIB_ARPACK_OK_1(
2337     [AC_DEFINE(HAVE_ARPACK, 1, [Define to 1 if ARPACK is available.])],
2338     [warn_arpack="ARPACK library found, but does not seem to work properly; disabling eigs function"])
2339   if test -z "$warn_arpack"; then
2340     OCTAVE_CHECK_LIB_ARPACK_OK_2([],
2341       [AC_MSG_WARN([ARPACK library found, but is buggy; upgrade library (>= v3.3.0) for better results])])
2342   fi
2343   ])
2344LIBS="$save_LIBS"
2345
2346### Check for Java.
2347
2348build_java=yes
2349AC_ARG_ENABLE([java],
2350  [AS_HELP_STRING([--disable-java],
2351    [disable Java interface])],
2352  [if test "$enableval" = no; then
2353     build_java=no
2354   fi],
2355  [])
2356
2357AC_ARG_WITH([java-homedir],
2358  [AS_HELP_STRING([--with-java-homedir=DIR],
2359    [Java JDK directory in DIR])],
2360  [JAVA_HOMEDIR="$withval"])
2361
2362AC_ARG_WITH([java-includedir],
2363  [AS_HELP_STRING([--with-java-includedir=DIR],
2364    [look for java include file <jni.h> in DIR])],
2365  [JAVA_CPPFLAGS="$withval"], [JAVA_CPPFLAGS=""])
2366
2367AC_ARG_WITH([java-libdir],
2368  [AS_HELP_STRING([--with-java-libdir=DIR],
2369    [look for java library libjvm in DIR])],
2370  [JAVA_LDPATH="$withval"], [JAVA_LDPATH=""])
2371
2372## Grab JAVA_HOME from environment variable if it exists
2373AC_ARG_VAR([JAVA_HOME], [path to Java JDK installation])
2374## But --with-java-homedir option overrides environment variable
2375if test -n "$JAVA_HOMEDIR"; then
2376  JAVA_HOME=$JAVA_HOMEDIR
2377fi
2378JAVA=
2379JAVAC=
2380JAR=
2381JAVA_LIBS=
2382
2383dnl Fake loop so that "break" can be used to skip code blocks.
2384warn_java=
2385while test $build_java = yes
2386do
2387  ## Unset build_java.  Variable is set only if all configuration tests pass.
2388  build_java=no
2389
2390  ## Warn if JAVA_HOME is unset.  It is *strongly* advised to specify JAVA_HOME.
2391  if test -z "$JAVA_HOME"; then
2392    warn_java_home="JAVA_HOME environment variable not initialized.  Auto-detection will proceed but is unreliable."
2393    OCTAVE_CONFIGURE_WARNING([warn_java_home])
2394  fi
2395
2396  ## Search for a viable Java executable.
2397  if test -z "$JAVA_HOME"; then
2398    JAVA_PATH="$PATH"
2399  else
2400    JAVA_PATH="${JAVA_HOME}$PATH_SEPARATOR${JAVA_HOME}/jre/bin$PATH_SEPARATOR${JAVA_HOME}/bin$PATH_SEPARATOR${JAVA_HOME}/../bin$PATH_SEPARATOR${PATH}"
2401  fi
2402  AC_PATH_PROG(JAVA, java, [], [$JAVA_PATH])
2403
2404  if test -z "$JAVA"; then
2405    warn_java="No Java executable found.  Octave will not be able to call Java methods."
2406    break
2407  fi
2408
2409  if test -z "$JAVA_HOME"; then
2410    ## Find JAVA_HOME for JRE by running java and querying properties.
2411    JAVA_TMP_HOME=`"$JAVA" -classpath ${srcdir}/build-aux OctJavaQry JAVA_HOME`
2412    ## Strip directory back to top-level installation dir (JAVA_HOME for JDK).
2413    JAVA_HOME=`echo $JAVA_TMP_HOME | $SED -e 's|[[/\\]]bin[[/\\]]\?$||' | $SED -e 's|[[/\\]]jre[[/\\]]\?$||'`
2414  fi
2415
2416  case $build_os in
2417    mingw* | msdosmsvc)
2418      ## Under Win32 platform, we want JAVA_HOME to be in MSYS format; that is,
2419      ## without colon and backslashes, as it is also used as path separator.
2420      ## Use quoted paths as Java may be installed in a path with whitespaces
2421      ## (e.g. C:\Program Files\Java\...).
2422      if test -n "$JAVA_HOME"; then
2423        JAVA_HOME=`cd "$JAVA_HOME" && pwd`
2424      fi
2425    ;;
2426  esac
2427
2428  ## Amend search path for JAVAC and JAR.
2429  if test -z "$JAVA_HOME"; then
2430    JAVA_PATH="$PATH"
2431  else
2432    JAVA_PATH="${JAVA_HOME}$PATH_SEPARATOR${JAVA_HOME}/bin$PATH_SEPARATOR${JAVA_HOME}/../bin$PATH_SEPARATOR${PATH}"
2433  fi
2434
2435  AC_PATH_PROG(JAVAC, javac, [], [$JAVA_PATH])
2436  AC_PATH_PROG(JAR, jar, [], [$JAVA_PATH])
2437
2438  if test -z "$JAVAC" || test -z "$JAR"; then
2439    warn_java="No javac compiler or jar executable found.  Octave will not be able to call Java methods."
2440    break
2441  fi
2442
2443  ## Check Java version is recent enough.
2444  AC_MSG_CHECKING([for Java version])
2445  java_version=[`"$JAVA" -version 2>&1 | $SED -n -e 's/^[^ ]* version[^0-9"]*"\([^"]*\)".*/\1/p'`]
2446  AC_MSG_RESULT([$java_version])
2447  java_major=[`echo $java_version | $SED -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*$/\1/'`]
2448  java_minor=[`echo $java_version | $SED -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*$/\2/'`]
2449  if test $java_major -gt 1 || (test $java_major -eq 1 && test $java_minor -ge 5); then
2450    :  # Version is OK.  Do nothing.
2451  else
2452    warn_java="Java version is too old (< 1.5).  Octave will not be able to call Java methods."
2453    break
2454  fi
2455
2456  ## At this point Win32 systems have enough configuration data.
2457  ## We assume that all appropriate variables (e.g. INCLUDE and LIB) already
2458  ## contain the required paths to compile and link against JDK.
2459  case $host_os in
2460    msdosmsvc)
2461      build_java=yes
2462      JAVA_LIBS=-ladvapi32
2463      AC_DEFINE(HAVE_JAVA, 1,
2464        [Define to 1 if Java is available and is at least version 1.5])
2465      break
2466    ;;
2467    mingw* | cygwin*)
2468      build_java=yes
2469      JAVA_LIBS=-ladvapi32
2470      if test $have_msvc = no; then
2471        if test -n "$JAVA_CPPFLAGS"; then
2472          JAVA_CPPFLAGS="-I\"${JAVA_CPPFLAGS}\" -I\"${JAVA_CPPFLAGS}/win32\""
2473        else
2474          JAVA_CPPFLAGS="-I\"${JAVA_HOME}/include\" -I\"${JAVA_HOME}/include/win32\""
2475        fi
2476        LDFLAGS="$LDFLAGS -Wl,--export-all-symbols"
2477      fi
2478      AC_DEFINE(HAVE_JAVA, 1,
2479        [Define to 1 if Java is available and is at least version 1.5])
2480      break
2481    ;;
2482  esac
2483
2484  ## Determine which library filename to search for.
2485  case $host_os in
2486    darwin*)
2487      jvmlib=libjvm.dylib
2488    ;;
2489    *)
2490      jvmlib=libjvm.so
2491    ;;
2492  esac
2493
2494  AC_MSG_CHECKING([for $jvmlib])
2495
2496  if test -z "$JAVA_LDPATH"; then
2497    ## Run Java to try and determine library path to libjvm.so.
2498    JAVA_TMP_LDPATH=`$JAVA -classpath ${srcdir}/build-aux OctJavaQry JAVA_LDPATH`
2499    JAVA_TMP_LDPATH=`echo $JAVA_TMP_LDPATH | $SED -e "s/${PATH_SEPARATOR}/ /g"`
2500    for dir in $JAVA_TMP_LDPATH; do
2501      if test -f "$dir/$jvmlib"; then
2502        JAVA_LDPATH=$dir
2503        break
2504      fi
2505    done
2506  fi
2507
2508  if test -z "$JAVA_LDPATH"; then
2509    ## Nothing found.  Try Java again using bootpath argument.
2510    JAVA_TMP_LDPATH=`$JAVA -classpath ${srcdir}/build-aux OctJavaQry JAVA_BOOTPATH`
2511    JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_TMP_LDPATH}/client ${JAVA_TMP_LDPATH}/server"
2512    for dir in $JAVA_TMP_LDPATH; do
2513      if test -f "$dir/$jvmlib"; then
2514        JAVA_LDPATH=$dir
2515        break
2516      fi
2517    done
2518  fi
2519
2520  if test -z "$JAVA_LDPATH"; then
2521    ## Java failed to find its own library path.  Guess wildly.
2522    JAVA_TMP_LDPATH=`ls -d $JAVA_HOME/jre/lib/*/client`
2523    JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} `ls -d $JAVA_HOME/jre/lib/*/server`"
2524    ## Add some paths that might work on Macs.
2525    JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_HOME}/../Libraries ${JAVA_HOME}/Libraries"
2526    ## Add some paths that might work on MinGW
2527    JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_HOME}/bin/client ${JAVA_HOME}/bin/server"
2528    for dir in $JAVA_TMP_LDPATH; do
2529      if test -f "$dir/$jvmlib"; then
2530        JAVA_LDPATH=$dir
2531        break
2532      fi
2533    done
2534  fi
2535
2536  ## Verify value passed in option --with-java-libdir
2537  if test -n "$JAVA_LDPATH"; then
2538    if test -f "${JAVA_LDPATH}/$jvmlib"; then
2539      :  # libjvm found
2540    else
2541      JAVA_LDPATH=""
2542    fi
2543  fi
2544
2545  if test -z "$JAVA_LDPATH"; then
2546    AC_MSG_RESULT([not found])
2547    warn_java="Library $jvmlib not found.  Octave will not be able to call Java methods."
2548    break
2549  else
2550    AC_MSG_RESULT([$JAVA_LDPATH])
2551  fi
2552
2553  AC_MSG_CHECKING([for include file <jni.h>])
2554
2555  ## Java and JVM found.  Set up flags.
2556  case $host_os in
2557    darwin*)
2558      if test -n "$JAVA_CPPFLAGS"; then
2559        JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS} -I${JAVA_CPPFLAGS}/darwin"
2560      else
2561        JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/darwin"
2562      fi
2563    ;;
2564    *)
2565      if test -n "$JAVA_CPPFLAGS"; then
2566        JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS} -I${JAVA_CPPFLAGS}/linux"
2567      else
2568        JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux"
2569      fi
2570    ;;
2571  esac
2572
2573  ## Verify jni.h include file exists.
2574  JNI_PATH=`echo $JAVA_CPPFLAGS | $SED -e 's/-I//g'`
2575  have_jni=no
2576  for dir in $JNI_PATH; do
2577    if test -f "${dir}/jni.h"; then have_jni=yes; break; fi
2578  done
2579  if test $have_jni = yes; then
2580    AC_MSG_RESULT([$dir])
2581  else
2582    AC_MSG_RESULT([not found])
2583    warn_java="Include file <jni.h> not found.  Octave will not be able to call Java methods."
2584    break
2585  fi
2586
2587  ## Passed all configuration tests.  A workable Java installation was found.
2588  build_java=yes
2589  AC_DEFINE(HAVE_JAVA, 1,
2590    [Define to 1 if Java is available and is at least version 1.5])
2591  break
2592done
2593if test -n "$warn_java"; then
2594  OCTAVE_CONFIGURE_WARNING([warn_java])
2595fi
2596
2597AM_CONDITIONAL([AMCOND_HAVE_JAVA], [test $build_java = yes])
2598AC_SUBST(JAVA)
2599AC_SUBST(JAVAC)
2600AC_SUBST(JAR)
2601AC_SUBST(JAVA_CPPFLAGS)
2602AC_SUBST(JAVA_LIBS)
2603AC_DEFINE_UNQUOTED([JAVA_HOME], ["$JAVA_HOME"], [Java home (top-level installation dir)])
2604AC_DEFINE_UNQUOTED([JAVA_LDPATH], ["$JAVA_LDPATH"], [Java library path (libjvm)])
2605
2606### Determine if documentation should and can be built.
2607
2608ENABLE_DOCS=yes
2609AC_ARG_ENABLE([docs],
2610  [AS_HELP_STRING([--disable-docs], [don't build documentation files])],
2611  [if test "$enableval" = no; then
2612     ENABLE_DOCS=no
2613     warn_docs="building documentation disabled; make dist will fail."
2614     OCTAVE_CONFIGURE_WARNING([warn_docs])
2615   fi], [])
2616if test $ENABLE_DOCS = yes; then
2617  if test $opengl_graphics = no || test "$have_qt_opengl_offscreen" = no; then
2618    if test -n "$warn_gnuplot"; then
2619      ENABLE_DOCS=no
2620      warn_docs_graphics="building documentation disabled because no suitable graphics toolkit is available; make dist will fail."
2621      OCTAVE_CONFIGURE_WARNING([warn_docs_graphics])
2622    fi
2623  fi
2624  if test -n "$warn_makeinfo"; then
2625    ENABLE_DOCS=no
2626    warn_docs_makeinfo="building documentation disabled because makeinfo was not found or does not support @sortas; make dist will fail."
2627    OCTAVE_CONFIGURE_WARNING([warn_docs_makeinfo])
2628  fi
2629fi
2630if test $ENABLE_DOCS = yes; then
2631  AC_DEFINE(ENABLE_DOCS, 1,
2632    [Define to 1 to build Octave documentation files.])
2633fi
2634AM_CONDITIONAL([AMCOND_BUILD_DOCS], [test $ENABLE_DOCS = yes])
2635
2636AM_CONDITIONAL([AMCOND_BUILD_QT_DOCS],
2637               [test $ENABLE_DOCS = yes && test $build_qt_gui = yes])
2638
2639OCTAVE_RELOCATE_ALL=no
2640AC_ARG_ENABLE([relocate-all],
2641  [AS_HELP_STRING([--enable-relocate-all],
2642    [assume that all dependencies that are installed under the same prefix are relocated when Octave is relocated])],
2643  [if test "$enableval" = yes; then OCTAVE_RELOCATE_ALL=yes; fi], [])
2644AC_SUBST(OCTAVE_RELOCATE_ALL)
2645if test $OCTAVE_RELOCATE_ALL = yes; then
2646  AC_DEFINE(OCTAVE_REPLACE_PREFIX, 1, [Replace prefix in mkoctfile flags.])
2647fi
2648
2649### Determine whether Mercurial ID should be embedded in library binaries.
2650
2651ENABLE_HG_ID=yes
2652AC_ARG_ENABLE([hg-id],
2653  [AS_HELP_STRING([--disable-hg-id],
2654    [disable embedding of hg id in libraries])],
2655  [if test "$enableval" = no; then ENABLE_HG_ID=no; fi], [])
2656AM_CONDITIONAL([AMCOND_ENABLE_HG_ID], [test $ENABLE_HG_ID = yes])
2657
2658### Determine whether to install build logs with Octave.
2659
2660install_build_logs=no
2661AC_ARG_ENABLE([install-build-logs],
2662  [AS_HELP_STRING([--enable-install-build-logs],
2663    [install build logs (i.e. config.log) with Octave])],
2664  [if test "$enableval" = yes; then install_build_logs=yes; fi])
2665AM_CONDITIONAL([AMCOND_INSTALL_BUILD_LOGS], [test $install_build_logs = yes])
2666
2667### Add extra compiler flags now that feature testing is complete.
2668
2669## Add warning flags
2670
2671dnl Don't add -Wshadow for GCC 4.x.
2672case "$GCC_VERSION" in
2673  *4*) ;;
2674  *)   GCC_WSHADOW_OPTION=-Wshadow ;;
2675esac
2676
2677GCC_EXTRA_FLAGS="-Wall -W $GCC_WSHADOW_OPTION -Wformat -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wcast-align -Wcast-qual"
2678GXX_EXTRA_FLAGS="-Wall -W $GCC_WSHADOW_OPTION -Woverloaded-virtual -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual"
2679
2680try_extra_warning_flags=yes
2681AC_ARG_ENABLE([extra-warning-flags],
2682  [AS_HELP_STRING([--disable-extra-warning-flags],
2683    [don't add -Wall, -W, -Wformat, -Wold-style-cast, and other warning options to CFLAGS and CXXFLAGS])],
2684  [if test "$enableval" = no; then
2685     try_extra_warning_flags=no
2686   fi],
2687  [])
2688
2689if test $try_extra_warning_flags = yes; then
2690  for flag in $GCC_EXTRA_FLAGS; do
2691    OCTAVE_CC_FLAG([$flag], [
2692      WARN_CFLAGS="$WARN_CFLAGS $flag";
2693      AC_MSG_RESULT([adding $flag to WARN_CFLAGS])])
2694  done
2695  for flag in $GXX_EXTRA_FLAGS; do
2696    OCTAVE_CXX_FLAG([$flag], [
2697      WARN_CXXFLAGS="$WARN_CXXFLAGS $flag";
2698      AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])])
2699  done
2700fi
2701
2702## Add strict warning flags
2703GCC_STRICT_FLAGS="-Wconversion"
2704GXX_STRICT_FLAGS="-Wconversion -Weffc++"
2705
2706try_strict_warning_flags=no
2707AC_ARG_ENABLE([strict-warning-flags],
2708  [AS_HELP_STRING([--enable-strict-warning-flags],
2709    [add extra strict warning options to CFLAGS and CXXFLAGS])],
2710  [if test "$enableval" = yes; then
2711     try_strict_warning_flags=yes
2712   fi],
2713  [])
2714
2715if test $try_strict_warning_flags = yes; then
2716  for flag in $GCC_STRICT_FLAGS; do
2717    OCTAVE_CC_FLAG([$flag], [
2718      WARN_CFLAGS="$WARN_CFLAGS $flag";
2719      AC_MSG_RESULT([adding $flag to WARN_CFLAGS])])
2720  done
2721  for flag in $GXX_STRICT_FLAGS; do
2722    OCTAVE_CXX_FLAG([$flag], [
2723      WARN_CXXFLAGS="$WARN_CXXFLAGS $flag";
2724      AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])])
2725  done
2726fi
2727
2728## Add sanitizer flags
2729GCC_ADDRESS_SANITIZER_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
2730GXX_ADDRESS_SANITIZER_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
2731LD_ADDRESS_SANITIZER_FLAGS="-fsanitize=address"
2732
2733try_address_sanitizer_flags=no
2734AC_ARG_ENABLE([address-sanitizer-flags],
2735  [AS_HELP_STRING([--enable-address-sanitizer-flags],
2736    [add extra -fsanitize=address and -fno-omit-frame-pointer options to CFLAGS, CXXFLAGS, and LDFLAGS])],
2737  [if test "$enableval" = yes; then
2738     try_address_sanitizer_flags=yes
2739   fi],
2740  [])
2741
2742if test $try_address_sanitizer_flags = yes; then
2743  ADDRESS_SANITIZER_OPTIONS="symbolize=1"
2744  AC_SUBST(ADDRESS_SANITIZER_OPTIONS)
2745fi
2746
2747AM_CONDITIONAL([AMCOND_ADDRESS_SANITIZER_ENABLED],
2748  [test $try_address_sanitizer_flags = yes])
2749
2750if test $try_address_sanitizer_flags = yes; then
2751  for flag in $GCC_ADDRESS_SANITIZER_FLAGS; do
2752    OCTAVE_CC_FLAG([$flag], [
2753      WARN_CFLAGS="$WARN_CFLAGS $flag";
2754      AC_MSG_RESULT([adding $flag to WARN_CFLAGS])])
2755  done
2756  for flag in $GXX_ADDRESS_SANITIZER_FLAGS; do
2757    OCTAVE_CXX_FLAG([$flag], [
2758      WARN_CXXFLAGS="$WARN_CXXFLAGS $flag";
2759      AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])])
2760  done
2761  dnl FIXME: do we really need an LD-specific test, or is this good enough?
2762  for flag in $LD_ADDRESS_SANITIZER_FLAGS; do
2763    OCTAVE_CC_FLAG([$flag], [
2764      WARN_LDFLAGS="$WARN_LDFLAGS $flag";
2765      AC_MSG_RESULT([adding $flag to WARN_LDFLAGS])])
2766  done
2767fi
2768
2769AC_SUBST(WARN_CFLAGS)
2770AC_SUBST(WARN_CXXFLAGS)
2771AC_SUBST(WARN_LDFLAGS)
2772
2773### Check for GCC-specific pragmas to control warnings.
2774
2775AC_CACHE_CHECK([for @%:@pragma GCC diagnostic push/pop/ignore],
2776  [octave_cv_gcc_has_pragma_GCC_diagnostic],
2777  [AC_LANG_PUSH(C++)
2778   AC_TRY_COMPILE([], [
2779#pragma GCC diagnostic push
2780#pragma GCC diagnostic ignore "-Wold-style-cast"
2781  int three = (int) 3.1415926;
2782#pragma GCC diagnostic pop
2783    ],
2784    [octave_cv_gcc_has_pragma_GCC_diagnostic=yes],
2785    [octave_cv_gcc_has_pragma_GCC_diagnostic=no])
2786   AC_LANG_POP(C++)],
2787  ])
2788
2789if test $octave_cv_gcc_has_pragma_GCC_diagnostic = yes; then
2790  AC_DEFINE(HAVE_PRAGMA_GCC_DIAGNOSTIC, 1,
2791    [Define to 1 if GCC supports @%:@pragma GCC diagnostic ...])
2792fi
2793
2794## Check for one unusual warning used in pragmas that is not always available
2795if test $octave_cv_gcc_has_pragma_GCC_diagnostic = yes; then
2796  OCTAVE_CC_FLAG([-Wimplicit-fallthrough],
2797    [AC_DEFINE(HAVE_WARN_IMPLICIT_FALLTHROUGH, 1,
2798      [Define to 1 if GCC supports -Wimplicit-fallthrough warning])])
2799fi
2800
2801### These are recommended by the gnulib bootstrap script:
2802
2803GNULIB_LINK_DEPS="$FREXPF_LIBM $FREXP_LIBM $GETHOSTNAME_LIB $LIBSOCKET $LIB_CLOCK_GETTIME $LIB_CRYPTO $LIB_GETLOGIN $LIB_NANOSLEEP $LIB_SELECT $LTLIBICONV $LTLIBINTL $LTLIBTHREAD $INTL_MACOSX_LIBS"
2804
2805### FIXME: This is a kluge to transform $libdir/libiconv.dll.a to -liconv.
2806### It would probably be better to fix gnulib to not give us an absolute
2807### file name...
2808
2809case $host_os in
2810  mingw*)
2811    ## Don't use $libdir here because that's defined to be
2812    ## ${exec_prefix}/lib and at this point, ${exec_prefix} is "NONE"!
2813    tmp_libiconv_dll="$LIBICONV_PREFIX/lib/libiconv.dll.a"
2814    MKOCTFILE_LIBICONV=`echo $LIBICONV | sed "s|$tmp_libiconv_dll|-liconv|"`
2815  ;;
2816  *)
2817    MKOCTFILE_LIBICONV="$LIBICONV"
2818  ;;
2819esac
2820
2821MKOCTFILE_GNULIB_LINK_DEPS="$FREXPF_LIBM $FREXP_LIBM $GETHOSTNAME_LIB $LIBSOCKET $LIB_CLOCK_GETTIME $LIB_CRYPTO $LIB_GETLOGIN $LIB_NANOSLEEP $LIB_SELECT $MKOCTFILE_LIBICONV $LIBINTL $LIBTHREAD $INTL_MACOSX_LIBS"
2822
2823AC_SUBST(GNULIB_LINK_DEPS)
2824
2825BASE_LIBOCTAVE_LINK_DEPS="$CURL_LIBS $SPARSE_XLIBS $ARPACK_LIBS $QRUPDATE_LIBS $FFTW_XLIBS $LAPACK_LIBS $BLAS_LIBS $READLINE_LIBS $TERM_LIBS $LIBGLOB $PCRE_LIBS $DL_LIBS $PTHREAD_LIBS $FLIBS $LIBS"
2826
2827LIBOCTAVE_LINK_DEPS="$BASE_LIBOCTAVE_LINK_DEPS $GNULIB_LINK_DEPS"
2828
2829MKOCTFILE_LIBOCTAVE_LINK_DEPS="$BASE_LIBOCTAVE_LINK_DEPS $MKOCTFILE_GNULIB_LINK_DEPS"
2830
2831LIBOCTAVE_LINK_OPTS="$CURL_LDFLAGS $SPARSE_XLDFLAGS $ARPACK_LDFLAGS $QRUPDATE_LDFLAGS $FFTW_XLDFLAGS $PCRE_LDFLAGS"
2832
2833AC_SUBST(LIBOCTAVE_LINK_DEPS)
2834AC_SUBST(LIBOCTAVE_LINK_OPTS)
2835
2836LIBOCTINTERP_LINK_DEPS="$FT2_LIBS $HDF5_LIBS $MAGICK_LIBS $Z_LIBS $SPARSE_XLIBS $FFTW_XLIBS $OPENGL_LIBS $FONTCONFIG_LIBS $FREETYPE_LIBS $X11_LIBS $CARBON_LIBS $GL2PS_LIBS $LLVM_LIBS $JAVA_LIBS $LAPACK_LIBS"
2837
2838LIBOCTINTERP_LINK_OPTS="$FT2_LDFLAGS $HDF5_LDFLAGS $MAGICK_LDFLAGS $Z_LDFLAGS $SPARSE_XLDFLAGS $FFTW_XLDFLAGS $LLVM_LDFLAGS"
2839
2840OCTAVE_LINK_DEPS=""
2841OCTAVE_LINK_OPTS=""
2842
2843OCT_LINK_DEPS=""
2844OCT_GUI_LINK_DEPS=""
2845
2846OCT_LINK_OPTS="$LDFLAGS"
2847OCT_GUI_LINK_OPTS="$LDFLAGS"
2848
2849if test $link_all_deps = yes; then
2850  OCT_LINK_DEPS="libinterp/liboctinterp.la liboctave/liboctave.la"
2851  OCT_GUI_LINK_DEPS="libgui/liboctgui.la libinterp/liboctinterp.la liboctave/liboctave.la"
2852
2853  MKOCTFILE_OCTAVE_LINK_DEPS="$LIBOCTINTERP_LINK_DEPS $MKOCTFILE_LIBOCTAVE_LINK_DEPS"
2854  MKOCTFILE_OCT_LINK_DEPS="$LIBOCTINTERP $LIBOCTAVE"
2855
2856  LIBOCTINTERP_LINK_DEPS="$LIBOCTINTERP_LINK_DEPS $LIBOCTAVE_LINK_DEPS"
2857  LIBOCTINTERP_LINK_OPTS="$LIBOCTINTERP_LINK_OPTS $LIBOCTAVE_LINK_OPTS"
2858
2859  OCTAVE_LINK_DEPS="$LIBOCTINTERP_LINK_DEPS"
2860  OCTAVE_LINK_OPTS="$LIBOCTINTERP_LINK_OPTS"
2861else
2862  case $host_os in
2863    mingw* | msdosmsvc)
2864      OCT_LINK_DEPS="libinterp/liboctinterp.la liboctave/liboctave.la"
2865      OCT_GUI_LINK_DEPS="libgui/liboctgui.la libinterp/liboctinterp.la liboctave/liboctave.la"
2866    ;;
2867  esac
2868fi
2869
2870AC_SUBST(LIBOCTINTERP_LINK_DEPS)
2871AC_SUBST(LIBOCTINTERP_LINK_OPTS)
2872
2873AC_SUBST(OCTAVE_LINK_DEPS)
2874AC_SUBST(OCTAVE_LINK_OPTS)
2875
2876AC_SUBST(OCT_LINK_DEPS)
2877AC_SUBST(OCT_LINK_OPTS)
2878
2879AC_SUBST(OCT_GUI_LINK_DEPS)
2880AC_SUBST(OCT_GUI_LINK_OPTS)
2881
2882AC_SUBST(MKOCTFILE_OCTAVE_LINK_DEPS)
2883AC_SUBST(MKOCTFILE_OCT_LINK_DEPS)
2884
2885LIBOCTGUI_LINK_DEPS=""
2886LIBOCTGUI_LINK_OPTS=""
2887
2888OCTAVE_GUI_LINK_DEPS=""
2889OCTAVE_GUI_LINK_OPTS=""
2890
2891if test $build_qt_gui = yes; then
2892  LIBOCTGUI_LINK_DEPS="$QT_LIBS $QT_OPENGL_LIBS"
2893  LIBOCTGUI_LINK_OPTS="$QT_LDFLAGS $QT_OPENGL_LDFLAGS"
2894
2895  if test $link_all_deps = yes || test -n "$QT_LDFLAGS"; then
2896    LIBOCTGUI_LINK_DEPS="$LIBOCTGUI_LINK_DEPS $LIBOCTINTERP_LINK_DEPS"
2897    LIBOCTGUI_LINK_OPTS="$LIBOCTGUI_LINK_OPTS $LIBOCTINTERP_LINK_OPTS"
2898
2899    OCTAVE_GUI_LINK_DEPS="$OCTAVE_GUI_LINK_DEPS $LIBOCTGUI_LINK_DEPS"
2900    OCTAVE_GUI_LINK_OPTS="$OCTAVE_GUI_LINK_OPTS $LIBOCTGUI_LINK_OPTS"
2901  fi
2902fi
2903
2904AC_SUBST(LIBOCTGUI_LINK_DEPS)
2905AC_SUBST(LIBOCTGUI_LINK_OPTS)
2906
2907AC_SUBST(OCTAVE_GUI_LINK_DEPS)
2908AC_SUBST(OCTAVE_GUI_LINK_OPTS)
2909
2910##############################################################################
2911### Configuration tests done
2912
2913### Restore original compilation flags
2914CFLAGS="$original_octave_configure_CFLAGS"
2915CXXFLAGS="$original_octave_configure_CXXFLAGS"
2916
2917### Add footer to config.h
2918
2919AH_BOTTOM([#include "oct-conf-post.h"])
2920
2921### Make all AC_DEFINES available to testif feature of test.m function.
2922dnl This must reside at the bottom of configure.ac after all AC_DEFINES
2923dnl have been made.
2924
2925AC_OUTPUT_MAKE_DEFS
2926
2927AC_CONFIG_COMMANDS_PRE([
2928  ## Fully expand all directory variables.  These are normally left
2929  ## unexpanded (as explained and recommended by the autoconf manual).
2930  ## But we store configuration info in files and expect whatever
2931  ## is set at configure time to stay the same when Make is executed.
2932  ## Doing things like
2933  ##
2934  ##   configure --prefix=/some/where
2935  ##   make --prefix=/some/where/else
2936  ##
2937  ## won't work properly and is not allowed when building Octave.
2938
2939  eval prefix="\"$prefix\""
2940  eval exec_prefix="\"$exec_prefix\""
2941  eval bindir="\"$bindir\""
2942  eval sbindir="\"$sbindir\""
2943  eval libexecdir="\"$libexecdir\""
2944  eval datarootdir="\"$datarootdir\""
2945  eval datadir="\"$datadir\""
2946  eval sysconfdir="\"$sysconfdir\""
2947  eval sharedstatedir="\"$sharedstatedir\""
2948  eval localstatedir="\"$localstatedir\""
2949  eval runstatedir="\"$runstatedir\""
2950  eval includedir="\"$includedir\""
2951  eval oldincludedir="\"$oldincludedir\""
2952  eval docdir="\"$docdir\""
2953  eval infodir="\"$infodir\""
2954  eval htmldir="\"$htmldir\""
2955  eval dvidir="\"$dvidir\""
2956  eval pdfdir="\"$pdfdir\""
2957  eval psdir="\"$psdir\""
2958  eval libdir="\"$libdir\""
2959  eval localedir="\"$localedir\""
2960  eval mandir="\"$mandir\""
2961
2962  version="$OCTAVE_VERSION"
2963  api_version="$OCTAVE_API_VERSION"
2964
2965  eval octlibdir="\"$octlibdir\""
2966  eval archlibdir="\"$archlibdir\""
2967  eval localarchlibdir="\"$localarchlibdir\""
2968  eval localapiarchlibdir="\"$localapiarchlibdir\""
2969  eval localverarchlibdir="\"$localverarchlibdir\""
2970  eval octfiledir="\"$octfiledir\""
2971  eval localoctfiledir="\"$localoctfiledir\""
2972  eval localapioctfiledir="\"$localapioctfiledir\""
2973  eval localveroctfiledir="\"$localveroctfiledir\""
2974  eval octincludedir="\"$octincludedir\""
2975  eval fcnfiledir="\"$fcnfiledir\""
2976  eval localfcnfiledir="\"$localfcnfiledir\""
2977  eval localapifcnfiledir="\"$localapifcnfiledir\""
2978  eval localverfcnfiledir="\"$localverfcnfiledir\""
2979  eval octetcdir="\"$octetcdir\""
2980  eval octlocaledir="\"$octlocaledir\""
2981  eval doc_cache_file="\"$doc_cache_file\""
2982  eval octtestsdir="\"$octtestsdir\""
2983  eval texi_macros_file="\"$texi_macros_file\""
2984  eval imagedir="\"$imagedir\""
2985  eval octdatadir="\"$octdatadir\""
2986  eval octdocdir="\"$octdocdir\""
2987  eval octfontsdir="\"$octfontsdir\""
2988  eval startupfiledir="\"$startupfiledir\""
2989  eval localstartupfiledir="\"$localstartupfiledir\""
2990  eval man1dir="\"$man1dir\""
2991  eval man1ext="\"$man1ext\""
2992  eval infofile="\"$infofile\""
2993
2994  ## Also expand MKOCTFILE_DL_LDFLAGS, because it may depend on the values
2995  ## of variables expanded above.
2996
2997  eval MKOCTFILE_DL_LDFLAGS="\"$MKOCTFILE_DL_LDFLAGS\""
2998])
2999
3000### Do substitutions in Makefiles and other files that hold configuration info.
3001
3002AUTOCONF_SUBST_VARS="`echo $ac_subst_vars`"
3003
3004AC_SUBST(AUTOCONF_SUBST_VARS)
3005AC_SUBST(ac_config_files)
3006AC_SUBST(ac_config_headers)
3007
3008AC_CONFIG_FILES([
3009  Makefile
3010  build-aux/check-subst-vars.sh:build-aux/check-subst-vars.in.sh
3011  doc/doxyhtml/Doxyfile
3012  libgnu/Makefile
3013  liboctave/octave.pc:liboctave/octave.in.pc
3014  libinterp/octinterp.pc:libinterp/octinterp.in.pc])
3015
3016dnl We use a .in.h file for oct-conf-post.h simply to copy it to the build tree
3017dnl so that we don't have to add the -I${top_srcdir} to any CPPFLAGS variables.
3018
3019AC_CONFIG_FILES([oct-conf-post.h-tmp:oct-conf-post.in.h])
3020AC_CONFIG_COMMANDS([oct-conf-post.h],
3021  [$SHELL $srcdir/build-aux/move-if-change oct-conf-post.h-tmp oct-conf-post.h])
3022
3023OCTAVE_CONFIG_MOVE_IF_CHANGE_FILES([
3024  libgui/mk-default-qt-settings.sh
3025  liboctave/external/mk-f77-def.sh
3026  liboctave/mk-version-h.sh
3027  libinterp/corefcn/mk-mxarray-h.sh
3028  build-aux/subst-config-vals.sh
3029  build-aux/subst-cross-config-vals.sh
3030  build-aux/subst-script-vals.sh])
3031
3032AC_OUTPUT
3033
3034### Print a summary of the build configuration.
3035
3036AC_MSG_NOTICE([
3037
3038Octave is now configured for $canonical_host_type
3039
3040  Source directory:              $srcdir
3041  Installation prefix:           $prefix
3042  C compiler:                    $CC $XTRA_CFLAGS $WARN_CFLAGS $CFLAGS
3043  C++ compiler:                  $CXX $XTRA_CXXFLAGS $WARN_CXXFLAGS $CXXFLAGS
3044  Fortran compiler:              $F77 $FFLAGS
3045  Fortran libraries:             $FLIBS
3046  Lex libraries:                 $LEXLIB
3047  LIBS:                          $LIBS
3048  LDFLAGS:                       $LDFLAGS
3049  Extra LDFLAGS:                 $WARN_LDFLAGS
3050
3051  AMD CPPFLAGS:                  $AMD_CPPFLAGS
3052  AMD LDFLAGS:                   $AMD_LDFLAGS
3053  AMD libraries:                 $AMD_LIBS
3054  ARPACK CPPFLAGS:               $ARPACK_CPPFLAGS
3055  ARPACK LDFLAGS:                $ARPACK_LDFLAGS
3056  ARPACK libraries:              $ARPACK_LIBS
3057  BLAS libraries:                $BLAS_LIBS
3058  BZ2 CPPFLAGS:                  $BZ2_CPPFLAGS
3059  BZ2 LDFLAGS:                   $BZ2_LDFLAGS
3060  BZ2 libraries:                 $BZ2_LIBS
3061  CAMD CPPFLAGS:                 $CAMD_CPPFLAGS
3062  CAMD LDFLAGS:                  $CAMD_LDFLAGS
3063  CAMD libraries:                $CAMD_LIBS
3064  CARBON libraries:              $CARBON_LIBS
3065  CCOLAMD CPPFLAGS:              $CCOLAMD_CPPFLAGS
3066  CCOLAMD LDFLAGS:               $CCOLAMD_LDFLAGS
3067  CCOLAMD libraries:             $CCOLAMD_LIBS
3068  CHOLMOD CPPFLAGS:              $CHOLMOD_CPPFLAGS
3069  CHOLMOD LDFLAGS:               $CHOLMOD_LDFLAGS
3070  CHOLMOD libraries:             $CHOLMOD_LIBS
3071  COLAMD CPPFLAGS:               $COLAMD_CPPFLAGS
3072  COLAMD LDFLAGS:                $COLAMD_LDFLAGS
3073  COLAMD libraries:              $COLAMD_LIBS
3074  CURL CPPFLAGS:                 $CURL_CPPFLAGS
3075  CURL LDFLAGS:                  $CURL_LDFLAGS
3076  CURL libraries:                $CURL_LIBS
3077  CXSPARSE CPPFLAGS:             $CXSPARSE_CPPFLAGS
3078  CXSPARSE LDFLAGS:              $CXSPARSE_LDFLAGS
3079  CXSPARSE libraries:            $CXSPARSE_LIBS
3080  DL libraries:                  $DL_LIBS
3081  FFTW3 CPPFLAGS:                $FFTW3_CPPFLAGS
3082  FFTW3 LDFLAGS:                 $FFTW3_LDFLAGS
3083  FFTW3 libraries:               $FFTW3_LIBS
3084  FFTW3F CPPFLAGS:               $FFTW3F_CPPFLAGS
3085  FFTW3F LDFLAGS:                $FFTW3F_LDFLAGS
3086  FFTW3F libraries:              $FFTW3F_LIBS
3087  FLTK CPPFLAGS:                 $FLTK_CPPFLAGS
3088  FLTK LDFLAGS:                  $FLTK_LDFLAGS
3089  FLTK libraries:                $FLTK_LIBS
3090  fontconfig CPPFLAGS:           $FONTCONFIG_CPPFLAGS
3091  fontconfig libraries:          $FONTCONFIG_LIBS
3092  FreeType2 CPPFLAGS:            $FT2_CPPFLAGS
3093  FreeType2 libraries:           $FT2_LIBS
3094  GLPK CPPFLAGS:                 $GLPK_CPPFLAGS
3095  GLPK LDFLAGS:                  $GLPK_LDFLAGS
3096  GLPK libraries:                $GLPK_LIBS
3097  HDF5 CPPFLAGS:                 $HDF5_CPPFLAGS
3098  HDF5 LDFLAGS:                  $HDF5_LDFLAGS
3099  HDF5 libraries:                $HDF5_LIBS
3100  Java home:                     $JAVA_HOME
3101  Java JVM path:                 $JAVA_LDPATH
3102  Java CPPFLAGS:                 $JAVA_CPPFLAGS
3103  Java libraries:                $JAVA_LIBS
3104  KLU CPPFLAGS:                  $KLU_CPPFLAGS
3105  KLU LDFLAGS:                   $KLU_LDFLAGS
3106  KLU libraries:                 $KLU_LIBS
3107  LAPACK libraries:              $LAPACK_LIBS
3108  LLVM CPPFLAGS:                 $LLVM_CPPFLAGS
3109  LLVM LDFLAGS:                  $LLVM_LDFLAGS
3110  LLVM libraries:                $LLVM_LIBS
3111  Magick++ CPPFLAGS:             $MAGICK_CPPFLAGS
3112  Magick++ LDFLAGS:              $MAGICK_LDFLAGS
3113  Magick++ libraries:            $MAGICK_LIBS
3114  OpenGL libraries:              $OPENGL_LIBS
3115  PCRE CPPFLAGS:                 $PCRE_CPPFLAGS
3116  PCRE LDFLAGS:                  $PCRE_LDFLAGS
3117  PCRE libraries:                $PCRE_LIBS
3118  PortAudio CPPFLAGS:            $PORTAUDIO_CPPFLAGS
3119  PortAudio LDFLAGS:             $PORTAUDIO_LDFLAGS
3120  PortAudio libraries:           $PORTAUDIO_LIBS
3121  PTHREAD flags:                 $PTHREAD_CFLAGS
3122  PTHREAD libraries:             $PTHREAD_LIBS
3123  QHULL CPPFLAGS:                $QHULL_CPPFLAGS
3124  QHULL LDFLAGS:                 $QHULL_LDFLAGS
3125  QHULL libraries:               $QHULL_LIBS
3126  QRUPDATE CPPFLAGS:             $QRUPDATE_CPPFLAGS
3127  QRUPDATE LDFLAGS:              $QRUPDATE_LDFLAGS
3128  QRUPDATE libraries:            $QRUPDATE_LIBS
3129  Qt CPPFLAGS:                   $QT_CPPFLAGS
3130  Qt LDFLAGS:                    $QT_LDFLAGS
3131  Qt GUI libraries:              $QT_LIBS
3132  Qt OpenGL libraries:           $QT_OPENGL_LIBS
3133  Qt moc:                        $MOC $MOCFLAGS
3134  Qt uic:                        $UIC $UICFLAGS
3135  Qt rcc:                        $RCC $RCCFLAGS
3136  Qt lrelease:                   $LRELEASE $LRELEASEFLAGS
3137  Qt qcollectiongenerator:       $QCOLLECTIONGENERATOR $QCOLLECTIONGENERATORFLAGS
3138  Qt qhelpgenerator:             $QHELPGENERATOR $QHELPGENERATORFLAGS
3139  READLINE libraries:            $READLINE_LIBS
3140  Sndfile CPPFLAGS:              $SNDFILE_CPPFLAGS
3141  Sndfile LDFLAGS:               $SNDFILE_LDFLAGS
3142  Sndfile libraries:             $SNDFILE_LIBS
3143  SuiteSparse config libraries:  $SUITESPARSECONFIG_LIBS
3144  SUNDIALS IDA CPPFLAGS:         $SUNDIALS_IDA_CPPFLAGS
3145  SUNDIALS IDA LDFLAGS:          $SUNDIALS_IDA_LDFLAGS
3146  SUNDIALS IDA libraries:        $SUNDIALS_IDA_LIBS
3147  SUNDIALS NVECTOR CPPFLAGS:     $SUNDIALS_NVECSERIAL_CPPFLAGS
3148  SUNDIALS NVECTOR LDFLAGS:      $SUNDIALS_NVECSERIAL_LDFLAGS
3149  SUNDIALS NVECTOR libraries:    $SUNDIALS_NVECSERIAL_LIBS
3150  SUNLINSOL KLU CPPFLAGS:        $SUNDIALS_SUNLINSOLKLU_CPPFLAGS
3151  SUNLINSOL KLU LDFLAGS:         $SUNDIALS_SUNLINSOLKLU_LDFLAGS
3152  SUNLINSOL KLU libraries:       $SUNDIALS_SUNLINSOLKLU_LIBS
3153  TERM libraries:                $TERM_LIBS
3154  UMFPACK CPPFLAGS:              $UMFPACK_CPPFLAGS
3155  UMFPACK LDFLAGS:               $UMFPACK_LDFLAGS
3156  UMFPACK libraries:             $UMFPACK_LIBS
3157  X11 include flags:             $X11_INCFLAGS
3158  X11 libraries:                 $X11_LIBS
3159  Z CPPFLAGS:                    $Z_CPPFLAGS
3160  Z LDFLAGS:                     $Z_LDFLAGS
3161  Z libraries:                   $Z_LIBS
3162
3163  Default pager:                 $DEFAULT_PAGER
3164  gnuplot:                       $GNUPLOT_BINARY
3165
3166  Build Octave Qt GUI:                  $BUILD_QT_SUMMARY_MSG
3167  JIT compiler for loops:               $ENABLE_JIT
3168  Build Java interface:                 $build_java
3169  Build static libraries:               $STATIC_LIBS
3170  Build shared libraries:               $SHARED_LIBS
3171  Dynamic Linking API:                  $DL_API_MSG
3172  Include support for GNU readline:     $USE_READLINE
3173  Use push parser in command line REPL: $ENABLE_COMMAND_LINE_PUSH_PARSER
3174  64-bit array dims and indexing:       $ENABLE_64
3175  64-bit BLAS array dims and indexing:  $HAVE_64_BIT_BLAS
3176  OpenMP SMP multithreading:            $ENABLE_OPENMP
3177  Truncate intermediate FP results:     $ENABLE_FLOAT_TRUNCATE
3178  Build cross tools:                    $cross_tools
3179  Build docs:                           $ENABLE_DOCS
3180])
3181
3182warn_msg_printed=false
3183
3184OCTAVE_CONFIGURE_WARNING_SUMMARY
3185
3186if test $opengl_graphics = no; then
3187  AC_MSG_WARN([])
3188  AC_MSG_WARN([The libraries needed for OpenGL graphics were not found.])
3189  AC_MSG_WARN([Creating plots is still possible if gnuplot is installed.])
3190  warn_msg_printed=true
3191fi
3192
3193if $warn_msg_printed; then
3194  AC_MSG_NOTICE([])
3195  AC_MSG_NOTICE([NOTE: Libraries or auxiliary programs may be skipped if they are not found])
3196  AC_MSG_NOTICE([NOTE: OR if they are missing required features on your system.])
3197fi
3198
3199### End of configure.
3200