Mercurial > octave
comparison m4/acinclude.m4 @ 15141:4388f6518440
build: Overhaul acinclude.m4 macros.
Use indenting in m4 code to help understand what is happening.
Use Autoconf cache variable naming schema.
Properly use caching of results whenever possible.
Remove unnecessary m4_include of macros causing re-definition loops.
Convert tabs to spaces.
* configure.ac: Change macro names to match new names in acinclude.m4.
* m4/acinclude.m4: Use indenting in m4 code for better understanding.
Use Autoconf cache variable naming schema.
Properly use caching of results whenever possible.
Remove unnecessary m4_include of macros causing re-definition loops.
Convert tabs to spaces.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 10 Aug 2012 12:03:16 -0700 |
parents | edae65062740 |
children | 9cc337ced51a |
comparison
equal
deleted
inserted
replaced
15140:6ea86e1d0f5f | 15141:4388f6518440 |
---|---|
35 [m4_if(m4_translit([[$1]], [ ][ ][ | 35 [m4_if(m4_translit([[$1]], [ ][ ][ |
36 ]), [], [$3], [$2])])]) | 36 ]), [], [$3], [$2])])]) |
37 dnl | 37 dnl |
38 dnl ---------------------------------------------------------------------- | 38 dnl ---------------------------------------------------------------------- |
39 dnl | 39 dnl |
40 | |
41 dnl | |
42 dnl Alphabetical list of macros in the OCTAVE_ namespace | |
43 dnl | |
44 | |
45 dnl | |
46 dnl Check if the Carbon Framework defines CGDisplayBitsPerPixel. | |
47 dnl | |
48 AC_DEFUN([OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL], [ | |
49 AC_CACHE_CHECK([whether CGDisplayBitsPerPixel is defined in the Carbon Framework], | |
50 [octave_cv_func_carbon_cgdisplaybitsperpixel], | |
51 [AC_LANG_PUSH(C++) | |
52 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
53 #include <Carbon/Carbon.h> | |
54 ]], [[ | |
55 CGDirectDisplayID display = CGMainDisplayID (); | |
56 size_t depth = CGDisplayBitsPerPixel (display); | |
57 ]])], | |
58 octave_cv_func_carbon_cgdisplaybitsperpixel=yes, | |
59 octave_cv_func_carbon_cgdisplaybitsperpixel=no) | |
60 AC_LANG_POP(C++) | |
61 ]) | |
62 if test $octave_cv_func_carbon_cgdisplaybitsperpixel = yes; then | |
63 AC_DEFINE(HAVE_CARBON_CGDISPLAYBITSPERPIXEL, 1, | |
64 [Define to 1 if Carbon Framework has CGDisplayBitsPerPixel.]) | |
65 fi | |
66 ]) | |
67 dnl | |
68 dnl Check if C compiler handles FLAG command line option. If two | |
69 dnl arguments are specified, execute the second arg as shell commands. | |
70 dnl Otherwise, add FLAG to CFLAGS if the compiler accepts the flag. | |
71 dnl | |
72 AC_DEFUN([OCTAVE_CC_FLAG], [ | |
73 ac_safe=`echo "$1" | sed 'y% ./+-:=%___p___%'` | |
74 AC_MSG_CHECKING([whether ${CC-cc} accepts $1]) | |
75 AC_CACHE_VAL([octave_cv_cc_flag_$ac_safe], | |
76 [AC_LANG_PUSH(C) | |
77 XCFLAGS="$CFLAGS" | |
78 CFLAGS="$CFLAGS $1" | |
79 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], | |
80 [eval "octave_cv_cc_flag_$ac_safe=yes"], | |
81 [eval "octave_cv_cc_flag_$ac_safe=no"]) | |
82 CFLAGS="$XCFLAGS" | |
83 AC_LANG_POP(C) | |
84 ]) | |
85 if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then | |
86 AC_MSG_RESULT(yes) | |
87 ifelse([$2], , | |
88 [CFLAGS="$CFLAGS $1" | |
89 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2]) | |
90 else | |
91 AC_MSG_RESULT(no) | |
92 ifelse([$3], , , [$3]) | |
93 fi | |
94 ]) | |
95 dnl | |
96 dnl Check whether a math mapper function is available in <cmath>. | |
97 dnl Will define HAVE_CMATH_FUNC if there is a double variant and | |
98 dnl HAVE_CMATH_FUNCF if there is a float variant. | |
99 dnl Currently capable of checking for functions with single | |
100 dnl argument and returning bool/int/real. | |
101 dnl | |
102 AC_DEFUN([OCTAVE_CHECK_FUNC_CMATH], [ | |
103 ac_safe=`echo "$1" | sed 'y% ./+-:=%___p___%'` | |
104 | |
105 AC_CACHE_CHECK([for std::$1 in <cmath>], | |
106 [octave_cv_func_cmath_$ac_safe], | |
107 [AC_LANG_PUSH(C++) | |
108 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
109 #include <cmath> | |
110 void take_func (bool (*func) (double x)); | |
111 void take_func (int (*func) (double x)); | |
112 void take_func (double (*func) (double x)); | |
113 ]], [[ | |
114 take_func(std::$1); | |
115 ]])], | |
116 [eval "octave_cv_func_cmath_$ac_safe=yes"], | |
117 [eval "octave_cv_func_cmath_$ac_safe=no"]) | |
118 AC_LANG_POP(C++) | |
119 ]) | |
120 if eval "test \"`echo '$octave_cv_func_cmath_'$ac_safe`\" = yes"; then | |
121 AC_DEFINE(AS_TR_CPP([[HAVE_CMATH_][$1]]), 1, | |
122 [Define to 1 if <cmath> provides $1.]) | |
123 fi | |
124 | |
125 AC_CACHE_CHECK([for std::$1 (float variant) in <cmath>], | |
126 [octave_cv_func_cmath_f$ac_safe], | |
127 [AC_LANG_PUSH(C++) | |
128 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
129 #include <cmath> | |
130 void take_func (bool (*func) (float x)); | |
131 void take_func (int (*func) (float x)); | |
132 void take_func (float (*func) (float x)); | |
133 ]], [[ | |
134 take_func(std::$1); | |
135 ]])], | |
136 [eval "octave_cv_func_cmath_f$ac_safe=yes"], | |
137 [eval "octave_cv_func_cmath_f$ac_safe=no"]) | |
138 AC_LANG_POP(C++) | |
139 ]) | |
140 if eval "test \"`echo '$octave_cv_func_cmath_f'$ac_safe`\" = yes"; then | |
141 AC_DEFINE(AS_TR_CPP([[HAVE_CMATH_][$1][F]]), 1, | |
142 [Define to 1 if <cmath> provides float variant of $1.]) | |
143 fi | |
144 ]) | |
145 dnl | |
146 dnl Check if Fortran compiler has the intrinsic function ISNAN. | |
147 dnl | |
148 AC_DEFUN([OCTAVE_CHECK_FUNC_FORTRAN_ISNAN], [ | |
149 AC_CACHE_CHECK([whether $F77 has the intrinsic function ISNAN], | |
150 [octave_cv_func_fortran_isnan], | |
151 [AC_LANG_PUSH(Fortran 77) | |
152 AC_COMPILE_IFELSE( | |
153 [[ program foo | |
154 implicit none | |
155 real x | |
156 double precision y | |
157 if (isnan(x)) then | |
158 print *, 'x is NaN' | |
159 end if | |
160 if (isnan(y)) then | |
161 print *, 'y is NaN' | |
162 end if | |
163 end program | |
164 ]], | |
165 octave_cv_func_fortran_isnan=yes, octave_cv_func_fortran_isnan=no) | |
166 AC_LANG_POP(Fortran 77) | |
167 ]) | |
168 ]) | |
169 dnl | |
170 dnl Check if function gluTessCallback is called with "(...)". | |
171 dnl | |
172 AC_DEFUN([OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS], [ | |
173 AC_CACHE_CHECK([whether gluTessCallback is called with "(...)"], | |
174 [octave_cv_func_glutesscallback_threedots], | |
175 [AC_LANG_PUSH(C++) | |
176 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
177 #ifdef HAVE_GL_GLU_H | |
178 # include <GL/glu.h> | |
179 #elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL | |
180 # include <OpenGL/glu.h> | |
181 #endif | |
182 ]], [[ | |
183 GLvoid (*func)(...); | |
184 gluTessCallback(0, 0, func); | |
185 ]])], | |
186 octave_cv_func_glutesscallback_threedots=yes, | |
187 octave_cv_func_glutesscallback_threedots=no) | |
188 AC_LANG_POP(C++) | |
189 ]) | |
190 if test $octave_cv_func_glutesscallback_threedots = "yes"; then | |
191 AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1, | |
192 [Define to 1 if gluTessCallback is called with (...).]) | |
193 fi | |
194 ]) | |
195 dnl | |
196 dnl Check whether HDF5 library has version 1.6 API functions. | |
197 dnl | |
198 AC_DEFUN([OCTAVE_CHECK_HDF5_HAS_VER_16_API], [ | |
199 AC_CACHE_CHECK([whether HDF5 library has enforced version 1.6 API], | |
200 [octave_cv_hdf5_has_ver_16_api], | |
201 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
202 #include <hdf5.h> | |
203 ]], [[ | |
204 H5Eset_auto (0, 0); | |
205 ]])], | |
206 octave_cv_hdf5_has_ver_16_api=yes, | |
207 octave_cv_hdf5_has_ver_16_api=no) | |
208 ]) | |
209 if test "$octave_cv_hdf5_has_ver_16_api" != "yes"; then | |
210 AC_DEFINE(HAVE_HDF5_18, 1, [Define to 1 if >=HDF5-1.8 is available.]) | |
211 fi | |
212 ]) | |
213 dnl | |
214 dnl Usage: | |
215 dnl OCTAVE_CHECK_LIB(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC, | |
216 dnl LANG, DOC-STRING, EXTRA-CHECK) | |
217 dnl | |
218 AC_DEFUN([OCTAVE_CHECK_LIB], [ | |
219 AC_ARG_WITH([$1-includedir], | |
220 [AS_HELP_STRING([--with-$1-includedir=DIR], | |
221 [look for $2 include files in DIR])], | |
222 [m4_toupper([$1])_CPPFLAGS="-I$withval"]) | |
223 AC_SUBST(m4_toupper([$1])_CPPFLAGS) | |
224 | |
225 AC_ARG_WITH([$1-libdir], | |
226 [AS_HELP_STRING([--with-$1-libdir=DIR], | |
227 [look for $2 libraries in DIR])], | |
228 [m4_toupper([$1])_LDFLAGS="-L$withval"]) | |
229 AC_SUBST(m4_toupper([$1])_LDFLAGS) | |
230 | |
231 AC_ARG_WITH([$1], | |
232 [m4_ifblank([$7], | |
233 [AS_HELP_STRING([--without-$1], [don't use $2 library])], | |
234 [AS_HELP_STRING([--without-$1], [$7])])], | |
235 with_$1=$withval, with_$1=yes) | |
236 | |
237 m4_toupper([$1])_LIBS= | |
238 case $with_$1 in | |
239 no) | |
240 m4_toupper([$1])_LIBS= | |
241 ;; | |
242 yes | "") | |
243 m4_toupper([$1])_LIBS="-l$1" | |
244 ;; | |
245 -* | */* | *.a | *.so | *.so.* | *.o) | |
246 m4_toupper([$1])_LIBS="$with_$1" | |
247 ;; | |
248 *) | |
249 m4_toupper([$1])_LIBS="-l$with_$1" | |
250 ;; | |
251 esac | |
252 | |
253 [TEXINFO_]m4_toupper([$1])= | |
254 warn_$1="$3" | |
255 m4_set_add([summary_warning_list], [warn_$1]) | |
256 | |
257 if test -n "$m4_toupper([$1])_LIBS"; then | |
258 octave_check_lib_save_CPPFLAGS="$CPPFLAGS" | |
259 CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS" | |
260 m4_ifnblank([$6], [AC_LANG_PUSH($6)]) | |
261 octave_$1_check_for_lib=false | |
262 m4_ifblank([$4], [octave_$1_check_for_lib=true], | |
263 [AC_CHECK_HEADERS($4, [octave_$1_check_for_lib=true; break])]) | |
264 if $octave_$1_check_for_lib; then | |
265 octave_check_lib_save_LDFLAGS="$LDFLAGS" | |
266 LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS" | |
267 octave_check_lib_save_LIBS="$LIBS" | |
268 LIBS="$m4_toupper([$1])_LIBS $LIBS" | |
269 octave_$1_ok=no | |
270 AC_MSG_CHECKING([for $5 in $m4_toupper([$1])_LIBS]) | |
271 AC_LINK_IFELSE([AC_LANG_CALL([], [$5])], | |
272 [octave_$1_ok=yes]) | |
273 AC_MSG_RESULT([$octave_$1_ok]) | |
274 if test $octave_$1_ok = yes; then | |
275 m4_ifblank([$8], [ | |
276 warn_$1= | |
277 AC_DEFINE([HAVE_]m4_toupper([$1]), 1, | |
278 [Define to 1 if $2 is available.]) | |
279 [TEXINFO_]m4_toupper([$1])="@set [HAVE_]m4_toupper([$1])"], [$8]) | |
280 fi | |
281 LIBS="$octave_check_lib_save_LIBS" | |
282 LDFLAGS="$octave_check_lib_save_LDFLAGS" | |
283 fi | |
284 m4_ifnblank([$6], [AC_LANG_POP($6)]) | |
285 CPPFLAGS="$octave_check_lib_save_CPPFLAGS" | |
286 fi | |
287 AC_SUBST(m4_toupper([$1])_LIBS) | |
288 AC_SUBST([TEXINFO_]m4_toupper([$1])) | |
289 if test -n "$warn_$1"; then | |
290 AC_MSG_WARN([$warn_$1]) | |
291 m4_toupper([$1])_LIBS= | |
292 fi | |
293 ]) | |
294 dnl | |
295 dnl Check whether ARPACK works (does not crash). | |
296 dnl | |
297 dnl Using a pure Fortran program doesn't seem to crash when linked | |
298 dnl with the buggy ARPACK library but the C++ program does. Maybe it | |
299 dnl is the memory allocation that exposes the bug and using statically | |
300 dnl allocated arrays in Fortran does not? | |
301 dnl | |
302 AC_DEFUN([OCTAVE_CHECK_LIB_ARPACK_OK], [ | |
303 AC_LANG_PUSH(C++) | |
304 AC_CACHE_CHECK([whether the arpack library works], | |
305 [octave_cv_lib_arpack_ok], | |
306 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | |
307 // External functions from ARPACK library | |
308 extern "C" int | |
309 F77_FUNC (dnaupd, DNAUPD) (int&, const char *, const int&, const char *, | |
310 int&, const double&, double*, const int&, | |
311 double*, const int&, int*, int*, double*, | |
312 double*, const int&, int&, long int, long int); | |
313 | |
314 extern "C" int | |
315 F77_FUNC (dneupd, DNEUPD) (const int&, const char *, int*, double*, | |
316 double*, double*, const int&, | |
317 const double&, const double&, double*, | |
318 const char*, const int&, const char *, | |
319 int&, const double&, double*, const int&, | |
320 double*, const int&, int*, int*, double*, | |
321 double*, const int&, int&, long int, | |
322 long int, long int); | |
323 | |
324 extern "C" int | |
325 F77_FUNC (dgemv, DGEMV) (const char *, const int&, const int&, | |
326 const double&, const double*, const int&, | |
327 const double*, const int&, const double&, | |
328 double*, const int&, long int); | |
329 | |
330 #include <cfloat> | |
331 | |
332 void | |
333 doit (void) | |
334 { | |
335 // Based on function EigsRealNonSymmetricMatrix from liboctave/eigs-base.cc. | |
336 | |
337 // Problem matrix. See bug #31479 | |
338 int n = 4; | |
339 double *m = new double [n * n]; | |
340 m[0] = 1, m[4] = 0, m[8] = 0, m[12] = -1; | |
341 m[1] = 0, m[5] = 1, m[9] = 0, m[13] = 0; | |
342 m[2] = 0, m[6] = 0, m[10] = 1, m[14] = 0; | |
343 m[3] = 0, m[7] = 0, m[11] = 2, m[15] = 1; | |
344 | |
345 double *resid = new double [4]; | |
346 | |
347 resid[0] = 0.960966; | |
348 resid[1] = 0.741195; | |
349 resid[2] = 0.150143; | |
350 resid[3] = 0.868067; | |
351 | |
352 int *ip = new int [11]; | |
353 | |
354 ip[0] = 1; // ishift | |
355 ip[1] = 0; // ip[1] not referenced | |
356 ip[2] = 300; // mxiter, maximum number of iterations | |
357 ip[3] = 1; // NB blocksize in recurrence | |
358 ip[4] = 0; // nconv, number of Ritz values that satisfy convergence | |
359 ip[5] = 0; // ip[5] not referenced | |
360 ip[6] = 1; // mode | |
361 ip[7] = 0; // ip[7] to ip[10] are return values | |
362 ip[8] = 0; | |
363 ip[9] = 0; | |
364 ip[10] = 0; | |
365 | |
366 int *ipntr = new int [14]; | |
367 | |
368 int k = 1; | |
369 int p = 3; | |
370 int lwork = 3 * p * (p + 2); | |
371 | |
372 double *v = new double [n * (p + 1)]; | |
373 double *workl = new double [lwork + 1]; | |
374 double *workd = new double [3 * n + 1]; | |
375 | |
376 int ido = 0; | |
377 int info = 0; | |
378 | |
379 double tol = DBL_EPSILON; | |
380 | |
381 do | |
382 { | |
383 F77_FUNC (dnaupd, DNAUPD) (ido, "I", n, "LM", k, tol, resid, p, | |
384 v, n, ip, ipntr, workd, workl, lwork, | |
385 info, 1L, 2L); | |
386 | |
387 if (ido == -1 || ido == 1 || ido == 2) | |
388 { | |
389 double *x = workd + ipntr[0] - 1; | |
390 double *y = workd + ipntr[1] - 1; | |
391 | |
392 F77_FUNC (dgemv, DGEMV) ("N", n, n, 1.0, m, n, x, 1, 0.0, | |
393 y, 1, 1L); | |
394 } | |
395 else | |
396 { | |
397 if (info < 0) | |
398 { | |
399 return; // Error | |
400 } | |
401 | |
402 break; | |
403 } | |
404 } | |
405 while (1); | |
406 | |
407 int *sel = new int [p]; | |
408 | |
409 // In Octave, the dimensions of dr and di are k+1, but k+2 avoids segfault | |
410 double *dr = new double [k + 1]; | |
411 double *di = new double [k + 1]; | |
412 double *workev = new double [3 * p]; | |
413 | |
414 for (int i = 0; i < k + 1; i++) | |
415 dr[i] = di[i] = 0.; | |
416 | |
417 int rvec = 1; | |
418 | |
419 double sigmar = 0.0; | |
420 double sigmai = 0.0; | |
421 | |
422 // In Octave, this is n*(k+1), but n*(k+2) avoids segfault | |
423 double *z = new double [n * (k + 1)]; | |
424 | |
425 F77_FUNC (dneupd, DNEUPD) (rvec, "A", sel, dr, di, z, n, sigmar, | |
426 sigmai, workev, "I", n, "LM", k, tol, | |
427 resid, p, v, n, ip, ipntr, workd, | |
428 workl, lwork, info, 1L, 1L, 2L); | |
429 } | |
430 | |
431 ]], [[ | |
432 | |
433 for (int i = 0; i < 10; i++) | |
434 doit (); | |
435 ]])], | |
436 octave_cv_lib_arpack_ok=yes, | |
437 octave_cv_lib_arpack_ok=no, | |
438 octave_cv_lib_arpack_ok=yes) | |
439 ]) | |
440 AC_LANG_POP(C++) | |
441 if test "$octave_cv_lib_arpack_ok" = "yes"; then | |
442 $1 | |
443 else | |
444 $2 | |
445 fi | |
446 ]) | |
447 dnl | |
448 dnl Check whether using HDF5 DLL under Windows. This is done by | |
449 dnl testing for a data symbol in the HDF5 library, which would | |
450 dnl require the definition of _HDF5USEDL_ under MSVC compiler. | |
451 dnl | |
452 AC_DEFUN([OCTAVE_CHECK_LIB_HDF5_DLL], [ | |
453 AC_CACHE_CHECK([if _HDF5USEDLL_ needs to be defined], | |
454 [octave_cv_lib_hdf5_dll], | |
455 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
456 #include <hdf5.h> | |
457 ]], [[ | |
458 hid_t x = H5T_NATIVE_DOUBLE; | |
459 return x | |
460 ]])], | |
461 [octave_cv_lib_hdf5_dll=no], | |
462 [save_CFLAGS="$CFLAGS" | |
463 CFLAGS="$CFLAGS -DWIN32 -D_HDF5USEDLL_" | |
464 save_LIBS="$LIBS" | |
465 LIBS="$HDF5_LIBS $LIBS" | |
466 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
467 #include <hdf5.h> | |
468 ]], [[ | |
469 hid_t x = H5T_NATIVE_DOUBLE; | |
470 return x | |
471 ]])], | |
472 octave_cv_lib_hdf5_dll=yes, | |
473 octave_cv_lib_hdf5_dll=no) | |
474 CFLAGS="$save_CFLAGS" | |
475 LIBS="$save_LIBS" | |
476 ]) | |
477 ]) | |
478 if test "$octave_cv_lib_hdf5_dll" = yes; then | |
479 AC_DEFINE(_HDF5USEDLL_, 1, [Define to 1 if using HDF5 dll (Win32).]) | |
480 fi | |
481 ]) | |
482 dnl | |
483 dnl Check for OpenGL. If found, define OPENGL_LIBS. | |
484 dnl | |
485 dnl FIXME: The following tests should probably check for the | |
486 dnl libraries separately. | |
487 dnl | |
488 dnl FIXME: Should we allow a way to specify a directory for OpenGL | |
489 dnl libraries and header files? | |
490 dnl | |
491 AC_DEFUN([OCTAVE_CHECK_LIB_OPENGL], [ | |
492 OPENGL_LIBS= | |
493 | |
494 ## On MacOSX systems the OpenGL framework can be used | |
495 OCTAVE_HAVE_FRAMEWORK(OpenGL, [[ | |
496 #include <OpenGL/gl.h> | |
497 #include <OpenGL/glu.h> | |
498 ]], [[ | |
499 GLint par; glGetIntegerv (GL_VIEWPORT, &par); | |
500 ]], | |
501 have_framework_opengl=yes, have_framework_opengl=no) | |
502 | |
503 if test $have_framework_opengl = "yes"; then | |
504 AC_DEFINE(HAVE_FRAMEWORK_OPENGL, 1, | |
505 [Define to 1 if framework OPENGL is available.]) | |
506 OPENGL_LIBS="-Wl,-framework -Wl,OpenGL" | |
507 AC_MSG_NOTICE([adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS]) | |
508 OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS | |
509 else | |
510 case $canonical_host_type in | |
511 *-*-mingw32* | *-*-msdosmsvc) | |
512 AC_CHECK_HEADERS(windows.h) | |
513 ;; | |
514 esac | |
515 have_opengl_incs=no | |
516 AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h], | |
517 [AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h], | |
518 [have_opengl_incs=yes; break], [], [ | |
519 #ifdef HAVE_WINDOWS_H | |
520 #include <windows.h> | |
521 #endif | |
522 ]) | |
523 break | |
524 ], [], [ | |
525 #ifdef HAVE_WINDOWS_H | |
526 # include <windows.h> | |
527 #endif | |
528 ]) | |
529 | |
530 if test "$have_opengl_incs" = "yes"; then | |
531 case $canonical_host_type in | |
532 *-*-mingw32* | *-*-msdosmsvc) | |
533 save_LIBS="$LIBS" | |
534 LIBS="$LIBS -lopengl32" | |
535 AC_MSG_CHECKING([for glEnable in -lopengl32]) | |
536 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
537 #if HAVE_WINDOWS_H | |
538 # include <windows.h> | |
539 #endif | |
540 #if defined (HAVE_GL_GL_H) | |
541 # include <GL/gl.h> | |
542 #elif defined (HAVE_OPENGL_GL_H) | |
543 # include <OpenGL/gl.h> | |
544 #endif | |
545 ]], [[ | |
546 glEnable(GL_SMOOTH); | |
547 ]])], [OPENGL_LIBS="-lopengl32 -lglu32"]) | |
548 | |
549 LIBS="$save_LIBS" | |
550 if test "x$OPENGL_LIBS" != "x"; then | |
551 AC_MSG_RESULT(yes) | |
552 else | |
553 AC_MSG_RESULT(no) | |
554 fi | |
555 ;; | |
556 *) | |
557 ## Non-Mac, Non-Windows systems use this check | |
558 AC_CHECK_LIB(GL, [glEnable], [OPENGL_LIBS="-lGL -lGLU"]) | |
559 ;; | |
560 esac | |
561 fi | |
562 fi | |
563 AC_SUBST(OPENGL_LIBS) | |
564 ]) | |
565 dnl | |
566 dnl Check whether Qhull works (does not crash). | |
567 dnl | |
568 AC_DEFUN([OCTAVE_CHECK_LIB_QHULL_OK], [ | |
569 AC_CACHE_CHECK([whether the qhull library works], | |
570 [octave_cv_lib_qhull_ok], | |
571 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | |
572 #include <stdio.h> | |
573 #if defined (HAVE_LIBQHULL_LIBQHULL_H) | |
574 # include <libqhull/libqhull.h> | |
575 # include <libqhull/qset.h> | |
576 # include <libqhull/geom.h> | |
577 # include <libqhull/poly.h> | |
578 # include <libqhull/io.h> | |
579 #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H) | |
580 # if defined (HAVE_QHULL_LIBQHULL_H) | |
581 # include <qhull/libqhull.h> | |
582 # else | |
583 # include <qhull/qhull.h> | |
584 # endif | |
585 # include <qhull/qset.h> | |
586 # include <qhull/geom.h> | |
587 # include <qhull/poly.h> | |
588 # include <qhull/io.h> | |
589 #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H) | |
590 # if defined (HAVE_LIBQHULL_H) | |
591 # include <libqhull.h> | |
592 # else | |
593 # include <qhull.h> | |
594 # endif | |
595 # include <qset.h> | |
596 # include <geom.h> | |
597 # include <poly.h> | |
598 # include <io.h> | |
599 #endif | |
600 #ifdef NEED_QHULL_VERSION | |
601 char *qh_version = "version"; | |
602 #endif | |
603 ]], [[ | |
604 int dim = 2; | |
605 int n = 4; | |
606 coordT points[8] = { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5 }; | |
607 boolT ismalloc = 0; | |
608 return qh_new_qhull (dim, n, points, ismalloc, "qhull ", 0, stderr); | |
609 ]])], | |
610 octave_cv_lib_qhull_ok=yes, | |
611 octave_cv_lib_qhull_ok=no, | |
612 octave_cv_lib_qhull_ok=yes) | |
613 ]) | |
614 if test "$octave_cv_lib_qhull_ok" = "yes"; then | |
615 $1 | |
616 else | |
617 $2 | |
618 fi | |
619 ]) | |
620 dnl | |
621 dnl Check for support of OpenMP with a given compiler flag. | |
622 dnl If found define HAVE_OPENMP and add the compile flag | |
623 dnl to CFLAGS and CXXFLAGS. | |
624 dnl | |
625 AC_DEFUN([OCTAVE_CHECK_OPENMP], [ | |
626 AC_MSG_CHECKING([for support of OpenMP]) | |
627 XCFLAGS="$CFLAGS" | |
628 CFLAGS="$CFLAGS $1" | |
629 AC_CACHE_VAL([octave_cv_check_openmp], | |
630 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
631 #include <omp.h> | |
632 #include <stdio.h> | |
633 ]], [[ | |
634 int main(int argc, char* argv[]) | |
635 { | |
636 _Pragma("omp parallel") | |
637 printf("Hello, world.\n"); | |
638 return 0; | |
639 } | |
640 ]])], | |
641 octave_cv_openmp=yes, octave_cv_openmmp=no, octave_cv_openmp=no) | |
642 ]) | |
643 AC_MSG_RESULT([$octave_cv_openmp]) | |
644 if test "$octave_cv_openmp" = yes; then | |
645 AC_DEFINE(HAVE_OPENMP, 1, [Define to 1 if compiler supports OpenMP.]) | |
646 CXXFLAGS="$CXXFLAGS $1" | |
647 else | |
648 CFLAGS="$XCFLAGS" | |
649 fi | |
650 ]) | |
651 dnl | |
652 dnl Check for the Qhull version. | |
653 dnl | |
654 AC_DEFUN([OCTAVE_CHECK_QHULL_VERSION], [ | |
655 AC_CACHE_CHECK([for qh_version in $QHULL_LIBS], | |
656 [octave_cv_lib_qhull_version], | |
657 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
658 #include <stdio.h> | |
659 #if defined (HAVE_LIBQHULL_LIBQHULL_H) | |
660 # include <libqhull/libqhull.h> | |
661 # include <libqhull/qset.h> | |
662 # include <libqhull/geom.h> | |
663 # include <libqhull/poly.h> | |
664 # include <libqhull/io.h> | |
665 #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H) | |
666 # if defined (HAVE_QHULL_LIBQHULL_H) | |
667 # include <qhull/libqhull.h> | |
668 # else | |
669 # include <qhull/qhull.h> | |
670 # endif | |
671 # include <qhull/qset.h> | |
672 # include <qhull/geom.h> | |
673 # include <qhull/poly.h> | |
674 # include <qhull/io.h> | |
675 #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H) | |
676 # if defined (HAVE_LIBQHULL_H) | |
677 # include <libqhull.h> | |
678 # else | |
679 # include <qhull.h> | |
680 # endif | |
681 # include <qset.h> | |
682 # include <geom.h> | |
683 # include <poly.h> | |
684 # include <io.h> | |
685 #endif | |
686 ]], [[ | |
687 const char *tmp = qh_version; | |
688 ]])], | |
689 octave_cv_lib_qhull_version=yes, octave_cv_lib_qhull_version=no) | |
690 ]) | |
691 if test "$octave_cv_lib_qhull_version" = no; then | |
692 AC_DEFINE(NEED_QHULL_VERSION, 1, | |
693 [Define to 1 if the Qhull library needs a qh_version variable defined.]) | |
694 fi | |
695 ]) | |
696 dnl | |
697 dnl Check if the default Fortran INTEGER is 64 bits wide. | |
698 dnl | |
699 AC_DEFUN([OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER], [ | |
700 AC_CACHE_CHECK([whether $F77 generates correct size integers], | |
701 [octave_cv_sizeof_fortran_integer], | |
702 [octave_fintsize_save_FFLAGS="$FFLAGS" | |
703 FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG" | |
704 AC_LANG_PUSH(Fortran 77) | |
705 AC_COMPILE_IFELSE( | |
706 [[ subroutine foo(n, in, out) | |
707 integer n, in(n), out(n) | |
708 integer i | |
709 do 10 i = 1, n | |
710 out(i) = in(i) | |
711 10 continue | |
712 return | |
713 end | |
714 ]], | |
715 [mv conftest.$ac_objext fintsize.$ac_objext | |
716 octave_fintsize_save_LIBS="$LIBS" | |
717 LIBS="fintsize.$ac_objext $[]_AC_LANG_PREFIX[]LIBS" | |
718 AC_LANG_PUSH(C) | |
719 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | |
720 #include <assert.h> ]], [[ | |
721 #ifdef USE_64_BIT_IDX_T | |
722 #if IDX_TYPE_LONG | |
723 typedef long octave_idx_type; | |
724 #else | |
725 typedef int octave_idx_type; | |
726 #endif | |
727 #else | |
728 typedef int octave_idx_type; | |
729 #endif | |
730 octave_idx_type n = 2; | |
731 octave_idx_type in[2]; | |
732 octave_idx_type out[2]; | |
733 in[0] = 13; | |
734 in[0] = 42; | |
735 F77_FUNC(foo,FOO) (&n, &in, &out); | |
736 assert (in[0] == out[0] && in[1] == out[1]); | |
737 ]])], | |
738 octave_cv_sizeof_fortran_integer=yes, | |
739 octave_cv_sizeof_fortran_integer=no, | |
740 octave_cv_sizeof_fortran_integer=yes) | |
741 AC_LANG_POP(C) | |
742 LIBS="$octave_fintsize_save_LIBS" | |
743 rm -f conftest.$ac_objext fintsize.$ac_objext], | |
744 [rm -f conftest.$ac_objext | |
745 AC_MSG_FAILURE([cannot compile a simple Fortran program]) | |
746 octave_cv_sizeof_fortran_integer=no]) | |
747 AC_LANG_POP(Fortran 77) | |
748 FFLAGS="$octave_fintsize_save_FFLAGS" | |
749 ]) | |
750 ]) | |
751 dnl | |
752 dnl Add warning to final summary. | |
753 dnl | |
754 AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [ | |
755 AC_MSG_WARN([$][$1]) | |
756 m4_set_add([summary_warning_list], [$1]) | |
757 ]) | |
758 dnl | |
759 dnl Print final summary. | |
760 dnl | |
761 AC_DEFUN([OCTAVE_CONFIGURE_WARNING_SUMMARY], [ | |
762 m4_set_foreach([summary_warning_list], [elt], [ | |
763 if test -n "[$]elt"; then | |
764 AC_MSG_WARN([$]elt) | |
765 warn_msg_printed=true | |
766 fi]) | |
767 ]) | |
768 dnl | |
769 dnl Check if the C++ library has the bit_and, bit_or, and bit_xor | |
770 dnl templates defined. | |
771 dnl | |
772 AC_DEFUN([OCTAVE_CXX_BITWISE_OP_TEMPLATES], [ | |
773 AC_CACHE_CHECK([whether bit_and, bit_or, bit_xor are defined in the C++ library], | |
774 [octave_cv_cxx_bitwise_op_templates], | |
775 [AC_LANG_PUSH(C++) | |
776 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
777 #include <functional> | |
778 ]], [[ | |
779 int x = 0; | |
780 int y = 1; | |
781 int z1 = std::bit_and<int>() (x, y); | |
782 int z2 = std::bit_or<int>() (x, y); | |
783 int z3 = std::bit_xor<int>() (x, y); | |
784 ]])], | |
785 octave_cv_cxx_bitwise_op_templates=yes, | |
786 octave_cv_cxx_bitwise_op_templates=no) | |
787 AC_LANG_POP(C++) | |
788 ]) | |
789 if test $octave_cv_cxx_bitwise_op_templates = yes; then | |
790 AC_DEFINE(HAVE_CXX_BITWISE_OP_TEMPLATES, 1, | |
791 [Define to 1 if C++ library has templated bitwise operators.]) | |
792 fi | |
793 ]) | |
794 dnl | |
795 dnl Check if C++ reinterpret cast works for function pointers. | |
796 dnl | |
797 AC_DEFUN([OCTAVE_CXX_BROKEN_REINTERPRET_CAST], | |
798 [AC_REQUIRE([AC_PROG_CXX]) | |
799 AC_CACHE_CHECK([for broken C++ reinterpret_cast], | |
800 [octave_cv_cxx_broken_reinterpret_cast], | |
801 [AC_LANG_PUSH(C++) | |
802 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
803 #include <cmath> ]], [[ | |
804 typedef double (*fptr) (double); | |
805 fptr psin = sin; | |
806 void *vptr = reinterpret_cast<void *> (psin); | |
807 psin = reinterpret_cast<fptr> (vptr); | |
808 ]])], | |
809 octave_cv_cxx_broken_reinterpret_cast=no, | |
810 octave_cv_cxx_broken_reinterpret_cast=yes) | |
811 AC_LANG_POP(C++) | |
812 ]) | |
813 if test $octave_cv_cxx_broken_reinterpret_cast = yes ; then | |
814 AC_DEFINE(CXX_BROKEN_REINTERPRET_CAST, 1, | |
815 [Define to 1 if C++ reinterpret_cast fails for function pointers.]) | |
816 fi | |
817 ]) | |
818 dnl | |
819 dnl Check if the C++ library has functions to access real and imaginary | |
820 dnl parts of complex numbers independently via references. | |
821 dnl | |
822 AC_DEFUN([OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS], [ | |
823 AC_CACHE_CHECK([whether complex class can reference components independently], | |
824 [octave_cv_cxx_complex_reference_accessors], | |
825 [AC_LANG_PUSH(C++) | |
826 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
827 #include <complex> | |
828 ]], [[ | |
829 std::complex<double> x; | |
830 x.real () = 1.0; | |
831 x.imag () = 1.0; | |
832 ]])], | |
833 octave_cv_cxx_complex_reference_accessors=yes, | |
834 octave_cv_cxx_complex_reference_accessors=no) | |
835 AC_LANG_POP(C++) | |
836 ]) | |
837 if test $octave_cv_cxx_complex_reference_accessors = yes; then | |
838 AC_DEFINE(HAVE_CXX_COMPLEX_REFERENCE_ACCESSORS, 1, | |
839 [Define to 1 if C++ complex class has T& real (void) and T& imag (void) methods.]) | |
840 fi | |
841 ]) | |
842 dnl | |
843 dnl Check if the C++ library has functions to set real and imaginary | |
844 dnl parts of complex numbers independently. | |
845 dnl | |
846 AC_DEFUN([OCTAVE_CXX_COMPLEX_SETTERS], [ | |
847 AC_CACHE_CHECK([whether complex class can set components independently], | |
848 [octave_cv_cxx_complex_setters], | |
849 [AC_LANG_PUSH(C++) | |
850 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
851 #include <complex> | |
852 ]], [[ | |
853 std::complex<double> x; | |
854 x.real (1.0); | |
855 x.imag (2.0); | |
856 ]])], | |
857 octave_cv_cxx_complex_setters=yes, octave_cv_cxx_complex_setters=no) | |
858 AC_LANG_POP(C++) | |
859 ]) | |
860 if test $octave_cv_cxx_complex_setters = yes; then | |
861 AC_DEFINE(HAVE_CXX_COMPLEX_SETTERS, 1, | |
862 [Define to 1 if C++ complex class has void real (T) and void imag (T) methods.]) | |
863 fi | |
864 ]) | |
865 dnl | |
866 dnl Check if the compiler supports dynamic auto arrays. | |
867 dnl | |
868 AC_DEFUN([OCTAVE_CXX_DYNAMIC_AUTO_ARRAYS], [ | |
869 AC_CACHE_CHECK([whether C++ supports dynamic auto arrays], | |
870 [octave_cv_cxx_dynamic_auto_arrays], | |
871 [AC_LANG_PUSH(C++) | |
872 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ | |
873 void test(char *); | |
874 int length(); | |
875 char x[length()]; | |
876 test(x); | |
877 ]])], | |
878 octave_cv_cxx_dynamic_auto_arrays=yes, | |
879 octave_cv_cxx_dynamic_auto_arrays=no) | |
880 AC_LANG_POP(C++) | |
881 ]) | |
882 if test $octave_cv_cxx_dynamic_auto_arrays = yes; then | |
883 AC_DEFINE(HAVE_DYNAMIC_AUTO_ARRAYS, 1, | |
884 [Define to 1 if C++ supports dynamic auto arrays.]) | |
885 fi | |
886 ]) | |
887 dnl | |
888 dnl Check if C++ compiler handles FLAG command line option. If two | |
889 dnl arguments are specified, execute the second arg as shell commands. | |
890 dnl Otherwise, add FLAG to CXXFLAGS if the compiler accepts the flag. | |
891 dnl | |
892 AC_DEFUN([OCTAVE_CXX_FLAG], [ | |
893 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` | |
894 AC_MSG_CHECKING([whether ${CXX-g++} accepts $1]) | |
895 AC_CACHE_VAL([octave_cv_cxx_flag_$ac_safe], | |
896 [AC_LANG_PUSH(C++) | |
897 XCXXFLAGS="$CXXFLAGS" | |
898 CXXFLAGS="$CXXFLAGS $1" | |
899 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], | |
900 eval "octave_cv_cxx_flag_$ac_safe=yes", | |
901 eval "octave_cv_cxx_flag_$ac_safe=no") | |
902 CXXFLAGS="$XCXXFLAGS" | |
903 AC_LANG_POP(C++) | |
904 ]) | |
905 if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then | |
906 AC_MSG_RESULT(yes) | |
907 ifelse([$2], , | |
908 [CXXFLAGS="$CXXFLAGS $1" | |
909 AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2]) | |
910 else | |
911 AC_MSG_RESULT(no) | |
912 ifelse([$3], , , [$3]) | |
913 fi | |
914 ]) | |
915 dnl | |
916 dnl Check if the C++ library is ISO compliant. | |
917 dnl FIXME: This is obviously very simplistic, and trivially fooled. | |
918 dnl | |
919 AC_DEFUN([OCTAVE_CXX_ISO_COMPLIANT_LIBRARY], [ | |
920 AC_REQUIRE([AC_PROG_CXX]) | |
921 AC_MSG_CHECKING([if C++ library is ISO compliant]) | |
922 AC_CACHE_VAL([octave_cv_cxx_iso_compliant_library], | |
923 [AC_LANG_PUSH(C++) | |
924 rm -f conftest.h | |
925 ## Omitting cwctype for now, since it is broken with gcc-3.0.x and | |
926 ## possibly other versions... | |
927 for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \ | |
928 climits clocale cmath complex csetjmp csignal cstdarg cstddef \ | |
929 cstdio cstdlib cstring ctime cwchar deque exception \ | |
930 fstream functional iomanip ios iosfwd iostream istream iterator \ | |
931 limits list locale map memory new numeric ostream queue set \ | |
932 sstream stack stdexcept streambuf string strstream typeinfo \ | |
933 utility valarray vector; do | |
934 echo "#include <$inc>" >> conftest.h | |
935 done | |
936 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
937 #include "conftest.h" | |
938 ]], [[ | |
939 std::bitset<50> flags; | |
940 flags.set(); | |
941 int digits = std::numeric_limits<unsigned long>::digits; | |
942 digits = 0; | |
943 ]])], | |
944 octave_cv_cxx_iso_compliant_library=yes, | |
945 octave_cv_cxx_iso_compliant_library=no) | |
946 AC_LANG_POP(C++) | |
947 ]) | |
948 AC_MSG_RESULT([$octave_cv_cxx_iso_compliant_library]) | |
949 if test $octave_cv_cxx_iso_compliant_library = yes; then | |
950 AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, | |
951 [Define to 1 if your C++ runtime library is ISO compliant.]) | |
952 fi | |
953 ]) | |
954 dnl | |
955 dnl Check if C++ compiler needs the new friend template declaration | |
956 dnl syntax. | |
957 dnl | |
958 AC_DEFUN([OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL], [ | |
959 AC_REQUIRE([AC_PROG_CXX]) | |
960 AC_MSG_CHECKING([for C++ support for new friend template declaration]) | |
961 AC_CACHE_VAL([octave_cv_cxx_new_friend_template_decl], | |
962 [AC_LANG_PUSH(C++) | |
963 rm -f conftest.h | |
964 cat > conftest.h <<EOB | |
965 struct A { | |
966 friend int operator== (const A&, const A&); | |
967 A (int) { } | |
968 }; | |
969 | |
970 template <class T> int | |
971 operator== (const T&, const T&) | |
972 { | |
973 return 0; | |
974 } | |
975 EOB | |
976 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
977 #include "conftest.h" | |
978 ]], [[ | |
979 A a (1); | |
980 return a == A(1); | |
981 ]])], | |
982 octave_cv_cxx_new_friend_template_decl=no, | |
983 octave_cv_cxx_new_friend_template_decl=yes) | |
984 AC_LANG_POP(C++) | |
985 ]) | |
986 AC_MSG_RESULT([$octave_cv_cxx_new_friend_template_decl]) | |
987 if test $octave_cv_cxx_new_friend_template_decl = yes; then | |
988 AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL, 1, | |
989 [Define to 1 if your compiler supports `<>' stuff for template friends.]) | |
990 fi | |
991 ]) | |
992 dnl | |
993 dnl Check if the compiler supports placement delete. | |
994 dnl | |
995 AC_DEFUN([OCTAVE_CXX_PLACEMENT_DELETE], [ | |
996 AC_CACHE_CHECK([whether <new> defines placement delete operator], | |
997 [octave_cv_cxx_placement_delete], | |
998 [AC_LANG_PUSH(C++) | |
999 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
1000 #include <new> | |
1001 ]], [[ | |
1002 operator delete((void *)0, (void *)0); | |
1003 ]])], | |
1004 octave_cv_cxx_placement_delete=yes, | |
1005 octave_cv_cxx_placement_delete=no) | |
1006 AC_LANG_POP(C++) | |
1007 ]) | |
1008 if test $octave_cv_cxx_placement_delete = yes; then | |
1009 AC_DEFINE(HAVE_PLACEMENT_DELETE, 1, | |
1010 [Define to 1 if C++ supports operator delete(void *, void *).]) | |
1011 fi | |
1012 ]) | |
1013 dnl | |
1014 dnl Allow the user disable support for command line editing using GNU | |
1015 dnl readline. | |
1016 dnl | |
1017 AC_DEFUN([OCTAVE_ENABLE_READLINE], [ | |
1018 USE_READLINE=true | |
1019 READLINE_LIBS= | |
1020 AC_ARG_ENABLE(readline, | |
1021 [AS_HELP_STRING([--enable-readline], | |
1022 [use readline library (default is yes)])], | |
1023 [if test "$enableval" = no; then | |
1024 USE_READLINE=false | |
1025 warn_readline="command editing and history features require GNU Readline" | |
1026 fi]) | |
1027 if $USE_READLINE; then | |
1028 save_LIBS="$LIBS" | |
1029 LIBS="$TERM_LIBS" | |
1030 AC_CHECK_LIB(readline, rl_set_keyboard_input_timeout, | |
1031 [READLINE_LIBS="-lreadline" | |
1032 AC_DEFINE(USE_READLINE, 1, [Define to 1 to use the readline library.]) | |
1033 ], | |
1034 [AC_MSG_WARN([I need GNU Readline 4.2 or later]) | |
1035 AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) | |
1036 ]) | |
1037 LIBS="$save_LIBS" | |
1038 fi | |
1039 AC_SUBST(READLINE_LIBS) | |
1040 ]) | |
1041 dnl | |
1042 dnl Check if Fortran compiler handles FLAG command line option. If | |
1043 dnl two arguments are specified, execute the second arg as shell | |
1044 dnl commands. Otherwise, add FLAG to FFLAGS if the compiler accepts | |
1045 dnl the flag. | |
1046 dnl | |
1047 AC_DEFUN([OCTAVE_F77_FLAG], [ | |
1048 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` | |
1049 AC_MSG_CHECKING([whether ${F77-g77} accepts $1]) | |
1050 AC_CACHE_VAL(octave_cv_f77_flag_$ac_safe, [ | |
1051 AC_LANG_PUSH(Fortran 77) | |
1052 XFFLAGS="$FFLAGS" | |
1053 FFLAGS="$FFLAGS $1" | |
1054 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], | |
1055 eval "octave_cv_f77_flag_$ac_safe=yes", | |
1056 eval "octave_cv_f77_flag_$ac_safe=no") | |
1057 FFLAGS="$XFFLAGS" | |
1058 AC_LANG_POP(Fortran 77) | |
1059 ]) | |
1060 if eval "test \"`echo '$octave_cv_f77_flag_'$ac_safe`\" = yes"; then | |
1061 AC_MSG_RESULT(yes) | |
1062 ifelse([$2], , | |
1063 [FFLAGS="$FFLAGS $1" | |
1064 AC_MSG_RESULT([adding $1 to FFLAGS])], [$2]) | |
1065 else | |
1066 AC_MSG_RESULT(no) | |
1067 ifelse([$3], , , [$3]) | |
1068 fi | |
1069 ]) | |
1070 dnl | |
1071 dnl Check whether fast signed integer arithmetics using bit tricks | |
1072 dnl can be used in oct-inttypes.h. Defines HAVE_FAST_INT_OPS if | |
1073 dnl the following conditions hold: | |
1074 dnl 1. Signed numbers are represented by twos complement | |
1075 dnl (see <http://en.wikipedia.org/wiki/Two%27s_complement>) | |
1076 dnl 2. static_cast to unsigned int counterpart works like interpreting | |
1077 dnl the signed bit pattern as unsigned (and is thus zero-cost). | |
1078 dnl 3. Signed addition and subtraction yield the same bit results as unsigned. | |
1079 dnl (We use casts to prevent optimization interference, so there is no | |
1080 dnl need for things like -ftrapv). | |
1081 dnl 4. Bit operations on signed integers work like on unsigned integers, | |
1082 dnl except for the shifts. Shifts are arithmetic. | |
1083 dnl | |
1084 AC_DEFUN([OCTAVE_FAST_INT_OPS], [ | |
1085 AC_CACHE_CHECK([whether fast integer arithmetics is usable], | |
1086 [octave_cv_fast_int_ops], | |
1087 [AC_LANG_PUSH(C++) | |
1088 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | |
1089 #include <limits> | |
1090 template<class UT, class ST> | |
1091 static bool | |
1092 do_test (UT, ST) | |
1093 { | |
1094 volatile ST s = std::numeric_limits<ST>::min () / 3; | |
1095 volatile UT u = static_cast<UT> (s); | |
1096 if (*(reinterpret_cast<volatile ST *> (&u)) != s) return true; | |
1097 | |
1098 u = 0; u = ~u; | |
1099 if (*(reinterpret_cast<volatile ST *> (&u)) != -1) return true; | |
1100 | |
1101 ST sx, sy; | |
1102 sx = std::numeric_limits<ST>::max () / 2 + 1; | |
1103 sy = std::numeric_limits<ST>::max () / 2 + 2; | |
1104 if (static_cast<ST> (static_cast<UT> (sx) + static_cast<UT> (sy)) | |
1105 != std::numeric_limits<ST>::min () + 1) return true; | |
1106 if (static_cast<ST> (static_cast<UT> (sx) - static_cast<UT> (sy)) | |
1107 != -1) return true; | |
1108 | |
1109 if ((sx & sy) != (static_cast<UT> (sx) & static_cast<UT> (sy))) | |
1110 return true; | |
1111 if ((sx | sy) != (static_cast<UT> (sx) | static_cast<UT> (sy))) | |
1112 return true; | |
1113 if ((sx ^ sy) != (static_cast<UT> (sx) ^ static_cast<UT> (sy))) | |
1114 return true; | |
1115 if ((-1 >> 1) != -1) return true; | |
1116 return false; | |
1117 } | |
1118 | |
1119 #define DO_TEST(T) \ | |
1120 if (do_test (static_cast<unsigned T> (0), static_cast<signed T> (0)))\ | |
1121 return sizeof (T); | |
1122 | |
1123 ]],[[ | |
1124 | |
1125 DO_TEST(char) | |
1126 DO_TEST(short) | |
1127 DO_TEST(int) | |
1128 DO_TEST(long) | |
1129 #if (defined(HAVE_LONG_LONG_INT) && defined(HAVE_UNSIGNED_LONG_LONG_INT)) | |
1130 DO_TEST(long long) | |
1131 #endif | |
1132 ]])], | |
1133 octave_cv_fast_int_ops=yes, | |
1134 octave_cv_fast_int_ops=no, | |
1135 octave_cv_fast_int_ops=yes) | |
1136 AC_LANG_POP(C++) | |
1137 ]) | |
1138 if test $octave_cv_fast_int_ops = yes; then | |
1139 AC_DEFINE(HAVE_FAST_INT_OPS, 1, | |
1140 [Define to 1 if signed integers use two's complement.]) | |
1141 fi | |
1142 ]) | |
1143 dnl | |
1144 dnl Check to see if the compiler and the linker can handle the flags | |
1145 dnl "-framework $1" for the given prologue $2 and the given body $3 of | |
1146 dnl a source file. Arguments 2 and 3 optionally can also be empty. | |
1147 dnl Add options (lower case letters $1) "--with-framework-$1" and | |
1148 dnl "--without-framework-$1". If this test is successful then perform | |
1149 dnl $4, otherwise do $5. | |
1150 dnl | |
1151 AC_DEFUN([OCTAVE_HAVE_FRAMEWORK], [ | |
1152 AC_MSG_CHECKING([whether ${LD-ld} accepts -framework $1]) | |
1153 AC_CACHE_VAL([octave_cv_framework_$1], | |
1154 [XLDFLAGS="$LDFLAGS" | |
1155 LDFLAGS="$LDFLAGS -framework $1" | |
1156 AC_LANG_PUSH(C++) | |
1157 AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])], | |
1158 eval "octave_cv_framework_$1=yes", | |
1159 eval "octave_cv_framework_$1=no") | |
1160 AC_LANG_POP(C++) | |
1161 LDFLAGS="$XLDFLAGS" | |
1162 ]) | |
1163 if test "$octave_cv_framework_$1" = "yes"; then | |
1164 AC_MSG_RESULT(yes) | |
1165 AC_ARG_WITH(framework-m4_tolower($1), | |
1166 [AS_HELP_STRING([--without-framework-m4_tolower($1)], | |
1167 [don't use framework $1])], | |
1168 with_have_framework=$withval, with_have_framework=yes) | |
1169 if test "$with_have_framework" = "yes"; then | |
1170 [$4] | |
1171 else | |
1172 AC_MSG_NOTICE([framework rejected by --without-framework-m4_tolower($1)]) | |
1173 [$5] | |
1174 fi | |
1175 else | |
1176 AC_MSG_RESULT(no) | |
1177 [$5] | |
1178 fi | |
1179 ]) | |
1180 dnl | |
40 dnl Figure out the hardware-vendor-os info. | 1181 dnl Figure out the hardware-vendor-os info. |
41 dnl | 1182 dnl |
42 AC_DEFUN([OCTAVE_HOST_TYPE], | 1183 dnl Hanging '])' in AC_MSG_WARN is for adding newline to output |
43 [AC_CANONICAL_HOST | 1184 dnl |
44 if test -z "$host"; then | 1185 AC_DEFUN([OCTAVE_HOST_TYPE], [ |
45 host=unknown | 1186 AC_CANONICAL_HOST |
46 fi | 1187 if test -z "$host"; then |
47 canonical_host_type=$host | 1188 host=unknown |
48 if test "$host" = unknown; then | 1189 fi |
49 AC_MSG_WARN([configuring Octave for unknown system type | 1190 canonical_host_type=$host |
50 ]) | 1191 if test "$host" = unknown; then |
51 fi | 1192 AC_MSG_WARN([configuring Octave for unknown system type |
52 AC_SUBST(canonical_host_type)]) | 1193 ]) |
1194 fi | |
1195 AC_SUBST(canonical_host_type) | |
1196 ]) | |
1197 dnl | |
1198 dnl Check for IEEE 754 data format. | |
1199 dnl | |
1200 AC_DEFUN([OCTAVE_IEEE754_DATA_FORMAT], [ | |
1201 AC_MSG_CHECKING([for IEEE 754 data format]) | |
1202 AC_CACHE_VAL([octave_cv_ieee754_data_format], | |
1203 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
1204 int | |
1205 main (void) | |
1206 { | |
1207 typedef union { unsigned char c[8]; double d; } ieeebytes; | |
1208 | |
1209 ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43}; | |
1210 ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c}; | |
1211 | |
1212 return l.d != 1234567891234567.0 && b.d != 1234567891234567.0; | |
1213 } | |
1214 ]])], | |
1215 octave_cv_ieee754_data_format=yes, | |
1216 octave_cv_ieee754_data_format=no, | |
1217 octave_cv_ieee754_data_format=yes) | |
1218 ]) | |
1219 if test "$cross_compiling" = yes; then | |
1220 AC_MSG_RESULT([$octave_cv_ieee754_data_format assumed for cross compilation]) | |
1221 else | |
1222 AC_MSG_RESULT([$octave_cv_ieee754_data_format]) | |
1223 fi | |
1224 if test "$octave_cv_ieee754_data_format" = yes; then | |
1225 AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1, | |
1226 [Define to 1 if your system uses IEEE 754 data format.]) | |
1227 else | |
1228 ## If the format is unknown, then you will probably not have a | |
1229 ## useful system, so we will abort here. Anyone wishing to | |
1230 ## experiment with building Octave on a system without IEEE | |
1231 ## floating point should be capable of removing this check and | |
1232 ## the one in the octave_ieee_init function in liboctave/lo-ieee.cc. | |
1233 AC_MSG_ERROR([IEEE 754 data format required for building Octave]) | |
1234 fi | |
1235 ]) | |
1236 dnl | |
1237 dnl Check for ar. | |
1238 dnl | |
1239 AC_DEFUN([OCTAVE_PROG_AR], [ | |
1240 if test -z "$AR"; then | |
1241 AR=ar | |
1242 fi | |
1243 AC_SUBST(AR) | |
1244 | |
1245 if test -z "$ARFLAGS"; then | |
1246 ARFLAGS="rc" | |
1247 fi | |
1248 AC_SUBST(ARFLAGS) | |
1249 ]) | |
1250 dnl | |
1251 dnl Check for bison. | |
1252 dnl | |
1253 AC_DEFUN([OCTAVE_PROG_BISON], [ | |
1254 AC_PROG_YACC | |
1255 case "$YACC" in | |
1256 bison*) | |
1257 ;; | |
1258 *) | |
1259 YACC='$(top_srcdir)/build-aux/missing bison' | |
1260 warn_bison=" | |
1261 | |
1262 I didn't find bison, but it's only a problem if you need to | |
1263 reconstruct parse.cc, which is the case if you're building from VCS | |
1264 sources. | |
1265 " | |
1266 OCTAVE_CONFIGURE_WARNING([warn_bison]) | |
1267 ;; | |
1268 esac | |
1269 ]) | |
1270 dnl | |
1271 dnl Find desktop-file-install program. | |
1272 dnl | |
1273 AC_DEFUN([OCTAVE_PROG_DESKTOP_FILE_INSTALL], [ | |
1274 AC_CHECK_PROG(DESKTOP_FILE_INSTALL, desktop-file-install, desktop-file-install, []) | |
1275 AC_SUBST(DESKTOP_FILE_INSTALL) | |
1276 ]) | |
1277 dnl | |
1278 dnl Find find program. | |
1279 dnl | |
1280 # Prefer GNU find if found. | |
1281 AN_MAKEVAR([FIND], [OCTAVE_PROG_FIND]) | |
1282 AN_PROGRAM([gfind], [OCTAVE_PROG_FIND]) | |
1283 AN_PROGRAM([find], [OCTAVE_PROG_FIND]) | |
1284 AC_DEFUN([OCTAVE_PROG_FIND], [ | |
1285 AC_CHECK_PROGS(FIND, [gfind find]) | |
1286 ]) | |
1287 dnl | |
1288 dnl Check for flex. | |
1289 dnl | |
1290 AC_DEFUN([OCTAVE_PROG_FLEX], [ | |
1291 ## For now, don't define LEXLIB to be -lfl -- we don't use anything in | |
1292 ## it, and it might not be installed. | |
1293 ## | |
1294 ## Also make sure that we generate an interactive scanner if we are | |
1295 ## using flex. | |
1296 AC_PROG_LEX | |
1297 case "$LEX" in | |
1298 flex*) | |
1299 LFLAGS="-I" | |
1300 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) | |
1301 LEXLIB= | |
1302 ;; | |
1303 *) | |
1304 LEX='$(top_srcdir)/build-aux/missing flex' | |
1305 warn_flex=" | |
1306 | |
1307 I didn't find flex, but it's only a problem if you need to reconstruct | |
1308 lex.cc, which is the case if you're building from VCS sources. | |
1309 " | |
1310 OCTAVE_CONFIGURE_WARNING([warn_flex]) | |
1311 ;; | |
1312 esac | |
1313 AC_SUBST(LFLAGS) | |
1314 ]) | |
1315 dnl | |
1316 dnl Check for ghostscript. | |
1317 dnl | |
1318 AC_DEFUN([OCTAVE_PROG_GHOSTSCRIPT], [ | |
1319 case "$canonical_host_type" in | |
1320 *-*-mingw* | *-*-msdosmsvc) | |
1321 gs_names="gswin32c gs mgs" | |
1322 ;; | |
1323 *) | |
1324 gs_names="gs" | |
1325 ;; | |
1326 esac | |
1327 AC_CHECK_PROGS(GHOSTSCRIPT, [$gs_names]) | |
1328 if test -z "$GHOSTSCRIPT"; then | |
1329 GHOSTSCRIPT='$(top_srcdir)/build-aux/missing gs' | |
1330 warn_ghostscript=" | |
1331 | |
1332 I didn't find ghostscript, so reconstructing figures for the manual | |
1333 will fail, and saving graphics in some output formats will fail when | |
1334 using Octave | |
1335 " | |
1336 OCTAVE_CONFIGURE_WARNING([warn_ghostscript]) | |
1337 fi | |
1338 AC_SUBST(GHOSTSCRIPT) | |
1339 ]) | |
1340 dnl | |
1341 dnl Check for gnuplot. | |
1342 dnl | |
1343 AC_DEFUN([OCTAVE_PROG_GNUPLOT], [ | |
1344 gp_names="gnuplot" | |
1345 gp_default="gnuplot" | |
1346 if test "$cross_compiling" = yes; then | |
1347 GNUPLOT="$gp_default" | |
1348 AC_MSG_RESULT([assuming $GNUPLOT exists on $canonical_host_type host]) | |
1349 else | |
1350 AC_CHECK_PROGS(GNUPLOT, [$gp_names]) | |
1351 if test -z "$GNUPLOT"; then | |
1352 GNUPLOT="$gp_default" | |
1353 warn_gnuplot=" | |
1354 | |
1355 gnuplot not found. It isn't necessary to have gnuplot installed, but | |
1356 without native graphics or gnuplot you won't be able to use any of | |
1357 Octave's plotting commands. | |
1358 " | |
1359 OCTAVE_CONFIGURE_WARNING([warn_gnuplot]) | |
1360 fi | |
1361 fi | |
1362 AC_SUBST(GNUPLOT) | |
1363 ]) | |
1364 dnl | |
1365 dnl Check for gperf. | |
1366 dnl | |
1367 AC_DEFUN([OCTAVE_PROG_GPERF], [ | |
1368 AC_CHECK_PROG(GPERF, gperf, gperf, []) | |
1369 if test -z "$GPERF"; then | |
1370 GPERF='$(top_srcdir)/build-aux/missing gperf' | |
1371 warn_gperf=" | |
1372 | |
1373 I didn't find gperf, but it's only a problem if you need to | |
1374 reconstruct oct-gperf.h | |
1375 " | |
1376 OCTAVE_CONFIGURE_WARNING([warn_gperf]) | |
1377 fi | |
1378 AC_SUBST(GPERF) | |
1379 ]) | |
1380 dnl | |
1381 dnl Check for makeinfo. | |
1382 dnl | |
1383 AC_DEFUN([OCTAVE_PROG_MAKEINFO], [ | |
1384 dnl use MKINFO, not MAKEINFO, for variable name because Automake | |
1385 dnl automatically defines a value for MAKEINFO even when it does not | |
1386 dnl exist which will then fool the 'test -z' line. | |
1387 AC_CHECK_PROG(MKINFO, makeinfo, makeinfo, []) | |
1388 if test -z "$MKINFO"; then | |
1389 AC_MSG_ERROR([makeinfo program required for reading documentation]) | |
1390 fi | |
1391 ]) | |
1392 dnl | |
1393 dnl What pager should we use? | |
1394 dnl | |
1395 AC_DEFUN([OCTAVE_PROG_PAGER], [ | |
1396 if test "$cross_compiling" = yes; then | |
1397 DEFAULT_PAGER=less | |
1398 AC_MSG_RESULT([assuming $DEFAULT_PAGER exists on $canonical_host_type host]) | |
1399 AC_SUBST(DEFAULT_PAGER) | |
1400 else | |
1401 octave_possible_pagers="less more page pg" | |
1402 case "$canonical_host_type" in | |
1403 *-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc) | |
1404 octave_possible_pagers="$octave_possible_pagers more.com" | |
1405 ;; | |
1406 esac | |
1407 | |
1408 AC_CHECK_PROGS(DEFAULT_PAGER, $octave_possible_pagers, []) | |
1409 if test -z "$DEFAULT_PAGER"; then | |
1410 warn_less="I couldn't find \`less', \`more', \`page', or \`pg'" | |
1411 OCTAVE_CONFIGURE_WARNING([warn_less]) | |
1412 fi | |
1413 fi | |
1414 ]) | |
1415 dnl | |
1416 dnl Find Perl program. | |
1417 dnl | |
1418 AC_DEFUN([OCTAVE_PROG_PERL], [ | |
1419 AC_CHECK_PROG(PERL, perl, perl, []) | |
1420 AC_SUBST(PERL) | |
1421 ]) | |
1422 dnl | |
1423 dnl Find Python program. | |
1424 dnl | |
1425 AC_DEFUN([OCTAVE_PROG_PYTHON], [ | |
1426 AC_CHECK_PROG(PYTHON, python, python, []) | |
1427 AC_SUBST(PYTHON) | |
1428 ]) | |
1429 dnl | |
1430 dnl Find sed program. | |
1431 dnl | |
1432 # Check for a fully-functional sed program, that truncates | |
1433 # as few characters as possible and that supports "\(X\|Y\)" | |
1434 # style regular expression alternation. Prefer GNU sed if found. | |
1435 AC_DEFUN([OCTAVE_PROG_SED], [ | |
1436 AC_MSG_CHECKING([for a usable sed]) | |
1437 if test -z "$SED"; then | |
1438 AC_CACHE_VAL([octave_cv_prog_sed], | |
1439 [# Loop through the user's path and search for sed and gsed. | |
1440 # Next, test potential sed programs in list for truncation. | |
1441 _AS_PATH_WALK([$PATH], | |
1442 [for ac_prog in sed gsed; do | |
1443 for ac_exec_ext in '' $ac_executable_extensions; do | |
1444 if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then | |
1445 _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" | |
1446 fi | |
1447 done | |
1448 done | |
1449 ]) | |
1450 AS_TMPDIR(sed) | |
1451 _max=0 | |
1452 _count=0 | |
1453 # Add /usr/xpg4/bin/sed as it is typically found on Solaris | |
1454 # along with /bin/sed that truncates output. | |
1455 for _sed in $_sed_list /usr/xpg4/bin/sed; do | |
1456 test ! -f ${_sed} && break | |
1457 cat /dev/null > "$tmp/sed.in" | |
1458 _count=0 | |
1459 echo $ECHO_N "0123456789$ECHO_C" >"$tmp/sed.in" | |
1460 # Check for GNU sed and select it if it is found. | |
1461 if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then | |
1462 octave_cv_prog_sed=${_sed} | |
1463 break; | |
1464 fi | |
1465 # Reject if RE alternation is not handled. | |
1466 if test "`echo 'this and that' | ${_sed} -n 's/\(this\|that\).*$/\1/p'`" != "this"; then | |
1467 continue; | |
1468 fi | |
1469 while true; do | |
1470 cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" | |
1471 mv "$tmp/sed.tmp" "$tmp/sed.in" | |
1472 cp "$tmp/sed.in" "$tmp/sed.nl" | |
1473 echo >>"$tmp/sed.nl" | |
1474 ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break | |
1475 cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break | |
1476 # 10000 chars as input seems more than enough | |
1477 test $_count -gt 10 && break | |
1478 _count=`expr $_count + 1` | |
1479 if test $_count -gt $_max; then | |
1480 _max=$_count | |
1481 octave_cv_prog_sed=$_sed | |
1482 fi | |
1483 done | |
1484 done | |
1485 rm -rf "$tmp" | |
1486 ]) | |
1487 SED=$octave_cv_prog_sed | |
1488 if test -z "$SED"; then | |
1489 AC_MSG_ERROR([no usable version of sed found]) | |
1490 fi | |
1491 fi | |
1492 AC_SUBST(SED) | |
1493 AC_MSG_RESULT([$SED]) | |
1494 ]) | |
1495 dnl | |
1496 dnl Check for texi2dvi. | |
1497 dnl | |
1498 AC_DEFUN([OCTAVE_PROG_TEXI2DVI], [ | |
1499 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, []) | |
1500 if test -z "$TEXI2DVI"; then | |
1501 TEXI2DVI='$(top_srcdir)/build-aux/missing texi2dvi' | |
1502 warn_texi2dvi=" | |
1503 | |
1504 I didn't find texi2dvi, but it's only a problem if you need to | |
1505 reconstruct the DVI version of the manual | |
1506 " | |
1507 OCTAVE_CONFIGURE_WARNING([warn_texi2dvi]) | |
1508 fi | |
1509 AC_SUBST(TEXI2DVI) | |
1510 ]) | |
1511 dnl | |
1512 dnl Check for texi2pdf. | |
1513 dnl | |
1514 AC_DEFUN([OCTAVE_PROG_TEXI2PDF], [ | |
1515 AC_REQUIRE([OCTAVE_PROG_TEXI2DVI]) | |
1516 AC_CHECK_PROG(TEXI2PDF, texi2pdf, texi2pdf, []) | |
1517 if test -z "$TEXI2PDF"; then | |
1518 missing=true; | |
1519 if test -n "$TEXI2DVI"; then | |
1520 TEXI2PDF="$TEXI2DVI --pdf" | |
1521 missing=false; | |
1522 fi | |
1523 else | |
1524 missing=false; | |
1525 fi | |
1526 if $missing; then | |
1527 TEXI2PDF='$(top_srcdir)/build-aux/missing texi2pdf' | |
1528 warn_texi2pdf=" | |
1529 | |
1530 I didn't find texi2pdf, but it's only a problem if you need to | |
1531 reconstruct the PDF version of the manual | |
1532 " | |
1533 OCTAVE_CONFIGURE_WARNING([warn_texi2pdf]) | |
1534 fi | |
1535 AC_SUBST(TEXI2PDF) | |
1536 ]) | |
53 dnl | 1537 dnl |
54 dnl Set default value for a variable and substitute it. | 1538 dnl Set default value for a variable and substitute it. |
55 dnl | 1539 dnl |
56 AC_DEFUN([OCTAVE_SET_DEFAULT], | 1540 AC_DEFUN([OCTAVE_SET_DEFAULT], [ |
57 [ifelse($#, 2, [: ${$1=$2} | 1541 ifelse($#, 2, [: ${$1=$2} |
58 ])dnl | 1542 ])dnl |
59 AC_MSG_RESULT([defining $1 to be $$1]) | 1543 AC_MSG_RESULT([defining $1 to be $$1]) |
60 AC_SUBST($1)]) | 1544 AC_SUBST($1) |
61 dnl | 1545 ]) |
62 dnl Check for ar. | 1546 dnl |
63 dnl | 1547 dnl Check for UMFPACK separately split complex matrix and RHS. Note |
64 AC_DEFUN([OCTAVE_PROG_AR], | 1548 dnl that as umfpack.h can be in three different places, rather than |
65 [if test -z "$AR"; then | 1549 dnl include it, just declare the functions needed. |
66 AR=ar | 1550 dnl |
67 fi | 1551 dnl Assumes that the check for umfpack has already been performed. |
68 AC_SUBST(AR) | 1552 dnl |
69 | 1553 AC_DEFUN([OCTAVE_UMFPACK_SEPARATE_SPLIT], [ |
70 if test -z "$ARFLAGS"; then | 1554 AC_MSG_CHECKING([for UMFPACK separate complex matrix and rhs split]) |
71 ARFLAGS="rc" | 1555 AC_CACHE_VAL(octave_cv_umfpack_separate_split, |
72 fi | 1556 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
73 AC_SUBST(ARFLAGS) | 1557 #include <stdlib.h> |
1558 #if defined (HAVE_UFSPARSE_UMFPACK_H) | |
1559 #include <ufsparse/umfpack.h> | |
1560 #elif defined (HAVE_UMFPACK_UMFPACK_H) | |
1561 #include <umfpack/umfpack.h> | |
1562 #elif defined (HAVE_UMFPACK_H) | |
1563 #include <umfpack.h> | |
1564 #endif | |
1565 int n = 5; | |
1566 int Ap[] = {0, 2, 5, 9, 10, 12}; | |
1567 int Ai[] = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4}; | |
1568 double Ax[] = {2., 0., 3., 0., 3., 0., -1., 0., 4., 0., 4., 0., | |
1569 -3., 0., 1., 0., 2., 0., 2., 0., 6., 0., 1., 0.}; | |
1570 double br[] = {8., 45., -3., 3., 19.}; | |
1571 double bi[] = {0., 0., 0., 0., 0.}; | |
1572 int main (void) | |
1573 { | |
1574 double *null = (double *) NULL ; | |
1575 double *x = (double *)malloc (2 * n * sizeof(double)); | |
1576 int i ; | |
1577 void *Symbolic, *Numeric ; | |
1578 (void) umfpack_zi_symbolic (n, n, Ap, Ai, Ax, null, &Symbolic, null, null) ; | |
1579 (void) umfpack_zi_numeric (Ap, Ai, Ax, null, Symbolic, &Numeric, null, null) ; | |
1580 umfpack_zi_free_symbolic (&Symbolic) ; | |
1581 (void) umfpack_zi_solve (0, Ap, Ai, Ax, null, x, null, br, bi, | |
1582 Numeric, null, null) ; | |
1583 umfpack_zi_free_numeric (&Numeric) ; | |
1584 for (i = 0; i < n; i++, x+=2) | |
1585 if (fabs(*x - i - 1.) > 1.e-13) | |
1586 return (1); | |
1587 return (0) ; | |
1588 } | |
1589 ]])], | |
1590 octave_cv_umfpack_separate_split=yes, | |
1591 octave_cv_umfpack_separate_split=no, | |
1592 octave_cv_umfpack_separate_split=yes) | |
1593 ]) | |
1594 if test "$cross_compiling" = yes; then | |
1595 AC_MSG_RESULT([$octave_cv_umfpack_separate_split assumed for cross compilation]) | |
1596 else | |
1597 AC_MSG_RESULT([$octave_cv_umfpack_separate_split]) | |
1598 fi | |
1599 if test "$octave_cv_umfpack_separate_split" = yes; then | |
1600 AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1, | |
1601 [Define to 1 if the UMFPACK Complex solver allows matrix and RHS to be split independently.]) | |
1602 fi | |
74 ]) | 1603 ]) |
75 dnl | 1604 dnl |
76 dnl Check for unordered map headers and whether tr1 namespace is | 1605 dnl Check for unordered map headers and whether tr1 namespace is |
77 dnl required. | 1606 dnl required. |
78 dnl | 1607 dnl |
79 AC_DEFUN([OCTAVE_UNORDERED_MAP_HEADERS], [ | 1608 AC_DEFUN([OCTAVE_UNORDERED_MAP_HEADERS], [ |
80 AC_CHECK_HEADERS([unordered_map], [], [ | 1609 AC_CHECK_HEADERS([unordered_map], [], |
81 AC_CHECK_HEADERS([tr1/unordered_map])]) | 1610 [AC_CHECK_HEADERS([tr1/unordered_map])]) |
82 AC_CACHE_CHECK([whether unordered_map requires tr1 namespace], | 1611 AC_CACHE_CHECK([whether unordered_map requires tr1 namespace], |
83 [octave_cv_header_require_tr1_namespace], | 1612 [octave_cv_header_require_tr1_namespace], |
84 [AC_LANG_PUSH(C++) | 1613 [AC_LANG_PUSH(C++) |
85 octave_cv_header_require_tr1_namespace=no | 1614 octave_cv_header_require_tr1_namespace=no |
86 if test "$ac_cv_header_unordered_map" = "yes"; then | 1615 if test "$ac_cv_header_unordered_map" = "yes"; then |
87 ## Have <unordered_map>, but still have to check whether | 1616 ## Have <unordered_map>, but still have to check whether |
88 ## tr1 namespace is required (like MSVC, for instance). | 1617 ## tr1 namespace is required (like MSVC, for instance). |
89 AC_COMPILE_IFELSE([ | 1618 AC_COMPILE_IFELSE( |
90 AC_LANG_PROGRAM([ | 1619 [AC_LANG_PROGRAM([[ |
91 #include <unordered_map> | 1620 #include <unordered_map> |
92 ], [ | 1621 ]], [[ |
93 std::unordered_map<int,int> m; | 1622 std::unordered_map<int,int> m; |
94 ])], octave_cv_header_require_tr1_namespace=no, octave_cv_header_require_tr1_namespace=yes) | 1623 ]])], |
95 elif test "$ac_cv_header_tr1_unordered_map" = "yes"; then | 1624 octave_cv_header_require_tr1_namespace=no, |
96 octave_cv_header_require_tr1_namespace=yes | 1625 octave_cv_header_require_tr1_namespace=yes) |
97 fi | 1626 elif test "$ac_cv_header_tr1_unordered_map" = "yes"; then |
98 AC_LANG_POP(C++)]) | 1627 octave_cv_header_require_tr1_namespace=yes |
1628 fi | |
1629 AC_LANG_POP(C++) | |
1630 ]) | |
99 if test "$octave_cv_header_require_tr1_namespace" = "yes"; then | 1631 if test "$octave_cv_header_require_tr1_namespace" = "yes"; then |
100 AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, [Define to 1 if unordered_map requires the use of tr1 namespace.]) | 1632 AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, |
101 fi | 1633 [Define to 1 if unordered_map requires the use of tr1 namespace.]) |
102 ]) | 1634 fi |
103 dnl | 1635 ]) |
104 dnl Check if the compiler supports placement delete. | 1636 |
105 dnl | 1637 dnl End of macros written by Octave developers |
106 AC_DEFUN([OCTAVE_PLACEMENT_DELETE], | 1638 dnl ------------------------------------------------------------ |
107 [AC_CACHE_CHECK([whether <new> defines placement delete operator], | 1639 dnl |
108 octave_cv_placement_delete, | 1640 |
109 [AC_LANG_PUSH(C++) | 1641 dnl |
110 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <new>]], | 1642 dnl The following macros were taken from other sources. |
111 [[operator delete((void *)0, (void *)0);]])], | 1643 dnl ------------------------------------------------------------ |
112 octave_cv_placement_delete=yes, octave_cv_placement_delete=no)]) | 1644 |
113 if test $octave_cv_placement_delete = yes; then | 1645 dnl |
114 AC_DEFINE(HAVE_PLACEMENT_DELETE,1,[Define to 1 if C++ supports operator delete(void *, void *).]) | 1646 dnl Configure paths for FreeType2 |
1647 dnl Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor | |
1648 dnl | |
1649 dnl Copyright 2001, 2003 by | |
1650 dnl David Turner, Robert Wilhelm, and Werner Lemberg. | |
1651 dnl | |
1652 dnl This file is part of the FreeType project, and may only be used, modified, | |
1653 dnl and distributed under the terms of the FreeType project license, | |
1654 dnl LICENSE.TXT. By continuing to use, modify, or distribute this file you | |
1655 dnl indicate that you have read the license and understand and accept it | |
1656 dnl fully. | |
1657 dnl | |
1658 dnl As a special exception to the FreeType project license, this file may be | |
1659 dnl distributed as part of a program that contains a configuration script | |
1660 dnl generated by Autoconf, under the same distribution terms as the rest of | |
1661 dnl that program. | |
1662 dnl | |
1663 dnl serial 2 | |
1664 dnl | |
1665 dnl AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) | |
1666 dnl Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS. | |
1667 dnl MINIMUM-VERSION is what libtool reports; the default is `7.0.1' (this is | |
1668 dnl FreeType 2.0.4). | |
1669 dnl | |
1670 AC_DEFUN([AC_CHECK_FT2], [ | |
1671 dnl | |
1672 dnl Get the cflags and libraries from the freetype-config script | |
1673 dnl | |
1674 AC_ARG_WITH([ft-prefix], | |
1675 dnl don't quote AS_HELP_STRING! | |
1676 AS_HELP_STRING([--with-ft-prefix=PREFIX], | |
1677 [Prefix where FreeType is installed (optional)]), | |
1678 [ft_config_prefix="$withval"], | |
1679 [ft_config_prefix=""]) | |
1680 | |
1681 AC_ARG_WITH([ft-exec-prefix], | |
1682 dnl don't quote AS_HELP_STRING! | |
1683 AS_HELP_STRING([--with-ft-exec-prefix=PREFIX], | |
1684 [Exec prefix where FreeType is installed (optional)]), | |
1685 [ft_config_exec_prefix="$withval"], | |
1686 [ft_config_exec_prefix=""]) | |
1687 | |
1688 AC_ARG_ENABLE([freetypetest], | |
1689 [AS_HELP_STRING([--disable-freetypetest], | |
1690 [Do not try to compile and run a test FreeType program])], | |
1691 [], | |
1692 [enable_fttest=yes]) | |
1693 | |
1694 if test x$ft_config_exec_prefix != x ; then | |
1695 ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix" | |
1696 if test x${FT2_CONFIG+set} != xset ; then | |
1697 FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config | |
1698 fi | |
1699 fi | |
1700 | |
1701 if test x$ft_config_prefix != x ; then | |
1702 ft_config_args="$ft_config_args --prefix=$ft_config_prefix" | |
1703 if test x${FT2_CONFIG+set} != xset ; then | |
1704 FT2_CONFIG=$ft_config_prefix/bin/freetype-config | |
1705 fi | |
1706 fi | |
1707 | |
1708 AC_PATH_PROG([FT2_CONFIG], [freetype-config], [no]) | |
1709 | |
1710 min_ft_version=m4_if([$1], [], [7.0.1], [$1]) | |
1711 AC_MSG_CHECKING([for FreeType -- version >= $min_ft_version]) | |
1712 no_ft="" | |
1713 if test "$FT2_CONFIG" = "no" ; then | |
1714 no_ft=yes | |
1715 else | |
1716 FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags` | |
1717 FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs` | |
1718 ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \ | |
1719 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
1720 ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \ | |
1721 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
1722 ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \ | |
1723 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
1724 ft_min_major_version=`echo $min_ft_version | \ | |
1725 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
1726 ft_min_minor_version=`echo $min_ft_version | \ | |
1727 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
1728 ft_min_micro_version=`echo $min_ft_version | \ | |
1729 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
1730 if test x$enable_fttest = xyes ; then | |
1731 ft_config_is_lt="" | |
1732 if test $ft_config_major_version -lt $ft_min_major_version ; then | |
1733 ft_config_is_lt=yes | |
1734 else | |
1735 if test $ft_config_major_version -eq $ft_min_major_version ; then | |
1736 if test $ft_config_minor_version -lt $ft_min_minor_version ; then | |
1737 ft_config_is_lt=yes | |
1738 else | |
1739 if test $ft_config_minor_version -eq $ft_min_minor_version ; then | |
1740 if test $ft_config_micro_version -lt $ft_min_micro_version ; then | |
1741 ft_config_is_lt=yes | |
1742 fi | |
1743 fi | |
1744 fi | |
1745 fi | |
1746 fi | |
1747 if test x$ft_config_is_lt = xyes ; then | |
1748 no_ft=yes | |
1749 else | |
1750 ac_save_CFLAGS="$CFLAGS" | |
1751 ac_save_LIBS="$LIBS" | |
1752 CFLAGS="$CFLAGS $FT2_CFLAGS" | |
1753 LIBS="$FT2_LIBS $LIBS" | |
1754 dnl | |
1755 dnl Sanity checks for the results of freetype-config to some extent. | |
1756 dnl | |
1757 AC_RUN_IFELSE([ | |
1758 AC_LANG_SOURCE([[ | |
1759 | |
1760 #include <ft2build.h> | |
1761 #include FT_FREETYPE_H | |
1762 #include <stdio.h> | |
1763 #include <stdlib.h> | |
1764 | |
1765 int | |
1766 main() | |
1767 { | |
1768 FT_Library library; | |
1769 FT_Error error; | |
1770 | |
1771 error = FT_Init_FreeType(&library); | |
1772 | |
1773 if (error) | |
1774 return 1; | |
1775 else | |
1776 { | |
1777 FT_Done_FreeType(library); | |
1778 return 0; | |
1779 } | |
1780 } | |
1781 | |
1782 ]] | |
1783 )], | |
1784 [], | |
1785 [no_ft=yes], | |
1786 [echo $ECHO_N "cross compiling; assuming OK... $ECHO_C"]) | |
1787 | |
1788 CFLAGS="$ac_save_CFLAGS" | |
1789 LIBS="$ac_save_LIBS" | |
1790 fi dnl test $ft_config_version -lt $ft_min_version | |
1791 fi dnl test x$enable_fttest = xyes | |
1792 fi dnl test "$FT2_CONFIG" = "no" | |
1793 | |
1794 if test x$no_ft = x ; then | |
1795 AC_MSG_RESULT([yes]) | |
1796 m4_if([$2], [], [:], [$2]) | |
1797 else | |
1798 AC_MSG_RESULT([no]) | |
1799 if test "$FT2_CONFIG" = "no" ; then | |
1800 warn_ft2_config = " | |
1801 | |
1802 The freetype-config script installed by FreeType 2 could not be found. | |
1803 If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in your | |
1804 path, or set the FT2_CONFIG environment variable to the full path to | |
1805 freetype-config. | |
1806 " | |
1807 OCTAVE_CONFIGURE_WARNING([warn_ft2_config]) | |
1808 else | |
1809 if test x$ft_config_is_lt = xyes ; then | |
1810 warn_ft2_too_old=" | |
1811 | |
1812 Your installed version of the FreeType 2 library is too old. If you | |
1813 have different versions of FreeType 2, make sure that correct values | |
1814 for --with-ft-prefix or --with-ft-exec-prefix are used, or set the | |
1815 FT2_CONFIG environment variable to the full path to freetype-config. | |
1816 " | |
1817 OCTAVE_CONFIGURE_WARNING([warn_ft2_too_old]) | |
1818 else | |
1819 warn_ft2_failed=" | |
1820 | |
1821 The FreeType test program failed to run. If your system uses shared | |
1822 libraries and they are installed outside the normal system library | |
1823 path, make sure the variable LD_LIBRARY_PATH (or whatever is | |
1824 appropiate for your system) is correctly set. | |
1825 " | |
1826 OCTAVE_CONFIGURE_WARNING([warn_ft2_failed]) | |
1827 fi | |
1828 fi | |
1829 | |
1830 FT2_CFLAGS="" | |
1831 FT2_LIBS="" | |
1832 m4_if([$3], [], [:], [$3]) | |
1833 fi | |
1834 | |
1835 AC_SUBST([FT2_CFLAGS]) | |
1836 AC_SUBST([FT2_LIBS]) | |
1837 ]) | |
1838 dnl end of freetype2.m4 | |
1839 | |
1840 | |
1841 ############################################################################## | |
1842 ############################################################################## | |
1843 | |
1844 # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- | |
1845 # | |
1846 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>. | |
1847 # | |
1848 # This program is free software; you can redistribute it and/or modify | |
1849 # it under the terms of the GNU General Public License as published by | |
1850 # the Free Software Foundation; either version 2 of the License, or | |
1851 # (at your option) any later version. | |
1852 # | |
1853 # This program is distributed in the hope that it will be useful, but | |
1854 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
1855 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1856 # General Public License for more details. | |
1857 # | |
1858 # You should have received a copy of the GNU General Public License | |
1859 # along with this program; if not, write to the Free Software | |
1860 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1861 # | |
1862 # As a special exception to the GNU General Public License, if you | |
1863 # distribute this file as part of a program that contains a | |
1864 # configuration script generated by Autoconf, you may include it under | |
1865 # the same distribution terms that you use for the rest of that program. | |
1866 | |
1867 # PKG_PROG_PKG_CONFIG([MIN-VERSION]) | |
1868 # ---------------------------------- | |
1869 AC_DEFUN([PKG_PROG_PKG_CONFIG], | |
1870 [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) | |
1871 m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) | |
1872 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl | |
1873 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then | |
1874 AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) | |
115 fi | 1875 fi |
116 AC_LANG_POP(C++) | 1876 if test -n "$PKG_CONFIG"; then |
117 ]) | 1877 _pkg_min_version=m4_default([$1], [0.9.0]) |
118 dnl | 1878 AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) |
119 dnl Check if the compiler dynamic auto arrays. | 1879 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then |
120 dnl | 1880 AC_MSG_RESULT([yes]) |
121 AC_DEFUN([OCTAVE_DYNAMIC_AUTO_ARRAYS], | 1881 else |
122 [AC_CACHE_CHECK([whether C++ supports dynamic auto arrays], | 1882 AC_MSG_RESULT([no]) |
123 octave_cv_dynamic_auto_arrays, | 1883 PKG_CONFIG="" |
124 [AC_LANG_PUSH(C++) | 1884 fi |
125 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], | 1885 |
126 [[void test(char *); int length(); char x[length()]; test(x);]])], | 1886 fi[]dnl |
127 octave_cv_dynamic_auto_arrays=yes, octave_cv_dynamic_auto_arrays=no)]) | 1887 ])# PKG_PROG_PKG_CONFIG |
128 if test $octave_cv_dynamic_auto_arrays = yes; then | 1888 |
129 AC_DEFINE(HAVE_DYNAMIC_AUTO_ARRAYS,1,[Define to 1 if C++ supports dynamic auto arrays.]) | 1889 # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) |
130 fi | 1890 # |
131 AC_LANG_POP(C++) | 1891 # Check to see whether a particular set of modules exists. Similar |
132 ]) | 1892 # to PKG_CHECK_MODULES(), but does not set variables or print errors. |
133 dnl | 1893 # |
134 dnl Check if the C++ library has the bit_and, bit_or, and bit_xor | 1894 # |
135 dnl templates defined. | 1895 # Similar to PKG_CHECK_MODULES, make sure that the first instance of |
136 dnl | 1896 # this or PKG_CHECK_MODULES is called, or make sure to call |
137 AC_DEFUN([OCTAVE_CXX_BITWISE_OP_TEMPLATES], | 1897 # PKG_CHECK_EXISTS manually |
138 [AC_CACHE_CHECK([whether bit_and, bit_or, bit_xor are defined in the C++ library], | 1898 # -------------------------------------------------------------- |
139 octave_cv_cxx_bitwise_op_templates, | 1899 AC_DEFUN([PKG_CHECK_EXISTS], |
140 [AC_LANG_PUSH(C++) | 1900 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl |
141 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <functional>]], | 1901 if test -n "$PKG_CONFIG" && \ |
142 [[int x = 0; | 1902 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then |
143 int y = 1; | 1903 m4_ifval([$2], [$2], [:]) |
144 int z1 = std::bit_and<int>() (x, y); | 1904 m4_ifvaln([$3], [else |
145 int z2 = std::bit_or<int>() (x, y); | 1905 $3])dnl |
146 int z3 = std::bit_xor<int>() (x, y);]])], | 1906 fi]) |
147 octave_cv_cxx_bitwise_op_templates=yes, octave_cv_cxx_bitwise_op_templates=no)]) | 1907 |
148 if test $octave_cv_cxx_bitwise_op_templates = yes; then | 1908 |
149 AC_DEFINE(HAVE_CXX_BITWISE_OP_TEMPLATES,1,[Define to 1 if C++ library has templated bitwise operators.]) | 1909 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) |
150 fi | 1910 # --------------------------------------------- |
151 AC_LANG_POP(C++) | 1911 m4_define([_PKG_CONFIG], |
152 ]) | 1912 [if test -n "$PKG_CONFIG"; then |
153 dnl | 1913 if test -n "$$1"; then |
154 dnl Check if the C++ library has functions to set real and imaginary | 1914 pkg_cv_[]$1="$$1" |
155 dnl parts of complex numbers independently. | 1915 else |
156 dnl | 1916 PKG_CHECK_EXISTS([$3], |
157 AC_DEFUN([OCTAVE_CXX_COMPLEX_SETTERS], | 1917 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], |
158 [AC_CACHE_CHECK([whether complex class can set components independently], | 1918 [pkg_failed=yes]) |
159 octave_cv_cxx_complex_setters, | 1919 fi |
160 [AC_LANG_PUSH(C++) | 1920 else |
161 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <complex>]], | 1921 pkg_failed=untried |
162 [[std::complex<double> x; x.real (1.0); x.imag (2.0);]])], | 1922 fi[]dnl |
163 octave_cv_cxx_complex_setters=yes, octave_cv_cxx_complex_setters=no)]) | 1923 ])# _PKG_CONFIG |
164 if test $octave_cv_cxx_complex_setters = yes; then | 1924 |
165 AC_DEFINE(HAVE_CXX_COMPLEX_SETTERS,1,[Define to 1 if C++ complex class has void real (T) and void imag (T) methods.]) | 1925 # _PKG_SHORT_ERRORS_SUPPORTED |
166 fi | 1926 # ----------------------------- |
167 AC_LANG_POP(C++) | 1927 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], |
168 ]) | 1928 [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) |
169 dnl | 1929 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then |
170 dnl Check if the C++ library has functions to access real and imaginary | 1930 _pkg_short_errors_supported=yes |
171 dnl parts of complex numbers independently via references. | 1931 else |
172 dnl | 1932 _pkg_short_errors_supported=no |
173 AC_DEFUN([OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS], | 1933 fi[]dnl |
174 [AC_CACHE_CHECK([whether complex class can reference components independently], | 1934 ])# _PKG_SHORT_ERRORS_SUPPORTED |
175 octave_cv_cxx_complex_reference_accessors, | 1935 |
176 [AC_LANG_PUSH(C++) | 1936 |
177 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <complex>]], | 1937 # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], |
178 [[std::complex<double> x; x.real () = 1.0; x.imag () = 1.0;]])], | 1938 # [ACTION-IF-NOT-FOUND]) |
179 octave_cv_cxx_complex_reference_accessors=yes, octave_cv_cxx_complex_reference_accessors=no)]) | 1939 # |
180 if test $octave_cv_cxx_complex_reference_accessors = yes; then | 1940 # |
181 AC_DEFINE(HAVE_CXX_COMPLEX_REFERENCE_ACCESSORS,1,[Define to 1 if C++ complex class has T& real (void) and T& imag (void) methods.]) | 1941 # Note that if there is a possibility the first call to |
182 fi | 1942 # PKG_CHECK_MODULES might not happen, you should be sure to include an |
183 AC_LANG_POP(C++) | 1943 # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac |
184 ]) | 1944 # |
185 dnl | 1945 # |
186 dnl Check if the Carbon Framework defines CGDisplayBitsPerPixel. | 1946 # -------------------------------------------------------------- |
187 dnl | 1947 AC_DEFUN([PKG_CHECK_MODULES], |
188 AC_DEFUN([OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL], | 1948 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl |
189 [AC_CACHE_CHECK([whether CGDisplayBitsPerPixel is defined in the Carbon Framework], | 1949 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl |
190 octave_cv_carbon_cgdisplaybitsperpixel, | 1950 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl |
191 [AC_LANG_PUSH(C++) | 1951 |
192 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | 1952 pkg_failed=no |
193 #include <Carbon/Carbon.h> | 1953 AC_MSG_CHECKING([for $1]) |
194 ]], [[ | 1954 |
195 CGDirectDisplayID display = CGMainDisplayID (); | 1955 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) |
196 size_t depth = CGDisplayBitsPerPixel (display); | 1956 _PKG_CONFIG([$1][_LIBS], [libs], [$2]) |
197 ]])], | 1957 |
198 octave_cv_carbon_cgdisplaybitsperpixel=yes, octave_cv_carbon_cgdisplaybitsperpixel=no)]) | 1958 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS |
199 if test $octave_cv_carbon_cgdisplaybitsperpixel = yes; then | 1959 and $1[]_LIBS to avoid the need to call pkg-config. |
200 AC_DEFINE(HAVE_CARBON_CGDISPLAYBITSPERPIXEL,1,[Define to 1 if Carbon Framework has CGDisplayBitsPerPixel.]) | 1960 See the pkg-config man page for more details.]) |
201 fi | 1961 |
202 AC_LANG_POP(C++) | 1962 if test $pkg_failed = yes; then |
203 ]) | 1963 _PKG_SHORT_ERRORS_SUPPORTED |
1964 if test $_pkg_short_errors_supported = yes; then | |
1965 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` | |
1966 else | |
1967 $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` | |
1968 fi | |
1969 # Put the nasty error message in config.log where it belongs | |
1970 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD | |
1971 | |
1972 ifelse([$4], , [AC_MSG_ERROR(dnl | |
1973 [Package requirements ($2) were not met: | |
1974 | |
1975 $$1_PKG_ERRORS | |
1976 | |
1977 Consider adjusting the PKG_CONFIG_PATH environment variable if you | |
1978 installed software in a non-standard prefix. | |
1979 | |
1980 _PKG_TEXT | |
1981 ])], | |
1982 [AC_MSG_RESULT([no]) | |
1983 $4]) | |
1984 elif test $pkg_failed = untried; then | |
1985 ifelse([$4], , [AC_MSG_FAILURE(dnl | |
1986 [The pkg-config script could not be found or is too old. Make sure it | |
1987 is in your PATH or set the PKG_CONFIG environment variable to the full | |
1988 path to pkg-config. | |
1989 | |
1990 _PKG_TEXT | |
1991 | |
1992 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])], | |
1993 [$4]) | |
1994 else | |
1995 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS | |
1996 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS | |
1997 AC_MSG_RESULT([yes]) | |
1998 ifelse([$3], , :, [$3]) | |
1999 fi[]dnl | |
2000 ])# PKG_CHECK_MODULES | |
2001 dnl end of pkg.m4 | |
2002 | |
204 dnl | 2003 dnl |
205 dnl The following test is from Karl Berry's Kpathsearch library. I'm | 2004 dnl The following test is from Karl Berry's Kpathsearch library. I'm |
206 dnl including it here in case we someday want to make the use of | 2005 dnl including it here in case we someday want to make the use of |
207 dnl kpathsea optional. | 2006 dnl kpathsea optional. |
208 dnl | 2007 dnl |
267 octave_cv_func_putenv_malloc=no)])dnl | 2066 octave_cv_func_putenv_malloc=no)])dnl |
268 AC_MSG_RESULT([$octave_cv_func_putenv_malloc]) | 2067 AC_MSG_RESULT([$octave_cv_func_putenv_malloc]) |
269 if test $octave_cv_func_putenv_malloc = yes; then | 2068 if test $octave_cv_func_putenv_malloc = yes; then |
270 AC_DEFINE(SMART_PUTENV,1,[To quiet autoheader.]) | 2069 AC_DEFINE(SMART_PUTENV,1,[To quiet autoheader.]) |
271 fi]) | 2070 fi]) |
272 dnl | |
273 dnl Check if C++ compiler needs the new friend template declaration | |
274 dnl syntax. | |
275 dnl | |
276 AC_DEFUN([OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL], [ | |
277 AC_REQUIRE([AC_PROG_CXX]) | |
278 AC_MSG_CHECKING([for C++ support for new friend template declaration]) | |
279 AC_CACHE_VAL(octave_cv_cxx_new_friend_template_decl, [ | |
280 AC_LANG_PUSH(C++) | |
281 rm -f conftest.h | |
282 cat > conftest.h <<EOB | |
283 struct A { | |
284 friend int operator== (const A&, const A&); | |
285 A (int) { } | |
286 }; | |
287 | |
288 template <class T> int | |
289 operator== (const T&, const T&) | |
290 { | |
291 return 0; | |
292 } | |
293 EOB | |
294 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "conftest.h"]], | |
295 [[A a (1); | |
296 return a == A(1);]])], | |
297 [octave_cv_cxx_new_friend_template_decl=no], | |
298 [octave_cv_cxx_new_friend_template_decl=yes]) | |
299 AC_LANG_POP(C++) | |
300 ]) | |
301 AC_MSG_RESULT([$octave_cv_cxx_new_friend_template_decl]) | |
302 if test $octave_cv_cxx_new_friend_template_decl = yes; then | |
303 AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL,1,[Define to 1 if your compiler supports `<>' stuff for template friends.]) | |
304 fi | |
305 ]) | |
306 dnl | |
307 dnl Check if C compiler handles FLAG command line option. If two | |
308 dnl arguments are specified, execute the second arg as shell commands. | |
309 dnl Otherwise, add FLAG to CFLAGS if the compiler accepts the flag. | |
310 dnl | |
311 AC_DEFUN([OCTAVE_CC_FLAG], [ | |
312 ac_safe=`echo "$1" | sed 'y% ./+-:=%___p___%'` | |
313 AC_MSG_CHECKING([whether ${CC-cc} accepts $1]) | |
314 AC_CACHE_VAL(octave_cv_cc_flag_$ac_safe, [ | |
315 AC_LANG_PUSH(C) | |
316 XCFLAGS="$CFLAGS" | |
317 CFLAGS="$CFLAGS $1" | |
318 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], | |
319 eval "octave_cv_cc_flag_$ac_safe=yes", | |
320 eval "octave_cv_cc_flag_$ac_safe=no") | |
321 CFLAGS="$XCFLAGS" | |
322 AC_LANG_POP(C) | |
323 ]) | |
324 if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then | |
325 AC_MSG_RESULT(yes) | |
326 ifelse([$2], , [ | |
327 CFLAGS="$CFLAGS $1" | |
328 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2]) | |
329 else | |
330 AC_MSG_RESULT(no) | |
331 ifelse([$3], , , [$3]) | |
332 fi | |
333 ]) | |
334 dnl | |
335 dnl Check if C++ compiler handles FLAG command line option. If two | |
336 dnl arguments are specified, execute the second arg as shell commands. | |
337 dnl Otherwise, add FLAG to CXXFLAGS if the compiler accepts the flag. | |
338 dnl | |
339 AC_DEFUN([OCTAVE_CXX_FLAG], [ | |
340 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` | |
341 AC_MSG_CHECKING([whether ${CXX-g++} accepts $1]) | |
342 AC_CACHE_VAL(octave_cv_cxx_flag_$ac_safe, [ | |
343 AC_LANG_PUSH(C++) | |
344 XCXXFLAGS="$CXXFLAGS" | |
345 CXXFLAGS="$CXXFLAGS $1" | |
346 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], | |
347 eval "octave_cv_cxx_flag_$ac_safe=yes", | |
348 eval "octave_cv_cxx_flag_$ac_safe=no") | |
349 CXXFLAGS="$XCXXFLAGS" | |
350 AC_LANG_POP(C++) | |
351 ]) | |
352 if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then | |
353 AC_MSG_RESULT(yes) | |
354 ifelse([$2], , [ | |
355 CXXFLAGS="$CXXFLAGS $1" | |
356 AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2]) | |
357 else | |
358 AC_MSG_RESULT(no) | |
359 ifelse([$3], , , [$3]) | |
360 fi | |
361 ]) | |
362 dnl | |
363 dnl Check if Fortran compiler handles FLAG command line option. If | |
364 dnl two arguments are specified, execute the second arg as shell | |
365 dnl commands. Otherwise, add FLAG to FFLAGS if the compiler accepts | |
366 dnl the flag. | |
367 dnl | |
368 AC_DEFUN([OCTAVE_F77_FLAG], [ | |
369 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` | |
370 AC_MSG_CHECKING([whether ${F77-g77} accepts $1]) | |
371 AC_CACHE_VAL(octave_cv_f77_flag_$ac_safe, [ | |
372 AC_LANG_PUSH(Fortran 77) | |
373 XFFLAGS="$FFLAGS" | |
374 FFLAGS="$FFLAGS $1" | |
375 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], | |
376 eval "octave_cv_f77_flag_$ac_safe=yes", | |
377 eval "octave_cv_f77_flag_$ac_safe=no") | |
378 FFLAGS="$XFFLAGS" | |
379 AC_LANG_POP(Fortran 77) | |
380 ]) | |
381 if eval "test \"`echo '$octave_cv_f77_flag_'$ac_safe`\" = yes"; then | |
382 AC_MSG_RESULT(yes) | |
383 ifelse([$2], , [ | |
384 FFLAGS="$FFLAGS $1" | |
385 AC_MSG_RESULT([adding $1 to FFLAGS])], [$2]) | |
386 else | |
387 AC_MSG_RESULT(no) | |
388 ifelse([$3], , , [$3]) | |
389 fi | |
390 ]) | |
391 dnl | |
392 dnl Check if Fortran compiler has the intrinsic function ISNAN. | |
393 dnl | |
394 AC_DEFUN([OCTAVE_CHECK_FORTRAN_HAVE_ISNAN], [ | |
395 AC_LANG_PUSH(Fortran 77) | |
396 AC_CACHE_CHECK([whether $F77 has the intrinsic function ISNAN], | |
397 [octave_cv_fortran_have_isnan], | |
398 [AC_COMPILE_IFELSE( | |
399 [ program foo | |
400 implicit none | |
401 real x | |
402 double precision y | |
403 if (isnan(x)) then | |
404 print *, 'x is NaN' | |
405 end if | |
406 if (isnan(y)) then | |
407 print *, 'y is NaN' | |
408 end if | |
409 end program], [octave_cv_fortran_have_isnan=yes], [octave_cv_fortran_have_isnan=no] | |
410 )]) | |
411 AC_LANG_POP(Fortran 77) | |
412 ]) | |
413 dnl | |
414 dnl Check if the default Fortran INTEGER is 64 bits wide. | |
415 dnl | |
416 AC_DEFUN([OCTAVE_CHECK_FORTRAN_INTEGER_SIZE], [ | |
417 octave_fintsize_save_FFLAGS="$FFLAGS" | |
418 FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG" | |
419 AC_LANG_PUSH(Fortran 77) | |
420 AC_CACHE_CHECK([whether $F77 generates correct size integers], | |
421 [octave_cv_fortran_integer_size], | |
422 [AC_COMPILE_IFELSE( | |
423 [ subroutine foo(n, in, out) | |
424 integer n, in(n), out(n) | |
425 integer i | |
426 do 10 i = 1, n | |
427 out(i) = in(i) | |
428 10 continue | |
429 return | |
430 end], | |
431 [mv conftest.$ac_objext fintsize.$ac_objext | |
432 | |
433 octave_fintsize_save_LIBS="$LIBS" | |
434 LIBS="fintsize.$ac_objext $[]_AC_LANG_PREFIX[]LIBS" | |
435 AC_LANG_PUSH(C)dnl | |
436 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <assert.h>]], [[ | |
437 #ifdef USE_64_BIT_IDX_T | |
438 #if IDX_TYPE_LONG | |
439 typedef long octave_idx_type; | |
440 #else | |
441 typedef int octave_idx_type; | |
442 #endif | |
443 #else | |
444 typedef int octave_idx_type; | |
445 #endif | |
446 octave_idx_type n = 2; | |
447 octave_idx_type in[2]; | |
448 octave_idx_type out[2]; | |
449 in[0] = 13; | |
450 in[0] = 42; | |
451 F77_FUNC(foo,FOO) (&n, &in, &out); | |
452 assert (in[0] == out[0] && in[1] == out[1]); | |
453 ]])], | |
454 [octave_cv_fortran_integer_size=yes], | |
455 [octave_cv_fortran_integer_size=no], | |
456 [octave_cv_fortran_integer_size=yes]) | |
457 AC_LANG_POP(C)dnl | |
458 LIBS="$octave_fintsize_save_LIBS" | |
459 rm -f conftest.$ac_objext fintsize.$ac_objext | |
460 ], [ | |
461 rm -f conftest.$ac_objext | |
462 AC_MSG_FAILURE([cannot compile a simple Fortran program]) | |
463 octave_cv_fortran_integer_size=no])]) | |
464 AC_LANG_POP(Fortran 77) | |
465 FFLAGS="$octave_fintsize_save_FFLAGS" | |
466 ]) | |
467 dnl | |
468 dnl Add warning to final summary. | |
469 dnl | |
470 AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [ | |
471 AC_MSG_WARN([$][$1]) | |
472 m4_set_add([summary_warning_list], [$1]) | |
473 ]) | |
474 dnl | |
475 dnl Print final summary. | |
476 dnl | |
477 AC_DEFUN([OCTAVE_CONFIGURE_WARNING_SUMMARY], [ | |
478 m4_set_foreach([summary_warning_list], [elt], [ | |
479 if test -n "[$]elt"; then | |
480 AC_MSG_WARN([$]elt) | |
481 warn_msg_printed=true | |
482 fi]) | |
483 ]) | |
484 dnl | |
485 dnl OCTAVE_CHECK_LIBRARY(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC, | |
486 dnl LANG, DOC-STRING, EXTRA-CHECK) | |
487 dnl | |
488 AC_DEFUN([OCTAVE_CHECK_LIBRARY], [ | |
489 AC_ARG_WITH([$1-includedir], | |
490 [AS_HELP_STRING([--with-$1-includedir=DIR], | |
491 [look for $2 include files in DIR])], | |
492 [m4_toupper([$1])_CPPFLAGS="-I$withval"]) | |
493 AC_SUBST(m4_toupper([$1])_CPPFLAGS) | |
494 | |
495 AC_ARG_WITH([$1-libdir], | |
496 [AS_HELP_STRING([--with-$1-libdir=DIR], | |
497 [look for $2 libraries in DIR])], | |
498 [m4_toupper([$1])_LDFLAGS="-L$withval"]) | |
499 AC_SUBST(m4_toupper([$1])_LDFLAGS) | |
500 | |
501 AC_ARG_WITH([$1], | |
502 [m4_ifblank([$7], | |
503 [AS_HELP_STRING([--without-$1], [don't use $2 library])], | |
504 [AS_HELP_STRING([--without-$1], [$7])])], | |
505 with_$1=$withval, with_$1=yes) | |
506 | |
507 m4_toupper([$1])_LIBS= | |
508 case $with_$1 in | |
509 no) | |
510 m4_toupper([$1])_LIBS= | |
511 ;; | |
512 yes | "") | |
513 m4_toupper([$1])_LIBS="-l$1" | |
514 ;; | |
515 -* | */* | *.a | *.so | *.so.* | *.o) | |
516 m4_toupper([$1])_LIBS="$with_$1" | |
517 ;; | |
518 *) | |
519 m4_toupper([$1])_LIBS="-l$with_$1" | |
520 ;; | |
521 esac | |
522 | |
523 [TEXINFO_]m4_toupper([$1])= | |
524 warn_$1="$3" | |
525 m4_set_add([summary_warning_list], [warn_$1]) | |
526 | |
527 if test -n "$m4_toupper([$1])_LIBS"; then | |
528 octave_check_library_save_CPPFLAGS="$CPPFLAGS" | |
529 CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS" | |
530 m4_ifnblank([$6], [AC_LANG_PUSH($6)]) | |
531 octave_$1_check_for_lib=false | |
532 m4_ifblank([$4], [octave_$1_check_for_lib=true], | |
533 [AC_CHECK_HEADERS($4, [octave_$1_check_for_lib=true; break])]) | |
534 if $octave_$1_check_for_lib; then | |
535 octave_check_library_save_LDFLAGS="$LDFLAGS" | |
536 LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS" | |
537 octave_check_library_save_LIBS="$LIBS" | |
538 LIBS="$m4_toupper([$1])_LIBS $LIBS" | |
539 octave_$1_ok=no | |
540 AC_MSG_CHECKING([for $5 in $m4_toupper([$1])_LIBS]) | |
541 AC_LINK_IFELSE([AC_LANG_CALL([], [$5])], | |
542 [octave_$1_ok=yes]) | |
543 AC_MSG_RESULT([$octave_$1_ok]) | |
544 if test $octave_$1_ok = yes; then | |
545 m4_ifblank([$8], [ | |
546 warn_$1= | |
547 AC_DEFINE([HAVE_]m4_toupper([$1]), 1, | |
548 [Define to 1 if $2 is available.]) | |
549 [TEXINFO_]m4_toupper([$1])="@set [HAVE_]m4_toupper([$1])"], [$8]) | |
550 fi | |
551 LIBS="$octave_check_library_save_LIBS" | |
552 LDFLAGS="$octave_check_library_save_LDFLAGS" | |
553 fi | |
554 m4_ifnblank([$6], [AC_LANG_POP($6)]) | |
555 CPPFLAGS="$octave_check_library_save_CPPFLAGS" | |
556 fi | |
557 AC_SUBST(m4_toupper([$1])_LIBS) | |
558 AC_SUBST([TEXINFO_]m4_toupper([$1])) | |
559 if test -n "$warn_$1"; then | |
560 AC_MSG_WARN([$warn_$1]) | |
561 m4_toupper([$1])_LIBS= | |
562 fi | |
563 ]) | |
564 dnl | |
565 dnl Check for flex. | |
566 dnl | |
567 AC_DEFUN([OCTAVE_PROG_FLEX], [ | |
568 ### For now, don't define LEXLIB to be -lfl -- we don't use anything in | |
569 ### it, and it might not be installed. | |
570 ### | |
571 ### Also make sure that we generate an interactive scanner if we are | |
572 ### using flex. | |
573 AC_PROG_LEX | |
574 case "$LEX" in | |
575 flex*) | |
576 LFLAGS="-I" | |
577 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) | |
578 LEXLIB= | |
579 ;; | |
580 *) | |
581 LEX='$(top_srcdir)/build-aux/missing flex' | |
582 warn_flex=" | |
583 | |
584 I didn't find flex, but it's only a problem if you need to reconstruct | |
585 lex.cc, which is the case if you're building from VCS sources. | |
586 " | |
587 OCTAVE_CONFIGURE_WARNING([warn_flex]) | |
588 ;; | |
589 esac | |
590 AC_SUBST(LFLAGS) | |
591 ]) | |
592 dnl | |
593 dnl Check for bison. | |
594 dnl | |
595 AC_DEFUN([OCTAVE_PROG_BISON], [ | |
596 AC_PROG_YACC | |
597 case "$YACC" in | |
598 bison*) | |
599 ;; | |
600 *) | |
601 YACC='$(top_srcdir)/build-aux/missing bison' | |
602 warn_bison=" | |
603 | |
604 I didn't find bison, but it's only a problem if you need to | |
605 reconstruct parse.cc, which is the case if you're building from VCS | |
606 sources. | |
607 | |
608 " | |
609 OCTAVE_CONFIGURE_WARNING([warn_bison]) | |
610 ;; | |
611 esac | |
612 ]) | |
613 dnl | |
614 dnl What pager should we use? | |
615 dnl | |
616 AC_DEFUN([OCTAVE_PROG_PAGER], | |
617 [if test "$cross_compiling" = yes; then | |
618 DEFAULT_PAGER=less | |
619 AC_MSG_RESULT([assuming $DEFAULT_PAGER exists on $canonical_host_type host]) | |
620 AC_SUBST(DEFAULT_PAGER) | |
621 else | |
622 octave_possible_pagers="less more page pg" | |
623 case "$canonical_host_type" in | |
624 *-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc) | |
625 octave_possible_pagers="$octave_possible_pagers more.com" | |
626 ;; | |
627 esac | |
628 | |
629 AC_CHECK_PROGS(DEFAULT_PAGER, $octave_possible_pagers, []) | |
630 if test -z "$DEFAULT_PAGER"; then | |
631 warn_less="I couldn't find \`less', \`more', \`page', or \`pg'" | |
632 OCTAVE_CONFIGURE_WARNING([warn_less]) | |
633 fi | |
634 fi | |
635 ]) | |
636 dnl | |
637 dnl Check for gnuplot. | |
638 dnl | |
639 AC_DEFUN([OCTAVE_PROG_GNUPLOT], [ | |
640 gp_names="gnuplot" | |
641 gp_default="gnuplot" | |
642 if test "$cross_compiling" = yes; then | |
643 GNUPLOT="$gp_default" | |
644 AC_MSG_RESULT([assuming $GNUPLOT exists on $canonical_host_type host]) | |
645 else | |
646 AC_CHECK_PROGS(GNUPLOT, [$gp_names]) | |
647 if test -z "$GNUPLOT"; then | |
648 GNUPLOT="$gp_default" | |
649 warn_gnuplot=" | |
650 | |
651 gnuplot not found. It isn't necessary to have gnuplot installed, but | |
652 without native graphics or gnuplot you won't be able to use any of | |
653 Octave's plotting commands. | |
654 " | |
655 OCTAVE_CONFIGURE_WARNING([warn_gnuplot]) | |
656 fi | |
657 fi | |
658 AC_SUBST(GNUPLOT) | |
659 ]) | |
660 dnl | |
661 dnl Check for gperf. | |
662 dnl | |
663 AC_DEFUN([OCTAVE_PROG_GPERF], [ | |
664 AC_CHECK_PROG(GPERF, gperf, gperf, []) | |
665 if test -z "$GPERF"; then | |
666 GPERF='$(top_srcdir)/build-aux/missing gperf' | |
667 warn_gperf=" | |
668 | |
669 I didn't find gperf, but it's only a problem if you need to | |
670 reconstruct oct-gperf.h | |
671 " | |
672 OCTAVE_CONFIGURE_WARNING([warn_gperf]) | |
673 fi | |
674 AC_SUBST(GPERF) | |
675 ]) | |
676 dnl | |
677 dnl Check for ghostscript. | |
678 dnl | |
679 AC_DEFUN([OCTAVE_PROG_GHOSTSCRIPT], [ | |
680 case "$canonical_host_type" in | |
681 *-*-mingw* | *-*-msdosmsvc) | |
682 gs_names="gswin32c gs mgs" | |
683 ;; | |
684 *) | |
685 gs_names="gs" | |
686 ;; | |
687 esac | |
688 AC_CHECK_PROGS(GHOSTSCRIPT, [$gs_names]) | |
689 if test -z "$GHOSTSCRIPT"; then | |
690 GHOSTSCRIPT='$(top_srcdir)/build-aux/missing gs' | |
691 warn_ghostscript=" | |
692 | |
693 I didn't find ghostscript, so reconstructing figures for the manual | |
694 will fail, and saving graphics in some output formats will fail when | |
695 using Octave | |
696 " | |
697 | |
698 OCTAVE_CONFIGURE_WARNING([warn_ghostscript]) | |
699 fi | |
700 AC_SUBST(GHOSTSCRIPT) | |
701 ]) | |
702 dnl | |
703 dnl Check for makeinfo. | |
704 dnl | |
705 AC_DEFUN([OCTAVE_PROG_MAKEINFO], | |
706 dnl use MKINFO, not MAKEINFO, for variable name because Automake automatically | |
707 dnl defines a value for MAKEINFO even when it does not exist which will then | |
708 dnl fool the 'test -z' line. | |
709 [AC_CHECK_PROG(MKINFO, makeinfo, makeinfo, []) | |
710 if test -z "$MKINFO"; then | |
711 AC_MSG_ERROR([makeinfo program required for reading documentation]) | |
712 fi | |
713 ]) | |
714 dnl | |
715 dnl Check for texi2dvi. | |
716 dnl | |
717 AC_DEFUN([OCTAVE_PROG_TEXI2DVI], [ | |
718 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, []) | |
719 if test -z "$TEXI2DVI"; then | |
720 TEXI2DVI='$(top_srcdir)/build-aux/missing texi2dvi' | |
721 warn_texi2dvi=" | |
722 | |
723 I didn't find texi2dvi, but it's only a problem if you need to | |
724 reconstruct the DVI version of the manual | |
725 " | |
726 OCTAVE_CONFIGURE_WARNING([warn_texi2dvi]) | |
727 fi | |
728 AC_SUBST(TEXI2DVI) | |
729 ]) | |
730 dnl | |
731 dnl Check for texi2pdf. | |
732 dnl | |
733 AC_DEFUN([OCTAVE_PROG_TEXI2PDF], [ | |
734 AC_REQUIRE([OCTAVE_PROG_TEXI2DVI]) | |
735 AC_CHECK_PROG(TEXI2PDF, texi2pdf, texi2pdf, []) | |
736 if test -z "$TEXI2PDF"; then | |
737 missing=true; | |
738 if test -n "$TEXI2DVI"; then | |
739 TEXI2PDF="$TEXI2DVI --pdf" | |
740 missing=false; | |
741 fi | |
742 else | |
743 missing=false; | |
744 fi | |
745 if $missing; then | |
746 TEXI2PDF='$(top_srcdir)/build-aux/missing texi2pdf' | |
747 warn_texi2pdf=" | |
748 | |
749 I didn't find texi2pdf, but it's only a problem if you need to | |
750 reconstruct the PDF version of the manual | |
751 " | |
752 OCTAVE_CONFIGURE_WARNING([warn_texi2pdf]) | |
753 fi | |
754 AC_SUBST(TEXI2PDF) | |
755 ]) | |
756 dnl | |
757 dnl Check if the C++ library is ISO compliant. | |
758 dnl FIXME: This is obviously very simplistic, and trivially fooled. | |
759 dnl | |
760 AC_DEFUN([OCTAVE_CXX_ISO_COMPLIANT_LIBRARY], [ | |
761 AC_REQUIRE([AC_PROG_CXX]) | |
762 AC_MSG_CHECKING([if C++ library is ISO compliant]) | |
763 AC_CACHE_VAL(octave_cv_cxx_iso_compliant_library, [ | |
764 AC_LANG_PUSH(C++) | |
765 rm -f conftest.h | |
766 ### Omitting cwctype for now, since it is broken with gcc-3.0.x and | |
767 ### possibly other versions... | |
768 for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \ | |
769 climits clocale cmath complex csetjmp csignal cstdarg cstddef \ | |
770 cstdio cstdlib cstring ctime cwchar deque exception \ | |
771 fstream functional iomanip ios iosfwd iostream istream iterator \ | |
772 limits list locale map memory new numeric ostream queue set \ | |
773 sstream stack stdexcept streambuf string strstream typeinfo \ | |
774 utility valarray vector; do | |
775 echo "#include <$inc>" >> conftest.h | |
776 done | |
777 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "conftest.h"]], | |
778 [[std::bitset<50> flags; | |
779 flags.set(); | |
780 int digits = std::numeric_limits<unsigned long>::digits; | |
781 digits = 0;]])], | |
782 [octave_cv_cxx_iso_compliant_library=yes], | |
783 [octave_cv_cxx_iso_compliant_library=no]) | |
784 AC_LANG_POP(C++) | |
785 ]) | |
786 AC_MSG_RESULT([$octave_cv_cxx_iso_compliant_library]) | |
787 if test $octave_cv_cxx_iso_compliant_library = yes; then | |
788 AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, [Define to 1 if your C++ runtime library is ISO compliant.]) | |
789 fi | |
790 ]) | |
791 dnl | |
792 dnl Allow the user disable support for command line editing using GNU | |
793 dnl readline. | |
794 dnl | |
795 dnl OCTAVE_ENABLE_READLINE | |
796 AC_DEFUN([OCTAVE_ENABLE_READLINE], [ | |
797 USE_READLINE=true | |
798 READLINE_LIBS= | |
799 AC_ARG_ENABLE(readline, | |
800 [ --enable-readline use readline library (default is yes)], | |
801 [if test "$enableval" = no; then | |
802 USE_READLINE=false | |
803 warn_readline="command editing and history features require GNU Readline" | |
804 fi]) | |
805 if $USE_READLINE; then | |
806 save_LIBS="$LIBS" | |
807 LIBS="$TERM_LIBS" | |
808 AC_CHECK_LIB(readline, rl_set_keyboard_input_timeout, [ | |
809 READLINE_LIBS="-lreadline" | |
810 AC_DEFINE(USE_READLINE, 1, [Define to 1 to use the readline library.]) | |
811 ], [ | |
812 AC_MSG_WARN([I need GNU Readline 4.2 or later]) | |
813 AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) | |
814 ]) | |
815 LIBS="$save_LIBS" | |
816 fi | |
817 AC_SUBST(READLINE_LIBS) | |
818 ]) | |
819 dnl | |
820 dnl Check if C++ reinterpret cast works for function pointers. | |
821 dnl | |
822 AC_DEFUN([OCTAVE_CXX_BROKEN_REINTERPRET_CAST], [ | |
823 AC_REQUIRE([AC_PROG_CXX]) | |
824 AC_LANG_PUSH(C++) | |
825 AC_CACHE_CHECK([for broken C++ reinterpret_cast], | |
826 octave_cv_cxx_broken_reinterpret_cast, [ | |
827 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <cmath>]], [[ | |
828 typedef double (*fptr) (double); | |
829 fptr psin = sin; | |
830 void *vptr = reinterpret_cast<void *> (psin); | |
831 psin = reinterpret_cast<fptr> (vptr);]])], | |
832 octave_cv_cxx_broken_reinterpret_cast=no, | |
833 octave_cv_cxx_broken_reinterpret_cast=yes)]) | |
834 if test $octave_cv_cxx_broken_reinterpret_cast = yes ; then | |
835 AC_DEFINE(CXX_BROKEN_REINTERPRET_CAST, 1, [Define to 1 if C++ reinterpret_cast fails for function pointers.]) | |
836 fi | |
837 AC_LANG_POP(C++)]) | |
838 dnl | |
839 dnl Find find program. | |
840 dnl | |
841 # Prefer GNU find if found. | |
842 AN_MAKEVAR([FIND], [OCTAVE_PROG_FIND]) | |
843 AN_PROGRAM([gfind], [OCTAVE_PROG_FIND]) | |
844 AN_PROGRAM([find], [OCTAVE_PROG_FIND]) | |
845 AC_DEFUN([OCTAVE_PROG_FIND], | |
846 [AC_CHECK_PROGS(FIND, gfind find, )]) | |
847 dnl | |
848 dnl Find sed program. | |
849 dnl | |
850 # Check for a fully-functional sed program, that truncates | |
851 # as few characters as possible and that supports "\(X\|Y\)" | |
852 # style regular expression alternation. Prefer GNU sed if found. | |
853 AC_DEFUN([OCTAVE_PROG_SED], | |
854 [AC_MSG_CHECKING([for a usable sed]) | |
855 if test -z "$SED"; then | |
856 AC_CACHE_VAL(ac_cv_path_sed, [ | |
857 # Loop through the user's path and test for sed and gsed. | |
858 # Then use that list of sed's as ones to test for truncation. | |
859 _AS_PATH_WALK([$PATH], | |
860 [for ac_prog in sed gsed; do | |
861 for ac_exec_ext in '' $ac_executable_extensions; do | |
862 if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then | |
863 _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" | |
864 fi | |
865 done | |
866 done | |
867 ]) | |
868 AS_TMPDIR(sed) | |
869 _max=0 | |
870 _count=0 | |
871 # Add /usr/xpg4/bin/sed as it is typically found on Solaris | |
872 # along with /bin/sed that truncates output. | |
873 for _sed in $_sed_list /usr/xpg4/bin/sed; do | |
874 test ! -f ${_sed} && break | |
875 cat /dev/null > "$tmp/sed.in" | |
876 _count=0 | |
877 echo $ECHO_N "0123456789$ECHO_C" >"$tmp/sed.in" | |
878 # Check for GNU sed and select it if it is found. | |
879 if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then | |
880 octave_cv_path_sed=${_sed} | |
881 break; | |
882 fi | |
883 # Reject if RE alternation is not handled. | |
884 if test "`echo 'this and that' | ${_sed} -n 's/\(this\|that\).*$/\1/p'`" != "this"; then | |
885 continue; | |
886 fi | |
887 while true; do | |
888 cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" | |
889 mv "$tmp/sed.tmp" "$tmp/sed.in" | |
890 cp "$tmp/sed.in" "$tmp/sed.nl" | |
891 echo >>"$tmp/sed.nl" | |
892 ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break | |
893 cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break | |
894 # 10000 chars as input seems more than enough | |
895 test $_count -gt 10 && break | |
896 _count=`expr $_count + 1` | |
897 if test $_count -gt $_max; then | |
898 _max=$_count | |
899 octave_cv_path_sed=$_sed | |
900 fi | |
901 done | |
902 done | |
903 rm -rf "$tmp" | |
904 ]) | |
905 SED=$octave_cv_path_sed | |
906 if test -z "$SED"; then | |
907 AC_MSG_ERROR([no usable version of sed found]) | |
908 fi | |
909 fi | |
910 AC_SUBST(SED) | |
911 AC_MSG_RESULT([$SED]) | |
912 ]) | |
913 dnl | |
914 dnl Find Perl program. | |
915 dnl | |
916 AC_DEFUN([OCTAVE_PROG_PERL], | |
917 [AC_CHECK_PROG(PERL, perl, perl, []) | |
918 AC_SUBST(PERL) | |
919 ]) | |
920 dnl | |
921 dnl Find Python program. | |
922 dnl | |
923 AC_DEFUN([OCTAVE_PROG_PYTHON], | |
924 [AC_CHECK_PROG(PYTHON, python, python, []) | |
925 AC_SUBST(PYTHON) | |
926 ]) | |
927 dnl | |
928 dnl Find desktop-file-install program. | |
929 dnl | |
930 AC_DEFUN([OCTAVE_PROG_DESKTOP_FILE_INSTALL], | |
931 [AC_CHECK_PROG(DESKTOP_FILE_INSTALL, desktop-file-install, desktop-file-install, []) | |
932 AC_SUBST(DESKTOP_FILE_INSTALL) | |
933 ]) | |
934 dnl | |
935 dnl Check for IEEE 754 data format. | |
936 dnl | |
937 AC_DEFUN([OCTAVE_IEEE754_DATA_FORMAT], | |
938 [AC_MSG_CHECKING([for IEEE 754 data format]) | |
939 AC_CACHE_VAL(octave_cv_ieee754_data_format, | |
940 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
941 int | |
942 main (void) | |
943 { | |
944 typedef union { unsigned char c[8]; double d; } ieeebytes; | |
945 | |
946 ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43}; | |
947 ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c}; | |
948 | |
949 return l.d != 1234567891234567.0 && b.d != 1234567891234567.0; | |
950 }]])], | |
951 octave_cv_ieee754_data_format=yes, | |
952 octave_cv_ieee754_data_format=no, | |
953 octave_cv_ieee754_data_format=yes)]) | |
954 if test "$cross_compiling" = yes; then | |
955 AC_MSG_RESULT([$octave_cv_ieee754_data_format assumed for cross compilation]) | |
956 else | |
957 AC_MSG_RESULT([$octave_cv_ieee754_data_format]) | |
958 fi | |
959 if test "$octave_cv_ieee754_data_format" = yes; then | |
960 AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1, [Define to 1 if your system uses IEEE 754 data format.]) | |
961 else | |
962 ## If the format is unknown, then you will probably not have a | |
963 ## useful system, so we will abort here. Anyone wishing to | |
964 ## experiment with building Octave on a system without IEEE | |
965 ## floating point should be capable of removing this check and | |
966 ## the one in the octave_ieee_init function in liboctave/lo-ieee.cc. | |
967 AC_MSG_ERROR([IEEE 754 data format required for building Octave]) | |
968 fi | |
969 ]) | |
970 dnl | |
971 dnl Check for UMFPACK separately split complex matrix and RHS. Note | |
972 dnl that as umfpack.h can be in three different places, rather than | |
973 dnl include it, just declare the functions needed. | |
974 dnl | |
975 dnl Assumes that the check for umfpack has already been performed. | |
976 dnl | |
977 AC_DEFUN([OCTAVE_UMFPACK_SEPERATE_SPLIT], | |
978 [AC_MSG_CHECKING([for UMFPACK seperate complex matrix and rhs split]) | |
979 AC_CACHE_VAL(octave_cv_umfpack_seperate_split, | |
980 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
981 #include <stdlib.h> | |
982 #if defined (HAVE_UFSPARSE_UMFPACK_h) | |
983 #include <ufsparse/umfpack.h> | |
984 #elif defined (HAVE_UMFPACK_UMFPACK_H) | |
985 #include <umfpack/umfpack.h> | |
986 #elif defined (HAVE_UMFPACK_H) | |
987 #include <umfpack.h> | |
988 #endif | |
989 int n = 5; | |
990 int Ap[] = {0, 2, 5, 9, 10, 12}; | |
991 int Ai[] = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4}; | |
992 double Ax[] = {2., 0., 3., 0., 3., 0., -1., 0., 4., 0., 4., 0., | |
993 -3., 0., 1., 0., 2., 0., 2., 0., 6., 0., 1., 0.}; | |
994 double br[] = {8., 45., -3., 3., 19.}; | |
995 double bi[] = {0., 0., 0., 0., 0.}; | |
996 int main (void) | |
997 { | |
998 double *null = (double *) NULL ; | |
999 double *x = (double *)malloc (2 * n * sizeof(double)); | |
1000 int i ; | |
1001 void *Symbolic, *Numeric ; | |
1002 (void) umfpack_zi_symbolic (n, n, Ap, Ai, Ax, null, &Symbolic, null, null) ; | |
1003 (void) umfpack_zi_numeric (Ap, Ai, Ax, null, Symbolic, &Numeric, null, null) ; | |
1004 umfpack_zi_free_symbolic (&Symbolic) ; | |
1005 (void) umfpack_zi_solve (0, Ap, Ai, Ax, null, x, null, br, bi, | |
1006 Numeric, null, null) ; | |
1007 umfpack_zi_free_numeric (&Numeric) ; | |
1008 for (i = 0; i < n; i++, x+=2) | |
1009 if (fabs(*x - i - 1.) > 1.e-13) | |
1010 return (1); | |
1011 return (0) ; | |
1012 } | |
1013 ]])], | |
1014 octave_cv_umfpack_seperate_split=yes, | |
1015 octave_cv_umfpack_seperate_split=no, | |
1016 octave_cv_umfpack_seperate_split=yes)]) | |
1017 if test "$cross_compiling" = yes; then | |
1018 AC_MSG_RESULT([$octave_cv_umfpack_seperate_split assumed for cross compilation]) | |
1019 else | |
1020 AC_MSG_RESULT([$octave_cv_umfpack_seperate_split]) | |
1021 fi | |
1022 if test "$octave_cv_umfpack_seperate_split" = yes; then | |
1023 AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1, [Define to 1 if the UMFPACK Complex solver allow matrix and RHS to be split independently.]) | |
1024 fi | |
1025 ]) | |
1026 dnl | |
1027 dnl Check whether using HDF5 DLL under Windows. This is done by | |
1028 dnl testing for a data symbol in the HDF5 library, which would | |
1029 dnl require the definition of _HDF5USEDL_ under MSVC compiler. | |
1030 dnl | |
1031 AC_DEFUN([OCTAVE_HDF5_DLL], [ | |
1032 AC_CACHE_CHECK([if _HDF5USEDLL_ needs to be defined],octave_cv_hdf5_dll, [ | |
1033 AC_TRY_LINK([#include <hdf5.h>], [hid_t x = H5T_NATIVE_DOUBLE; return x], | |
1034 octave_cv_hdf5_dll=no, [ | |
1035 save_CFLAGS="$CFLAGS" | |
1036 CFLAGS="$CFLAGS -DWIN32 -D_HDF5USEDLL_" | |
1037 save_LIBS="$LIBS" | |
1038 LIBS="$HDF5_LIBS $LIBS" | |
1039 AC_TRY_LINK([#include <hdf5.h>], [hid_t x = H5T_NATIVE_DOUBLE; return x], | |
1040 octave_cv_hdf5_dll=yes, | |
1041 octave_cv_hdf5_dll=no) | |
1042 CFLAGS="$save_CFLAGS" | |
1043 LIBS="$save_LIBS"])]) | |
1044 if test "$octave_cv_hdf5_dll" = yes; then | |
1045 AC_DEFINE(_HDF5USEDLL_, 1, [Define to 1 if using HDF5 dll (Win32).]) | |
1046 fi]) | |
1047 dnl | |
1048 dnl Check whether HDF5 library has version 1.6 API functions. | |
1049 dnl | |
1050 AC_DEFUN([OCTAVE_HDF5_HAS_ENFORCED_16_API], [ | |
1051 AC_CACHE_CHECK([whether HDF5 library has enforced version 1.6 API], | |
1052 octave_cv_hdf5_has_enforced_16_api, [ | |
1053 AC_TRY_LINK([ | |
1054 #include <hdf5.h> | |
1055 ], [ | |
1056 H5Eset_auto (0, 0);], [ | |
1057 octave_cv_hdf5_has_enforced_16_api=yes], [ | |
1058 octave_cv_hdf5_has_enforced_16_api=no])]) | |
1059 if test "$octave_cv_hdf5_has_enforced_16_api" != "yes"; then | |
1060 AC_DEFINE(HAVE_HDF5_18, 1, [Define to 1 if >=HDF5-1.8 is available.]) | |
1061 fi | |
1062 ]) | |
1063 dnl | |
1064 dnl Check for the Qhull version. | |
1065 dnl | |
1066 AC_DEFUN([OCTAVE_CHECK_QHULL_VERSION], | |
1067 [AC_CACHE_CHECK([for qh_version in $QHULL_LIBS], | |
1068 octave_cv_lib_qhull_version, [ | |
1069 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
1070 #include <stdio.h> | |
1071 #if defined (HAVE_LIBQHULL_LIBQHULL_H) | |
1072 # include <libqhull/libqhull.h> | |
1073 # include <libqhull/qset.h> | |
1074 # include <libqhull/geom.h> | |
1075 # include <libqhull/poly.h> | |
1076 # include <libqhull/io.h> | |
1077 #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H) | |
1078 # if defined (HAVE_QHULL_LIBQHULL_H) | |
1079 # include <qhull/libqhull.h> | |
1080 # else | |
1081 # include <qhull/qhull.h> | |
1082 # endif | |
1083 # include <qhull/qset.h> | |
1084 # include <qhull/geom.h> | |
1085 # include <qhull/poly.h> | |
1086 # include <qhull/io.h> | |
1087 #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H) | |
1088 # if defined (HAVE_LIBQHULL_H) | |
1089 # include <libqhull.h> | |
1090 # else | |
1091 # include <qhull.h> | |
1092 # endif | |
1093 # include <qset.h> | |
1094 # include <geom.h> | |
1095 # include <poly.h> | |
1096 # include <io.h> | |
1097 #endif | |
1098 ]], [[ | |
1099 const char *tmp = qh_version; | |
1100 ]])], [octave_cv_lib_qhull_version=yes], [octave_cv_lib_qhull_version=no])]) | |
1101 if test "$octave_cv_lib_qhull_version" = no; then | |
1102 AC_DEFINE(NEED_QHULL_VERSION, 1, | |
1103 [Define to 1 if the Qhull library needs a qh_version variable defined.]) | |
1104 fi | |
1105 ]) | |
1106 dnl | |
1107 dnl Check whether Qhull works (does not crash). | |
1108 dnl | |
1109 AC_DEFUN([OCTAVE_CHECK_QHULL_OK], | |
1110 [AC_CACHE_CHECK([whether the qhull library works], | |
1111 octave_cv_lib_qhull_ok, [ | |
1112 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | |
1113 #include <stdio.h> | |
1114 #if defined (HAVE_LIBQHULL_LIBQHULL_H) | |
1115 # include <libqhull/libqhull.h> | |
1116 # include <libqhull/qset.h> | |
1117 # include <libqhull/geom.h> | |
1118 # include <libqhull/poly.h> | |
1119 # include <libqhull/io.h> | |
1120 #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H) | |
1121 # if defined (HAVE_QHULL_LIBQHULL_H) | |
1122 # include <qhull/libqhull.h> | |
1123 # else | |
1124 # include <qhull/qhull.h> | |
1125 # endif | |
1126 # include <qhull/qset.h> | |
1127 # include <qhull/geom.h> | |
1128 # include <qhull/poly.h> | |
1129 # include <qhull/io.h> | |
1130 #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H) | |
1131 # if defined (HAVE_LIBQHULL_H) | |
1132 # include <libqhull.h> | |
1133 # else | |
1134 # include <qhull.h> | |
1135 # endif | |
1136 # include <qset.h> | |
1137 # include <geom.h> | |
1138 # include <poly.h> | |
1139 # include <io.h> | |
1140 #endif | |
1141 #ifdef NEED_QHULL_VERSION | |
1142 char *qh_version = "version"; | |
1143 #endif | |
1144 ]], [[ | |
1145 int dim = 2; | |
1146 int n = 4; | |
1147 coordT points[8] = { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5 }; | |
1148 boolT ismalloc = 0; | |
1149 return qh_new_qhull (dim, n, points, ismalloc, "qhull ", 0, stderr); | |
1150 ]])], | |
1151 [octave_cv_lib_qhull_ok=yes], | |
1152 [octave_cv_lib_qhull_ok=no], | |
1153 [octave_cv_lib_qhull_ok=yes])]) | |
1154 if test "$octave_cv_lib_qhull_ok" = "yes"; then | |
1155 $1 | |
1156 else | |
1157 $2 | |
1158 fi | |
1159 ]) | |
1160 dnl | |
1161 dnl Check whether ARPACK works (does not crash). | |
1162 dnl | |
1163 dnl Using a pure Fortran program doesn't seem to crash when linked | |
1164 dnl with the buggy ARPACK library but the C++ program does. Maybe it | |
1165 dnl is the memory allocation that exposes the bug and using statically | |
1166 dnl allocated arrays in Fortran does not? | |
1167 dnl | |
1168 AC_DEFUN([OCTAVE_CHECK_ARPACK_OK], [ | |
1169 AC_LANG_PUSH(C++) | |
1170 AC_CACHE_CHECK([whether the arpack library works], | |
1171 [octave_cv_lib_arpack_ok], [ | |
1172 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | |
1173 // External functions from ARPACK library | |
1174 extern "C" int | |
1175 F77_FUNC (dnaupd, DNAUPD) (int&, const char *, const int&, const char *, | |
1176 int&, const double&, double*, const int&, | |
1177 double*, const int&, int*, int*, double*, | |
1178 double*, const int&, int&, long int, long int); | |
1179 | |
1180 extern "C" int | |
1181 F77_FUNC (dneupd, DNEUPD) (const int&, const char *, int*, double*, | |
1182 double*, double*, const int&, | |
1183 const double&, const double&, double*, | |
1184 const char*, const int&, const char *, | |
1185 int&, const double&, double*, const int&, | |
1186 double*, const int&, int*, int*, double*, | |
1187 double*, const int&, int&, long int, | |
1188 long int, long int); | |
1189 | |
1190 extern "C" int | |
1191 F77_FUNC (dgemv, DGEMV) (const char *, const int&, const int&, | |
1192 const double&, const double*, const int&, | |
1193 const double*, const int&, const double&, | |
1194 double*, const int&, long int); | |
1195 | |
1196 #include <cfloat> | |
1197 | |
1198 void | |
1199 doit (void) | |
1200 { | |
1201 // Based on function EigsRealNonSymmetricMatrix from liboctave/eigs-base.cc. | |
1202 | |
1203 // Problem matrix. See bug #31479 | |
1204 int n = 4; | |
1205 double *m = new double [n * n]; | |
1206 m[0] = 1, m[4] = 0, m[8] = 0, m[12] = -1; | |
1207 m[1] = 0, m[5] = 1, m[9] = 0, m[13] = 0; | |
1208 m[2] = 0, m[6] = 0, m[10] = 1, m[14] = 0; | |
1209 m[3] = 0, m[7] = 0, m[11] = 2, m[15] = 1; | |
1210 | |
1211 double *resid = new double [4]; | |
1212 | |
1213 resid[0] = 0.960966; | |
1214 resid[1] = 0.741195; | |
1215 resid[2] = 0.150143; | |
1216 resid[3] = 0.868067; | |
1217 | |
1218 int *ip = new int [11]; | |
1219 | |
1220 ip[0] = 1; // ishift | |
1221 ip[1] = 0; // ip[1] not referenced | |
1222 ip[2] = 300; // mxiter, maximum number of iterations | |
1223 ip[3] = 1; // NB blocksize in recurrence | |
1224 ip[4] = 0; // nconv, number of Ritz values that satisfy convergence | |
1225 ip[5] = 0; // ip[5] not referenced | |
1226 ip[6] = 1; // mode | |
1227 ip[7] = 0; // ip[7] to ip[10] are return values | |
1228 ip[8] = 0; | |
1229 ip[9] = 0; | |
1230 ip[10] = 0; | |
1231 | |
1232 int *ipntr = new int [14]; | |
1233 | |
1234 int k = 1; | |
1235 int p = 3; | |
1236 int lwork = 3 * p * (p + 2); | |
1237 | |
1238 double *v = new double [n * (p + 1)]; | |
1239 double *workl = new double [lwork + 1]; | |
1240 double *workd = new double [3 * n + 1]; | |
1241 | |
1242 int ido = 0; | |
1243 int info = 0; | |
1244 | |
1245 double tol = DBL_EPSILON; | |
1246 | |
1247 do | |
1248 { | |
1249 F77_FUNC (dnaupd, DNAUPD) (ido, "I", n, "LM", k, tol, resid, p, | |
1250 v, n, ip, ipntr, workd, workl, lwork, | |
1251 info, 1L, 2L); | |
1252 | |
1253 if (ido == -1 || ido == 1 || ido == 2) | |
1254 { | |
1255 double *x = workd + ipntr[0] - 1; | |
1256 double *y = workd + ipntr[1] - 1; | |
1257 | |
1258 F77_FUNC (dgemv, DGEMV) ("N", n, n, 1.0, m, n, x, 1, 0.0, | |
1259 y, 1, 1L); | |
1260 } | |
1261 else | |
1262 { | |
1263 if (info < 0) | |
1264 { | |
1265 return; // Error | |
1266 } | |
1267 | |
1268 break; | |
1269 } | |
1270 } | |
1271 while (1); | |
1272 | |
1273 int *sel = new int [p]; | |
1274 | |
1275 // In Octave, the dimensions of dr and di are k+1, but k+2 avoids segfault | |
1276 double *dr = new double [k + 1]; | |
1277 double *di = new double [k + 1]; | |
1278 double *workev = new double [3 * p]; | |
1279 | |
1280 for (int i = 0; i < k + 1; i++) | |
1281 dr[i] = di[i] = 0.; | |
1282 | |
1283 int rvec = 1; | |
1284 | |
1285 double sigmar = 0.0; | |
1286 double sigmai = 0.0; | |
1287 | |
1288 // In Octave, this is n*(k+1), but k+2 avoids segfault | |
1289 double *z = new double [n * (k + 1)]; | |
1290 | |
1291 F77_FUNC (dneupd, DNEUPD) (rvec, "A", sel, dr, di, z, n, sigmar, | |
1292 sigmai, workev, "I", n, "LM", k, tol, | |
1293 resid, p, v, n, ip, ipntr, workd, | |
1294 workl, lwork, info, 1L, 1L, 2L); | |
1295 } | |
1296 ]], [[ | |
1297 for (int i = 0; i < 10; i++) | |
1298 doit (); | |
1299 ]])], | |
1300 [octave_cv_lib_arpack_ok=yes], | |
1301 [octave_cv_lib_arpack_ok=no], | |
1302 [octave_cv_lib_arpack_ok=yes])]) | |
1303 AC_LANG_POP(C++) | |
1304 if test "$octave_cv_lib_arpack_ok" = "yes"; then | |
1305 $1 | |
1306 else | |
1307 $2 | |
1308 fi | |
1309 ]) | |
1310 dnl | |
1311 dnl Check for OpenGL. If found, define OPENGL_LIBS. | |
1312 dnl | |
1313 dnl FIXME: The following tests should probably check for the | |
1314 dnl libraries separately. | |
1315 dnl | |
1316 dnl FIXME: Should we allow a way to specify a directory for OpenGL | |
1317 dnl libraries and header files? | |
1318 dnl | |
1319 AC_DEFUN([OCTAVE_OPENGL], [ | |
1320 OPENGL_LIBS= | |
1321 | |
1322 ### On MacOSX systems the OpenGL framework can be used | |
1323 OCTAVE_HAVE_FRAMEWORK(OpenGL, [ | |
1324 #include <OpenGL/gl.h> | |
1325 #include <OpenGL/glu.h> ], [GLint par; glGetIntegerv (GL_VIEWPORT, &par);], | |
1326 [have_framework_opengl="yes"], [have_framework_opengl="no"]) | |
1327 | |
1328 if test $have_framework_opengl = "yes"; then | |
1329 AC_DEFINE(HAVE_FRAMEWORK_OPENGL, 1, [Define to 1 if framework OPENGL is available.]) | |
1330 OPENGL_LIBS="-Wl,-framework -Wl,OpenGL" | |
1331 AC_MSG_NOTICE([adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS]) | |
1332 OCTAVE_GLUTESSCALLBACK_THREEDOTS | |
1333 else | |
1334 case $canonical_host_type in | |
1335 *-*-mingw32* | *-*-msdosmsvc) | |
1336 AC_CHECK_HEADERS(windows.h) | |
1337 ;; | |
1338 esac | |
1339 have_opengl_incs=no | |
1340 AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h], [ | |
1341 AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h], [ | |
1342 have_opengl_incs=yes; break], [], [ | |
1343 #ifdef HAVE_WINDOWS_H | |
1344 #include <windows.h> | |
1345 #endif | |
1346 ]) | |
1347 break | |
1348 ], [], [ | |
1349 #ifdef HAVE_WINDOWS_H | |
1350 #include <windows.h> | |
1351 #endif | |
1352 ]) | |
1353 | |
1354 if test "$have_opengl_incs" = "yes"; then | |
1355 case $canonical_host_type in | |
1356 *-*-mingw32* | *-*-msdosmsvc) | |
1357 save_LIBS="$LIBS" | |
1358 LIBS="$LIBS -lopengl32" | |
1359 AC_MSG_CHECKING([for glEnable in -lopengl32]) | |
1360 AC_TRY_LINK([ | |
1361 #if HAVE_WINDOWS_H | |
1362 #include <windows.h> | |
1363 #endif | |
1364 #if defined (HAVE_GL_GL_H) | |
1365 #include <GL/gl.h> | |
1366 #elif defined (HAVE_OPENGL_GL_H) | |
1367 #include <OpenGL/gl.h> | |
1368 #endif | |
1369 ], [glEnable(GL_SMOOTH);], OPENGL_LIBS="-lopengl32 -lglu32") | |
1370 LIBS="$save_LIBS" | |
1371 if test "x$OPENGL_LIBS" != "x"; then | |
1372 AC_MSG_RESULT(yes) | |
1373 else | |
1374 AC_MSG_RESULT(no) | |
1375 fi | |
1376 ;; | |
1377 *) | |
1378 AC_CHECK_LIB(GL, glEnable, OPENGL_LIBS="-lGL -lGLU") | |
1379 ;; | |
1380 esac | |
1381 fi | |
1382 fi | |
1383 AC_SUBST(OPENGL_LIBS) | |
1384 ]) | |
1385 dnl | |
1386 dnl Check if function gluTessCallback is called with "(...)". | |
1387 dnl | |
1388 AC_DEFUN([OCTAVE_GLUTESSCALLBACK_THREEDOTS], | |
1389 [AC_CACHE_CHECK([whether gluTessCallback is called with "(...)"], | |
1390 octave_cv_glutesscallback_threedots, | |
1391 [AC_LANG_PUSH(C++) | |
1392 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
1393 #ifdef HAVE_GL_GLU_H | |
1394 #include <GL/glu.h> | |
1395 #elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL | |
1396 #include <OpenGL/glu.h> | |
1397 #endif]], | |
1398 [[GLvoid (*func)(...); gluTessCallback(0, 0, func);]])], | |
1399 octave_cv_glutesscallback_threedots="yes", octave_cv_glutesscallback_threedots="no")]) | |
1400 AC_LANG_POP(C++) | |
1401 if test $octave_cv_glutesscallback_threedots = "yes"; then | |
1402 AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1, | |
1403 [Define to 1 if gluTessCallback is called with (...).]) | |
1404 fi | |
1405 ]) | |
1406 dnl | |
1407 dnl Check for support of OpenMP with a given compiler flag. | |
1408 dnl If found define HAVE_OPENMP and add the compile flag | |
1409 dnl to CFLAGS and CXXFLAGS. | |
1410 dnl | |
1411 AC_DEFUN([OCTAVE_CHECK_OPENMP], | |
1412 [AC_MSG_CHECKING([for support of OpenMP]) | |
1413 XCFLAGS="$CFLAGS" | |
1414 CFLAGS="$CFLAGS $1" | |
1415 AC_CACHE_VAL(octave_cv_check_openmp,[ | |
1416 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
1417 #include <omp.h> | |
1418 #include <stdio.h> | |
1419 ]], [[ | |
1420 int main(int argc, char* argv[]) | |
1421 { | |
1422 _Pragma("omp parallel") | |
1423 printf("Hello, world.\n"); | |
1424 return 0; | |
1425 } | |
1426 ]])],octave_cv_openmp=yes, octave_cv_openmmp=no, octave_cv_openmp=no)]) | |
1427 AC_MSG_RESULT($octave_cv_openmp) | |
1428 if test "$octave_cv_openmp" = yes; then | |
1429 AC_DEFINE(HAVE_OPENMP,1,[Define to 1 if compiler supports OpenMP.]) | |
1430 CXXFLAGS="$CXXFLAGS $1" | |
1431 else | |
1432 CFLAGS="$XCFLAGS" | |
1433 fi | |
1434 ]) | |
1435 dnl | |
1436 dnl Configure paths for FreeType2 | |
1437 dnl Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor | |
1438 dnl | |
1439 dnl Copyright 2001, 2003 by | |
1440 dnl David Turner, Robert Wilhelm, and Werner Lemberg. | |
1441 dnl | |
1442 dnl This file is part of the FreeType project, and may only be used, modified, | |
1443 dnl and distributed under the terms of the FreeType project license, | |
1444 dnl LICENSE.TXT. By continuing to use, modify, or distribute this file you | |
1445 dnl indicate that you have read the license and understand and accept it | |
1446 dnl fully. | |
1447 dnl | |
1448 dnl As a special exception to the FreeType project license, this file may be | |
1449 dnl distributed as part of a program that contains a configuration script | |
1450 dnl generated by Autoconf, under the same distribution terms as the rest of | |
1451 dnl that program. | |
1452 dnl | |
1453 dnl serial 2 | |
1454 dnl | |
1455 dnl AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) | |
1456 dnl Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS. | |
1457 dnl MINIMUM-VERSION is what libtool reports; the default is `7.0.1' (this is | |
1458 dnl FreeType 2.0.4). | |
1459 dnl | |
1460 AC_DEFUN([AC_CHECK_FT2], | |
1461 [dnl Get the cflags and libraries from the freetype-config script | |
1462 dnl | |
1463 AC_ARG_WITH([ft-prefix], | |
1464 dnl don't quote AS_HELP_STRING! | |
1465 AS_HELP_STRING([--with-ft-prefix=PREFIX], | |
1466 [Prefix where FreeType is installed (optional)]), | |
1467 [ft_config_prefix="$withval"], | |
1468 [ft_config_prefix=""]) | |
1469 | |
1470 AC_ARG_WITH([ft-exec-prefix], | |
1471 dnl don't quote AS_HELP_STRING! | |
1472 AS_HELP_STRING([--with-ft-exec-prefix=PREFIX], | |
1473 [Exec prefix where FreeType is installed (optional)]), | |
1474 [ft_config_exec_prefix="$withval"], | |
1475 [ft_config_exec_prefix=""]) | |
1476 | |
1477 AC_ARG_ENABLE([freetypetest], | |
1478 dnl don't quote AS_HELP_STRING! | |
1479 AS_HELP_STRING([--disable-freetypetest], | |
1480 [Do not try to compile and run a test FreeType program]), | |
1481 [], | |
1482 [enable_fttest=yes]) | |
1483 | |
1484 if test x$ft_config_exec_prefix != x ; then | |
1485 ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix" | |
1486 if test x${FT2_CONFIG+set} != xset ; then | |
1487 FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config | |
1488 fi | |
1489 fi | |
1490 | |
1491 if test x$ft_config_prefix != x ; then | |
1492 ft_config_args="$ft_config_args --prefix=$ft_config_prefix" | |
1493 if test x${FT2_CONFIG+set} != xset ; then | |
1494 FT2_CONFIG=$ft_config_prefix/bin/freetype-config | |
1495 fi | |
1496 fi | |
1497 | |
1498 AC_PATH_PROG([FT2_CONFIG], [freetype-config], [no]) | |
1499 | |
1500 min_ft_version=m4_if([$1], [], [7.0.1], [$1]) | |
1501 AC_MSG_CHECKING([for FreeType -- version >= $min_ft_version]) | |
1502 no_ft="" | |
1503 if test "$FT2_CONFIG" = "no" ; then | |
1504 no_ft=yes | |
1505 else | |
1506 FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags` | |
1507 FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs` | |
1508 ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \ | |
1509 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
1510 ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \ | |
1511 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
1512 ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \ | |
1513 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
1514 ft_min_major_version=`echo $min_ft_version | \ | |
1515 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
1516 ft_min_minor_version=`echo $min_ft_version | \ | |
1517 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
1518 ft_min_micro_version=`echo $min_ft_version | \ | |
1519 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
1520 if test x$enable_fttest = xyes ; then | |
1521 ft_config_is_lt="" | |
1522 if test $ft_config_major_version -lt $ft_min_major_version ; then | |
1523 ft_config_is_lt=yes | |
1524 else | |
1525 if test $ft_config_major_version -eq $ft_min_major_version ; then | |
1526 if test $ft_config_minor_version -lt $ft_min_minor_version ; then | |
1527 ft_config_is_lt=yes | |
1528 else | |
1529 if test $ft_config_minor_version -eq $ft_min_minor_version ; then | |
1530 if test $ft_config_micro_version -lt $ft_min_micro_version ; then | |
1531 ft_config_is_lt=yes | |
1532 fi | |
1533 fi | |
1534 fi | |
1535 fi | |
1536 fi | |
1537 if test x$ft_config_is_lt = xyes ; then | |
1538 no_ft=yes | |
1539 else | |
1540 ac_save_CFLAGS="$CFLAGS" | |
1541 ac_save_LIBS="$LIBS" | |
1542 CFLAGS="$CFLAGS $FT2_CFLAGS" | |
1543 LIBS="$FT2_LIBS $LIBS" | |
1544 | |
1545 dnl | |
1546 dnl Sanity checks for the results of freetype-config to some extent. | |
1547 dnl | |
1548 AC_RUN_IFELSE([ | |
1549 AC_LANG_SOURCE([[ | |
1550 | |
1551 #include <ft2build.h> | |
1552 #include FT_FREETYPE_H | |
1553 #include <stdio.h> | |
1554 #include <stdlib.h> | |
1555 | |
1556 int | |
1557 main() | |
1558 { | |
1559 FT_Library library; | |
1560 FT_Error error; | |
1561 | |
1562 error = FT_Init_FreeType(&library); | |
1563 | |
1564 if (error) | |
1565 return 1; | |
1566 else | |
1567 { | |
1568 FT_Done_FreeType(library); | |
1569 return 0; | |
1570 } | |
1571 } | |
1572 | |
1573 ]]) | |
1574 ], | |
1575 [], | |
1576 [no_ft=yes], | |
1577 [echo $ECHO_N "cross compiling; assuming OK... $ECHO_C"]) | |
1578 | |
1579 CFLAGS="$ac_save_CFLAGS" | |
1580 LIBS="$ac_save_LIBS" | |
1581 fi dnl test $ft_config_version -lt $ft_min_version | |
1582 fi dnl test x$enable_fttest = xyes | |
1583 fi dnl test "$FT2_CONFIG" = "no" | |
1584 | |
1585 if test x$no_ft = x ; then | |
1586 AC_MSG_RESULT([yes]) | |
1587 m4_if([$2], [], [:], [$2]) | |
1588 else | |
1589 AC_MSG_RESULT([no]) | |
1590 if test "$FT2_CONFIG" = "no" ; then | |
1591 warn_ft2_config = " | |
1592 | |
1593 The freetype-config script installed by FreeType 2 could not be found. | |
1594 If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in your | |
1595 path, or set the FT2_CONFIG environment variable to the full path to | |
1596 freetype-config. | |
1597 " | |
1598 OCTAVE_CONFIGURE_WARNING([warn_ft2_config]) | |
1599 else | |
1600 if test x$ft_config_is_lt = xyes ; then | |
1601 warn_ft2_too_old=" | |
1602 | |
1603 Your installed version of the FreeType 2 library is too old. If you | |
1604 have different versions of FreeType 2, make sure that correct values | |
1605 for --with-ft-prefix or --with-ft-exec-prefix are used, or set the | |
1606 FT2_CONFIG environment variable to the full path to freetype-config. | |
1607 " | |
1608 OCTAVE_CONFIGURE_WARNING([warn_ft2_too_old]) | |
1609 else | |
1610 warn_ft2_failed=" | |
1611 | |
1612 The FreeType test program failed to run. If your system uses shared | |
1613 libraries and they are installed outside the normal system library | |
1614 path, make sure the variable LD_LIBRARY_PATH (or whatever is | |
1615 appropiate for your system) is correctly set. | |
1616 " | |
1617 OCTAVE_CONFIGURE_WARNING([warn_ft2_failed]) | |
1618 fi | |
1619 fi | |
1620 | |
1621 FT2_CFLAGS="" | |
1622 FT2_LIBS="" | |
1623 m4_if([$3], [], [:], [$3]) | |
1624 fi | |
1625 | |
1626 AC_SUBST([FT2_CFLAGS]) | |
1627 AC_SUBST([FT2_LIBS])]) | |
1628 dnl end of freetype2.m4 | |
1629 | |
1630 dnl | |
1631 dnl Check whether a math mapper function is available in <cmath>. | |
1632 dnl Will define HAVE_CMATH_FUNC if there is a double variant and | |
1633 dnl HAVE_CMATH_FUNCF if there is a float variant. | |
1634 dnl Currently capable of checking for functions with single | |
1635 dnl argument and returning bool/int/real. | |
1636 dnl | |
1637 AC_DEFUN([OCTAVE_CMATH_FUNC],[ | |
1638 AC_MSG_CHECKING([for std::$1 in <cmath>]) | |
1639 AC_LANG_PUSH(C++) | |
1640 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
1641 #include <cmath> | |
1642 void take_func (bool (*func) (double x)); | |
1643 void take_func (int (*func) (double x)); | |
1644 void take_func (double (*func) (double x)); | |
1645 ]], | |
1646 [[ | |
1647 take_func(std::$1); | |
1648 ]])], | |
1649 [AC_MSG_RESULT([yes]) | |
1650 AC_DEFINE(HAVE_CMATH_[]AS_TR_CPP($1),1,[Define to 1 if <cmath> provides $1.])], | |
1651 [AC_MSG_RESULT([no])]) | |
1652 AC_MSG_CHECKING([for std::$1 (float variant) in <cmath>]) | |
1653 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
1654 #include <cmath> | |
1655 void take_func (bool (*func) (float x)); | |
1656 void take_func (int (*func) (float x)); | |
1657 void take_func (float (*func) (float x)); | |
1658 ]], | |
1659 [[ | |
1660 take_func(std::$1); | |
1661 ]])], | |
1662 [AC_MSG_RESULT([yes]) | |
1663 AC_DEFINE(HAVE_CMATH_[]AS_TR_CPP($1)F,1,[Define to 1 if <cmath> provides float variant of $1.])], | |
1664 [AC_MSG_RESULT([no])]) | |
1665 AC_LANG_POP(C++) | |
1666 ]) | |
1667 | |
1668 dnl | |
1669 dnl Check whether fast signed integer arithmetics using bit tricks | |
1670 dnl can be used in oct-inttypes.h. Defines HAVE_FAST_INT_OPS if | |
1671 dnl the following conditions hold: | |
1672 dnl 1. Signed numbers are represented by twos complement | |
1673 dnl (see <http://en.wikipedia.org/wiki/Two%27s_complement>) | |
1674 dnl 2. static_cast to unsigned int counterpart works like interpreting | |
1675 dnl the signed bit pattern as unsigned (and is thus zero-cost). | |
1676 dnl 3. Signed addition and subtraction yield the same bit results as unsigned. | |
1677 dnl (We use casts to prevent optimization interference, so there is no | |
1678 dnl need for things like -ftrapv). | |
1679 dnl 4. Bit operations on signed integers work like on unsigned integers, | |
1680 dnl except for the shifts. Shifts are arithmetic. | |
1681 dnl | |
1682 AC_DEFUN([OCTAVE_FAST_INT_OPS], | |
1683 [AC_CACHE_CHECK([whether fast integer arithmetics is usable], | |
1684 octave_cv_fast_int_ops, | |
1685 [AC_LANG_PUSH(C++) | |
1686 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | |
1687 #include <limits> | |
1688 template<class UT, class ST> | |
1689 static bool | |
1690 do_test (UT, ST) | |
1691 { | |
1692 volatile ST s = std::numeric_limits<ST>::min () / 3; | |
1693 volatile UT u = static_cast<UT> (s); | |
1694 if (*(reinterpret_cast<volatile ST *> (&u)) != s) return true; | |
1695 | |
1696 u = 0; u = ~u; | |
1697 if (*(reinterpret_cast<volatile ST *> (&u)) != -1) return true; | |
1698 | |
1699 ST sx, sy; | |
1700 sx = std::numeric_limits<ST>::max () / 2 + 1; | |
1701 sy = std::numeric_limits<ST>::max () / 2 + 2; | |
1702 if (static_cast<ST> (static_cast<UT> (sx) + static_cast<UT> (sy)) | |
1703 != std::numeric_limits<ST>::min () + 1) return true; | |
1704 if (static_cast<ST> (static_cast<UT> (sx) - static_cast<UT> (sy)) | |
1705 != -1) return true; | |
1706 | |
1707 if ((sx & sy) != (static_cast<UT> (sx) & static_cast<UT> (sy))) | |
1708 return true; | |
1709 if ((sx | sy) != (static_cast<UT> (sx) | static_cast<UT> (sy))) | |
1710 return true; | |
1711 if ((sx ^ sy) != (static_cast<UT> (sx) ^ static_cast<UT> (sy))) | |
1712 return true; | |
1713 if ((-1 >> 1) != -1) return true; | |
1714 return false; | |
1715 } | |
1716 | |
1717 #define DO_TEST(T) \ | |
1718 if (do_test (static_cast<unsigned T> (0), static_cast<signed T> (0))) \ | |
1719 return sizeof (T); | |
1720 ]],[[ | |
1721 DO_TEST(char) | |
1722 DO_TEST(short) | |
1723 DO_TEST(int) | |
1724 DO_TEST(long) | |
1725 #if (defined(HAVE_LONG_LONG_INT) && defined(HAVE_UNSIGNED_LONG_LONG_INT)) | |
1726 DO_TEST(long long) | |
1727 #endif | |
1728 ]])], | |
1729 [octave_cv_fast_int_ops=yes], | |
1730 [octave_cv_fast_int_ops=no], | |
1731 [octave_cv_fast_int_ops=yes]) | |
1732 AC_LANG_POP(C++)]) | |
1733 if test $octave_cv_fast_int_ops = yes; then | |
1734 AC_DEFINE(HAVE_FAST_INT_OPS, 1, | |
1735 [Define to 1 if signed integers use two's complement.]) | |
1736 fi | |
1737 ]) | |
1738 dnl | |
1739 dnl Check to see if the compiler and the linker can handle the flags | |
1740 dnl "-framework $1" for the given prologue $2 and the given body $3 of | |
1741 dnl a source file. Arguments 2 and 3 optionally can also be empty. | |
1742 dnl Add options (lower case letters $1) "--with-framework-$1" and | |
1743 dnl "--without-framework-$1". If this test is successful then perform | |
1744 dnl $4, otherwise do $5. | |
1745 dnl | |
1746 AC_DEFUN([OCTAVE_HAVE_FRAMEWORK], [ | |
1747 AC_MSG_CHECKING([whether ${LD-ld} accepts -framework $1]) | |
1748 AC_CACHE_VAL(octave_cv_framework_$1, [ | |
1749 XLDFLAGS="$LDFLAGS" | |
1750 LDFLAGS="$LDFLAGS -framework $1" | |
1751 AC_LANG_PUSH(C++) | |
1752 AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])], | |
1753 eval "octave_cv_framework_$1=yes", | |
1754 eval "octave_cv_framework_$1=no") | |
1755 AC_LANG_POP(C++) | |
1756 LDFLAGS="$XLDFLAGS" | |
1757 ]) | |
1758 if test "$octave_cv_framework_$1" = "yes"; then | |
1759 AC_MSG_RESULT(yes) | |
1760 AC_ARG_WITH(framework-m4_tolower($1), | |
1761 [AS_HELP_STRING([--without-framework-m4_tolower($1)], | |
1762 [don't use framework $1])], | |
1763 with_have_framework=$withval, with_have_framework="yes") | |
1764 if test "$with_have_framework" = "yes"; then | |
1765 [$4] | |
1766 else | |
1767 AC_MSG_NOTICE([framework rejected by --without-framework-m4_tolower($1)]) | |
1768 [$5] | |
1769 fi | |
1770 else | |
1771 AC_MSG_RESULT(no) | |
1772 [$5] | |
1773 fi | |
1774 ]) | |
1775 | |
1776 ############################################################################## | |
1777 ############################################################################## | |
1778 | |
1779 # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- | |
1780 # | |
1781 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>. | |
1782 # | |
1783 # This program is free software; you can redistribute it and/or modify | |
1784 # it under the terms of the GNU General Public License as published by | |
1785 # the Free Software Foundation; either version 2 of the License, or | |
1786 # (at your option) any later version. | |
1787 # | |
1788 # This program is distributed in the hope that it will be useful, but | |
1789 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
1790 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1791 # General Public License for more details. | |
1792 # | |
1793 # You should have received a copy of the GNU General Public License | |
1794 # along with this program; if not, write to the Free Software | |
1795 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1796 # | |
1797 # As a special exception to the GNU General Public License, if you | |
1798 # distribute this file as part of a program that contains a | |
1799 # configuration script generated by Autoconf, you may include it under | |
1800 # the same distribution terms that you use for the rest of that program. | |
1801 | |
1802 # PKG_PROG_PKG_CONFIG([MIN-VERSION]) | |
1803 # ---------------------------------- | |
1804 AC_DEFUN([PKG_PROG_PKG_CONFIG], | |
1805 [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) | |
1806 m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) | |
1807 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl | |
1808 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then | |
1809 AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) | |
1810 fi | |
1811 if test -n "$PKG_CONFIG"; then | |
1812 _pkg_min_version=m4_default([$1], [0.9.0]) | |
1813 AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) | |
1814 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then | |
1815 AC_MSG_RESULT([yes]) | |
1816 else | |
1817 AC_MSG_RESULT([no]) | |
1818 PKG_CONFIG="" | |
1819 fi | |
1820 | |
1821 fi[]dnl | |
1822 ])# PKG_PROG_PKG_CONFIG | |
1823 | |
1824 # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) | |
1825 # | |
1826 # Check to see whether a particular set of modules exists. Similar | |
1827 # to PKG_CHECK_MODULES(), but does not set variables or print errors. | |
1828 # | |
1829 # | |
1830 # Similar to PKG_CHECK_MODULES, make sure that the first instance of | |
1831 # this or PKG_CHECK_MODULES is called, or make sure to call | |
1832 # PKG_CHECK_EXISTS manually | |
1833 # -------------------------------------------------------------- | |
1834 AC_DEFUN([PKG_CHECK_EXISTS], | |
1835 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
1836 if test -n "$PKG_CONFIG" && \ | |
1837 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then | |
1838 m4_ifval([$2], [$2], [:]) | |
1839 m4_ifvaln([$3], [else | |
1840 $3])dnl | |
1841 fi]) | |
1842 | |
1843 | |
1844 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) | |
1845 # --------------------------------------------- | |
1846 m4_define([_PKG_CONFIG], | |
1847 [if test -n "$PKG_CONFIG"; then | |
1848 if test -n "$$1"; then | |
1849 pkg_cv_[]$1="$$1" | |
1850 else | |
1851 PKG_CHECK_EXISTS([$3], | |
1852 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], | |
1853 [pkg_failed=yes]) | |
1854 fi | |
1855 else | |
1856 pkg_failed=untried | |
1857 fi[]dnl | |
1858 ])# _PKG_CONFIG | |
1859 | |
1860 # _PKG_SHORT_ERRORS_SUPPORTED | |
1861 # ----------------------------- | |
1862 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], | |
1863 [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) | |
1864 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then | |
1865 _pkg_short_errors_supported=yes | |
1866 else | |
1867 _pkg_short_errors_supported=no | |
1868 fi[]dnl | |
1869 ])# _PKG_SHORT_ERRORS_SUPPORTED | |
1870 | |
1871 | |
1872 # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], | |
1873 # [ACTION-IF-NOT-FOUND]) | |
1874 # | |
1875 # | |
1876 # Note that if there is a possibility the first call to | |
1877 # PKG_CHECK_MODULES might not happen, you should be sure to include an | |
1878 # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac | |
1879 # | |
1880 # | |
1881 # -------------------------------------------------------------- | |
1882 AC_DEFUN([PKG_CHECK_MODULES], | |
1883 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
1884 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl | |
1885 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl | |
1886 | |
1887 pkg_failed=no | |
1888 AC_MSG_CHECKING([for $1]) | |
1889 | |
1890 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) | |
1891 _PKG_CONFIG([$1][_LIBS], [libs], [$2]) | |
1892 | |
1893 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS | |
1894 and $1[]_LIBS to avoid the need to call pkg-config. | |
1895 See the pkg-config man page for more details.]) | |
1896 | |
1897 if test $pkg_failed = yes; then | |
1898 _PKG_SHORT_ERRORS_SUPPORTED | |
1899 if test $_pkg_short_errors_supported = yes; then | |
1900 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` | |
1901 else | |
1902 $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` | |
1903 fi | |
1904 # Put the nasty error message in config.log where it belongs | |
1905 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD | |
1906 | |
1907 ifelse([$4], , [AC_MSG_ERROR(dnl | |
1908 [Package requirements ($2) were not met: | |
1909 | |
1910 $$1_PKG_ERRORS | |
1911 | |
1912 Consider adjusting the PKG_CONFIG_PATH environment variable if you | |
1913 installed software in a non-standard prefix. | |
1914 | |
1915 _PKG_TEXT | |
1916 ])], | |
1917 [AC_MSG_RESULT([no]) | |
1918 $4]) | |
1919 elif test $pkg_failed = untried; then | |
1920 ifelse([$4], , [AC_MSG_FAILURE(dnl | |
1921 [The pkg-config script could not be found or is too old. Make sure it | |
1922 is in your PATH or set the PKG_CONFIG environment variable to the full | |
1923 path to pkg-config. | |
1924 | |
1925 _PKG_TEXT | |
1926 | |
1927 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])], | |
1928 [$4]) | |
1929 else | |
1930 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS | |
1931 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS | |
1932 AC_MSG_RESULT([yes]) | |
1933 ifelse([$3], , :, [$3]) | |
1934 fi[]dnl | |
1935 ])# PKG_CHECK_MODULES | |
1936 | |
1937 dnl | |
1938 dnl Include external macros. | |
1939 dnl | |
1940 | |
1941 m4_include([m4/ax_pthread.m4]) | |
1942 m4_include([m4/ax_blas.m4]) | |
1943 m4_include([m4/ax_blas_f77_func.m4]) | |
1944 m4_include([m4/ax_lapack.m4]) |