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
1=== modified file '.pc/applied-patches'
2--- .pc/applied-patches 2015-07-18 14:20:22 +0000
3+++ .pc/applied-patches 2015-08-02 19:51:25 +0000
4@@ -9,3 +9,4 @@
5 hdf5-mkoctfile.patch
6 xbackslash-texinfo.patch
7 dont-use-included-texinfo-texmfcnf.patch
8+qt-requires-opengl.patch
9
10=== added directory '.pc/qt-requires-opengl.patch'
11=== added file '.pc/qt-requires-opengl.patch/configure.ac'
12--- .pc/qt-requires-opengl.patch/configure.ac 1970-01-01 00:00:00 +0000
13+++ .pc/qt-requires-opengl.patch/configure.ac 2015-08-02 19:51:25 +0000
14@@ -0,0 +1,3228 @@
15+dnl Process this file with autoconf to produce a configure script.
16+dnl
17+dnl Copyright (C) 1993-2015 John W. Eaton
18+###
19+### This file is part of Octave.
20+###
21+### Octave is free software; you can redistribute it and/or modify it
22+### under the terms of the GNU General Public License as published by the
23+### Free Software Foundation; either version 3 of the License, or (at
24+### your option) any later version.
25+###
26+### Octave is distributed in the hope that it will be useful, but WITHOUT
27+### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
28+### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
29+### for more details.
30+###
31+### You should have received a copy of the GNU General Public License
32+### along with Octave; see the file COPYING. If not, see
33+### <http://www.gnu.org/licenses/>.
34+
35+AC_PREREQ([2.63])
36+AC_INIT([GNU Octave], [4.0.0], [http://octave.org/bugs.html], [octave])
37+
38+dnl Note that the version number is duplicated here and in AC_INIT
39+dnl because AC_INIT requires it to be static, not computed from
40+dnl shell variables.
41+OCTAVE_MAJOR_VERSION=4
42+OCTAVE_MINOR_VERSION=0
43+OCTAVE_PATCH_VERSION=0
44+
45+dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg
46+OCTAVE_VERSION="$PACKAGE_VERSION"
47+
48+OCTAVE_COPYRIGHT="Copyright (C) 2015 John W. Eaton and others."
49+
50+OCTAVE_RELEASE_DATE="2015-05-26"
51+
52+## The "API version" is used as a way of checking that interfaces in the
53+## liboctave and libinterp libraries haven't changed in a backwardly
54+## incompatible way when loading .oct files. A better way to do that is
55+## with library versioning, but not all systems support that.
56+## NOTE: This macro will be removed in a future version of Octave. If
57+## you insist on checking for features using a version number, use the
58+## OCTAVE_MAJOR_VERSION, OCTAVE_MINOR_VERSION, and
59+## OCTAVE_PATCH_VERSION macros instead.
60+## FIXME: Since we also set libtool versions for liboctave and
61+## libinterp, perhaps we should be computing the "api version" from
62+## those versions numbers in some way instead of setting it
63+## independently here.
64+OCTAVE_API_VERSION="api-v50+"
65+
66+AC_SUBST(OCTAVE_MAJOR_VERSION)
67+AC_SUBST(OCTAVE_MINOR_VERSION)
68+AC_SUBST(OCTAVE_PATCH_VERSION)
69+AC_SUBST(OCTAVE_VERSION)
70+AC_SUBST(OCTAVE_COPYRIGHT)
71+AC_SUBST(OCTAVE_RELEASE_DATE)
72+AC_SUBST(OCTAVE_API_VERSION)
73+
74+dnl FIXME: We should auto-insert the Mercurial changeset ID into the
75+dnl AC_REVISION field whenever configure.ac is modified.
76+dnl AC_REVISION($Revision: 1.603 $)
77+AC_CONFIG_SRCDIR([libinterp/octave.cc])
78+AC_CONFIG_HEADERS([config.h:config.in.h])
79+AC_CONFIG_AUX_DIR([build-aux])
80+AC_CONFIG_MACRO_DIR([m4])
81+
82+AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability -Wno-override tar-ustar subdir-objects])
83+
84+## Add the option to enable silent rules and make silent rules the
85+## default behavior. Available since Automake 1.11 and included by
86+## default starting with Automake 1.13.
87+AM_SILENT_RULES([yes])
88+
89+OCTAVE_CANONICAL_HOST
90+
91+AC_DEFINE(OCTAVE_SOURCE, 1, [Define to 1 if this is Octave.])
92+
93+AC_USE_SYSTEM_EXTENSIONS
94+
95+### Make configure args available for other uses.
96+
97+config_opts=$ac_configure_args
98+AC_SUBST(config_opts)
99+
100+### Set default file locations
101+
102+OCTAVE_SET_DEFAULT([octlibdir], '$(libdir)/octave/$(version)')
103+OCTAVE_SET_DEFAULT([archlibdir],
104+ '$(libexecdir)/octave/$(version)/exec/$(canonical_host_type)')
105+OCTAVE_SET_DEFAULT([localarchlibdir],
106+ '$(libexecdir)/octave/site/exec/$(canonical_host_type)')
107+OCTAVE_SET_DEFAULT([localapiarchlibdir],
108+ '$(libexecdir)/octave/$(api_version)/site/exec/$(canonical_host_type)')
109+OCTAVE_SET_DEFAULT([localverarchlibdir],
110+ '$(libexecdir)/octave/$(version)/site/exec/$(canonical_host_type)')
111+OCTAVE_SET_DEFAULT([octfiledir],
112+ '$(libdir)/octave/$(version)/oct/$(canonical_host_type)')
113+OCTAVE_SET_DEFAULT([localoctfiledir],
114+ '$(libdir)/octave/site/oct/$(canonical_host_type)')
115+OCTAVE_SET_DEFAULT([localapioctfiledir],
116+ '$(libdir)/octave/site/oct/$(api_version)/$(canonical_host_type)')
117+OCTAVE_SET_DEFAULT([localveroctfiledir],
118+ '$(libdir)/octave/$(version)/site/oct/$(canonical_host_type)')
119+OCTAVE_SET_DEFAULT([octincludedir], '$(includedir)/octave-$(version)/octave')
120+OCTAVE_SET_DEFAULT([fcnfiledir], '$(datadir)/octave/$(version)/m')
121+OCTAVE_SET_DEFAULT([localfcnfiledir], '$(datadir)/octave/site/m')
122+OCTAVE_SET_DEFAULT([localapifcnfiledir],
123+ '$(datadir)/octave/site/$(api_version)/m')
124+OCTAVE_SET_DEFAULT([localverfcnfiledir], '$(datadir)/octave/$(version)/site/m')
125+OCTAVE_SET_DEFAULT([octetcdir], '$(datadir)/octave/$(version)/etc')
126+OCTAVE_SET_DEFAULT([octlocaledir], '$(datadir)/octave/$(version)/locale')
127+OCTAVE_SET_DEFAULT([doc_cache_file], '$(octetcdir)/doc-cache')
128+OCTAVE_SET_DEFAULT([octtestsdir], '$(octetcdir)/tests')
129+OCTAVE_SET_DEFAULT([texi_macros_file], '$(octetcdir)/macros.texi')
130+OCTAVE_SET_DEFAULT([imagedir], '$(datadir)/octave/$(version)/imagelib')
131+OCTAVE_SET_DEFAULT([octdatadir], '$(datadir)/octave/$(version)/data')
132+OCTAVE_SET_DEFAULT([man1dir], '$(mandir)/man1')
133+OCTAVE_SET_DEFAULT([man1ext], '.1')
134+OCTAVE_SET_DEFAULT([infofile], '$(infodir)/octave.info')
135+
136+### Check for programs used in building, installing, and running Octave.
137+
138+## Programs used in configuring Octave.
139+## Find pkg-config executable (sets $PKG_CONFIG)
140+PKG_PROG_PKG_CONFIG
141+
142+## Programs used in Makefiles.
143+AC_PROG_AWK
144+AC_PROG_GREP
145+OCTAVE_PROG_FIND
146+OCTAVE_PROG_SED
147+OCTAVE_PROG_PERL
148+
149+## Programs used to build parts of Octave.
150+OCTAVE_PROG_GPERF
151+
152+OCTAVE_PROG_FLEX
153+AC_SUBST([LEX_OUTPUT_ROOT], [lex.octave_])
154+
155+OCTAVE_PROG_BISON
156+
157+OCTAVE_PROG_MAKEINFO
158+OCTAVE_PROG_TEXI2DVI
159+OCTAVE_PROG_TEXI2PDF
160+
161+## Programs used when installing Octave.
162+AC_PROG_LN_S
163+AC_PROG_MKDIR_P
164+
165+AC_PROG_INSTALL
166+INSTALL_SCRIPT='${INSTALL}'
167+AC_SUBST(INSTALL_SCRIPT)
168+
169+OCTAVE_PROG_DESKTOP_FILE_INSTALL
170+
171+## Programs used when running Octave
172+OCTAVE_PROG_GHOSTSCRIPT
173+OCTAVE_PROG_GNUPLOT
174+OCTAVE_PROG_PAGER
175+OCTAVE_PROG_PYTHON
176+
177+## Programs used to generate icons file formats.
178+OCTAVE_PROG_ICOTOOL
179+OCTAVE_PROG_RSVG_CONVERT
180+AM_CONDITIONAL([AMCOND_HAVE_ICON_TOOLS],
181+ [test -n "$ICOTOOL" && test -n "$RSVG_CONVERT"])
182+
183+### Default terminal font for the GUI
184+case $host_os in
185+ mingw* | msdosmsvc)
186+ DEFAULT_TERMINAL_FONT="Lucida Console"
187+ ;;
188+ *)
189+ DEFAULT_TERMINAL_FONT="Courier"
190+ ;;
191+esac
192+DEFAULT_TERMINAL_FONT_SIZE=10
193+AC_SUBST(DEFAULT_TERMINAL_FONT)
194+AC_SUBST(DEFAULT_TERMINAL_FONT_SIZE)
195+
196+### Path separator.
197+
198+sepchar=':'
199+AC_ARG_WITH([sepchar],
200+ [AS_HELP_STRING([--with-sepchar=<char>],
201+ [use <char> as the path separation character])])
202+case $with_sepchar in
203+ yes | "")
204+ case $host_os in
205+ mingw* | msdosmsvc)
206+ sepchar=';' ;;
207+ esac
208+ ;;
209+ no)
210+ AC_MSG_ERROR([You are required to define a path separation character])
211+ ;;
212+ *)
213+ sepchar=$with_sepchar
214+ ;;
215+esac
216+AC_SUBST(sepchar)
217+AC_DEFINE_UNQUOTED(SEPCHAR, ['$sepchar'],
218+ [Define this to be the path separator for your system, as a character constant.])
219+AC_DEFINE_UNQUOTED(SEPCHAR_STR, ["$sepchar"],
220+ [Define this to be the path separator for your system, as a string.])
221+
222+### Define the path to the shell on the host system. Most systems will
223+### ensure /bin/sh is the default shell so this can be safely ignored by
224+### almost everyone. However, when building for Android, for example,
225+### this will need to be set.
226+SHELL_PATH=/bin/sh
227+AC_ARG_WITH([shell],
228+ [AS_HELP_STRING([--with-shell=SHELL],
229+ [use SHELL as the shell interpreter (default: /bin/sh)])])
230+case $with_shell in
231+ no)
232+ AC_MSG_ERROR([A shell interpreter is required])
233+ ;;
234+ yes | "")
235+ ;;
236+ *)
237+ SHELL_PATH=$with_shell
238+ ;;
239+esac
240+AC_DEFINE_UNQUOTED([SHELL_PATH], ["$SHELL_PATH"],
241+ [Define this to be the path to the shell command interpreter.])
242+
243+### Enable bounds checking on element references within Octave's array and
244+### matrix classes. This slows down some operations a bit, so it is turned off
245+### by default.
246+
247+BOUNDS_CHECKING=no
248+AC_ARG_ENABLE([bounds-check],
249+ [AS_HELP_STRING([--enable-bounds-check],
250+ [enable bounds checking for indexing in internal array classes])],
251+ [if test "$enableval" = yes; then BOUNDS_CHECKING=yes; fi], [])
252+if test $BOUNDS_CHECKING = yes; then
253+ AC_DEFINE(BOUNDS_CHECKING, 1, [Define to 1 to use internal bounds checking.])
254+fi
255+
256+### Use atomic operations for internal reference counting. This is required
257+### for thread-safe behavior (Qt Handles) but incurs a significant slowdown.
258+### Enabled by default until a higher performing solution can be found.
259+
260+USE_ATOMIC_REFCOUNT=yes
261+AC_ARG_ENABLE([atomic-refcount],
262+ [AS_HELP_STRING([--disable-atomic-refcount],
263+ [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.])],
264+ [if test "$enableval" = no; then USE_ATOMIC_REFCOUNT=no; fi], [])
265+if test $USE_ATOMIC_REFCOUNT = yes; then
266+ AC_DEFINE(USE_ATOMIC_REFCOUNT, 1,
267+ [Define to 1 to use atomic operations for reference counting.])
268+fi
269+
270+### Disable running Make in the doc directory.
271+### This is useful, for example, when building Octave on systems without TeX.
272+
273+DOCDIR=doc
274+AC_ARG_ENABLE([docs],
275+ [AS_HELP_STRING([--disable-docs], [don't build documentation files])],
276+ [if test "$enableval" = no; then
277+ DOCDIR=
278+ warn_docs="building documentation disabled; make dist will fail"
279+ OCTAVE_CONFIGURE_WARNING([warn_docs])
280+ fi],
281+ [])
282+AC_SUBST(DOCDIR)
283+
284+### If possible, use a 64-bit integer type for array dimensions and indexing.
285+
286+USE_64_BIT_IDX_T=no
287+OCTAVE_IDX_TYPE=int
288+AC_ARG_ENABLE(64,
289+ [AS_HELP_STRING([--enable-64],
290+ [(EXPERIMENTAL) use 64-bit integers for array dimensions and indexing])],
291+ [if test "$enableval" = yes; then USE_64_BIT_IDX_T=yes; fi], [])
292+if test $USE_64_BIT_IDX_T = yes; then
293+ AC_CHECK_SIZEOF([void *])
294+ AC_CHECK_SIZEOF([int])
295+ AC_CHECK_SIZEOF([long])
296+ AC_CHECK_SIZEOF([int64_t])
297+ if test $ac_cv_sizeof_void_p -eq 8; then
298+ OCTAVE_IDX_TYPE=int64_t
299+ else
300+ warn_64_bit="pointers are not 64-bits wide; disabling 64-bit features"
301+ OCTAVE_CONFIGURE_WARNING([warn_64_bit])
302+ USE_64_BIT_IDX_T=no
303+ fi
304+fi
305+AC_SUBST(OCTAVE_IDX_TYPE)
306+AC_DEFINE_UNQUOTED(OCTAVE_IDX_TYPE, [$OCTAVE_IDX_TYPE],
307+ [Define to the type of octave_idx_type (64 or 32 bit signed integer).])
308+if test $USE_64_BIT_IDX_T = yes; then
309+ AC_DEFINE(USE_64_BIT_IDX_T, 1,
310+ [Define to 1 if using 64-bit integers for array dimensions and indexing.])
311+fi
312+AC_SUBST(USE_64_BIT_IDX_T)
313+
314+### It seems that there are some broken inline assembly functions in
315+### the GNU libc. Since I'm not sure how to test whether we are using
316+### GNU libc, just disable them for all platforms.
317+
318+AC_MSG_NOTICE([defining __NO_MATH_INLINES avoids buggy GNU libc exp function])
319+AC_DEFINE(__NO_MATH_INLINES, 1,
320+ [Define to 1 if your version of GNU libc has buggy inline assembly code for math functions like exp.])
321+
322+### Determine which C++ compiler to use (we expect to find g++).
323+
324+AC_PROG_CXX
325+AC_PROG_CXXCPP
326+
327+### Determine which C compiler to use (we expect to find gcc).
328+
329+AC_PROG_CC
330+AC_PROG_CPP
331+AC_PROG_GCC_TRADITIONAL
332+
333+## Save and restore CFLAGS and CXXFLAGS globally. These variables
334+## are for users, so we shouldn't be touching them. Instead, we should
335+## set the corresponding AM_ flags (currently by way of the XTRA_ variables).
336+## However, for the duration of the configure script, we may set CFLAGS
337+## and CXXFLAGS so that subsequent tests succeed. Temporary settings
338+## like this are currently done for pthreads and openmp, for example.
339+original_octave_configure_CFLAGS="$CFLAGS"
340+original_octave_configure_CXXFLAGS="$CXXFLAGS"
341+
342+## Check for MSVC
343+have_msvc=no
344+case $host_os in
345+ msdosmsvc)
346+ have_msvc=yes
347+ ;;
348+ mingw*)
349+ AC_MSG_CHECKING([for MSVC compiler])
350+ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
351+ #ifndef _MSC_VER
352+ #error "Not MSVC compiler"
353+ #endif
354+ ]])],
355+ have_msvc=yes, have_msvc=no)
356+ AC_MSG_RESULT([$have_msvc])
357+ ;;
358+esac
359+
360+### gnulib initialization: part 1
361+### Must take place immediately after a compiler is determined
362+
363+gl_EARLY
364+
365+### Check version number when using gcc.
366+
367+GCC_VERSION=
368+if test "$GCC" = yes; then
369+ AC_MSG_CHECKING([C compiler version number])
370+ gcc_version=`$CC -v 2>&1 | $GREP "^.*gcc version" | \
371+ $SED -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'`
372+
373+ AX_COMPARE_VERSION([$gcc_version], [lt], [3],
374+ [warn_gcc_version="gcc version $gcc_version is likely to cause problems"
375+ OCTAVE_CONFIGURE_WARNING([warn_gcc_version])])
376+
377+ GCC_VERSION=$gcc_version
378+ AC_MSG_RESULT([$GCC_VERSION])
379+fi
380+AC_SUBST(GCC_VERSION)
381+
382+### Check version number when using g++ .
383+### It might be different from the gcc version number.
384+
385+GXX_VERSION=
386+if test "$GXX" = yes; then
387+ AC_MSG_CHECKING([C++ compiler version number])
388+ gxx_version=`$CXX -v 2>&1 | $GREP "^.*g.. version" | \
389+ $SED -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'`
390+
391+ AX_COMPARE_VERSION([$gxx_version], [lt], [4.1],
392+ [warn_gxx_version="g++ version $gxx_version is likely to cause problems"
393+ OCTAVE_CONFIGURE_WARNING([warn_gxx_version])])
394+
395+ GXX_VERSION=$gxx_version
396+ AC_MSG_RESULT([$GXX_VERSION])
397+fi
398+AC_SUBST(GXX_VERSION)
399+
400+OCTAVE_CHECK_BROKEN_STL_ALGO_H
401+AM_CONDITIONAL([AMCOND_HAVE_BROKEN_STL_ALGO_H],
402+ [test $octave_cv_broken_stl_algo_h = yes])
403+
404+if test $octave_cv_broken_stl_algo_h = yes; then
405+ 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."
406+ OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
407+fi
408+
409+### Determine the compiler flag necessary to create dependencies
410+
411+## Assume GCC.
412+INCLUDE_DEPS=yes
413+DEPEND_FLAGS="-M"
414+DEPEND_EXTRA_SED_PATTERN=""
415+if test "$GCC" != yes; then
416+ case $canonical_host_type in
417+ sparc-sun-solaris2* | i386-pc-solaris2*)
418+ DEPEND_FLAGS="-xM1"
419+ DEPEND_EXTRA_SED_PATTERN="-e '/\/opt\/SUNWspro/d'"
420+ ;;
421+ *-*-msdosmsvc)
422+ ;;
423+ *-*-mingw*)
424+ if test $have_msvc = no; then
425+ INCLUDE_DEPS=no
426+ fi
427+ ;;
428+ *)
429+ INCLUDE_DEPS=no
430+ ;;
431+ esac
432+fi
433+AC_SUBST(INCLUDE_DEPS)
434+AC_SUBST(DEPEND_FLAGS)
435+AC_SUBST(DEPEND_EXTRA_SED_PATTERN)
436+
437+### Check for pthread library
438+
439+AX_PTHREAD
440+## Include pthread libs and flags early in case other tests need them.
441+## They seem to be required for the OpenGL tests on Debian systems.
442+LIBS="$PTHREAD_LIBS $LIBS"
443+XTRA_CFLAGS="$XTRA_CFLAGS $PTHREAD_CFLAGS"
444+XTRA_CXXFLAGS="$XTRA_CXXFLAGS $PTHREAD_CFLAGS"
445+## Set these for any other tests that may require them. They will be
446+## reset before output files are generated.
447+CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
448+CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
449+
450+### Test whether the compiler supports OpenMP. This is enabled by default
451+### now to allow the option of using OpenMP in loadable modules.
452+
453+USE_OPENMP=no
454+check_for_openmp=yes
455+AC_ARG_ENABLE([openmp],
456+ [AS_HELP_STRING([--disable-openmp],
457+ [disable OpenMP SMP multi-threading])],
458+ [if test "$enableval" = no; then check_for_openmp=no; fi], [])
459+if test $check_for_openmp = yes; then
460+ AC_LANG_PUSH(C)
461+ AX_OPENMP([XTRA_CFLAGS="$XTRA_CFLAGS $OPENMP_CFLAGS"; USE_OPENMP=yes], [])
462+ AC_LANG_POP(C)
463+ AC_LANG_PUSH(C++)
464+ AX_OPENMP([XTRA_CXXFLAGS="$XTRA_CXXFLAGS $OPENMP_CXXFLAGS"; USE_OPENMP=yes], [])
465+ AC_LANG_POP(C++)
466+fi
467+dnl Define here since it is skipped if the first argument to
468+dnl AX_OPENMP is not empty.
469+if test $USE_OPENMP = yes; then
470+ AC_DEFINE(HAVE_OPENMP, 1, [Define if OpenMP is enabled])
471+fi
472+## Set these for any other tests that may require them. They will be
473+## reset before output files are generated.
474+CFLAGS="$CFLAGS $OPENMP_CFLAGS"
475+CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
476+
477+### When compiling math for x87, problems may arise in some code comparing
478+### floating-point intermediate results. The root cause is the extra precision
479+### (~80 bits) of x87 co-processor registers versus the IEEE standard 64 bits.
480+### Generally, storing the result in a local volatile variable forces a
481+### truncation back to 64 bits, but it also degrades performance.
482+### However, this performance degradation is very minimal, if indeed measurable.
483+### Therefore, it has been enabled for all platforms and compilers.
484+### Reported bugs indicate that --enable-float-truncate is required for MinGW
485+### and Cygwin platforms and for GCC compilers >= 5.0. It should not be
486+### necessary for non-x87 targets or when using modern SSE math.
487+ac_float_truncate=volatile
488+AC_ARG_ENABLE([float-truncate],
489+ [AS_HELP_STRING([--disable-float-truncate],
490+ [truncate intermediate FP results])],
491+ [if test "$enableval" = no; then
492+ ac_float_truncate=
493+ fi],
494+ [])
495+
496+AC_DEFINE_UNQUOTED(FLOAT_TRUNCATE, [$ac_float_truncate],
497+ [Define to volatile if you need to truncate intermediate FP results.])
498+
499+### Determine extra CFLAGS that may be necessary for Octave.
500+
501+## On Intel systems with gcc, we may need to compile with -mieee-fp
502+## to get full support for IEEE floating point.
503+##
504+## On Alpha/OSF systems, we need -mieee.
505+
506+ieee_fp_flag=
507+case $canonical_host_type in
508+ i[[3456789]]86-*-*)
509+ if test "$GCC" = yes; then
510+ OCTAVE_CC_FLAG([-mieee-fp], [
511+ ieee_fp_flag=-mieee-fp
512+ XTRA_CFLAGS="$XTRA_CFLAGS -mieee-fp"
513+ AC_MSG_NOTICE([adding -mieee-fp to XTRA_CFLAGS])])
514+ fi
515+ if test "$GXX" = yes; then
516+ OCTAVE_CXX_FLAG([-mieee-fp], [
517+ ieee_fp_flag=-mieee-fp
518+ XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee-fp"
519+ AC_MSG_NOTICE([adding -mieee-fp to XTRA_CXXFLAGS])])
520+ fi
521+ ;;
522+ alpha*-*-*)
523+ if test "$GCC" = yes; then
524+ OCTAVE_CC_FLAG([-mieee], [
525+ ieee_fp_flag=-mieee
526+ XTRA_CFLAGS="$XTRA_CFLAGS -mieee"
527+ AC_MSG_NOTICE([adding -mieee to XTRA_CFLAGS])])
528+ else
529+ OCTAVE_CC_FLAG([-ieee], [
530+ ieee_fp_flag=-ieee
531+ XTRA_CFLAGS="$XTRA_CFLAGS -ieee"
532+ AC_MSG_NOTICE([adding -ieee to XTRA_CFLAGS])])
533+ fi
534+ if test "$GXX" = yes; then
535+ OCTAVE_CXX_FLAG([-mieee], [
536+ ieee_fp_flag=-mieee
537+ XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee"
538+ AC_MSG_NOTICE([adding -mieee to XTRA_CXXFLAGS])])
539+ else
540+ OCTAVE_CXX_FLAG([-ieee], [
541+ ieee_fp_flag=-ieee
542+ XTRA_CXXFLAGS="$XTRA_CXXFLAGS -ieee"
543+ AC_MSG_NOTICE([adding -ieee to XTRA_CXXFLAGS])])
544+ fi
545+ ;;
546+ *ibm-aix4*)
547+ OCTAVE_CC_FLAG([-mminimal-toc], [
548+ XTRA_CFLAGS="$XTRA_CFLAGS -mminimal-toc"])
549+
550+ OCTAVE_CXX_FLAG([-mminimal-toc], [
551+ XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mminimal-toc"])
552+ ;;
553+esac
554+
555+AC_SUBST(XTRA_CFLAGS)
556+AC_SUBST(XTRA_CXXFLAGS)
557+
558+### Defaults for cross compiling. BUILD_CC and BUILD_CXX are
559+### the compilers that we use for building tools on the build system.
560+### For now, we assume that the only cross compiling we can do is
561+### with gcc on a Unixy system, but the dedicated hacker can override these.
562+
563+if test "$cross_compiling" = yes; then
564+ BUILD_CC="gcc"
565+ BUILD_CFLAGS="-O2 -g"
566+ BUILD_CXX="g++"
567+ BUILD_CXXFLAGS="-O2 -g"
568+ BUILD_LDFLAGS=""
569+ BUILD_EXEEXT=""
570+else
571+ BUILD_CC='$(CC)'
572+ BUILD_CFLAGS='$(CFLAGS)'
573+ BUILD_CXX='$(CXX)'
574+ BUILD_CXXFLAGS='$(CXXFLAGS)'
575+ BUILD_LDFLAGS='$(LDFLAGS)'
576+ BUILD_EXEEXT='$(EXEEXT)'
577+fi
578+
579+AC_ARG_VAR([BUILD_CC],
580+ [build system C compiler (used if cross compiling)])
581+AC_ARG_VAR([BUILD_CFLAGS],
582+ [build system C compiler flags (used if cross compiling)])
583+AC_ARG_VAR([BUILD_CXX],
584+ [build system C++ compiler (used if cross compiling)])
585+AC_ARG_VAR([BUILD_CXXFLAGS],
586+ [build system C++ compiler flags (used if cross compiling)])
587+AC_ARG_VAR([BUILD_LDFLAGS],
588+ [build system C++ compiler link flags (used if cross compiling)])
589+AC_ARG_VAR([BUILD_EXEEXT],
590+ [build system executable extension (used if cross compiling)])
591+
592+
593+### Look for math library. If found, this will add -lm to LIBS.
594+
595+dnl Keep this check before the check for the Fortran compiler,
596+dnl in case -lm is needed to compile Fortran programs.
597+AC_CHECK_LIB(m, sin)
598+
599+### Determine the Fortran compiler and how to invoke it
600+
601+## Default FFLAGS is -O.
602+if test -z "$FFLAGS"; then
603+ FFLAGS="-O"
604+fi
605+
606+## Prefer gfortran, but the user's F77 environment variable will override.
607+AC_PROG_F77([gfortran])
608+if test -z "$F77"; then
609+ ## No gfortran found, search for any other installed compiler.
610+ AC_PROG_F77
611+fi
612+if test "$F77" = g77; then
613+ AC_MSG_ERROR([g77 is not a supported Fortran compiler. Select another compiler by setting the environment variable F77 and re-running configure.])
614+fi
615+
616+AC_MSG_CHECKING([whether a usable Fortran compiler was found])
617+if test -n "$F77"; then
618+ AC_MSG_RESULT(yes)
619+else
620+ AC_MSG_RESULT(no)
621+ AC_MSG_ERROR([A Fortran compiler is required])
622+fi
623+
624+## Determine calling conventions for Fortran compiler
625+AC_F77_LIBRARY_LDFLAGS
626+AC_F77_DUMMY_MAIN
627+AC_F77_WRAPPERS
628+
629+F77_TOLOWER=yes
630+F77_APPEND_UNDERSCORE=yes
631+F77_APPEND_EXTRA_UNDERSCORE=yes
632+
633+case $ac_cv_f77_mangling in
634+ "upper case") F77_TOLOWER=no ;;
635+esac
636+case $ac_cv_f77_mangling in
637+ "no underscore") F77_APPEND_UNDERSCORE=no ;;
638+esac
639+case $ac_cv_f77_mangling in
640+ "no extra underscore") F77_APPEND_EXTRA_UNDERSCORE=no ;;
641+esac
642+
643+case $canonical_host_type in
644+ i[[3456789]]86-*-*)
645+ if test $ac_cv_f77_compiler_gnu = yes; then
646+ OCTAVE_F77_FLAG([-mieee-fp])
647+ fi
648+ ;;
649+ alpha*-*-*)
650+ if test $ac_cv_f77_compiler_gnu = yes; then
651+ OCTAVE_F77_FLAG([-mieee])
652+ else
653+ OCTAVE_F77_FLAG([-ieee])
654+ OCTAVE_F77_FLAG([-fpe1])
655+ fi
656+ ;;
657+ powerpc-apple-machten*)
658+ FFLAGS=
659+ ;;
660+esac
661+
662+if test -n "$FFLAGS"; then
663+ AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS])
664+fi
665+
666+AC_SUBST(F77_TOLOWER)
667+AC_SUBST(F77_APPEND_UNDERSCORE)
668+AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE)
669+
670+if test -z "$F77"; then
671+ 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.])
672+fi
673+
674+OCTAVE_CHECK_FUNC_FORTRAN_ISNAN
675+F77_ISNAN_MACRO=
676+if test $octave_cv_func_fortran_isnan = no; then
677+ AC_MSG_NOTICE([substituting ISNAN(X) with X.NE.X in Fortran sources])
678+ F77_ISNAN_MACRO="s|ISNAN(\(@<:@^)@:>@*\))|(\1.NE.\1)|"
679+fi
680+AC_SUBST(F77_ISNAN_MACRO)
681+
682+OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER
683+if test $octave_cv_sizeof_fortran_integer = no; then
684+ if test $USE_64_BIT_IDX_T = yes; then
685+ case $F77 in
686+ *gfortran*)
687+ case $F77_INTEGER_8_FLAG in
688+ *-fdefault-integer-8*)
689+ ;;
690+ *)
691+ case $FFLAGS in
692+ *-fdefault-integer-8*)
693+ AC_MSG_NOTICE([setting -fdefault-integer-8 in F77_INTEGER_8_FLAG instead of FFLAGS])
694+ FFLAGS=`echo $FFLAGS | $SED 's/-fdefault-integer-8//g'`
695+ F77_INTEGER_8_FLAG="-fdefault-integer-8"
696+ ;;
697+ *)
698+ AC_MSG_NOTICE([adding -fdefault-integer-8 to F77_INTEGER_8_FLAG])
699+ F77_INTEGER_8_FLAG="-fdefault-integer-8"
700+ ## Invalidate the cache and try again.
701+ $as_unset octave_cv_sizeof_fortran_integer
702+ ;;
703+ esac
704+ ;;
705+ esac
706+ ;;
707+ esac
708+ if test -z "$octave_cv_sizeof_fortran_integer"; then
709+ OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER
710+ fi
711+ if test $octave_cv_sizeof_fortran_integer = no; then
712+ 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.])
713+ fi
714+ else
715+ 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.])
716+ fi
717+fi
718+AC_SUBST(F77_INTEGER_8_FLAG)
719+
720+OCTAVE_F77_FLAG([-ffloat-store], [
721+ AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store])
722+ F77_FLOAT_STORE_FLAG=-ffloat-store
723+ AC_SUBST(F77_FLOAT_STORE_FLAG)
724+])
725+
726+### Check for the Qhull library
727+
728+OCTAVE_CHECK_LIB(qhull, QHull,
729+ [Qhull library not found. This will result in loss of functionality of some geometry functions.],
730+ [libqhull/libqhull.h qhull/libqhull.h libqhull.h qhull/qhull.h qhull.h],
731+ [qh_qhull], [], [],
732+ [warn_qhull=
733+ OCTAVE_CHECK_QHULL_VERSION
734+ OCTAVE_CHECK_LIB_QHULL_OK(
735+ [AC_DEFINE(HAVE_QHULL, 1, [Define to 1 if Qhull is available.])],
736+ [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."])])
737+
738+### Check for PCRE regex library.
739+
740+PCRE_LIBS=
741+
742+pcre_fail_msg="to build Octave, you must have the PCRE library and header files installed"
743+
744+AC_CHECK_HEADERS([pcre.h pcre/pcre.h])
745+
746+AC_CACHE_CHECK([whether pcre.h defines the macros we need],
747+ [ac_cv_pcre_h_macros_present],
748+ [AC_EGREP_CPP([PCRE_HAS_MACROS_WE_NEED], [
749+ #if defined (HAVE_PCRE_H)
750+ # include <pcre.h>
751+ #elif defined (HAVE_PCRE_PCRE_H)
752+ # include <pcre/pcre.h>
753+ #error "NO PCRE HEADER"
754+ #endif
755+ #if defined (PCRE_INFO_NAMECOUNT) \
756+ && defined (PCRE_INFO_NAMEENTRYSIZE) \
757+ && defined (PCRE_INFO_NAMETABLE)
758+ PCRE_HAS_MACROS_WE_NEED
759+ #endif],
760+ ac_cv_pcre_h_macros_present=yes, ac_cv_pcre_h_macros_present=no)])
761+
762+if test $ac_cv_pcre_h_macros_present = yes; then
763+ ## check for pcre-config, and if so, get build variables
764+ AC_CHECK_PROG(HAVE_PCRE_CONFIG, pcre-config, [yes], [no])
765+ if test $HAVE_PCRE_CONFIG = yes; then
766+ PCRE_CPPFLAGS=`pcre-config --cflags`
767+ PCRE_LIBS=`pcre-config --libs`
768+ else
769+ PCRE_LIBS="-lpcre"
770+ fi
771+ save_LIBS="$LIBS"
772+ LIBS="$PCRE_LIBS $LIBS"
773+ AC_CHECK_FUNCS([pcre_compile],
774+ [AC_SUBST(PCRE_CPPFLAGS)
775+ AC_SUBST(PCRE_LIBS)],
776+ [AC_MSG_ERROR([$pcre_fail_msg])])
777+ LIBS="$save_LIBS"
778+else
779+ AC_MSG_ERROR([$pcre_fail_msg])
780+fi
781+
782+### Check for ZLIB library.
783+
784+OCTAVE_CHECK_LIB(z, ZLIB,
785+ [ZLIB library not found. Octave will not be able to save or load compressed data files or HDF5 files.],
786+ [zlib.h], [gzclearerr])
787+
788+### Also define HAVE_ZLIB if libz is found.
789+if test -z "$warn_z"; then
790+ AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if ZLIB is available.])
791+fi
792+
793+ ### Check for the LLVM library
794+
795+build_jit=no
796+AC_ARG_ENABLE([jit],
797+ [AS_HELP_STRING([--enable-jit],
798+ [(EXPERIMENTAL) enable JIT compiler])],
799+ [if test "$enableval" = yes; then
800+ build_jit=yes
801+ fi],
802+ [])
803+
804+LLVM_CXXFLAGS=
805+LLVM_CPPFLAGS=
806+LLVM_LDFLAGS=
807+LLVM_LIBS=
808+
809+if test $build_jit = yes; then
810+
811+ ## Find llvm-config program from environment variable or by searching
812+ AC_ARG_VAR([LLVM_CONFIG], [path to llvm-config utility])
813+ AC_CHECK_PROG([LLVM_CONFIG], llvm-config, llvm-config, [])
814+
815+ if test -z "$LLVM_CONFIG"; then
816+ warn_llvm="llvm-config utility not found. JIT compiler is disabled."
817+ else
818+ dnl Preset warning message in case compile fails
819+ warn_llvm="LLVM was not found or is to old. JIT compiler is disabled."
820+
821+ save_CPPFLAGS="$CPPFLAGS"
822+ save_CXXFLAGS="$CXXFLAGS"
823+ save_LDFLAGS="$LDFLAGS"
824+
825+ ## Use -isystem if available because we don't want to see warnings in LLVM
826+ LLVM_INCLUDE_FLAG=-I
827+ OCTAVE_CC_FLAG([-isystem .], [
828+ LLVM_INCLUDE_FLAG=-isystem
829+ AC_MSG_NOTICE([using -isystem for LLVM headers])])
830+
831+ dnl Use -isystem so we don't get warnings from llvm headers
832+ LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
833+ LLVM_CXXFLAGS=
834+ LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
835+
836+
837+ LDFLAGS="$LDFLAGS $LLVM_LDFLAGS"
838+ LLVM_SO=LLVM-`$LLVM_CONFIG --version`
839+ AC_CHECK_LIB([$LLVM_SO], [LLVMBuildAdd], [LLVM_LIBS="-l$LLVM_SO"], [LLVM_LIBS=`$LLVM_CONFIG --libs`])
840+
841+ dnl
842+ dnl Define some extra flags that LLVM requires in order to include headers.
843+ dnl Ideally we should get these from llvm-config, but llvm-config isn't
844+ dnl very helpful.
845+ dnl
846+ CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS"
847+ CXXFLAGS="$LLVM_CXXFLAGS $CXXFLAGS"
848+ AC_LANG_PUSH(C++)
849+ AC_CHECK_HEADER([llvm/Support/TargetSelect.h], [warn_llvm=""])
850+
851+ have_function_h=no
852+ AC_CHECK_HEADERS([llvm/IR/Function.h llvm/Function.h],
853+ [have_function_h=yes; break])
854+ if test $have_function_h = no; then
855+ warn_llvm="Missing LLVM file Function.h. JIT compiler is disabled."
856+ fi
857+ have_irbuilder_h=no
858+ AC_CHECK_HEADERS([llvm/Support/IRBuilder.h llvm/IR/IRBuilder.h \
859+ llvm/IRBuilder.h], [have_irbuilder_h=yes; break])
860+ if test $have_irbuilder_h = no; then
861+ warn_llvm="Missing LLVM file IRBuilder.h. JIT compiler is disabled."
862+ fi
863+ have_llvm_data_h=no
864+ AC_CHECK_HEADERS([llvm/Target/TargetData.h llvm/IR/DataLayout.h \
865+ llvm/DataLayout.h], [have_llvm_data_h=yes; break])
866+ if test $have_llvm_data_h = no; then
867+ warn_llvm="Missing LLVM file TargetData.h. JIT compiler is disabled."
868+ fi
869+
870+ AC_CHECK_HEADERS([llvm/IR/Verifier.h])
871+
872+ OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API
873+ OCTAVE_LLVM_FUNCTION_ADDFNATTR_API
874+ OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API
875+ OCTAVE_LLVM_RAW_FD_OSTREAM_API
876+ OCTAVE_LLVM_LEGACY_PASSMANAGER_API
877+ AC_LANG_POP(C++)
878+ CPPFLAGS="$save_CPPFLAGS"
879+ CXXFLAGS="$save_CXXFLAGS"
880+ LDFLAGS="$save_LDFLAGS"
881+ fi
882+
883+ if test -z "$warn_llvm"; then
884+ AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.])
885+ else
886+ build_jit=no
887+ LLVM_CPPFLAGS=
888+ LLVM_CXXFLAGS=
889+ LLVM_LDFLAGS=
890+ LLVM_LIBS=
891+ OCTAVE_CONFIGURE_WARNING([warn_llvm])
892+ fi
893+dnl FIXME: Re-instate when JIT is enabled by default
894+dnl else
895+dnl ## JIT build disabled
896+dnl warn_llvm="JIT compiler disabled, some performance loss for loops"
897+dnl OCTAVE_CONFIGURE_WARNING([warn_llvm])
898+fi
899+
900+AC_SUBST(LLVM_CPPFLAGS)
901+AC_SUBST(LLVM_CXXFLAGS)
902+AC_SUBST(LLVM_LDFLAGS)
903+AC_SUBST(LLVM_LIBS)
904+AM_CONDITIONAL([AMCOND_HAVE_LLVM], [test -z "$warn_llvm"])
905+
906+### Check for HDF5 library.
907+
908+save_CPPFLAGS="$CPPFLAGS"
909+save_LIBS="$LIBS"
910+CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
911+LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
912+OCTAVE_CHECK_LIB(hdf5, HDF5,
913+ [HDF5 library not found. Octave will not be able to save or load HDF5 data files.],
914+ [hdf5.h], [H5Gget_num_objs], [], [],
915+ [warn_hdf5=
916+ OCTAVE_CHECK_HDF5_HAS_VER_16_API
917+ AC_DEFINE(HAVE_HDF5, 1,
918+ [Define to 1 if HDF5 is available and newer than version 1.6.])
919+ if test $have_msvc = yes; then
920+ OCTAVE_CHECK_LIB_HDF5_DLL
921+ fi
922+ ])
923+CPPFLAGS="$save_CPPFLAGS"
924+LIBS="$save_LIBS"
925+
926+### Check for FFTW library. Default to Fortran FFTPACK if it is not available.
927+
928+## Check for FFTW header and library.
929+OCTAVE_CHECK_LIB(fftw3, FFTW3,
930+ [FFTW3 library not found. The slower FFTPACK library will be used instead.],
931+ [fftw3.h], [fftw_plan_dft_1d])
932+
933+OCTAVE_CHECK_LIB(fftw3f, FFTW3F,
934+ [FFTW3F library not found. The slower FFTPACK library will be used instead.],
935+ [fftw3.h], [fftwf_plan_dft_1d])
936+
937+## Check command line for the option to disable multi-threaded FFTW
938+build_fftw_threads=yes
939+AC_ARG_ENABLE([fftw-threads],
940+ [AS_HELP_STRING([--disable-fftw-threads],
941+ [disable Multi-threaded FFTW])],
942+ [if test "$enableval" = no; then
943+ build_fftw_threads=no
944+ fi],
945+ [])
946+
947+## Octave is currently unable to use FFTW unless
948+## both float and double versions are available.
949+
950+AM_CONDITIONAL([AMCOND_HAVE_FFTW],
951+ [test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"])
952+
953+if test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"; then
954+ AC_DEFINE(HAVE_FFTW, 1, [Define if you have both FFTW3 and FFTW3F libraries.])
955+else
956+ ## --without-fftw3 given, or one of the FFTW3 libs not installed.
957+ ## Don't check for FFTW threads as this is now pointless.
958+ build_fftw_threads=no
959+fi
960+
961+## Check for the multithreaded FFTW library.
962+## Fallback to singlethreaded if not found or disabled
963+if test $build_fftw_threads = yes; then
964+ OCTAVE_CHECK_FFTW_THREADS(fftw3, fftw_plan_with_nthreads)
965+ OCTAVE_CHECK_FFTW_THREADS(fftw3f, fftwf_plan_with_nthreads)
966+fi
967+
968+## Subdirectory of liboctave/cruft to build if FFTW is not found.
969+FFT_DIR="fftpack"
970+AC_SUBST(FFT_DIR)
971+
972+### Check for GLPK library and header.
973+
974+save_CPPFLAGS="$CPPFLAGS"
975+save_LIBS="$LIBS"
976+CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
977+LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
978+OCTAVE_CHECK_LIB(glpk, GLPK,
979+ [GLPK library not found. The glpk function for solving linear programs will be disabled.],
980+ [glpk/glpk.h glpk.h], [glp_simplex], [], [],
981+ [warn_glpk=
982+ OCTAVE_CHECK_LIB_GLPK_OK(
983+ [AC_DEFINE(HAVE_GLPK, 1, [Define to 1 if GLPK is available.])],
984+ [warn_glpk="GLPK library found, but does not seem to work properly -- disabling glpk function"])])
985+LIBS="$save_LIBS"
986+CPPFLAGS="$save_CPPFLAGS"
987+
988+### Checks for cURL header and library.
989+
990+save_CPPFLAGS="$CPPFLAGS"
991+save_LIBS="$LIBS"
992+CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
993+LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
994+OCTAVE_CHECK_LIB(curl, cURL,
995+ [cURL library not found. The ftp objects, urlread and urlwrite functions will be disabled.],
996+ [curl/curl.h], [curl_easy_escape])
997+if test -z "$warn_curl"; then
998+ ## Additional check on cURL library that was found
999+ AC_CACHE_CHECK([for CURLOPT_DIRLISTONLY in curl/curl.h],
1000+ [octave_cv_curl_has_curlopt_dirlistonly],
1001+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1002+ #include <curl/curl.h>
1003+ ]], [[
1004+ curl_easy_setopt ((CURL*)NULL, CURLOPT_DIRLISTONLY, 0);
1005+ ]])],
1006+ [octave_cv_curl_has_curlopt_dirlistonly=yes],
1007+ [octave_cv_curl_has_curlopt_dirlistonly=no])
1008+ ])
1009+ if test $octave_cv_curl_has_curlopt_dirlistonly = no; then
1010+ AC_DEFINE(CURLOPT_DIRLISTONLY, CURLOPT_FTPLISTONLY,
1011+ [Define to the legacy option name if using an older version of cURL.])
1012+ fi
1013+fi
1014+LIBS="$save_LIBS"
1015+CPPFLAGS="$save_CPPFLAGS"
1016+
1017+### Check for sndfile
1018+
1019+warn_sndfile="sndfile library fails tests. The audioinfo, audioread and audiowrite functions for reading and writing audio files will not be fully functional."
1020+
1021+check_sndfile=no
1022+AC_ARG_WITH([sndfile],
1023+ [AS_HELP_STRING([--without-sndfile],
1024+ [don't use sndfile library, disable audio file I/O])],
1025+ [if test x"$withval" = x"no"; then
1026+ warn_sndfile="--without-sndfile specified. The audioinfo, audioread and audiowrite functions for reading and writing audio files will not be fully functional."
1027+ else
1028+ check_sndfile=yes
1029+ fi],
1030+ [check_sndfile=yes])
1031+
1032+if test $check_sndfile = yes; then
1033+ PKG_CHECK_EXISTS([sndfile], [
1034+ SNDFILE_CPPFLAGS=`$PKG_CONFIG --cflags-only-I sndfile`
1035+ SNDFILE_LDFLAGS=`$PKG_CONFIG --libs-only-L sndfile`
1036+ SNDFILE_LIBS=`$PKG_CONFIG --libs-only-l sndfile`
1037+ OCTAVE_CHECK_LIB_SNDFILE_OK([warn_sndfile=])
1038+ ])
1039+fi
1040+
1041+if test -z "$warn_sndfile"; then
1042+ AC_DEFINE(HAVE_SNDFILE, 1, [Define to 1 if sndfile is available.])
1043+else
1044+ SNDFILE_CPPFLAGS=
1045+ SNDFILE_LDFLAGS=
1046+ SNDFILE_LIBS=
1047+fi
1048+
1049+AC_SUBST(SNDFILE_CPPFLAGS)
1050+AC_SUBST(SNDFILE_LDFLAGS)
1051+AC_SUBST(SNDFILE_LIBS)
1052+
1053+### Check for PortAudio
1054+
1055+warn_portaudio="PortAudio library fails tests. The audioplayer, audiorecorder classes and audiodevinfo function for audio playback and recording will not be fully functional."
1056+
1057+check_portaudio=no
1058+AC_ARG_WITH([portaudio],
1059+ [AS_HELP_STRING([--without-portaudio],
1060+ [don't use PortAudio library, disable audio playback and recording])],
1061+ [if test x"$withval" = x"no"; then
1062+ warn_portaudio="--without-portaudio specified. The audioplayer, audiorecorder classes and audiodevinfo function for audio playback and recording will not be fully functional."
1063+ else
1064+ check_portaudio=yes
1065+ fi],
1066+ [check_portaudio=yes])
1067+
1068+if test $check_portaudio = yes; then
1069+ PKG_CHECK_EXISTS([portaudio-2.0 >= 19], [
1070+ PORTAUDIO_CPPFLAGS=`$PKG_CONFIG --cflags-only-I portaudio-2.0`
1071+ PORTAUDIO_LDFLAGS=`$PKG_CONFIG --libs-only-L portaudio-2.0`
1072+ PORTAUDIO_LIBS=`$PKG_CONFIG --libs-only-l portaudio-2.0`
1073+ warn_portaudio=
1074+ ])
1075+fi
1076+
1077+if test -z "$warn_portaudio"; then
1078+ AC_DEFINE(HAVE_PORTAUDIO, 1, [Define to 1 if PortAudio is available.])
1079+else
1080+ PORTAUDIO_CPPFLAGS=
1081+ PORTAUDIO_LDFLAGS=
1082+ PORTAUDIO_LIBS=
1083+fi
1084+AC_SUBST(PORTAUDIO_CPPFLAGS)
1085+AC_SUBST(PORTAUDIO_LDFLAGS)
1086+AC_SUBST(PORTAUDIO_LIBS)
1087+
1088+### Check for either of Graphics/ImageMagick++ libraries
1089+
1090+AC_ARG_WITH([magick],
1091+ [AS_HELP_STRING([--with-magick=LIB],
1092+ [select library to use for image I/O (options: GraphicsMagick(default) or ImageMagick)])],
1093+ [magick="$withval"],
1094+ [magick="GraphicsMagick"])
1095+
1096+warn_magick="$magick++ library not found. The imread function for reading image files will not be fully functional."
1097+
1098+MAGICK_CPPFLAGS=
1099+MAGICK_LDFLAGS=
1100+MAGICK_LIBS=
1101+
1102+PKG_CHECK_EXISTS([$magick++], [
1103+ ## Make sure we only get -I, -L, and -l flags. Some Graphics/ImageMagick++
1104+ ## packages add extra flags that are useful when building
1105+ ## Graphics/ImageMagick++ extentions. These extra flags break the
1106+ ## Octave build.
1107+ MAGICK_CPPFLAGS=`$PKG_CONFIG --cflags-only-I $magick++`
1108+ MAGICK_LDFLAGS=`$PKG_CONFIG --libs-only-L $magick++`
1109+ MAGICK_LIBS=`$PKG_CONFIG --libs-only-l $magick++`
1110+
1111+ warn_magick="$magick++ library fails tests. The imread function for reading image files will not be fully functional."
1112+
1113+ save_CPPFLAGS="$CPPFLAGS"
1114+ save_LIBS="$LIBS"
1115+ CPPFLAGS="$MAGICK_CPPFLAGS $CPPFLAGS"
1116+ LIBS="$MAGICK_LDFLAGS $MAGICK_LIBS $LIBS"
1117+ AC_LANG_PUSH(C++)
1118+ AC_CHECK_HEADER([Magick++.h], [
1119+ AC_CACHE_CHECK([for Magick::ColorRGB in Magick++.h],
1120+ [octave_cv_func_magick_colorrgb],
1121+ [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
1122+ #include <Magick++.h>
1123+ ]], [[
1124+ Magick::ColorRGB c;
1125+ ]])],
1126+ octave_cv_func_magick_colorrgb=yes,
1127+ octave_cv_func_magick_colorrgb=no)
1128+ ])
1129+ if test $octave_cv_func_magick_colorrgb = yes; then
1130+ warn_magick=
1131+ fi
1132+ ])
1133+ AC_LANG_POP(C++)
1134+ CPPFLAGS="$save_CPPFLAGS"
1135+ LIBS="$save_LIBS"
1136+
1137+ AC_CHECK_FUNCS([setlocale], [],
1138+ [warn_magick="$magick++ requires setlocale function. The imread function for reading image files will not be fully functional."])
1139+])
1140+
1141+if test -z "$warn_magick"; then
1142+ AC_DEFINE(HAVE_MAGICK, 1,
1143+ [Define to 1 if Graphics/ImageMagick++ is available.])
1144+else
1145+ MAGICK_CPPFLAGS=
1146+ MAGICK_LDFLAGS=
1147+ MAGICK_LIBS=
1148+fi
1149+AC_SUBST(MAGICK_CPPFLAGS)
1150+AC_SUBST(MAGICK_LDFLAGS)
1151+AC_SUBST(MAGICK_LIBS)
1152+
1153+### Check for X11 libraries
1154+
1155+AC_PATH_X
1156+if test "$have_x" = yes; then
1157+ AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if you have X11.])
1158+
1159+ if test "$x_includes" != "NONE"; then
1160+ X11_INCFLAGS="$x_includes"
1161+ fi
1162+ AC_SUBST(X11_INCFLAGS)
1163+
1164+ if test -z "$x_libraries"; then
1165+ AC_CHECK_LIB([X11], XrmInitialize, [X11_LIBS="-lX11"], [X11_LIBS=])
1166+ elif test $x_libraries != "NONE"; then
1167+ AC_CHECK_LIB([X11], XrmInitialize,
1168+ [X11_LIBS="-L$x_libraries -lX11"], [X11_LIBS=], "-L$x_libraries")
1169+ fi
1170+ AC_SUBST(X11_LIBS)
1171+fi
1172+
1173+### Check for the Carbon framework on MacOSX systems
1174+OCTAVE_HAVE_FRAMEWORK([Carbon],
1175+ [[#include <Carbon/Carbon.h>]], [[CGMainDisplayID ()]],
1176+ [have_framework_carbon=yes], [have_framework_carbon=no])
1177+if test $have_framework_carbon = yes; then
1178+ AC_DEFINE(HAVE_FRAMEWORK_CARBON, 1,
1179+ [Define to 1 if framework CARBON is available.])
1180+ CARBON_LIBS="-Wl,-framework -Wl,Carbon"
1181+ AC_MSG_NOTICE([adding -Wl,-framework -Wl,Carbon to CARBON_LIBS])
1182+ AC_SUBST(CARBON_LIBS)
1183+fi
1184+
1185+### Check for list of libraries needed for native graphics renderer.
1186+
1187+native_graphics=yes
1188+warn_freetype=""
1189+
1190+check_opengl=no
1191+AC_ARG_WITH([opengl],
1192+ [AS_HELP_STRING([--without-opengl],
1193+ [don't use OpenGL libraries, disable native graphics])],
1194+ [if test x"$withval" = x"no"; then
1195+ native_graphics=no
1196+ warn_opengl="--without-opengl specified. Native graphics will be disabled."
1197+ OCTAVE_CONFIGURE_WARNING([warn_opengl])
1198+ else
1199+ check_opengl=yes
1200+ fi],
1201+ [check_opengl=yes])
1202+
1203+## Check for OpenGL library
1204+if test $check_opengl = yes; then
1205+ OCTAVE_CHECK_LIB_OPENGL
1206+fi
1207+
1208+FLTK_CPPFLAGS=
1209+FLTK_LDFLAGS=
1210+FLTK_LIBS=
1211+
1212+if test -z "$OPENGL_LIBS"; then
1213+ if test $check_opengl = yes; then
1214+ native_graphics=no
1215+ warn_fltk_opengl="OpenGL libs (GL and GLU) not found. Native graphics will be disabled."
1216+ OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl])
1217+ fi
1218+fi
1219+
1220+if test -n "$OPENGL_LIBS"; then
1221+ AC_DEFINE(HAVE_OPENGL, 1, [Define to 1 if OpenGL is available.])
1222+
1223+ ## Check for FreeType 2 library
1224+
1225+ PKG_CHECK_MODULES([FT2], [freetype2], [
1226+ min_ft2_version=9.03
1227+ AC_MSG_CHECKING([for FreeType2 version >= $min_ft2_version])
1228+ $PKG_CONFIG freetype2 --atleast-version=$min_ft2_version
1229+ ac_status=$?
1230+ if test $ac_status = 0; then
1231+ AC_MSG_RESULT(yes)
1232+ AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if you have Freetype library.])
1233+ save_LIBS="$LIBS"
1234+ LIBS="$FT2_LIBS $LIBS"
1235+ AC_CHECK_FUNCS([FT_Reference_Face])
1236+ LIBS="$save_LIBS"
1237+ else
1238+ AC_MSG_RESULT(no)
1239+ warn_freetype="FreeType library >= 9.03 not found. Native graphics will be disabled."
1240+ fi])
1241+
1242+ if test -n "$warn_freetype"; then
1243+ native_graphics=no
1244+ OCTAVE_CONFIGURE_WARNING([warn_freetype])
1245+ else
1246+ FT2_CPPFLAGS="$FT2_CFLAGS"
1247+ fi
1248+
1249+ ## Check for fontconfig library
1250+
1251+ warn_fontconfig=""
1252+ if test $native_graphics = yes; then
1253+ PKG_CHECK_MODULES(FONTCONFIG, [fontconfig],
1254+ [have_fontconfig=yes
1255+ OPENGL_LIBS="$FONTCONFIG_LIBS $OPENGL_LIBS"
1256+ AC_DEFINE(HAVE_FONTCONFIG, 1, [Define to 1 if fontconfig is present.])],
1257+ [have_fontconfig=no
1258+ warn_fontconfig="Fontconfig library not found. Native graphics will be disabled."])
1259+ fi
1260+
1261+ if test -n "$warn_fontconfig"; then
1262+ native_graphics=no
1263+ OCTAVE_CONFIGURE_WARNING([warn_fontconfig])
1264+ else
1265+ FONTCONFIG_CPPFLAGS="$FONTCONFIG_CFLAGS"
1266+ fi
1267+
1268+ ## Check for Xft library (when using X11)
1269+
1270+ warn_xft=""
1271+ if test $native_graphics = yes && test "$have_x" = yes; then
1272+ PKG_CHECK_MODULES(XFT, [xft],
1273+ [AC_DEFINE(HAVE_XFT, 1, [Define to 1 if Xft is present.])],
1274+ [warn_xft="Xft library not found. Native graphics will be disabled."])
1275+ fi
1276+
1277+ if test -n "$warn_xft"; then
1278+ native_graphics=no
1279+ OCTAVE_CONFIGURE_WARNING([warn_xft])
1280+ fi
1281+
1282+ ## Check for FLTK (www.fltk.org) library
1283+
1284+ check_fltk=no
1285+ AC_ARG_WITH([fltk],
1286+ [AS_HELP_STRING([--without-fltk],
1287+ [don't use FLTK libraries, disable native graphics])],
1288+ [if test x"$withval" = x"no"; then
1289+ native_graphics=no
1290+ warn_fltk="--without-fltk specified. Native graphics will be disabled."
1291+ OCTAVE_CONFIGURE_WARNING([warn_fltk])
1292+ else
1293+ check_fltk=yes
1294+ fi],
1295+ [check_fltk=yes])
1296+
1297+ if test $check_fltk = yes; then
1298+ AC_ARG_WITH([fltk-prefix],
1299+ [AS_HELP_STRING([--with-fltk-prefix=PFX],
1300+ [prefix where FLTK is installed (optional)])],
1301+ [fltk_prefix="$withval"],
1302+ [fltk_prefix=""])
1303+
1304+ AC_ARG_WITH([fltk-exec-prefix],
1305+ [AS_HELP_STRING([--with-fltk-exec-prefix=PFX],
1306+ [exec prefix where FLTK is installed (optional)])],
1307+ [fltk_exec_prefix="$withval"],
1308+ [fltk_exec_prefix=""])
1309+
1310+ if test x"$fltk_exec_prefix" != x""; then
1311+ fltk_args="$fltk_args --exec-prefix=$fltk_exec_prefix"
1312+ if test "x${FLTK_CONFIG+set}" != xset ; then
1313+ FLTK_CONFIG="$fltk_exec_prefix/bin/fltk-config"
1314+ fi
1315+ fi
1316+
1317+ if test x"$fltk_prefix" != x""; then
1318+ fltk_args="$fltk_args --prefix=$fltk_prefix"
1319+ if test x${FLTK_CONFIG+set} != xset ; then
1320+ FLTK_CONFIG="$fltk_prefix/bin/fltk-config"
1321+ fi
1322+ fi
1323+
1324+ AC_PATH_PROG([FLTK_CONFIG], [fltk-config], [no])
1325+
1326+ warn_fltk_config=""
1327+ warn_fltk_opengl=""
1328+
1329+ if test "$FLTK_CONFIG" = no; then
1330+ native_graphics=no
1331+ warn_fltk_config="FLTK config script not found. Native graphics will be disabled."
1332+ OCTAVE_CONFIGURE_WARNING([warn_fltk_config])
1333+ else
1334+ FLTK_CPPFLAGS=`$FLTK_CONFIG $fltkconf_args --use-gl --cflags`
1335+ FLTK_LDFLAGS=`$FLTK_CONFIG $fltkconf_args --use-gl --ldflags`
1336+
1337+ case $host_os in
1338+ mingw*)
1339+ FLTK_LDFLAGS=`echo $FLTK_LDFLAGS | $SED -e 's/-mwindows//g'`
1340+ ;;
1341+ esac
1342+
1343+ AC_CACHE_CHECK([for OpenGL support in FLTK],
1344+ [octave_cv_fltk_opengl_support],
1345+ [save_CPPFLAGS="$CPPFLAGS"
1346+ CPPFLAGS="$CFLAGS $FLTK_CPPFLAGS"
1347+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1348+ #include <FL/gl.h>
1349+ ]], [[
1350+ int nothing = 0;
1351+ ]])],
1352+ octave_cv_fltk_opengl_support=no,
1353+ octave_cv_fltk_opengl_support=yes)
1354+ CPPFLAGS="$save_CPPFLAGS"
1355+ ])
1356+ if test $octave_cv_fltk_opengl_support = no; then
1357+ warn_fltk_opengl="FLTK does not have OpenGL support. Native graphics will be disabled."
1358+ else
1359+ AC_DEFINE(HAVE_FLTK, 1, [Define to 1 if FLTK is available.])
1360+ fi
1361+
1362+ if test -n "$warn_fltk_opengl"; then
1363+ native_graphics=no
1364+ OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl])
1365+ fi
1366+ fi
1367+ fi
1368+fi
1369+
1370+AC_SUBST(FLTK_CPPFLAGS)
1371+AC_SUBST(FLTK_LDFLAGS)
1372+AC_SUBST(FLTK_LIBS)
1373+
1374+## Check for gl2ps which is required for printing with OpenGL graphics
1375+if test $native_graphics = yes; then
1376+ AC_CHECK_HEADERS([gl2ps.h],
1377+ [GL2PS_LIBS="-lgl2ps"],
1378+ [warn_gl2ps="gl2ps library not found. OpenGL printing is disabled."
1379+ OCTAVE_CONFIGURE_WARNING([warn_gl2ps])])
1380+fi
1381+
1382+AC_SUBST(GL2PS_LIBS)
1383+
1384+if test -n "$OPENGL_LIBS"; then
1385+ ## Check for OSMesa which is needed for offscreen rendering with OpenGL
1386+ ## FIXME: Check for version >= 9.0.0
1387+ OCTAVE_CHECK_LIB(OSMesa, OSMesa,
1388+ [OSMesa library not found. Offscreen rendering with OpenGL will be disabled.],
1389+ [osmesa.h GL/osmesa.h], [OSMesaCreateContext])
1390+fi
1391+
1392+### Start determination of shared vs. static libraries
1393+
1394+## Use -static if compiling on Alpha OSF/1 1.3 systems.
1395+case $canonical_host_type in
1396+ alpha*-dec-osf1.3)
1397+ LD_STATIC_FLAG=-static
1398+ ;;
1399+esac
1400+if test -n "$LD_STATIC_FLAG"; then
1401+ AC_MSG_NOTICE([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG])
1402+fi
1403+AC_SUBST(LD_STATIC_FLAG)
1404+
1405+OCTAVE_PROG_AR
1406+
1407+ifdef([LT_INIT], [], [
1408+ errprint([error: you must have libtool 2.2.2 or a more recent version
1409+])
1410+ m4exit([1])])
1411+
1412+LT_PREREQ([2.2.2])
1413+LT_INIT([disable-static dlopen win32-dll])
1414+
1415+if test $enable_shared = yes; then
1416+ SHARED_LIBS=yes
1417+else
1418+ SHARED_LIBS=no
1419+fi
1420+
1421+if test $enable_static = yes; then
1422+ STATIC_LIBS=yes
1423+else
1424+ STATIC_LIBS=no
1425+fi
1426+
1427+XTRA_CRUFT_SH_LDFLAGS=
1428+if test $have_msvc = yes; then
1429+ FLIBS="$FLIBS -lkernel32"
1430+ XTRA_CRUFT_SH_LDFLAGS="-Wl,cruft/cruft.def"
1431+fi
1432+AC_SUBST(XTRA_CRUFT_SH_LDFLAGS)
1433+
1434+### Check for BLAS and LAPACK libraries:
1435+
1436+## Need to adjust FFLAGS to include correct integer size.
1437+save_FFLAGS="$FFLAGS"
1438+FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
1439+
1440+AX_BLAS_WITH_F77_FUNC([:], [:],
1441+ [ax_blas_ok=yes
1442+ AC_MSG_CHECKING([BLAS can be called from Fortran])
1443+ AC_MSG_RESULT([yes assumed for cross compilation])])
1444+AX_LAPACK([:], [:])
1445+
1446+## Restore FFLAGS.
1447+FFLAGS="$save_FFLAGS"
1448+
1449+## If necessary, try again with -ff2c in FFLAGS
1450+if test $ax_blas_ok = no; then
1451+ save_FFLAGS="$FFLAGS"
1452+ FFLAGS="-ff2c $FFLAGS $F77_INTEGER_8_FLAG"
1453+
1454+ AX_BLAS_WITH_F77_FUNC([:], [:])
1455+ AX_LAPACK([:], [:])
1456+
1457+ ## Restore FFLAGS, with -ff2c if that was helpful
1458+
1459+ if test $ax_blas_ok = yes; then
1460+ FFLAGS="-ff2c $save_FFLAGS"
1461+ else
1462+ FFLAGS="$save_FFLAGS"
1463+ fi
1464+fi
1465+
1466+## On OSX, try again with a wrapper library (without -ff2c!)
1467+if test $ax_blas_ok = no; then
1468+ case $host_os in
1469+ darwin*)
1470+ ## test if wrapper functions help
1471+ octave_blaswrap_save_CFLAGS="$CFLAGS"
1472+ CFLAGS="$CFLAGS -DUSE_BLASWRAP"
1473+ AC_LANG_PUSH(C)
1474+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1475+ #include "liboctave/cruft/misc/blaswrap.c"
1476+ ]])],
1477+ [mv conftest.$ac_objext blaswrap.$ac_objext
1478+ octave_blaswrap_save_BLAS_LIBS="$BLAS_LIBS"
1479+ BLAS_LIBS="blaswrap.$ac_objext -framework vecLib"
1480+
1481+ save_FFLAGS="$FFLAGS"
1482+ FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
1483+
1484+ AX_BLAS_WITH_F77_FUNC([:], [:])
1485+ AX_LAPACK([:], [:])
1486+
1487+ ## Restore FFLAGS.
1488+ FFLAGS="$save_FFLAGS"
1489+
1490+ ## remove temp file
1491+ rm -f blaswrap.$ac_objext],
1492+ [AC_MSG_FAILURE([cannot compile liboctave/cruft/misc/blaswrap.c])])
1493+ AC_LANG_POP(C)
1494+ CFLAGS="$octave_blaswrap_save_CFLAGS"
1495+
1496+ if test $ax_blas_ok = no; then
1497+ BLAS_LIBS="$octave_blaswrap_save_BLAS_LIBS"
1498+ else
1499+ ## wrapper in cruft, remove from BLAS_LIBS
1500+ BLAS_LIBS=`echo $BLAS_LIBS | $SED -e 's/blaswrap.[[^ ]]* //g'`
1501+ AC_DEFINE(USE_BLASWRAP, 1,
1502+ [Define to 1 if BLAS functions need to be wrapped (potentially needed for 64-bit OSX only).])
1503+ fi
1504+ ;;
1505+ esac
1506+fi
1507+
1508+if test $ax_blas_ok = no; then
1509+ if test $USE_64_BIT_IDX_T = yes && test "$ax_blas_integer_size_ok" = no; then
1510+ ## Attempt to be more informative.
1511+ AC_MSG_ERROR([BLAS doesn't seem to support 64-bit integers. This is incompatible with --enable-64.])
1512+ else
1513+ AC_MSG_ERROR([A BLAS library was detected but found incompatible with your Fortran 77 compiler settings.])
1514+ fi
1515+fi
1516+
1517+if test $ax_blas_ok = no || test $ax_lapack_ok = no; then
1518+ AC_MSG_ERROR([BLAS and LAPACK libraries are required])
1519+fi
1520+
1521+### Check for the qrupdate library
1522+
1523+## No need to adjust FFLAGS because only link is attempted.
1524+## Must supply proper LIBS, however.
1525+save_LIBS="$LIBS"
1526+LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
1527+OCTAVE_CHECK_LIB(qrupdate, qrupdate,
1528+ [qrupdate not found. The QR & Cholesky updating functions will be slow.],
1529+ [],
1530+ [sqr1up],
1531+ [Fortran 77], [don't use qrupdate, disable QR & Cholesky updating functions])
1532+
1533+## Additional check to see if qrupdate lib found supports LU updates
1534+if test -z "$warn_qrupdate"; then
1535+ AC_CACHE_CHECK([for slup1up in $QRUPDATE_LIBS],
1536+ [octave_cv_func_slup1up],
1537+ [LIBS="$LIBS $QRUPDATE_LIBS"
1538+ AC_LANG_PUSH([Fortran 77])
1539+ AC_LINK_IFELSE([AC_LANG_CALL([], [slup1up])],
1540+ octave_cv_func_slup1up=yes, octave_cv_func_slup1up=no)
1541+ AC_LANG_POP([Fortran 77])
1542+ ])
1543+ if test $octave_cv_func_slup1up = yes; then
1544+ AC_DEFINE(HAVE_QRUPDATE_LUU, 1, [Define to 1 if qrupdate supports LU updates.])
1545+ fi
1546+fi
1547+LIBS="$save_LIBS"
1548+
1549+if test $USE_64_BIT_IDX_T = yes; then
1550+ CHOLMOD_TAG="_l_"
1551+ CXSPARSE_TAG="_dl_"
1552+ UMFPACK_TAG="_zl_"
1553+else
1554+ CHOLMOD_TAG="_"
1555+ CXSPARSE_TAG="_di_"
1556+ UMFPACK_TAG="_zi_"
1557+fi
1558+
1559+### Check for AMD library
1560+
1561+OCTAVE_CHECK_LIB(amd, AMD,
1562+ [AMD library not found. This will result in some lack of functionality for sparse matrices.],
1563+ [suitesparse/amd.h ufsparse/amd.h amd/amd.h amd.h],
1564+ [amd_postorder],
1565+ [], [don't use AMD library, disable some sparse matrix functionality])
1566+
1567+### Check for CAMD library
1568+
1569+OCTAVE_CHECK_LIB(camd, CAMD,
1570+ [CAMD library not found. This will result in some lack of functionality for sparse matrices.],
1571+ [suitesparse/camd.h ufsparse/camd.h camd/camd.h camd.h],
1572+ [camd_postorder],
1573+ [], [don't use CAMD library, disable some sparse matrix functionality])
1574+
1575+### Check for COLAMD library
1576+
1577+OCTAVE_CHECK_LIB(colamd, COLAMD,
1578+ [COLAMD library not found. This will result in some lack of functionality for sparse matrices.],
1579+ [suitesparse/colamd.h ufsparse/colamd.h colamd/colamd.h colamd.h],
1580+ [colamd],
1581+ [], [don't use COLAMD library, disable some sparse matrix functionality])
1582+
1583+### Check for CCOLAMD library
1584+
1585+OCTAVE_CHECK_LIB(ccolamd, CCOLAMD,
1586+ [CCOLAMD library not found. This will result in some lack of functionality for sparse matrices.],
1587+ [suitesparse/ccolamd.h ufsparse/ccolamd.h ccolamd/ccolamd.h ccolamd.h],
1588+ [ccolamd],
1589+ [], [don't use CCOLAMD library, disable some sparse matrix functionality])
1590+
1591+### Check for CHOLMOD library.
1592+### If your cholmod library requires cblas, then you will need to
1593+### configure with --with-cholmod="-lcholmod -lcblas".
1594+
1595+save_LIBS="$LIBS"
1596+LIBS="$COLAMD_LDFLAGS $COLAMD_LIBS $AMD_LDFLAGS $AMD_LIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
1597+OCTAVE_CHECK_LIB(cholmod, CHOLMOD,
1598+ [CHOLMOD library not found. This will result in some lack of functionality for sparse matrices.],
1599+ [suitesparse/cholmod.h ufsparse/cholmod.h cholmod/cholmod.h cholmod.h],
1600+ [cholmod${CHOLMOD_TAG}start],
1601+ [], [don't use CHOLMOD library, disable some sparse matrix functionality])
1602+LIBS="$save_LIBS"
1603+
1604+### Check for CXSparse library
1605+
1606+OCTAVE_CHECK_LIB(cxsparse, CXSparse,
1607+ [CXSparse library not found. This will result in some lack of functionality for sparse matrices.],
1608+ [suitesparse/cs.h ufsparse/cs.h cxsparse/cs.h cs.h],
1609+ [cs${CXSPARSE_TAG}sqr],
1610+ [C++], [don't use CXSparse library, disable some sparse matrix functionality])
1611+
1612+### Check for UMFPACK library.
1613+
1614+save_LIBS="$LIBS"
1615+save_CPPFLAGS="$CPPFLAGS"
1616+LIBS="$AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS"
1617+CPPFLAGS="$AMD_CPPFLAGS $CPPFLAGS"
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+CPPFLAGS="$save_CPPFLAGS"
1624+LIBS="$save_LIBS"
1625+
1626+if test -z "$UMFPACK_LIBS"; then
1627+ ## Invalidate the cache and try again with -lcblas.
1628+ $as_unset ac_cv_lib_umfpack_umfpack${UMFPACK_TAG}get_determinant
1629+ $as_unset octave_cv_lib_umfpack
1630+ save_LIBS="$LIBS"
1631+ LIBS="-lcblas $AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS"
1632+ OCTAVE_CHECK_LIB([umfpack], UMFPACK,
1633+ [UMFPACK not found. This will result in some lack of functionality for sparse matrices.],
1634+ [suitesparse/umfpack.h ufsparse/umfpack.h umfpack/umfpack.h umfpack.h],
1635+ [umfpack${UMFPACK_TAG}get_determinant],
1636+ [], [don't use UMFPACK, disable some sparse matrix functionality])
1637+ if test -n "$UMFPACK_LIBS"; then
1638+ UMFPACK_LIBS="$UMFPACK_LIBS -lcblas"
1639+ fi
1640+ LIBS="$save_LIBS"
1641+fi
1642+
1643+## Test features of the installed UMFPACK library
1644+
1645+if test -n "$UMFPACK_LIBS"; then
1646+ ## SuiteSparse >= 4.0 needs additional link library for SuiteSparse_time()
1647+ save_CPPFLAGS="$CPPFLAGS"
1648+ save_LIBS="$LIBS";
1649+ CPPFLAGS="$UMFPACK_CPPFLAGS $AMD_CPPFLAGS $CPPFLAGS"
1650+ LIBS="$UMFPACK_LIBS $AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS"
1651+ xtra_libs=
1652+ OCTAVE_UMFPACK_NEED_SUITESPARSE_TIME
1653+ if test $octave_cv_umfpack_need_suitesparse_time = yes; then
1654+ AC_CHECK_LIB([rt], [clock_gettime], [xtra_libs="-lrt"], [xtra_libs=])
1655+ ## FIXME: This library list is only accurate for Linux, Mac OS X.
1656+ ## Possibly need other library names for MinGW, Cygwin.
1657+ AC_SEARCH_LIBS([SuiteSparse_time],
1658+ [suitesparseconfig SuiteSparse],
1659+ [], [], [$xtra_libs])
1660+ case $ac_cv_search_SuiteSparse_time in
1661+ -l*)
1662+ UMFPACK_LIBS="$UMFPACK_LIBS $ac_cv_search_SuiteSparse_time"
1663+ ;;
1664+ no)
1665+ UMFPACK_LIBS=
1666+ AC_MSG_WARN([UMFPACK library found but is missing SuiteSparse_time functionality.])
1667+ AC_MSG_WARN([UMFPACK library will be disabled.])
1668+ ;;
1669+ esac
1670+ fi
1671+ LIBS="$save_LIBS"
1672+ CPPFLAGS="$save_CPPFLAGS"
1673+
1674+ ## Check for UMFPACK separately split complex matrix and RHS.
1675+ if test -n "$UMFPACK_LIBS"; then
1676+ save_CPPFLAGS="$CPPFLAGS"
1677+ save_LIBS="$LIBS";
1678+ CPPFLAGS="$UMFPACK_CPPFLAGS $AMD_CPPFLAGS $CPPFLAGS"
1679+ LIBS="$UMFPACK_LIBS $CHOLMOD_LDFLAGS $CHOLMOD_LIBS $AMD_LDFLAGS $AMD_LIBS $COLAMD_LDFLAGS $COLAMD_LIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS $xtra_libs"
1680+ OCTAVE_UMFPACK_SEPARATE_SPLIT
1681+ LIBS="$save_LIBS"
1682+ CPPFLAGS="$save_CPPFLAGS"
1683+ fi
1684+fi
1685+
1686+### Check for ARPACK library.
1687+
1688+save_LIBS="$LIBS"
1689+LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
1690+OCTAVE_CHECK_LIB([arpack], ARPACK,
1691+ [ARPACK not found. The eigs function will be disabled.],
1692+ [],
1693+ [dseupd],
1694+ [Fortran 77], [don't use the ARPACK library, disable eigs function],
1695+ [warn_arpack=
1696+ OCTAVE_CHECK_LIB_ARPACK_OK(
1697+ [AC_DEFINE(HAVE_ARPACK, 1, [Define to 1 if ARPACK is available.])],
1698+ [warn_arpack="ARPACK library found, but does not seem to work properly -- disabling eigs function"])])
1699+LIBS="$save_LIBS"
1700+
1701+### Check for readline library.
1702+
1703+OCTAVE_ENABLE_READLINE
1704+
1705+### Enable dynamic linking. --enable-shared implies this, so
1706+### --enable-dl is only need if you are only building static libraries
1707+### and want to try dynamic linking too (works on some systems, for
1708+### example, OS X and Windows).
1709+
1710+AC_ARG_ENABLE([dl],
1711+ [AS_HELP_STRING([--disable-dl],
1712+ [disable loading of dynamically linked modules])],
1713+ [case $enableval in
1714+ yes) ENABLE_DYNAMIC_LINKING=yes ;;
1715+ no) ENABLE_DYNAMIC_LINKING=no ;;
1716+ *) AC_MSG_ERROR([bad value $enableval for --enable-dl]) ;;
1717+ esac],
1718+ [ENABLE_DYNAMIC_LINKING=no])
1719+
1720+if test $STATIC_LIBS = no && test $SHARED_LIBS = no; then
1721+ AC_MSG_ERROR([You can't disable building both static AND shared libraries!])
1722+fi
1723+
1724+CPICFLAG=-fPIC
1725+CXXPICFLAG=-fPIC
1726+FPICFLAG=-fPIC
1727+SHLEXT=so
1728+SHLLIB='$(SHLEXT)'
1729+SHLBIN=
1730+SHLEXT_VER='$(SHLEXT).$(version)'
1731+SHLLIB_VER='$(SHLLIB).$(version)'
1732+SHLBIN_VER='$(SHLBIN).$(version)'
1733+SHLLINKEXT=
1734+LIBPRE=lib
1735+SHLPRE=lib
1736+SHLLIBPRE=lib
1737+SHLBINPRE=lib
1738+SH_LD='$(CXX)'
1739+SH_LDFLAGS=-shared
1740+DL_LD='$(SH_LD)'
1741+DL_LDFLAGS='$(SH_LDFLAGS)'
1742+MKOCTFILE_DL_LDFLAGS='$(DL_LDFLAGS)'
1743+SONAME_FLAGS=
1744+NO_OCT_FILE_STRIP=false
1745+TEMPLATE_AR='$(AR)'
1746+TEMPLATE_ARFLAGS="$ARFLAGS"
1747+CRUFT_DLL_DEFS=
1748+OCTAVE_DLL_DEFS=
1749+OCTINTERP_DLL_DEFS=
1750+OCTGUI_DLL_DEFS=
1751+OCTGRAPHICS_DLL_DEFS=
1752+library_path_var=LD_LIBRARY_PATH
1753+ldpreloadsep=" "
1754+case $canonical_host_type in
1755+ *-*-386bsd* | *-*-netbsd*)
1756+ SH_LD=ld
1757+ SH_LDFLAGS=-Bshareable
1758+ ;;
1759+ *-*-openbsd*)
1760+ SH_LDFLAGS='-shared -fPIC'
1761+ ;;
1762+ *-*-freebsd*)
1763+ SH_LDFLAGS="-shared -Wl,-x"
1764+ ;;
1765+ alpha*-dec-osf*)
1766+ CPICFLAG=
1767+ CXXPICFLAG=
1768+ FPICFLAG=
1769+ SH_LDFLAGS="-shared -Wl,-expect_unresolved -Wl,'*'"
1770+ ;;
1771+ *-*-darwin*)
1772+ DL_LDFLAGS='-bundle -bundle_loader $(top_builddir)/libinterp/octave $(LDFLAGS)'
1773+ MKOCTFILE_DL_LDFLAGS='-bundle -bundle_loader $(bindir)/octave-$(version)$(EXEEXT)'
1774+ SH_LDFLAGS='-dynamiclib -single_module $(LDFLAGS)'
1775+ case $canonical_host_type in
1776+ powerpc-*)
1777+ CXXPICFLAG=
1778+ CPICFLAG=
1779+ FPICFLAG=
1780+ ;;
1781+ esac
1782+ SHLEXT=dylib
1783+ SHLLIB='$(SHLEXT)'
1784+ SHLEXT_VER='$(version).$(SHLEXT)'
1785+ SHLLIB_VER='$(version).$(SHLLIB)'
1786+ NO_OCT_FILE_STRIP=true
1787+ SONAME_FLAGS='-install_name $(octlibdir)/$@'
1788+ library_path_var=DYLD_LIBRARY_PATH
1789+ ;;
1790+ *-*-cygwin*)
1791+ CPICFLAG=
1792+ CXXPICFLAG=
1793+ FPICFLAG=
1794+ LIBPRE=lib
1795+ SHLPRE=cyg
1796+ SHLBINPRE=cyg
1797+ SHLEXT=dll
1798+ SHLLIB=dll.a
1799+ SHLBIN=dll
1800+ DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
1801+ SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
1802+ SONAME_FLAGS='-Wl,--out-implib=$(patsubst $(SHLPRE)%,$(LIBPRE)%,$@).a'
1803+ ldpreloadsep=":"
1804+ ;;
1805+ *-*-mingw*)
1806+ if test $have_msvc = yes; then
1807+ DL_LDFLAGS="-shared"
1808+ CPICFLAG=
1809+ CXXPICFLAG=
1810+ FPICFLAG=
1811+ SHLEXT=dll
1812+ SHLLIB=lib
1813+ SHLBIN=dll
1814+ LIBPRE=
1815+ SHLPRE=
1816+ SHLLIBPRE=
1817+ SHLBINPRE=
1818+ SH_LDFLAGS="-shared"
1819+ if test -n "`echo $CFLAGS | $GREP -e '-g'`" || test -n "`echo $CXXFLAGS | $GREP -e '-g'`"; then
1820+ DL_LDFLAGS="$DL_LDFLAGS -g"
1821+ SH_LDFLAGS="$SH_LDFLAGS -g"
1822+ fi
1823+ NO_OCT_FILE_STRIP=true
1824+ library_path_var=PATH
1825+ ## Extra compilation flags.
1826+ CRUFT_DLL_DEFS="-DCRUFT_DLL"
1827+ OCTAVE_DLL_DEFS="-DOCTAVE_DLL"
1828+ OCTINTERP_DLL_DEFS="-DOCTINTERP_DLL"
1829+ OCTGUI_DLL_DEFS="-DOCTGUI_DLL"
1830+ OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL"
1831+ else
1832+ CPICFLAG=
1833+ CXXPICFLAG=
1834+ FPICFLAG=
1835+ SHLEXT=dll
1836+ SHLLIB=dll.a
1837+ SHLBIN=dll
1838+ DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
1839+ SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
1840+ SONAME_FLAGS='-Wl,--out-implib=$@.a'
1841+ library_path_var=PATH
1842+ fi
1843+ ;;
1844+
1845+ *-*-msdosmsvc)
1846+ DL_LDFLAGS="-shared"
1847+ CPICFLAG=
1848+ CXXPICFLAG=
1849+ FPICFLAG=
1850+ SHLEXT=dll
1851+ SHLLIB=lib
1852+ SHLBIN=dll
1853+ LIBPRE=
1854+ SHLPRE=
1855+ SHLLIBPRE=
1856+ SHLBINPRE=
1857+ SH_LDFLAGS="-shared"
1858+ if test -n "`echo $CFLAGS | $GREP -e '-g'`" || test -n "`echo $CXXFLAGS | $GREP -e '-g'`"; then
1859+ DL_LDFLAGS="$DL_LDFLAGS -g"
1860+ SH_LDFLAGS="$SH_LDFLAGS -g"
1861+ fi
1862+ NO_OCT_FILE_STRIP=true
1863+ library_path_var=PATH
1864+ ## Extra compilation flags.
1865+ CRUFT_DLL_DEFS="-DCRUFT_DLL"
1866+ OCTAVE_DLL_DEFS="-DOCTAVE_DLL"
1867+ OCTGUI_DLL_DEFS="-DOCTGUI_DLL"
1868+ OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL"
1869+ ;;
1870+ *-*-linux* | *-*-gnu*)
1871+ MKOCTFILE_DL_LDFLAGS="-shared -Wl,-Bsymbolic"
1872+ SONAME_FLAGS='-Wl,-soname -Wl,$@'
1873+ ;;
1874+ i[[3456]]86-*-sco3.2v5*)
1875+ SONAME_FLAGS='-Wl,-h -Wl,$@'
1876+ SH_LDFLAGS=-G
1877+ ;;
1878+ rs6000-ibm-aix* | powerpc-ibm-aix*)
1879+ CPICFLAG=
1880+ CXXPICFLAG=
1881+ FPICFLAG=
1882+ library_path_var=LIBPATH
1883+ ;;
1884+ hppa*-hp-hpux*)
1885+ if test $ac_cv_f77_compiler_gnu = yes; then
1886+ FPICFLAG=-fPIC
1887+ else
1888+ FPICFLAG=+Z
1889+ fi
1890+ SHLEXT=sl
1891+ SH_LDFLAGS="-shared -fPIC"
1892+ library_path_var=SHLIB_PATH
1893+ ;;
1894+ ia64*-hp-hpux*)
1895+ if test $ac_cv_f77_compiler_gnu = yes; then
1896+ FPICFLAG=-fPIC
1897+ else
1898+ FPICFLAG=+Z
1899+ fi
1900+ SH_LDFLAGS="-shared -fPIC"
1901+ ;;
1902+ *-sgi-*)
1903+ CPICFLAG=
1904+ CXXPICFLAG=
1905+ FPICFLAG=
1906+ ;;
1907+ sparc-sun-sunos4*)
1908+ if test $ac_cv_f77_compiler_gnu = yes; then
1909+ FPICFLAG=-fPIC
1910+ else
1911+ FPICFLAG=-PIC
1912+ fi
1913+ SH_LD=ld
1914+ SH_LDFLAGS="-assert nodefinitions"
1915+ ;;
1916+ sparc-sun-solaris2* | i386-pc-solaris2*)
1917+ if test $ac_cv_f77_compiler_gnu = yes; then
1918+ FPICFLAG=-fPIC
1919+ else
1920+ FPICFLAG=-KPIC
1921+ fi
1922+ if test "$GCC" = yes; then
1923+ CPICFLAG=-fPIC
1924+ else
1925+ CPICFLAG=-KPIC
1926+ fi
1927+ if test "$GXX" = yes; then
1928+ CXXPICFLAG=-fPIC
1929+ SH_LDFLAGS=-shared
1930+ else
1931+ CXXPICFLAG=-KPIC
1932+ SH_LDFLAGS=-G
1933+ fi
1934+ ## Template closures in archive libraries need a different mechanism.
1935+ if test "$GXX" != yes; then
1936+ TEMPLATE_AR='$(CXX)'
1937+ TEMPLATE_ARFLAGS="-xar -o"
1938+ fi
1939+ ;;
1940+esac
1941+
1942+AC_MSG_NOTICE([defining FPICFLAG to be $FPICFLAG])
1943+AC_MSG_NOTICE([defining CPICFLAG to be $CPICFLAG])
1944+AC_MSG_NOTICE([defining CXXPICFLAG to be $CXXPICFLAG])
1945+AC_MSG_NOTICE([defining SHLEXT to be $SHLEXT])
1946+AC_MSG_NOTICE([defining SHLLIB to be $SHLLIB])
1947+AC_MSG_NOTICE([defining SHLBIN to be $SHLBIN])
1948+AC_MSG_NOTICE([defining SHLEXT_VER to be $SHLEXT_VER])
1949+AC_MSG_NOTICE([defining SHLLIB_VER to be $SHLLIB_VER])
1950+AC_MSG_NOTICE([defining SHLBIN_VER to be $SHLBIN_VER])
1951+AC_MSG_NOTICE([defining SHLLINKEXT to be $SHLLINKEXT])
1952+AC_MSG_NOTICE([defining LIBPRE to be $LIBPRE])
1953+AC_MSG_NOTICE([defining SHLPRE to be $SHLPRE])
1954+AC_MSG_NOTICE([defining SHLLIBPRE to be $SHLLIBPRE])
1955+AC_MSG_NOTICE([defining SHLBINPRE to be $SHLBINPRE])
1956+AC_MSG_NOTICE([defining SH_LD to be $SH_LD])
1957+AC_MSG_NOTICE([defining SH_LDFLAGS to be $SH_LDFLAGS])
1958+AC_MSG_NOTICE([defining DL_LD to be $DL_LD])
1959+AC_MSG_NOTICE([defining DL_LDFLAGS to be $DL_LDFLAGS])
1960+AC_MSG_NOTICE([defining MKOCTFILE_DL_LDFLAGS to be $MKOCTFILE_DL_LDFLAGS])
1961+AC_MSG_NOTICE([defining SONAME_FLAGS to be $SONAME_FLAGS])
1962+AC_MSG_NOTICE([defining NO_OCT_FILE_STRIP to be $NO_OCT_FILE_STRIP])
1963+AC_MSG_NOTICE([defining TEMPLATE_AR to be $TEMPLATE_AR])
1964+AC_MSG_NOTICE([defining TEMPLATE_ARFLAGS to be $TEMPLATE_ARFLAGS])
1965+AC_MSG_NOTICE([defining CRUFT_DLL_DEFS to be $CRUFT_DLL_DEFS])
1966+AC_MSG_NOTICE([defining OCTAVE_DLL_DEFS to be $OCTAVE_DLL_DEFS])
1967+AC_MSG_NOTICE([defining OCTINTERP_DLL_DEFS to be $OCTINTERP_DLL_DEFS])
1968+AC_MSG_NOTICE([defining OCTGUI_DLL_DEFS to be $OCTGUI_DLL_DEFS])
1969+AC_MSG_NOTICE([defining OCTGRAPHICS_DLL_DEFS to be $OCTGRAPHICS_DLL_DEFS])
1970+AC_MSG_NOTICE([defining library_path_var to be $library_path_var])
1971+AC_SUBST(FPICFLAG)
1972+AC_SUBST(CPICFLAG)
1973+AC_SUBST(CXXPICFLAG)
1974+AC_SUBST(SHLEXT)
1975+AC_SUBST(SHLLIB)
1976+AC_SUBST(SHLBIN)
1977+AC_SUBST(SHLEXT_VER)
1978+AC_SUBST(SHLLIB_VER)
1979+AC_SUBST(SHLBIN_VER)
1980+AC_SUBST(SHLLINKEXT)
1981+AC_SUBST(LIBPRE)
1982+AC_SUBST(SHLPRE)
1983+AC_SUBST(SHLLIBPRE)
1984+AC_SUBST(SHLBINPRE)
1985+AC_SUBST(SH_LD)
1986+AC_SUBST(SH_LDFLAGS)
1987+AC_SUBST(DL_LD)
1988+AC_SUBST(DL_LDFLAGS)
1989+AC_SUBST(MKOCTFILE_DL_LDFLAGS)
1990+AC_SUBST(SONAME_FLAGS)
1991+AC_SUBST(NO_OCT_FILE_STRIP)
1992+AC_SUBST(TEMPLATE_AR)
1993+AC_SUBST(TEMPLATE_ARFLAGS)
1994+AC_SUBST(CRUFT_DLL_DEFS)
1995+AC_SUBST(OCTAVE_DLL_DEFS)
1996+AC_SUBST(OCTINTERP_DLL_DEFS)
1997+AC_SUBST(OCTGUI_DLL_DEFS)
1998+AC_SUBST(OCTGRAPHICS_DLL_DEFS)
1999+AC_SUBST(library_path_var)
2000+AC_SUBST(ldpreloadsep)
2001+
2002+### More configure argument checking related to linking
2003+
2004+AC_ARG_ENABLE([no-undefined],
2005+ [AS_HELP_STRING([--disable-no-undefined],
2006+ [don't pass -no-undefined to libtool when linking Octave and its shared libraries])],
2007+ [case $enableval in
2008+ yes) NO_UNDEFINED_LDFLAG="-no-undefined" ;;
2009+ no) NO_UNDEFINED_LDFLAG="" ;;
2010+ *) AC_MSG_ERROR([bad value $enableval for --disable-no-undefined]) ;;
2011+ esac],
2012+ [NO_UNDEFINED_LDFLAG="-no-undefined"])
2013+AC_SUBST(NO_UNDEFINED_LDFLAG)
2014+
2015+AC_ARG_ENABLE([link-all-dependencies],
2016+ [AS_HELP_STRING([--enable-link-all-dependencies],
2017+ [link Octave and its shared libraries with all dependencies, not just those immediately referenced (should not be needed on most systems)])],
2018+ [case $enableval in
2019+ yes) link_all_deps=yes ;;
2020+ no) link_all_deps=no ;;
2021+ *) AC_MSG_ERROR([bad value $enableval for --enable-link-all-depenencies])
2022+ ;;
2023+ esac],
2024+ [link_all_deps=no])
2025+AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS], [test $link_all_deps = yes])
2026+
2027+## Dynamic linking is now enabled only if we are building shared
2028+## libs and some API for dynamic linking has been detected.
2029+
2030+## FIXME: A lot of the following duplicates the functionality of
2031+## code generated by the dlopen option for LT_INIT.
2032+
2033+LD_CXX='$(CXX)'
2034+RDYNAMIC_FLAG=
2035+DL_API_MSG=""
2036+dlopen_api=no
2037+shl_load_api=no
2038+loadlibrary_api=no
2039+dyld_api=no
2040+
2041+if test $SHARED_LIBS = yes || test $ENABLE_DYNAMIC_LINKING = yes; then
2042+
2043+ case $lt_cv_dlopen in
2044+ dlopen)
2045+ dlopen_api=yes
2046+ DL_API_MSG="(dlopen)"
2047+ AC_DEFINE(HAVE_DLOPEN_API, 1,
2048+ [Define to 1 if your system has dlopen, dlsym, dlerror, and dlclose for dynamic linking.])
2049+ OCTAVE_CXX_FLAG([-rdynamic], [RDYNAMIC_FLAG=-rdynamic])
2050+ ;;
2051+ shl_load)
2052+ shl_load_api=yes
2053+ DL_API_MSG="(shl_load)"
2054+ AC_DEFINE(HAVE_SHL_LOAD_API, 1,
2055+ [Define to 1 if your system has shl_load and shl_findsym for dynamic linking.])
2056+ ;;
2057+ LoadLibrary)
2058+ loadlibrary_api=yes
2059+ DL_API_MSG="(LoadLibrary)"
2060+ AC_DEFINE(HAVE_LOADLIBRARY_API, 1,
2061+ [Define to 1 if your system has LoadLibrary for dynamic linking.])
2062+ ;;
2063+ dyld)
2064+ dyld_api=yes
2065+ DL_API_MSG="(dyld)"
2066+ AC_DEFINE(HAVE_DYLD_API, 1,
2067+ [Define to 1 if your system has dyld for dynamic linking.])
2068+ ;;
2069+ esac
2070+
2071+ DL_LIBS="$lt_cv_dlopen_libs"
2072+ AC_SUBST(DL_LIBS)
2073+
2074+ ## Disable dynamic linking if capability is not present.
2075+ if test $dlopen_api = yes \
2076+ || test $shl_load_api = yes \
2077+ || test $loadlibrary_api = yes \
2078+ || test $dyld_api = yes; then
2079+ # some form of dynamic linking present
2080+ ENABLE_DYNAMIC_LINKING=yes
2081+ else
2082+ ENABLE_DYNAMIC_LINKING=no
2083+ fi
2084+fi
2085+
2086+if test $ENABLE_DYNAMIC_LINKING = yes; then
2087+ AC_DEFINE(ENABLE_DYNAMIC_LINKING, 1, [Define to 1 if using dynamic linking.])
2088+fi
2089+
2090+AM_CONDITIONAL([AMCOND_ENABLE_DYNAMIC_LINKING],
2091+ [test $ENABLE_DYNAMIC_LINKING = yes])
2092+
2093+if test $SHARED_LIBS = yes; then
2094+ LIBOCTINTERP="-loctinterp$SHLLINKEXT"
2095+ LIBOCTAVE="-loctave$SHLLINKEXT"
2096+else
2097+ LIBOCTINTERP='$(top_builddir)/libinterp/liboctinterp.$(LIBEXT)'
2098+ LIBOCTAVE='$(top_builddir)/liboctave/liboctave.$(LIBEXT)'
2099+fi
2100+
2101+AC_SUBST(LD_CXX)
2102+AC_SUBST(RDYNAMIC_FLAG)
2103+AC_SUBST(ENABLE_DYNAMIC_LINKING)
2104+AC_SUBST(LIBOCTINTERP)
2105+AC_SUBST(LIBOCTAVE)
2106+
2107+
2108+if test "$cross_compiling" = yes && test -n "$ac_tool_prefix"; then
2109+ CROSS_TOOL_PREFIX="$ac_tool_prefix"
2110+ MKOCTFILE_AR='$(shell echo $(AR) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2111+ MKOCTFILE_CC='$(shell echo $(CC) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2112+ MKOCTFILE_CXX='$(shell echo $(CXX) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2113+ MKOCTFILE_DL_LD='$(shell echo $(DL_LD) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2114+ MKOCTFILE_F77='$(shell echo $(F77) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2115+ MKOCTFILE_LD_CXX='$(shell echo $(LD_CXX) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2116+ MKOCTFILE_RANLIB='$(shell echo $(RANLIB) | $(SED) "s,$(CROSS_TOOL_PREFIX),,")'
2117+else
2118+ MKOCTFILE_AR="$AR"
2119+ MKOCTFILE_CC="$CC"
2120+ MKOCTFILE_CXX="$CXX"
2121+ MKOCTFILE_DL_LD="$DL_LD"
2122+ MKOCTFILE_F77="$F77"
2123+ MKOCTFILE_LD_CXX="$LD_CXX"
2124+ MKOCTFILE_RANLIB="$RANLIB"
2125+fi
2126+AC_MSG_NOTICE([defining CROSS_TOOL_PREFIX to be $CROSS_TOOL_PREFIX])
2127+AC_MSG_NOTICE([defining MKOCTFILE_AR to be $MKOCTFILE_AR])
2128+AC_MSG_NOTICE([defining MKOCTFILE_CC to be $MKOCTFILE_CC])
2129+AC_MSG_NOTICE([defining MKOCTFILE_CXX to be $MKOCTFILE_CXX])
2130+AC_MSG_NOTICE([defining MKOCTFILE_DL_LD to be $MKOCTFILE_DL_LD])
2131+AC_MSG_NOTICE([defining MKOCTFILE_F77 to be $MKOCTFILE_F77])
2132+AC_MSG_NOTICE([defining MKOCTFILE_LD_CXX to be $MKOCTFILE_LD_CXX])
2133+AC_MSG_NOTICE([defining MKOCTFILE_RANLIB to be $MKOCTFILE_RANLIB])
2134+AC_SUBST(CROSS_TOOL_PREFIX)
2135+AC_SUBST(MKOCTFILE_AR)
2136+AC_SUBST(MKOCTFILE_CC)
2137+AC_SUBST(MKOCTFILE_CXX)
2138+AC_SUBST(MKOCTFILE_DL_LD)
2139+AC_SUBST(MKOCTFILE_F77)
2140+AC_SUBST(MKOCTFILE_LD_CXX)
2141+AC_SUBST(MKOCTFILE_RANLIB)
2142+
2143+### Check for existence of various libraries
2144+
2145+## OS-specific test for dirent, opendir.
2146+case $host_os in
2147+ mingw*)
2148+ if test $have_msvc = yes; then
2149+ AC_CHECK_LIB([dirent], [opendir])
2150+ LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
2151+ else
2152+ LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
2153+ fi
2154+ LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
2155+ ;;
2156+ msdosmsvc)
2157+ AC_CHECK_LIB([dirent], [opendir])
2158+ LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
2159+ ;;
2160+esac
2161+
2162+## Find a termlib to use.
2163+OCTAVE_CHECK_LIB_TERMLIB
2164+
2165+### Checks for header files.
2166+
2167+AC_HEADER_DIRENT
2168+AC_HEADER_SYS_WAIT
2169+
2170+## C headers
2171+
2172+dnl Use multiple AC_CHECKs to avoid line continuations '\' in list
2173+AC_CHECK_HEADERS([curses.h direct.h dlfcn.h floatingpoint.h fpu_control.h])
2174+AC_CHECK_HEADERS([grp.h ieeefp.h inttypes.h locale.h memory.h ncurses.h])
2175+AC_CHECK_HEADERS([poll.h pthread.h pwd.h sunmath.h sys/ioctl.h])
2176+AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/resource.h])
2177+AC_CHECK_HEADERS([sys/select.h termcap.h])
2178+
2179+## C++ headers
2180+
2181+AC_LANG_PUSH(C++)
2182+
2183+AC_CHECK_HEADERS([sstream])
2184+OCTAVE_UNORDERED_MAP_HEADERS
2185+
2186+AC_LANG_POP(C++)
2187+
2188+## Find a termio header to include.
2189+
2190+AC_CHECK_HEADERS([termios.h], have_termios_h=yes, have_termios_h=no)
2191+AC_CHECK_HEADERS([termio.h], have_termio_h=yes, have_termio_h=no)
2192+AC_CHECK_HEADERS([sgtty.h], have_sgtty_h=yes, have_sgtty_h=no)
2193+AC_CHECK_HEADERS([fnmatch.h], have_fnmatch_h=yes, have_fnmatch_h=no)
2194+AC_CHECK_HEADERS([conio.h], have_conio_h=yes, have_conio_h=no)
2195+
2196+if test $have_termios_h != yes \
2197+ && test $have_termio_h != yes \
2198+ && test $have_sgtty_h != yes; then
2199+ AC_MSG_WARN([I couldn't find termios.h, termio.h, or sgtty.h!])
2200+fi
2201+
2202+## For MSVC compilers, avoid #define of min/max from windows.h header
2203+if test $have_msvc = yes; then
2204+ AC_DEFINE(NOMINMAX, 1, [Define to 1 if you want to avoid min/max macro definition in Windows headers.])
2205+fi
2206+
2207+### Determine types and size of types.
2208+
2209+AC_TYPE_INT64_T
2210+AC_TYPE_MODE_T
2211+AC_TYPE_OFF_T
2212+AC_TYPE_PID_T
2213+AC_TYPE_SIZE_T
2214+AC_TYPE_SSIZE_T
2215+AC_TYPE_UID_T
2216+AC_TYPE_UINT64_T
2217+AC_CHECK_TYPES([dev_t, ino_t])
2218+AC_CHECK_TYPES([long long int, unsigned long long int])
2219+AC_CHECK_TYPES([ptrdiff_t])
2220+
2221+## How big are ints and how are they oriented?
2222+## These could probably be eliminated in favor of run-time checks.
2223+
2224+AC_CHECK_SIZEOF([short])
2225+AC_CHECK_SIZEOF([int])
2226+AC_CHECK_SIZEOF([long])
2227+AC_CHECK_SIZEOF([long long])
2228+## Check for long double type (for 64-bit integers)
2229+AC_CHECK_SIZEOF([long double])
2230+
2231+### Check structures and existence of necessary members
2232+
2233+AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks,
2234+ struct stat.st_rdev])
2235+AC_CHECK_MEMBERS([struct group.gr_passwd])
2236+
2237+AC_STRUCT_TIMEZONE
2238+
2239+### Check compiler characteristics.
2240+
2241+## Does compiler have support for new friend template declarations?
2242+OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL
2243+
2244+## Does reinterpret_cast fail for function pointers?
2245+OCTAVE_CXX_BROKEN_REINTERPRET_CAST
2246+
2247+## Check if C++ compiler allows placement delete.
2248+OCTAVE_CXX_PLACEMENT_DELETE
2249+
2250+## Check if C++ compiler can auto allocate variable sized arrays.
2251+OCTAVE_CXX_DYNAMIC_AUTO_ARRAYS
2252+
2253+## Check that C compiler and libraries support IEEE754 data format.
2254+OCTAVE_IEEE754_DATA_FORMAT
2255+
2256+## Is C++ runtime library ISO compliant?
2257+OCTAVE_CXX_ISO_COMPLIANT_LIBRARY
2258+
2259+## Are bit_and, bit_or, and bit_xor defined as templated operators?
2260+OCTAVE_CXX_BITWISE_OP_TEMPLATES
2261+
2262+## Can complex class set components independently?
2263+OCTAVE_CXX_COMPLEX_SETTERS
2264+
2265+## Are there functions to access real/imag parts of numbers via references?
2266+OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS
2267+
2268+## Check if fast integer arithmetics based on bit tricks is available.
2269+OCTAVE_FAST_INT_OPS
2270+
2271+## Does the C compiler handle alloca() and const correctly?
2272+AC_FUNC_ALLOCA
2273+
2274+## Does the C compiler support Automake subdir-objects option?
2275+AM_PROG_CC_C_O
2276+
2277+### gnulib initialization: part 2
2278+### After all include and path modifications have taken place
2279+### and at the same priority level as function checks.
2280+
2281+gl_INIT
2282+
2283+### Checks for functions and variables.
2284+
2285+dnl These checks define/undefine HAVE_FUNCNAME in config.h.
2286+dnl Code tests HAVE_FUNCNAME and either uses function or provides workaround.
2287+dnl Use multiple AC_CHECKs to avoid line continuations '\' in list
2288+AC_CHECK_FUNCS([ctermid dup2])
2289+AC_CHECK_FUNCS([endgrent endpwent execvp expm1 expm1f fork])
2290+AC_CHECK_FUNCS([getegid geteuid getgid getgrent getgrgid getgrnam])
2291+AC_CHECK_FUNCS([getpgrp getpid getppid getpwent getpwuid getuid])
2292+AC_CHECK_FUNCS([isascii kill])
2293+AC_CHECK_FUNCS([lgamma lgammaf lgamma_r lgammaf_r])
2294+AC_CHECK_FUNCS([log1p log1pf pipe])
2295+AC_CHECK_FUNCS([realpath resolvepath roundl])
2296+AC_CHECK_FUNCS([select setgrent setpwent siglongjmp strsignal])
2297+AC_CHECK_FUNCS([tcgetattr tcsetattr tgammaf toascii])
2298+AC_CHECK_FUNCS([umask waitpid])
2299+AC_CHECK_FUNCS([_kbhit])
2300+
2301+dnl There are no workarounds in the code for missing these functions.
2302+AC_CHECK_FUNCS([modf pow sqrt sqrtf], [],
2303+ [AC_MSG_ERROR([Missing function required to build Octave])])
2304+
2305+## exp2, round, tgamma function checks
2306+AC_LANG_PUSH(C++)
2307+AC_CHECK_DECLS([exp2, round, tgamma], [], [], [[#include <cmath>]])
2308+AC_CHECK_FUNCS([exp2 round tgamma])
2309+AH_VERBATIM([Z_FUNCS_AND_DECLS], [
2310+#if defined (__cplusplus)
2311+extern "C" {
2312+#endif
2313+#if HAVE_EXP2 && ! HAVE_DECL_EXP2
2314+double exp2 (double);
2315+#endif
2316+#if HAVE_ROUND && ! HAVE_DECL_ROUND
2317+double round (double);
2318+#endif
2319+#if HAVE_TGAMMA && ! HAVE_DECL_TGAMMA
2320+double tgamma (double);
2321+#endif
2322+#if defined (__cplusplus)
2323+}
2324+#endif
2325+])
2326+AC_LANG_POP(C++)
2327+
2328+## Look in <cmath> for the IEEE functions isnan, isinf, isfinite that we need.
2329+
2330+OCTAVE_CHECK_FUNC_CMATH(isnan)
2331+OCTAVE_CHECK_FUNC_CMATH(isinf)
2332+OCTAVE_CHECK_FUNC_CMATH(isfinite)
2333+OCTAVE_CHECK_FUNC_CMATH(signbit)
2334+
2335+## Check for Inf and NaN functions
2336+
2337+case $canonical_host_type in
2338+ m68k-hp-hpux*)
2339+ ## I am told that Inf and NaN don't work on m68k HP sytems.
2340+ ;;
2341+ *)
2342+ AC_CHECK_FUNCS([finite isnan isinf signbit])
2343+ AC_CHECK_FUNCS([_finite _isnan])
2344+ AC_CHECK_DECLS([signbit], , , [#include <math.h>])
2345+ ;;
2346+esac
2347+
2348+## Check for nonstandard, but common math functions, that we need.
2349+
2350+dnl Use multiple AC_CHECKs to avoid line continuations '\' in list
2351+AC_CHECK_FUNCS([acosh acoshf asinh asinhf atanh atanhf cbrt cbrtf])
2352+AC_CHECK_FUNCS([erf erff erfc erfcf exp2f hypotf _hypotf log2 log2f])
2353+
2354+## Check for math defines such as M_LN2 in math.h
2355+AC_CACHE_CHECK([for MATH DEFINES in math.h],
2356+ [octave_cv_header_math_defines],
2357+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2358+ #include <math.h>
2359+ ]], [[
2360+ double x = M_LN2;]])],
2361+ octave_cv_header_math_defines=yes,
2362+ octave_cv_header_math_defines=no)
2363+ ])
2364+
2365+if test $octave_cv_header_math_defines = no; then
2366+ ## Check again and try defining _USE_MATH_DEFINES
2367+ AC_CACHE_CHECK([whether _USE_MATH_DEFINES needs to be defined],
2368+ [octave_cv_header__use_math_defines],
2369+ [save_CPPFLAGS="$CPPFLAGS"
2370+ CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES"
2371+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2372+ #include <math.h>
2373+ ]], [[
2374+ double x = M_LN2;]])],
2375+ octave_cv_header__use_math_defines=yes,
2376+ octave_cv_header__use_math_defines=no)
2377+ CPPFLAGS="$save_CPPFLAGS"
2378+ ])
2379+ if test $octave_cv_header__use_math_defines = yes; then
2380+ octave_cv_header_math_defines=yes
2381+ AC_DEFINE(_USE_MATH_DEFINES, 1,
2382+ [Define to 1 if _USE_MATH_DEFINES is required to get math constants like M_LN2.])
2383+ CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES"
2384+ fi
2385+fi
2386+
2387+if test $octave_cv_header_math_defines = yes; then
2388+ AC_DEFINE(HAVE_MATH_DEFINES, 1,
2389+ [Define to 1 if defines such as M_PI are available in math.h])
2390+else
2391+ AC_MSG_ERROR([MATH DEFINES in math.h such as M_PI are required to build Octave])
2392+fi
2393+
2394+## Windows-specific tests for extra #defines
2395+case $host_os in
2396+ msdosmsvc | mingw*)
2397+ AC_MSG_CHECKING([for required _WIN32_WINNT])
2398+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2399+ #include <windows.h>
2400+ #if _WIN32_WINNT < 0x0403
2401+ #error "Wrong version"
2402+ #endif
2403+ ]], [])],
2404+ [AC_MSG_RESULT([none])],
2405+ [AC_DEFINE(_WIN32_WINNT, 0x0403,
2406+ [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.])
2407+ AC_MSG_RESULT([0x0403])])
2408+ ;;
2409+esac
2410+
2411+## Windows-specific use of functions
2412+case $host_os in
2413+ msdosmsvc | mingw*)
2414+ AC_CHECK_FUNCS([setvbuf], [],
2415+ [AC_MSG_ERROR([Missing function required to build Octave])])
2416+ ;;
2417+esac
2418+
2419+## Cygwin kluge for getrusage.
2420+AC_CHECK_FUNCS([getrusage])
2421+case $host_os in
2422+ cygwin*)
2423+ AC_DEFINE(RUSAGE_TIMES_ONLY, 1,
2424+ [Define to 1 if your struct rusage only has time information.])
2425+ ;;
2426+esac
2427+
2428+## Check for CGDisplayBitsPerPixel function on Mac OSX systems with Carbon
2429+if test $have_framework_carbon = yes; then
2430+ OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL
2431+fi
2432+
2433+AC_CHECK_FUNCS([getpwnam], [], [AC_CHECK_LIB([sun], [getpwnam])])
2434+
2435+AC_FUNC_CLOSEDIR_VOID
2436+
2437+## Check return type of matherr()
2438+AC_CACHE_CHECK([for struct exception in math.h],
2439+ [octave_cv_func_matherr_type],
2440+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2441+ #include <math.h>
2442+ ]], [[
2443+ struct exception *x;
2444+ x->type;
2445+ x->name;
2446+ ]])],
2447+ octave_cv_func_matherr_type=yes,
2448+ octave_cv_func_matherr_type=no)
2449+ ])
2450+if test $octave_cv_func_matherr_type = yes; then
2451+ AC_DEFINE(EXCEPTION_IN_MATH, 1,
2452+ [Define to 1 if math.h declares struct exception for matherr().])
2453+fi
2454+
2455+## Signal stuff.
2456+
2457+AC_CHECK_DECLS([sys_siglist], [], [],
2458+[[#include <signal.h>
2459+/* NetBSD declares sys_siglist in unistd.h. */
2460+#if HAVE_UNISTD_H
2461+# include <unistd.h>
2462+#endif
2463+]])
2464+
2465+### Need to disable building documentation if either gnuplot or
2466+### makeinfo are missing. Skip this warning if building docs was
2467+### disabled with a configure option.
2468+
2469+if test -n "$DOCDIR"; then
2470+ if test -n "$warn_gnuplot"; then
2471+ DOCDIR=
2472+ warn_docs_gnuplot="building documentation disabled because gnuplot was not found; make dist will fail"
2473+ OCTAVE_CONFIGURE_WARNING([warn_docs_gnuplot])
2474+ fi
2475+ if test -n "$warn_makeinfo"; then
2476+ DOCDIR=
2477+ warn_docs_makeinfo="building documentation disabled because makeinfo was not found; make dist will fail"
2478+ OCTAVE_CONFIGURE_WARNING([warn_docs_makeinfo])
2479+ fi
2480+fi
2481+AM_CONDITIONAL([AMCOND_BUILD_DOCS], [test -n "$DOCDIR"])
2482+
2483+### Maybe add -Wall, -W, and -Wshadow to compiler flags now that we're
2484+### done feature testing.
2485+
2486+GCC_EXTRA_FLAGS="-Wall -W -Wshadow -Wformat -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wcast-align -Wcast-qual"
2487+
2488+GXX_EXTRA_FLAGS="-Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual"
2489+
2490+try_extra_warning_flags=yes
2491+
2492+AC_ARG_ENABLE([extra-warning-flags],
2493+ [AS_HELP_STRING([--disable-extra-warning-flags],
2494+ [don't add -Wall, -W, -Wshadow, and -Wold-style-cast options to CFLAGS and CXXFLAGS])],
2495+ [if test "$enableval" = no; then
2496+ try_extra_warning_flags=no
2497+ fi],
2498+ [])
2499+
2500+if test $try_extra_warning_flags = yes; then
2501+ for flag in $GCC_EXTRA_FLAGS; do
2502+ OCTAVE_CC_FLAG([$flag], [
2503+ WARN_CFLAGS="$WARN_CFLAGS $flag";
2504+ AC_MSG_RESULT([adding $flag to WARN_CFLAGS])])
2505+ done
2506+ for flag in $GXX_EXTRA_FLAGS; do
2507+ OCTAVE_CXX_FLAG([$flag], [
2508+ WARN_CXXFLAGS="$WARN_CXXFLAGS $flag";
2509+ AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])])
2510+ done
2511+fi
2512+
2513+GCC_STRICT_FLAGS="-Wconversion"
2514+
2515+GXX_STRICT_FLAGS="-Wconversion -Weffc++"
2516+
2517+try_strict_warning_flags=no
2518+
2519+AC_ARG_ENABLE([strict-warning-flags],
2520+ [AS_HELP_STRING([--enable-strict-warning-flags],
2521+ [add extra strict warning options to CFLAGS and CXXFLAGS])],
2522+ [if test "$enableval" = yes; then
2523+ try_strict_warning_flags=yes
2524+ fi],
2525+ [])
2526+
2527+if test $try_strict_warning_flags = yes; then
2528+ for flag in $GCC_STRICT_FLAGS; do
2529+ OCTAVE_CC_FLAG([$flag], [
2530+ WARN_CFLAGS="$WARN_CFLAGS $flag";
2531+ AC_MSG_RESULT([adding $flag to WARN_CFLAGS])])
2532+ done
2533+ for flag in $GXX_STRICT_FLAGS; do
2534+ OCTAVE_CXX_FLAG([$flag], [
2535+ WARN_CXXFLAGS="$WARN_CXXFLAGS $flag";
2536+ AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])])
2537+ done
2538+fi
2539+
2540+AC_SUBST(WARN_CFLAGS)
2541+AC_SUBST(WARN_CXXFLAGS)
2542+
2543+### Check for Java.
2544+
2545+build_java=yes
2546+AC_ARG_ENABLE([java],
2547+ [AS_HELP_STRING([--disable-java],
2548+ [disable Java interface])],
2549+ [if test "$enableval" = no; then
2550+ build_java=no
2551+ fi],
2552+ [])
2553+
2554+AC_ARG_WITH([java-homedir],
2555+ [AS_HELP_STRING([--with-java-homedir=DIR],
2556+ [Java JDK directory in DIR])],
2557+ [JAVA_HOMEDIR="$withval"])
2558+
2559+AC_ARG_WITH([java-includedir],
2560+ [AS_HELP_STRING([--with-java-includedir=DIR],
2561+ [look for java include file <jni.h> in DIR])],
2562+ [JAVA_CPPFLAGS="$withval"], [JAVA_CPPFLAGS=""])
2563+
2564+AC_ARG_WITH([java-libdir],
2565+ [AS_HELP_STRING([--with-java-libdir=DIR],
2566+ [look for java library libjvm in DIR])],
2567+ [JAVA_LDPATH="$withval"], [JAVA_LDPATH=""])
2568+
2569+## Grab JAVA_HOME from environment variable if it exists
2570+AC_ARG_VAR([JAVA_HOME], [path to Java JDK installation])
2571+## But --with-java-homedir option overrides environment variable
2572+if test -n "$JAVA_HOMEDIR"; then
2573+ JAVA_HOME=$JAVA_HOMEDIR
2574+fi
2575+JAVA=
2576+JAVAC=
2577+JAR=
2578+JAVA_LIBS=
2579+
2580+## Fake loop so that "break" can be used to skip code blocks.
2581+warn_java=""
2582+while test $build_java = yes
2583+do
2584+ ## Unset build_java. Variable is set only if all configuration tests pass.
2585+ build_java=no
2586+
2587+ ## Warn if JAVA_HOME is unset. It is *strongly* advised to specify JAVA_HOME.
2588+ if test -z "$JAVA_HOME"; then
2589+ warn_java_home="JAVA_HOME environment variable not initialized. Auto-detection will proceed but is unreliable."
2590+ OCTAVE_CONFIGURE_WARNING([warn_java_home])
2591+ fi
2592+
2593+ ## Search for a viable Java executable.
2594+ if test -z "$JAVA_HOME"; then
2595+ JAVA_PATH="$PATH"
2596+ else
2597+ JAVA_PATH="${JAVA_HOME}$PATH_SEPARATOR${JAVA_HOME}/jre/bin$PATH_SEPARATOR${JAVA_HOME}/bin$PATH_SEPARATOR${JAVA_HOME}/../bin$PATH_SEPARATOR${PATH}"
2598+ fi
2599+ AC_PATH_PROG(JAVA, java, [], [$JAVA_PATH])
2600+
2601+ if test -z "$JAVA"; then
2602+ warn_java="No Java executable found. Octave will not be able to call Java methods."
2603+ break
2604+ fi
2605+
2606+ if test -z "$JAVA_HOME"; then
2607+ ## Find JAVA_HOME for JRE by running java and querying properties.
2608+ JAVA_TMP_HOME=`"$JAVA" -classpath ${srcdir}/build-aux OctJavaQry JAVA_HOME`
2609+ ## Strip directory back to top-level installation dir (JAVA_HOME for JDK).
2610+ JAVA_HOME=`echo $JAVA_TMP_HOME | $SED -e 's|[[/\\]]bin[[/\\]]\?$||' | $SED -e 's|[[/\\]]jre[[/\\]]\?$||'`
2611+ fi
2612+
2613+ case $build_os in
2614+ mingw* | msdosmsvc)
2615+ ## Under Win32 platform, we want JAVA_HOME to be in MSYS format, that is
2616+ ## without colon and backslashes, as it is also used as path separator.
2617+ ## Use quoted paths as Java may be installed in a path with whitespaces
2618+ ## (e.g. C:\Program Files\Java\...).
2619+ if test -n "$JAVA_HOME"; then
2620+ JAVA_HOME=`cd "$JAVA_HOME" && pwd`
2621+ fi
2622+ ;;
2623+ esac
2624+
2625+ ## Amend search path for JAVAC and JAR.
2626+ if test -z "$JAVA_HOME"; then
2627+ JAVA_PATH="$PATH"
2628+ else
2629+ JAVA_PATH="${JAVA_HOME}$PATH_SEPARATOR${JAVA_HOME}/bin$PATH_SEPARATOR${JAVA_HOME}/../bin$PATH_SEPARATOR${PATH}"
2630+ fi
2631+
2632+ AC_PATH_PROG(JAVAC, javac, [], [$JAVA_PATH])
2633+ AC_PATH_PROG(JAR, jar, [], [$JAVA_PATH])
2634+
2635+ if test -z "$JAVAC" || test -z "$JAR"; then
2636+ warn_java="No javac compiler or jar executable found. Octave will not be able to call Java methods."
2637+ break
2638+ fi
2639+
2640+ ## Check Java version is recent enough.
2641+ AC_MSG_CHECKING([for Java version])
2642+ java_version=[`"$JAVA" -version 2>&1 | $SED -n -e 's/^[^ ]* version[^0-9"]*"\([^"]*\)"/\1/p'`]
2643+ AC_MSG_RESULT([$java_version])
2644+ java_major=[`echo $java_version | $SED -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*$/\1/'`]
2645+ java_minor=[`echo $java_version | $SED -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*$/\2/'`]
2646+ if test $java_major -ge 1 && test $java_minor -ge 5; then
2647+ : # Version is ok. Do nothing.
2648+ else
2649+ warn_java="Java version is too old (< 1.5). Octave will not be able to call Java methods."
2650+ break
2651+ fi
2652+
2653+ ## At this point Win32 systems have enough configuration data.
2654+ ## We assume that all appropriate variables (e.g. INCLUDE and LIB) already
2655+ ## contain the required paths to compile and link against JDK.
2656+ case $host_os in
2657+ msdosmsvc)
2658+ build_java=yes
2659+ JAVA_LIBS=-ladvapi32
2660+ AC_DEFINE(HAVE_JAVA, 1,
2661+ [Define to 1 if Java is available and is at least version 1.5])
2662+ break
2663+ ;;
2664+ mingw* | cygwin*)
2665+ build_java=yes
2666+ JAVA_LIBS=-ladvapi32
2667+ if test $have_msvc = no; then
2668+ if test -n "$JAVA_CPPFLAGS"; then
2669+ JAVA_CPPFLAGS="-I\"${JAVA_CPPFLAGS}\" -I\"${JAVA_CPPFLAGS}/win32\""
2670+ else
2671+ JAVA_CPPFLAGS="-I\"${JAVA_HOME}/include\" -I\"${JAVA_HOME}/include/win32\""
2672+ fi
2673+ LDFLAGS="$LDFLAGS -Wl,--export-all-symbols"
2674+ fi
2675+ AC_DEFINE(HAVE_JAVA, 1,
2676+ [Define to 1 if Java is available and is at least version 1.5])
2677+ break
2678+ ;;
2679+ esac
2680+
2681+ ## Determine which library file name to search for.
2682+ case $host_os in
2683+ darwin*)
2684+ jvmlib=libjvm.dylib
2685+ ;;
2686+ *)
2687+ jvmlib=libjvm.so
2688+ ;;
2689+ esac
2690+
2691+ AC_MSG_CHECKING([for $jvmlib])
2692+
2693+ if test -z "$JAVA_LDPATH"; then
2694+ ## Run Java to try and determine library path to libjvm.so.
2695+ JAVA_TMP_LDPATH=`$JAVA -classpath ${srcdir}/build-aux OctJavaQry JAVA_LDPATH`
2696+ JAVA_TMP_LDPATH=`echo $JAVA_TMP_LDPATH | $SED -e "s/${PATH_SEPARATOR}/ /g"`
2697+ for dir in $JAVA_TMP_LDPATH; do
2698+ if test -f "$dir/$jvmlib"; then
2699+ JAVA_LDPATH=$dir
2700+ break
2701+ fi
2702+ done
2703+ fi
2704+
2705+ if test -z "$JAVA_LDPATH"; then
2706+ ## Nothing found. Try Java again using bootpath argument.
2707+ JAVA_TMP_LDPATH=`$JAVA -classpath ${srcdir}/build-aux OctJavaQry JAVA_BOOTPATH`
2708+ JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_TMP_LDPATH}/client ${JAVA_TMP_LDPATH}/server"
2709+ for dir in $JAVA_TMP_LDPATH; do
2710+ if test -f "$dir/$jvmlib"; then
2711+ JAVA_LDPATH=$dir
2712+ break
2713+ fi
2714+ done
2715+ fi
2716+
2717+ if test -z "$JAVA_LDPATH"; then
2718+ ## Java failed to find it's own library path. Guess wildly.
2719+ JAVA_TMP_LDPATH=`ls -d $JAVA_HOME/jre/lib/*/client`
2720+ JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} `ls -d $JAVA_HOME/jre/lib/*/server`"
2721+ ## Add some paths that might work on Macs.
2722+ JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_HOME}/../Libraries ${JAVA_HOME}/Libraries"
2723+ ## Add some paths that might work on MinGW
2724+ JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_HOME}/bin/client ${JAVA_HOME}/bin/server"
2725+ for dir in $JAVA_TMP_LDPATH; do
2726+ if test -f "$dir/$jvmlib"; then
2727+ JAVA_LDPATH=$dir
2728+ break
2729+ fi
2730+ done
2731+ fi
2732+
2733+ ## Verify value passed in option --with-java-libdir
2734+ if test -n "$JAVA_LDPATH"; then
2735+ if test -f "${JAVA_LDPATH}/$jvmlib"; then
2736+ : # libjvm found
2737+ else
2738+ JAVA_LDPATH=""
2739+ fi
2740+ fi
2741+
2742+ if test -z "$JAVA_LDPATH"; then
2743+ AC_MSG_RESULT([not found])
2744+ warn_java="Library $jvmlib not found. Octave will not be able to call Java methods."
2745+ break
2746+ else
2747+ AC_MSG_RESULT([$JAVA_LDPATH])
2748+ fi
2749+
2750+ AC_MSG_CHECKING([for include file <jni.h>])
2751+
2752+ ## Java and JVM found. Set up flags.
2753+ case $host_os in
2754+ darwin*)
2755+ ## Sneak the -framework flag into mkoctfile via LDFLAGS
2756+ LDFLAGS="$LDFLAGS -framework JavaVM"
2757+ ## According to: http://developer.apple.com/unix/crossplatform.html
2758+ ## one must explicitly set the include path.
2759+ ## Unfortunately, the include path keeps moving around.
2760+ if test -n "$JAVA_CPPFLAGS"; then
2761+ JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS}"
2762+ else
2763+ 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"
2764+ fi
2765+ JAVA_LIBS="-framework JavaVM"
2766+ ;;
2767+ *)
2768+ if test -n "$JAVA_CPPFLAGS"; then
2769+ JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS} -I${JAVA_CPPFLAGS}/linux"
2770+ else
2771+ JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux"
2772+ fi
2773+ ;;
2774+ esac
2775+
2776+ ## Verify jni.h include file exists.
2777+ JNI_PATH=`echo $JAVA_CPPFLAGS | $SED -e 's/-I//g'`
2778+ have_jni=no
2779+ for dir in $JNI_PATH; do
2780+ if test -f "${dir}/jni.h"; then have_jni=yes; break; fi
2781+ done
2782+ if test $have_jni = yes; then
2783+ AC_MSG_RESULT([$dir])
2784+ else
2785+ AC_MSG_RESULT([not found])
2786+ warn_java="Include file <jni.h> not found. Octave will not be able to call Java methods."
2787+ break
2788+ fi
2789+
2790+ ## Passed all configuration tests. A workable Java installation was found.
2791+ build_java=yes
2792+ AC_DEFINE(HAVE_JAVA, 1,
2793+ [Define to 1 if Java is available and is at least version 1.5])
2794+ break
2795+done
2796+if test -n "$warn_java"; then
2797+ OCTAVE_CONFIGURE_WARNING([warn_java])
2798+fi
2799+
2800+AM_CONDITIONAL([AMCOND_HAVE_JAVA], [test $build_java = yes])
2801+AC_SUBST(JAVA)
2802+AC_SUBST(JAVAC)
2803+AC_SUBST(JAR)
2804+AC_SUBST(JAVA_CPPFLAGS)
2805+AC_SUBST(JAVA_LIBS)
2806+AC_DEFINE_UNQUOTED([JAVA_HOME], ["$JAVA_HOME"], [Java home (top-level installation dir)])
2807+AC_DEFINE_UNQUOTED([JAVA_LDPATH], ["$JAVA_LDPATH"], [Java library path (libjvm)])
2808+
2809+### GUI/Qt related tests.
2810+
2811+QT_CPPFLAGS=
2812+QT_LDFLAGS=
2813+QT_LIBS=
2814+win32_terminal=no
2815+build_gui=yes
2816+AC_ARG_ENABLE([gui],
2817+ [AS_HELP_STRING([--disable-gui], [don't build the GUI])],
2818+ [if test "$enableval" = no; then build_gui=no; fi], [])
2819+
2820+if test -z "$OPENGL_LIBS"; then
2821+ build_gui=no
2822+ if test $check_opengl = yes; then
2823+ warn_gui="OpenGL libs (GL and GLU) not found -- disabling GUI"
2824+ else
2825+ warn_gui="--without-opengl was specified -- disabling GUI"
2826+ fi
2827+ OCTAVE_CONFIGURE_WARNING([warn_gui])
2828+fi
2829+
2830+if test $build_gui = yes; then
2831+
2832+ warn_gui=""
2833+ ## Check for Qt libraries
2834+ QT_MODULES="QtCore QtGui QtNetwork QtOpenGL"
2835+ PKG_CHECK_MODULES(QT, [$QT_MODULES],
2836+ [],
2837+ [warn_gui="Qt libraries not found -- disabling GUI"
2838+ build_gui=no])
2839+
2840+ if test $build_gui = yes; then
2841+ ## Retrieve Qt compilation and linker flags
2842+ QT_CPPFLAGS="`$PKG_CONFIG --cflags-only-I $QT_MODULES`"
2843+ QT_LDFLAGS="`$PKG_CONFIG --libs-only-L $QT_MODULES`"
2844+ QT_LIBS="`$PKG_CONFIG --libs-only-l $QT_MODULES`"
2845+
2846+ case $host_os in
2847+ *darwin*)
2848+ ## Qt might be installed in framework
2849+ if test -z "$QT_LIBS"; then
2850+ QT_LDFLAGS="`$PKG_CONFIG --libs-only-other $QT_MODULES | tr ' ' '\n' | $GREP -e '-F' | uniq | tr '\n' ' '`"
2851+ QT_LIBS="`$PKG_CONFIG --libs-only-other $QT_MODULES | tr ' ' '\n' | $GREP -v -e '-F' | uniq | tr '\n' ' '`"
2852+ ## Enabling link_all_deps works around libtool's imperfect handling
2853+ ## of the -F flag
2854+ AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS],
2855+ [test $link_all_deps = yes || test -n "$QT_LDFLAGS"])
2856+ fi
2857+ ;;
2858+ esac
2859+
2860+ ## Check for Qt4
2861+ if ! `$PKG_CONFIG --atleast-version=4.0.0 QtCore`; then
2862+ warn_gui="Qt >= 4.0.0 not found -- disabling GUI"
2863+ build_gui=no
2864+ fi
2865+ fi
2866+
2867+ if test $build_gui = yes; then
2868+ AC_CHECK_TOOLS(MOC, [moc-qt4 moc])
2869+ AC_CHECK_TOOLS(UIC, [uic-qt4 uic])
2870+ AC_CHECK_TOOLS(RCC, [rcc-qt4 rcc])
2871+ AC_CHECK_TOOLS(LRELEASE, [lrelease-qt4 lrelease])
2872+ if test -n "$MOC" && test -n "$UIC" && test -n "$RCC" && test -n "$LRELEASE"; then
2873+ AC_DEFINE(HAVE_QT, 1,
2874+ [Define to 1 if Qt is available (libraries, developer header files, utility programs (moc, uic, rcc, and lrelease))])
2875+ else
2876+ warn_gui="Qt utility programs moc, uic, rcc, and lrelease not found -- disabling GUI"
2877+ build_gui=no
2878+ fi
2879+ fi
2880+
2881+ if test $build_gui = yes; then
2882+ OCTAVE_CHECK_FUNC_QABSTRACTITEMMODEL_BEGINRESETMODEL
2883+ if test $octave_cv_func_qabstractitemmodel_beginresetmodel = no; then
2884+ warn_gui="QAbstractItemModel::beginResetModel() not found -- disabling GUI"
2885+ build_gui=no
2886+ fi
2887+ fi
2888+
2889+ if test $build_gui = yes; then
2890+ OCTAVE_CHECK_QFONT_MONOSPACE
2891+ OCTAVE_CHECK_QFONT_FORCE_INTEGER_METRICS
2892+ OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT
2893+ OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE
2894+ OCTAVE_CHECK_FUNC_QSCI_FINDSELECTION
2895+ fi
2896+
2897+ if test $build_gui = yes; then
2898+ ## Check for Qscintilla library which is used in the GUI editor.
2899+ AC_CACHE_CHECK([whether Qscintilla library is installed],
2900+ [octave_cv_lib_qscintilla],
2901+ [save_CPPFLAGS="$CPPFLAGS"
2902+ save_LDFLAGS="$LDFLAGS"
2903+ save_LIBS="$LIBS"
2904+ CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
2905+ LDFLAGS="$QT_LDFLAGS $LDFLAGS"
2906+ LIBS="$QT_LIBS -lqscintilla2"
2907+ AC_LANG_PUSH(C++)
2908+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2909+ #include <Qsci/qscilexersql.h>
2910+ ]], [[
2911+ QsciLexerSQL sqlLexer(0);
2912+ ]])],
2913+ octave_cv_lib_qscintilla=yes,
2914+ octave_cv_lib_qscintilla=no)
2915+ CPPFLAGS="$save_CPPFLAGS"
2916+ LDFLAGS="$save_LDFLAGS"
2917+ LIBS="$save_LIBS"
2918+ AC_LANG_POP([C++])
2919+ ])
2920+ if test $octave_cv_lib_qscintilla = no; then
2921+ warn_gui_editor="Qscintilla library not found -- disabling built-in GUI editor"
2922+ OCTAVE_CONFIGURE_WARNING([warn_gui_editor])
2923+ else
2924+ ## Let's assume Qscintilla library is at the same location as
2925+ ## other regular Qt libraries.
2926+ QT_LIBS="$QT_LIBS -lqscintilla2"
2927+ OCTAVE_CHECK_VERSION_2_6_0
2928+ AC_DEFINE(HAVE_QSCINTILLA, 1,
2929+ [Define to 1 if the QScintilla library and header files are available])
2930+
2931+ save_CPPFLAGS="$CPPFLAGS"
2932+ CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
2933+ AC_LANG_PUSH(C++)
2934+ AC_CHECK_HEADERS([Qsci/qscilexeroctave.h Qsci/qscilexermatlab.h])
2935+ AC_LANG_POP(C++)
2936+ CPPFLAGS="$save_CPPFLAGS"
2937+ fi
2938+
2939+ AC_CHECK_FUNCS([setlocale], [],
2940+ [warn_gui="setlocale not found -- disabling GUI"
2941+ build_gui=no])
2942+
2943+ if test $build_gui = yes; then
2944+ case $host_os in
2945+ mingw* | msdosmsvc*)
2946+ AC_CHECK_FUNCS([setvbuf], [win32_terminal=yes],
2947+ [warn_gui="setvbuf not found -- disabling GUI"
2948+ build_gui=no])
2949+ ;;
2950+ *)
2951+ AC_CHECK_HEADERS([pty.h libutil.h util.h])
2952+ AC_SEARCH_LIBS([openpty], [util],
2953+ [AC_DEFINE(HAVE_OPENPTY, [], [Define whether openpty exists])])
2954+ AC_CHECK_FUNCS([chmod chown ftruncate mmap munmap], [],
2955+ [AC_MSG_ERROR([At least one of chmod, chown, ftruncate, mmap, and munmap not found -- disabling GUI])
2956+ build_gui=no])
2957+ ;;
2958+ esac
2959+ fi
2960+ fi
2961+
2962+ if test -n "$warn_gui"; then
2963+ OCTAVE_CONFIGURE_WARNING([warn_gui])
2964+ fi
2965+fi
2966+
2967+AM_CONDITIONAL([AMCOND_BUILD_GUI], [test $build_gui = yes])
2968+AM_CONDITIONAL([AMCOND_HAVE_QSCINTILLA],
2969+ [test "$octave_cv_lib_qscintilla" = yes])
2970+AM_CONDITIONAL([WIN32_TERMINAL], [test $win32_terminal = yes])
2971+AC_SUBST(QT_CPPFLAGS)
2972+AC_SUBST(QT_LDFLAGS)
2973+AC_SUBST(QT_LIBS)
2974+
2975+# do we want to create cross-mkoctfile etc ?
2976+cross_tools=no
2977+AC_ARG_ENABLE([cross-tools],
2978+ [AS_HELP_STRING([--enable-cross-tools],
2979+ [build cross tools (mkoctfile, octave-config) if cross compiling])],
2980+ [if test "$enableval" = yes; then cross_tools=yes; fi])
2981+
2982+if test "$cross_tools" = yes; then
2983+ if test "$cross_compiling" = no; then
2984+ AC_MSG_WARN([ignoring --enable-cross-tools when not cross compiling])
2985+ cross_tools=no
2986+ fi
2987+fi
2988+AM_CONDITIONAL([AMCOND_CROSS_TOOLS], [test $cross_tools = yes])
2989+
2990+
2991+### Decide whether or not to install build logs with Octave.
2992+
2993+install_build_logs=no
2994+AC_ARG_ENABLE([install-build-logs],
2995+ [AS_HELP_STRING([--enable-install-build-logs],
2996+ [install build logs (e.g. config.log) with Octave])],
2997+ [if test "$enableval" = yes; then install_build_logs=yes; fi])
2998+AM_CONDITIONAL([AMCOND_INSTALL_BUILD_LOGS], [test $install_build_logs = yes])
2999+
3000+CFLAGS="$original_octave_configure_CFLAGS"
3001+CXXFLAGS="$original_octave_configure_CXXFLAGS"
3002+
3003+AH_BOTTOM([#include "oct-conf-post.h"])
3004+
3005+### Make all AC_DEFINES available to testif feature of test.m function.
3006+### This must reside at the bottom of configure.ac after all AC_DEFINES
3007+### have been made.
3008+
3009+AC_OUTPUT_MAKE_DEFS
3010+
3011+### Do the substitutions in all the Makefiles.
3012+
3013+AC_SUBST(ac_config_files)
3014+AC_SUBST(ac_config_headers)
3015+
3016+AC_CONFIG_FILES([
3017+ oct-conf-post.h:oct-conf-post.in.h
3018+ Makefile
3019+ doc/Makefile
3020+ doc/doxyhtml/Makefile
3021+ doc/doxyhtml/Doxyfile
3022+ doc/interpreter/Makefile
3023+ doc/liboctave/Makefile
3024+ doc/refcard/Makefile
3025+ etc/icons/Makefile
3026+ examples/Makefile
3027+ examples/code/Makefile
3028+ examples/data/Makefile
3029+ libgnu/Makefile
3030+ libgui/Makefile
3031+ libinterp/Makefile
3032+ liboctave/Makefile
3033+ liboctave/cruft/mkf77def
3034+ scripts/Makefile
3035+ src/Makefile
3036+ test/Makefile])
3037+
3038+AC_OUTPUT
3039+
3040+### Print a summary so that important information isn't missed.
3041+
3042+AC_MSG_NOTICE([
3043+
3044+Octave is now configured for $canonical_host_type
3045+
3046+ Source directory: $srcdir
3047+ Installation prefix: $prefix
3048+ C compiler: $CC $XTRA_CFLAGS $WARN_CFLAGS $CFLAGS
3049+ C++ compiler: $CXX $XTRA_CXXFLAGS $WARN_CXXFLAGS $CXXFLAGS
3050+ Fortran compiler: $F77 $FFLAGS
3051+ Fortran libraries: $FLIBS
3052+ Lex libraries: $LEXLIB
3053+ LIBS: $LIBS
3054+
3055+ AMD CPPFLAGS: $AMD_CPPFLAGS
3056+ AMD LDFLAGS: $AMD_LDFLAGS
3057+ AMD libraries: $AMD_LIBS
3058+ ARPACK CPPFLAGS: $ARPACK_CPPFLAGS
3059+ ARPACK LDFLAGS: $ARPACK_LDFLAGS
3060+ ARPACK libraries: $ARPACK_LIBS
3061+ BLAS libraries: $BLAS_LIBS
3062+ CAMD CPPFLAGS: $CAMD_CPPFLAGS
3063+ CAMD LDFLAGS: $CAMD_LDFLAGS
3064+ CAMD libraries: $CAMD_LIBS
3065+ CARBON libraries: $CARBON_LIBS
3066+ CCOLAMD CPPFLAGS: $CCOLAMD_CPPFLAGS
3067+ CCOLAMD LDFLAGS: $CCOLAMD_LDFLAGS
3068+ CCOLAMD libraries: $CCOLAMD_LIBS
3069+ CHOLMOD CPPFLAGS: $CHOLMOD_CPPFLAGS
3070+ CHOLMOD LDFLAGS: $CHOLMOD_LDFLAGS
3071+ CHOLMOD libraries: $CHOLMOD_LIBS
3072+ COLAMD CPPFLAGS: $COLAMD_CPPFLAGS
3073+ COLAMD LDFLAGS: $COLAMD_LDFLAGS
3074+ COLAMD libraries: $COLAMD_LIBS
3075+ CURL CPPFLAGS: $CURL_CPPFLAGS
3076+ CURL LDFLAGS: $CURL_LDFLAGS
3077+ CURL libraries: $CURL_LIBS
3078+ CXSPARSE CPPFLAGS: $CXSPARSE_CPPFLAGS
3079+ CXSPARSE LDFLAGS: $CXSPARSE_LDFLAGS
3080+ CXSPARSE libraries: $CXSPARSE_LIBS
3081+ DL libraries: $DL_LIBS
3082+ FFTW3 CPPFLAGS: $FFTW3_CPPFLAGS
3083+ FFTW3 LDFLAGS: $FFTW3_LDFLAGS
3084+ FFTW3 libraries: $FFTW3_LIBS
3085+ FFTW3F CPPFLAGS: $FFTW3F_CPPFLAGS
3086+ FFTW3F LDFLAGS: $FFTW3F_LDFLAGS
3087+ FFTW3F libraries: $FFTW3F_LIBS
3088+ FLTK CPPFLAGS: $FLTK_CPPFLAGS
3089+ FLTK LDFLAGS: $FLTK_LDFLAGS
3090+ FLTK libraries: $FLTK_LIBS
3091+ fontconfig CPPFLAGS: $FONTCONFIG_CPPFLAGS
3092+ fontconfig libraries: $FONTCONFIG_LIBS
3093+ FreeType2 CPPFLAGS: $FT2_CPPFLAGS
3094+ FreeType2 libraries: $FT2_LIBS
3095+ GLPK CPPFLAGS: $GLPK_CPPFLAGS
3096+ GLPK LDFLAGS: $GLPK_LDFLAGS
3097+ GLPK libraries: $GLPK_LIBS
3098+ HDF5 CPPFLAGS: $HDF5_CPPFLAGS
3099+ HDF5 LDFLAGS: $HDF5_LDFLAGS
3100+ HDF5 libraries: $HDF5_LIBS
3101+ Java home: $JAVA_HOME
3102+ Java JVM path: $JAVA_LDPATH
3103+ Java CPPFLAGS: $JAVA_CPPFLAGS
3104+ Java libraries: $JAVA_LIBS
3105+ LAPACK libraries: $LAPACK_LIBS
3106+ LLVM CPPFLAGS: $LLVM_CPPFLAGS
3107+ LLVM LDFLAGS: $LLVM_LDFLAGS
3108+ LLVM libraries: $LLVM_LIBS
3109+ Magick++ CPPFLAGS: $MAGICK_CPPFLAGS
3110+ Magick++ LDFLAGS: $MAGICK_LDFLAGS
3111+ Magick++ libraries: $MAGICK_LIBS
3112+ OPENGL libraries: $OPENGL_LIBS
3113+ OSMesa CPPFLAGS: $OSMESA_CPPFLAGS
3114+ OSMesa LDFLAGS: $OSMESA_LDFLAGS
3115+ OSMesa libraries: $OSMESA_LIBS
3116+ PCRE CPPFLAGS: $PCRE_CPPFLAGS
3117+ PCRE libraries: $PCRE_LIBS
3118+ PortAudio CPPFLAGS: $PORTAUDIO_CPPFLAGS
3119+ PortAudio LDFLAGS: $PORTAUDIO_LDFLAGS
3120+ PortAudio libraries: $PORTAUDIO_LIBS
3121+ PTHREAD flags: $PTHREAD_CFLAGS
3122+ PTHREAD libraries: $PTHREAD_LIBS
3123+ QHULL CPPFLAGS: $QHULL_CPPFLAGS
3124+ QHULL LDFLAGS: $QHULL_LDFLAGS
3125+ QHULL libraries: $QHULL_LIBS
3126+ QRUPDATE CPPFLAGS: $QRUPDATE_CPPFLAGS
3127+ QRUPDATE LDFLAGS: $QRUPDATE_LDFLAGS
3128+ QRUPDATE libraries: $QRUPDATE_LIBS
3129+ Qt CPPFLAGS: $QT_CPPFLAGS
3130+ Qt LDFLAGS: $QT_LDFLAGS
3131+ Qt libraries: $QT_LIBS
3132+ READLINE libraries: $READLINE_LIBS
3133+ Sndfile CPPFLAGS: $SNDFILE_CPPFLAGS
3134+ Sndfile LDFLAGS: $SNDFILE_LDFLAGS
3135+ Sndfile libraries: $SNDFILE_LIBS
3136+ TERM libraries: $TERM_LIBS
3137+ UMFPACK CPPFLAGS: $UMFPACK_CPPFLAGS
3138+ UMFPACK LDFLAGS: $UMFPACK_LDFLAGS
3139+ UMFPACK libraries: $UMFPACK_LIBS
3140+ X11 include flags: $X11_INCFLAGS
3141+ X11 libraries: $X11_LIBS
3142+ Z CPPFLAGS: $Z_CPPFLAGS
3143+ Z LDFLAGS: $Z_LDFLAGS
3144+ Z libraries: $Z_LIBS
3145+
3146+ Default pager: $DEFAULT_PAGER
3147+ gnuplot: $GNUPLOT
3148+
3149+ Build Octave GUI: $build_gui
3150+ JIT compiler for loops: $build_jit
3151+ Build Java interface: $build_java
3152+ Do internal array bounds checking: $BOUNDS_CHECKING
3153+ Build static libraries: $STATIC_LIBS
3154+ Build shared libraries: $SHARED_LIBS
3155+ Dynamic Linking: $ENABLE_DYNAMIC_LINKING $DL_API_MSG
3156+ Include support for GNU readline: $USE_READLINE
3157+ 64-bit array dims and indexing: $USE_64_BIT_IDX_T
3158+ OpenMP SMP multithreading: $USE_OPENMP
3159+ Build cross tools: $cross_tools
3160+])
3161+
3162+warn_msg_printed=false
3163+
3164+OCTAVE_CONFIGURE_WARNING_SUMMARY
3165+
3166+if test $ENABLE_DYNAMIC_LINKING = yes; then
3167+ if test $SHARED_LIBS = no; then
3168+ AC_MSG_WARN([You used --enable-dl but not --enable-shared.])
3169+ AC_MSG_WARN([Are you sure that is what you want to do?])
3170+ warn_msg_printed=true
3171+ fi
3172+fi
3173+
3174+if test $USE_64_BIT_IDX_T = yes; then
3175+ AC_MSG_WARN([])
3176+ AC_MSG_WARN([You used the EXPERIMENTAL --enable-64 option.])
3177+ AC_MSG_WARN([Are you sure that is what you want to do?])
3178+ AC_MSG_WARN([])
3179+ AC_MSG_WARN([Your Fortran compiler must have an option to generate])
3180+ AC_MSG_WARN([code with 8 byte signed INTEGER values. This option])
3181+ AC_MSG_WARN([should be specified in the F77_INTEGER_8_FLAG variable])
3182+ AC_MSG_WARN([Make. This should work automatically for gfortran. If])
3183+ AC_MSG_WARN([you use another compiler, you will need to set this])
3184+ AC_MSG_WARN([variable on the configure command line. You must also])
3185+ AC_MSG_WARN([compile the ARPACK, BLAS, LAPACK, QRUPDATE, and SuiteSparse])
3186+ AC_MSG_WARN([libraries to use 8 byte signed integers for array indexing.])
3187+ AC_MSG_WARN([])
3188+ warn_msg_printed=true
3189+fi
3190+
3191+if test $native_graphics != yes; then
3192+ AC_MSG_WARN([])
3193+ AC_MSG_WARN([I didn't find the necessary libraries to compile native])
3194+ AC_MSG_WARN([graphics. It isn't necessary to have native graphics,])
3195+ AC_MSG_WARN([but you will need to have gnuplot installed or you won't])
3196+ AC_MSG_WARN([be able to use any of Octave's plotting commands])
3197+ AC_MSG_WARN([])
3198+ warn_msg_printed=true
3199+fi
3200+
3201+if test -n "$warn_gnuplot"; then
3202+ if test $native_graphics = yes; then
3203+ AC_MSG_WARN([])
3204+ AC_MSG_WARN([I didn't find gnuplot. Plotting commands will use the])
3205+ AC_MSG_WARN([native graphics toolkit.])
3206+ else
3207+ AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot])
3208+ AC_MSG_WARN([installed, but you won't be able to use any of Octave's])
3209+ AC_MSG_WARN([plotting commands without it.])
3210+ fi
3211+ AC_MSG_WARN([])
3212+ AC_MSG_WARN([If gnuplot is installed, but isn't in your path, you can])
3213+ AC_MSG_WARN([tell Octave where to find it by using the gnuplot_binary])
3214+ AC_MSG_WARN([function. For example,])
3215+ AC_MSG_WARN([])
3216+ AC_MSG_WARN([gnuplot_binary ("/full/path/and/name/of/gnuplot/binary")])
3217+ AC_MSG_WARN([])
3218+ AC_MSG_WARN([at the Octave prompt.])
3219+ AC_MSG_WARN([])
3220+ AC_MSG_WARN([Setting default value to $GNUPLOT])
3221+ AC_MSG_WARN([])
3222+
3223+ warn_msg_printed=true
3224+fi
3225+
3226+if test $USE_ATOMIC_REFCOUNT = no; then
3227+ AC_MSG_WARN([])
3228+ AC_MSG_WARN([atomic reference counting disabled.])
3229+ AC_MSG_WARN([This feature allows access to Octave data safely from])
3230+ AC_MSG_WARN([another thread, and is required when using the GUI's Qt toolkit])
3231+ AC_MSG_WARN([for plotting.])
3232+ AC_MSG_WARN([])
3233+fi
3234+
3235+if $warn_msg_printed; then
3236+ AC_MSG_NOTICE([])
3237+ AC_MSG_NOTICE([NOTE: Libraries or auxiliary programs may be skipped if they are])
3238+ AC_MSG_NOTICE([NOTE: not found OR if they are missing required features on your])
3239+ AC_MSG_NOTICE([NOTE: system. ])
3240+fi
3241+
3242+### End of configure.
3243
3244=== added directory '.pc/qt-requires-opengl.patch/m4'
3245=== added file '.pc/qt-requires-opengl.patch/m4/acinclude.m4'
3246--- .pc/qt-requires-opengl.patch/m4/acinclude.m4 1970-01-01 00:00:00 +0000
3247+++ .pc/qt-requires-opengl.patch/m4/acinclude.m4 2015-08-02 19:51:25 +0000
3248@@ -0,0 +1,2448 @@
3249+dnl aclocal.m4 -- extra macros for configuring Octave
3250+dnl
3251+dnl Copyright (C) 1995-2015 John W. Eaton
3252+dnl
3253+dnl This file is part of Octave.
3254+dnl
3255+dnl Octave is free software; you can redistribute it and/or modify it
3256+dnl under the terms of the GNU General Public License as published by the
3257+dnl Free Software Foundation; either version 3 of the License, or (at
3258+dnl your option) any later version.
3259+dnl
3260+dnl Octave is distributed in the hope that it will be useful, but WITHOUT
3261+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3262+dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3263+dnl for more details.
3264+dnl
3265+dnl You should have received a copy of the GNU General Public License
3266+dnl along with Octave; see the file COPYING. If not, see
3267+dnl <http://www.gnu.org/licenses/>.
3268+dnl
3269+dnl
3270+dnl Copyright (C) 2008 - 2009 Free Software Foundation, Inc.
3271+dnl
3272+dnl If needed, define the m4_ifblank and m4_ifnblank macros from autoconf 2.64
3273+dnl This allows us to run with earlier Autoconfs as well.
3274+dnl FIXME: these should go away once Autoconf 2.64 is required or ubiquitous.
3275+dnl
3276+ifdef([m4_ifblank],[],[
3277+m4_define([m4_ifblank],
3278+[m4_if(m4_translit([[$1]], [ ][ ][
3279+]), [], [$2], [$3])])])
3280+dnl
3281+ifdef([m4_ifnblank],[],[
3282+m4_define([m4_ifnblank],
3283+[m4_if(m4_translit([[$1]], [ ][ ][
3284+]), [], [$3], [$2])])])
3285+dnl
3286+dnl ----------------------------------------------------------------------
3287+dnl
3288+
3289+dnl
3290+dnl Alphabetical list of macros in the OCTAVE_ namespace
3291+dnl
3292+
3293+dnl
3294+dnl Check if the Carbon Framework defines CGDisplayBitsPerPixel.
3295+dnl
3296+AC_DEFUN([OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL], [
3297+ AC_CACHE_CHECK([whether CGDisplayBitsPerPixel is defined in the Carbon Framework],
3298+ [octave_cv_func_carbon_cgdisplaybitsperpixel],
3299+ [AC_LANG_PUSH(C++)
3300+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3301+ #include <Carbon/Carbon.h>
3302+ ]], [[
3303+ CGDirectDisplayID display = CGMainDisplayID ();
3304+ size_t depth = CGDisplayBitsPerPixel (display);
3305+ ]])],
3306+ octave_cv_func_carbon_cgdisplaybitsperpixel=yes,
3307+ octave_cv_func_carbon_cgdisplaybitsperpixel=no)
3308+ AC_LANG_POP(C++)
3309+ ])
3310+ if test $octave_cv_func_carbon_cgdisplaybitsperpixel = yes; then
3311+ AC_DEFINE(HAVE_CARBON_CGDISPLAYBITSPERPIXEL, 1,
3312+ [Define to 1 if Carbon Framework has CGDisplayBitsPerPixel.])
3313+ fi
3314+])
3315+dnl
3316+dnl Check if C compiler handles FLAG command line option. If two
3317+dnl arguments are specified, execute the second arg as shell commands.
3318+dnl Otherwise, add FLAG to CFLAGS if the compiler accepts the flag.
3319+dnl
3320+AC_DEFUN([OCTAVE_CC_FLAG], [
3321+ ac_safe=`echo "$1" | $SED 'y% ./+-:=%___p___%'`
3322+ AC_MSG_CHECKING([whether ${CC-cc} accepts $1])
3323+ AC_CACHE_VAL([octave_cv_cc_flag_$ac_safe],
3324+ [AC_LANG_PUSH(C)
3325+ ac_octave_save_CFLAGS="$CFLAGS"
3326+ CFLAGS="$CFLAGS $1"
3327+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
3328+ [eval "octave_cv_cc_flag_$ac_safe=yes"],
3329+ [eval "octave_cv_cc_flag_$ac_safe=no"])
3330+ CFLAGS="$ac_octave_save_CFLAGS"
3331+ AC_LANG_POP(C)
3332+ ])
3333+ if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then
3334+ AC_MSG_RESULT([yes])
3335+ ifelse([$2], ,
3336+ [CFLAGS="$CFLAGS $1"
3337+ AC_MSG_RESULT([adding $1 to CFLAGS])], [$2])
3338+ else
3339+ AC_MSG_RESULT([no])
3340+ ifelse([$3], , , [$3])
3341+ fi
3342+])
3343+dnl
3344+dnl Check for broken stl_algo.h header file in gcc versions 4.8.0, 4.8.1, 4.8.2
3345+dnl which leads to failures in nth_element.
3346+dnl
3347+AC_DEFUN([OCTAVE_CHECK_BROKEN_STL_ALGO_H], [
3348+ AC_CACHE_CHECK([whether stl_algo.h is broken],
3349+ [octave_cv_broken_stl_algo_h],
3350+ [AC_LANG_PUSH(C++)
3351+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3352+// Based on code from a GCC test program.
3353+
3354+// Copyright (C) 2013 Free Software Foundation, Inc.
3355+//
3356+// This file is part of the GNU ISO C++ Library. This library is free
3357+// software; you can redistribute it and/or modify it under the
3358+// terms of the GNU General Public License as published by the
3359+// Free Software Foundation; either version 3, or (at your option)
3360+// any later version.
3361+
3362+// This library is distributed in the hope that it will be useful,
3363+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3364+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3365+// GNU General Public License for more details.
3366+
3367+// You should have received a copy of the GNU General Public License along
3368+// with this library; see the file COPYING3. If not see
3369+// <http://www.gnu.org/licenses/>.
3370+
3371+// 25.3.2 [lib.alg.nth.element]
3372+
3373+// { dg-options "-std=gnu++11" }
3374+
3375+#include <algorithm>
3376+#include <vector>
3377+ ]], [[
3378+std::vector<int> v (7);
3379+
3380+v[0] = 207089;
3381+v[1] = 202585;
3382+v[2] = 180067;
3383+v[3] = 157549;
3384+v[4] = 211592;
3385+v[5] = 216096;
3386+v[6] = 207089;
3387+
3388+std::nth_element (v.begin (), v.begin () + 3, v.end ());
3389+
3390+return v[3] == 207089 ? 0 : 1;
3391+ ]])],
3392+ octave_cv_broken_stl_algo_h=no,
3393+ octave_cv_broken_stl_algo_h=yes,
3394+ [case "$GXX_VERSION" in
3395+ *4.8.2*)
3396+ octave_cv_broken_stl_algo_h=yes
3397+ ;;
3398+ *)
3399+ octave_cv_broken_stl_algo_h=no
3400+ ;;
3401+ esac
3402+ ])
3403+ AC_LANG_POP(C++)
3404+ ])
3405+ if test "$GXX" = yes; then
3406+ if test $octave_cv_broken_stl_algo_h = yes; then
3407+ case "$GXX_VERSION" in
3408+ 4.8.[[012]])
3409+ ;;
3410+ *)
3411+ octave_cv_broken_stl_algo_h=no
3412+ 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."
3413+ OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
3414+ ;;
3415+ esac
3416+ else
3417+ case "$GXX_VERSION" in
3418+ 4.8.2)
3419+ warn_stl_algo_h="UNEXPECTED: found nth_element working in g++ 4.8.2. Has it been patched on your system?"
3420+ OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
3421+ ;;
3422+ esac
3423+ fi
3424+ else
3425+ octave_cv_broken_stl_algo_h=no
3426+ warn_stl_algo_h="UNEXPECTED: nth_element test failed. Refusing to fix except for g++ 4.8.2."
3427+ OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
3428+ fi
3429+])
3430+dnl
3431+dnl Check whether the FFTW library supports multi-threading. This macro
3432+dnl should be called once per FFTW precision passing in the library
3433+dnl variant (e.g. "fftw3") and a function in the thread support API
3434+dnl (e.g. "fftw_plan_with_nthreads"). Depending on how FFTW was built,
3435+dnl the thread functions could be compiled into the main FFTW library or
3436+dnl could be a separate add-on library that is passed to the linker
3437+dnl ahead of the main FFTW library.
3438+dnl
3439+AC_DEFUN([OCTAVE_CHECK_FFTW_THREADS], [
3440+ ac_octave_save_CPPFLAGS="$CPPFLAGS"
3441+ ac_octave_save_LDFLAGS="$LDFLAGS"
3442+ ac_octave_save_LIBS="$LIBS"
3443+ CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS"
3444+ LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS"
3445+ LIBS="$m4_toupper([$1])_LIBS $LIBS"
3446+ AC_CACHE_CHECK([for $1 multi-threading support],
3447+ [octave_cv_[$1]_threads_lib],
3448+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3449+ #include <fftw3.h>
3450+ ]], [[
3451+ $2 (2);
3452+ ]])],
3453+ [octave_cv_[$1]_threads_lib=yes],
3454+ [LIBS="-l[$1]_threads $LIBS"
3455+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3456+ #include <fftw3.h>
3457+ ]], [[
3458+ $2 (2);
3459+ ]])],
3460+ [octave_cv_[$1]_threads_lib="-l[$1]_threads"],
3461+ [octave_cv_[$1]_threads_lib=no])
3462+ ])
3463+ ])
3464+ case $octave_cv_[$1]_threads_lib in
3465+ -l*)
3466+ m4_toupper([$1])_LIBS="$octave_cv_[$1]_threads_lib $m4_toupper([$1])_LIBS"
3467+ ;;
3468+ no)
3469+ AC_MSG_WARN([No $1 multi-threading support found.])
3470+ AC_MSG_WARN([The single-threaded library will be used instead.])
3471+ ;;
3472+ esac
3473+ if test $octave_cv_[$1]_threads_lib != no; then
3474+ AC_DEFINE([HAVE_]m4_toupper([$1])[_THREADS], 1,
3475+ [Define to 1 if ]m4_toupper([$1])[ has multi-threading support.])
3476+ fi
3477+ CPPFLAGS="$ac_octave_save_CPPFLAGS"
3478+ LDFLAGS="$ac_octave_save_LDFLAGS"
3479+ LIBS="$ac_octave_save_LIBS"
3480+])
3481+dnl
3482+dnl Check whether a math mapper function is available in <cmath>.
3483+dnl Will define HAVE_CMATH_FUNC if there is a double variant and
3484+dnl HAVE_CMATH_FUNCF if there is a float variant.
3485+dnl Currently capable of checking for functions with single
3486+dnl argument and returning bool/int/real.
3487+dnl
3488+AC_DEFUN([OCTAVE_CHECK_FUNC_CMATH], [
3489+ ac_safe=`echo "$1" | $SED 'y% ./+-:=%___p___%'`
3490+
3491+ AC_CACHE_CHECK([for std::$1 in <cmath>],
3492+ [octave_cv_func_cmath_$ac_safe],
3493+ [AC_LANG_PUSH(C++)
3494+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3495+ #include <cmath>
3496+ void take_func (bool (*func) (double x));
3497+ void take_func (int (*func) (double x));
3498+ void take_func (double (*func) (double x));
3499+ ]], [[
3500+ take_func(std::$1);
3501+ ]])],
3502+ [eval "octave_cv_func_cmath_$ac_safe=yes"],
3503+ [eval "octave_cv_func_cmath_$ac_safe=no"])
3504+ AC_LANG_POP(C++)
3505+ ])
3506+ if eval "test \"`echo '$octave_cv_func_cmath_'$ac_safe`\" = yes"; then
3507+ AC_DEFINE(AS_TR_CPP([[HAVE_CMATH_][$1]]), 1,
3508+ [Define to 1 if <cmath> provides $1.])
3509+ fi
3510+
3511+ AC_CACHE_CHECK([for std::$1 (float variant) in <cmath>],
3512+ [octave_cv_func_cmath_f$ac_safe],
3513+ [AC_LANG_PUSH(C++)
3514+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3515+ #include <cmath>
3516+ void take_func (bool (*func) (float x));
3517+ void take_func (int (*func) (float x));
3518+ void take_func (float (*func) (float x));
3519+ ]], [[
3520+ take_func(std::$1);
3521+ ]])],
3522+ [eval "octave_cv_func_cmath_f$ac_safe=yes"],
3523+ [eval "octave_cv_func_cmath_f$ac_safe=no"])
3524+ AC_LANG_POP(C++)
3525+ ])
3526+ if eval "test \"`echo '$octave_cv_func_cmath_f'$ac_safe`\" = yes"; then
3527+ AC_DEFINE(AS_TR_CPP([[HAVE_CMATH_][$1][F]]), 1,
3528+ [Define to 1 if <cmath> provides float variant of $1.])
3529+ fi
3530+])
3531+dnl
3532+dnl Check whether Qscintilla has version 2.6.0 or later
3533+dnl FIXME: This test uses a version number. It potentially could
3534+dnl be re-written to actually call the function, but is it worth it?
3535+dnl
3536+AC_DEFUN([OCTAVE_CHECK_VERSION_2_6_0], [
3537+ AC_CACHE_CHECK([whether Qscintilla has version 2.6.0 or later],
3538+ [octave_cv_version_2_6_0],
3539+ [AC_LANG_PUSH(C++)
3540+ ac_octave_save_CPPFLAGS="$CPPFLAGS"
3541+ CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
3542+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3543+ #include <Qsci/qsciglobal.h>
3544+ ]], [[
3545+ #if QSCINTILLA_VERSION < 0x020600
3546+ #error Old FindFirst function found.
3547+ #endif
3548+ ]])],
3549+ octave_cv_version_2_6_0=yes,
3550+ octave_cv_version_2_6_0=no)
3551+ CPPFLAGS="$ac_octave_save_CPPFLAGS"
3552+ AC_LANG_POP(C++)
3553+ ])
3554+ if test $octave_cv_version_2_6_0 = yes; then
3555+ AC_DEFINE(HAVE_QSCI_VERSION_2_6_0, 1,
3556+ [Define to 1 if Qscintilla is of Version 2.6.0 or later.])
3557+ fi
3558+])
3559+dnl
3560+dnl Check if Fortran compiler has the intrinsic function ISNAN.
3561+dnl
3562+AC_DEFUN([OCTAVE_CHECK_FUNC_FORTRAN_ISNAN], [
3563+ AC_CACHE_CHECK([whether $F77 has the intrinsic function ISNAN],
3564+ [octave_cv_func_fortran_isnan],
3565+ [AC_LANG_PUSH(Fortran 77)
3566+ AC_COMPILE_IFELSE([[
3567+ program foo
3568+ implicit none
3569+ real x
3570+ double precision y
3571+ if (isnan(x)) then
3572+ print *, 'x is NaN'
3573+ end if
3574+ if (isnan(y)) then
3575+ print *, 'y is NaN'
3576+ end if
3577+ end program
3578+ ]],
3579+ octave_cv_func_fortran_isnan=yes, octave_cv_func_fortran_isnan=no)
3580+ AC_LANG_POP(Fortran 77)
3581+ ])
3582+])
3583+dnl
3584+dnl Check if function gluTessCallback is called with "(...)".
3585+dnl
3586+AC_DEFUN([OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS], [
3587+ AC_CACHE_CHECK([whether gluTessCallback is called with "(...)"],
3588+ [octave_cv_func_glutesscallback_threedots],
3589+ [AC_LANG_PUSH(C++)
3590+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3591+ #ifdef HAVE_GL_GLU_H
3592+ # include <GL/glu.h>
3593+ #elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL
3594+ # include <OpenGL/glu.h>
3595+ #endif
3596+ ]], [[
3597+ GLvoid (*func)(...);
3598+ gluTessCallback(0, 0, func);
3599+ ]])],
3600+ octave_cv_func_glutesscallback_threedots=yes,
3601+ octave_cv_func_glutesscallback_threedots=no)
3602+ AC_LANG_POP(C++)
3603+ ])
3604+ if test $octave_cv_func_glutesscallback_threedots = yes; then
3605+ AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1,
3606+ [Define to 1 if gluTessCallback is called with (...).])
3607+ fi
3608+])
3609+dnl
3610+dnl Check whether Qt provides QFont::Monospace
3611+dnl
3612+AC_DEFUN([OCTAVE_CHECK_QFONT_MONOSPACE], [
3613+ AC_CACHE_CHECK([whether Qt provides QFont::Monospace],
3614+ [octave_cv_decl_qfont_monospace],
3615+ [AC_LANG_PUSH(C++)
3616+ ac_octave_save_CPPFLAGS="$CPPFLAGS"
3617+ CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
3618+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3619+ #include <QFont>
3620+ ]], [[
3621+ QFont::StyleHint hint = QFont::Monospace;
3622+ ]])],
3623+ octave_cv_decl_qfont_monospace=yes,
3624+ octave_cv_decl_qfont_monospace=no)
3625+ CPPFLAGS="$ac_octave_save_CPPFLAGS"
3626+ AC_LANG_POP(C++)
3627+ ])
3628+ if test $octave_cv_decl_qfont_monospace = yes; then
3629+ AC_DEFINE(HAVE_QFONT_MONOSPACE, 1,
3630+ [Define to 1 if Qt provides QFont::Monospace.])
3631+ fi
3632+])
3633+dnl
3634+dnl Check whether Qt provides QFont::ForceIntegerMetrics
3635+dnl
3636+AC_DEFUN([OCTAVE_CHECK_QFONT_FORCE_INTEGER_METRICS], [
3637+ AC_CACHE_CHECK([whether Qt provides QFont::ForceIntegerMetrics],
3638+ [octave_cv_decl_qfont_force_integer_metrics],
3639+ [AC_LANG_PUSH(C++)
3640+ ac_octave_save_CPPFLAGS="$CPPFLAGS"
3641+ CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
3642+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3643+ #include <QFont>
3644+ ]], [[
3645+ QFont::StyleStrategy strategy = QFont::ForceIntegerMetrics;
3646+ ]])],
3647+ octave_cv_decl_qfont_force_integer_metrics=yes,
3648+ octave_cv_decl_qfont_force_integer_metrics=no)
3649+ CPPFLAGS="$ac_octave_save_CPPFLAGS"
3650+ AC_LANG_POP(C++)
3651+ ])
3652+ if test $octave_cv_decl_qfont_force_integer_metrics = yes; then
3653+ AC_DEFINE(HAVE_QFONT_FORCE_INTEGER_METRICS, 1,
3654+ [Define to 1 if Qt provides QFont::ForceIntegerMetrics.])
3655+ fi
3656+])
3657+dnl
3658+dnl Check whether Qscintilla SetPlaceholderText function exists.
3659+dnl FIXME: This test uses a version number. It potentially could
3660+dnl be re-written to actually call the function, but is it worth it?
3661+dnl
3662+AC_DEFUN([OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT], [
3663+ AC_CACHE_CHECK([whether Qt has SetPlaceholderText function],
3664+ [octave_cv_func_setplaceholdertext],
3665+ [AC_LANG_PUSH(C++)
3666+ ac_octave_save_CPPFLAGS="$CPPFLAGS"
3667+ CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
3668+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3669+ #include <Qt/qglobal.h>
3670+ ]], [[
3671+ #if QT_VERSION < 0x040700
3672+ #error No SetPlacholderText function available.
3673+ #endif
3674+ ]])],
3675+ octave_cv_func_setplaceholdertext=yes,
3676+ octave_cv_func_setplaceholdertext=no)
3677+ CPPFLAGS="$ac_octave_save_CPPFLAGS"
3678+ AC_LANG_POP(C++)
3679+ ])
3680+ if test $octave_cv_func_setplaceholdertext = yes; then
3681+ AC_DEFINE(HAVE_SETPLACEHOLDERTEXT, 1,
3682+ [Define to 1 if you have the Qt SetPlaceholderText function.])
3683+ fi
3684+])
3685+dnl
3686+dnl Check whether the Qt QAbstractItemModel::beginResetModel() function exists.
3687+dnl Also checks for QAbstractItemModel::endResetModel(). These are two of the
3688+dnl newest Qt functions that the Octave GUI depends on, added in Qt 4.6.
3689+dnl
3690+AC_DEFUN([OCTAVE_CHECK_FUNC_QABSTRACTITEMMODEL_BEGINRESETMODEL], [
3691+ AC_CACHE_CHECK([whether Qt has the QAbstractItemModel::beginResetModel() function],
3692+ [octave_cv_func_qabstractitemmodel_beginresetmodel],
3693+ [AC_LANG_PUSH(C++)
3694+ ac_octave_save_CPPFLAGS="$CPPFLAGS"
3695+ CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
3696+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3697+ #include <QAbstractItemModel>
3698+ class item_model : public QAbstractItemModel
3699+ {
3700+ public:
3701+ item_model (QObject *parent = 0) : QAbstractItemModel (parent) {}
3702+ ~item_model () {}
3703+ QModelIndex index (int, int, const QModelIndex& m) const { return m; }
3704+ QModelIndex parent (const QModelIndex& m) const { return m; }
3705+ int columnCount (const QModelIndex&) const { return 0; }
3706+ int rowCount (const QModelIndex&) const { return 0; }
3707+ QVariant data (const QModelIndex&, int) const { return QVariant(); }
3708+ void update_model ()
3709+ {
3710+ this->beginResetModel ();
3711+ this->endResetModel ();
3712+ }
3713+ };
3714+ ]], [[
3715+ item_model model;
3716+ model.update_model ();
3717+ ]])],
3718+ octave_cv_func_qabstractitemmodel_beginresetmodel=yes,
3719+ octave_cv_func_qabstractitemmodel_beginresetmodel=no)
3720+ CPPFLAGS="$ac_octave_save_CPPFLAGS"
3721+ AC_LANG_POP(C++)
3722+ ])
3723+ if test $octave_cv_func_qabstractitemmodel_beginresetmodel = yes; then
3724+ AC_DEFINE(HAVE_QABSTRACTITEMMODEL_BEGINRESETMODEL, 1,
3725+ [Define to 1 if Qt has the QAbstractItemModel::beginResetModel() function.])
3726+ fi
3727+])
3728+dnl
3729+dnl Check whether the Qt QTabWidget::setMovable() function exists.
3730+dnl This function was added in Qt 4.5.
3731+dnl
3732+AC_DEFUN([OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE], [
3733+ AC_CACHE_CHECK([whether Qt has the QTabWidget::setMovable() function],
3734+ [octave_cv_func_qtabwidget_setmovable],
3735+ [AC_LANG_PUSH(C++)
3736+ ac_octave_save_CPPFLAGS="$CPPFLAGS"
3737+ CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
3738+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3739+ #include <QTabWidget>
3740+ class tab_widget : public QTabWidget
3741+ {
3742+ public:
3743+ tab_widget (QWidget *parent = 0) : QTabWidget (parent) { this->setMovable (true); }
3744+ ~tab_widget () {}
3745+ };
3746+ ]], [[
3747+ tab_widget tw;
3748+ ]])],
3749+ octave_cv_func_qtabwidget_setmovable=yes,
3750+ octave_cv_func_qtabwidget_setmovable=no)
3751+ CPPFLAGS="$ac_octave_save_CPPFLAGS"
3752+ AC_LANG_POP(C++)
3753+ ])
3754+ if test $octave_cv_func_qtabwidget_setmovable = yes; then
3755+ AC_DEFINE(HAVE_QTABWIDGET_SETMOVABLE, 1,
3756+ [Define to 1 if Qt has the QTabWidget::setMovable() function.])
3757+ fi
3758+])
3759+dnl
3760+dnl Check whether the QsciScintilla::findFirstInSelection () function exists.
3761+dnl This function was added in QScintilla 2.7.
3762+dnl
3763+AC_DEFUN([OCTAVE_CHECK_FUNC_QSCI_FINDSELECTION], [
3764+ AC_CACHE_CHECK([whether QSci has the QsciScintilla::findFirstInSelection () function],
3765+ [octave_cv_func_qsci_findfirstinselection],
3766+ [AC_LANG_PUSH(C++)
3767+ ac_octave_save_CPPFLAGS="$CPPFLAGS"
3768+ CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
3769+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3770+ #include <Qsci/qsciscintilla.h>
3771+ class qsci : public QsciScintilla
3772+ {
3773+ public:
3774+ qsci (QWidget *parent = 0) : QsciScintilla (parent)
3775+ { this->findFirstInSelection (QString ("x"),true,true,true,true,true); }
3776+ ~qsci () {}
3777+ };
3778+ ]], [[
3779+ qsci edit;
3780+ ]])],
3781+ octave_cv_func_qsci_findfirstinselection=yes,
3782+ octave_cv_func_qsci_findfirstinselection=no)
3783+ CPPFLAGS="$ac_octave_save_CPPFLAGS"
3784+ AC_LANG_POP(C++)
3785+ ])
3786+ if test $octave_cv_func_qsci_findfirstinselection = yes; then
3787+ AC_DEFINE(HAVE_QSCI_FINDSELECTION, 1,
3788+ [Define to 1 if Qsci has the QsciScintilla::findFirstInSelection () function.])
3789+ fi
3790+])
3791+dnl
3792+dnl Check whether HDF5 library has version 1.6 API functions.
3793+dnl
3794+AC_DEFUN([OCTAVE_CHECK_HDF5_HAS_VER_16_API], [
3795+ AC_CACHE_CHECK([whether HDF5 library has enforced version 1.6 API],
3796+ [octave_cv_hdf5_has_ver_16_api],
3797+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3798+ #include <hdf5.h>
3799+ ]], [[
3800+ H5Eset_auto (0, 0);
3801+ ]])],
3802+ octave_cv_hdf5_has_ver_16_api=yes,
3803+ octave_cv_hdf5_has_ver_16_api=no)
3804+ ])
3805+ if test $octave_cv_hdf5_has_ver_16_api != yes; then
3806+ AC_DEFINE(HAVE_HDF5_18, 1, [Define to 1 if >=HDF5-1.8 is available.])
3807+ fi
3808+])
3809+dnl
3810+dnl Usage:
3811+dnl OCTAVE_CHECK_LIB(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC,
3812+dnl LANG, DOC-STRING, EXTRA-CHECK)
3813+dnl
3814+AC_DEFUN([OCTAVE_CHECK_LIB], [
3815+ AC_ARG_WITH([$1-includedir],
3816+ [AS_HELP_STRING([--with-$1-includedir=DIR],
3817+ [look for $2 include files in DIR])],
3818+ [m4_toupper([$1])_CPPFLAGS="-I$withval"])
3819+ AC_SUBST(m4_toupper([$1])_CPPFLAGS)
3820+
3821+ AC_ARG_WITH([$1-libdir],
3822+ [AS_HELP_STRING([--with-$1-libdir=DIR],
3823+ [look for $2 libraries in DIR])],
3824+ [m4_toupper([$1])_LDFLAGS="-L$withval"])
3825+ AC_SUBST(m4_toupper([$1])_LDFLAGS)
3826+
3827+ AC_ARG_WITH([$1],
3828+ [m4_ifblank([$7],
3829+ [AS_HELP_STRING([--without-$1], [don't use $2 library])],
3830+ [AS_HELP_STRING([--without-$1], [$7])])],
3831+ with_$1=$withval, with_$1=yes)
3832+
3833+ m4_toupper([$1])_LIBS=
3834+ case $with_$1 in
3835+ no)
3836+ m4_toupper([$1])_LIBS=
3837+ ;;
3838+ yes | "")
3839+ m4_toupper([$1])_LIBS="-l$1"
3840+ ;;
3841+ -* | */* | *.a | *.so | *.so.* | *.o)
3842+ m4_toupper([$1])_LIBS="$with_$1"
3843+ ;;
3844+ *)
3845+ m4_toupper([$1])_LIBS="-l$with_$1"
3846+ ;;
3847+ esac
3848+
3849+ warn_$1="$3"
3850+ m4_set_add([summary_warning_list], [warn_$1])
3851+
3852+ if test -n "$m4_toupper([$1])_LIBS"; then
3853+ ac_octave_save_CPPFLAGS="$CPPFLAGS"
3854+ ac_octave_save_LDFLAGS="$LDFLAGS"
3855+ ac_octave_save_LIBS="$LIBS"
3856+ CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS"
3857+ LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS"
3858+ LIBS="$m4_toupper([$1])_LIBS $LIBS"
3859+ m4_ifnblank([$6], [AC_LANG_PUSH($6)])
3860+ ac_octave_$1_check_for_lib=no
3861+ m4_ifblank([$4], [ac_octave_$1_check_for_lib=yes],
3862+ [AC_CHECK_HEADERS([$4], [ac_octave_$1_check_for_lib=yes; break])])
3863+ if test $ac_octave_$1_check_for_lib = yes; then
3864+ AC_CACHE_CHECK([for $5 in $m4_toupper([$1])_LIBS],
3865+ [octave_cv_lib_$1],
3866+ [AC_LINK_IFELSE([AC_LANG_CALL([], [$5])],
3867+ [octave_cv_lib_$1=yes], [octave_cv_lib_$1=no])
3868+ ])
3869+ if test "$octave_cv_lib_$1" = yes; then
3870+ m4_ifblank([$8], [
3871+ warn_$1=
3872+ AC_DEFINE([HAVE_]m4_toupper([$1]), 1,
3873+ [Define to 1 if $2 is available.])], [$8])
3874+ fi
3875+ fi
3876+ m4_ifnblank([$6], [AC_LANG_POP($6)])
3877+ CPPFLAGS="$ac_octave_save_CPPFLAGS"
3878+ LDFLAGS="$ac_octave_save_LDFLAGS"
3879+ LIBS="$ac_octave_save_LIBS"
3880+ fi
3881+
3882+ AC_SUBST(m4_toupper([$1])_LIBS)
3883+ if test -n "$warn_$1"; then
3884+ AC_MSG_WARN([$warn_$1])
3885+ m4_toupper([$1])_LIBS=
3886+ fi
3887+])
3888+dnl
3889+dnl Check whether ARPACK works (does not crash).
3890+dnl
3891+dnl Using a pure Fortran program doesn't seem to crash when linked
3892+dnl with the buggy ARPACK library but the C++ program does. Maybe it
3893+dnl is the memory allocation that exposes the bug and using statically
3894+dnl allocated arrays in Fortran does not?
3895+dnl
3896+dnl FIXME: it would be nice to avoid the duplication of F77 macros
3897+dnl and typedefs here and in the f77-fcn.h header file.
3898+dnl
3899+AC_DEFUN([OCTAVE_CHECK_LIB_ARPACK_OK], [
3900+ AC_CACHE_CHECK([whether the arpack library works],
3901+ [octave_cv_lib_arpack_ok],
3902+ [AC_LANG_PUSH(C++)
3903+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3904+
3905+#include <cfloat>
3906+
3907+#include <stdint.h>
3908+
3909+typedef OCTAVE_IDX_TYPE octave_idx_type;
3910+typedef int F77_RET_T;
3911+
3912+#define F77_CHAR_ARG2(x, l) x
3913+#define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l)
3914+
3915+#define F77_CHAR_ARG_LEN(l) , l
3916+
3917+#define F77_CONST_CHAR_ARG_DECL const char *
3918+#define F77_CHAR_ARG_LEN_DECL , long
3919+
3920+extern "C"
3921+{
3922+ F77_RET_T
3923+ F77_FUNC (dnaupd, DNAUPD) (octave_idx_type&,
3924+ F77_CONST_CHAR_ARG_DECL,
3925+ const octave_idx_type&,
3926+ F77_CONST_CHAR_ARG_DECL,
3927+ octave_idx_type&, const double&,
3928+ double*, const octave_idx_type&, double*,
3929+ const octave_idx_type&, octave_idx_type*,
3930+ octave_idx_type*, double*, double*,
3931+ const octave_idx_type&, octave_idx_type&
3932+ F77_CHAR_ARG_LEN_DECL
3933+ F77_CHAR_ARG_LEN_DECL);
3934+
3935+ F77_RET_T
3936+ F77_FUNC (dneupd, DNEUPD) (const octave_idx_type&,
3937+ F77_CONST_CHAR_ARG_DECL,
3938+ octave_idx_type*, double*, double*,
3939+ double*, const octave_idx_type&, const double&,
3940+ const double&, double*,
3941+ F77_CONST_CHAR_ARG_DECL,
3942+ const octave_idx_type&,
3943+ F77_CONST_CHAR_ARG_DECL,
3944+ octave_idx_type&, const double&, double*,
3945+ const octave_idx_type&, double*,
3946+ const octave_idx_type&, octave_idx_type*,
3947+ octave_idx_type*, double*, double*,
3948+ const octave_idx_type&, octave_idx_type&
3949+ F77_CHAR_ARG_LEN_DECL
3950+ F77_CHAR_ARG_LEN_DECL
3951+ F77_CHAR_ARG_LEN_DECL);
3952+
3953+ F77_RET_T
3954+ F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG_DECL,
3955+ const octave_idx_type&, const octave_idx_type&,
3956+ const double&, const double*,
3957+ const octave_idx_type&, const double*,
3958+ const octave_idx_type&, const double&, double*,
3959+ const octave_idx_type&
3960+ F77_CHAR_ARG_LEN_DECL);
3961+}
3962+
3963+void
3964+doit (void)
3965+{
3966+ // Based on function EigsRealNonSymmetricMatrix from liboctave/eigs-base.cc.
3967+
3968+ // Problem matrix. See bug #31479
3969+ octave_idx_type n = 4;
3970+ double *m = new double [n * n];
3971+ m[0] = 1, m[4] = 0, m[8] = 0, m[12] = -1;
3972+ m[1] = 0, m[5] = 1, m[9] = 0, m[13] = 0;
3973+ m[2] = 0, m[6] = 0, m[10] = 1, m[14] = 0;
3974+ m[3] = 0, m[7] = 0, m[11] = 2, m[15] = 1;
3975+
3976+ double *resid = new double [4];
3977+
3978+ resid[0] = 0.960966;
3979+ resid[1] = 0.741195;
3980+ resid[2] = 0.150143;
3981+ resid[3] = 0.868067;
3982+
3983+ octave_idx_type *ip = new octave_idx_type [11];
3984+
3985+ ip[0] = 1; // ishift
3986+ ip[1] = 0; // ip[1] not referenced
3987+ ip[2] = 300; // mxiter, maximum number of iterations
3988+ ip[3] = 1; // NB blocksize in recurrence
3989+ ip[4] = 0; // nconv, number of Ritz values that satisfy convergence
3990+ ip[5] = 0; // ip[5] not referenced
3991+ ip[6] = 1; // mode
3992+ ip[7] = 0; // ip[7] to ip[10] are return values
3993+ ip[8] = 0;
3994+ ip[9] = 0;
3995+ ip[10] = 0;
3996+
3997+ octave_idx_type *ipntr = new octave_idx_type [14];
3998+
3999+ octave_idx_type k = 1;
4000+ octave_idx_type p = 3;
4001+ octave_idx_type lwork = 3 * p * (p + 2);
4002+
4003+ double *v = new double [n * (p + 1)];
4004+ double *workl = new double [lwork + 1];
4005+ double *workd = new double [3 * n + 1];
4006+
4007+ octave_idx_type ido = 0;
4008+ octave_idx_type info = 0;
4009+
4010+ double tol = DBL_EPSILON;
4011+
4012+ do
4013+ {
4014+ F77_FUNC (dnaupd, DNAUPD) (ido, F77_CONST_CHAR_ARG2 ("I", 1),
4015+ n, F77_CONST_CHAR_ARG2 ("LM", 2),
4016+ k, tol, resid, p, v, n, ip, ipntr,
4017+ workd, workl, lwork, info
4018+ F77_CHAR_ARG_LEN (1)
4019+ F77_CHAR_ARG_LEN (2));
4020+
4021+ if (ido == -1 || ido == 1 || ido == 2)
4022+ {
4023+ double *x = workd + ipntr[0] - 1;
4024+ double *y = workd + ipntr[1] - 1;
4025+
4026+ F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG2 ("N", 1),
4027+ n, n, 1.0, m, n, x, 1, 0.0, y, 1
4028+ F77_CHAR_ARG_LEN (1));
4029+ }
4030+ else
4031+ {
4032+ if (info < 0)
4033+ {
4034+ return; // Error
4035+ }
4036+
4037+ break;
4038+ }
4039+ }
4040+ while (1);
4041+
4042+ octave_idx_type *sel = new octave_idx_type [p];
4043+
4044+ // In Octave, the dimensions of dr and di are k+1, but k+2 avoids segfault
4045+ double *dr = new double [k + 1];
4046+ double *di = new double [k + 1];
4047+ double *workev = new double [3 * p];
4048+
4049+ for (octave_idx_type i = 0; i < k + 1; i++)
4050+ dr[i] = di[i] = 0.;
4051+
4052+ octave_idx_type rvec = 1;
4053+
4054+ double sigmar = 0.0;
4055+ double sigmai = 0.0;
4056+
4057+ // In Octave, this is n*(k+1), but n*(k+2) avoids segfault
4058+ double *z = new double [n * (k + 1)];
4059+
4060+ F77_FUNC (dneupd, DNEUPD) (rvec, F77_CONST_CHAR_ARG2 ("A", 1),
4061+ sel, dr, di, z, n, sigmar, sigmai, workev,
4062+ F77_CONST_CHAR_ARG2 ("I", 1), n,
4063+ F77_CONST_CHAR_ARG2 ("LM", 2), k, tol,
4064+ resid, p, v, n, ip, ipntr, workd,
4065+ workl, lwork, info
4066+ F77_CHAR_ARG_LEN (1)
4067+ F77_CHAR_ARG_LEN (1)
4068+ F77_CHAR_ARG_LEN (2));
4069+}
4070+
4071+]], [[
4072+
4073+ for (int i = 0; i < 10; i++)
4074+ doit ();
4075+ ]])],
4076+ octave_cv_lib_arpack_ok=yes,
4077+ octave_cv_lib_arpack_ok=no,
4078+ octave_cv_lib_arpack_ok=yes)
4079+ AC_LANG_POP(C++)
4080+ ])
4081+ if test $octave_cv_lib_arpack_ok = yes; then
4082+ $1
4083+ :
4084+ else
4085+ $2
4086+ :
4087+ fi
4088+])
4089+dnl
4090+dnl Check whether GLPK provides the latest API functions required
4091+dnl for the glpk function. The glp_iptcp structure was introduced
4092+dnl in GLPK version 4.38.
4093+dnl
4094+AC_DEFUN([OCTAVE_CHECK_LIB_GLPK_OK], [
4095+ AC_CACHE_CHECK([whether the glpk library has glp_interior(glp_prob*, glp_iptcp*)],
4096+ [octave_cv_lib_glpk_ok],
4097+ [AC_LANG_PUSH(C++)
4098+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4099+ extern "C"
4100+ {
4101+ #if defined (HAVE_GLPK_GLPK_H)
4102+ #include <glpk/glpk.h>
4103+ #else
4104+ #include <glpk.h>
4105+ #endif
4106+ }
4107+ ]], [[
4108+ glp_prob *lp = glp_create_prob ();
4109+ glp_iptcp iptcp;
4110+ glp_init_iptcp (&iptcp);
4111+ int retval = glp_interior (lp, &iptcp);
4112+ ]])],
4113+ octave_cv_lib_glpk_ok=yes,
4114+ octave_cv_lib_glpk_ok=no)
4115+ AC_LANG_POP(C++)
4116+ ])
4117+ if test $octave_cv_lib_glpk_ok = yes; then
4118+ $1
4119+ :
4120+ else
4121+ $2
4122+ :
4123+ fi
4124+])
4125+dnl
4126+dnl Check whether using HDF5 DLL under Windows. This is done by
4127+dnl testing for a data symbol in the HDF5 library, which would
4128+dnl require the definition of _HDF5USEDL_ under MSVC compiler.
4129+dnl
4130+AC_DEFUN([OCTAVE_CHECK_LIB_HDF5_DLL], [
4131+ AC_CACHE_CHECK([if _HDF5USEDLL_ needs to be defined],
4132+ [octave_cv_lib_hdf5_dll],
4133+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4134+ #include <hdf5.h>
4135+ ]], [[
4136+ hid_t x = H5T_NATIVE_DOUBLE;
4137+ return x
4138+ ]])],
4139+ [octave_cv_lib_hdf5_dll=no],
4140+ [save_CFLAGS="$CFLAGS"
4141+ CFLAGS="$CFLAGS -DWIN32 -D_HDF5USEDLL_"
4142+ save_LIBS="$LIBS"
4143+ LIBS="$HDF5_LIBS $LIBS"
4144+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4145+ #include <hdf5.h>
4146+ ]], [[
4147+ hid_t x = H5T_NATIVE_DOUBLE;
4148+ return x
4149+ ]])],
4150+ octave_cv_lib_hdf5_dll=yes,
4151+ octave_cv_lib_hdf5_dll=no)
4152+ CFLAGS="$save_CFLAGS"
4153+ LIBS="$save_LIBS"
4154+ ])
4155+ ])
4156+ if test $octave_cv_lib_hdf5_dll = yes; then
4157+ AC_DEFINE(_HDF5USEDLL_, 1, [Define to 1 if using HDF5 dll (Win32).])
4158+ fi
4159+])
4160+dnl
4161+dnl Check for OpenGL. If found, define OPENGL_LIBS.
4162+dnl
4163+dnl FIXME: The following tests should probably check for the
4164+dnl libraries separately.
4165+dnl
4166+dnl FIXME: Should we allow a way to specify a directory for OpenGL
4167+dnl libraries and header files?
4168+dnl
4169+AC_DEFUN([OCTAVE_CHECK_LIB_OPENGL], [
4170+ OPENGL_LIBS=
4171+
4172+ ## On MacOSX systems the OpenGL framework can be used
4173+ OCTAVE_HAVE_FRAMEWORK(OpenGL, [[
4174+ #include <OpenGL/gl.h>
4175+ #include <OpenGL/glu.h>
4176+ ]], [[
4177+ GLint par; glGetIntegerv (GL_VIEWPORT, &par);
4178+ ]],
4179+ have_framework_opengl=yes, have_framework_opengl=no)
4180+
4181+ if test $have_framework_opengl = yes; then
4182+ AC_DEFINE(HAVE_FRAMEWORK_OPENGL, 1,
4183+ [Define to 1 if framework OPENGL is available.])
4184+ OPENGL_LIBS="-Wl,-framework -Wl,OpenGL"
4185+ AC_MSG_NOTICE([adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS])
4186+ OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS
4187+ else
4188+ case $canonical_host_type in
4189+ *-*-mingw32* | *-*-msdosmsvc)
4190+ AC_CHECK_HEADERS([windows.h])
4191+ ;;
4192+ esac
4193+ have_opengl_incs=no
4194+ AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h],
4195+ [AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h],
4196+ [have_opengl_incs=yes; break], [], [
4197+#ifdef HAVE_WINDOWS_H
4198+#include <windows.h>
4199+#endif
4200+ ])
4201+ break
4202+ ], [], [
4203+#ifdef HAVE_WINDOWS_H
4204+# include <windows.h>
4205+#endif
4206+ ])
4207+
4208+ if test $have_opengl_incs = yes; then
4209+ AC_CHECK_HEADERS([GL/glext.h OpenGL/glext.h], [], [], [
4210+#ifdef HAVE_WINDOWS_H
4211+# include <windows.h>
4212+#endif
4213+#if defined (HAVE_GL_GL_H)
4214+# include <GL/gl.h>
4215+#elif defined (HAVE_OPENGL_GL_H)
4216+# include <OpenGL/gl.h>
4217+#endif
4218+ ])
4219+ case $canonical_host_type in
4220+ *-*-mingw32* | *-*-msdosmsvc)
4221+ save_LIBS="$LIBS"
4222+ LIBS="$LIBS -lopengl32"
4223+ AC_MSG_CHECKING([for glEnable in -lopengl32])
4224+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4225+ #if HAVE_WINDOWS_H
4226+ # include <windows.h>
4227+ #endif
4228+ #if defined (HAVE_GL_GL_H)
4229+ # include <GL/gl.h>
4230+ #elif defined (HAVE_OPENGL_GL_H)
4231+ # include <OpenGL/gl.h>
4232+ #endif
4233+ ]], [[
4234+ glEnable(GL_SMOOTH);
4235+ ]])], [OPENGL_LIBS="-lopengl32 -lglu32"])
4236+
4237+ LIBS="$save_LIBS"
4238+ if test "x$OPENGL_LIBS" != "x"; then
4239+ AC_MSG_RESULT([yes])
4240+ else
4241+ AC_MSG_RESULT([no])
4242+ fi
4243+ ;;
4244+ *)
4245+ ## Non-Mac, Non-Windows systems use this check
4246+ AC_CHECK_LIB([GL], [glEnable], [OPENGL_LIBS="-lGL -lGLU"])
4247+ ;;
4248+ esac
4249+ fi
4250+ fi
4251+ AC_SUBST(OPENGL_LIBS)
4252+])
4253+dnl
4254+dnl Check whether Qhull works (does not crash).
4255+dnl
4256+AC_DEFUN([OCTAVE_CHECK_LIB_QHULL_OK], [
4257+ AC_CACHE_CHECK([whether the qhull library works],
4258+ [octave_cv_lib_qhull_ok],
4259+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4260+ #include <stdio.h>
4261+ #if defined (HAVE_LIBQHULL_LIBQHULL_H)
4262+ # include <libqhull/libqhull.h>
4263+ # include <libqhull/qset.h>
4264+ # include <libqhull/geom.h>
4265+ # include <libqhull/poly.h>
4266+ # include <libqhull/io.h>
4267+ #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H)
4268+ # if defined (HAVE_QHULL_LIBQHULL_H)
4269+ # include <qhull/libqhull.h>
4270+ # else
4271+ # include <qhull/qhull.h>
4272+ # endif
4273+ # include <qhull/qset.h>
4274+ # include <qhull/geom.h>
4275+ # include <qhull/poly.h>
4276+ # include <qhull/io.h>
4277+ #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H)
4278+ # if defined (HAVE_LIBQHULL_H)
4279+ # include <libqhull.h>
4280+ # else
4281+ # include <qhull.h>
4282+ # endif
4283+ # include <qset.h>
4284+ # include <geom.h>
4285+ # include <poly.h>
4286+ # include <io.h>
4287+ #endif
4288+ #ifdef NEED_QHULL_VERSION
4289+ char *qh_version = "version";
4290+ #endif
4291+ ]], [[
4292+ int dim = 2;
4293+ int n = 4;
4294+ coordT points[8] = { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5 };
4295+ boolT ismalloc = 0;
4296+ return qh_new_qhull (dim, n, points, ismalloc, "qhull ", 0, stderr);
4297+ ]])],
4298+ octave_cv_lib_qhull_ok=yes,
4299+ octave_cv_lib_qhull_ok=no,
4300+ octave_cv_lib_qhull_ok=yes)
4301+ ])
4302+ if test $octave_cv_lib_qhull_ok = yes; then
4303+ $1
4304+ :
4305+ else
4306+ $2
4307+ :
4308+ fi
4309+])
4310+dnl
4311+dnl Check whether sndfile library is modern enough to include things like Ogg
4312+dnl
4313+AC_DEFUN([OCTAVE_CHECK_LIB_SNDFILE_OK], [
4314+ AC_CACHE_CHECK([whether sndfile library is modern enough],
4315+ [octave_cv_lib_sndfile_ok],
4316+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4317+ #include <sndfile.h>
4318+ ]], [[
4319+ int x = SF_FORMAT_OGG;
4320+ ]])],
4321+ octave_cv_lib_sndfile_ok=yes,
4322+ octave_cv_lib_sndfile_ok=no)
4323+ ])
4324+ if test $octave_cv_lib_sndfile_ok = yes; then
4325+ $1
4326+ :
4327+ else
4328+ $2
4329+ :
4330+ fi
4331+])
4332+dnl
4333+dnl Find a suitable termlib to use.
4334+dnl
4335+AC_DEFUN([OCTAVE_CHECK_LIB_TERMLIB], [
4336+ TERM_LIBS=
4337+ ac_octave_save_LIBS="$LIBS"
4338+ AC_SEARCH_LIBS([tputs],
4339+ [ncurses curses termcap terminfo termlib],
4340+ [], [])
4341+ LIBS="$ac_octave_save_LIBS"
4342+ case "$ac_cv_search_tputs" in
4343+ -l*)
4344+ TERM_LIBS="$ac_cv_search_tputs"
4345+ ;;
4346+ no)
4347+ warn_termlibs="I couldn't find -ltermcap, -lterminfo, -lncurses, -lcurses, or -ltermlib!"
4348+ AC_MSG_WARN([$warn_termlibs])
4349+ ;;
4350+ esac
4351+
4352+dnl Old code (9/9/2012). Delete when new code is definitely proven.
4353+dnl
4354+dnl for _termlib in ncurses curses termcap terminfo termlib; do
4355+dnl AC_CHECK_LIB([${_termlib}], [tputs], [
4356+dnl TERM_LIBS="-l${termlib}"
4357+dnl octave_cv_lib_found_termlib=yes
4358+dnl break])
4359+dnl done
4360+
4361+ AC_SUBST(TERM_LIBS)
4362+])
4363+dnl
4364+dnl Check for the Qhull version.
4365+dnl
4366+AC_DEFUN([OCTAVE_CHECK_QHULL_VERSION], [
4367+ AC_CACHE_CHECK([for qh_version in $QHULL_LIBS],
4368+ [octave_cv_lib_qhull_version],
4369+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4370+ #include <stdio.h>
4371+ #if defined (HAVE_LIBQHULL_LIBQHULL_H)
4372+ # include <libqhull/libqhull.h>
4373+ # include <libqhull/qset.h>
4374+ # include <libqhull/geom.h>
4375+ # include <libqhull/poly.h>
4376+ # include <libqhull/io.h>
4377+ #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H)
4378+ # if defined (HAVE_QHULL_LIBQHULL_H)
4379+ # include <qhull/libqhull.h>
4380+ # else
4381+ # include <qhull/qhull.h>
4382+ # endif
4383+ # include <qhull/qset.h>
4384+ # include <qhull/geom.h>
4385+ # include <qhull/poly.h>
4386+ # include <qhull/io.h>
4387+ #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H)
4388+ # if defined (HAVE_LIBQHULL_H)
4389+ # include <libqhull.h>
4390+ # else
4391+ # include <qhull.h>
4392+ # endif
4393+ # include <qset.h>
4394+ # include <geom.h>
4395+ # include <poly.h>
4396+ # include <io.h>
4397+ #endif
4398+ ]], [[
4399+ const char *tmp = qh_version;
4400+ ]])],
4401+ octave_cv_lib_qhull_version=yes, octave_cv_lib_qhull_version=no)
4402+ ])
4403+ if test $octave_cv_lib_qhull_version = no; then
4404+ AC_DEFINE(NEED_QHULL_VERSION, 1,
4405+ [Define to 1 if the Qhull library needs a qh_version variable defined.])
4406+ fi
4407+])
4408+dnl
4409+dnl Check if the default Fortran INTEGER is 64 bits wide.
4410+dnl
4411+AC_DEFUN([OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER], [
4412+ AC_CACHE_CHECK([whether $F77 generates correct size integers],
4413+ [octave_cv_sizeof_fortran_integer],
4414+ [ac_octave_save_FFLAGS="$FFLAGS"
4415+ FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
4416+ AC_LANG_PUSH(Fortran 77)
4417+ AC_COMPILE_IFELSE([[
4418+ subroutine foo(n, in, out)
4419+ integer n, in(n), out(n)
4420+ integer i
4421+ do 10 i = 1, n
4422+ out(i) = in(i)
4423+ 10 continue
4424+ return
4425+ end
4426+ ]],
4427+ [mv conftest.$ac_objext fintsize.$ac_objext
4428+ ac_octave_save_LIBS="$LIBS"
4429+ LIBS="fintsize.$ac_objext $[]_AC_LANG_PREFIX[]LIBS"
4430+ AC_LANG_PUSH(C)
4431+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4432+ #include <assert.h>
4433+ #include <stdint.h>
4434+ ]], [[
4435+ #ifdef USE_64_BIT_IDX_T
4436+ typedef int64_t octave_idx_type;
4437+ #else
4438+ typedef int octave_idx_type;
4439+ #endif
4440+ octave_idx_type n = 2;
4441+ octave_idx_type in[2];
4442+ octave_idx_type out[2];
4443+ in[0] = 13;
4444+ in[0] = 42;
4445+ F77_FUNC(foo,FOO) (&n, &in, &out);
4446+ assert (in[0] == out[0] && in[1] == out[1]);
4447+ ]])],
4448+ octave_cv_sizeof_fortran_integer=yes,
4449+ octave_cv_sizeof_fortran_integer=no,
4450+ octave_cv_sizeof_fortran_integer=yes)
4451+ AC_LANG_POP(C)
4452+ LIBS="$ac_octave_save_LIBS"
4453+ rm -f conftest.$ac_objext fintsize.$ac_objext],
4454+ [rm -f conftest.$ac_objext
4455+ AC_MSG_FAILURE([cannot compile a simple Fortran program])
4456+ octave_cv_sizeof_fortran_integer=no])
4457+ AC_LANG_POP(Fortran 77)
4458+ FFLAGS="$ac_octave_save_FFLAGS"
4459+ ])
4460+])
4461+dnl
4462+dnl Add warning to final summary.
4463+dnl
4464+AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [
4465+ AC_MSG_WARN([$][$1])
4466+ m4_set_add([summary_warning_list], [$1])
4467+])
4468+dnl
4469+dnl Print final summary.
4470+dnl
4471+AC_DEFUN([OCTAVE_CONFIGURE_WARNING_SUMMARY], [
4472+ m4_set_foreach([summary_warning_list], [elt], [
4473+ if test -n "[$]elt"; then
4474+ AC_MSG_WARN([$]elt)
4475+ warn_msg_printed=true
4476+ fi])
4477+])
4478+dnl
4479+dnl Check if the C++ library has the bit_and, bit_or, and bit_xor
4480+dnl templates defined.
4481+dnl
4482+AC_DEFUN([OCTAVE_CXX_BITWISE_OP_TEMPLATES], [
4483+ AC_CACHE_CHECK([whether bit_and, bit_or, bit_xor are defined in the C++ library],
4484+ [octave_cv_cxx_bitwise_op_templates],
4485+ [AC_LANG_PUSH(C++)
4486+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4487+ #include <functional>
4488+ ]], [[
4489+ int x = 0;
4490+ int y = 1;
4491+ int z1 = std::bit_and<int>() (x, y);
4492+ int z2 = std::bit_or<int>() (x, y);
4493+ int z3 = std::bit_xor<int>() (x, y);
4494+ ]])],
4495+ octave_cv_cxx_bitwise_op_templates=yes,
4496+ octave_cv_cxx_bitwise_op_templates=no)
4497+ AC_LANG_POP(C++)
4498+ ])
4499+ if test $octave_cv_cxx_bitwise_op_templates = yes; then
4500+ AC_DEFINE(HAVE_CXX_BITWISE_OP_TEMPLATES, 1,
4501+ [Define to 1 if C++ library has templated bitwise operators.])
4502+ fi
4503+])
4504+dnl
4505+dnl Check if C++ reinterpret cast works for function pointers.
4506+dnl
4507+AC_DEFUN([OCTAVE_CXX_BROKEN_REINTERPRET_CAST],
4508+ [AC_REQUIRE([AC_PROG_CXX])
4509+ AC_CACHE_CHECK([for broken C++ reinterpret_cast],
4510+ [octave_cv_cxx_broken_reinterpret_cast],
4511+ [AC_LANG_PUSH(C++)
4512+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4513+ #include <cmath> ]], [[
4514+ typedef double (*fptr) (double);
4515+ fptr psin = sin;
4516+ void *vptr = reinterpret_cast<void *> (psin);
4517+ psin = reinterpret_cast<fptr> (vptr);
4518+ ]])],
4519+ octave_cv_cxx_broken_reinterpret_cast=no,
4520+ octave_cv_cxx_broken_reinterpret_cast=yes)
4521+ AC_LANG_POP(C++)
4522+ ])
4523+ if test $octave_cv_cxx_broken_reinterpret_cast = yes; then
4524+ AC_DEFINE(CXX_BROKEN_REINTERPRET_CAST, 1,
4525+ [Define to 1 if C++ reinterpret_cast fails for function pointers.])
4526+ fi
4527+])
4528+dnl
4529+dnl Check if the C++ library has functions to access real and imaginary
4530+dnl parts of complex numbers independently via references.
4531+dnl
4532+AC_DEFUN([OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS], [
4533+ AC_CACHE_CHECK([whether complex class can reference components independently],
4534+ [octave_cv_cxx_complex_reference_accessors],
4535+ [AC_LANG_PUSH(C++)
4536+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4537+ #include <complex>
4538+ ]], [[
4539+ std::complex<double> x;
4540+ x.real () = 1.0;
4541+ x.imag () = 1.0;
4542+ ]])],
4543+ octave_cv_cxx_complex_reference_accessors=yes,
4544+ octave_cv_cxx_complex_reference_accessors=no)
4545+ AC_LANG_POP(C++)
4546+ ])
4547+ if test $octave_cv_cxx_complex_reference_accessors = yes; then
4548+ AC_DEFINE(HAVE_CXX_COMPLEX_REFERENCE_ACCESSORS, 1,
4549+ [Define to 1 if C++ complex class has T& real (void) and T& imag (void) methods.])
4550+ fi
4551+])
4552+dnl
4553+dnl Check if the C++ library has functions to set real and imaginary
4554+dnl parts of complex numbers independently.
4555+dnl
4556+AC_DEFUN([OCTAVE_CXX_COMPLEX_SETTERS], [
4557+ AC_CACHE_CHECK([whether complex class can set components independently],
4558+ [octave_cv_cxx_complex_setters],
4559+ [AC_LANG_PUSH(C++)
4560+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4561+ #include <complex>
4562+ ]], [[
4563+ std::complex<double> x;
4564+ x.real (1.0);
4565+ x.imag (2.0);
4566+ ]])],
4567+ octave_cv_cxx_complex_setters=yes, octave_cv_cxx_complex_setters=no)
4568+ AC_LANG_POP(C++)
4569+ ])
4570+ if test $octave_cv_cxx_complex_setters = yes; then
4571+ AC_DEFINE(HAVE_CXX_COMPLEX_SETTERS, 1,
4572+ [Define to 1 if C++ complex class has void real (T) and void imag (T) methods.])
4573+ fi
4574+])
4575+dnl
4576+dnl Check if the compiler supports dynamic auto arrays.
4577+dnl
4578+AC_DEFUN([OCTAVE_CXX_DYNAMIC_AUTO_ARRAYS], [
4579+ AC_CACHE_CHECK([whether C++ supports dynamic auto arrays],
4580+ [octave_cv_cxx_dynamic_auto_arrays],
4581+ [AC_LANG_PUSH(C++)
4582+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
4583+ void test(char *);
4584+ int length();
4585+ char x[length()];
4586+ test(x);
4587+ ]])],
4588+ octave_cv_cxx_dynamic_auto_arrays=yes,
4589+ octave_cv_cxx_dynamic_auto_arrays=no)
4590+ AC_LANG_POP(C++)
4591+ ])
4592+ if test $octave_cv_cxx_dynamic_auto_arrays = yes; then
4593+ AC_DEFINE(HAVE_DYNAMIC_AUTO_ARRAYS, 1,
4594+ [Define to 1 if C++ supports dynamic auto arrays.])
4595+ fi
4596+])
4597+dnl
4598+dnl Check if C++ compiler handles FLAG command line option. If two
4599+dnl arguments are specified, execute the second arg as shell commands.
4600+dnl Otherwise, add FLAG to CXXFLAGS if the compiler accepts the flag.
4601+dnl
4602+AC_DEFUN([OCTAVE_CXX_FLAG], [
4603+ ac_safe=`echo "$1" | $SED 'y%./+-:=%__p___%'`
4604+ AC_MSG_CHECKING([whether ${CXX-g++} accepts $1])
4605+ AC_CACHE_VAL([octave_cv_cxx_flag_$ac_safe],
4606+ [AC_LANG_PUSH(C++)
4607+ ac_octave_save_CXXFLAGS="$CXXFLAGS"
4608+ CXXFLAGS="$CXXFLAGS $1"
4609+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
4610+ eval "octave_cv_cxx_flag_$ac_safe=yes",
4611+ eval "octave_cv_cxx_flag_$ac_safe=no")
4612+ CXXFLAGS="$ac_octave_save_CXXFLAGS"
4613+ AC_LANG_POP(C++)
4614+ ])
4615+ if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then
4616+ AC_MSG_RESULT([yes])
4617+ ifelse([$2], ,
4618+ [CXXFLAGS="$CXXFLAGS $1"
4619+ AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2])
4620+ else
4621+ AC_MSG_RESULT([no])
4622+ ifelse([$3], , , [$3])
4623+ fi
4624+])
4625+dnl
4626+dnl Check if the C++ library is ISO compliant.
4627+dnl FIXME: This is obviously very simplistic, and trivially fooled.
4628+dnl
4629+AC_DEFUN([OCTAVE_CXX_ISO_COMPLIANT_LIBRARY], [
4630+ AC_REQUIRE([AC_PROG_CXX])
4631+ AC_MSG_CHECKING([if C++ library is ISO compliant])
4632+ AC_CACHE_VAL([octave_cv_cxx_iso_compliant_library],
4633+ [AC_LANG_PUSH(C++)
4634+ rm -f conftest.h
4635+ ## Omitting cwctype for now, since it is broken with gcc-3.0.x and
4636+ ## possibly other versions...
4637+ for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \
4638+ climits clocale cmath complex csetjmp csignal cstdarg cstddef \
4639+ cstdio cstdlib cstring ctime cwchar deque exception \
4640+ fstream functional iomanip ios iosfwd iostream istream iterator \
4641+ limits list locale map memory new numeric ostream queue set \
4642+ sstream stack stdexcept streambuf string strstream typeinfo \
4643+ utility valarray vector; do
4644+ echo "#include <$inc>" >> conftest.h
4645+ done
4646+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4647+ #include "conftest.h"
4648+ ]], [[
4649+ std::bitset<50> flags;
4650+ flags.set();
4651+ int digits = std::numeric_limits<unsigned long>::digits;
4652+ digits = 0;
4653+ ]])],
4654+ octave_cv_cxx_iso_compliant_library=yes,
4655+ octave_cv_cxx_iso_compliant_library=no)
4656+ AC_LANG_POP(C++)
4657+ ])
4658+ AC_MSG_RESULT([$octave_cv_cxx_iso_compliant_library])
4659+ if test $octave_cv_cxx_iso_compliant_library = yes; then
4660+ AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1,
4661+ [Define to 1 if your C++ runtime library is ISO compliant.])
4662+ fi
4663+])
4664+dnl
4665+dnl Check if C++ compiler needs the new friend template declaration
4666+dnl syntax.
4667+dnl
4668+AC_DEFUN([OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL], [
4669+ AC_REQUIRE([AC_PROG_CXX])
4670+ AC_MSG_CHECKING([for C++ support for new friend template declaration])
4671+ AC_CACHE_VAL([octave_cv_cxx_new_friend_template_decl],
4672+ [AC_LANG_PUSH(C++)
4673+ rm -f conftest.h
4674+ cat > conftest.h <<EOB
4675+ struct A {
4676+ friend int operator== (const A&, const A&);
4677+ A (int) { }
4678+ };
4679+
4680+ template <class T> int
4681+ operator== (const T&, const T&)
4682+ {
4683+ return 0;
4684+ }
4685+EOB
4686+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4687+ #include "conftest.h"
4688+ ]], [[
4689+ A a (1);
4690+ return a == A(1);
4691+ ]])],
4692+ octave_cv_cxx_new_friend_template_decl=no,
4693+ octave_cv_cxx_new_friend_template_decl=yes)
4694+ AC_LANG_POP(C++)
4695+ ])
4696+ AC_MSG_RESULT([$octave_cv_cxx_new_friend_template_decl])
4697+ if test $octave_cv_cxx_new_friend_template_decl = yes; then
4698+ AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL, 1,
4699+ [Define to 1 if your compiler supports `<>' stuff for template friends.])
4700+ fi
4701+])
4702+dnl
4703+dnl Check if the compiler supports placement delete.
4704+dnl
4705+AC_DEFUN([OCTAVE_CXX_PLACEMENT_DELETE], [
4706+ AC_CACHE_CHECK([whether <new> defines placement delete operator],
4707+ [octave_cv_cxx_placement_delete],
4708+ [AC_LANG_PUSH(C++)
4709+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4710+ #include <new>
4711+ ]], [[
4712+ operator delete((void *)0, (void *)0);
4713+ ]])],
4714+ octave_cv_cxx_placement_delete=yes,
4715+ octave_cv_cxx_placement_delete=no)
4716+ AC_LANG_POP(C++)
4717+ ])
4718+ if test $octave_cv_cxx_placement_delete = yes; then
4719+ AC_DEFINE(HAVE_PLACEMENT_DELETE, 1,
4720+ [Define to 1 if C++ supports operator delete(void *, void *).])
4721+ fi
4722+])
4723+dnl
4724+dnl Allow the user disable support for command line editing using GNU
4725+dnl readline.
4726+dnl
4727+AC_DEFUN([OCTAVE_ENABLE_READLINE], [
4728+ USE_READLINE=yes
4729+ READLINE_LIBS=
4730+ AC_ARG_ENABLE([readline],
4731+ [AS_HELP_STRING([--disable-readline],
4732+ [do not use readline library])],
4733+ [if test "$enableval" = no; then
4734+ USE_READLINE=no
4735+ warn_readline="command editing and history features require GNU Readline"
4736+ fi])
4737+ if test $USE_READLINE = yes; then
4738+ dnl RHEL 5 and older systems require termlib set before enabling readline
4739+ AC_REQUIRE([OCTAVE_CHECK_LIB_TERMLIB])
4740+ ac_octave_save_LIBS="$LIBS"
4741+ LIBS="$TERM_LIBS"
4742+ AC_CHECK_LIB([readline], [rl_set_keyboard_input_timeout],
4743+ [READLINE_LIBS="-lreadline"
4744+ AC_DEFINE(USE_READLINE, 1, [Define to 1 to use the readline library.])
4745+ ],
4746+ [AC_MSG_WARN([I need GNU Readline 4.2 or later])
4747+ AC_MSG_ERROR([this is fatal unless you specify --disable-readline])
4748+ ])
4749+ LIBS="$ac_octave_save_LIBS"
4750+ fi
4751+ AC_SUBST(READLINE_LIBS)
4752+])
4753+dnl
4754+dnl Check if Fortran compiler handles FLAG command line option. If
4755+dnl two arguments are specified, execute the second arg as shell
4756+dnl commands. Otherwise, add FLAG to FFLAGS if the compiler accepts
4757+dnl the flag.
4758+dnl
4759+AC_DEFUN([OCTAVE_F77_FLAG], [
4760+ ac_safe=`echo "$1" | $SED 'y%./+-:=%__p___%'`
4761+ AC_MSG_CHECKING([whether ${F77-g77} accepts $1])
4762+ AC_CACHE_VAL([octave_cv_f77_flag_$ac_safe], [
4763+ AC_LANG_PUSH(Fortran 77)
4764+ ac_octave_save_FFLAGS="$FFLAGS"
4765+ FFLAGS="$FFLAGS $1"
4766+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
4767+ eval "octave_cv_f77_flag_$ac_safe=yes",
4768+ eval "octave_cv_f77_flag_$ac_safe=no")
4769+ FFLAGS="$ac_octave_save_FFLAGS"
4770+ AC_LANG_POP(Fortran 77)
4771+ ])
4772+ if eval "test \"`echo '$octave_cv_f77_flag_'$ac_safe`\" = yes"; then
4773+ AC_MSG_RESULT([yes])
4774+ ifelse([$2], ,
4775+ [FFLAGS="$FFLAGS $1"
4776+ AC_MSG_RESULT([adding $1 to FFLAGS])], [$2])
4777+ else
4778+ AC_MSG_RESULT([no])
4779+ ifelse([$3], , , [$3])
4780+ fi
4781+])
4782+dnl
4783+dnl Check whether fast signed integer arithmetics using bit tricks
4784+dnl can be used in oct-inttypes.h. Defines HAVE_FAST_INT_OPS if
4785+dnl the following conditions hold:
4786+dnl 1. Signed numbers are represented by twos complement
4787+dnl (see <http://en.wikipedia.org/wiki/Two%27s_complement>)
4788+dnl 2. static_cast to unsigned int counterpart works like interpreting
4789+dnl the signed bit pattern as unsigned (and is thus zero-cost).
4790+dnl 3. Signed addition and subtraction yield the same bit results as unsigned.
4791+dnl (We use casts to prevent optimization interference, so there is no
4792+dnl need for things like -ftrapv).
4793+dnl 4. Bit operations on signed integers work like on unsigned integers,
4794+dnl except for the shifts. Shifts are arithmetic.
4795+dnl
4796+AC_DEFUN([OCTAVE_FAST_INT_OPS], [
4797+ AC_CACHE_CHECK([whether fast integer arithmetics is usable],
4798+ [octave_cv_fast_int_ops],
4799+ [AC_LANG_PUSH(C++)
4800+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4801+ #include <limits>
4802+ template<class UT, class ST>
4803+ static bool
4804+ do_test (UT, ST)
4805+ {
4806+ volatile ST s = std::numeric_limits<ST>::min () / 3;
4807+ volatile UT u = static_cast<UT> (s);
4808+ if (*(reinterpret_cast<volatile ST *> (&u)) != s) return true;
4809+
4810+ u = 0; u = ~u;
4811+ if (*(reinterpret_cast<volatile ST *> (&u)) != -1) return true;
4812+
4813+ ST sx, sy;
4814+ sx = std::numeric_limits<ST>::max () / 2 + 1;
4815+ sy = std::numeric_limits<ST>::max () / 2 + 2;
4816+ if (static_cast<ST> (static_cast<UT> (sx) + static_cast<UT> (sy))
4817+ != std::numeric_limits<ST>::min () + 1) return true;
4818+ if (static_cast<ST> (static_cast<UT> (sx) - static_cast<UT> (sy))
4819+ != -1) return true;
4820+
4821+ if ((sx & sy) != (static_cast<UT> (sx) & static_cast<UT> (sy)))
4822+ return true;
4823+ if ((sx | sy) != (static_cast<UT> (sx) | static_cast<UT> (sy)))
4824+ return true;
4825+ if ((sx ^ sy) != (static_cast<UT> (sx) ^ static_cast<UT> (sy)))
4826+ return true;
4827+ if ((-1 >> 1) != -1) return true;
4828+ return false;
4829+ }
4830+
4831+ #define DO_TEST(T) \
4832+ if (do_test (static_cast<unsigned T> (0), static_cast<signed T> (0)))\
4833+ return sizeof (T);
4834+
4835+ ]],[[
4836+
4837+ DO_TEST(char)
4838+ DO_TEST(short)
4839+ DO_TEST(int)
4840+ DO_TEST(long)
4841+ #if (defined(HAVE_LONG_LONG_INT) && defined(HAVE_UNSIGNED_LONG_LONG_INT))
4842+ DO_TEST(long long)
4843+ #endif
4844+ ]])],
4845+ octave_cv_fast_int_ops=yes,
4846+ octave_cv_fast_int_ops=no,
4847+ octave_cv_fast_int_ops=yes)
4848+ AC_LANG_POP(C++)
4849+ ])
4850+ if test $octave_cv_fast_int_ops = yes; then
4851+ AC_DEFINE(HAVE_FAST_INT_OPS, 1,
4852+ [Define to 1 if signed integers use two's complement.])
4853+ fi
4854+])
4855+dnl
4856+dnl Check to see if the compiler and the linker can handle the flags
4857+dnl "-framework $1" for the given prologue $2 and the given body $3 of
4858+dnl a source file. Arguments 2 and 3 optionally can also be empty.
4859+dnl Add options (lower case letters $1) "--with-framework-$1" and
4860+dnl "--without-framework-$1". If this test is successful then perform
4861+dnl $4, otherwise do $5.
4862+dnl
4863+AC_DEFUN([OCTAVE_HAVE_FRAMEWORK], [
4864+ AC_MSG_CHECKING([whether ${LD-ld} accepts -framework $1])
4865+ AC_CACHE_VAL([octave_cv_framework_$1],
4866+ [ac_octave_save_LDFLAGS="$LDFLAGS"
4867+ LDFLAGS="$LDFLAGS -framework $1"
4868+ AC_LANG_PUSH(C++)
4869+ AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])],
4870+ eval "octave_cv_framework_$1=yes",
4871+ eval "octave_cv_framework_$1=no")
4872+ AC_LANG_POP(C++)
4873+ LDFLAGS="$ac_octave_save_LDFLAGS"
4874+ ])
4875+ if test "$octave_cv_framework_$1" = yes; then
4876+ AC_MSG_RESULT([yes])
4877+ AC_ARG_WITH(framework-m4_tolower($1),
4878+ [AS_HELP_STRING([--without-framework-m4_tolower($1)],
4879+ [don't use framework $1])],
4880+ with_have_framework=$withval, with_have_framework=yes)
4881+ if test "$with_have_framework" = yes; then
4882+ [$4]
4883+ :
4884+ else
4885+ AC_MSG_NOTICE([framework rejected by --without-framework-m4_tolower($1)])
4886+ [$5]
4887+ fi
4888+ else
4889+ AC_MSG_RESULT([no])
4890+ [$5]
4891+ fi
4892+])
4893+dnl
4894+dnl Figure out the hardware-vendor-os info.
4895+dnl
4896+AC_DEFUN([OCTAVE_CANONICAL_HOST], [
4897+ AC_CANONICAL_HOST
4898+ if test -z "$host"; then
4899+ host=unknown-unknown-unknown
4900+ AC_MSG_WARN([configuring Octave for unknown system type])
4901+ fi
4902+ canonical_host_type=$host
4903+ AC_SUBST(canonical_host_type)
4904+ if test -z "$host_cpu"; then
4905+ host_cpu=unknown
4906+ fi
4907+ if test -z "$host_vendor"; then
4908+ host_vendor=unknown
4909+ fi
4910+ if test -z "$host_os"; then
4911+ host_os=unknown
4912+ fi
4913+])
4914+dnl
4915+dnl Check for IEEE 754 data format.
4916+dnl
4917+AC_DEFUN([OCTAVE_IEEE754_DATA_FORMAT], [
4918+ AC_MSG_CHECKING([for IEEE 754 data format])
4919+ AC_CACHE_VAL([octave_cv_ieee754_data_format],
4920+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
4921+ int
4922+ main (void)
4923+ {
4924+ typedef union { unsigned char c[8]; double d; } ieeebytes;
4925+
4926+ ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43};
4927+ ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c};
4928+
4929+ return l.d != 1234567891234567.0 && b.d != 1234567891234567.0;
4930+ }
4931+ ]])],
4932+ octave_cv_ieee754_data_format=yes,
4933+ octave_cv_ieee754_data_format=no,
4934+ octave_cv_ieee754_data_format=yes)
4935+ ])
4936+ if test "$cross_compiling" = yes; then
4937+ AC_MSG_RESULT([$octave_cv_ieee754_data_format assumed for cross compilation])
4938+ else
4939+ AC_MSG_RESULT([$octave_cv_ieee754_data_format])
4940+ fi
4941+ if test $octave_cv_ieee754_data_format = yes; then
4942+ AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1,
4943+ [Define to 1 if your system uses IEEE 754 data format.])
4944+ else
4945+ ## If the format is unknown, then you will probably not have a
4946+ ## useful system, so we will abort here. Anyone wishing to
4947+ ## experiment with building Octave on a system without IEEE
4948+ ## floating point should be capable of removing this check and
4949+ ## the one in the octave_ieee_init function in liboctave/lo-ieee.cc.
4950+ AC_MSG_ERROR([IEEE 754 data format required for building Octave])
4951+ fi
4952+])
4953+dnl
4954+dnl Check for CallInst::addAttribute API
4955+dnl
4956+AC_DEFUN([OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API], [
4957+ AC_CACHE_CHECK([check LLVM::CallInst::addAttribute arg type is llvm::Attributes],
4958+ [octave_cv_callinst_addattribute_arg_is_attributes],
4959+ [AC_LANG_PUSH(C++)
4960+ AC_COMPILE_IFELSE(
4961+ [AC_LANG_PROGRAM([[
4962+#ifdef HAVE_LLVM_IR_FUNCTION_H
4963+ #include <llvm/IR/Instructions.h>
4964+ #include <llvm/IR/Attributes.h>
4965+#else
4966+ #include <llvm/Instructions.h>
4967+ #include <llvm/Attributes.h>
4968+#endif
4969+ ]], [[
4970+ llvm::CallInst *callinst;
4971+ llvm::AttrBuilder attr_builder;
4972+ attr_builder.addAttribute(llvm::Attributes::StructRet);
4973+ llvm::Attributes attrs = llvm::Attributes::get(llvm::getGlobalContext(), attr_builder);
4974+ callinst->addAttribute (1, attrs);
4975+ ]])],
4976+ octave_cv_callinst_addattribute_arg_is_attributes=yes,
4977+ octave_cv_callinst_addattribute_arg_is_attributes=no)
4978+ AC_LANG_POP(C++)
4979+ ])
4980+ if test $octave_cv_callinst_addattribute_arg_is_attributes = yes; then
4981+ AC_DEFINE(CALLINST_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1,
4982+ [Define to 1 if llvm::CallInst:addAttribute arg type is llvm::Attributes.])
4983+ fi
4984+])
4985+dnl
4986+dnl Check for Function::addAttribute API
4987+dnl
4988+AC_DEFUN([OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API], [
4989+ AC_CACHE_CHECK([check llvm::Function::addAttribute arg type is llvm::Attributes],
4990+ [octave_cv_function_addattribute_arg_is_attributes],
4991+ [AC_LANG_PUSH(C++)
4992+ AC_COMPILE_IFELSE(
4993+ [AC_LANG_PROGRAM([[
4994+#ifdef HAVE_LLVM_IR_FUNCTION_H
4995+ #include <llvm/IR/Function.h>
4996+ #include <llvm/IR/Attributes.h>
4997+ #include <llvm/IR/LLVMContext.h>
4998+#else
4999+ #include <llvm/Function.h>
5000+ #include <llvm/Attributes.h>
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: