Merge lp:~mtmiller/ubuntu/wily/octave/fix-build-and-break into lp:ubuntu/wily-proposed/octave

Proposed by Mike Miller
Status: Merged
Merge reported by: Sebastien Bacher
Merged at revision: not available
Proposed branch: lp:~mtmiller/ubuntu/wily/octave/fix-build-and-break
Merge into: lp:ubuntu/wily-proposed/octave
Diff against target: 5977 lines (+5836/-39)
9 files modified
.pc/applied-patches (+1/-0)
.pc/qt-requires-opengl.patch/configure.ac (+3228/-0)
.pc/qt-requires-opengl.patch/m4/acinclude.m4 (+2448/-0)
configure.ac (+6/-0)
debian/changelog (+8/-0)
debian/control (+23/-39)
debian/patches/qt-requires-opengl.patch (+75/-0)
debian/patches/series (+1/-0)
m4/acinclude.m4 (+46/-0)
To merge this branch: bzr merge lp:~mtmiller/ubuntu/wily/octave/fix-build-and-break
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email: mp+266672@code.launchpad.net

This proposal supersedes a proposal from 2015-08-02.

Description of the change

This branch includes two changes necessary for a functional Octave 4.0.0 in wily. The first change fixes a build failure on the armhf architecture using a patch I am proposing for inclusion upstream. The patch disables building the Qt components of Octave when Qt was configured for GLES, as it appears to be on Ubuntu armhf. The second change updates the list of Breaks to the versions currently found in wily (some of which are already good for Octave 4.0, some of which will need to be rebuilt).

I've done a test build of the qt-requires-opengl.patch in my PPA (https://launchpad.net/~mtmiller/+archive/ubuntu/octave/+packages). The armhf build hasn't completed yet but it at least got past the point where the error appeared in 4.0.0-3.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Seems like the patch has been merged in https://launchpad.net/ubuntu/+source/octave/4.0.0-3ubuntu1, can you please resubmit the other change if it still applies? thanks

review: Approve
Revision history for this message
Mike Miller (mtmiller) wrote :

Thanks for your review anyway. It's easier for folks with upload rights to take care of these changes, looks like both of my changes have been taken care of by others now. Thanks for your hard work!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.pc/applied-patches'
--- .pc/applied-patches 2015-07-18 14:20:22 +0000
+++ .pc/applied-patches 2015-08-02 19:51:25 +0000
@@ -9,3 +9,4 @@
9hdf5-mkoctfile.patch9hdf5-mkoctfile.patch
10xbackslash-texinfo.patch10xbackslash-texinfo.patch
11dont-use-included-texinfo-texmfcnf.patch11dont-use-included-texinfo-texmfcnf.patch
12qt-requires-opengl.patch
1213
=== added directory '.pc/qt-requires-opengl.patch'
=== added file '.pc/qt-requires-opengl.patch/configure.ac'
--- .pc/qt-requires-opengl.patch/configure.ac 1970-01-01 00:00:00 +0000
+++ .pc/qt-requires-opengl.patch/configure.ac 2015-08-02 19:51:25 +0000
@@ -0,0 +1,3228 @@
1dnl Process this file with autoconf to produce a configure script.
2dnl
3dnl Copyright (C) 1993-2015 John W. Eaton
4###
5### This file is part of Octave.
6###
7### Octave is free software; you can redistribute it and/or modify it
8### under the terms of the GNU General Public License as published by the
9### Free Software Foundation; either version 3 of the License, or (at
10### your option) any later version.
11###
12### Octave is distributed in the hope that it will be useful, but WITHOUT
13### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15### for more details.
16###
17### You should have received a copy of the GNU General Public License
18### along with Octave; see the file COPYING. If not, see
19### <http://www.gnu.org/licenses/>.
20
21AC_PREREQ([2.63])
22AC_INIT([GNU Octave], [4.0.0], [http://octave.org/bugs.html], [octave])
23
24dnl Note that the version number is duplicated here and in AC_INIT
25dnl because AC_INIT requires it to be static, not computed from
26dnl shell variables.
27OCTAVE_MAJOR_VERSION=4
28OCTAVE_MINOR_VERSION=0
29OCTAVE_PATCH_VERSION=0
30
31dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg
32OCTAVE_VERSION="$PACKAGE_VERSION"
33
34OCTAVE_COPYRIGHT="Copyright (C) 2015 John W. Eaton and others."
35
36OCTAVE_RELEASE_DATE="2015-05-26"
37
38## The "API version" is used as a way of checking that interfaces in the
39## liboctave and libinterp libraries haven't changed in a backwardly
40## incompatible way when loading .oct files. A better way to do that is
41## with library versioning, but not all systems support that.
42## NOTE: This macro will be removed in a future version of Octave. If
43## you insist on checking for features using a version number, use the
44## OCTAVE_MAJOR_VERSION, OCTAVE_MINOR_VERSION, and
45## OCTAVE_PATCH_VERSION macros instead.
46## FIXME: Since we also set libtool versions for liboctave and
47## libinterp, perhaps we should be computing the "api version" from
48## those versions numbers in some way instead of setting it
49## independently here.
50OCTAVE_API_VERSION="api-v50+"
51
52AC_SUBST(OCTAVE_MAJOR_VERSION)
53AC_SUBST(OCTAVE_MINOR_VERSION)
54AC_SUBST(OCTAVE_PATCH_VERSION)
55AC_SUBST(OCTAVE_VERSION)
56AC_SUBST(OCTAVE_COPYRIGHT)
57AC_SUBST(OCTAVE_RELEASE_DATE)
58AC_SUBST(OCTAVE_API_VERSION)
59
60dnl FIXME: We should auto-insert the Mercurial changeset ID into the
61dnl AC_REVISION field whenever configure.ac is modified.
62dnl AC_REVISION($Revision: 1.603 $)
63AC_CONFIG_SRCDIR([libinterp/octave.cc])
64AC_CONFIG_HEADERS([config.h:config.in.h])
65AC_CONFIG_AUX_DIR([build-aux])
66AC_CONFIG_MACRO_DIR([m4])
67
68AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability -Wno-override tar-ustar subdir-objects])
69
70## Add the option to enable silent rules and make silent rules the
71## default behavior. Available since Automake 1.11 and included by
72## default starting with Automake 1.13.
73AM_SILENT_RULES([yes])
74
75OCTAVE_CANONICAL_HOST
76
77AC_DEFINE(OCTAVE_SOURCE, 1, [Define to 1 if this is Octave.])
78
79AC_USE_SYSTEM_EXTENSIONS
80
81### Make configure args available for other uses.
82
83config_opts=$ac_configure_args
84AC_SUBST(config_opts)
85
86### Set default file locations
87
88OCTAVE_SET_DEFAULT([octlibdir], '$(libdir)/octave/$(version)')
89OCTAVE_SET_DEFAULT([archlibdir],
90 '$(libexecdir)/octave/$(version)/exec/$(canonical_host_type)')
91OCTAVE_SET_DEFAULT([localarchlibdir],
92 '$(libexecdir)/octave/site/exec/$(canonical_host_type)')
93OCTAVE_SET_DEFAULT([localapiarchlibdir],
94 '$(libexecdir)/octave/$(api_version)/site/exec/$(canonical_host_type)')
95OCTAVE_SET_DEFAULT([localverarchlibdir],
96 '$(libexecdir)/octave/$(version)/site/exec/$(canonical_host_type)')
97OCTAVE_SET_DEFAULT([octfiledir],
98 '$(libdir)/octave/$(version)/oct/$(canonical_host_type)')
99OCTAVE_SET_DEFAULT([localoctfiledir],
100 '$(libdir)/octave/site/oct/$(canonical_host_type)')
101OCTAVE_SET_DEFAULT([localapioctfiledir],
102 '$(libdir)/octave/site/oct/$(api_version)/$(canonical_host_type)')
103OCTAVE_SET_DEFAULT([localveroctfiledir],
104 '$(libdir)/octave/$(version)/site/oct/$(canonical_host_type)')
105OCTAVE_SET_DEFAULT([octincludedir], '$(includedir)/octave-$(version)/octave')
106OCTAVE_SET_DEFAULT([fcnfiledir], '$(datadir)/octave/$(version)/m')
107OCTAVE_SET_DEFAULT([localfcnfiledir], '$(datadir)/octave/site/m')
108OCTAVE_SET_DEFAULT([localapifcnfiledir],
109 '$(datadir)/octave/site/$(api_version)/m')
110OCTAVE_SET_DEFAULT([localverfcnfiledir], '$(datadir)/octave/$(version)/site/m')
111OCTAVE_SET_DEFAULT([octetcdir], '$(datadir)/octave/$(version)/etc')
112OCTAVE_SET_DEFAULT([octlocaledir], '$(datadir)/octave/$(version)/locale')
113OCTAVE_SET_DEFAULT([doc_cache_file], '$(octetcdir)/doc-cache')
114OCTAVE_SET_DEFAULT([octtestsdir], '$(octetcdir)/tests')
115OCTAVE_SET_DEFAULT([texi_macros_file], '$(octetcdir)/macros.texi')
116OCTAVE_SET_DEFAULT([imagedir], '$(datadir)/octave/$(version)/imagelib')
117OCTAVE_SET_DEFAULT([octdatadir], '$(datadir)/octave/$(version)/data')
118OCTAVE_SET_DEFAULT([man1dir], '$(mandir)/man1')
119OCTAVE_SET_DEFAULT([man1ext], '.1')
120OCTAVE_SET_DEFAULT([infofile], '$(infodir)/octave.info')
121
122### Check for programs used in building, installing, and running Octave.
123
124## Programs used in configuring Octave.
125## Find pkg-config executable (sets $PKG_CONFIG)
126PKG_PROG_PKG_CONFIG
127
128## Programs used in Makefiles.
129AC_PROG_AWK
130AC_PROG_GREP
131OCTAVE_PROG_FIND
132OCTAVE_PROG_SED
133OCTAVE_PROG_PERL
134
135## Programs used to build parts of Octave.
136OCTAVE_PROG_GPERF
137
138OCTAVE_PROG_FLEX
139AC_SUBST([LEX_OUTPUT_ROOT], [lex.octave_])
140
141OCTAVE_PROG_BISON
142
143OCTAVE_PROG_MAKEINFO
144OCTAVE_PROG_TEXI2DVI
145OCTAVE_PROG_TEXI2PDF
146
147## Programs used when installing Octave.
148AC_PROG_LN_S
149AC_PROG_MKDIR_P
150
151AC_PROG_INSTALL
152INSTALL_SCRIPT='${INSTALL}'
153AC_SUBST(INSTALL_SCRIPT)
154
155OCTAVE_PROG_DESKTOP_FILE_INSTALL
156
157## Programs used when running Octave
158OCTAVE_PROG_GHOSTSCRIPT
159OCTAVE_PROG_GNUPLOT
160OCTAVE_PROG_PAGER
161OCTAVE_PROG_PYTHON
162
163## Programs used to generate icons file formats.
164OCTAVE_PROG_ICOTOOL
165OCTAVE_PROG_RSVG_CONVERT
166AM_CONDITIONAL([AMCOND_HAVE_ICON_TOOLS],
167 [test -n "$ICOTOOL" && test -n "$RSVG_CONVERT"])
168
169### Default terminal font for the GUI
170case $host_os in
171 mingw* | msdosmsvc)
172 DEFAULT_TERMINAL_FONT="Lucida Console"
173 ;;
174 *)
175 DEFAULT_TERMINAL_FONT="Courier"
176 ;;
177esac
178DEFAULT_TERMINAL_FONT_SIZE=10
179AC_SUBST(DEFAULT_TERMINAL_FONT)
180AC_SUBST(DEFAULT_TERMINAL_FONT_SIZE)
181
182### Path separator.
183
184sepchar=':'
185AC_ARG_WITH([sepchar],
186 [AS_HELP_STRING([--with-sepchar=<char>],
187 [use <char> as the path separation character])])
188case $with_sepchar in
189 yes | "")
190 case $host_os in
191 mingw* | msdosmsvc)
192 sepchar=';' ;;
193 esac
194 ;;
195 no)
196 AC_MSG_ERROR([You are required to define a path separation character])
197 ;;
198 *)
199 sepchar=$with_sepchar
200 ;;
201esac
202AC_SUBST(sepchar)
203AC_DEFINE_UNQUOTED(SEPCHAR, ['$sepchar'],
204 [Define this to be the path separator for your system, as a character constant.])
205AC_DEFINE_UNQUOTED(SEPCHAR_STR, ["$sepchar"],
206 [Define this to be the path separator for your system, as a string.])
207
208### Define the path to the shell on the host system. Most systems will
209### ensure /bin/sh is the default shell so this can be safely ignored by
210### almost everyone. However, when building for Android, for example,
211### this will need to be set.
212SHELL_PATH=/bin/sh
213AC_ARG_WITH([shell],
214 [AS_HELP_STRING([--with-shell=SHELL],
215 [use SHELL as the shell interpreter (default: /bin/sh)])])
216case $with_shell in
217 no)
218 AC_MSG_ERROR([A shell interpreter is required])
219 ;;
220 yes | "")
221 ;;
222 *)
223 SHELL_PATH=$with_shell
224 ;;
225esac
226AC_DEFINE_UNQUOTED([SHELL_PATH], ["$SHELL_PATH"],
227 [Define this to be the path to the shell command interpreter.])
228
229### Enable bounds checking on element references within Octave's array and
230### matrix classes. This slows down some operations a bit, so it is turned off
231### by default.
232
233BOUNDS_CHECKING=no
234AC_ARG_ENABLE([bounds-check],
235 [AS_HELP_STRING([--enable-bounds-check],
236 [enable bounds checking for indexing in internal array classes])],
237 [if test "$enableval" = yes; then BOUNDS_CHECKING=yes; fi], [])
238if test $BOUNDS_CHECKING = yes; then
239 AC_DEFINE(BOUNDS_CHECKING, 1, [Define to 1 to use internal bounds checking.])
240fi
241
242### Use atomic operations for internal reference counting. This is required
243### for thread-safe behavior (Qt Handles) but incurs a significant slowdown.
244### Enabled by default until a higher performing solution can be found.
245
246USE_ATOMIC_REFCOUNT=yes
247AC_ARG_ENABLE([atomic-refcount],
248 [AS_HELP_STRING([--disable-atomic-refcount],
249 [Do not use atomic operations for internal reference counting. This option is required for thread-safe behavior as used in the GUI's Qt plotting toolkit. Performance for CLI-only builds is improved by disabling this feature.])],
250 [if test "$enableval" = no; then USE_ATOMIC_REFCOUNT=no; fi], [])
251if test $USE_ATOMIC_REFCOUNT = yes; then
252 AC_DEFINE(USE_ATOMIC_REFCOUNT, 1,
253 [Define to 1 to use atomic operations for reference counting.])
254fi
255
256### Disable running Make in the doc directory.
257### This is useful, for example, when building Octave on systems without TeX.
258
259DOCDIR=doc
260AC_ARG_ENABLE([docs],
261 [AS_HELP_STRING([--disable-docs], [don't build documentation files])],
262 [if test "$enableval" = no; then
263 DOCDIR=
264 warn_docs="building documentation disabled; make dist will fail"
265 OCTAVE_CONFIGURE_WARNING([warn_docs])
266 fi],
267 [])
268AC_SUBST(DOCDIR)
269
270### If possible, use a 64-bit integer type for array dimensions and indexing.
271
272USE_64_BIT_IDX_T=no
273OCTAVE_IDX_TYPE=int
274AC_ARG_ENABLE(64,
275 [AS_HELP_STRING([--enable-64],
276 [(EXPERIMENTAL) use 64-bit integers for array dimensions and indexing])],
277 [if test "$enableval" = yes; then USE_64_BIT_IDX_T=yes; fi], [])
278if test $USE_64_BIT_IDX_T = yes; then
279 AC_CHECK_SIZEOF([void *])
280 AC_CHECK_SIZEOF([int])
281 AC_CHECK_SIZEOF([long])
282 AC_CHECK_SIZEOF([int64_t])
283 if test $ac_cv_sizeof_void_p -eq 8; then
284 OCTAVE_IDX_TYPE=int64_t
285 else
286 warn_64_bit="pointers are not 64-bits wide; disabling 64-bit features"
287 OCTAVE_CONFIGURE_WARNING([warn_64_bit])
288 USE_64_BIT_IDX_T=no
289 fi
290fi
291AC_SUBST(OCTAVE_IDX_TYPE)
292AC_DEFINE_UNQUOTED(OCTAVE_IDX_TYPE, [$OCTAVE_IDX_TYPE],
293 [Define to the type of octave_idx_type (64 or 32 bit signed integer).])
294if test $USE_64_BIT_IDX_T = yes; then
295 AC_DEFINE(USE_64_BIT_IDX_T, 1,
296 [Define to 1 if using 64-bit integers for array dimensions and indexing.])
297fi
298AC_SUBST(USE_64_BIT_IDX_T)
299
300### It seems that there are some broken inline assembly functions in
301### the GNU libc. Since I'm not sure how to test whether we are using
302### GNU libc, just disable them for all platforms.
303
304AC_MSG_NOTICE([defining __NO_MATH_INLINES avoids buggy GNU libc exp function])
305AC_DEFINE(__NO_MATH_INLINES, 1,
306 [Define to 1 if your version of GNU libc has buggy inline assembly code for math functions like exp.])
307
308### Determine which C++ compiler to use (we expect to find g++).
309
310AC_PROG_CXX
311AC_PROG_CXXCPP
312
313### Determine which C compiler to use (we expect to find gcc).
314
315AC_PROG_CC
316AC_PROG_CPP
317AC_PROG_GCC_TRADITIONAL
318
319## Save and restore CFLAGS and CXXFLAGS globally. These variables
320## are for users, so we shouldn't be touching them. Instead, we should
321## set the corresponding AM_ flags (currently by way of the XTRA_ variables).
322## However, for the duration of the configure script, we may set CFLAGS
323## and CXXFLAGS so that subsequent tests succeed. Temporary settings
324## like this are currently done for pthreads and openmp, for example.
325original_octave_configure_CFLAGS="$CFLAGS"
326original_octave_configure_CXXFLAGS="$CXXFLAGS"
327
328## Check for MSVC
329have_msvc=no
330case $host_os in
331 msdosmsvc)
332 have_msvc=yes
333 ;;
334 mingw*)
335 AC_MSG_CHECKING([for MSVC compiler])
336 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
337 #ifndef _MSC_VER
338 #error "Not MSVC compiler"
339 #endif
340 ]])],
341 have_msvc=yes, have_msvc=no)
342 AC_MSG_RESULT([$have_msvc])
343 ;;
344esac
345
346### gnulib initialization: part 1
347### Must take place immediately after a compiler is determined
348
349gl_EARLY
350
351### Check version number when using gcc.
352
353GCC_VERSION=
354if test "$GCC" = yes; then
355 AC_MSG_CHECKING([C compiler version number])
356 gcc_version=`$CC -v 2>&1 | $GREP "^.*gcc version" | \
357 $SED -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'`
358
359 AX_COMPARE_VERSION([$gcc_version], [lt], [3],
360 [warn_gcc_version="gcc version $gcc_version is likely to cause problems"
361 OCTAVE_CONFIGURE_WARNING([warn_gcc_version])])
362
363 GCC_VERSION=$gcc_version
364 AC_MSG_RESULT([$GCC_VERSION])
365fi
366AC_SUBST(GCC_VERSION)
367
368### Check version number when using g++ .
369### It might be different from the gcc version number.
370
371GXX_VERSION=
372if test "$GXX" = yes; then
373 AC_MSG_CHECKING([C++ compiler version number])
374 gxx_version=`$CXX -v 2>&1 | $GREP "^.*g.. version" | \
375 $SED -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'`
376
377 AX_COMPARE_VERSION([$gxx_version], [lt], [4.1],
378 [warn_gxx_version="g++ version $gxx_version is likely to cause problems"
379 OCTAVE_CONFIGURE_WARNING([warn_gxx_version])])
380
381 GXX_VERSION=$gxx_version
382 AC_MSG_RESULT([$GXX_VERSION])
383fi
384AC_SUBST(GXX_VERSION)
385
386OCTAVE_CHECK_BROKEN_STL_ALGO_H
387AM_CONDITIONAL([AMCOND_HAVE_BROKEN_STL_ALGO_H],
388 [test $octave_cv_broken_stl_algo_h = yes])
389
390if test $octave_cv_broken_stl_algo_h = yes; then
391 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."
392 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
393fi
394
395### Determine the compiler flag necessary to create dependencies
396
397## Assume GCC.
398INCLUDE_DEPS=yes
399DEPEND_FLAGS="-M"
400DEPEND_EXTRA_SED_PATTERN=""
401if test "$GCC" != yes; then
402 case $canonical_host_type in
403 sparc-sun-solaris2* | i386-pc-solaris2*)
404 DEPEND_FLAGS="-xM1"
405 DEPEND_EXTRA_SED_PATTERN="-e '/\/opt\/SUNWspro/d'"
406 ;;
407 *-*-msdosmsvc)
408 ;;
409 *-*-mingw*)
410 if test $have_msvc = no; then
411 INCLUDE_DEPS=no
412 fi
413 ;;
414 *)
415 INCLUDE_DEPS=no
416 ;;
417 esac
418fi
419AC_SUBST(INCLUDE_DEPS)
420AC_SUBST(DEPEND_FLAGS)
421AC_SUBST(DEPEND_EXTRA_SED_PATTERN)
422
423### Check for pthread library
424
425AX_PTHREAD
426## Include pthread libs and flags early in case other tests need them.
427## They seem to be required for the OpenGL tests on Debian systems.
428LIBS="$PTHREAD_LIBS $LIBS"
429XTRA_CFLAGS="$XTRA_CFLAGS $PTHREAD_CFLAGS"
430XTRA_CXXFLAGS="$XTRA_CXXFLAGS $PTHREAD_CFLAGS"
431## Set these for any other tests that may require them. They will be
432## reset before output files are generated.
433CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
434CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
435
436### Test whether the compiler supports OpenMP. This is enabled by default
437### now to allow the option of using OpenMP in loadable modules.
438
439USE_OPENMP=no
440check_for_openmp=yes
441AC_ARG_ENABLE([openmp],
442 [AS_HELP_STRING([--disable-openmp],
443 [disable OpenMP SMP multi-threading])],
444 [if test "$enableval" = no; then check_for_openmp=no; fi], [])
445if test $check_for_openmp = yes; then
446 AC_LANG_PUSH(C)
447 AX_OPENMP([XTRA_CFLAGS="$XTRA_CFLAGS $OPENMP_CFLAGS"; USE_OPENMP=yes], [])
448 AC_LANG_POP(C)
449 AC_LANG_PUSH(C++)
450 AX_OPENMP([XTRA_CXXFLAGS="$XTRA_CXXFLAGS $OPENMP_CXXFLAGS"; USE_OPENMP=yes], [])
451 AC_LANG_POP(C++)
452fi
453dnl Define here since it is skipped if the first argument to
454dnl AX_OPENMP is not empty.
455if test $USE_OPENMP = yes; then
456 AC_DEFINE(HAVE_OPENMP, 1, [Define if OpenMP is enabled])
457fi
458## Set these for any other tests that may require them. They will be
459## reset before output files are generated.
460CFLAGS="$CFLAGS $OPENMP_CFLAGS"
461CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
462
463### When compiling math for x87, problems may arise in some code comparing
464### floating-point intermediate results. The root cause is the extra precision
465### (~80 bits) of x87 co-processor registers versus the IEEE standard 64 bits.
466### Generally, storing the result in a local volatile variable forces a
467### truncation back to 64 bits, but it also degrades performance.
468### However, this performance degradation is very minimal, if indeed measurable.
469### Therefore, it has been enabled for all platforms and compilers.
470### Reported bugs indicate that --enable-float-truncate is required for MinGW
471### and Cygwin platforms and for GCC compilers >= 5.0. It should not be
472### necessary for non-x87 targets or when using modern SSE math.
473ac_float_truncate=volatile
474AC_ARG_ENABLE([float-truncate],
475 [AS_HELP_STRING([--disable-float-truncate],
476 [truncate intermediate FP results])],
477 [if test "$enableval" = no; then
478 ac_float_truncate=
479 fi],
480 [])
481
482AC_DEFINE_UNQUOTED(FLOAT_TRUNCATE, [$ac_float_truncate],
483 [Define to volatile if you need to truncate intermediate FP results.])
484
485### Determine extra CFLAGS that may be necessary for Octave.
486
487## On Intel systems with gcc, we may need to compile with -mieee-fp
488## to get full support for IEEE floating point.
489##
490## On Alpha/OSF systems, we need -mieee.
491
492ieee_fp_flag=
493case $canonical_host_type in
494 i[[3456789]]86-*-*)
495 if test "$GCC" = yes; then
496 OCTAVE_CC_FLAG([-mieee-fp], [
497 ieee_fp_flag=-mieee-fp
498 XTRA_CFLAGS="$XTRA_CFLAGS -mieee-fp"
499 AC_MSG_NOTICE([adding -mieee-fp to XTRA_CFLAGS])])
500 fi
501 if test "$GXX" = yes; then
502 OCTAVE_CXX_FLAG([-mieee-fp], [
503 ieee_fp_flag=-mieee-fp
504 XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee-fp"
505 AC_MSG_NOTICE([adding -mieee-fp to XTRA_CXXFLAGS])])
506 fi
507 ;;
508 alpha*-*-*)
509 if test "$GCC" = yes; then
510 OCTAVE_CC_FLAG([-mieee], [
511 ieee_fp_flag=-mieee
512 XTRA_CFLAGS="$XTRA_CFLAGS -mieee"
513 AC_MSG_NOTICE([adding -mieee to XTRA_CFLAGS])])
514 else
515 OCTAVE_CC_FLAG([-ieee], [
516 ieee_fp_flag=-ieee
517 XTRA_CFLAGS="$XTRA_CFLAGS -ieee"
518 AC_MSG_NOTICE([adding -ieee to XTRA_CFLAGS])])
519 fi
520 if test "$GXX" = yes; then
521 OCTAVE_CXX_FLAG([-mieee], [
522 ieee_fp_flag=-mieee
523 XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee"
524 AC_MSG_NOTICE([adding -mieee to XTRA_CXXFLAGS])])
525 else
526 OCTAVE_CXX_FLAG([-ieee], [
527 ieee_fp_flag=-ieee
528 XTRA_CXXFLAGS="$XTRA_CXXFLAGS -ieee"
529 AC_MSG_NOTICE([adding -ieee to XTRA_CXXFLAGS])])
530 fi
531 ;;
532 *ibm-aix4*)
533 OCTAVE_CC_FLAG([-mminimal-toc], [
534 XTRA_CFLAGS="$XTRA_CFLAGS -mminimal-toc"])
535
536 OCTAVE_CXX_FLAG([-mminimal-toc], [
537 XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mminimal-toc"])
538 ;;
539esac
540
541AC_SUBST(XTRA_CFLAGS)
542AC_SUBST(XTRA_CXXFLAGS)
543
544### Defaults for cross compiling. BUILD_CC and BUILD_CXX are
545### the compilers that we use for building tools on the build system.
546### For now, we assume that the only cross compiling we can do is
547### with gcc on a Unixy system, but the dedicated hacker can override these.
548
549if test "$cross_compiling" = yes; then
550 BUILD_CC="gcc"
551 BUILD_CFLAGS="-O2 -g"
552 BUILD_CXX="g++"
553 BUILD_CXXFLAGS="-O2 -g"
554 BUILD_LDFLAGS=""
555 BUILD_EXEEXT=""
556else
557 BUILD_CC='$(CC)'
558 BUILD_CFLAGS='$(CFLAGS)'
559 BUILD_CXX='$(CXX)'
560 BUILD_CXXFLAGS='$(CXXFLAGS)'
561 BUILD_LDFLAGS='$(LDFLAGS)'
562 BUILD_EXEEXT='$(EXEEXT)'
563fi
564
565AC_ARG_VAR([BUILD_CC],
566 [build system C compiler (used if cross compiling)])
567AC_ARG_VAR([BUILD_CFLAGS],
568 [build system C compiler flags (used if cross compiling)])
569AC_ARG_VAR([BUILD_CXX],
570 [build system C++ compiler (used if cross compiling)])
571AC_ARG_VAR([BUILD_CXXFLAGS],
572 [build system C++ compiler flags (used if cross compiling)])
573AC_ARG_VAR([BUILD_LDFLAGS],
574 [build system C++ compiler link flags (used if cross compiling)])
575AC_ARG_VAR([BUILD_EXEEXT],
576 [build system executable extension (used if cross compiling)])
577
578
579### Look for math library. If found, this will add -lm to LIBS.
580
581dnl Keep this check before the check for the Fortran compiler,
582dnl in case -lm is needed to compile Fortran programs.
583AC_CHECK_LIB(m, sin)
584
585### Determine the Fortran compiler and how to invoke it
586
587## Default FFLAGS is -O.
588if test -z "$FFLAGS"; then
589 FFLAGS="-O"
590fi
591
592## Prefer gfortran, but the user's F77 environment variable will override.
593AC_PROG_F77([gfortran])
594if test -z "$F77"; then
595 ## No gfortran found, search for any other installed compiler.
596 AC_PROG_F77
597fi
598if test "$F77" = g77; then
599 AC_MSG_ERROR([g77 is not a supported Fortran compiler. Select another compiler by setting the environment variable F77 and re-running configure.])
600fi
601
602AC_MSG_CHECKING([whether a usable Fortran compiler was found])
603if test -n "$F77"; then
604 AC_MSG_RESULT(yes)
605else
606 AC_MSG_RESULT(no)
607 AC_MSG_ERROR([A Fortran compiler is required])
608fi
609
610## Determine calling conventions for Fortran compiler
611AC_F77_LIBRARY_LDFLAGS
612AC_F77_DUMMY_MAIN
613AC_F77_WRAPPERS
614
615F77_TOLOWER=yes
616F77_APPEND_UNDERSCORE=yes
617F77_APPEND_EXTRA_UNDERSCORE=yes
618
619case $ac_cv_f77_mangling in
620 "upper case") F77_TOLOWER=no ;;
621esac
622case $ac_cv_f77_mangling in
623 "no underscore") F77_APPEND_UNDERSCORE=no ;;
624esac
625case $ac_cv_f77_mangling in
626 "no extra underscore") F77_APPEND_EXTRA_UNDERSCORE=no ;;
627esac
628
629case $canonical_host_type in
630 i[[3456789]]86-*-*)
631 if test $ac_cv_f77_compiler_gnu = yes; then
632 OCTAVE_F77_FLAG([-mieee-fp])
633 fi
634 ;;
635 alpha*-*-*)
636 if test $ac_cv_f77_compiler_gnu = yes; then
637 OCTAVE_F77_FLAG([-mieee])
638 else
639 OCTAVE_F77_FLAG([-ieee])
640 OCTAVE_F77_FLAG([-fpe1])
641 fi
642 ;;
643 powerpc-apple-machten*)
644 FFLAGS=
645 ;;
646esac
647
648if test -n "$FFLAGS"; then
649 AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS])
650fi
651
652AC_SUBST(F77_TOLOWER)
653AC_SUBST(F77_APPEND_UNDERSCORE)
654AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE)
655
656if test -z "$F77"; then
657 AC_MSG_ERROR([in order to build Octave, you must have a compatible Fortran compiler or wrapper script for f2c that functions as a Fortran compiler installed and in your path. See the file INSTALL for more information.])
658fi
659
660OCTAVE_CHECK_FUNC_FORTRAN_ISNAN
661F77_ISNAN_MACRO=
662if test $octave_cv_func_fortran_isnan = no; then
663 AC_MSG_NOTICE([substituting ISNAN(X) with X.NE.X in Fortran sources])
664 F77_ISNAN_MACRO="s|ISNAN(\(@<:@^)@:>@*\))|(\1.NE.\1)|"
665fi
666AC_SUBST(F77_ISNAN_MACRO)
667
668OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER
669if test $octave_cv_sizeof_fortran_integer = no; then
670 if test $USE_64_BIT_IDX_T = yes; then
671 case $F77 in
672 *gfortran*)
673 case $F77_INTEGER_8_FLAG in
674 *-fdefault-integer-8*)
675 ;;
676 *)
677 case $FFLAGS in
678 *-fdefault-integer-8*)
679 AC_MSG_NOTICE([setting -fdefault-integer-8 in F77_INTEGER_8_FLAG instead of FFLAGS])
680 FFLAGS=`echo $FFLAGS | $SED 's/-fdefault-integer-8//g'`
681 F77_INTEGER_8_FLAG="-fdefault-integer-8"
682 ;;
683 *)
684 AC_MSG_NOTICE([adding -fdefault-integer-8 to F77_INTEGER_8_FLAG])
685 F77_INTEGER_8_FLAG="-fdefault-integer-8"
686 ## Invalidate the cache and try again.
687 $as_unset octave_cv_sizeof_fortran_integer
688 ;;
689 esac
690 ;;
691 esac
692 ;;
693 esac
694 if test -z "$octave_cv_sizeof_fortran_integer"; then
695 OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER
696 fi
697 if test $octave_cv_sizeof_fortran_integer = no; then
698 AC_MSG_ERROR([in order to build Octave with 64-bit indexing support your Fortran compiler must have an option for setting the default integer size to 8 bytes. See the file INSTALL for more information.])
699 fi
700 else
701 AC_MSG_ERROR([your Fortran compiler must have an option to make integers the same size as octave_idx_type ($OCTAVE_IDX_TYPE). See the file INSTALL for more information.])
702 fi
703fi
704AC_SUBST(F77_INTEGER_8_FLAG)
705
706OCTAVE_F77_FLAG([-ffloat-store], [
707 AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store])
708 F77_FLOAT_STORE_FLAG=-ffloat-store
709 AC_SUBST(F77_FLOAT_STORE_FLAG)
710])
711
712### Check for the Qhull library
713
714OCTAVE_CHECK_LIB(qhull, QHull,
715 [Qhull library not found. This will result in loss of functionality of some geometry functions.],
716 [libqhull/libqhull.h qhull/libqhull.h libqhull.h qhull/qhull.h qhull.h],
717 [qh_qhull], [], [],
718 [warn_qhull=
719 OCTAVE_CHECK_QHULL_VERSION
720 OCTAVE_CHECK_LIB_QHULL_OK(
721 [AC_DEFINE(HAVE_QHULL, 1, [Define to 1 if Qhull is available.])],
722 [warn_qhull="Qhull library found, but does not seem to work properly. This will result in loss of functionality of some geometry functions. Please try recompiling the library with -fno-strict-aliasing."])])
723
724### Check for PCRE regex library.
725
726PCRE_LIBS=
727
728pcre_fail_msg="to build Octave, you must have the PCRE library and header files installed"
729
730AC_CHECK_HEADERS([pcre.h pcre/pcre.h])
731
732AC_CACHE_CHECK([whether pcre.h defines the macros we need],
733 [ac_cv_pcre_h_macros_present],
734 [AC_EGREP_CPP([PCRE_HAS_MACROS_WE_NEED], [
735 #if defined (HAVE_PCRE_H)
736 # include <pcre.h>
737 #elif defined (HAVE_PCRE_PCRE_H)
738 # include <pcre/pcre.h>
739 #error "NO PCRE HEADER"
740 #endif
741 #if defined (PCRE_INFO_NAMECOUNT) \
742 && defined (PCRE_INFO_NAMEENTRYSIZE) \
743 && defined (PCRE_INFO_NAMETABLE)
744 PCRE_HAS_MACROS_WE_NEED
745 #endif],
746 ac_cv_pcre_h_macros_present=yes, ac_cv_pcre_h_macros_present=no)])
747
748if test $ac_cv_pcre_h_macros_present = yes; then
749 ## check for pcre-config, and if so, get build variables
750 AC_CHECK_PROG(HAVE_PCRE_CONFIG, pcre-config, [yes], [no])
751 if test $HAVE_PCRE_CONFIG = yes; then
752 PCRE_CPPFLAGS=`pcre-config --cflags`
753 PCRE_LIBS=`pcre-config --libs`
754 else
755 PCRE_LIBS="-lpcre"
756 fi
757 save_LIBS="$LIBS"
758 LIBS="$PCRE_LIBS $LIBS"
759 AC_CHECK_FUNCS([pcre_compile],
760 [AC_SUBST(PCRE_CPPFLAGS)
761 AC_SUBST(PCRE_LIBS)],
762 [AC_MSG_ERROR([$pcre_fail_msg])])
763 LIBS="$save_LIBS"
764else
765 AC_MSG_ERROR([$pcre_fail_msg])
766fi
767
768### Check for ZLIB library.
769
770OCTAVE_CHECK_LIB(z, ZLIB,
771 [ZLIB library not found. Octave will not be able to save or load compressed data files or HDF5 files.],
772 [zlib.h], [gzclearerr])
773
774### Also define HAVE_ZLIB if libz is found.
775if test -z "$warn_z"; then
776 AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if ZLIB is available.])
777fi
778
779 ### Check for the LLVM library
780
781build_jit=no
782AC_ARG_ENABLE([jit],
783 [AS_HELP_STRING([--enable-jit],
784 [(EXPERIMENTAL) enable JIT compiler])],
785 [if test "$enableval" = yes; then
786 build_jit=yes
787 fi],
788 [])
789
790LLVM_CXXFLAGS=
791LLVM_CPPFLAGS=
792LLVM_LDFLAGS=
793LLVM_LIBS=
794
795if test $build_jit = yes; then
796
797 ## Find llvm-config program from environment variable or by searching
798 AC_ARG_VAR([LLVM_CONFIG], [path to llvm-config utility])
799 AC_CHECK_PROG([LLVM_CONFIG], llvm-config, llvm-config, [])
800
801 if test -z "$LLVM_CONFIG"; then
802 warn_llvm="llvm-config utility not found. JIT compiler is disabled."
803 else
804 dnl Preset warning message in case compile fails
805 warn_llvm="LLVM was not found or is to old. JIT compiler is disabled."
806
807 save_CPPFLAGS="$CPPFLAGS"
808 save_CXXFLAGS="$CXXFLAGS"
809 save_LDFLAGS="$LDFLAGS"
810
811 ## Use -isystem if available because we don't want to see warnings in LLVM
812 LLVM_INCLUDE_FLAG=-I
813 OCTAVE_CC_FLAG([-isystem .], [
814 LLVM_INCLUDE_FLAG=-isystem
815 AC_MSG_NOTICE([using -isystem for LLVM headers])])
816
817 dnl Use -isystem so we don't get warnings from llvm headers
818 LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
819 LLVM_CXXFLAGS=
820 LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
821
822
823 LDFLAGS="$LDFLAGS $LLVM_LDFLAGS"
824 LLVM_SO=LLVM-`$LLVM_CONFIG --version`
825 AC_CHECK_LIB([$LLVM_SO], [LLVMBuildAdd], [LLVM_LIBS="-l$LLVM_SO"], [LLVM_LIBS=`$LLVM_CONFIG --libs`])
826
827 dnl
828 dnl Define some extra flags that LLVM requires in order to include headers.
829 dnl Ideally we should get these from llvm-config, but llvm-config isn't
830 dnl very helpful.
831 dnl
832 CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS"
833 CXXFLAGS="$LLVM_CXXFLAGS $CXXFLAGS"
834 AC_LANG_PUSH(C++)
835 AC_CHECK_HEADER([llvm/Support/TargetSelect.h], [warn_llvm=""])
836
837 have_function_h=no
838 AC_CHECK_HEADERS([llvm/IR/Function.h llvm/Function.h],
839 [have_function_h=yes; break])
840 if test $have_function_h = no; then
841 warn_llvm="Missing LLVM file Function.h. JIT compiler is disabled."
842 fi
843 have_irbuilder_h=no
844 AC_CHECK_HEADERS([llvm/Support/IRBuilder.h llvm/IR/IRBuilder.h \
845 llvm/IRBuilder.h], [have_irbuilder_h=yes; break])
846 if test $have_irbuilder_h = no; then
847 warn_llvm="Missing LLVM file IRBuilder.h. JIT compiler is disabled."
848 fi
849 have_llvm_data_h=no
850 AC_CHECK_HEADERS([llvm/Target/TargetData.h llvm/IR/DataLayout.h \
851 llvm/DataLayout.h], [have_llvm_data_h=yes; break])
852 if test $have_llvm_data_h = no; then
853 warn_llvm="Missing LLVM file TargetData.h. JIT compiler is disabled."
854 fi
855
856 AC_CHECK_HEADERS([llvm/IR/Verifier.h])
857
858 OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API
859 OCTAVE_LLVM_FUNCTION_ADDFNATTR_API
860 OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API
861 OCTAVE_LLVM_RAW_FD_OSTREAM_API
862 OCTAVE_LLVM_LEGACY_PASSMANAGER_API
863 AC_LANG_POP(C++)
864 CPPFLAGS="$save_CPPFLAGS"
865 CXXFLAGS="$save_CXXFLAGS"
866 LDFLAGS="$save_LDFLAGS"
867 fi
868
869 if test -z "$warn_llvm"; then
870 AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.])
871 else
872 build_jit=no
873 LLVM_CPPFLAGS=
874 LLVM_CXXFLAGS=
875 LLVM_LDFLAGS=
876 LLVM_LIBS=
877 OCTAVE_CONFIGURE_WARNING([warn_llvm])
878 fi
879dnl FIXME: Re-instate when JIT is enabled by default
880dnl else
881dnl ## JIT build disabled
882dnl warn_llvm="JIT compiler disabled, some performance loss for loops"
883dnl OCTAVE_CONFIGURE_WARNING([warn_llvm])
884fi
885
886AC_SUBST(LLVM_CPPFLAGS)
887AC_SUBST(LLVM_CXXFLAGS)
888AC_SUBST(LLVM_LDFLAGS)
889AC_SUBST(LLVM_LIBS)
890AM_CONDITIONAL([AMCOND_HAVE_LLVM], [test -z "$warn_llvm"])
891
892### Check for HDF5 library.
893
894save_CPPFLAGS="$CPPFLAGS"
895save_LIBS="$LIBS"
896CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
897LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
898OCTAVE_CHECK_LIB(hdf5, HDF5,
899 [HDF5 library not found. Octave will not be able to save or load HDF5 data files.],
900 [hdf5.h], [H5Gget_num_objs], [], [],
901 [warn_hdf5=
902 OCTAVE_CHECK_HDF5_HAS_VER_16_API
903 AC_DEFINE(HAVE_HDF5, 1,
904 [Define to 1 if HDF5 is available and newer than version 1.6.])
905 if test $have_msvc = yes; then
906 OCTAVE_CHECK_LIB_HDF5_DLL
907 fi
908 ])
909CPPFLAGS="$save_CPPFLAGS"
910LIBS="$save_LIBS"
911
912### Check for FFTW library. Default to Fortran FFTPACK if it is not available.
913
914## Check for FFTW header and library.
915OCTAVE_CHECK_LIB(fftw3, FFTW3,
916 [FFTW3 library not found. The slower FFTPACK library will be used instead.],
917 [fftw3.h], [fftw_plan_dft_1d])
918
919OCTAVE_CHECK_LIB(fftw3f, FFTW3F,
920 [FFTW3F library not found. The slower FFTPACK library will be used instead.],
921 [fftw3.h], [fftwf_plan_dft_1d])
922
923## Check command line for the option to disable multi-threaded FFTW
924build_fftw_threads=yes
925AC_ARG_ENABLE([fftw-threads],
926 [AS_HELP_STRING([--disable-fftw-threads],
927 [disable Multi-threaded FFTW])],
928 [if test "$enableval" = no; then
929 build_fftw_threads=no
930 fi],
931 [])
932
933## Octave is currently unable to use FFTW unless
934## both float and double versions are available.
935
936AM_CONDITIONAL([AMCOND_HAVE_FFTW],
937 [test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"])
938
939if test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"; then
940 AC_DEFINE(HAVE_FFTW, 1, [Define if you have both FFTW3 and FFTW3F libraries.])
941else
942 ## --without-fftw3 given, or one of the FFTW3 libs not installed.
943 ## Don't check for FFTW threads as this is now pointless.
944 build_fftw_threads=no
945fi
946
947## Check for the multithreaded FFTW library.
948## Fallback to singlethreaded if not found or disabled
949if test $build_fftw_threads = yes; then
950 OCTAVE_CHECK_FFTW_THREADS(fftw3, fftw_plan_with_nthreads)
951 OCTAVE_CHECK_FFTW_THREADS(fftw3f, fftwf_plan_with_nthreads)
952fi
953
954## Subdirectory of liboctave/cruft to build if FFTW is not found.
955FFT_DIR="fftpack"
956AC_SUBST(FFT_DIR)
957
958### Check for GLPK library and header.
959
960save_CPPFLAGS="$CPPFLAGS"
961save_LIBS="$LIBS"
962CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
963LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
964OCTAVE_CHECK_LIB(glpk, GLPK,
965 [GLPK library not found. The glpk function for solving linear programs will be disabled.],
966 [glpk/glpk.h glpk.h], [glp_simplex], [], [],
967 [warn_glpk=
968 OCTAVE_CHECK_LIB_GLPK_OK(
969 [AC_DEFINE(HAVE_GLPK, 1, [Define to 1 if GLPK is available.])],
970 [warn_glpk="GLPK library found, but does not seem to work properly -- disabling glpk function"])])
971LIBS="$save_LIBS"
972CPPFLAGS="$save_CPPFLAGS"
973
974### Checks for cURL header and library.
975
976save_CPPFLAGS="$CPPFLAGS"
977save_LIBS="$LIBS"
978CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
979LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
980OCTAVE_CHECK_LIB(curl, cURL,
981 [cURL library not found. The ftp objects, urlread and urlwrite functions will be disabled.],
982 [curl/curl.h], [curl_easy_escape])
983if test -z "$warn_curl"; then
984 ## Additional check on cURL library that was found
985 AC_CACHE_CHECK([for CURLOPT_DIRLISTONLY in curl/curl.h],
986 [octave_cv_curl_has_curlopt_dirlistonly],
987 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
988 #include <curl/curl.h>
989 ]], [[
990 curl_easy_setopt ((CURL*)NULL, CURLOPT_DIRLISTONLY, 0);
991 ]])],
992 [octave_cv_curl_has_curlopt_dirlistonly=yes],
993 [octave_cv_curl_has_curlopt_dirlistonly=no])
994 ])
995 if test $octave_cv_curl_has_curlopt_dirlistonly = no; then
996 AC_DEFINE(CURLOPT_DIRLISTONLY, CURLOPT_FTPLISTONLY,
997 [Define to the legacy option name if using an older version of cURL.])
998 fi
999fi
1000LIBS="$save_LIBS"
1001CPPFLAGS="$save_CPPFLAGS"
1002
1003### Check for sndfile
1004
1005warn_sndfile="sndfile library fails tests. The audioinfo, audioread and audiowrite functions for reading and writing audio files will not be fully functional."
1006
1007check_sndfile=no
1008AC_ARG_WITH([sndfile],
1009 [AS_HELP_STRING([--without-sndfile],
1010 [don't use sndfile library, disable audio file I/O])],
1011 [if test x"$withval" = x"no"; then
1012 warn_sndfile="--without-sndfile specified. The audioinfo, audioread and audiowrite functions for reading and writing audio files will not be fully functional."
1013 else
1014 check_sndfile=yes
1015 fi],
1016 [check_sndfile=yes])
1017
1018if test $check_sndfile = yes; then
1019 PKG_CHECK_EXISTS([sndfile], [
1020 SNDFILE_CPPFLAGS=`$PKG_CONFIG --cflags-only-I sndfile`
1021 SNDFILE_LDFLAGS=`$PKG_CONFIG --libs-only-L sndfile`
1022 SNDFILE_LIBS=`$PKG_CONFIG --libs-only-l sndfile`
1023 OCTAVE_CHECK_LIB_SNDFILE_OK([warn_sndfile=])
1024 ])
1025fi
1026
1027if test -z "$warn_sndfile"; then
1028 AC_DEFINE(HAVE_SNDFILE, 1, [Define to 1 if sndfile is available.])
1029else
1030 SNDFILE_CPPFLAGS=
1031 SNDFILE_LDFLAGS=
1032 SNDFILE_LIBS=
1033fi
1034
1035AC_SUBST(SNDFILE_CPPFLAGS)
1036AC_SUBST(SNDFILE_LDFLAGS)
1037AC_SUBST(SNDFILE_LIBS)
1038
1039### Check for PortAudio
1040
1041warn_portaudio="PortAudio library fails tests. The audioplayer, audiorecorder classes and audiodevinfo function for audio playback and recording will not be fully functional."
1042
1043check_portaudio=no
1044AC_ARG_WITH([portaudio],
1045 [AS_HELP_STRING([--without-portaudio],
1046 [don't use PortAudio library, disable audio playback and recording])],
1047 [if test x"$withval" = x"no"; then
1048 warn_portaudio="--without-portaudio specified. The audioplayer, audiorecorder classes and audiodevinfo function for audio playback and recording will not be fully functional."
1049 else
1050 check_portaudio=yes
1051 fi],
1052 [check_portaudio=yes])
1053
1054if test $check_portaudio = yes; then
1055 PKG_CHECK_EXISTS([portaudio-2.0 >= 19], [
1056 PORTAUDIO_CPPFLAGS=`$PKG_CONFIG --cflags-only-I portaudio-2.0`
1057 PORTAUDIO_LDFLAGS=`$PKG_CONFIG --libs-only-L portaudio-2.0`
1058 PORTAUDIO_LIBS=`$PKG_CONFIG --libs-only-l portaudio-2.0`
1059 warn_portaudio=
1060 ])
1061fi
1062
1063if test -z "$warn_portaudio"; then
1064 AC_DEFINE(HAVE_PORTAUDIO, 1, [Define to 1 if PortAudio is available.])
1065else
1066 PORTAUDIO_CPPFLAGS=
1067 PORTAUDIO_LDFLAGS=
1068 PORTAUDIO_LIBS=
1069fi
1070AC_SUBST(PORTAUDIO_CPPFLAGS)
1071AC_SUBST(PORTAUDIO_LDFLAGS)
1072AC_SUBST(PORTAUDIO_LIBS)
1073
1074### Check for either of Graphics/ImageMagick++ libraries
1075
1076AC_ARG_WITH([magick],
1077 [AS_HELP_STRING([--with-magick=LIB],
1078 [select library to use for image I/O (options: GraphicsMagick(default) or ImageMagick)])],
1079 [magick="$withval"],
1080 [magick="GraphicsMagick"])
1081
1082warn_magick="$magick++ library not found. The imread function for reading image files will not be fully functional."
1083
1084MAGICK_CPPFLAGS=
1085MAGICK_LDFLAGS=
1086MAGICK_LIBS=
1087
1088PKG_CHECK_EXISTS([$magick++], [
1089 ## Make sure we only get -I, -L, and -l flags. Some Graphics/ImageMagick++
1090 ## packages add extra flags that are useful when building
1091 ## Graphics/ImageMagick++ extentions. These extra flags break the
1092 ## Octave build.
1093 MAGICK_CPPFLAGS=`$PKG_CONFIG --cflags-only-I $magick++`
1094 MAGICK_LDFLAGS=`$PKG_CONFIG --libs-only-L $magick++`
1095 MAGICK_LIBS=`$PKG_CONFIG --libs-only-l $magick++`
1096
1097 warn_magick="$magick++ library fails tests. The imread function for reading image files will not be fully functional."
1098
1099 save_CPPFLAGS="$CPPFLAGS"
1100 save_LIBS="$LIBS"
1101 CPPFLAGS="$MAGICK_CPPFLAGS $CPPFLAGS"
1102 LIBS="$MAGICK_LDFLAGS $MAGICK_LIBS $LIBS"
1103 AC_LANG_PUSH(C++)
1104 AC_CHECK_HEADER([Magick++.h], [
1105 AC_CACHE_CHECK([for Magick::ColorRGB in Magick++.h],
1106 [octave_cv_func_magick_colorrgb],
1107 [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
1108 #include <Magick++.h>
1109 ]], [[
1110 Magick::ColorRGB c;
1111 ]])],
1112 octave_cv_func_magick_colorrgb=yes,
1113 octave_cv_func_magick_colorrgb=no)
1114 ])
1115 if test $octave_cv_func_magick_colorrgb = yes; then
1116 warn_magick=
1117 fi
1118 ])
1119 AC_LANG_POP(C++)
1120 CPPFLAGS="$save_CPPFLAGS"
1121 LIBS="$save_LIBS"
1122
1123 AC_CHECK_FUNCS([setlocale], [],
1124 [warn_magick="$magick++ requires setlocale function. The imread function for reading image files will not be fully functional."])
1125])
1126
1127if test -z "$warn_magick"; then
1128 AC_DEFINE(HAVE_MAGICK, 1,
1129 [Define to 1 if Graphics/ImageMagick++ is available.])
1130else
1131 MAGICK_CPPFLAGS=
1132 MAGICK_LDFLAGS=
1133 MAGICK_LIBS=
1134fi
1135AC_SUBST(MAGICK_CPPFLAGS)
1136AC_SUBST(MAGICK_LDFLAGS)
1137AC_SUBST(MAGICK_LIBS)
1138
1139### Check for X11 libraries
1140
1141AC_PATH_X
1142if test "$have_x" = yes; then
1143 AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if you have X11.])
1144
1145 if test "$x_includes" != "NONE"; then
1146 X11_INCFLAGS="$x_includes"
1147 fi
1148 AC_SUBST(X11_INCFLAGS)
1149
1150 if test -z "$x_libraries"; then
1151 AC_CHECK_LIB([X11], XrmInitialize, [X11_LIBS="-lX11"], [X11_LIBS=])
1152 elif test $x_libraries != "NONE"; then
1153 AC_CHECK_LIB([X11], XrmInitialize,
1154 [X11_LIBS="-L$x_libraries -lX11"], [X11_LIBS=], "-L$x_libraries")
1155 fi
1156 AC_SUBST(X11_LIBS)
1157fi
1158
1159### Check for the Carbon framework on MacOSX systems
1160OCTAVE_HAVE_FRAMEWORK([Carbon],
1161 [[#include <Carbon/Carbon.h>]], [[CGMainDisplayID ()]],
1162 [have_framework_carbon=yes], [have_framework_carbon=no])
1163if test $have_framework_carbon = yes; then
1164 AC_DEFINE(HAVE_FRAMEWORK_CARBON, 1,
1165 [Define to 1 if framework CARBON is available.])
1166 CARBON_LIBS="-Wl,-framework -Wl,Carbon"
1167 AC_MSG_NOTICE([adding -Wl,-framework -Wl,Carbon to CARBON_LIBS])
1168 AC_SUBST(CARBON_LIBS)
1169fi
1170
1171### Check for list of libraries needed for native graphics renderer.
1172
1173native_graphics=yes
1174warn_freetype=""
1175
1176check_opengl=no
1177AC_ARG_WITH([opengl],
1178 [AS_HELP_STRING([--without-opengl],
1179 [don't use OpenGL libraries, disable native graphics])],
1180 [if test x"$withval" = x"no"; then
1181 native_graphics=no
1182 warn_opengl="--without-opengl specified. Native graphics will be disabled."
1183 OCTAVE_CONFIGURE_WARNING([warn_opengl])
1184 else
1185 check_opengl=yes
1186 fi],
1187 [check_opengl=yes])
1188
1189## Check for OpenGL library
1190if test $check_opengl = yes; then
1191 OCTAVE_CHECK_LIB_OPENGL
1192fi
1193
1194FLTK_CPPFLAGS=
1195FLTK_LDFLAGS=
1196FLTK_LIBS=
1197
1198if test -z "$OPENGL_LIBS"; then
1199 if test $check_opengl = yes; then
1200 native_graphics=no
1201 warn_fltk_opengl="OpenGL libs (GL and GLU) not found. Native graphics will be disabled."
1202 OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl])
1203 fi
1204fi
1205
1206if test -n "$OPENGL_LIBS"; then
1207 AC_DEFINE(HAVE_OPENGL, 1, [Define to 1 if OpenGL is available.])
1208
1209 ## Check for FreeType 2 library
1210
1211 PKG_CHECK_MODULES([FT2], [freetype2], [
1212 min_ft2_version=9.03
1213 AC_MSG_CHECKING([for FreeType2 version >= $min_ft2_version])
1214 $PKG_CONFIG freetype2 --atleast-version=$min_ft2_version
1215 ac_status=$?
1216 if test $ac_status = 0; then
1217 AC_MSG_RESULT(yes)
1218 AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if you have Freetype library.])
1219 save_LIBS="$LIBS"
1220 LIBS="$FT2_LIBS $LIBS"
1221 AC_CHECK_FUNCS([FT_Reference_Face])
1222 LIBS="$save_LIBS"
1223 else
1224 AC_MSG_RESULT(no)
1225 warn_freetype="FreeType library >= 9.03 not found. Native graphics will be disabled."
1226 fi])
1227
1228 if test -n "$warn_freetype"; then
1229 native_graphics=no
1230 OCTAVE_CONFIGURE_WARNING([warn_freetype])
1231 else
1232 FT2_CPPFLAGS="$FT2_CFLAGS"
1233 fi
1234
1235 ## Check for fontconfig library
1236
1237 warn_fontconfig=""
1238 if test $native_graphics = yes; then
1239 PKG_CHECK_MODULES(FONTCONFIG, [fontconfig],
1240 [have_fontconfig=yes
1241 OPENGL_LIBS="$FONTCONFIG_LIBS $OPENGL_LIBS"
1242 AC_DEFINE(HAVE_FONTCONFIG, 1, [Define to 1 if fontconfig is present.])],
1243 [have_fontconfig=no
1244 warn_fontconfig="Fontconfig library not found. Native graphics will be disabled."])
1245 fi
1246
1247 if test -n "$warn_fontconfig"; then
1248 native_graphics=no
1249 OCTAVE_CONFIGURE_WARNING([warn_fontconfig])
1250 else
1251 FONTCONFIG_CPPFLAGS="$FONTCONFIG_CFLAGS"
1252 fi
1253
1254 ## Check for Xft library (when using X11)
1255
1256 warn_xft=""
1257 if test $native_graphics = yes && test "$have_x" = yes; then
1258 PKG_CHECK_MODULES(XFT, [xft],
1259 [AC_DEFINE(HAVE_XFT, 1, [Define to 1 if Xft is present.])],
1260 [warn_xft="Xft library not found. Native graphics will be disabled."])
1261 fi
1262
1263 if test -n "$warn_xft"; then
1264 native_graphics=no
1265 OCTAVE_CONFIGURE_WARNING([warn_xft])
1266 fi
1267
1268 ## Check for FLTK (www.fltk.org) library
1269
1270 check_fltk=no
1271 AC_ARG_WITH([fltk],
1272 [AS_HELP_STRING([--without-fltk],
1273 [don't use FLTK libraries, disable native graphics])],
1274 [if test x"$withval" = x"no"; then
1275 native_graphics=no
1276 warn_fltk="--without-fltk specified. Native graphics will be disabled."
1277 OCTAVE_CONFIGURE_WARNING([warn_fltk])
1278 else
1279 check_fltk=yes
1280 fi],
1281 [check_fltk=yes])
1282
1283 if test $check_fltk = yes; then
1284 AC_ARG_WITH([fltk-prefix],
1285 [AS_HELP_STRING([--with-fltk-prefix=PFX],
1286 [prefix where FLTK is installed (optional)])],
1287 [fltk_prefix="$withval"],
1288 [fltk_prefix=""])
1289
1290 AC_ARG_WITH([fltk-exec-prefix],
1291 [AS_HELP_STRING([--with-fltk-exec-prefix=PFX],
1292 [exec prefix where FLTK is installed (optional)])],
1293 [fltk_exec_prefix="$withval"],
1294 [fltk_exec_prefix=""])
1295
1296 if test x"$fltk_exec_prefix" != x""; then
1297 fltk_args="$fltk_args --exec-prefix=$fltk_exec_prefix"
1298 if test "x${FLTK_CONFIG+set}" != xset ; then
1299 FLTK_CONFIG="$fltk_exec_prefix/bin/fltk-config"
1300 fi
1301 fi
1302
1303 if test x"$fltk_prefix" != x""; then
1304 fltk_args="$fltk_args --prefix=$fltk_prefix"
1305 if test x${FLTK_CONFIG+set} != xset ; then
1306 FLTK_CONFIG="$fltk_prefix/bin/fltk-config"
1307 fi
1308 fi
1309
1310 AC_PATH_PROG([FLTK_CONFIG], [fltk-config], [no])
1311
1312 warn_fltk_config=""
1313 warn_fltk_opengl=""
1314
1315 if test "$FLTK_CONFIG" = no; then
1316 native_graphics=no
1317 warn_fltk_config="FLTK config script not found. Native graphics will be disabled."
1318 OCTAVE_CONFIGURE_WARNING([warn_fltk_config])
1319 else
1320 FLTK_CPPFLAGS=`$FLTK_CONFIG $fltkconf_args --use-gl --cflags`
1321 FLTK_LDFLAGS=`$FLTK_CONFIG $fltkconf_args --use-gl --ldflags`
1322
1323 case $host_os in
1324 mingw*)
1325 FLTK_LDFLAGS=`echo $FLTK_LDFLAGS | $SED -e 's/-mwindows//g'`
1326 ;;
1327 esac
1328
1329 AC_CACHE_CHECK([for OpenGL support in FLTK],
1330 [octave_cv_fltk_opengl_support],
1331 [save_CPPFLAGS="$CPPFLAGS"
1332 CPPFLAGS="$CFLAGS $FLTK_CPPFLAGS"
1333 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1334 #include <FL/gl.h>
1335 ]], [[
1336 int nothing = 0;
1337 ]])],
1338 octave_cv_fltk_opengl_support=no,
1339 octave_cv_fltk_opengl_support=yes)
1340 CPPFLAGS="$save_CPPFLAGS"
1341 ])
1342 if test $octave_cv_fltk_opengl_support = no; then
1343 warn_fltk_opengl="FLTK does not have OpenGL support. Native graphics will be disabled."
1344 else
1345 AC_DEFINE(HAVE_FLTK, 1, [Define to 1 if FLTK is available.])
1346 fi
1347
1348 if test -n "$warn_fltk_opengl"; then
1349 native_graphics=no
1350 OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl])
1351 fi
1352 fi
1353 fi
1354fi
1355
1356AC_SUBST(FLTK_CPPFLAGS)
1357AC_SUBST(FLTK_LDFLAGS)
1358AC_SUBST(FLTK_LIBS)
1359
1360## Check for gl2ps which is required for printing with OpenGL graphics
1361if test $native_graphics = yes; then
1362 AC_CHECK_HEADERS([gl2ps.h],
1363 [GL2PS_LIBS="-lgl2ps"],
1364 [warn_gl2ps="gl2ps library not found. OpenGL printing is disabled."
1365 OCTAVE_CONFIGURE_WARNING([warn_gl2ps])])
1366fi
1367
1368AC_SUBST(GL2PS_LIBS)
1369
1370if test -n "$OPENGL_LIBS"; then
1371 ## Check for OSMesa which is needed for offscreen rendering with OpenGL
1372 ## FIXME: Check for version >= 9.0.0
1373 OCTAVE_CHECK_LIB(OSMesa, OSMesa,
1374 [OSMesa library not found. Offscreen rendering with OpenGL will be disabled.],
1375 [osmesa.h GL/osmesa.h], [OSMesaCreateContext])
1376fi
1377
1378### Start determination of shared vs. static libraries
1379
1380## Use -static if compiling on Alpha OSF/1 1.3 systems.
1381case $canonical_host_type in
1382 alpha*-dec-osf1.3)
1383 LD_STATIC_FLAG=-static
1384 ;;
1385esac
1386if test -n "$LD_STATIC_FLAG"; then
1387 AC_MSG_NOTICE([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG])
1388fi
1389AC_SUBST(LD_STATIC_FLAG)
1390
1391OCTAVE_PROG_AR
1392
1393ifdef([LT_INIT], [], [
1394 errprint([error: you must have libtool 2.2.2 or a more recent version
1395])
1396 m4exit([1])])
1397
1398LT_PREREQ([2.2.2])
1399LT_INIT([disable-static dlopen win32-dll])
1400
1401if test $enable_shared = yes; then
1402 SHARED_LIBS=yes
1403else
1404 SHARED_LIBS=no
1405fi
1406
1407if test $enable_static = yes; then
1408 STATIC_LIBS=yes
1409else
1410 STATIC_LIBS=no
1411fi
1412
1413XTRA_CRUFT_SH_LDFLAGS=
1414if test $have_msvc = yes; then
1415 FLIBS="$FLIBS -lkernel32"
1416 XTRA_CRUFT_SH_LDFLAGS="-Wl,cruft/cruft.def"
1417fi
1418AC_SUBST(XTRA_CRUFT_SH_LDFLAGS)
1419
1420### Check for BLAS and LAPACK libraries:
1421
1422## Need to adjust FFLAGS to include correct integer size.
1423save_FFLAGS="$FFLAGS"
1424FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
1425
1426AX_BLAS_WITH_F77_FUNC([:], [:],
1427 [ax_blas_ok=yes
1428 AC_MSG_CHECKING([BLAS can be called from Fortran])
1429 AC_MSG_RESULT([yes assumed for cross compilation])])
1430AX_LAPACK([:], [:])
1431
1432## Restore FFLAGS.
1433FFLAGS="$save_FFLAGS"
1434
1435## If necessary, try again with -ff2c in FFLAGS
1436if test $ax_blas_ok = no; then
1437 save_FFLAGS="$FFLAGS"
1438 FFLAGS="-ff2c $FFLAGS $F77_INTEGER_8_FLAG"
1439
1440 AX_BLAS_WITH_F77_FUNC([:], [:])
1441 AX_LAPACK([:], [:])
1442
1443 ## Restore FFLAGS, with -ff2c if that was helpful
1444
1445 if test $ax_blas_ok = yes; then
1446 FFLAGS="-ff2c $save_FFLAGS"
1447 else
1448 FFLAGS="$save_FFLAGS"
1449 fi
1450fi
1451
1452## On OSX, try again with a wrapper library (without -ff2c!)
1453if test $ax_blas_ok = no; then
1454 case $host_os in
1455 darwin*)
1456 ## test if wrapper functions help
1457 octave_blaswrap_save_CFLAGS="$CFLAGS"
1458 CFLAGS="$CFLAGS -DUSE_BLASWRAP"
1459 AC_LANG_PUSH(C)
1460 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1461 #include "liboctave/cruft/misc/blaswrap.c"
1462 ]])],
1463 [mv conftest.$ac_objext blaswrap.$ac_objext
1464 octave_blaswrap_save_BLAS_LIBS="$BLAS_LIBS"
1465 BLAS_LIBS="blaswrap.$ac_objext -framework vecLib"
1466
1467 save_FFLAGS="$FFLAGS"
1468 FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
1469
1470 AX_BLAS_WITH_F77_FUNC([:], [:])
1471 AX_LAPACK([:], [:])
1472
1473 ## Restore FFLAGS.
1474 FFLAGS="$save_FFLAGS"
1475
1476 ## remove temp file
1477 rm -f blaswrap.$ac_objext],
1478 [AC_MSG_FAILURE([cannot compile liboctave/cruft/misc/blaswrap.c])])
1479 AC_LANG_POP(C)
1480 CFLAGS="$octave_blaswrap_save_CFLAGS"
1481
1482 if test $ax_blas_ok = no; then
1483 BLAS_LIBS="$octave_blaswrap_save_BLAS_LIBS"
1484 else
1485 ## wrapper in cruft, remove from BLAS_LIBS
1486 BLAS_LIBS=`echo $BLAS_LIBS | $SED -e 's/blaswrap.[[^ ]]* //g'`
1487 AC_DEFINE(USE_BLASWRAP, 1,
1488 [Define to 1 if BLAS functions need to be wrapped (potentially needed for 64-bit OSX only).])
1489 fi
1490 ;;
1491 esac
1492fi
1493
1494if test $ax_blas_ok = no; then
1495 if test $USE_64_BIT_IDX_T = yes && test "$ax_blas_integer_size_ok" = no; then
1496 ## Attempt to be more informative.
1497 AC_MSG_ERROR([BLAS doesn't seem to support 64-bit integers. This is incompatible with --enable-64.])
1498 else
1499 AC_MSG_ERROR([A BLAS library was detected but found incompatible with your Fortran 77 compiler settings.])
1500 fi
1501fi
1502
1503if test $ax_blas_ok = no || test $ax_lapack_ok = no; then
1504 AC_MSG_ERROR([BLAS and LAPACK libraries are required])
1505fi
1506
1507### Check for the qrupdate library
1508
1509## No need to adjust FFLAGS because only link is attempted.
1510## Must supply proper LIBS, however.
1511save_LIBS="$LIBS"
1512LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
1513OCTAVE_CHECK_LIB(qrupdate, qrupdate,
1514 [qrupdate not found. The QR & Cholesky updating functions will be slow.],
1515 [],
1516 [sqr1up],
1517 [Fortran 77], [don't use qrupdate, disable QR & Cholesky updating functions])
1518
1519## Additional check to see if qrupdate lib found supports LU updates
1520if test -z "$warn_qrupdate"; then
1521 AC_CACHE_CHECK([for slup1up in $QRUPDATE_LIBS],
1522 [octave_cv_func_slup1up],
1523 [LIBS="$LIBS $QRUPDATE_LIBS"
1524 AC_LANG_PUSH([Fortran 77])
1525 AC_LINK_IFELSE([AC_LANG_CALL([], [slup1up])],
1526 octave_cv_func_slup1up=yes, octave_cv_func_slup1up=no)
1527 AC_LANG_POP([Fortran 77])
1528 ])
1529 if test $octave_cv_func_slup1up = yes; then
1530 AC_DEFINE(HAVE_QRUPDATE_LUU, 1, [Define to 1 if qrupdate supports LU updates.])
1531 fi
1532fi
1533LIBS="$save_LIBS"
1534
1535if test $USE_64_BIT_IDX_T = yes; then
1536 CHOLMOD_TAG="_l_"
1537 CXSPARSE_TAG="_dl_"
1538 UMFPACK_TAG="_zl_"
1539else
1540 CHOLMOD_TAG="_"
1541 CXSPARSE_TAG="_di_"
1542 UMFPACK_TAG="_zi_"
1543fi
1544
1545### Check for AMD library
1546
1547OCTAVE_CHECK_LIB(amd, AMD,
1548 [AMD library not found. This will result in some lack of functionality for sparse matrices.],
1549 [suitesparse/amd.h ufsparse/amd.h amd/amd.h amd.h],
1550 [amd_postorder],
1551 [], [don't use AMD library, disable some sparse matrix functionality])
1552
1553### Check for CAMD library
1554
1555OCTAVE_CHECK_LIB(camd, CAMD,
1556 [CAMD library not found. This will result in some lack of functionality for sparse matrices.],
1557 [suitesparse/camd.h ufsparse/camd.h camd/camd.h camd.h],
1558 [camd_postorder],
1559 [], [don't use CAMD library, disable some sparse matrix functionality])
1560
1561### Check for COLAMD library
1562
1563OCTAVE_CHECK_LIB(colamd, COLAMD,
1564 [COLAMD library not found. This will result in some lack of functionality for sparse matrices.],
1565 [suitesparse/colamd.h ufsparse/colamd.h colamd/colamd.h colamd.h],
1566 [colamd],
1567 [], [don't use COLAMD library, disable some sparse matrix functionality])
1568
1569### Check for CCOLAMD library
1570
1571OCTAVE_CHECK_LIB(ccolamd, CCOLAMD,
1572 [CCOLAMD library not found. This will result in some lack of functionality for sparse matrices.],
1573 [suitesparse/ccolamd.h ufsparse/ccolamd.h ccolamd/ccolamd.h ccolamd.h],
1574 [ccolamd],
1575 [], [don't use CCOLAMD library, disable some sparse matrix functionality])
1576
1577### Check for CHOLMOD library.
1578### If your cholmod library requires cblas, then you will need to
1579### configure with --with-cholmod="-lcholmod -lcblas".
1580
1581save_LIBS="$LIBS"
1582LIBS="$COLAMD_LDFLAGS $COLAMD_LIBS $AMD_LDFLAGS $AMD_LIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
1583OCTAVE_CHECK_LIB(cholmod, CHOLMOD,
1584 [CHOLMOD library not found. This will result in some lack of functionality for sparse matrices.],
1585 [suitesparse/cholmod.h ufsparse/cholmod.h cholmod/cholmod.h cholmod.h],
1586 [cholmod${CHOLMOD_TAG}start],
1587 [], [don't use CHOLMOD library, disable some sparse matrix functionality])
1588LIBS="$save_LIBS"
1589
1590### Check for CXSparse library
1591
1592OCTAVE_CHECK_LIB(cxsparse, CXSparse,
1593 [CXSparse library not found. This will result in some lack of functionality for sparse matrices.],
1594 [suitesparse/cs.h ufsparse/cs.h cxsparse/cs.h cs.h],
1595 [cs${CXSPARSE_TAG}sqr],
1596 [C++], [don't use CXSparse library, disable some sparse matrix functionality])
1597
1598### Check for UMFPACK library.
1599
1600save_LIBS="$LIBS"
1601save_CPPFLAGS="$CPPFLAGS"
1602LIBS="$AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS"
1603CPPFLAGS="$AMD_CPPFLAGS $CPPFLAGS"
1604OCTAVE_CHECK_LIB([umfpack], UMFPACK,
1605 [UMFPACK not found. This will result in some lack of functionality for sparse matrices.],
1606 [suitesparse/umfpack.h ufsparse/umfpack.h umfpack/umfpack.h umfpack.h],
1607 [umfpack${UMFPACK_TAG}get_determinant],
1608 [], [don't use UMFPACK, disable some sparse matrix functionality])
1609CPPFLAGS="$save_CPPFLAGS"
1610LIBS="$save_LIBS"
1611
1612if test -z "$UMFPACK_LIBS"; then
1613 ## Invalidate the cache and try again with -lcblas.
1614 $as_unset ac_cv_lib_umfpack_umfpack${UMFPACK_TAG}get_determinant
1615 $as_unset octave_cv_lib_umfpack
1616 save_LIBS="$LIBS"
1617 LIBS="-lcblas $AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS"
1618 OCTAVE_CHECK_LIB([umfpack], UMFPACK,
1619 [UMFPACK not found. This will result in some lack of functionality for sparse matrices.],
1620 [suitesparse/umfpack.h ufsparse/umfpack.h umfpack/umfpack.h umfpack.h],
1621 [umfpack${UMFPACK_TAG}get_determinant],
1622 [], [don't use UMFPACK, disable some sparse matrix functionality])
1623 if test -n "$UMFPACK_LIBS"; then
1624 UMFPACK_LIBS="$UMFPACK_LIBS -lcblas"
1625 fi
1626 LIBS="$save_LIBS"
1627fi
1628
1629## Test features of the installed UMFPACK library
1630
1631if test -n "$UMFPACK_LIBS"; then
1632 ## SuiteSparse >= 4.0 needs additional link library for SuiteSparse_time()
1633 save_CPPFLAGS="$CPPFLAGS"
1634 save_LIBS="$LIBS";
1635 CPPFLAGS="$UMFPACK_CPPFLAGS $AMD_CPPFLAGS $CPPFLAGS"
1636 LIBS="$UMFPACK_LIBS $AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS"
1637 xtra_libs=
1638 OCTAVE_UMFPACK_NEED_SUITESPARSE_TIME
1639 if test $octave_cv_umfpack_need_suitesparse_time = yes; then
1640 AC_CHECK_LIB([rt], [clock_gettime], [xtra_libs="-lrt"], [xtra_libs=])
1641 ## FIXME: This library list is only accurate for Linux, Mac OS X.
1642 ## Possibly need other library names for MinGW, Cygwin.
1643 AC_SEARCH_LIBS([SuiteSparse_time],
1644 [suitesparseconfig SuiteSparse],
1645 [], [], [$xtra_libs])
1646 case $ac_cv_search_SuiteSparse_time in
1647 -l*)
1648 UMFPACK_LIBS="$UMFPACK_LIBS $ac_cv_search_SuiteSparse_time"
1649 ;;
1650 no)
1651 UMFPACK_LIBS=
1652 AC_MSG_WARN([UMFPACK library found but is missing SuiteSparse_time functionality.])
1653 AC_MSG_WARN([UMFPACK library will be disabled.])
1654 ;;
1655 esac
1656 fi
1657 LIBS="$save_LIBS"
1658 CPPFLAGS="$save_CPPFLAGS"
1659
1660 ## Check for UMFPACK separately split complex matrix and RHS.
1661 if test -n "$UMFPACK_LIBS"; then
1662 save_CPPFLAGS="$CPPFLAGS"
1663 save_LIBS="$LIBS";
1664 CPPFLAGS="$UMFPACK_CPPFLAGS $AMD_CPPFLAGS $CPPFLAGS"
1665 LIBS="$UMFPACK_LIBS $CHOLMOD_LDFLAGS $CHOLMOD_LIBS $AMD_LDFLAGS $AMD_LIBS $COLAMD_LDFLAGS $COLAMD_LIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS $xtra_libs"
1666 OCTAVE_UMFPACK_SEPARATE_SPLIT
1667 LIBS="$save_LIBS"
1668 CPPFLAGS="$save_CPPFLAGS"
1669 fi
1670fi
1671
1672### Check for ARPACK library.
1673
1674save_LIBS="$LIBS"
1675LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
1676OCTAVE_CHECK_LIB([arpack], ARPACK,
1677 [ARPACK not found. The eigs function will be disabled.],
1678 [],
1679 [dseupd],
1680 [Fortran 77], [don't use the ARPACK library, disable eigs function],
1681 [warn_arpack=
1682 OCTAVE_CHECK_LIB_ARPACK_OK(
1683 [AC_DEFINE(HAVE_ARPACK, 1, [Define to 1 if ARPACK is available.])],
1684 [warn_arpack="ARPACK library found, but does not seem to work properly -- disabling eigs function"])])
1685LIBS="$save_LIBS"
1686
1687### Check for readline library.
1688
1689OCTAVE_ENABLE_READLINE
1690
1691### Enable dynamic linking. --enable-shared implies this, so
1692### --enable-dl is only need if you are only building static libraries
1693### and want to try dynamic linking too (works on some systems, for
1694### example, OS X and Windows).
1695
1696AC_ARG_ENABLE([dl],
1697 [AS_HELP_STRING([--disable-dl],
1698 [disable loading of dynamically linked modules])],
1699 [case $enableval in
1700 yes) ENABLE_DYNAMIC_LINKING=yes ;;
1701 no) ENABLE_DYNAMIC_LINKING=no ;;
1702 *) AC_MSG_ERROR([bad value $enableval for --enable-dl]) ;;
1703 esac],
1704 [ENABLE_DYNAMIC_LINKING=no])
1705
1706if test $STATIC_LIBS = no && test $SHARED_LIBS = no; then
1707 AC_MSG_ERROR([You can't disable building both static AND shared libraries!])
1708fi
1709
1710CPICFLAG=-fPIC
1711CXXPICFLAG=-fPIC
1712FPICFLAG=-fPIC
1713SHLEXT=so
1714SHLLIB='$(SHLEXT)'
1715SHLBIN=
1716SHLEXT_VER='$(SHLEXT).$(version)'
1717SHLLIB_VER='$(SHLLIB).$(version)'
1718SHLBIN_VER='$(SHLBIN).$(version)'
1719SHLLINKEXT=
1720LIBPRE=lib
1721SHLPRE=lib
1722SHLLIBPRE=lib
1723SHLBINPRE=lib
1724SH_LD='$(CXX)'
1725SH_LDFLAGS=-shared
1726DL_LD='$(SH_LD)'
1727DL_LDFLAGS='$(SH_LDFLAGS)'
1728MKOCTFILE_DL_LDFLAGS='$(DL_LDFLAGS)'
1729SONAME_FLAGS=
1730NO_OCT_FILE_STRIP=false
1731TEMPLATE_AR='$(AR)'
1732TEMPLATE_ARFLAGS="$ARFLAGS"
1733CRUFT_DLL_DEFS=
1734OCTAVE_DLL_DEFS=
1735OCTINTERP_DLL_DEFS=
1736OCTGUI_DLL_DEFS=
1737OCTGRAPHICS_DLL_DEFS=
1738library_path_var=LD_LIBRARY_PATH
1739ldpreloadsep=" "
1740case $canonical_host_type in
1741 *-*-386bsd* | *-*-netbsd*)
1742 SH_LD=ld
1743 SH_LDFLAGS=-Bshareable
1744 ;;
1745 *-*-openbsd*)
1746 SH_LDFLAGS='-shared -fPIC'
1747 ;;
1748 *-*-freebsd*)
1749 SH_LDFLAGS="-shared -Wl,-x"
1750 ;;
1751 alpha*-dec-osf*)
1752 CPICFLAG=
1753 CXXPICFLAG=
1754 FPICFLAG=
1755 SH_LDFLAGS="-shared -Wl,-expect_unresolved -Wl,'*'"
1756 ;;
1757 *-*-darwin*)
1758 DL_LDFLAGS='-bundle -bundle_loader $(top_builddir)/libinterp/octave $(LDFLAGS)'
1759 MKOCTFILE_DL_LDFLAGS='-bundle -bundle_loader $(bindir)/octave-$(version)$(EXEEXT)'
1760 SH_LDFLAGS='-dynamiclib -single_module $(LDFLAGS)'
1761 case $canonical_host_type in
1762 powerpc-*)
1763 CXXPICFLAG=
1764 CPICFLAG=
1765 FPICFLAG=
1766 ;;
1767 esac
1768 SHLEXT=dylib
1769 SHLLIB='$(SHLEXT)'
1770 SHLEXT_VER='$(version).$(SHLEXT)'
1771 SHLLIB_VER='$(version).$(SHLLIB)'
1772 NO_OCT_FILE_STRIP=true
1773 SONAME_FLAGS='-install_name $(octlibdir)/$@'
1774 library_path_var=DYLD_LIBRARY_PATH
1775 ;;
1776 *-*-cygwin*)
1777 CPICFLAG=
1778 CXXPICFLAG=
1779 FPICFLAG=
1780 LIBPRE=lib
1781 SHLPRE=cyg
1782 SHLBINPRE=cyg
1783 SHLEXT=dll
1784 SHLLIB=dll.a
1785 SHLBIN=dll
1786 DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
1787 SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
1788 SONAME_FLAGS='-Wl,--out-implib=$(patsubst $(SHLPRE)%,$(LIBPRE)%,$@).a'
1789 ldpreloadsep=":"
1790 ;;
1791 *-*-mingw*)
1792 if test $have_msvc = yes; then
1793 DL_LDFLAGS="-shared"
1794 CPICFLAG=
1795 CXXPICFLAG=
1796 FPICFLAG=
1797 SHLEXT=dll
1798 SHLLIB=lib
1799 SHLBIN=dll
1800 LIBPRE=
1801 SHLPRE=
1802 SHLLIBPRE=
1803 SHLBINPRE=
1804 SH_LDFLAGS="-shared"
1805 if test -n "`echo $CFLAGS | $GREP -e '-g'`" || test -n "`echo $CXXFLAGS | $GREP -e '-g'`"; then
1806 DL_LDFLAGS="$DL_LDFLAGS -g"
1807 SH_LDFLAGS="$SH_LDFLAGS -g"
1808 fi
1809 NO_OCT_FILE_STRIP=true
1810 library_path_var=PATH
1811 ## Extra compilation flags.
1812 CRUFT_DLL_DEFS="-DCRUFT_DLL"
1813 OCTAVE_DLL_DEFS="-DOCTAVE_DLL"
1814 OCTINTERP_DLL_DEFS="-DOCTINTERP_DLL"
1815 OCTGUI_DLL_DEFS="-DOCTGUI_DLL"
1816 OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL"
1817 else
1818 CPICFLAG=
1819 CXXPICFLAG=
1820 FPICFLAG=
1821 SHLEXT=dll
1822 SHLLIB=dll.a
1823 SHLBIN=dll
1824 DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
1825 SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
1826 SONAME_FLAGS='-Wl,--out-implib=$@.a'
1827 library_path_var=PATH
1828 fi
1829 ;;
1830
1831 *-*-msdosmsvc)
1832 DL_LDFLAGS="-shared"
1833 CPICFLAG=
1834 CXXPICFLAG=
1835 FPICFLAG=
1836 SHLEXT=dll
1837 SHLLIB=lib
1838 SHLBIN=dll
1839 LIBPRE=
1840 SHLPRE=
1841 SHLLIBPRE=
1842 SHLBINPRE=
1843 SH_LDFLAGS="-shared"
1844 if test -n "`echo $CFLAGS | $GREP -e '-g'`" || test -n "`echo $CXXFLAGS | $GREP -e '-g'`"; then
1845 DL_LDFLAGS="$DL_LDFLAGS -g"
1846 SH_LDFLAGS="$SH_LDFLAGS -g"
1847 fi
1848 NO_OCT_FILE_STRIP=true
1849 library_path_var=PATH
1850 ## Extra compilation flags.
1851 CRUFT_DLL_DEFS="-DCRUFT_DLL"
1852 OCTAVE_DLL_DEFS="-DOCTAVE_DLL"
1853 OCTGUI_DLL_DEFS="-DOCTGUI_DLL"
1854 OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL"
1855 ;;
1856 *-*-linux* | *-*-gnu*)
1857 MKOCTFILE_DL_LDFLAGS="-shared -Wl,-Bsymbolic"
1858 SONAME_FLAGS='-Wl,-soname -Wl,$@'
1859 ;;
1860 i[[3456]]86-*-sco3.2v5*)
1861 SONAME_FLAGS='-Wl,-h -Wl,$@'
1862 SH_LDFLAGS=-G
1863 ;;
1864 rs6000-ibm-aix* | powerpc-ibm-aix*)
1865 CPICFLAG=
1866 CXXPICFLAG=
1867 FPICFLAG=
1868 library_path_var=LIBPATH
1869 ;;
1870 hppa*-hp-hpux*)
1871 if test $ac_cv_f77_compiler_gnu = yes; then
1872 FPICFLAG=-fPIC
1873 else
1874 FPICFLAG=+Z
1875 fi
1876 SHLEXT=sl
1877 SH_LDFLAGS="-shared -fPIC"
1878 library_path_var=SHLIB_PATH
1879 ;;
1880 ia64*-hp-hpux*)
1881 if test $ac_cv_f77_compiler_gnu = yes; then
1882 FPICFLAG=-fPIC
1883 else
1884 FPICFLAG=+Z
1885 fi
1886 SH_LDFLAGS="-shared -fPIC"
1887 ;;
1888 *-sgi-*)
1889 CPICFLAG=
1890 CXXPICFLAG=
1891 FPICFLAG=
1892 ;;
1893 sparc-sun-sunos4*)
1894 if test $ac_cv_f77_compiler_gnu = yes; then
1895 FPICFLAG=-fPIC
1896 else
1897 FPICFLAG=-PIC
1898 fi
1899 SH_LD=ld
1900 SH_LDFLAGS="-assert nodefinitions"
1901 ;;
1902 sparc-sun-solaris2* | i386-pc-solaris2*)
1903 if test $ac_cv_f77_compiler_gnu = yes; then
1904 FPICFLAG=-fPIC
1905 else
1906 FPICFLAG=-KPIC
1907 fi
1908 if test "$GCC" = yes; then
1909 CPICFLAG=-fPIC
1910 else
1911 CPICFLAG=-KPIC
1912 fi
1913 if test "$GXX" = yes; then
1914 CXXPICFLAG=-fPIC
1915 SH_LDFLAGS=-shared
1916 else
1917 CXXPICFLAG=-KPIC
1918 SH_LDFLAGS=-G
1919 fi
1920 ## Template closures in archive libraries need a different mechanism.
1921 if test "$GXX" != yes; then
1922 TEMPLATE_AR='$(CXX)'
1923 TEMPLATE_ARFLAGS="-xar -o"
1924 fi
1925 ;;
1926esac
1927
1928AC_MSG_NOTICE([defining FPICFLAG to be $FPICFLAG])
1929AC_MSG_NOTICE([defining CPICFLAG to be $CPICFLAG])
1930AC_MSG_NOTICE([defining CXXPICFLAG to be $CXXPICFLAG])
1931AC_MSG_NOTICE([defining SHLEXT to be $SHLEXT])
1932AC_MSG_NOTICE([defining SHLLIB to be $SHLLIB])
1933AC_MSG_NOTICE([defining SHLBIN to be $SHLBIN])
1934AC_MSG_NOTICE([defining SHLEXT_VER to be $SHLEXT_VER])
1935AC_MSG_NOTICE([defining SHLLIB_VER to be $SHLLIB_VER])
1936AC_MSG_NOTICE([defining SHLBIN_VER to be $SHLBIN_VER])
1937AC_MSG_NOTICE([defining SHLLINKEXT to be $SHLLINKEXT])
1938AC_MSG_NOTICE([defining LIBPRE to be $LIBPRE])
1939AC_MSG_NOTICE([defining SHLPRE to be $SHLPRE])
1940AC_MSG_NOTICE([defining SHLLIBPRE to be $SHLLIBPRE])
1941AC_MSG_NOTICE([defining SHLBINPRE to be $SHLBINPRE])
1942AC_MSG_NOTICE([defining SH_LD to be $SH_LD])
1943AC_MSG_NOTICE([defining SH_LDFLAGS to be $SH_LDFLAGS])
1944AC_MSG_NOTICE([defining DL_LD to be $DL_LD])
1945AC_MSG_NOTICE([defining DL_LDFLAGS to be $DL_LDFLAGS])
1946AC_MSG_NOTICE([defining MKOCTFILE_DL_LDFLAGS to be $MKOCTFILE_DL_LDFLAGS])
1947AC_MSG_NOTICE([defining SONAME_FLAGS to be $SONAME_FLAGS])
1948AC_MSG_NOTICE([defining NO_OCT_FILE_STRIP to be $NO_OCT_FILE_STRIP])
1949AC_MSG_NOTICE([defining TEMPLATE_AR to be $TEMPLATE_AR])
1950AC_MSG_NOTICE([defining TEMPLATE_ARFLAGS to be $TEMPLATE_ARFLAGS])
1951AC_MSG_NOTICE([defining CRUFT_DLL_DEFS to be $CRUFT_DLL_DEFS])
1952AC_MSG_NOTICE([defining OCTAVE_DLL_DEFS to be $OCTAVE_DLL_DEFS])
1953AC_MSG_NOTICE([defining OCTINTERP_DLL_DEFS to be $OCTINTERP_DLL_DEFS])
1954AC_MSG_NOTICE([defining OCTGUI_DLL_DEFS to be $OCTGUI_DLL_DEFS])
1955AC_MSG_NOTICE([defining OCTGRAPHICS_DLL_DEFS to be $OCTGRAPHICS_DLL_DEFS])
1956AC_MSG_NOTICE([defining library_path_var to be $library_path_var])
1957AC_SUBST(FPICFLAG)
1958AC_SUBST(CPICFLAG)
1959AC_SUBST(CXXPICFLAG)
1960AC_SUBST(SHLEXT)
1961AC_SUBST(SHLLIB)
1962AC_SUBST(SHLBIN)
1963AC_SUBST(SHLEXT_VER)
1964AC_SUBST(SHLLIB_VER)
1965AC_SUBST(SHLBIN_VER)
1966AC_SUBST(SHLLINKEXT)
1967AC_SUBST(LIBPRE)
1968AC_SUBST(SHLPRE)
1969AC_SUBST(SHLLIBPRE)
1970AC_SUBST(SHLBINPRE)
1971AC_SUBST(SH_LD)
1972AC_SUBST(SH_LDFLAGS)
1973AC_SUBST(DL_LD)
1974AC_SUBST(DL_LDFLAGS)
1975AC_SUBST(MKOCTFILE_DL_LDFLAGS)
1976AC_SUBST(SONAME_FLAGS)
1977AC_SUBST(NO_OCT_FILE_STRIP)
1978AC_SUBST(TEMPLATE_AR)
1979AC_SUBST(TEMPLATE_ARFLAGS)
1980AC_SUBST(CRUFT_DLL_DEFS)
1981AC_SUBST(OCTAVE_DLL_DEFS)
1982AC_SUBST(OCTINTERP_DLL_DEFS)
1983AC_SUBST(OCTGUI_DLL_DEFS)
1984AC_SUBST(OCTGRAPHICS_DLL_DEFS)
1985AC_SUBST(library_path_var)
1986AC_SUBST(ldpreloadsep)
1987
1988### More configure argument checking related to linking
1989
1990AC_ARG_ENABLE([no-undefined],
1991 [AS_HELP_STRING([--disable-no-undefined],
1992 [don't pass -no-undefined to libtool when linking Octave and its shared libraries])],
1993 [case $enableval in
1994 yes) NO_UNDEFINED_LDFLAG="-no-undefined" ;;
1995 no) NO_UNDEFINED_LDFLAG="" ;;
1996 *) AC_MSG_ERROR([bad value $enableval for --disable-no-undefined]) ;;
1997 esac],
1998 [NO_UNDEFINED_LDFLAG="-no-undefined"])
1999AC_SUBST(NO_UNDEFINED_LDFLAG)
2000
2001AC_ARG_ENABLE([link-all-dependencies],
2002 [AS_HELP_STRING([--enable-link-all-dependencies],
2003 [link Octave and its shared libraries with all dependencies, not just those immediately referenced (should not be needed on most systems)])],
2004 [case $enableval in
2005 yes) link_all_deps=yes ;;
2006 no) link_all_deps=no ;;
2007 *) AC_MSG_ERROR([bad value $enableval for --enable-link-all-depenencies])
2008 ;;
2009 esac],
2010 [link_all_deps=no])
2011AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS], [test $link_all_deps = yes])
2012
2013## Dynamic linking is now enabled only if we are building shared
2014## libs and some API for dynamic linking has been detected.
2015
2016## FIXME: A lot of the following duplicates the functionality of
2017## code generated by the dlopen option for LT_INIT.
2018
2019LD_CXX='$(CXX)'
2020RDYNAMIC_FLAG=
2021DL_API_MSG=""
2022dlopen_api=no
2023shl_load_api=no
2024loadlibrary_api=no
2025dyld_api=no
2026
2027if test $SHARED_LIBS = yes || test $ENABLE_DYNAMIC_LINKING = yes; then
2028
2029 case $lt_cv_dlopen in
2030 dlopen)
2031 dlopen_api=yes
2032 DL_API_MSG="(dlopen)"
2033 AC_DEFINE(HAVE_DLOPEN_API, 1,
2034 [Define to 1 if your system has dlopen, dlsym, dlerror, and dlclose for dynamic linking.])
2035 OCTAVE_CXX_FLAG([-rdynamic], [RDYNAMIC_FLAG=-rdynamic])
2036 ;;
2037 shl_load)
2038 shl_load_api=yes
2039 DL_API_MSG="(shl_load)"
2040 AC_DEFINE(HAVE_SHL_LOAD_API, 1,
2041 [Define to 1 if your system has shl_load and shl_findsym for dynamic linking.])
2042 ;;
2043 LoadLibrary)
2044 loadlibrary_api=yes
2045 DL_API_MSG="(LoadLibrary)"
2046 AC_DEFINE(HAVE_LOADLIBRARY_API, 1,
2047 [Define to 1 if your system has LoadLibrary for dynamic linking.])
2048 ;;
2049 dyld)
2050 dyld_api=yes
2051 DL_API_MSG="(dyld)"
2052 AC_DEFINE(HAVE_DYLD_API, 1,
2053 [Define to 1 if your system has dyld for dynamic linking.])
2054 ;;
2055 esac
2056
2057 DL_LIBS="$lt_cv_dlopen_libs"
2058 AC_SUBST(DL_LIBS)
2059
2060 ## Disable dynamic linking if capability is not present.
2061 if test $dlopen_api = yes \
2062 || test $shl_load_api = yes \
2063 || test $loadlibrary_api = yes \
2064 || test $dyld_api = yes; then
2065 # some form of dynamic linking present
2066 ENABLE_DYNAMIC_LINKING=yes
2067 else
2068 ENABLE_DYNAMIC_LINKING=no
2069 fi
2070fi
2071
2072if test $ENABLE_DYNAMIC_LINKING = yes; then
2073 AC_DEFINE(ENABLE_DYNAMIC_LINKING, 1, [Define to 1 if using dynamic linking.])
2074fi
2075
2076AM_CONDITIONAL([AMCOND_ENABLE_DYNAMIC_LINKING],
2077 [test $ENABLE_DYNAMIC_LINKING = yes])
2078
2079if test $SHARED_LIBS = yes; then
2080 LIBOCTINTERP="-loctinterp$SHLLINKEXT"
2081 LIBOCTAVE="-loctave$SHLLINKEXT"
2082else
2083 LIBOCTINTERP='$(top_builddir)/libinterp/liboctinterp.$(LIBEXT)'
2084 LIBOCTAVE='$(top_builddir)/liboctave/liboctave.$(LIBEXT)'
2085fi
2086
2087AC_SUBST(LD_CXX)
2088AC_SUBST(RDYNAMIC_FLAG)
2089AC_SUBST(ENABLE_DYNAMIC_LINKING)
2090AC_SUBST(LIBOCTINTERP)
2091AC_SUBST(LIBOCTAVE)
2092
2093
2094if test "$cross_compiling" = yes && test -n "$ac_tool_prefix"; then
2095 CROSS_TOOL_PREFIX="$ac_tool_prefix"
2096 MKOCTFILE_AR='$(shell echo $(AR) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2097 MKOCTFILE_CC='$(shell echo $(CC) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2098 MKOCTFILE_CXX='$(shell echo $(CXX) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2099 MKOCTFILE_DL_LD='$(shell echo $(DL_LD) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2100 MKOCTFILE_F77='$(shell echo $(F77) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2101 MKOCTFILE_LD_CXX='$(shell echo $(LD_CXX) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2102 MKOCTFILE_RANLIB='$(shell echo $(RANLIB) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2103else
2104 MKOCTFILE_AR="$AR"
2105 MKOCTFILE_CC="$CC"
2106 MKOCTFILE_CXX="$CXX"
2107 MKOCTFILE_DL_LD="$DL_LD"
2108 MKOCTFILE_F77="$F77"
2109 MKOCTFILE_LD_CXX="$LD_CXX"
2110 MKOCTFILE_RANLIB="$RANLIB"
2111fi
2112AC_MSG_NOTICE([defining CROSS_TOOL_PREFIX to be $CROSS_TOOL_PREFIX])
2113AC_MSG_NOTICE([defining MKOCTFILE_AR to be $MKOCTFILE_AR])
2114AC_MSG_NOTICE([defining MKOCTFILE_CC to be $MKOCTFILE_CC])
2115AC_MSG_NOTICE([defining MKOCTFILE_CXX to be $MKOCTFILE_CXX])
2116AC_MSG_NOTICE([defining MKOCTFILE_DL_LD to be $MKOCTFILE_DL_LD])
2117AC_MSG_NOTICE([defining MKOCTFILE_F77 to be $MKOCTFILE_F77])
2118AC_MSG_NOTICE([defining MKOCTFILE_LD_CXX to be $MKOCTFILE_LD_CXX])
2119AC_MSG_NOTICE([defining MKOCTFILE_RANLIB to be $MKOCTFILE_RANLIB])
2120AC_SUBST(CROSS_TOOL_PREFIX)
2121AC_SUBST(MKOCTFILE_AR)
2122AC_SUBST(MKOCTFILE_CC)
2123AC_SUBST(MKOCTFILE_CXX)
2124AC_SUBST(MKOCTFILE_DL_LD)
2125AC_SUBST(MKOCTFILE_F77)
2126AC_SUBST(MKOCTFILE_LD_CXX)
2127AC_SUBST(MKOCTFILE_RANLIB)
2128
2129### Check for existence of various libraries
2130
2131## OS-specific test for dirent, opendir.
2132case $host_os in
2133 mingw*)
2134 if test $have_msvc = yes; then
2135 AC_CHECK_LIB([dirent], [opendir])
2136 LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
2137 else
2138 LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
2139 fi
2140 LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
2141 ;;
2142 msdosmsvc)
2143 AC_CHECK_LIB([dirent], [opendir])
2144 LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
2145 ;;
2146esac
2147
2148## Find a termlib to use.
2149OCTAVE_CHECK_LIB_TERMLIB
2150
2151### Checks for header files.
2152
2153AC_HEADER_DIRENT
2154AC_HEADER_SYS_WAIT
2155
2156## C headers
2157
2158dnl Use multiple AC_CHECKs to avoid line continuations '\' in list
2159AC_CHECK_HEADERS([curses.h direct.h dlfcn.h floatingpoint.h fpu_control.h])
2160AC_CHECK_HEADERS([grp.h ieeefp.h inttypes.h locale.h memory.h ncurses.h])
2161AC_CHECK_HEADERS([poll.h pthread.h pwd.h sunmath.h sys/ioctl.h])
2162AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/resource.h])
2163AC_CHECK_HEADERS([sys/select.h termcap.h])
2164
2165## C++ headers
2166
2167AC_LANG_PUSH(C++)
2168
2169AC_CHECK_HEADERS([sstream])
2170OCTAVE_UNORDERED_MAP_HEADERS
2171
2172AC_LANG_POP(C++)
2173
2174## Find a termio header to include.
2175
2176AC_CHECK_HEADERS([termios.h], have_termios_h=yes, have_termios_h=no)
2177AC_CHECK_HEADERS([termio.h], have_termio_h=yes, have_termio_h=no)
2178AC_CHECK_HEADERS([sgtty.h], have_sgtty_h=yes, have_sgtty_h=no)
2179AC_CHECK_HEADERS([fnmatch.h], have_fnmatch_h=yes, have_fnmatch_h=no)
2180AC_CHECK_HEADERS([conio.h], have_conio_h=yes, have_conio_h=no)
2181
2182if test $have_termios_h != yes \
2183 && test $have_termio_h != yes \
2184 && test $have_sgtty_h != yes; then
2185 AC_MSG_WARN([I couldn't find termios.h, termio.h, or sgtty.h!])
2186fi
2187
2188## For MSVC compilers, avoid #define of min/max from windows.h header
2189if test $have_msvc = yes; then
2190 AC_DEFINE(NOMINMAX, 1, [Define to 1 if you want to avoid min/max macro definition in Windows headers.])
2191fi
2192
2193### Determine types and size of types.
2194
2195AC_TYPE_INT64_T
2196AC_TYPE_MODE_T
2197AC_TYPE_OFF_T
2198AC_TYPE_PID_T
2199AC_TYPE_SIZE_T
2200AC_TYPE_SSIZE_T
2201AC_TYPE_UID_T
2202AC_TYPE_UINT64_T
2203AC_CHECK_TYPES([dev_t, ino_t])
2204AC_CHECK_TYPES([long long int, unsigned long long int])
2205AC_CHECK_TYPES([ptrdiff_t])
2206
2207## How big are ints and how are they oriented?
2208## These could probably be eliminated in favor of run-time checks.
2209
2210AC_CHECK_SIZEOF([short])
2211AC_CHECK_SIZEOF([int])
2212AC_CHECK_SIZEOF([long])
2213AC_CHECK_SIZEOF([long long])
2214## Check for long double type (for 64-bit integers)
2215AC_CHECK_SIZEOF([long double])
2216
2217### Check structures and existence of necessary members
2218
2219AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks,
2220 struct stat.st_rdev])
2221AC_CHECK_MEMBERS([struct group.gr_passwd])
2222
2223AC_STRUCT_TIMEZONE
2224
2225### Check compiler characteristics.
2226
2227## Does compiler have support for new friend template declarations?
2228OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL
2229
2230## Does reinterpret_cast fail for function pointers?
2231OCTAVE_CXX_BROKEN_REINTERPRET_CAST
2232
2233## Check if C++ compiler allows placement delete.
2234OCTAVE_CXX_PLACEMENT_DELETE
2235
2236## Check if C++ compiler can auto allocate variable sized arrays.
2237OCTAVE_CXX_DYNAMIC_AUTO_ARRAYS
2238
2239## Check that C compiler and libraries support IEEE754 data format.
2240OCTAVE_IEEE754_DATA_FORMAT
2241
2242## Is C++ runtime library ISO compliant?
2243OCTAVE_CXX_ISO_COMPLIANT_LIBRARY
2244
2245## Are bit_and, bit_or, and bit_xor defined as templated operators?
2246OCTAVE_CXX_BITWISE_OP_TEMPLATES
2247
2248## Can complex class set components independently?
2249OCTAVE_CXX_COMPLEX_SETTERS
2250
2251## Are there functions to access real/imag parts of numbers via references?
2252OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS
2253
2254## Check if fast integer arithmetics based on bit tricks is available.
2255OCTAVE_FAST_INT_OPS
2256
2257## Does the C compiler handle alloca() and const correctly?
2258AC_FUNC_ALLOCA
2259
2260## Does the C compiler support Automake subdir-objects option?
2261AM_PROG_CC_C_O
2262
2263### gnulib initialization: part 2
2264### After all include and path modifications have taken place
2265### and at the same priority level as function checks.
2266
2267gl_INIT
2268
2269### Checks for functions and variables.
2270
2271dnl These checks define/undefine HAVE_FUNCNAME in config.h.
2272dnl Code tests HAVE_FUNCNAME and either uses function or provides workaround.
2273dnl Use multiple AC_CHECKs to avoid line continuations '\' in list
2274AC_CHECK_FUNCS([ctermid dup2])
2275AC_CHECK_FUNCS([endgrent endpwent execvp expm1 expm1f fork])
2276AC_CHECK_FUNCS([getegid geteuid getgid getgrent getgrgid getgrnam])
2277AC_CHECK_FUNCS([getpgrp getpid getppid getpwent getpwuid getuid])
2278AC_CHECK_FUNCS([isascii kill])
2279AC_CHECK_FUNCS([lgamma lgammaf lgamma_r lgammaf_r])
2280AC_CHECK_FUNCS([log1p log1pf pipe])
2281AC_CHECK_FUNCS([realpath resolvepath roundl])
2282AC_CHECK_FUNCS([select setgrent setpwent siglongjmp strsignal])
2283AC_CHECK_FUNCS([tcgetattr tcsetattr tgammaf toascii])
2284AC_CHECK_FUNCS([umask waitpid])
2285AC_CHECK_FUNCS([_kbhit])
2286
2287dnl There are no workarounds in the code for missing these functions.
2288AC_CHECK_FUNCS([modf pow sqrt sqrtf], [],
2289 [AC_MSG_ERROR([Missing function required to build Octave])])
2290
2291## exp2, round, tgamma function checks
2292AC_LANG_PUSH(C++)
2293AC_CHECK_DECLS([exp2, round, tgamma], [], [], [[#include <cmath>]])
2294AC_CHECK_FUNCS([exp2 round tgamma])
2295AH_VERBATIM([Z_FUNCS_AND_DECLS], [
2296#if defined (__cplusplus)
2297extern "C" {
2298#endif
2299#if HAVE_EXP2 && ! HAVE_DECL_EXP2
2300double exp2 (double);
2301#endif
2302#if HAVE_ROUND && ! HAVE_DECL_ROUND
2303double round (double);
2304#endif
2305#if HAVE_TGAMMA && ! HAVE_DECL_TGAMMA
2306double tgamma (double);
2307#endif
2308#if defined (__cplusplus)
2309}
2310#endif
2311])
2312AC_LANG_POP(C++)
2313
2314## Look in <cmath> for the IEEE functions isnan, isinf, isfinite that we need.
2315
2316OCTAVE_CHECK_FUNC_CMATH(isnan)
2317OCTAVE_CHECK_FUNC_CMATH(isinf)
2318OCTAVE_CHECK_FUNC_CMATH(isfinite)
2319OCTAVE_CHECK_FUNC_CMATH(signbit)
2320
2321## Check for Inf and NaN functions
2322
2323case $canonical_host_type in
2324 m68k-hp-hpux*)
2325 ## I am told that Inf and NaN don't work on m68k HP sytems.
2326 ;;
2327 *)
2328 AC_CHECK_FUNCS([finite isnan isinf signbit])
2329 AC_CHECK_FUNCS([_finite _isnan])
2330 AC_CHECK_DECLS([signbit], , , [#include <math.h>])
2331 ;;
2332esac
2333
2334## Check for nonstandard, but common math functions, that we need.
2335
2336dnl Use multiple AC_CHECKs to avoid line continuations '\' in list
2337AC_CHECK_FUNCS([acosh acoshf asinh asinhf atanh atanhf cbrt cbrtf])
2338AC_CHECK_FUNCS([erf erff erfc erfcf exp2f hypotf _hypotf log2 log2f])
2339
2340## Check for math defines such as M_LN2 in math.h
2341AC_CACHE_CHECK([for MATH DEFINES in math.h],
2342 [octave_cv_header_math_defines],
2343 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2344 #include <math.h>
2345 ]], [[
2346 double x = M_LN2;]])],
2347 octave_cv_header_math_defines=yes,
2348 octave_cv_header_math_defines=no)
2349 ])
2350
2351if test $octave_cv_header_math_defines = no; then
2352 ## Check again and try defining _USE_MATH_DEFINES
2353 AC_CACHE_CHECK([whether _USE_MATH_DEFINES needs to be defined],
2354 [octave_cv_header__use_math_defines],
2355 [save_CPPFLAGS="$CPPFLAGS"
2356 CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES"
2357 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2358 #include <math.h>
2359 ]], [[
2360 double x = M_LN2;]])],
2361 octave_cv_header__use_math_defines=yes,
2362 octave_cv_header__use_math_defines=no)
2363 CPPFLAGS="$save_CPPFLAGS"
2364 ])
2365 if test $octave_cv_header__use_math_defines = yes; then
2366 octave_cv_header_math_defines=yes
2367 AC_DEFINE(_USE_MATH_DEFINES, 1,
2368 [Define to 1 if _USE_MATH_DEFINES is required to get math constants like M_LN2.])
2369 CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES"
2370 fi
2371fi
2372
2373if test $octave_cv_header_math_defines = yes; then
2374 AC_DEFINE(HAVE_MATH_DEFINES, 1,
2375 [Define to 1 if defines such as M_PI are available in math.h])
2376else
2377 AC_MSG_ERROR([MATH DEFINES in math.h such as M_PI are required to build Octave])
2378fi
2379
2380## Windows-specific tests for extra #defines
2381case $host_os in
2382 msdosmsvc | mingw*)
2383 AC_MSG_CHECKING([for required _WIN32_WINNT])
2384 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2385 #include <windows.h>
2386 #if _WIN32_WINNT < 0x0403
2387 #error "Wrong version"
2388 #endif
2389 ]], [])],
2390 [AC_MSG_RESULT([none])],
2391 [AC_DEFINE(_WIN32_WINNT, 0x0403,
2392 [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.])
2393 AC_MSG_RESULT([0x0403])])
2394 ;;
2395esac
2396
2397## Windows-specific use of functions
2398case $host_os in
2399 msdosmsvc | mingw*)
2400 AC_CHECK_FUNCS([setvbuf], [],
2401 [AC_MSG_ERROR([Missing function required to build Octave])])
2402 ;;
2403esac
2404
2405## Cygwin kluge for getrusage.
2406AC_CHECK_FUNCS([getrusage])
2407case $host_os in
2408 cygwin*)
2409 AC_DEFINE(RUSAGE_TIMES_ONLY, 1,
2410 [Define to 1 if your struct rusage only has time information.])
2411 ;;
2412esac
2413
2414## Check for CGDisplayBitsPerPixel function on Mac OSX systems with Carbon
2415if test $have_framework_carbon = yes; then
2416 OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL
2417fi
2418
2419AC_CHECK_FUNCS([getpwnam], [], [AC_CHECK_LIB([sun], [getpwnam])])
2420
2421AC_FUNC_CLOSEDIR_VOID
2422
2423## Check return type of matherr()
2424AC_CACHE_CHECK([for struct exception in math.h],
2425 [octave_cv_func_matherr_type],
2426 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2427 #include <math.h>
2428 ]], [[
2429 struct exception *x;
2430 x->type;
2431 x->name;
2432 ]])],
2433 octave_cv_func_matherr_type=yes,
2434 octave_cv_func_matherr_type=no)
2435 ])
2436if test $octave_cv_func_matherr_type = yes; then
2437 AC_DEFINE(EXCEPTION_IN_MATH, 1,
2438 [Define to 1 if math.h declares struct exception for matherr().])
2439fi
2440
2441## Signal stuff.
2442
2443AC_CHECK_DECLS([sys_siglist], [], [],
2444[[#include <signal.h>
2445/* NetBSD declares sys_siglist in unistd.h. */
2446#if HAVE_UNISTD_H
2447# include <unistd.h>
2448#endif
2449]])
2450
2451### Need to disable building documentation if either gnuplot or
2452### makeinfo are missing. Skip this warning if building docs was
2453### disabled with a configure option.
2454
2455if test -n "$DOCDIR"; then
2456 if test -n "$warn_gnuplot"; then
2457 DOCDIR=
2458 warn_docs_gnuplot="building documentation disabled because gnuplot was not found; make dist will fail"
2459 OCTAVE_CONFIGURE_WARNING([warn_docs_gnuplot])
2460 fi
2461 if test -n "$warn_makeinfo"; then
2462 DOCDIR=
2463 warn_docs_makeinfo="building documentation disabled because makeinfo was not found; make dist will fail"
2464 OCTAVE_CONFIGURE_WARNING([warn_docs_makeinfo])
2465 fi
2466fi
2467AM_CONDITIONAL([AMCOND_BUILD_DOCS], [test -n "$DOCDIR"])
2468
2469### Maybe add -Wall, -W, and -Wshadow to compiler flags now that we're
2470### done feature testing.
2471
2472GCC_EXTRA_FLAGS="-Wall -W -Wshadow -Wformat -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wcast-align -Wcast-qual"
2473
2474GXX_EXTRA_FLAGS="-Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual"
2475
2476try_extra_warning_flags=yes
2477
2478AC_ARG_ENABLE([extra-warning-flags],
2479 [AS_HELP_STRING([--disable-extra-warning-flags],
2480 [don't add -Wall, -W, -Wshadow, and -Wold-style-cast options to CFLAGS and CXXFLAGS])],
2481 [if test "$enableval" = no; then
2482 try_extra_warning_flags=no
2483 fi],
2484 [])
2485
2486if test $try_extra_warning_flags = yes; then
2487 for flag in $GCC_EXTRA_FLAGS; do
2488 OCTAVE_CC_FLAG([$flag], [
2489 WARN_CFLAGS="$WARN_CFLAGS $flag";
2490 AC_MSG_RESULT([adding $flag to WARN_CFLAGS])])
2491 done
2492 for flag in $GXX_EXTRA_FLAGS; do
2493 OCTAVE_CXX_FLAG([$flag], [
2494 WARN_CXXFLAGS="$WARN_CXXFLAGS $flag";
2495 AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])])
2496 done
2497fi
2498
2499GCC_STRICT_FLAGS="-Wconversion"
2500
2501GXX_STRICT_FLAGS="-Wconversion -Weffc++"
2502
2503try_strict_warning_flags=no
2504
2505AC_ARG_ENABLE([strict-warning-flags],
2506 [AS_HELP_STRING([--enable-strict-warning-flags],
2507 [add extra strict warning options to CFLAGS and CXXFLAGS])],
2508 [if test "$enableval" = yes; then
2509 try_strict_warning_flags=yes
2510 fi],
2511 [])
2512
2513if test $try_strict_warning_flags = yes; then
2514 for flag in $GCC_STRICT_FLAGS; do
2515 OCTAVE_CC_FLAG([$flag], [
2516 WARN_CFLAGS="$WARN_CFLAGS $flag";
2517 AC_MSG_RESULT([adding $flag to WARN_CFLAGS])])
2518 done
2519 for flag in $GXX_STRICT_FLAGS; do
2520 OCTAVE_CXX_FLAG([$flag], [
2521 WARN_CXXFLAGS="$WARN_CXXFLAGS $flag";
2522 AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])])
2523 done
2524fi
2525
2526AC_SUBST(WARN_CFLAGS)
2527AC_SUBST(WARN_CXXFLAGS)
2528
2529### Check for Java.
2530
2531build_java=yes
2532AC_ARG_ENABLE([java],
2533 [AS_HELP_STRING([--disable-java],
2534 [disable Java interface])],
2535 [if test "$enableval" = no; then
2536 build_java=no
2537 fi],
2538 [])
2539
2540AC_ARG_WITH([java-homedir],
2541 [AS_HELP_STRING([--with-java-homedir=DIR],
2542 [Java JDK directory in DIR])],
2543 [JAVA_HOMEDIR="$withval"])
2544
2545AC_ARG_WITH([java-includedir],
2546 [AS_HELP_STRING([--with-java-includedir=DIR],
2547 [look for java include file <jni.h> in DIR])],
2548 [JAVA_CPPFLAGS="$withval"], [JAVA_CPPFLAGS=""])
2549
2550AC_ARG_WITH([java-libdir],
2551 [AS_HELP_STRING([--with-java-libdir=DIR],
2552 [look for java library libjvm in DIR])],
2553 [JAVA_LDPATH="$withval"], [JAVA_LDPATH=""])
2554
2555## Grab JAVA_HOME from environment variable if it exists
2556AC_ARG_VAR([JAVA_HOME], [path to Java JDK installation])
2557## But --with-java-homedir option overrides environment variable
2558if test -n "$JAVA_HOMEDIR"; then
2559 JAVA_HOME=$JAVA_HOMEDIR
2560fi
2561JAVA=
2562JAVAC=
2563JAR=
2564JAVA_LIBS=
2565
2566## Fake loop so that "break" can be used to skip code blocks.
2567warn_java=""
2568while test $build_java = yes
2569do
2570 ## Unset build_java. Variable is set only if all configuration tests pass.
2571 build_java=no
2572
2573 ## Warn if JAVA_HOME is unset. It is *strongly* advised to specify JAVA_HOME.
2574 if test -z "$JAVA_HOME"; then
2575 warn_java_home="JAVA_HOME environment variable not initialized. Auto-detection will proceed but is unreliable."
2576 OCTAVE_CONFIGURE_WARNING([warn_java_home])
2577 fi
2578
2579 ## Search for a viable Java executable.
2580 if test -z "$JAVA_HOME"; then
2581 JAVA_PATH="$PATH"
2582 else
2583 JAVA_PATH="${JAVA_HOME}$PATH_SEPARATOR${JAVA_HOME}/jre/bin$PATH_SEPARATOR${JAVA_HOME}/bin$PATH_SEPARATOR${JAVA_HOME}/../bin$PATH_SEPARATOR${PATH}"
2584 fi
2585 AC_PATH_PROG(JAVA, java, [], [$JAVA_PATH])
2586
2587 if test -z "$JAVA"; then
2588 warn_java="No Java executable found. Octave will not be able to call Java methods."
2589 break
2590 fi
2591
2592 if test -z "$JAVA_HOME"; then
2593 ## Find JAVA_HOME for JRE by running java and querying properties.
2594 JAVA_TMP_HOME=`"$JAVA" -classpath ${srcdir}/build-aux OctJavaQry JAVA_HOME`
2595 ## Strip directory back to top-level installation dir (JAVA_HOME for JDK).
2596 JAVA_HOME=`echo $JAVA_TMP_HOME | $SED -e 's|[[/\\]]bin[[/\\]]\?$||' | $SED -e 's|[[/\\]]jre[[/\\]]\?$||'`
2597 fi
2598
2599 case $build_os in
2600 mingw* | msdosmsvc)
2601 ## Under Win32 platform, we want JAVA_HOME to be in MSYS format, that is
2602 ## without colon and backslashes, as it is also used as path separator.
2603 ## Use quoted paths as Java may be installed in a path with whitespaces
2604 ## (e.g. C:\Program Files\Java\...).
2605 if test -n "$JAVA_HOME"; then
2606 JAVA_HOME=`cd "$JAVA_HOME" && pwd`
2607 fi
2608 ;;
2609 esac
2610
2611 ## Amend search path for JAVAC and JAR.
2612 if test -z "$JAVA_HOME"; then
2613 JAVA_PATH="$PATH"
2614 else
2615 JAVA_PATH="${JAVA_HOME}$PATH_SEPARATOR${JAVA_HOME}/bin$PATH_SEPARATOR${JAVA_HOME}/../bin$PATH_SEPARATOR${PATH}"
2616 fi
2617
2618 AC_PATH_PROG(JAVAC, javac, [], [$JAVA_PATH])
2619 AC_PATH_PROG(JAR, jar, [], [$JAVA_PATH])
2620
2621 if test -z "$JAVAC" || test -z "$JAR"; then
2622 warn_java="No javac compiler or jar executable found. Octave will not be able to call Java methods."
2623 break
2624 fi
2625
2626 ## Check Java version is recent enough.
2627 AC_MSG_CHECKING([for Java version])
2628 java_version=[`"$JAVA" -version 2>&1 | $SED -n -e 's/^[^ ]* version[^0-9"]*"\([^"]*\)"/\1/p'`]
2629 AC_MSG_RESULT([$java_version])
2630 java_major=[`echo $java_version | $SED -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*$/\1/'`]
2631 java_minor=[`echo $java_version | $SED -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*$/\2/'`]
2632 if test $java_major -ge 1 && test $java_minor -ge 5; then
2633 : # Version is ok. Do nothing.
2634 else
2635 warn_java="Java version is too old (< 1.5). Octave will not be able to call Java methods."
2636 break
2637 fi
2638
2639 ## At this point Win32 systems have enough configuration data.
2640 ## We assume that all appropriate variables (e.g. INCLUDE and LIB) already
2641 ## contain the required paths to compile and link against JDK.
2642 case $host_os in
2643 msdosmsvc)
2644 build_java=yes
2645 JAVA_LIBS=-ladvapi32
2646 AC_DEFINE(HAVE_JAVA, 1,
2647 [Define to 1 if Java is available and is at least version 1.5])
2648 break
2649 ;;
2650 mingw* | cygwin*)
2651 build_java=yes
2652 JAVA_LIBS=-ladvapi32
2653 if test $have_msvc = no; then
2654 if test -n "$JAVA_CPPFLAGS"; then
2655 JAVA_CPPFLAGS="-I\"${JAVA_CPPFLAGS}\" -I\"${JAVA_CPPFLAGS}/win32\""
2656 else
2657 JAVA_CPPFLAGS="-I\"${JAVA_HOME}/include\" -I\"${JAVA_HOME}/include/win32\""
2658 fi
2659 LDFLAGS="$LDFLAGS -Wl,--export-all-symbols"
2660 fi
2661 AC_DEFINE(HAVE_JAVA, 1,
2662 [Define to 1 if Java is available and is at least version 1.5])
2663 break
2664 ;;
2665 esac
2666
2667 ## Determine which library file name to search for.
2668 case $host_os in
2669 darwin*)
2670 jvmlib=libjvm.dylib
2671 ;;
2672 *)
2673 jvmlib=libjvm.so
2674 ;;
2675 esac
2676
2677 AC_MSG_CHECKING([for $jvmlib])
2678
2679 if test -z "$JAVA_LDPATH"; then
2680 ## Run Java to try and determine library path to libjvm.so.
2681 JAVA_TMP_LDPATH=`$JAVA -classpath ${srcdir}/build-aux OctJavaQry JAVA_LDPATH`
2682 JAVA_TMP_LDPATH=`echo $JAVA_TMP_LDPATH | $SED -e "s/${PATH_SEPARATOR}/ /g"`
2683 for dir in $JAVA_TMP_LDPATH; do
2684 if test -f "$dir/$jvmlib"; then
2685 JAVA_LDPATH=$dir
2686 break
2687 fi
2688 done
2689 fi
2690
2691 if test -z "$JAVA_LDPATH"; then
2692 ## Nothing found. Try Java again using bootpath argument.
2693 JAVA_TMP_LDPATH=`$JAVA -classpath ${srcdir}/build-aux OctJavaQry JAVA_BOOTPATH`
2694 JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_TMP_LDPATH}/client ${JAVA_TMP_LDPATH}/server"
2695 for dir in $JAVA_TMP_LDPATH; do
2696 if test -f "$dir/$jvmlib"; then
2697 JAVA_LDPATH=$dir
2698 break
2699 fi
2700 done
2701 fi
2702
2703 if test -z "$JAVA_LDPATH"; then
2704 ## Java failed to find it's own library path. Guess wildly.
2705 JAVA_TMP_LDPATH=`ls -d $JAVA_HOME/jre/lib/*/client`
2706 JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} `ls -d $JAVA_HOME/jre/lib/*/server`"
2707 ## Add some paths that might work on Macs.
2708 JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_HOME}/../Libraries ${JAVA_HOME}/Libraries"
2709 ## Add some paths that might work on MinGW
2710 JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_HOME}/bin/client ${JAVA_HOME}/bin/server"
2711 for dir in $JAVA_TMP_LDPATH; do
2712 if test -f "$dir/$jvmlib"; then
2713 JAVA_LDPATH=$dir
2714 break
2715 fi
2716 done
2717 fi
2718
2719 ## Verify value passed in option --with-java-libdir
2720 if test -n "$JAVA_LDPATH"; then
2721 if test -f "${JAVA_LDPATH}/$jvmlib"; then
2722 : # libjvm found
2723 else
2724 JAVA_LDPATH=""
2725 fi
2726 fi
2727
2728 if test -z "$JAVA_LDPATH"; then
2729 AC_MSG_RESULT([not found])
2730 warn_java="Library $jvmlib not found. Octave will not be able to call Java methods."
2731 break
2732 else
2733 AC_MSG_RESULT([$JAVA_LDPATH])
2734 fi
2735
2736 AC_MSG_CHECKING([for include file <jni.h>])
2737
2738 ## Java and JVM found. Set up flags.
2739 case $host_os in
2740 darwin*)
2741 ## Sneak the -framework flag into mkoctfile via LDFLAGS
2742 LDFLAGS="$LDFLAGS -framework JavaVM"
2743 ## According to: http://developer.apple.com/unix/crossplatform.html
2744 ## one must explicitly set the include path.
2745 ## Unfortunately, the include path keeps moving around.
2746 if test -n "$JAVA_CPPFLAGS"; then
2747 JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS}"
2748 else
2749 JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I/System/Library/Frameworks/JavaVM.framework/Home/include -I/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers"
2750 fi
2751 JAVA_LIBS="-framework JavaVM"
2752 ;;
2753 *)
2754 if test -n "$JAVA_CPPFLAGS"; then
2755 JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS} -I${JAVA_CPPFLAGS}/linux"
2756 else
2757 JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux"
2758 fi
2759 ;;
2760 esac
2761
2762 ## Verify jni.h include file exists.
2763 JNI_PATH=`echo $JAVA_CPPFLAGS | $SED -e 's/-I//g'`
2764 have_jni=no
2765 for dir in $JNI_PATH; do
2766 if test -f "${dir}/jni.h"; then have_jni=yes; break; fi
2767 done
2768 if test $have_jni = yes; then
2769 AC_MSG_RESULT([$dir])
2770 else
2771 AC_MSG_RESULT([not found])
2772 warn_java="Include file <jni.h> not found. Octave will not be able to call Java methods."
2773 break
2774 fi
2775
2776 ## Passed all configuration tests. A workable Java installation was found.
2777 build_java=yes
2778 AC_DEFINE(HAVE_JAVA, 1,
2779 [Define to 1 if Java is available and is at least version 1.5])
2780 break
2781done
2782if test -n "$warn_java"; then
2783 OCTAVE_CONFIGURE_WARNING([warn_java])
2784fi
2785
2786AM_CONDITIONAL([AMCOND_HAVE_JAVA], [test $build_java = yes])
2787AC_SUBST(JAVA)
2788AC_SUBST(JAVAC)
2789AC_SUBST(JAR)
2790AC_SUBST(JAVA_CPPFLAGS)
2791AC_SUBST(JAVA_LIBS)
2792AC_DEFINE_UNQUOTED([JAVA_HOME], ["$JAVA_HOME"], [Java home (top-level installation dir)])
2793AC_DEFINE_UNQUOTED([JAVA_LDPATH], ["$JAVA_LDPATH"], [Java library path (libjvm)])
2794
2795### GUI/Qt related tests.
2796
2797QT_CPPFLAGS=
2798QT_LDFLAGS=
2799QT_LIBS=
2800win32_terminal=no
2801build_gui=yes
2802AC_ARG_ENABLE([gui],
2803 [AS_HELP_STRING([--disable-gui], [don't build the GUI])],
2804 [if test "$enableval" = no; then build_gui=no; fi], [])
2805
2806if test -z "$OPENGL_LIBS"; then
2807 build_gui=no
2808 if test $check_opengl = yes; then
2809 warn_gui="OpenGL libs (GL and GLU) not found -- disabling GUI"
2810 else
2811 warn_gui="--without-opengl was specified -- disabling GUI"
2812 fi
2813 OCTAVE_CONFIGURE_WARNING([warn_gui])
2814fi
2815
2816if test $build_gui = yes; then
2817
2818 warn_gui=""
2819 ## Check for Qt libraries
2820 QT_MODULES="QtCore QtGui QtNetwork QtOpenGL"
2821 PKG_CHECK_MODULES(QT, [$QT_MODULES],
2822 [],
2823 [warn_gui="Qt libraries not found -- disabling GUI"
2824 build_gui=no])
2825
2826 if test $build_gui = yes; then
2827 ## Retrieve Qt compilation and linker flags
2828 QT_CPPFLAGS="`$PKG_CONFIG --cflags-only-I $QT_MODULES`"
2829 QT_LDFLAGS="`$PKG_CONFIG --libs-only-L $QT_MODULES`"
2830 QT_LIBS="`$PKG_CONFIG --libs-only-l $QT_MODULES`"
2831
2832 case $host_os in
2833 *darwin*)
2834 ## Qt might be installed in framework
2835 if test -z "$QT_LIBS"; then
2836 QT_LDFLAGS="`$PKG_CONFIG --libs-only-other $QT_MODULES | tr ' ' '\n' | $GREP -e '-F' | uniq | tr '\n' ' '`"
2837 QT_LIBS="`$PKG_CONFIG --libs-only-other $QT_MODULES | tr ' ' '\n' | $GREP -v -e '-F' | uniq | tr '\n' ' '`"
2838 ## Enabling link_all_deps works around libtool's imperfect handling
2839 ## of the -F flag
2840 AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS],
2841 [test $link_all_deps = yes || test -n "$QT_LDFLAGS"])
2842 fi
2843 ;;
2844 esac
2845
2846 ## Check for Qt4
2847 if ! `$PKG_CONFIG --atleast-version=4.0.0 QtCore`; then
2848 warn_gui="Qt >= 4.0.0 not found -- disabling GUI"
2849 build_gui=no
2850 fi
2851 fi
2852
2853 if test $build_gui = yes; then
2854 AC_CHECK_TOOLS(MOC, [moc-qt4 moc])
2855 AC_CHECK_TOOLS(UIC, [uic-qt4 uic])
2856 AC_CHECK_TOOLS(RCC, [rcc-qt4 rcc])
2857 AC_CHECK_TOOLS(LRELEASE, [lrelease-qt4 lrelease])
2858 if test -n "$MOC" && test -n "$UIC" && test -n "$RCC" && test -n "$LRELEASE"; then
2859 AC_DEFINE(HAVE_QT, 1,
2860 [Define to 1 if Qt is available (libraries, developer header files, utility programs (moc, uic, rcc, and lrelease))])
2861 else
2862 warn_gui="Qt utility programs moc, uic, rcc, and lrelease not found -- disabling GUI"
2863 build_gui=no
2864 fi
2865 fi
2866
2867 if test $build_gui = yes; then
2868 OCTAVE_CHECK_FUNC_QABSTRACTITEMMODEL_BEGINRESETMODEL
2869 if test $octave_cv_func_qabstractitemmodel_beginresetmodel = no; then
2870 warn_gui="QAbstractItemModel::beginResetModel() not found -- disabling GUI"
2871 build_gui=no
2872 fi
2873 fi
2874
2875 if test $build_gui = yes; then
2876 OCTAVE_CHECK_QFONT_MONOSPACE
2877 OCTAVE_CHECK_QFONT_FORCE_INTEGER_METRICS
2878 OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT
2879 OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE
2880 OCTAVE_CHECK_FUNC_QSCI_FINDSELECTION
2881 fi
2882
2883 if test $build_gui = yes; then
2884 ## Check for Qscintilla library which is used in the GUI editor.
2885 AC_CACHE_CHECK([whether Qscintilla library is installed],
2886 [octave_cv_lib_qscintilla],
2887 [save_CPPFLAGS="$CPPFLAGS"
2888 save_LDFLAGS="$LDFLAGS"
2889 save_LIBS="$LIBS"
2890 CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
2891 LDFLAGS="$QT_LDFLAGS $LDFLAGS"
2892 LIBS="$QT_LIBS -lqscintilla2"
2893 AC_LANG_PUSH(C++)
2894 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2895 #include <Qsci/qscilexersql.h>
2896 ]], [[
2897 QsciLexerSQL sqlLexer(0);
2898 ]])],
2899 octave_cv_lib_qscintilla=yes,
2900 octave_cv_lib_qscintilla=no)
2901 CPPFLAGS="$save_CPPFLAGS"
2902 LDFLAGS="$save_LDFLAGS"
2903 LIBS="$save_LIBS"
2904 AC_LANG_POP([C++])
2905 ])
2906 if test $octave_cv_lib_qscintilla = no; then
2907 warn_gui_editor="Qscintilla library not found -- disabling built-in GUI editor"
2908 OCTAVE_CONFIGURE_WARNING([warn_gui_editor])
2909 else
2910 ## Let's assume Qscintilla library is at the same location as
2911 ## other regular Qt libraries.
2912 QT_LIBS="$QT_LIBS -lqscintilla2"
2913 OCTAVE_CHECK_VERSION_2_6_0
2914 AC_DEFINE(HAVE_QSCINTILLA, 1,
2915 [Define to 1 if the QScintilla library and header files are available])
2916
2917 save_CPPFLAGS="$CPPFLAGS"
2918 CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
2919 AC_LANG_PUSH(C++)
2920 AC_CHECK_HEADERS([Qsci/qscilexeroctave.h Qsci/qscilexermatlab.h])
2921 AC_LANG_POP(C++)
2922 CPPFLAGS="$save_CPPFLAGS"
2923 fi
2924
2925 AC_CHECK_FUNCS([setlocale], [],
2926 [warn_gui="setlocale not found -- disabling GUI"
2927 build_gui=no])
2928
2929 if test $build_gui = yes; then
2930 case $host_os in
2931 mingw* | msdosmsvc*)
2932 AC_CHECK_FUNCS([setvbuf], [win32_terminal=yes],
2933 [warn_gui="setvbuf not found -- disabling GUI"
2934 build_gui=no])
2935 ;;
2936 *)
2937 AC_CHECK_HEADERS([pty.h libutil.h util.h])
2938 AC_SEARCH_LIBS([openpty], [util],
2939 [AC_DEFINE(HAVE_OPENPTY, [], [Define whether openpty exists])])
2940 AC_CHECK_FUNCS([chmod chown ftruncate mmap munmap], [],
2941 [AC_MSG_ERROR([At least one of chmod, chown, ftruncate, mmap, and munmap not found -- disabling GUI])
2942 build_gui=no])
2943 ;;
2944 esac
2945 fi
2946 fi
2947
2948 if test -n "$warn_gui"; then
2949 OCTAVE_CONFIGURE_WARNING([warn_gui])
2950 fi
2951fi
2952
2953AM_CONDITIONAL([AMCOND_BUILD_GUI], [test $build_gui = yes])
2954AM_CONDITIONAL([AMCOND_HAVE_QSCINTILLA],
2955 [test "$octave_cv_lib_qscintilla" = yes])
2956AM_CONDITIONAL([WIN32_TERMINAL], [test $win32_terminal = yes])
2957AC_SUBST(QT_CPPFLAGS)
2958AC_SUBST(QT_LDFLAGS)
2959AC_SUBST(QT_LIBS)
2960
2961# do we want to create cross-mkoctfile etc ?
2962cross_tools=no
2963AC_ARG_ENABLE([cross-tools],
2964 [AS_HELP_STRING([--enable-cross-tools],
2965 [build cross tools (mkoctfile, octave-config) if cross compiling])],
2966 [if test "$enableval" = yes; then cross_tools=yes; fi])
2967
2968if test "$cross_tools" = yes; then
2969 if test "$cross_compiling" = no; then
2970 AC_MSG_WARN([ignoring --enable-cross-tools when not cross compiling])
2971 cross_tools=no
2972 fi
2973fi
2974AM_CONDITIONAL([AMCOND_CROSS_TOOLS], [test $cross_tools = yes])
2975
2976
2977### Decide whether or not to install build logs with Octave.
2978
2979install_build_logs=no
2980AC_ARG_ENABLE([install-build-logs],
2981 [AS_HELP_STRING([--enable-install-build-logs],
2982 [install build logs (e.g. config.log) with Octave])],
2983 [if test "$enableval" = yes; then install_build_logs=yes; fi])
2984AM_CONDITIONAL([AMCOND_INSTALL_BUILD_LOGS], [test $install_build_logs = yes])
2985
2986CFLAGS="$original_octave_configure_CFLAGS"
2987CXXFLAGS="$original_octave_configure_CXXFLAGS"
2988
2989AH_BOTTOM([#include "oct-conf-post.h"])
2990
2991### Make all AC_DEFINES available to testif feature of test.m function.
2992### This must reside at the bottom of configure.ac after all AC_DEFINES
2993### have been made.
2994
2995AC_OUTPUT_MAKE_DEFS
2996
2997### Do the substitutions in all the Makefiles.
2998
2999AC_SUBST(ac_config_files)
3000AC_SUBST(ac_config_headers)
3001
3002AC_CONFIG_FILES([
3003 oct-conf-post.h:oct-conf-post.in.h
3004 Makefile
3005 doc/Makefile
3006 doc/doxyhtml/Makefile
3007 doc/doxyhtml/Doxyfile
3008 doc/interpreter/Makefile
3009 doc/liboctave/Makefile
3010 doc/refcard/Makefile
3011 etc/icons/Makefile
3012 examples/Makefile
3013 examples/code/Makefile
3014 examples/data/Makefile
3015 libgnu/Makefile
3016 libgui/Makefile
3017 libinterp/Makefile
3018 liboctave/Makefile
3019 liboctave/cruft/mkf77def
3020 scripts/Makefile
3021 src/Makefile
3022 test/Makefile])
3023
3024AC_OUTPUT
3025
3026### Print a summary so that important information isn't missed.
3027
3028AC_MSG_NOTICE([
3029
3030Octave is now configured for $canonical_host_type
3031
3032 Source directory: $srcdir
3033 Installation prefix: $prefix
3034 C compiler: $CC $XTRA_CFLAGS $WARN_CFLAGS $CFLAGS
3035 C++ compiler: $CXX $XTRA_CXXFLAGS $WARN_CXXFLAGS $CXXFLAGS
3036 Fortran compiler: $F77 $FFLAGS
3037 Fortran libraries: $FLIBS
3038 Lex libraries: $LEXLIB
3039 LIBS: $LIBS
3040
3041 AMD CPPFLAGS: $AMD_CPPFLAGS
3042 AMD LDFLAGS: $AMD_LDFLAGS
3043 AMD libraries: $AMD_LIBS
3044 ARPACK CPPFLAGS: $ARPACK_CPPFLAGS
3045 ARPACK LDFLAGS: $ARPACK_LDFLAGS
3046 ARPACK libraries: $ARPACK_LIBS
3047 BLAS libraries: $BLAS_LIBS
3048 CAMD CPPFLAGS: $CAMD_CPPFLAGS
3049 CAMD LDFLAGS: $CAMD_LDFLAGS
3050 CAMD libraries: $CAMD_LIBS
3051 CARBON libraries: $CARBON_LIBS
3052 CCOLAMD CPPFLAGS: $CCOLAMD_CPPFLAGS
3053 CCOLAMD LDFLAGS: $CCOLAMD_LDFLAGS
3054 CCOLAMD libraries: $CCOLAMD_LIBS
3055 CHOLMOD CPPFLAGS: $CHOLMOD_CPPFLAGS
3056 CHOLMOD LDFLAGS: $CHOLMOD_LDFLAGS
3057 CHOLMOD libraries: $CHOLMOD_LIBS
3058 COLAMD CPPFLAGS: $COLAMD_CPPFLAGS
3059 COLAMD LDFLAGS: $COLAMD_LDFLAGS
3060 COLAMD libraries: $COLAMD_LIBS
3061 CURL CPPFLAGS: $CURL_CPPFLAGS
3062 CURL LDFLAGS: $CURL_LDFLAGS
3063 CURL libraries: $CURL_LIBS
3064 CXSPARSE CPPFLAGS: $CXSPARSE_CPPFLAGS
3065 CXSPARSE LDFLAGS: $CXSPARSE_LDFLAGS
3066 CXSPARSE libraries: $CXSPARSE_LIBS
3067 DL libraries: $DL_LIBS
3068 FFTW3 CPPFLAGS: $FFTW3_CPPFLAGS
3069 FFTW3 LDFLAGS: $FFTW3_LDFLAGS
3070 FFTW3 libraries: $FFTW3_LIBS
3071 FFTW3F CPPFLAGS: $FFTW3F_CPPFLAGS
3072 FFTW3F LDFLAGS: $FFTW3F_LDFLAGS
3073 FFTW3F libraries: $FFTW3F_LIBS
3074 FLTK CPPFLAGS: $FLTK_CPPFLAGS
3075 FLTK LDFLAGS: $FLTK_LDFLAGS
3076 FLTK libraries: $FLTK_LIBS
3077 fontconfig CPPFLAGS: $FONTCONFIG_CPPFLAGS
3078 fontconfig libraries: $FONTCONFIG_LIBS
3079 FreeType2 CPPFLAGS: $FT2_CPPFLAGS
3080 FreeType2 libraries: $FT2_LIBS
3081 GLPK CPPFLAGS: $GLPK_CPPFLAGS
3082 GLPK LDFLAGS: $GLPK_LDFLAGS
3083 GLPK libraries: $GLPK_LIBS
3084 HDF5 CPPFLAGS: $HDF5_CPPFLAGS
3085 HDF5 LDFLAGS: $HDF5_LDFLAGS
3086 HDF5 libraries: $HDF5_LIBS
3087 Java home: $JAVA_HOME
3088 Java JVM path: $JAVA_LDPATH
3089 Java CPPFLAGS: $JAVA_CPPFLAGS
3090 Java libraries: $JAVA_LIBS
3091 LAPACK libraries: $LAPACK_LIBS
3092 LLVM CPPFLAGS: $LLVM_CPPFLAGS
3093 LLVM LDFLAGS: $LLVM_LDFLAGS
3094 LLVM libraries: $LLVM_LIBS
3095 Magick++ CPPFLAGS: $MAGICK_CPPFLAGS
3096 Magick++ LDFLAGS: $MAGICK_LDFLAGS
3097 Magick++ libraries: $MAGICK_LIBS
3098 OPENGL libraries: $OPENGL_LIBS
3099 OSMesa CPPFLAGS: $OSMESA_CPPFLAGS
3100 OSMesa LDFLAGS: $OSMESA_LDFLAGS
3101 OSMesa libraries: $OSMESA_LIBS
3102 PCRE CPPFLAGS: $PCRE_CPPFLAGS
3103 PCRE libraries: $PCRE_LIBS
3104 PortAudio CPPFLAGS: $PORTAUDIO_CPPFLAGS
3105 PortAudio LDFLAGS: $PORTAUDIO_LDFLAGS
3106 PortAudio libraries: $PORTAUDIO_LIBS
3107 PTHREAD flags: $PTHREAD_CFLAGS
3108 PTHREAD libraries: $PTHREAD_LIBS
3109 QHULL CPPFLAGS: $QHULL_CPPFLAGS
3110 QHULL LDFLAGS: $QHULL_LDFLAGS
3111 QHULL libraries: $QHULL_LIBS
3112 QRUPDATE CPPFLAGS: $QRUPDATE_CPPFLAGS
3113 QRUPDATE LDFLAGS: $QRUPDATE_LDFLAGS
3114 QRUPDATE libraries: $QRUPDATE_LIBS
3115 Qt CPPFLAGS: $QT_CPPFLAGS
3116 Qt LDFLAGS: $QT_LDFLAGS
3117 Qt libraries: $QT_LIBS
3118 READLINE libraries: $READLINE_LIBS
3119 Sndfile CPPFLAGS: $SNDFILE_CPPFLAGS
3120 Sndfile LDFLAGS: $SNDFILE_LDFLAGS
3121 Sndfile libraries: $SNDFILE_LIBS
3122 TERM libraries: $TERM_LIBS
3123 UMFPACK CPPFLAGS: $UMFPACK_CPPFLAGS
3124 UMFPACK LDFLAGS: $UMFPACK_LDFLAGS
3125 UMFPACK libraries: $UMFPACK_LIBS
3126 X11 include flags: $X11_INCFLAGS
3127 X11 libraries: $X11_LIBS
3128 Z CPPFLAGS: $Z_CPPFLAGS
3129 Z LDFLAGS: $Z_LDFLAGS
3130 Z libraries: $Z_LIBS
3131
3132 Default pager: $DEFAULT_PAGER
3133 gnuplot: $GNUPLOT
3134
3135 Build Octave GUI: $build_gui
3136 JIT compiler for loops: $build_jit
3137 Build Java interface: $build_java
3138 Do internal array bounds checking: $BOUNDS_CHECKING
3139 Build static libraries: $STATIC_LIBS
3140 Build shared libraries: $SHARED_LIBS
3141 Dynamic Linking: $ENABLE_DYNAMIC_LINKING $DL_API_MSG
3142 Include support for GNU readline: $USE_READLINE
3143 64-bit array dims and indexing: $USE_64_BIT_IDX_T
3144 OpenMP SMP multithreading: $USE_OPENMP
3145 Build cross tools: $cross_tools
3146])
3147
3148warn_msg_printed=false
3149
3150OCTAVE_CONFIGURE_WARNING_SUMMARY
3151
3152if test $ENABLE_DYNAMIC_LINKING = yes; then
3153 if test $SHARED_LIBS = no; then
3154 AC_MSG_WARN([You used --enable-dl but not --enable-shared.])
3155 AC_MSG_WARN([Are you sure that is what you want to do?])
3156 warn_msg_printed=true
3157 fi
3158fi
3159
3160if test $USE_64_BIT_IDX_T = yes; then
3161 AC_MSG_WARN([])
3162 AC_MSG_WARN([You used the EXPERIMENTAL --enable-64 option.])
3163 AC_MSG_WARN([Are you sure that is what you want to do?])
3164 AC_MSG_WARN([])
3165 AC_MSG_WARN([Your Fortran compiler must have an option to generate])
3166 AC_MSG_WARN([code with 8 byte signed INTEGER values. This option])
3167 AC_MSG_WARN([should be specified in the F77_INTEGER_8_FLAG variable])
3168 AC_MSG_WARN([Make. This should work automatically for gfortran. If])
3169 AC_MSG_WARN([you use another compiler, you will need to set this])
3170 AC_MSG_WARN([variable on the configure command line. You must also])
3171 AC_MSG_WARN([compile the ARPACK, BLAS, LAPACK, QRUPDATE, and SuiteSparse])
3172 AC_MSG_WARN([libraries to use 8 byte signed integers for array indexing.])
3173 AC_MSG_WARN([])
3174 warn_msg_printed=true
3175fi
3176
3177if test $native_graphics != yes; then
3178 AC_MSG_WARN([])
3179 AC_MSG_WARN([I didn't find the necessary libraries to compile native])
3180 AC_MSG_WARN([graphics. It isn't necessary to have native graphics,])
3181 AC_MSG_WARN([but you will need to have gnuplot installed or you won't])
3182 AC_MSG_WARN([be able to use any of Octave's plotting commands])
3183 AC_MSG_WARN([])
3184 warn_msg_printed=true
3185fi
3186
3187if test -n "$warn_gnuplot"; then
3188 if test $native_graphics = yes; then
3189 AC_MSG_WARN([])
3190 AC_MSG_WARN([I didn't find gnuplot. Plotting commands will use the])
3191 AC_MSG_WARN([native graphics toolkit.])
3192 else
3193 AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot])
3194 AC_MSG_WARN([installed, but you won't be able to use any of Octave's])
3195 AC_MSG_WARN([plotting commands without it.])
3196 fi
3197 AC_MSG_WARN([])
3198 AC_MSG_WARN([If gnuplot is installed, but isn't in your path, you can])
3199 AC_MSG_WARN([tell Octave where to find it by using the gnuplot_binary])
3200 AC_MSG_WARN([function. For example,])
3201 AC_MSG_WARN([])
3202 AC_MSG_WARN([gnuplot_binary ("/full/path/and/name/of/gnuplot/binary")])
3203 AC_MSG_WARN([])
3204 AC_MSG_WARN([at the Octave prompt.])
3205 AC_MSG_WARN([])
3206 AC_MSG_WARN([Setting default value to $GNUPLOT])
3207 AC_MSG_WARN([])
3208
3209 warn_msg_printed=true
3210fi
3211
3212if test $USE_ATOMIC_REFCOUNT = no; then
3213 AC_MSG_WARN([])
3214 AC_MSG_WARN([atomic reference counting disabled.])
3215 AC_MSG_WARN([This feature allows access to Octave data safely from])
3216 AC_MSG_WARN([another thread, and is required when using the GUI's Qt toolkit])
3217 AC_MSG_WARN([for plotting.])
3218 AC_MSG_WARN([])
3219fi
3220
3221if $warn_msg_printed; then
3222 AC_MSG_NOTICE([])
3223 AC_MSG_NOTICE([NOTE: Libraries or auxiliary programs may be skipped if they are])
3224 AC_MSG_NOTICE([NOTE: not found OR if they are missing required features on your])
3225 AC_MSG_NOTICE([NOTE: system. ])
3226fi
3227
3228### End of configure.
03229
=== added directory '.pc/qt-requires-opengl.patch/m4'
=== added file '.pc/qt-requires-opengl.patch/m4/acinclude.m4'
--- .pc/qt-requires-opengl.patch/m4/acinclude.m4 1970-01-01 00:00:00 +0000
+++ .pc/qt-requires-opengl.patch/m4/acinclude.m4 2015-08-02 19:51:25 +0000
@@ -0,0 +1,2448 @@
1dnl aclocal.m4 -- extra macros for configuring Octave
2dnl
3dnl Copyright (C) 1995-2015 John W. Eaton
4dnl
5dnl This file is part of Octave.
6dnl
7dnl Octave is free software; you can redistribute it and/or modify it
8dnl under the terms of the GNU General Public License as published by the
9dnl Free Software Foundation; either version 3 of the License, or (at
10dnl your option) any later version.
11dnl
12dnl Octave is distributed in the hope that it will be useful, but WITHOUT
13dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15dnl for more details.
16dnl
17dnl You should have received a copy of the GNU General Public License
18dnl along with Octave; see the file COPYING. If not, see
19dnl <http://www.gnu.org/licenses/>.
20dnl
21dnl
22dnl Copyright (C) 2008 - 2009 Free Software Foundation, Inc.
23dnl
24dnl If needed, define the m4_ifblank and m4_ifnblank macros from autoconf 2.64
25dnl This allows us to run with earlier Autoconfs as well.
26dnl FIXME: these should go away once Autoconf 2.64 is required or ubiquitous.
27dnl
28ifdef([m4_ifblank],[],[
29m4_define([m4_ifblank],
30[m4_if(m4_translit([[$1]], [ ][ ][
31]), [], [$2], [$3])])])
32dnl
33ifdef([m4_ifnblank],[],[
34m4_define([m4_ifnblank],
35[m4_if(m4_translit([[$1]], [ ][ ][
36]), [], [$3], [$2])])])
37dnl
38dnl ----------------------------------------------------------------------
39dnl
40
41dnl
42dnl Alphabetical list of macros in the OCTAVE_ namespace
43dnl
44
45dnl
46dnl Check if the Carbon Framework defines CGDisplayBitsPerPixel.
47dnl
48AC_DEFUN([OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL], [
49 AC_CACHE_CHECK([whether CGDisplayBitsPerPixel is defined in the Carbon Framework],
50 [octave_cv_func_carbon_cgdisplaybitsperpixel],
51 [AC_LANG_PUSH(C++)
52 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
53 #include <Carbon/Carbon.h>
54 ]], [[
55 CGDirectDisplayID display = CGMainDisplayID ();
56 size_t depth = CGDisplayBitsPerPixel (display);
57 ]])],
58 octave_cv_func_carbon_cgdisplaybitsperpixel=yes,
59 octave_cv_func_carbon_cgdisplaybitsperpixel=no)
60 AC_LANG_POP(C++)
61 ])
62 if test $octave_cv_func_carbon_cgdisplaybitsperpixel = yes; then
63 AC_DEFINE(HAVE_CARBON_CGDISPLAYBITSPERPIXEL, 1,
64 [Define to 1 if Carbon Framework has CGDisplayBitsPerPixel.])
65 fi
66])
67dnl
68dnl Check if C compiler handles FLAG command line option. If two
69dnl arguments are specified, execute the second arg as shell commands.
70dnl Otherwise, add FLAG to CFLAGS if the compiler accepts the flag.
71dnl
72AC_DEFUN([OCTAVE_CC_FLAG], [
73 ac_safe=`echo "$1" | $SED 'y% ./+-:=%___p___%'`
74 AC_MSG_CHECKING([whether ${CC-cc} accepts $1])
75 AC_CACHE_VAL([octave_cv_cc_flag_$ac_safe],
76 [AC_LANG_PUSH(C)
77 ac_octave_save_CFLAGS="$CFLAGS"
78 CFLAGS="$CFLAGS $1"
79 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
80 [eval "octave_cv_cc_flag_$ac_safe=yes"],
81 [eval "octave_cv_cc_flag_$ac_safe=no"])
82 CFLAGS="$ac_octave_save_CFLAGS"
83 AC_LANG_POP(C)
84 ])
85 if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then
86 AC_MSG_RESULT([yes])
87 ifelse([$2], ,
88 [CFLAGS="$CFLAGS $1"
89 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2])
90 else
91 AC_MSG_RESULT([no])
92 ifelse([$3], , , [$3])
93 fi
94])
95dnl
96dnl Check for broken stl_algo.h header file in gcc versions 4.8.0, 4.8.1, 4.8.2
97dnl which leads to failures in nth_element.
98dnl
99AC_DEFUN([OCTAVE_CHECK_BROKEN_STL_ALGO_H], [
100 AC_CACHE_CHECK([whether stl_algo.h is broken],
101 [octave_cv_broken_stl_algo_h],
102 [AC_LANG_PUSH(C++)
103 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
104// Based on code from a GCC test program.
105
106// Copyright (C) 2013 Free Software Foundation, Inc.
107//
108// This file is part of the GNU ISO C++ Library. This library is free
109// software; you can redistribute it and/or modify it under the
110// terms of the GNU General Public License as published by the
111// Free Software Foundation; either version 3, or (at your option)
112// any later version.
113
114// This library is distributed in the hope that it will be useful,
115// but WITHOUT ANY WARRANTY; without even the implied warranty of
116// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117// GNU General Public License for more details.
118
119// You should have received a copy of the GNU General Public License along
120// with this library; see the file COPYING3. If not see
121// <http://www.gnu.org/licenses/>.
122
123// 25.3.2 [lib.alg.nth.element]
124
125// { dg-options "-std=gnu++11" }
126
127#include <algorithm>
128#include <vector>
129 ]], [[
130std::vector<int> v (7);
131
132v[0] = 207089;
133v[1] = 202585;
134v[2] = 180067;
135v[3] = 157549;
136v[4] = 211592;
137v[5] = 216096;
138v[6] = 207089;
139
140std::nth_element (v.begin (), v.begin () + 3, v.end ());
141
142return v[3] == 207089 ? 0 : 1;
143 ]])],
144 octave_cv_broken_stl_algo_h=no,
145 octave_cv_broken_stl_algo_h=yes,
146 [case "$GXX_VERSION" in
147 *4.8.2*)
148 octave_cv_broken_stl_algo_h=yes
149 ;;
150 *)
151 octave_cv_broken_stl_algo_h=no
152 ;;
153 esac
154 ])
155 AC_LANG_POP(C++)
156 ])
157 if test "$GXX" = yes; then
158 if test $octave_cv_broken_stl_algo_h = yes; then
159 case "$GXX_VERSION" in
160 4.8.[[012]])
161 ;;
162 *)
163 octave_cv_broken_stl_algo_h=no
164 warn_stl_algo_h="UNEXPECTED: found nth_element broken in g++ $GXX_VERSION. Refusing to fix except for g++ 4.8.0, 4.8.1, or 4.8.2. You appear to have g++ $GXX_VERSION."
165 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
166 ;;
167 esac
168 else
169 case "$GXX_VERSION" in
170 4.8.2)
171 warn_stl_algo_h="UNEXPECTED: found nth_element working in g++ 4.8.2. Has it been patched on your system?"
172 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
173 ;;
174 esac
175 fi
176 else
177 octave_cv_broken_stl_algo_h=no
178 warn_stl_algo_h="UNEXPECTED: nth_element test failed. Refusing to fix except for g++ 4.8.2."
179 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
180 fi
181])
182dnl
183dnl Check whether the FFTW library supports multi-threading. This macro
184dnl should be called once per FFTW precision passing in the library
185dnl variant (e.g. "fftw3") and a function in the thread support API
186dnl (e.g. "fftw_plan_with_nthreads"). Depending on how FFTW was built,
187dnl the thread functions could be compiled into the main FFTW library or
188dnl could be a separate add-on library that is passed to the linker
189dnl ahead of the main FFTW library.
190dnl
191AC_DEFUN([OCTAVE_CHECK_FFTW_THREADS], [
192 ac_octave_save_CPPFLAGS="$CPPFLAGS"
193 ac_octave_save_LDFLAGS="$LDFLAGS"
194 ac_octave_save_LIBS="$LIBS"
195 CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS"
196 LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS"
197 LIBS="$m4_toupper([$1])_LIBS $LIBS"
198 AC_CACHE_CHECK([for $1 multi-threading support],
199 [octave_cv_[$1]_threads_lib],
200 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
201 #include <fftw3.h>
202 ]], [[
203 $2 (2);
204 ]])],
205 [octave_cv_[$1]_threads_lib=yes],
206 [LIBS="-l[$1]_threads $LIBS"
207 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
208 #include <fftw3.h>
209 ]], [[
210 $2 (2);
211 ]])],
212 [octave_cv_[$1]_threads_lib="-l[$1]_threads"],
213 [octave_cv_[$1]_threads_lib=no])
214 ])
215 ])
216 case $octave_cv_[$1]_threads_lib in
217 -l*)
218 m4_toupper([$1])_LIBS="$octave_cv_[$1]_threads_lib $m4_toupper([$1])_LIBS"
219 ;;
220 no)
221 AC_MSG_WARN([No $1 multi-threading support found.])
222 AC_MSG_WARN([The single-threaded library will be used instead.])
223 ;;
224 esac
225 if test $octave_cv_[$1]_threads_lib != no; then
226 AC_DEFINE([HAVE_]m4_toupper([$1])[_THREADS], 1,
227 [Define to 1 if ]m4_toupper([$1])[ has multi-threading support.])
228 fi
229 CPPFLAGS="$ac_octave_save_CPPFLAGS"
230 LDFLAGS="$ac_octave_save_LDFLAGS"
231 LIBS="$ac_octave_save_LIBS"
232])
233dnl
234dnl Check whether a math mapper function is available in <cmath>.
235dnl Will define HAVE_CMATH_FUNC if there is a double variant and
236dnl HAVE_CMATH_FUNCF if there is a float variant.
237dnl Currently capable of checking for functions with single
238dnl argument and returning bool/int/real.
239dnl
240AC_DEFUN([OCTAVE_CHECK_FUNC_CMATH], [
241 ac_safe=`echo "$1" | $SED 'y% ./+-:=%___p___%'`
242
243 AC_CACHE_CHECK([for std::$1 in <cmath>],
244 [octave_cv_func_cmath_$ac_safe],
245 [AC_LANG_PUSH(C++)
246 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
247 #include <cmath>
248 void take_func (bool (*func) (double x));
249 void take_func (int (*func) (double x));
250 void take_func (double (*func) (double x));
251 ]], [[
252 take_func(std::$1);
253 ]])],
254 [eval "octave_cv_func_cmath_$ac_safe=yes"],
255 [eval "octave_cv_func_cmath_$ac_safe=no"])
256 AC_LANG_POP(C++)
257 ])
258 if eval "test \"`echo '$octave_cv_func_cmath_'$ac_safe`\" = yes"; then
259 AC_DEFINE(AS_TR_CPP([[HAVE_CMATH_][$1]]), 1,
260 [Define to 1 if <cmath> provides $1.])
261 fi
262
263 AC_CACHE_CHECK([for std::$1 (float variant) in <cmath>],
264 [octave_cv_func_cmath_f$ac_safe],
265 [AC_LANG_PUSH(C++)
266 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
267 #include <cmath>
268 void take_func (bool (*func) (float x));
269 void take_func (int (*func) (float x));
270 void take_func (float (*func) (float x));
271 ]], [[
272 take_func(std::$1);
273 ]])],
274 [eval "octave_cv_func_cmath_f$ac_safe=yes"],
275 [eval "octave_cv_func_cmath_f$ac_safe=no"])
276 AC_LANG_POP(C++)
277 ])
278 if eval "test \"`echo '$octave_cv_func_cmath_f'$ac_safe`\" = yes"; then
279 AC_DEFINE(AS_TR_CPP([[HAVE_CMATH_][$1][F]]), 1,
280 [Define to 1 if <cmath> provides float variant of $1.])
281 fi
282])
283dnl
284dnl Check whether Qscintilla has version 2.6.0 or later
285dnl FIXME: This test uses a version number. It potentially could
286dnl be re-written to actually call the function, but is it worth it?
287dnl
288AC_DEFUN([OCTAVE_CHECK_VERSION_2_6_0], [
289 AC_CACHE_CHECK([whether Qscintilla has version 2.6.0 or later],
290 [octave_cv_version_2_6_0],
291 [AC_LANG_PUSH(C++)
292 ac_octave_save_CPPFLAGS="$CPPFLAGS"
293 CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
294 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
295 #include <Qsci/qsciglobal.h>
296 ]], [[
297 #if QSCINTILLA_VERSION < 0x020600
298 #error Old FindFirst function found.
299 #endif
300 ]])],
301 octave_cv_version_2_6_0=yes,
302 octave_cv_version_2_6_0=no)
303 CPPFLAGS="$ac_octave_save_CPPFLAGS"
304 AC_LANG_POP(C++)
305 ])
306 if test $octave_cv_version_2_6_0 = yes; then
307 AC_DEFINE(HAVE_QSCI_VERSION_2_6_0, 1,
308 [Define to 1 if Qscintilla is of Version 2.6.0 or later.])
309 fi
310])
311dnl
312dnl Check if Fortran compiler has the intrinsic function ISNAN.
313dnl
314AC_DEFUN([OCTAVE_CHECK_FUNC_FORTRAN_ISNAN], [
315 AC_CACHE_CHECK([whether $F77 has the intrinsic function ISNAN],
316 [octave_cv_func_fortran_isnan],
317 [AC_LANG_PUSH(Fortran 77)
318 AC_COMPILE_IFELSE([[
319 program foo
320 implicit none
321 real x
322 double precision y
323 if (isnan(x)) then
324 print *, 'x is NaN'
325 end if
326 if (isnan(y)) then
327 print *, 'y is NaN'
328 end if
329 end program
330 ]],
331 octave_cv_func_fortran_isnan=yes, octave_cv_func_fortran_isnan=no)
332 AC_LANG_POP(Fortran 77)
333 ])
334])
335dnl
336dnl Check if function gluTessCallback is called with "(...)".
337dnl
338AC_DEFUN([OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS], [
339 AC_CACHE_CHECK([whether gluTessCallback is called with "(...)"],
340 [octave_cv_func_glutesscallback_threedots],
341 [AC_LANG_PUSH(C++)
342 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
343 #ifdef HAVE_GL_GLU_H
344 # include <GL/glu.h>
345 #elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL
346 # include <OpenGL/glu.h>
347 #endif
348 ]], [[
349 GLvoid (*func)(...);
350 gluTessCallback(0, 0, func);
351 ]])],
352 octave_cv_func_glutesscallback_threedots=yes,
353 octave_cv_func_glutesscallback_threedots=no)
354 AC_LANG_POP(C++)
355 ])
356 if test $octave_cv_func_glutesscallback_threedots = yes; then
357 AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1,
358 [Define to 1 if gluTessCallback is called with (...).])
359 fi
360])
361dnl
362dnl Check whether Qt provides QFont::Monospace
363dnl
364AC_DEFUN([OCTAVE_CHECK_QFONT_MONOSPACE], [
365 AC_CACHE_CHECK([whether Qt provides QFont::Monospace],
366 [octave_cv_decl_qfont_monospace],
367 [AC_LANG_PUSH(C++)
368 ac_octave_save_CPPFLAGS="$CPPFLAGS"
369 CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
370 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
371 #include <QFont>
372 ]], [[
373 QFont::StyleHint hint = QFont::Monospace;
374 ]])],
375 octave_cv_decl_qfont_monospace=yes,
376 octave_cv_decl_qfont_monospace=no)
377 CPPFLAGS="$ac_octave_save_CPPFLAGS"
378 AC_LANG_POP(C++)
379 ])
380 if test $octave_cv_decl_qfont_monospace = yes; then
381 AC_DEFINE(HAVE_QFONT_MONOSPACE, 1,
382 [Define to 1 if Qt provides QFont::Monospace.])
383 fi
384])
385dnl
386dnl Check whether Qt provides QFont::ForceIntegerMetrics
387dnl
388AC_DEFUN([OCTAVE_CHECK_QFONT_FORCE_INTEGER_METRICS], [
389 AC_CACHE_CHECK([whether Qt provides QFont::ForceIntegerMetrics],
390 [octave_cv_decl_qfont_force_integer_metrics],
391 [AC_LANG_PUSH(C++)
392 ac_octave_save_CPPFLAGS="$CPPFLAGS"
393 CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
394 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
395 #include <QFont>
396 ]], [[
397 QFont::StyleStrategy strategy = QFont::ForceIntegerMetrics;
398 ]])],
399 octave_cv_decl_qfont_force_integer_metrics=yes,
400 octave_cv_decl_qfont_force_integer_metrics=no)
401 CPPFLAGS="$ac_octave_save_CPPFLAGS"
402 AC_LANG_POP(C++)
403 ])
404 if test $octave_cv_decl_qfont_force_integer_metrics = yes; then
405 AC_DEFINE(HAVE_QFONT_FORCE_INTEGER_METRICS, 1,
406 [Define to 1 if Qt provides QFont::ForceIntegerMetrics.])
407 fi
408])
409dnl
410dnl Check whether Qscintilla SetPlaceholderText function exists.
411dnl FIXME: This test uses a version number. It potentially could
412dnl be re-written to actually call the function, but is it worth it?
413dnl
414AC_DEFUN([OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT], [
415 AC_CACHE_CHECK([whether Qt has SetPlaceholderText function],
416 [octave_cv_func_setplaceholdertext],
417 [AC_LANG_PUSH(C++)
418 ac_octave_save_CPPFLAGS="$CPPFLAGS"
419 CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
420 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
421 #include <Qt/qglobal.h>
422 ]], [[
423 #if QT_VERSION < 0x040700
424 #error No SetPlacholderText function available.
425 #endif
426 ]])],
427 octave_cv_func_setplaceholdertext=yes,
428 octave_cv_func_setplaceholdertext=no)
429 CPPFLAGS="$ac_octave_save_CPPFLAGS"
430 AC_LANG_POP(C++)
431 ])
432 if test $octave_cv_func_setplaceholdertext = yes; then
433 AC_DEFINE(HAVE_SETPLACEHOLDERTEXT, 1,
434 [Define to 1 if you have the Qt SetPlaceholderText function.])
435 fi
436])
437dnl
438dnl Check whether the Qt QAbstractItemModel::beginResetModel() function exists.
439dnl Also checks for QAbstractItemModel::endResetModel(). These are two of the
440dnl newest Qt functions that the Octave GUI depends on, added in Qt 4.6.
441dnl
442AC_DEFUN([OCTAVE_CHECK_FUNC_QABSTRACTITEMMODEL_BEGINRESETMODEL], [
443 AC_CACHE_CHECK([whether Qt has the QAbstractItemModel::beginResetModel() function],
444 [octave_cv_func_qabstractitemmodel_beginresetmodel],
445 [AC_LANG_PUSH(C++)
446 ac_octave_save_CPPFLAGS="$CPPFLAGS"
447 CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
448 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
449 #include <QAbstractItemModel>
450 class item_model : public QAbstractItemModel
451 {
452 public:
453 item_model (QObject *parent = 0) : QAbstractItemModel (parent) {}
454 ~item_model () {}
455 QModelIndex index (int, int, const QModelIndex& m) const { return m; }
456 QModelIndex parent (const QModelIndex& m) const { return m; }
457 int columnCount (const QModelIndex&) const { return 0; }
458 int rowCount (const QModelIndex&) const { return 0; }
459 QVariant data (const QModelIndex&, int) const { return QVariant(); }
460 void update_model ()
461 {
462 this->beginResetModel ();
463 this->endResetModel ();
464 }
465 };
466 ]], [[
467 item_model model;
468 model.update_model ();
469 ]])],
470 octave_cv_func_qabstractitemmodel_beginresetmodel=yes,
471 octave_cv_func_qabstractitemmodel_beginresetmodel=no)
472 CPPFLAGS="$ac_octave_save_CPPFLAGS"
473 AC_LANG_POP(C++)
474 ])
475 if test $octave_cv_func_qabstractitemmodel_beginresetmodel = yes; then
476 AC_DEFINE(HAVE_QABSTRACTITEMMODEL_BEGINRESETMODEL, 1,
477 [Define to 1 if Qt has the QAbstractItemModel::beginResetModel() function.])
478 fi
479])
480dnl
481dnl Check whether the Qt QTabWidget::setMovable() function exists.
482dnl This function was added in Qt 4.5.
483dnl
484AC_DEFUN([OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE], [
485 AC_CACHE_CHECK([whether Qt has the QTabWidget::setMovable() function],
486 [octave_cv_func_qtabwidget_setmovable],
487 [AC_LANG_PUSH(C++)
488 ac_octave_save_CPPFLAGS="$CPPFLAGS"
489 CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
490 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
491 #include <QTabWidget>
492 class tab_widget : public QTabWidget
493 {
494 public:
495 tab_widget (QWidget *parent = 0) : QTabWidget (parent) { this->setMovable (true); }
496 ~tab_widget () {}
497 };
498 ]], [[
499 tab_widget tw;
500 ]])],
501 octave_cv_func_qtabwidget_setmovable=yes,
502 octave_cv_func_qtabwidget_setmovable=no)
503 CPPFLAGS="$ac_octave_save_CPPFLAGS"
504 AC_LANG_POP(C++)
505 ])
506 if test $octave_cv_func_qtabwidget_setmovable = yes; then
507 AC_DEFINE(HAVE_QTABWIDGET_SETMOVABLE, 1,
508 [Define to 1 if Qt has the QTabWidget::setMovable() function.])
509 fi
510])
511dnl
512dnl Check whether the QsciScintilla::findFirstInSelection () function exists.
513dnl This function was added in QScintilla 2.7.
514dnl
515AC_DEFUN([OCTAVE_CHECK_FUNC_QSCI_FINDSELECTION], [
516 AC_CACHE_CHECK([whether QSci has the QsciScintilla::findFirstInSelection () function],
517 [octave_cv_func_qsci_findfirstinselection],
518 [AC_LANG_PUSH(C++)
519 ac_octave_save_CPPFLAGS="$CPPFLAGS"
520 CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
521 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
522 #include <Qsci/qsciscintilla.h>
523 class qsci : public QsciScintilla
524 {
525 public:
526 qsci (QWidget *parent = 0) : QsciScintilla (parent)
527 { this->findFirstInSelection (QString ("x"),true,true,true,true,true); }
528 ~qsci () {}
529 };
530 ]], [[
531 qsci edit;
532 ]])],
533 octave_cv_func_qsci_findfirstinselection=yes,
534 octave_cv_func_qsci_findfirstinselection=no)
535 CPPFLAGS="$ac_octave_save_CPPFLAGS"
536 AC_LANG_POP(C++)
537 ])
538 if test $octave_cv_func_qsci_findfirstinselection = yes; then
539 AC_DEFINE(HAVE_QSCI_FINDSELECTION, 1,
540 [Define to 1 if Qsci has the QsciScintilla::findFirstInSelection () function.])
541 fi
542])
543dnl
544dnl Check whether HDF5 library has version 1.6 API functions.
545dnl
546AC_DEFUN([OCTAVE_CHECK_HDF5_HAS_VER_16_API], [
547 AC_CACHE_CHECK([whether HDF5 library has enforced version 1.6 API],
548 [octave_cv_hdf5_has_ver_16_api],
549 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
550 #include <hdf5.h>
551 ]], [[
552 H5Eset_auto (0, 0);
553 ]])],
554 octave_cv_hdf5_has_ver_16_api=yes,
555 octave_cv_hdf5_has_ver_16_api=no)
556 ])
557 if test $octave_cv_hdf5_has_ver_16_api != yes; then
558 AC_DEFINE(HAVE_HDF5_18, 1, [Define to 1 if >=HDF5-1.8 is available.])
559 fi
560])
561dnl
562dnl Usage:
563dnl OCTAVE_CHECK_LIB(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC,
564dnl LANG, DOC-STRING, EXTRA-CHECK)
565dnl
566AC_DEFUN([OCTAVE_CHECK_LIB], [
567 AC_ARG_WITH([$1-includedir],
568 [AS_HELP_STRING([--with-$1-includedir=DIR],
569 [look for $2 include files in DIR])],
570 [m4_toupper([$1])_CPPFLAGS="-I$withval"])
571 AC_SUBST(m4_toupper([$1])_CPPFLAGS)
572
573 AC_ARG_WITH([$1-libdir],
574 [AS_HELP_STRING([--with-$1-libdir=DIR],
575 [look for $2 libraries in DIR])],
576 [m4_toupper([$1])_LDFLAGS="-L$withval"])
577 AC_SUBST(m4_toupper([$1])_LDFLAGS)
578
579 AC_ARG_WITH([$1],
580 [m4_ifblank([$7],
581 [AS_HELP_STRING([--without-$1], [don't use $2 library])],
582 [AS_HELP_STRING([--without-$1], [$7])])],
583 with_$1=$withval, with_$1=yes)
584
585 m4_toupper([$1])_LIBS=
586 case $with_$1 in
587 no)
588 m4_toupper([$1])_LIBS=
589 ;;
590 yes | "")
591 m4_toupper([$1])_LIBS="-l$1"
592 ;;
593 -* | */* | *.a | *.so | *.so.* | *.o)
594 m4_toupper([$1])_LIBS="$with_$1"
595 ;;
596 *)
597 m4_toupper([$1])_LIBS="-l$with_$1"
598 ;;
599 esac
600
601 warn_$1="$3"
602 m4_set_add([summary_warning_list], [warn_$1])
603
604 if test -n "$m4_toupper([$1])_LIBS"; then
605 ac_octave_save_CPPFLAGS="$CPPFLAGS"
606 ac_octave_save_LDFLAGS="$LDFLAGS"
607 ac_octave_save_LIBS="$LIBS"
608 CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS"
609 LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS"
610 LIBS="$m4_toupper([$1])_LIBS $LIBS"
611 m4_ifnblank([$6], [AC_LANG_PUSH($6)])
612 ac_octave_$1_check_for_lib=no
613 m4_ifblank([$4], [ac_octave_$1_check_for_lib=yes],
614 [AC_CHECK_HEADERS([$4], [ac_octave_$1_check_for_lib=yes; break])])
615 if test $ac_octave_$1_check_for_lib = yes; then
616 AC_CACHE_CHECK([for $5 in $m4_toupper([$1])_LIBS],
617 [octave_cv_lib_$1],
618 [AC_LINK_IFELSE([AC_LANG_CALL([], [$5])],
619 [octave_cv_lib_$1=yes], [octave_cv_lib_$1=no])
620 ])
621 if test "$octave_cv_lib_$1" = yes; then
622 m4_ifblank([$8], [
623 warn_$1=
624 AC_DEFINE([HAVE_]m4_toupper([$1]), 1,
625 [Define to 1 if $2 is available.])], [$8])
626 fi
627 fi
628 m4_ifnblank([$6], [AC_LANG_POP($6)])
629 CPPFLAGS="$ac_octave_save_CPPFLAGS"
630 LDFLAGS="$ac_octave_save_LDFLAGS"
631 LIBS="$ac_octave_save_LIBS"
632 fi
633
634 AC_SUBST(m4_toupper([$1])_LIBS)
635 if test -n "$warn_$1"; then
636 AC_MSG_WARN([$warn_$1])
637 m4_toupper([$1])_LIBS=
638 fi
639])
640dnl
641dnl Check whether ARPACK works (does not crash).
642dnl
643dnl Using a pure Fortran program doesn't seem to crash when linked
644dnl with the buggy ARPACK library but the C++ program does. Maybe it
645dnl is the memory allocation that exposes the bug and using statically
646dnl allocated arrays in Fortran does not?
647dnl
648dnl FIXME: it would be nice to avoid the duplication of F77 macros
649dnl and typedefs here and in the f77-fcn.h header file.
650dnl
651AC_DEFUN([OCTAVE_CHECK_LIB_ARPACK_OK], [
652 AC_CACHE_CHECK([whether the arpack library works],
653 [octave_cv_lib_arpack_ok],
654 [AC_LANG_PUSH(C++)
655 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
656
657#include <cfloat>
658
659#include <stdint.h>
660
661typedef OCTAVE_IDX_TYPE octave_idx_type;
662typedef int F77_RET_T;
663
664#define F77_CHAR_ARG2(x, l) x
665#define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l)
666
667#define F77_CHAR_ARG_LEN(l) , l
668
669#define F77_CONST_CHAR_ARG_DECL const char *
670#define F77_CHAR_ARG_LEN_DECL , long
671
672extern "C"
673{
674 F77_RET_T
675 F77_FUNC (dnaupd, DNAUPD) (octave_idx_type&,
676 F77_CONST_CHAR_ARG_DECL,
677 const octave_idx_type&,
678 F77_CONST_CHAR_ARG_DECL,
679 octave_idx_type&, const double&,
680 double*, const octave_idx_type&, double*,
681 const octave_idx_type&, octave_idx_type*,
682 octave_idx_type*, double*, double*,
683 const octave_idx_type&, octave_idx_type&
684 F77_CHAR_ARG_LEN_DECL
685 F77_CHAR_ARG_LEN_DECL);
686
687 F77_RET_T
688 F77_FUNC (dneupd, DNEUPD) (const octave_idx_type&,
689 F77_CONST_CHAR_ARG_DECL,
690 octave_idx_type*, double*, double*,
691 double*, const octave_idx_type&, const double&,
692 const double&, double*,
693 F77_CONST_CHAR_ARG_DECL,
694 const octave_idx_type&,
695 F77_CONST_CHAR_ARG_DECL,
696 octave_idx_type&, const double&, double*,
697 const octave_idx_type&, double*,
698 const octave_idx_type&, octave_idx_type*,
699 octave_idx_type*, double*, double*,
700 const octave_idx_type&, octave_idx_type&
701 F77_CHAR_ARG_LEN_DECL
702 F77_CHAR_ARG_LEN_DECL
703 F77_CHAR_ARG_LEN_DECL);
704
705 F77_RET_T
706 F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG_DECL,
707 const octave_idx_type&, const octave_idx_type&,
708 const double&, const double*,
709 const octave_idx_type&, const double*,
710 const octave_idx_type&, const double&, double*,
711 const octave_idx_type&
712 F77_CHAR_ARG_LEN_DECL);
713}
714
715void
716doit (void)
717{
718 // Based on function EigsRealNonSymmetricMatrix from liboctave/eigs-base.cc.
719
720 // Problem matrix. See bug #31479
721 octave_idx_type n = 4;
722 double *m = new double [n * n];
723 m[0] = 1, m[4] = 0, m[8] = 0, m[12] = -1;
724 m[1] = 0, m[5] = 1, m[9] = 0, m[13] = 0;
725 m[2] = 0, m[6] = 0, m[10] = 1, m[14] = 0;
726 m[3] = 0, m[7] = 0, m[11] = 2, m[15] = 1;
727
728 double *resid = new double [4];
729
730 resid[0] = 0.960966;
731 resid[1] = 0.741195;
732 resid[2] = 0.150143;
733 resid[3] = 0.868067;
734
735 octave_idx_type *ip = new octave_idx_type [11];
736
737 ip[0] = 1; // ishift
738 ip[1] = 0; // ip[1] not referenced
739 ip[2] = 300; // mxiter, maximum number of iterations
740 ip[3] = 1; // NB blocksize in recurrence
741 ip[4] = 0; // nconv, number of Ritz values that satisfy convergence
742 ip[5] = 0; // ip[5] not referenced
743 ip[6] = 1; // mode
744 ip[7] = 0; // ip[7] to ip[10] are return values
745 ip[8] = 0;
746 ip[9] = 0;
747 ip[10] = 0;
748
749 octave_idx_type *ipntr = new octave_idx_type [14];
750
751 octave_idx_type k = 1;
752 octave_idx_type p = 3;
753 octave_idx_type lwork = 3 * p * (p + 2);
754
755 double *v = new double [n * (p + 1)];
756 double *workl = new double [lwork + 1];
757 double *workd = new double [3 * n + 1];
758
759 octave_idx_type ido = 0;
760 octave_idx_type info = 0;
761
762 double tol = DBL_EPSILON;
763
764 do
765 {
766 F77_FUNC (dnaupd, DNAUPD) (ido, F77_CONST_CHAR_ARG2 ("I", 1),
767 n, F77_CONST_CHAR_ARG2 ("LM", 2),
768 k, tol, resid, p, v, n, ip, ipntr,
769 workd, workl, lwork, info
770 F77_CHAR_ARG_LEN (1)
771 F77_CHAR_ARG_LEN (2));
772
773 if (ido == -1 || ido == 1 || ido == 2)
774 {
775 double *x = workd + ipntr[0] - 1;
776 double *y = workd + ipntr[1] - 1;
777
778 F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG2 ("N", 1),
779 n, n, 1.0, m, n, x, 1, 0.0, y, 1
780 F77_CHAR_ARG_LEN (1));
781 }
782 else
783 {
784 if (info < 0)
785 {
786 return; // Error
787 }
788
789 break;
790 }
791 }
792 while (1);
793
794 octave_idx_type *sel = new octave_idx_type [p];
795
796 // In Octave, the dimensions of dr and di are k+1, but k+2 avoids segfault
797 double *dr = new double [k + 1];
798 double *di = new double [k + 1];
799 double *workev = new double [3 * p];
800
801 for (octave_idx_type i = 0; i < k + 1; i++)
802 dr[i] = di[i] = 0.;
803
804 octave_idx_type rvec = 1;
805
806 double sigmar = 0.0;
807 double sigmai = 0.0;
808
809 // In Octave, this is n*(k+1), but n*(k+2) avoids segfault
810 double *z = new double [n * (k + 1)];
811
812 F77_FUNC (dneupd, DNEUPD) (rvec, F77_CONST_CHAR_ARG2 ("A", 1),
813 sel, dr, di, z, n, sigmar, sigmai, workev,
814 F77_CONST_CHAR_ARG2 ("I", 1), n,
815 F77_CONST_CHAR_ARG2 ("LM", 2), k, tol,
816 resid, p, v, n, ip, ipntr, workd,
817 workl, lwork, info
818 F77_CHAR_ARG_LEN (1)
819 F77_CHAR_ARG_LEN (1)
820 F77_CHAR_ARG_LEN (2));
821}
822
823]], [[
824
825 for (int i = 0; i < 10; i++)
826 doit ();
827 ]])],
828 octave_cv_lib_arpack_ok=yes,
829 octave_cv_lib_arpack_ok=no,
830 octave_cv_lib_arpack_ok=yes)
831 AC_LANG_POP(C++)
832 ])
833 if test $octave_cv_lib_arpack_ok = yes; then
834 $1
835 :
836 else
837 $2
838 :
839 fi
840])
841dnl
842dnl Check whether GLPK provides the latest API functions required
843dnl for the glpk function. The glp_iptcp structure was introduced
844dnl in GLPK version 4.38.
845dnl
846AC_DEFUN([OCTAVE_CHECK_LIB_GLPK_OK], [
847 AC_CACHE_CHECK([whether the glpk library has glp_interior(glp_prob*, glp_iptcp*)],
848 [octave_cv_lib_glpk_ok],
849 [AC_LANG_PUSH(C++)
850 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
851 extern "C"
852 {
853 #if defined (HAVE_GLPK_GLPK_H)
854 #include <glpk/glpk.h>
855 #else
856 #include <glpk.h>
857 #endif
858 }
859 ]], [[
860 glp_prob *lp = glp_create_prob ();
861 glp_iptcp iptcp;
862 glp_init_iptcp (&iptcp);
863 int retval = glp_interior (lp, &iptcp);
864 ]])],
865 octave_cv_lib_glpk_ok=yes,
866 octave_cv_lib_glpk_ok=no)
867 AC_LANG_POP(C++)
868 ])
869 if test $octave_cv_lib_glpk_ok = yes; then
870 $1
871 :
872 else
873 $2
874 :
875 fi
876])
877dnl
878dnl Check whether using HDF5 DLL under Windows. This is done by
879dnl testing for a data symbol in the HDF5 library, which would
880dnl require the definition of _HDF5USEDL_ under MSVC compiler.
881dnl
882AC_DEFUN([OCTAVE_CHECK_LIB_HDF5_DLL], [
883 AC_CACHE_CHECK([if _HDF5USEDLL_ needs to be defined],
884 [octave_cv_lib_hdf5_dll],
885 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
886 #include <hdf5.h>
887 ]], [[
888 hid_t x = H5T_NATIVE_DOUBLE;
889 return x
890 ]])],
891 [octave_cv_lib_hdf5_dll=no],
892 [save_CFLAGS="$CFLAGS"
893 CFLAGS="$CFLAGS -DWIN32 -D_HDF5USEDLL_"
894 save_LIBS="$LIBS"
895 LIBS="$HDF5_LIBS $LIBS"
896 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
897 #include <hdf5.h>
898 ]], [[
899 hid_t x = H5T_NATIVE_DOUBLE;
900 return x
901 ]])],
902 octave_cv_lib_hdf5_dll=yes,
903 octave_cv_lib_hdf5_dll=no)
904 CFLAGS="$save_CFLAGS"
905 LIBS="$save_LIBS"
906 ])
907 ])
908 if test $octave_cv_lib_hdf5_dll = yes; then
909 AC_DEFINE(_HDF5USEDLL_, 1, [Define to 1 if using HDF5 dll (Win32).])
910 fi
911])
912dnl
913dnl Check for OpenGL. If found, define OPENGL_LIBS.
914dnl
915dnl FIXME: The following tests should probably check for the
916dnl libraries separately.
917dnl
918dnl FIXME: Should we allow a way to specify a directory for OpenGL
919dnl libraries and header files?
920dnl
921AC_DEFUN([OCTAVE_CHECK_LIB_OPENGL], [
922 OPENGL_LIBS=
923
924 ## On MacOSX systems the OpenGL framework can be used
925 OCTAVE_HAVE_FRAMEWORK(OpenGL, [[
926 #include <OpenGL/gl.h>
927 #include <OpenGL/glu.h>
928 ]], [[
929 GLint par; glGetIntegerv (GL_VIEWPORT, &par);
930 ]],
931 have_framework_opengl=yes, have_framework_opengl=no)
932
933 if test $have_framework_opengl = yes; then
934 AC_DEFINE(HAVE_FRAMEWORK_OPENGL, 1,
935 [Define to 1 if framework OPENGL is available.])
936 OPENGL_LIBS="-Wl,-framework -Wl,OpenGL"
937 AC_MSG_NOTICE([adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS])
938 OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS
939 else
940 case $canonical_host_type in
941 *-*-mingw32* | *-*-msdosmsvc)
942 AC_CHECK_HEADERS([windows.h])
943 ;;
944 esac
945 have_opengl_incs=no
946 AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h],
947 [AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h],
948 [have_opengl_incs=yes; break], [], [
949#ifdef HAVE_WINDOWS_H
950#include <windows.h>
951#endif
952 ])
953 break
954 ], [], [
955#ifdef HAVE_WINDOWS_H
956# include <windows.h>
957#endif
958 ])
959
960 if test $have_opengl_incs = yes; then
961 AC_CHECK_HEADERS([GL/glext.h OpenGL/glext.h], [], [], [
962#ifdef HAVE_WINDOWS_H
963# include <windows.h>
964#endif
965#if defined (HAVE_GL_GL_H)
966# include <GL/gl.h>
967#elif defined (HAVE_OPENGL_GL_H)
968# include <OpenGL/gl.h>
969#endif
970 ])
971 case $canonical_host_type in
972 *-*-mingw32* | *-*-msdosmsvc)
973 save_LIBS="$LIBS"
974 LIBS="$LIBS -lopengl32"
975 AC_MSG_CHECKING([for glEnable in -lopengl32])
976 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
977 #if HAVE_WINDOWS_H
978 # include <windows.h>
979 #endif
980 #if defined (HAVE_GL_GL_H)
981 # include <GL/gl.h>
982 #elif defined (HAVE_OPENGL_GL_H)
983 # include <OpenGL/gl.h>
984 #endif
985 ]], [[
986 glEnable(GL_SMOOTH);
987 ]])], [OPENGL_LIBS="-lopengl32 -lglu32"])
988
989 LIBS="$save_LIBS"
990 if test "x$OPENGL_LIBS" != "x"; then
991 AC_MSG_RESULT([yes])
992 else
993 AC_MSG_RESULT([no])
994 fi
995 ;;
996 *)
997 ## Non-Mac, Non-Windows systems use this check
998 AC_CHECK_LIB([GL], [glEnable], [OPENGL_LIBS="-lGL -lGLU"])
999 ;;
1000 esac
1001 fi
1002 fi
1003 AC_SUBST(OPENGL_LIBS)
1004])
1005dnl
1006dnl Check whether Qhull works (does not crash).
1007dnl
1008AC_DEFUN([OCTAVE_CHECK_LIB_QHULL_OK], [
1009 AC_CACHE_CHECK([whether the qhull library works],
1010 [octave_cv_lib_qhull_ok],
1011 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1012 #include <stdio.h>
1013 #if defined (HAVE_LIBQHULL_LIBQHULL_H)
1014 # include <libqhull/libqhull.h>
1015 # include <libqhull/qset.h>
1016 # include <libqhull/geom.h>
1017 # include <libqhull/poly.h>
1018 # include <libqhull/io.h>
1019 #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H)
1020 # if defined (HAVE_QHULL_LIBQHULL_H)
1021 # include <qhull/libqhull.h>
1022 # else
1023 # include <qhull/qhull.h>
1024 # endif
1025 # include <qhull/qset.h>
1026 # include <qhull/geom.h>
1027 # include <qhull/poly.h>
1028 # include <qhull/io.h>
1029 #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H)
1030 # if defined (HAVE_LIBQHULL_H)
1031 # include <libqhull.h>
1032 # else
1033 # include <qhull.h>
1034 # endif
1035 # include <qset.h>
1036 # include <geom.h>
1037 # include <poly.h>
1038 # include <io.h>
1039 #endif
1040 #ifdef NEED_QHULL_VERSION
1041 char *qh_version = "version";
1042 #endif
1043 ]], [[
1044 int dim = 2;
1045 int n = 4;
1046 coordT points[8] = { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5 };
1047 boolT ismalloc = 0;
1048 return qh_new_qhull (dim, n, points, ismalloc, "qhull ", 0, stderr);
1049 ]])],
1050 octave_cv_lib_qhull_ok=yes,
1051 octave_cv_lib_qhull_ok=no,
1052 octave_cv_lib_qhull_ok=yes)
1053 ])
1054 if test $octave_cv_lib_qhull_ok = yes; then
1055 $1
1056 :
1057 else
1058 $2
1059 :
1060 fi
1061])
1062dnl
1063dnl Check whether sndfile library is modern enough to include things like Ogg
1064dnl
1065AC_DEFUN([OCTAVE_CHECK_LIB_SNDFILE_OK], [
1066 AC_CACHE_CHECK([whether sndfile library is modern enough],
1067 [octave_cv_lib_sndfile_ok],
1068 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1069 #include <sndfile.h>
1070 ]], [[
1071 int x = SF_FORMAT_OGG;
1072 ]])],
1073 octave_cv_lib_sndfile_ok=yes,
1074 octave_cv_lib_sndfile_ok=no)
1075 ])
1076 if test $octave_cv_lib_sndfile_ok = yes; then
1077 $1
1078 :
1079 else
1080 $2
1081 :
1082 fi
1083])
1084dnl
1085dnl Find a suitable termlib to use.
1086dnl
1087AC_DEFUN([OCTAVE_CHECK_LIB_TERMLIB], [
1088 TERM_LIBS=
1089 ac_octave_save_LIBS="$LIBS"
1090 AC_SEARCH_LIBS([tputs],
1091 [ncurses curses termcap terminfo termlib],
1092 [], [])
1093 LIBS="$ac_octave_save_LIBS"
1094 case "$ac_cv_search_tputs" in
1095 -l*)
1096 TERM_LIBS="$ac_cv_search_tputs"
1097 ;;
1098 no)
1099 warn_termlibs="I couldn't find -ltermcap, -lterminfo, -lncurses, -lcurses, or -ltermlib!"
1100 AC_MSG_WARN([$warn_termlibs])
1101 ;;
1102 esac
1103
1104dnl Old code (9/9/2012). Delete when new code is definitely proven.
1105dnl
1106dnl for _termlib in ncurses curses termcap terminfo termlib; do
1107dnl AC_CHECK_LIB([${_termlib}], [tputs], [
1108dnl TERM_LIBS="-l${termlib}"
1109dnl octave_cv_lib_found_termlib=yes
1110dnl break])
1111dnl done
1112
1113 AC_SUBST(TERM_LIBS)
1114])
1115dnl
1116dnl Check for the Qhull version.
1117dnl
1118AC_DEFUN([OCTAVE_CHECK_QHULL_VERSION], [
1119 AC_CACHE_CHECK([for qh_version in $QHULL_LIBS],
1120 [octave_cv_lib_qhull_version],
1121 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1122 #include <stdio.h>
1123 #if defined (HAVE_LIBQHULL_LIBQHULL_H)
1124 # include <libqhull/libqhull.h>
1125 # include <libqhull/qset.h>
1126 # include <libqhull/geom.h>
1127 # include <libqhull/poly.h>
1128 # include <libqhull/io.h>
1129 #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H)
1130 # if defined (HAVE_QHULL_LIBQHULL_H)
1131 # include <qhull/libqhull.h>
1132 # else
1133 # include <qhull/qhull.h>
1134 # endif
1135 # include <qhull/qset.h>
1136 # include <qhull/geom.h>
1137 # include <qhull/poly.h>
1138 # include <qhull/io.h>
1139 #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H)
1140 # if defined (HAVE_LIBQHULL_H)
1141 # include <libqhull.h>
1142 # else
1143 # include <qhull.h>
1144 # endif
1145 # include <qset.h>
1146 # include <geom.h>
1147 # include <poly.h>
1148 # include <io.h>
1149 #endif
1150 ]], [[
1151 const char *tmp = qh_version;
1152 ]])],
1153 octave_cv_lib_qhull_version=yes, octave_cv_lib_qhull_version=no)
1154 ])
1155 if test $octave_cv_lib_qhull_version = no; then
1156 AC_DEFINE(NEED_QHULL_VERSION, 1,
1157 [Define to 1 if the Qhull library needs a qh_version variable defined.])
1158 fi
1159])
1160dnl
1161dnl Check if the default Fortran INTEGER is 64 bits wide.
1162dnl
1163AC_DEFUN([OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER], [
1164 AC_CACHE_CHECK([whether $F77 generates correct size integers],
1165 [octave_cv_sizeof_fortran_integer],
1166 [ac_octave_save_FFLAGS="$FFLAGS"
1167 FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
1168 AC_LANG_PUSH(Fortran 77)
1169 AC_COMPILE_IFELSE([[
1170 subroutine foo(n, in, out)
1171 integer n, in(n), out(n)
1172 integer i
1173 do 10 i = 1, n
1174 out(i) = in(i)
1175 10 continue
1176 return
1177 end
1178 ]],
1179 [mv conftest.$ac_objext fintsize.$ac_objext
1180 ac_octave_save_LIBS="$LIBS"
1181 LIBS="fintsize.$ac_objext $[]_AC_LANG_PREFIX[]LIBS"
1182 AC_LANG_PUSH(C)
1183 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1184 #include <assert.h>
1185 #include <stdint.h>
1186 ]], [[
1187 #ifdef USE_64_BIT_IDX_T
1188 typedef int64_t octave_idx_type;
1189 #else
1190 typedef int octave_idx_type;
1191 #endif
1192 octave_idx_type n = 2;
1193 octave_idx_type in[2];
1194 octave_idx_type out[2];
1195 in[0] = 13;
1196 in[0] = 42;
1197 F77_FUNC(foo,FOO) (&n, &in, &out);
1198 assert (in[0] == out[0] && in[1] == out[1]);
1199 ]])],
1200 octave_cv_sizeof_fortran_integer=yes,
1201 octave_cv_sizeof_fortran_integer=no,
1202 octave_cv_sizeof_fortran_integer=yes)
1203 AC_LANG_POP(C)
1204 LIBS="$ac_octave_save_LIBS"
1205 rm -f conftest.$ac_objext fintsize.$ac_objext],
1206 [rm -f conftest.$ac_objext
1207 AC_MSG_FAILURE([cannot compile a simple Fortran program])
1208 octave_cv_sizeof_fortran_integer=no])
1209 AC_LANG_POP(Fortran 77)
1210 FFLAGS="$ac_octave_save_FFLAGS"
1211 ])
1212])
1213dnl
1214dnl Add warning to final summary.
1215dnl
1216AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [
1217 AC_MSG_WARN([$][$1])
1218 m4_set_add([summary_warning_list], [$1])
1219])
1220dnl
1221dnl Print final summary.
1222dnl
1223AC_DEFUN([OCTAVE_CONFIGURE_WARNING_SUMMARY], [
1224 m4_set_foreach([summary_warning_list], [elt], [
1225 if test -n "[$]elt"; then
1226 AC_MSG_WARN([$]elt)
1227 warn_msg_printed=true
1228 fi])
1229])
1230dnl
1231dnl Check if the C++ library has the bit_and, bit_or, and bit_xor
1232dnl templates defined.
1233dnl
1234AC_DEFUN([OCTAVE_CXX_BITWISE_OP_TEMPLATES], [
1235 AC_CACHE_CHECK([whether bit_and, bit_or, bit_xor are defined in the C++ library],
1236 [octave_cv_cxx_bitwise_op_templates],
1237 [AC_LANG_PUSH(C++)
1238 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1239 #include <functional>
1240 ]], [[
1241 int x = 0;
1242 int y = 1;
1243 int z1 = std::bit_and<int>() (x, y);
1244 int z2 = std::bit_or<int>() (x, y);
1245 int z3 = std::bit_xor<int>() (x, y);
1246 ]])],
1247 octave_cv_cxx_bitwise_op_templates=yes,
1248 octave_cv_cxx_bitwise_op_templates=no)
1249 AC_LANG_POP(C++)
1250 ])
1251 if test $octave_cv_cxx_bitwise_op_templates = yes; then
1252 AC_DEFINE(HAVE_CXX_BITWISE_OP_TEMPLATES, 1,
1253 [Define to 1 if C++ library has templated bitwise operators.])
1254 fi
1255])
1256dnl
1257dnl Check if C++ reinterpret cast works for function pointers.
1258dnl
1259AC_DEFUN([OCTAVE_CXX_BROKEN_REINTERPRET_CAST],
1260 [AC_REQUIRE([AC_PROG_CXX])
1261 AC_CACHE_CHECK([for broken C++ reinterpret_cast],
1262 [octave_cv_cxx_broken_reinterpret_cast],
1263 [AC_LANG_PUSH(C++)
1264 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1265 #include <cmath> ]], [[
1266 typedef double (*fptr) (double);
1267 fptr psin = sin;
1268 void *vptr = reinterpret_cast<void *> (psin);
1269 psin = reinterpret_cast<fptr> (vptr);
1270 ]])],
1271 octave_cv_cxx_broken_reinterpret_cast=no,
1272 octave_cv_cxx_broken_reinterpret_cast=yes)
1273 AC_LANG_POP(C++)
1274 ])
1275 if test $octave_cv_cxx_broken_reinterpret_cast = yes; then
1276 AC_DEFINE(CXX_BROKEN_REINTERPRET_CAST, 1,
1277 [Define to 1 if C++ reinterpret_cast fails for function pointers.])
1278 fi
1279])
1280dnl
1281dnl Check if the C++ library has functions to access real and imaginary
1282dnl parts of complex numbers independently via references.
1283dnl
1284AC_DEFUN([OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS], [
1285 AC_CACHE_CHECK([whether complex class can reference components independently],
1286 [octave_cv_cxx_complex_reference_accessors],
1287 [AC_LANG_PUSH(C++)
1288 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1289 #include <complex>
1290 ]], [[
1291 std::complex<double> x;
1292 x.real () = 1.0;
1293 x.imag () = 1.0;
1294 ]])],
1295 octave_cv_cxx_complex_reference_accessors=yes,
1296 octave_cv_cxx_complex_reference_accessors=no)
1297 AC_LANG_POP(C++)
1298 ])
1299 if test $octave_cv_cxx_complex_reference_accessors = yes; then
1300 AC_DEFINE(HAVE_CXX_COMPLEX_REFERENCE_ACCESSORS, 1,
1301 [Define to 1 if C++ complex class has T& real (void) and T& imag (void) methods.])
1302 fi
1303])
1304dnl
1305dnl Check if the C++ library has functions to set real and imaginary
1306dnl parts of complex numbers independently.
1307dnl
1308AC_DEFUN([OCTAVE_CXX_COMPLEX_SETTERS], [
1309 AC_CACHE_CHECK([whether complex class can set components independently],
1310 [octave_cv_cxx_complex_setters],
1311 [AC_LANG_PUSH(C++)
1312 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1313 #include <complex>
1314 ]], [[
1315 std::complex<double> x;
1316 x.real (1.0);
1317 x.imag (2.0);
1318 ]])],
1319 octave_cv_cxx_complex_setters=yes, octave_cv_cxx_complex_setters=no)
1320 AC_LANG_POP(C++)
1321 ])
1322 if test $octave_cv_cxx_complex_setters = yes; then
1323 AC_DEFINE(HAVE_CXX_COMPLEX_SETTERS, 1,
1324 [Define to 1 if C++ complex class has void real (T) and void imag (T) methods.])
1325 fi
1326])
1327dnl
1328dnl Check if the compiler supports dynamic auto arrays.
1329dnl
1330AC_DEFUN([OCTAVE_CXX_DYNAMIC_AUTO_ARRAYS], [
1331 AC_CACHE_CHECK([whether C++ supports dynamic auto arrays],
1332 [octave_cv_cxx_dynamic_auto_arrays],
1333 [AC_LANG_PUSH(C++)
1334 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
1335 void test(char *);
1336 int length();
1337 char x[length()];
1338 test(x);
1339 ]])],
1340 octave_cv_cxx_dynamic_auto_arrays=yes,
1341 octave_cv_cxx_dynamic_auto_arrays=no)
1342 AC_LANG_POP(C++)
1343 ])
1344 if test $octave_cv_cxx_dynamic_auto_arrays = yes; then
1345 AC_DEFINE(HAVE_DYNAMIC_AUTO_ARRAYS, 1,
1346 [Define to 1 if C++ supports dynamic auto arrays.])
1347 fi
1348])
1349dnl
1350dnl Check if C++ compiler handles FLAG command line option. If two
1351dnl arguments are specified, execute the second arg as shell commands.
1352dnl Otherwise, add FLAG to CXXFLAGS if the compiler accepts the flag.
1353dnl
1354AC_DEFUN([OCTAVE_CXX_FLAG], [
1355 ac_safe=`echo "$1" | $SED 'y%./+-:=%__p___%'`
1356 AC_MSG_CHECKING([whether ${CXX-g++} accepts $1])
1357 AC_CACHE_VAL([octave_cv_cxx_flag_$ac_safe],
1358 [AC_LANG_PUSH(C++)
1359 ac_octave_save_CXXFLAGS="$CXXFLAGS"
1360 CXXFLAGS="$CXXFLAGS $1"
1361 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
1362 eval "octave_cv_cxx_flag_$ac_safe=yes",
1363 eval "octave_cv_cxx_flag_$ac_safe=no")
1364 CXXFLAGS="$ac_octave_save_CXXFLAGS"
1365 AC_LANG_POP(C++)
1366 ])
1367 if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then
1368 AC_MSG_RESULT([yes])
1369 ifelse([$2], ,
1370 [CXXFLAGS="$CXXFLAGS $1"
1371 AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2])
1372 else
1373 AC_MSG_RESULT([no])
1374 ifelse([$3], , , [$3])
1375 fi
1376])
1377dnl
1378dnl Check if the C++ library is ISO compliant.
1379dnl FIXME: This is obviously very simplistic, and trivially fooled.
1380dnl
1381AC_DEFUN([OCTAVE_CXX_ISO_COMPLIANT_LIBRARY], [
1382 AC_REQUIRE([AC_PROG_CXX])
1383 AC_MSG_CHECKING([if C++ library is ISO compliant])
1384 AC_CACHE_VAL([octave_cv_cxx_iso_compliant_library],
1385 [AC_LANG_PUSH(C++)
1386 rm -f conftest.h
1387 ## Omitting cwctype for now, since it is broken with gcc-3.0.x and
1388 ## possibly other versions...
1389 for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \
1390 climits clocale cmath complex csetjmp csignal cstdarg cstddef \
1391 cstdio cstdlib cstring ctime cwchar deque exception \
1392 fstream functional iomanip ios iosfwd iostream istream iterator \
1393 limits list locale map memory new numeric ostream queue set \
1394 sstream stack stdexcept streambuf string strstream typeinfo \
1395 utility valarray vector; do
1396 echo "#include <$inc>" >> conftest.h
1397 done
1398 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1399 #include "conftest.h"
1400 ]], [[
1401 std::bitset<50> flags;
1402 flags.set();
1403 int digits = std::numeric_limits<unsigned long>::digits;
1404 digits = 0;
1405 ]])],
1406 octave_cv_cxx_iso_compliant_library=yes,
1407 octave_cv_cxx_iso_compliant_library=no)
1408 AC_LANG_POP(C++)
1409 ])
1410 AC_MSG_RESULT([$octave_cv_cxx_iso_compliant_library])
1411 if test $octave_cv_cxx_iso_compliant_library = yes; then
1412 AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1,
1413 [Define to 1 if your C++ runtime library is ISO compliant.])
1414 fi
1415])
1416dnl
1417dnl Check if C++ compiler needs the new friend template declaration
1418dnl syntax.
1419dnl
1420AC_DEFUN([OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL], [
1421 AC_REQUIRE([AC_PROG_CXX])
1422 AC_MSG_CHECKING([for C++ support for new friend template declaration])
1423 AC_CACHE_VAL([octave_cv_cxx_new_friend_template_decl],
1424 [AC_LANG_PUSH(C++)
1425 rm -f conftest.h
1426 cat > conftest.h <<EOB
1427 struct A {
1428 friend int operator== (const A&, const A&);
1429 A (int) { }
1430 };
1431
1432 template <class T> int
1433 operator== (const T&, const T&)
1434 {
1435 return 0;
1436 }
1437EOB
1438 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1439 #include "conftest.h"
1440 ]], [[
1441 A a (1);
1442 return a == A(1);
1443 ]])],
1444 octave_cv_cxx_new_friend_template_decl=no,
1445 octave_cv_cxx_new_friend_template_decl=yes)
1446 AC_LANG_POP(C++)
1447 ])
1448 AC_MSG_RESULT([$octave_cv_cxx_new_friend_template_decl])
1449 if test $octave_cv_cxx_new_friend_template_decl = yes; then
1450 AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL, 1,
1451 [Define to 1 if your compiler supports `<>' stuff for template friends.])
1452 fi
1453])
1454dnl
1455dnl Check if the compiler supports placement delete.
1456dnl
1457AC_DEFUN([OCTAVE_CXX_PLACEMENT_DELETE], [
1458 AC_CACHE_CHECK([whether <new> defines placement delete operator],
1459 [octave_cv_cxx_placement_delete],
1460 [AC_LANG_PUSH(C++)
1461 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1462 #include <new>
1463 ]], [[
1464 operator delete((void *)0, (void *)0);
1465 ]])],
1466 octave_cv_cxx_placement_delete=yes,
1467 octave_cv_cxx_placement_delete=no)
1468 AC_LANG_POP(C++)
1469 ])
1470 if test $octave_cv_cxx_placement_delete = yes; then
1471 AC_DEFINE(HAVE_PLACEMENT_DELETE, 1,
1472 [Define to 1 if C++ supports operator delete(void *, void *).])
1473 fi
1474])
1475dnl
1476dnl Allow the user disable support for command line editing using GNU
1477dnl readline.
1478dnl
1479AC_DEFUN([OCTAVE_ENABLE_READLINE], [
1480 USE_READLINE=yes
1481 READLINE_LIBS=
1482 AC_ARG_ENABLE([readline],
1483 [AS_HELP_STRING([--disable-readline],
1484 [do not use readline library])],
1485 [if test "$enableval" = no; then
1486 USE_READLINE=no
1487 warn_readline="command editing and history features require GNU Readline"
1488 fi])
1489 if test $USE_READLINE = yes; then
1490 dnl RHEL 5 and older systems require termlib set before enabling readline
1491 AC_REQUIRE([OCTAVE_CHECK_LIB_TERMLIB])
1492 ac_octave_save_LIBS="$LIBS"
1493 LIBS="$TERM_LIBS"
1494 AC_CHECK_LIB([readline], [rl_set_keyboard_input_timeout],
1495 [READLINE_LIBS="-lreadline"
1496 AC_DEFINE(USE_READLINE, 1, [Define to 1 to use the readline library.])
1497 ],
1498 [AC_MSG_WARN([I need GNU Readline 4.2 or later])
1499 AC_MSG_ERROR([this is fatal unless you specify --disable-readline])
1500 ])
1501 LIBS="$ac_octave_save_LIBS"
1502 fi
1503 AC_SUBST(READLINE_LIBS)
1504])
1505dnl
1506dnl Check if Fortran compiler handles FLAG command line option. If
1507dnl two arguments are specified, execute the second arg as shell
1508dnl commands. Otherwise, add FLAG to FFLAGS if the compiler accepts
1509dnl the flag.
1510dnl
1511AC_DEFUN([OCTAVE_F77_FLAG], [
1512 ac_safe=`echo "$1" | $SED 'y%./+-:=%__p___%'`
1513 AC_MSG_CHECKING([whether ${F77-g77} accepts $1])
1514 AC_CACHE_VAL([octave_cv_f77_flag_$ac_safe], [
1515 AC_LANG_PUSH(Fortran 77)
1516 ac_octave_save_FFLAGS="$FFLAGS"
1517 FFLAGS="$FFLAGS $1"
1518 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
1519 eval "octave_cv_f77_flag_$ac_safe=yes",
1520 eval "octave_cv_f77_flag_$ac_safe=no")
1521 FFLAGS="$ac_octave_save_FFLAGS"
1522 AC_LANG_POP(Fortran 77)
1523 ])
1524 if eval "test \"`echo '$octave_cv_f77_flag_'$ac_safe`\" = yes"; then
1525 AC_MSG_RESULT([yes])
1526 ifelse([$2], ,
1527 [FFLAGS="$FFLAGS $1"
1528 AC_MSG_RESULT([adding $1 to FFLAGS])], [$2])
1529 else
1530 AC_MSG_RESULT([no])
1531 ifelse([$3], , , [$3])
1532 fi
1533])
1534dnl
1535dnl Check whether fast signed integer arithmetics using bit tricks
1536dnl can be used in oct-inttypes.h. Defines HAVE_FAST_INT_OPS if
1537dnl the following conditions hold:
1538dnl 1. Signed numbers are represented by twos complement
1539dnl (see <http://en.wikipedia.org/wiki/Two%27s_complement>)
1540dnl 2. static_cast to unsigned int counterpart works like interpreting
1541dnl the signed bit pattern as unsigned (and is thus zero-cost).
1542dnl 3. Signed addition and subtraction yield the same bit results as unsigned.
1543dnl (We use casts to prevent optimization interference, so there is no
1544dnl need for things like -ftrapv).
1545dnl 4. Bit operations on signed integers work like on unsigned integers,
1546dnl except for the shifts. Shifts are arithmetic.
1547dnl
1548AC_DEFUN([OCTAVE_FAST_INT_OPS], [
1549 AC_CACHE_CHECK([whether fast integer arithmetics is usable],
1550 [octave_cv_fast_int_ops],
1551 [AC_LANG_PUSH(C++)
1552 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1553 #include <limits>
1554 template<class UT, class ST>
1555 static bool
1556 do_test (UT, ST)
1557 {
1558 volatile ST s = std::numeric_limits<ST>::min () / 3;
1559 volatile UT u = static_cast<UT> (s);
1560 if (*(reinterpret_cast<volatile ST *> (&u)) != s) return true;
1561
1562 u = 0; u = ~u;
1563 if (*(reinterpret_cast<volatile ST *> (&u)) != -1) return true;
1564
1565 ST sx, sy;
1566 sx = std::numeric_limits<ST>::max () / 2 + 1;
1567 sy = std::numeric_limits<ST>::max () / 2 + 2;
1568 if (static_cast<ST> (static_cast<UT> (sx) + static_cast<UT> (sy))
1569 != std::numeric_limits<ST>::min () + 1) return true;
1570 if (static_cast<ST> (static_cast<UT> (sx) - static_cast<UT> (sy))
1571 != -1) return true;
1572
1573 if ((sx & sy) != (static_cast<UT> (sx) & static_cast<UT> (sy)))
1574 return true;
1575 if ((sx | sy) != (static_cast<UT> (sx) | static_cast<UT> (sy)))
1576 return true;
1577 if ((sx ^ sy) != (static_cast<UT> (sx) ^ static_cast<UT> (sy)))
1578 return true;
1579 if ((-1 >> 1) != -1) return true;
1580 return false;
1581 }
1582
1583 #define DO_TEST(T) \
1584 if (do_test (static_cast<unsigned T> (0), static_cast<signed T> (0)))\
1585 return sizeof (T);
1586
1587 ]],[[
1588
1589 DO_TEST(char)
1590 DO_TEST(short)
1591 DO_TEST(int)
1592 DO_TEST(long)
1593 #if (defined(HAVE_LONG_LONG_INT) && defined(HAVE_UNSIGNED_LONG_LONG_INT))
1594 DO_TEST(long long)
1595 #endif
1596 ]])],
1597 octave_cv_fast_int_ops=yes,
1598 octave_cv_fast_int_ops=no,
1599 octave_cv_fast_int_ops=yes)
1600 AC_LANG_POP(C++)
1601 ])
1602 if test $octave_cv_fast_int_ops = yes; then
1603 AC_DEFINE(HAVE_FAST_INT_OPS, 1,
1604 [Define to 1 if signed integers use two's complement.])
1605 fi
1606])
1607dnl
1608dnl Check to see if the compiler and the linker can handle the flags
1609dnl "-framework $1" for the given prologue $2 and the given body $3 of
1610dnl a source file. Arguments 2 and 3 optionally can also be empty.
1611dnl Add options (lower case letters $1) "--with-framework-$1" and
1612dnl "--without-framework-$1". If this test is successful then perform
1613dnl $4, otherwise do $5.
1614dnl
1615AC_DEFUN([OCTAVE_HAVE_FRAMEWORK], [
1616 AC_MSG_CHECKING([whether ${LD-ld} accepts -framework $1])
1617 AC_CACHE_VAL([octave_cv_framework_$1],
1618 [ac_octave_save_LDFLAGS="$LDFLAGS"
1619 LDFLAGS="$LDFLAGS -framework $1"
1620 AC_LANG_PUSH(C++)
1621 AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])],
1622 eval "octave_cv_framework_$1=yes",
1623 eval "octave_cv_framework_$1=no")
1624 AC_LANG_POP(C++)
1625 LDFLAGS="$ac_octave_save_LDFLAGS"
1626 ])
1627 if test "$octave_cv_framework_$1" = yes; then
1628 AC_MSG_RESULT([yes])
1629 AC_ARG_WITH(framework-m4_tolower($1),
1630 [AS_HELP_STRING([--without-framework-m4_tolower($1)],
1631 [don't use framework $1])],
1632 with_have_framework=$withval, with_have_framework=yes)
1633 if test "$with_have_framework" = yes; then
1634 [$4]
1635 :
1636 else
1637 AC_MSG_NOTICE([framework rejected by --without-framework-m4_tolower($1)])
1638 [$5]
1639 fi
1640 else
1641 AC_MSG_RESULT([no])
1642 [$5]
1643 fi
1644])
1645dnl
1646dnl Figure out the hardware-vendor-os info.
1647dnl
1648AC_DEFUN([OCTAVE_CANONICAL_HOST], [
1649 AC_CANONICAL_HOST
1650 if test -z "$host"; then
1651 host=unknown-unknown-unknown
1652 AC_MSG_WARN([configuring Octave for unknown system type])
1653 fi
1654 canonical_host_type=$host
1655 AC_SUBST(canonical_host_type)
1656 if test -z "$host_cpu"; then
1657 host_cpu=unknown
1658 fi
1659 if test -z "$host_vendor"; then
1660 host_vendor=unknown
1661 fi
1662 if test -z "$host_os"; then
1663 host_os=unknown
1664 fi
1665])
1666dnl
1667dnl Check for IEEE 754 data format.
1668dnl
1669AC_DEFUN([OCTAVE_IEEE754_DATA_FORMAT], [
1670 AC_MSG_CHECKING([for IEEE 754 data format])
1671 AC_CACHE_VAL([octave_cv_ieee754_data_format],
1672 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
1673 int
1674 main (void)
1675 {
1676 typedef union { unsigned char c[8]; double d; } ieeebytes;
1677
1678 ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43};
1679 ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c};
1680
1681 return l.d != 1234567891234567.0 && b.d != 1234567891234567.0;
1682 }
1683 ]])],
1684 octave_cv_ieee754_data_format=yes,
1685 octave_cv_ieee754_data_format=no,
1686 octave_cv_ieee754_data_format=yes)
1687 ])
1688 if test "$cross_compiling" = yes; then
1689 AC_MSG_RESULT([$octave_cv_ieee754_data_format assumed for cross compilation])
1690 else
1691 AC_MSG_RESULT([$octave_cv_ieee754_data_format])
1692 fi
1693 if test $octave_cv_ieee754_data_format = yes; then
1694 AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1,
1695 [Define to 1 if your system uses IEEE 754 data format.])
1696 else
1697 ## If the format is unknown, then you will probably not have a
1698 ## useful system, so we will abort here. Anyone wishing to
1699 ## experiment with building Octave on a system without IEEE
1700 ## floating point should be capable of removing this check and
1701 ## the one in the octave_ieee_init function in liboctave/lo-ieee.cc.
1702 AC_MSG_ERROR([IEEE 754 data format required for building Octave])
1703 fi
1704])
1705dnl
1706dnl Check for CallInst::addAttribute API
1707dnl
1708AC_DEFUN([OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API], [
1709 AC_CACHE_CHECK([check LLVM::CallInst::addAttribute arg type is llvm::Attributes],
1710 [octave_cv_callinst_addattribute_arg_is_attributes],
1711 [AC_LANG_PUSH(C++)
1712 AC_COMPILE_IFELSE(
1713 [AC_LANG_PROGRAM([[
1714#ifdef HAVE_LLVM_IR_FUNCTION_H
1715 #include <llvm/IR/Instructions.h>
1716 #include <llvm/IR/Attributes.h>
1717#else
1718 #include <llvm/Instructions.h>
1719 #include <llvm/Attributes.h>
1720#endif
1721 ]], [[
1722 llvm::CallInst *callinst;
1723 llvm::AttrBuilder attr_builder;
1724 attr_builder.addAttribute(llvm::Attributes::StructRet);
1725 llvm::Attributes attrs = llvm::Attributes::get(llvm::getGlobalContext(), attr_builder);
1726 callinst->addAttribute (1, attrs);
1727 ]])],
1728 octave_cv_callinst_addattribute_arg_is_attributes=yes,
1729 octave_cv_callinst_addattribute_arg_is_attributes=no)
1730 AC_LANG_POP(C++)
1731 ])
1732 if test $octave_cv_callinst_addattribute_arg_is_attributes = yes; then
1733 AC_DEFINE(CALLINST_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1,
1734 [Define to 1 if llvm::CallInst:addAttribute arg type is llvm::Attributes.])
1735 fi
1736])
1737dnl
1738dnl Check for Function::addAttribute API
1739dnl
1740AC_DEFUN([OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API], [
1741 AC_CACHE_CHECK([check llvm::Function::addAttribute arg type is llvm::Attributes],
1742 [octave_cv_function_addattribute_arg_is_attributes],
1743 [AC_LANG_PUSH(C++)
1744 AC_COMPILE_IFELSE(
1745 [AC_LANG_PROGRAM([[
1746#ifdef HAVE_LLVM_IR_FUNCTION_H
1747 #include <llvm/IR/Function.h>
1748 #include <llvm/IR/Attributes.h>
1749 #include <llvm/IR/LLVMContext.h>
1750#else
1751 #include <llvm/Function.h>
1752 #include <llvm/Attributes.h>
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: