1232
|
1 dnl aclocal.m4 -- extra macros for configuring Octave |
|
2 dnl |
2847
|
3 dnl Copyright (C) 1996, 1997 John W. Eaton |
1232
|
4 dnl |
|
5 dnl This file is part of Octave. |
|
6 dnl |
|
7 dnl Octave is free software; you can redistribute it and/or modify it |
|
8 dnl under the terms of the GNU General Public License as published by the |
7016
|
9 dnl Free Software Foundation; either version 3 of the License, or (at |
|
10 dnl your option) any later version. |
1232
|
11 dnl |
|
12 dnl Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 dnl for more details. |
|
16 dnl |
|
17 dnl You should have received a copy of the GNU General Public License |
7016
|
18 dnl along with Octave; see the file COPYING. If not, see |
|
19 dnl <http://www.gnu.org/licenses/>. |
2548
|
20 dnl |
2813
|
21 dnl ---------------------------------------------------------------------- |
|
22 dnl |
|
23 dnl Figure out the hardware-vendor-os info. |
|
24 dnl |
|
25 dnl OCTAVE_HOST_TYPE |
|
26 AC_DEFUN(OCTAVE_HOST_TYPE, |
|
27 [AC_CANONICAL_HOST |
|
28 if test -z "$host"; then |
|
29 host=unknown |
|
30 fi |
|
31 canonical_host_type=$host |
|
32 if test "$host" = unknown; then |
|
33 AC_MSG_WARN([configuring Octave for unknown system type |
|
34 ]) |
|
35 fi |
3130
|
36 AC_SUBST(canonical_host_type)]) |
2813
|
37 dnl |
|
38 dnl Set default value for a variable and substitute it. |
|
39 dnl |
|
40 dnl OCTAVE_SET_DEFAULT |
|
41 AC_DEFUN(OCTAVE_SET_DEFAULT, |
3176
|
42 [ifelse($#, 2, [: ${$1=$2} |
2813
|
43 ])dnl |
|
44 AC_MSG_RESULT([defining $1 to be $$1]) |
|
45 AC_SUBST($1)]) |
|
46 dnl |
|
47 dnl |
|
48 dnl OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS |
|
49 AC_DEFUN(OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS, |
|
50 [if test "${with_$1+set}" = set; then |
|
51 if test "${with_$2+set}" = set; then |
|
52 if test "$with_$2" = no; then |
|
53 true |
|
54 else |
|
55 $3 |
|
56 fi |
|
57 fi |
|
58 fi]) |
|
59 dnl |
3130
|
60 dnl Check for ar. |
|
61 dnl |
|
62 AC_DEFUN(OCTAVE_PROG_AR, |
|
63 [if test -z "$AR"; then |
|
64 AR=ar |
|
65 fi |
|
66 AC_SUBST(AR) |
|
67 |
|
68 if test -z "$ARFLAGS"; then |
|
69 ARFLAGS="rc" |
|
70 fi |
|
71 AC_SUBST(ARFLAGS) |
|
72 ]) |
|
73 dnl |
2574
|
74 dnl See if the standard string class has npos as a member. |
|
75 dnl |
|
76 AC_DEFUN(OCTAVE_STRING_NPOS, |
|
77 [AC_CACHE_CHECK([whether including <string> defines NPOS], |
|
78 octave_cv_string_npos, |
3888
|
79 [AC_LANG_PUSH(C++) |
5844
|
80 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string>]], |
|
81 [[size_t foo = NPOS]])], |
2574
|
82 octave_cv_string_npos=yes, octave_cv_string_npos=no)]) |
|
83 if test $octave_cv_string_npos = no; then |
3887
|
84 AC_DEFINE(NPOS, [std::string::npos], [Define (to string::npos) if <string> doesn't]) |
2574
|
85 fi |
3888
|
86 AC_LANG_POP(C++) |
2574
|
87 ]) |
|
88 dnl |
4360
|
89 dnl See if the compiler supports placement delete |
|
90 dnl |
|
91 AC_DEFUN(OCTAVE_PLACEMENT_DELETE, |
|
92 [AC_CACHE_CHECK([whether <new> defines placement delete operator], |
|
93 octave_cv_placement_delete, |
|
94 [AC_LANG_PUSH(C++) |
5844
|
95 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <new>]], |
|
96 [[operator delete((void *)0, (void *)0);]])], |
4360
|
97 octave_cv_placement_delete=yes, octave_cv_placement_delete=no)]) |
|
98 if test $octave_cv_placement_delete = yes; then |
|
99 AC_DEFINE(HAVE_PLACEMENT_DELETE,1,[Define if C++ supports operator delete(void *, void *)]) |
|
100 fi |
|
101 AC_LANG_POP(C++) |
|
102 ]) |
|
103 dnl |
4366
|
104 dnl See if the compiler dynamic auto arrays |
|
105 dnl |
|
106 AC_DEFUN(OCTAVE_DYNAMIC_AUTO_ARRAYS, |
|
107 [AC_CACHE_CHECK([whether C++ supports dynamic auto arrays], |
|
108 octave_cv_dynamic_auto_arrays, |
|
109 [AC_LANG_PUSH(C++) |
5844
|
110 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], |
|
111 [[void test(char *); int length(); char x[length()]; test(x);]])], |
4366
|
112 octave_cv_dynamic_auto_arrays=yes, octave_cv_dynamic_auto_arrays=no)]) |
|
113 if test $octave_cv_dynamic_auto_arrays = yes; then |
|
114 AC_DEFINE(HAVE_DYNAMIC_AUTO_ARRAYS,1,[Define if C++ supports dynamic auto arrays]) |
|
115 fi |
|
116 AC_LANG_POP(C++) |
|
117 ]) |
|
118 dnl |
1707
|
119 dnl The following test is from Karl Berry's Kpathseach library. I'm |
|
120 dnl including it here in case we someday want to make the use of |
|
121 dnl kpathsea optional. |
1708
|
122 dnl |
|
123 dnl Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment. |
|
124 dnl This test program is due to Mike Hibler <mike@cs.utah.edu>. |
|
125 dnl We don't actually need to run this if we don't have putenv, but it |
|
126 dnl doesn't hurt. |
|
127 AC_DEFUN(OCTAVE_SMART_PUTENV, |
|
128 [AC_MSG_CHECKING(whether putenv uses malloc) |
1707
|
129 AC_CACHE_VAL(octave_cv_func_putenv_malloc, |
5844
|
130 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
1707
|
131 #define VAR "YOW_VAR" |
|
132 #define STRING1 "GabbaGabbaHey" |
|
133 #define STRING2 "Yow!!" /* should be shorter than STRING1 */ |
|
134 extern char *getenv (); /* in case char* and int don't mix gracefully */ |
|
135 main () |
|
136 { |
|
137 char *str1, *rstr1, *str2, *rstr2; |
|
138 str1 = getenv (VAR); |
|
139 if (str1) |
|
140 exit (1); |
|
141 str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1); |
|
142 if (str1 == 0) |
|
143 exit (2); |
|
144 strcpy (str1, VAR); |
|
145 strcat (str1, "="); |
|
146 strcat (str1, STRING1); |
|
147 if (putenv (str1) < 0) |
|
148 exit (3); |
|
149 rstr1 = getenv (VAR); |
|
150 if (rstr1 == 0) |
|
151 exit (4); |
|
152 rstr1 -= strlen (VAR) + 1; |
|
153 if (strncmp (rstr1, VAR, strlen (VAR))) |
|
154 exit (5); |
|
155 str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1); |
|
156 if (str2 == 0 || str1 == str2) |
|
157 exit (6); |
|
158 strcpy (str2, VAR); |
|
159 strcat (str2, "="); |
|
160 strcat (str2, STRING2); |
|
161 if (putenv (str2) < 0) |
|
162 exit (7); |
|
163 rstr2 = getenv (VAR); |
|
164 if (rstr2 == 0) |
|
165 exit (8); |
|
166 rstr2 -= strlen (VAR) + 1; |
|
167 #if 0 |
|
168 printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2); |
|
169 /* |
|
170 * If string from first call was reused for the second call, |
|
171 * you had better not do a free on the first string! |
|
172 */ |
|
173 if (rstr1 == rstr2) |
|
174 printf ("#define SMART_PUTENV\n"); |
|
175 else |
|
176 printf ("#undef SMART_PUTENV\n"); |
|
177 #endif |
|
178 exit (rstr1 == rstr2 ? 0 : 1); |
5844
|
179 }]])], octave_cv_func_putenv_malloc=yes, octave_cv_func_putenv_malloc=no, |
1707
|
180 octave_cv_func_putenv_malloc=no)])dnl |
|
181 AC_MSG_RESULT($octave_cv_func_putenv_malloc) |
|
182 if test $octave_cv_func_putenv_malloc = yes; then |
3887
|
183 AC_DEFINE(SMART_PUTENV,1,[To quiet autoheader.]) |
1708
|
184 fi]) |
1788
|
185 dnl |
2469
|
186 dnl These two checks for signal functions were originally part of the |
|
187 dnl aclocal.m4 file distributed with bash 2.0. |
|
188 dnl |
|
189 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) |
|
190 AC_DEFUN(OCTAVE_SIGNAL_CHECK, |
|
191 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
192 AC_MSG_CHECKING(for type of signal functions) |
|
193 AC_CACHE_VAL(octave_cv_signal_vintage, |
|
194 [ |
5842
|
195 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], |
|
196 [[sigset_t ss; |
|
197 struct sigaction sa; |
|
198 sigemptyset (&ss); |
|
199 sigsuspend (&ss); |
|
200 sigaction (SIGINT, &sa, (struct sigaction *) 0); |
|
201 sigprocmask (SIG_BLOCK, &ss, (sigset_t *) 0);]])], |
|
202 [octave_cv_signal_vintage=posix], |
|
203 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], |
|
204 [[int mask = sigmask (SIGINT); |
|
205 sigsetmask (mask); |
|
206 sigblock (mask); |
|
207 sigpause (mask);]])], |
|
208 [octave_cv_signal_vintage=4.2bsd], |
|
209 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h> |
5844
|
210 RETSIGTYPE foo() { }]], |
5842
|
211 [[int mask = sigmask (SIGINT); |
|
212 sigset (SIGINT, foo); |
|
213 sigrelse (SIGINT); |
|
214 sighold (SIGINT); |
5844
|
215 sigpause (SIGINT);]])], |
5842
|
216 [octave_cv_signal_vintage=svr3], |
|
217 [octave_cv_signal_vintage=v7])])])]) |
2469
|
218 AC_MSG_RESULT($octave_cv_signal_vintage) |
2491
|
219 if test "$octave_cv_signal_vintage" = posix; then |
5842
|
220 AC_DEFINE(HAVE_POSIX_SIGNALS, 1, [Define if you have POSIX style signals.]) |
2491
|
221 elif test "$octave_cv_signal_vintage" = "4.2bsd"; then |
5842
|
222 AC_DEFINE(HAVE_BSD_SIGNALS, 1, [Define if you have BSD style signals.]) |
2491
|
223 elif test "$octave_cv_signal_vintage" = svr3; then |
5842
|
224 AC_DEFINE(HAVE_USG_SIGHOLD, 1, [Define if you have System V Release 3 signals.]) |
2469
|
225 fi |
|
226 ]) |
|
227 dnl |
|
228 AC_DEFUN(OCTAVE_REINSTALL_SIGHANDLERS, |
|
229 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
230 AC_REQUIRE([OCTAVE_SIGNAL_CHECK]) |
|
231 AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked]) |
|
232 AC_CACHE_VAL(octave_cv_must_reinstall_sighandlers, |
5844
|
233 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
2469
|
234 #include <signal.h> |
|
235 #ifdef HAVE_UNISTD_H |
|
236 #include <unistd.h> |
|
237 #endif |
|
238 typedef RETSIGTYPE sigfunc(); |
|
239 int nsigint; |
|
240 #ifdef HAVE_POSIX_SIGNALS |
|
241 sigfunc * |
|
242 set_signal_handler(sig, handler) |
|
243 int sig; |
|
244 sigfunc *handler; |
|
245 { |
|
246 struct sigaction act, oact; |
|
247 act.sa_handler = handler; |
|
248 act.sa_flags = 0; |
|
249 sigemptyset (&act.sa_mask); |
|
250 sigemptyset (&oact.sa_mask); |
|
251 sigaction (sig, &act, &oact); |
|
252 return (oact.sa_handler); |
|
253 } |
|
254 #else |
|
255 #define set_signal_handler(s, h) signal(s, h) |
|
256 #endif |
|
257 RETSIGTYPE |
|
258 sigint(s) |
|
259 int s; |
|
260 { |
|
261 nsigint++; |
|
262 } |
|
263 main() |
|
264 { |
|
265 nsigint = 0; |
|
266 set_signal_handler(SIGINT, sigint); |
|
267 kill((int)getpid(), SIGINT); |
|
268 kill((int)getpid(), SIGINT); |
|
269 exit(nsigint != 2); |
|
270 } |
5844
|
271 ]])], |
|
272 octave_cv_must_reinstall_sighandlers=no, |
|
273 octave_cv_must_reinstall_sighandlers=yes, |
3130
|
274 if test "$octave_cv_signal_vintage" = svr3; then |
|
275 octave_cv_must_reinstall_sighandlers=yes |
|
276 else |
|
277 octave_cv_must_reinstall_sighandlers=no |
|
278 fi)]) |
|
279 if test "$cross_compiling" = yes; then |
|
280 AC_MSG_RESULT([$octave_cv_must_reinstall_sighandlers assumed for cross compilation]) |
|
281 else |
|
282 AC_MSG_RESULT($octave_cv_must_reinstall_sighandlers) |
|
283 fi |
2491
|
284 if test "$octave_cv_must_reinstall_sighandlers" = yes; then |
3887
|
285 AC_DEFINE(MUST_REINSTALL_SIGHANDLERS,1,[Define if signal handlers must be reinstalled after they are called.]) |
2469
|
286 fi |
|
287 ]) |
2626
|
288 dnl |
3107
|
289 dnl Check to see if C++ compiler needs the new friend template declaration |
|
290 dnl syntax. |
|
291 dnl |
|
292 dnl OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL |
|
293 AC_DEFUN(OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL, [ |
|
294 AC_REQUIRE([AC_PROG_CXX]) |
|
295 AC_MSG_CHECKING([for C++ support for new friend template declaration]) |
|
296 AC_CACHE_VAL(octave_cv_cxx_new_friend_template_decl, [ |
3888
|
297 AC_LANG_PUSH(C++) |
3107
|
298 rm -f conftest.h |
|
299 cat > conftest.h <<EOB |
|
300 struct A { |
|
301 friend int operator== (const A&, const A&); |
|
302 A (int) { } |
|
303 }; |
|
304 |
|
305 template <class T> int |
|
306 operator== (const T&, const T&) |
|
307 { |
|
308 return 0; |
|
309 } |
|
310 EOB |
5842
|
311 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "conftest.h"]], |
|
312 [[A a (1); |
|
313 return a == A(1);]])], |
|
314 [octave_cv_cxx_new_friend_template_decl=no], |
|
315 [octave_cv_cxx_new_friend_template_decl=yes]) |
3888
|
316 AC_LANG_POP(C++) |
3107
|
317 ]) |
|
318 AC_MSG_RESULT($octave_cv_cxx_new_friend_template_decl) |
|
319 if test $octave_cv_cxx_new_friend_template_decl = yes; then |
3887
|
320 AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL,1,[Define if your compiler supports `<>' stuff for template friends.]) |
3107
|
321 fi |
|
322 ]) |
3126
|
323 dnl |
3233
|
324 dnl Check to see if C compiler handles FLAG command line option. If |
|
325 dnl two arguments are specified, execute the second arg as shell |
|
326 dnl commands. Otherwise, add FLAG to CFLAGS if the compiler accepts |
|
327 dnl the flag. |
3126
|
328 dnl |
|
329 dnl OCTAVE_CC_FLAG |
|
330 AC_DEFUN(OCTAVE_CC_FLAG, [ |
3908
|
331 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` |
3126
|
332 AC_MSG_CHECKING(whether ${CC-cc} accepts $1) |
|
333 AC_CACHE_VAL(octave_cv_cc_flag_$ac_safe, [ |
3888
|
334 AC_LANG_PUSH(C) |
3126
|
335 XCFLAGS="$CFLAGS" |
|
336 CFLAGS="$CFLAGS $1" |
5177
|
337 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], |
3126
|
338 eval "octave_cv_cc_flag_$ac_safe=yes", |
|
339 eval "octave_cv_cc_flag_$ac_safe=no") |
|
340 CFLAGS="$XCFLAGS" |
3888
|
341 AC_LANG_POP(C) |
3126
|
342 ]) |
|
343 if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then |
|
344 AC_MSG_RESULT(yes) |
3131
|
345 ifelse([$2], , [ |
|
346 CFLAGS="$CFLAGS $1" |
|
347 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2]) |
3126
|
348 else |
|
349 AC_MSG_RESULT(no) |
|
350 ifelse([$3], , , [$3]) |
|
351 fi |
|
352 ]) |
|
353 dnl |
3233
|
354 dnl Check to see if C++ compiler handles FLAG command line option. If |
|
355 dnl two arguments are specified, execute the second arg as shell |
|
356 dnl commands. Otherwise, add FLAG to CXXFLAGS if the compiler accepts |
|
357 dnl the flag. |
3126
|
358 dnl |
|
359 dnl OCTAVE_CXX_FLAG |
|
360 AC_DEFUN(OCTAVE_CXX_FLAG, [ |
3908
|
361 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` |
3222
|
362 AC_MSG_CHECKING(whether ${CXX-g++} accepts $1) |
3126
|
363 AC_CACHE_VAL(octave_cv_cxx_flag_$ac_safe, [ |
3888
|
364 AC_LANG_PUSH(C++) |
3126
|
365 XCXXFLAGS="$CXXFLAGS" |
|
366 CXXFLAGS="$CXXFLAGS $1" |
5177
|
367 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], |
3126
|
368 eval "octave_cv_cxx_flag_$ac_safe=yes", |
|
369 eval "octave_cv_cxx_flag_$ac_safe=no") |
|
370 CXXFLAGS="$XCXXFLAGS" |
3888
|
371 AC_LANG_POP(C++) |
3126
|
372 ]) |
|
373 if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then |
|
374 AC_MSG_RESULT(yes) |
3131
|
375 ifelse([$2], , [ |
|
376 CXXFLAGS="$CXXFLAGS $1" |
|
377 AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2]) |
3126
|
378 else |
|
379 AC_MSG_RESULT(no) |
|
380 ifelse([$3], , , [$3]) |
|
381 fi |
|
382 ]) |
3130
|
383 dnl |
5076
|
384 dnl Check to see if Fortran compiler handles FLAG command line option. If |
|
385 dnl two arguments are specified, execute the second arg as shell |
|
386 dnl commands. Otherwise, add FLAG to FFLAGS if the compiler accepts |
|
387 dnl the flag. |
|
388 dnl |
|
389 dnl OCTAVE_F77_FLAG |
|
390 AC_DEFUN(OCTAVE_F77_FLAG, [ |
|
391 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` |
|
392 AC_MSG_CHECKING(whether ${F77-g77} accepts $1) |
|
393 AC_CACHE_VAL(octave_cv_f77_flag_$ac_safe, [ |
|
394 AC_LANG_PUSH(Fortran 77) |
|
395 XFFLAGS="$FFLAGS" |
|
396 FFLAGS="$FFLAGS $1" |
5177
|
397 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], |
5076
|
398 eval "octave_cv_f77_flag_$ac_safe=yes", |
|
399 eval "octave_cv_f77_flag_$ac_safe=no") |
|
400 FFLAGS="$XFFLAGS" |
|
401 AC_LANG_POP(Fortran 77) |
|
402 ]) |
|
403 if eval "test \"`echo '$octave_cv_f77_flag_'$ac_safe`\" = yes"; then |
|
404 AC_MSG_RESULT(yes) |
|
405 ifelse([$2], , [ |
|
406 FFLAGS="$FFLAGS $1" |
|
407 AC_MSG_RESULT([adding $1 to FFLAGS])], [$2]) |
|
408 else |
|
409 AC_MSG_RESULT(no) |
|
410 ifelse([$3], , , [$3]) |
|
411 fi |
|
412 ]) |
|
413 dnl |
3729
|
414 dnl Check for flex |
|
415 dnl |
|
416 AC_DEFUN(OCTAVE_PROG_FLEX, [ |
|
417 ### For now, don't define LEXLIB to be -lfl -- we don't use anything in |
|
418 ### it, and it might not be installed. |
|
419 ### |
|
420 ### Also make sure that we generate an interactive scanner if we are |
|
421 ### using flex. |
|
422 AC_PROG_LEX |
|
423 case "$LEX" in |
|
424 flex*) |
|
425 LFLAGS="-t -I" |
|
426 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) |
|
427 LEXLIB= |
|
428 ;; |
|
429 *) |
|
430 LEX='$(top_srcdir)/missing flex' |
|
431 warn_flex="I didn't find flex, but it's only a problem if you need to reconstruct lex.cc" |
|
432 AC_MSG_WARN($warn_flex) |
|
433 ;; |
|
434 esac |
|
435 AC_SUBST(LFLAGS) |
|
436 ]) |
|
437 dnl |
|
438 dnl Check for bison |
|
439 dnl |
|
440 AC_DEFUN(OCTAVE_PROG_BISON, [ |
|
441 AC_PROG_YACC |
|
442 case "$YACC" in |
|
443 bison*) |
|
444 ;; |
|
445 *) |
|
446 YACC='$(top_srcdir)/missing bison' |
|
447 warn_bison="I didn't find bison, but it's only a problem if you need to reconstruct parse.cc" |
|
448 AC_MSG_WARN($warn_bison) |
|
449 ;; |
|
450 esac |
|
451 ]) |
|
452 dnl |
3130
|
453 dnl What pager should we use? |
|
454 dnl |
|
455 AC_DEFUN(OCTAVE_PROG_PAGER, |
|
456 [if test "$cross_compiling" = yes; then |
|
457 DEFAULT_PAGER=less |
|
458 AC_MSG_RESULT(assuming $DEFAULT_PAGER exists on $canonical_host_type host) |
|
459 AC_SUBST(DEFAULT_PAGER) |
|
460 else |
|
461 octave_possible_pagers="less more page pg" |
|
462 case "$canonical_host_type" in |
6103
|
463 *-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc) |
3130
|
464 octave_possible_pagers="$octave_possible_pagers more.com" |
|
465 ;; |
|
466 esac |
|
467 |
|
468 AC_CHECK_PROGS(DEFAULT_PAGER, $octave_possible_pagers, []) |
|
469 if test -z "$DEFAULT_PAGER"; then |
|
470 warn_less="I couldn't find \`less', \`more', \`page', or \`pg'" |
|
471 AC_MSG_WARN($warn_less) |
|
472 fi |
|
473 fi |
|
474 ]) |
|
475 dnl |
6821
|
476 dnl Does gnuplot exist? |
3130
|
477 dnl |
4098
|
478 AC_DEFUN(OCTAVE_PROG_GNUPLOT, [ |
|
479 case "$canonical_host_type" in |
6103
|
480 *-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc) |
4098
|
481 gp_names="pgnuplot pipe-gnuplot gnuplot" |
|
482 gp_default=pgnuplot |
|
483 ;; |
|
484 *) |
|
485 gp_names=gnuplot |
|
486 gp_default=gnuplot |
|
487 ;; |
|
488 esac |
|
489 if test "$cross_compiling" = yes; then |
3130
|
490 AC_MSG_RESULT(assuming $GNUPLOT_BINARY exists on $canonical_host_type host) |
|
491 else |
4098
|
492 AC_CHECK_PROGS(GNUPLOT_BINARY, $gp_names) |
6821
|
493 if test -z "$GNUPLOT_BINARY"; then |
5513
|
494 warn_gnuplot=yes |
3130
|
495 |
5076
|
496 GNUPLOT_BINARY="$gp_default" |
|
497 |
3130
|
498 ## If you change this text, be sure to also copy it to the set of |
|
499 ## warnings at the end of the script |
|
500 |
|
501 AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot]) |
|
502 AC_MSG_WARN([installed, but you won't be able to use any of Octave's]) |
|
503 AC_MSG_WARN([plotting commands without it.]) |
|
504 AC_MSG_WARN([]) |
|
505 AC_MSG_WARN([If gnuplot is installed but it isn't in your path, you can]) |
|
506 AC_MSG_WARN([tell Octave where to find it by typing the command]) |
|
507 AC_MSG_WARN([]) |
|
508 AC_MSG_WARN([gnuplot_binary = "/full/path/to/gnuplot/binary"]) |
|
509 AC_MSG_WARN([]) |
|
510 AC_MSG_WARN([at the Octave prompt.]) |
5076
|
511 AC_MSG_WARN([]) |
|
512 AC_MSG_WARN([Setting default value to $GNUPLOT_BINARY]) |
3130
|
513 fi |
|
514 fi |
4098
|
515 AC_DEFINE_UNQUOTED(GNUPLOT_BINARY, "$GNUPLOT_BINARY", [Name of gnuplot program.]) |
3130
|
516 ]) |
|
517 dnl |
3673
|
518 dnl Is gperf installed? |
|
519 dnl |
|
520 dnl OCTAVE_PROG_GPERF |
3731
|
521 AC_DEFUN(OCTAVE_PROG_GPERF, [ |
6119
|
522 AC_CHECK_PROG(GPERF, gperf, gperf, []) |
3731
|
523 if test -n "$GPERF"; then |
|
524 if echo "%{ |
4416
|
525 enum octave_kw_id { a_kw }; |
3731
|
526 %} |
4416
|
527 struct octave_kw { const char *name; int tok; octave_kw_id kw_id; }; |
3731
|
528 %% |
5094
|
529 foo" | $GPERF -t -C -D -E -G -L C++ -H octave_kw_hash -N octave_kw_lookup > /dev/null 2>&1; then |
3731
|
530 true |
|
531 else |
|
532 GPERF="" |
5094
|
533 warn_gperf="I found gperf, but it does not support all of the following options: -t -C -D -E -G -L C++ -H -N; you need gperf 3.0.1 or a more recent version" |
3731
|
534 AC_MSG_WARN($warn_gperf) |
|
535 fi |
|
536 else |
|
537 GPERF='$(top_srcdir)/missing gperf' |
|
538 warn_gperf="I didn't find gperf, but it's only a problem if you need to reconstruct oct-gperf.h" |
|
539 AC_MSG_WARN($warn_gperf) |
|
540 fi |
|
541 AC_SUBST(GPERF) |
3673
|
542 ]) |
|
543 dnl |
5934
|
544 dnl Is ghostscript installed? |
|
545 dnl |
|
546 dnl OCTAVE_PROG_GHOSTSCRIPT |
|
547 AC_DEFUN(OCTAVE_PROG_GHOSTSCRIPT, [ |
6116
|
548 case "$canonical_host_type" in |
|
549 *-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc) |
|
550 gs_names="gs gswin32" |
|
551 ;; |
|
552 *) |
|
553 gs_names=gs |
|
554 ;; |
|
555 esac |
|
556 AC_CHECK_PROGS(GHOSTSCRIPT, $gs_names) |
5934
|
557 if test -z "$GHOSTSCRIPT"; then |
|
558 GHOSTSCRIPT='$(top_srcdir)/missing gs' |
|
559 warn_ghostscript="I didn't find ghostscript, but it's only a problem if you need to reconstruct figures for the manual" |
|
560 AC_MSG_WARN($warn_ghostscript) |
|
561 fi |
|
562 AC_SUBST(GHOSTSCRIPT) |
|
563 ]) |
|
564 dnl |
|
565 dnl Is makeinfo installed? |
|
566 dnl |
|
567 dnl OCTAVE_PROG_MAKEINFO |
|
568 AC_DEFUN(OCTAVE_PROG_MAKEINFO, [ |
6119
|
569 AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, []) |
5934
|
570 if test -z "$MAKEINFO"; then |
|
571 MAKEINFO='$(top_srcdir)/missing makeinfo' |
|
572 warn_makeinfo="I didn't find makeinfo, but it's only a problem if you need to reconstruct the Info version of the manual" |
|
573 AC_MSG_WARN($warn_makeinfo) |
|
574 fi |
|
575 AC_SUBST(MAKEINFO) |
|
576 ]) |
|
577 dnl |
|
578 dnl Is texi2dvi installed? |
|
579 dnl |
|
580 dnl OCTAVE_PROG_TEXI2DVI |
|
581 AC_DEFUN(OCTAVE_PROG_TEXI2DVI, [ |
6119
|
582 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, []) |
5934
|
583 if test -z "$TEXI2DVI"; then |
|
584 TEXI2DVI='$(top_srcdir)/missing texi2dvi' |
|
585 warn_texi2dvi="I didn't find texi2dvi, but it's only a problem if you need to reconstruct the DVI version of the manual" |
|
586 AC_MSG_WARN($warn_texi2dvi) |
|
587 fi |
|
588 AC_SUBST(TEXI2DVI) |
|
589 ]) |
|
590 dnl |
|
591 dnl Is texi2pdf installed? |
|
592 dnl |
|
593 dnl OCTAVE_PROG_TEXI2PDF |
|
594 AC_DEFUN(OCTAVE_PROG_TEXI2PDF, [ |
6116
|
595 AC_REQUIRE([OCTAVE_PROG_TEXI2DVI]) |
6119
|
596 AC_CHECK_PROG(TEXI2PDF, texi2pdf, texi2pdf, []) |
5934
|
597 if test -z "$TEXI2PDF"; then |
6116
|
598 missing=true; |
|
599 if test -n "$TEXI2DVI"; then |
|
600 TEXI2PDF="$TEXI2DVI --pdf" |
|
601 missing=false; |
|
602 fi |
|
603 else |
|
604 missing=false; |
|
605 fi |
|
606 if $missing; then |
5934
|
607 TEXI2PDF='$(top_srcdir)/missing texi2pdf' |
|
608 warn_texi2pdf="I didn't find texi2pdf, but it's only a problem if you need to reconstruct the PDF version of the manual" |
|
609 AC_MSG_WARN($warn_texi2pdf) |
|
610 fi |
|
611 AC_SUBST(TEXI2PDF) |
|
612 ]) |
|
613 dnl |
3222
|
614 dnl Find nm. |
|
615 dnl |
|
616 dnl OCTAVE_PROG_NM |
|
617 AC_DEFUN(OCTAVE_PROG_NM, |
4093
|
618 [AC_CHECK_PROG(NM, ${ac_tool_prefix}nm, ${ac_tool_prefix}nm, []) |
3222
|
619 AC_SUBST(NM) |
|
620 ]) |
|
621 dnl |
|
622 dnl See if the C++ compiler prepends an underscore to external names. |
|
623 dnl |
|
624 dnl OCTAVE_CXX_PREPENDS_UNDERSCORE |
4093
|
625 AC_DEFUN(OCTAVE_CXX_PREPENDS_UNDERSCORE, [ |
|
626 AC_REQUIRE([OCTAVE_PROG_NM]) |
|
627 AC_MSG_CHECKING([whether ${CXX-g++} prepends an underscore to external names]) |
3222
|
628 AC_CACHE_VAL(octave_cv_cxx_prepends_underscore, |
|
629 [octave_cv_cxx_prepends_underscore=no |
3888
|
630 AC_LANG_PUSH(C++) |
3222
|
631 cat > conftest.$ac_ext <<EOF |
3842
|
632 bool FSmy_dld_fcn (void) { return false; } |
3222
|
633 EOF |
|
634 if AC_TRY_EVAL(ac_compile); then |
6057
|
635 if test "`${NM-nm} conftest.$ac_objext | grep _FSmy_dld_fcn`" != ""; then |
3222
|
636 octave_cv_cxx_prepends_underscore=yes |
|
637 fi |
|
638 else |
3888
|
639 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
|
640 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD |
3222
|
641 fi |
3888
|
642 AC_LANG_POP(C++) |
5775
|
643 ### FIXME -- Ignore test result on Windows. Yes it prepends |
4105
|
644 ### underscore, but LoadLibrary ignores it automatically. The |
4102
|
645 ### correct test is to build the shared library then try to grab the |
|
646 ### symbol from it with and without underscore. |
|
647 case "$canonical_host_type" in |
4105
|
648 *-*-cygwin* | *-*-mingw*) |
4102
|
649 octave_cv_cxx_prepends_underscore=no |
|
650 ;; |
5775
|
651 ### FIXME -- Ignore test result on OS X. Yes it prepends |
4162
|
652 ### underscore, but also messes with the name so test fails (incorrectly). |
4685
|
653 *-*-darwin*) |
4162
|
654 octave_cv_cxx_prepends_underscore=yes |
|
655 ;; |
4102
|
656 esac |
3222
|
657 ]) |
|
658 AC_MSG_RESULT($octave_cv_cxx_prepends_underscore) |
|
659 if test $octave_cv_cxx_prepends_underscore = yes; then |
3887
|
660 AC_DEFINE(CXX_PREPENDS_UNDERSCORE, 1, [Define if your compiler prepends underscores to external names.]) |
3222
|
661 fi |
|
662 ]) |
3769
|
663 dnl |
|
664 dnl See if the C++ library is ISO compliant. |
|
665 dnl FIXME: This is obviously very simplistic, and trivially fooled. |
|
666 dnl |
|
667 dnl OCTAVE_CXX_ISO_COMPLIANT_LIBRARY |
|
668 AC_DEFUN(OCTAVE_CXX_ISO_COMPLIANT_LIBRARY, [ |
|
669 AC_REQUIRE([AC_PROG_CXX]) |
|
670 AC_MSG_CHECKING([if C++ library is ISO compliant]) |
|
671 AC_CACHE_VAL(octave_cv_cxx_iso_compliant_library, [ |
3888
|
672 AC_LANG_PUSH(C++) |
3769
|
673 rm -f conftest.h |
3943
|
674 ### Omitting cwctype for now, since it is broken with gcc-3.0.x and |
|
675 ### possibly other versions... |
3769
|
676 for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \ |
|
677 climits clocale cmath complex csetjmp csignal cstdarg cstddef \ |
3943
|
678 cstdio cstdlib cstring ctime cwchar deque exception \ |
3769
|
679 fstream functional iomanip ios iosfwd iostream istream iterator \ |
|
680 limits list locale map memory new numeric ostream queue set \ |
|
681 sstream stack stdexcept streambuf string strstream typeinfo \ |
|
682 utility valarray vector; do |
|
683 echo "#include <$inc>" >> conftest.h |
|
684 done |
5842
|
685 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "conftest.h"]], |
|
686 [[std::bitset<50> flags; |
3769
|
687 flags.set(); |
|
688 int digits = std::numeric_limits<unsigned long>::digits; |
5842
|
689 digits = 0;]])], |
|
690 [octave_cv_cxx_iso_compliant_library=yes], |
|
691 [octave_cv_cxx_iso_compliant_library=no]) |
3888
|
692 AC_LANG_POP(C++) |
3769
|
693 ]) |
|
694 AC_MSG_RESULT($octave_cv_cxx_iso_compliant_library) |
|
695 if test $octave_cv_cxx_iso_compliant_library = yes; then |
3887
|
696 AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, [Define if your C++ runtime library is ISO compliant.]) |
3769
|
697 fi |
|
698 ]) |
3822
|
699 dnl |
|
700 dnl Allow the user disable support for command line editing using GNU |
|
701 dnl readline. |
|
702 dnl |
|
703 dnl OCTAVE_ENABLE_READLINE |
|
704 AC_DEFUN(OCTAVE_ENABLE_READLINE, [ |
|
705 USE_READLINE=true |
4102
|
706 LIBREADLINE= |
3822
|
707 AC_ARG_ENABLE(readline, |
|
708 [ --enable-readline use readline library (default is yes)], |
|
709 [if test "$enableval" = no; then |
3824
|
710 USE_READLINE=false |
3825
|
711 warn_readline="command editing and history features require GNU Readline" |
3824
|
712 fi]) |
3822
|
713 if $USE_READLINE; then |
|
714 AC_CHECK_LIB(readline, rl_set_keyboard_input_timeout, [ |
4102
|
715 LIBREADLINE="-lreadline" |
|
716 LIBS="$LIBREADLINE $LIBS" |
3887
|
717 AC_DEFINE(USE_READLINE, 1, [Define to use the readline library.]) |
3822
|
718 ], [ |
3824
|
719 AC_MSG_WARN([I need GNU Readline 4.2 or later]) |
|
720 AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) |
3822
|
721 ]) |
|
722 fi |
4102
|
723 AC_SUBST(LIBREADLINE) |
3822
|
724 ]) |
3842
|
725 dnl |
|
726 dnl Determine the C++ compiler ABI. It sets the macro CXX_ABI to the |
|
727 dnl name of the ABI, and is used to mangle the C linkage loadable |
|
728 dnl functions to avoid ABI mismatch. GNU C++ currently uses gnu_v2 |
|
729 dnl (GCC versions <= 2.95.x) dnl or gnu_v3 (GCC versions >= 3.0). |
|
730 dnl Set to "unknown" is when we don't know enough about the ABI, which |
|
731 dnl will happen when using an unsupported C++ compiler. |
|
732 dnl |
|
733 dnl OCTAVE_CXX_ABI |
4093
|
734 AC_DEFUN(OCTAVE_CXX_ABI, [ |
|
735 AC_REQUIRE([OCTAVE_PROG_NM]) |
|
736 AC_MSG_CHECKING([C++ ABI version used by ${CXX}]) |
3842
|
737 AC_CACHE_VAL(octave_cv_cxx_abi, |
|
738 [octave_cv_cxx_abi='unknown' |
3888
|
739 AC_LANG_PUSH(C++) |
3842
|
740 cat > conftest.$ac_ext <<EOF |
|
741 bool FSmy_dld_fcn (void) { return false; } |
|
742 EOF |
|
743 if AC_TRY_EVAL(ac_compile); then |
6057
|
744 if test "`${NM-nm} conftest.$ac_objext | grep FSmy_dld_fcn__Fv`" != ""; then |
3842
|
745 octave_cv_cxx_abi='gnu_v2' |
|
746 fi |
6057
|
747 if test "`${NM-nm} conftest.$ac_objext | grep _Z12FSmy_dld_fcnv`" != ""; then |
3842
|
748 octave_cv_cxx_abi='gnu_v3' |
|
749 fi |
6057
|
750 if test "`${NM-nm} conftest.$ac_objext | grep __1cMFSmy_dld_fcn6F_b_`" != ""; then |
3843
|
751 octave_cv_cxx_abi='sun_v5' |
3842
|
752 fi |
|
753 else |
3888
|
754 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
|
755 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD |
3842
|
756 fi |
3888
|
757 AC_LANG_POP(C++) |
3842
|
758 ]) |
|
759 AC_MSG_RESULT($octave_cv_cxx_abi) |
3887
|
760 AC_DEFINE_UNQUOTED(CXX_ABI, $octave_cv_cxx_abi, [Define to the C++ ABI your compiler uses.]) |
3842
|
761 ]) |
4067
|
762 dnl |
5854
|
763 dnl Check to see if C++ reintrepret cast works for function pointers. |
|
764 dnl |
|
765 dnl OCTAVE_CXX_BROKEN_REINTERPRET_CAST |
|
766 dnl |
|
767 AC_DEFUN(OCTAVE_CXX_BROKEN_REINTERPRET_CAST, [ |
|
768 AC_REQUIRE([AC_PROG_CXX]) |
|
769 AC_LANG_PUSH(C++) |
|
770 AC_CACHE_CHECK([for broken C++ reinterpret_cast], |
|
771 octave_cv_cxx_broken_reinterpret_cast, [ |
|
772 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <cmath>]], [[ |
|
773 typedef double (*fptr) (double); |
|
774 fptr psin = sin; |
|
775 void *vptr = reinterpret_cast<void *> (psin); |
|
776 psin = reinterpret_cast<fptr> (vptr);]])], |
|
777 octave_cv_cxx_broken_reinterpret_cast=no, |
|
778 octave_cv_cxx_broken_reinterpret_cast=yes)]) |
|
779 if test $octave_cv_cxx_broken_reinterpret_cast = yes ; then |
|
780 AC_DEFINE(CXX_BROKEN_REINTERPRET_CAST, 1, [Define if C++ reinterpret_cast fails for function pointers.]) |
|
781 fi |
|
782 AC_LANG_POP(C++)]) |
|
783 dnl |
4067
|
784 dnl Determine if mkdir accepts only one argument instead dnl of the usual 2. |
|
785 dnl |
6104
|
786 AC_DEFUN(OCTAVE_MKDIR_TAKES_ONE_ARG, [ |
|
787 AC_LANG_PUSH(C++) |
|
788 AC_CACHE_CHECK([if mkdir takes one argument], octave_cv_mkdir_takes_one_arg, |
5844
|
789 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
4067
|
790 #ifdef HAVE_SYS_STAT_H |
|
791 # include <sys/stat.h> |
|
792 #endif |
|
793 #ifdef HAVE_UNISTD_H |
|
794 # include <unistd.h> |
|
795 #endif |
|
796 #ifdef HAVE_DIRECT_H |
|
797 # include <direct.h> |
5844
|
798 #endif]], [[mkdir ("foo", 0);]])], |
4067
|
799 octave_cv_mkdir_takes_one_arg=no, octave_cv_mkdir_takes_one_arg=yes)]) |
6104
|
800 AC_LANG_POP(C++) |
4067
|
801 if test $octave_cv_mkdir_takes_one_arg = yes ; then |
|
802 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.]) |
|
803 fi |
|
804 ]) |
4084
|
805 # OCTAVE_PROG_SED |
|
806 # -------------- |
|
807 # Check for a fully-functional sed program, that truncates |
6955
|
808 # as few characters as possible and that supports "\(X\|Y\)" |
|
809 # style regular expression alternation. Prefer GNU sed if found. |
4084
|
810 AC_DEFUN([OCTAVE_PROG_SED], |
6955
|
811 [AC_MSG_CHECKING([for a usable sed]) |
4084
|
812 if test -z "$SED"; then |
6822
|
813 AC_CACHE_VAL(ac_cv_path_sed, [ |
|
814 # Loop through the user's path and test for sed and gsed. |
|
815 # Then use that list of sed's as ones to test for truncation. |
|
816 _AS_PATH_WALK([$PATH], |
|
817 [for ac_prog in sed gsed; do |
|
818 for ac_exec_ext in '' $ac_executable_extensions; do |
|
819 if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then |
|
820 _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" |
|
821 fi |
|
822 done |
4084
|
823 done |
6822
|
824 ]) |
|
825 AS_TMPDIR(sed) |
|
826 _max=0 |
4084
|
827 _count=0 |
6822
|
828 # Add /usr/xpg4/bin/sed as it is typically found on Solaris |
|
829 # along with /bin/sed that truncates output. |
|
830 for _sed in $_sed_list /usr/xpg4/bin/sed; do |
|
831 test ! -f ${_sed} && break |
|
832 cat /dev/null > "$tmp/sed.in" |
|
833 _count=0 |
|
834 echo $ECHO_N "0123456789$ECHO_C" >"$tmp/sed.in" |
|
835 # Check for GNU sed and select it if it is found. |
|
836 if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then |
|
837 octave_cv_path_sed=${_sed} |
|
838 break; |
4084
|
839 fi |
6955
|
840 # Reject if RE alternation is not handled. |
|
841 if test "`echo 'this and that' | ${_sed} -n 's/\(this\|that\).*$/\1/p'`" != "this"; then |
|
842 continue; |
|
843 fi |
6822
|
844 while true; do |
|
845 cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" |
|
846 mv "$tmp/sed.tmp" "$tmp/sed.in" |
|
847 cp "$tmp/sed.in" "$tmp/sed.nl" |
|
848 echo >>"$tmp/sed.nl" |
|
849 ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break |
|
850 cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break |
|
851 # 10000 chars as input seems more than enough |
|
852 test $_count -gt 10 && break |
|
853 _count=`expr $_count + 1` |
|
854 if test $_count -gt $_max; then |
|
855 _max=$_count |
|
856 octave_cv_path_sed=$_sed |
|
857 fi |
|
858 done |
4084
|
859 done |
6822
|
860 rm -rf "$tmp" |
|
861 ]) |
|
862 SED=$octave_cv_path_sed |
4084
|
863 fi |
6822
|
864 AC_SUBST(SED) |
4084
|
865 AC_MSG_RESULT([$SED]) |
|
866 ]) |
5465
|
867 dnl |
|
868 dnl Find Perl. |
|
869 dnl |
|
870 dnl OCTAVE_PROG_PERL |
|
871 AC_DEFUN(OCTAVE_PROG_PERL, |
6119
|
872 [AC_CHECK_PROG(PERL, perl, perl, []) |
5465
|
873 AC_SUBST(PERL) |
|
874 ]) |
5468
|
875 dnl |
5495
|
876 dnl Find Python. |
|
877 dnl |
|
878 dnl OCTAVE_PROG_PYTHON |
|
879 AC_DEFUN(OCTAVE_PROG_PYTHON, |
6119
|
880 [AC_CHECK_PROG(PYTHON, python, python, []) |
5495
|
881 AC_SUBST(PYTHON) |
|
882 ]) |
|
883 dnl |
5468
|
884 dnl Find desktop-file-install. |
|
885 dnl |
|
886 dnl OCTAVE_PROG_DESKTOP_FILE_INSTALL |
|
887 AC_DEFUN(OCTAVE_PROG_DESKTOP_FILE_INSTALL, |
6119
|
888 [AC_CHECK_PROG(DESKTOP_FILE_INSTALL, desktop-file-install, desktop-file-install, []) |
5468
|
889 AC_SUBST(DESKTOP_FILE_INSTALL) |
|
890 ]) |
|
891 dnl |
|
892 dnl Check for IEEE 754 data format. |
|
893 dnl |
4853
|
894 AC_DEFUN([OCTAVE_IEEE754_DATA_FORMAT], |
|
895 [AC_MSG_CHECKING([for IEEE 754 data format]) |
|
896 AC_CACHE_VAL(octave_cv_ieee754_data_format, |
5844
|
897 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
4853
|
898 int |
|
899 main (void) |
|
900 { |
|
901 typedef union { unsigned char c[8]; double d; } ieeebytes; |
|
902 |
|
903 ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43}; |
|
904 ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c}; |
|
905 |
|
906 return l.d != 1234567891234567.0 && b.d != 1234567891234567.0; |
5844
|
907 }]])], |
4853
|
908 octave_cv_ieee754_data_format=yes, |
|
909 octave_cv_ieee754_data_format=no, |
|
910 octave_cv_ieee754_data_format=no)]) |
|
911 if test "$cross_compiling" = yes; then |
|
912 AC_MSG_RESULT([$octave_cv_ieee754_data_format assumed for cross compilation]) |
|
913 else |
|
914 AC_MSG_RESULT($octave_cv_ieee754_data_format) |
|
915 fi |
|
916 if test "$octave_cv_ieee754_data_format" = yes; then |
|
917 AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1, [Define if your system uses IEEE 754 data format.]) |
|
918 fi |
|
919 ]) |
5505
|
920 dnl |
|
921 dnl Check for UMFPACK seperately split complex matrix and RHS. Note |
|
922 dnl that as umfpack.h can be in three different places, rather than |
|
923 dnl include it, just declare the functions needed. |
|
924 dnl |
5512
|
925 dnl Assumes that the check for umfpack has already been performed. |
5505
|
926 dnl |
|
927 AC_DEFUN([OCTAVE_UMFPACK_SEPERATE_SPLIT], |
|
928 [AC_MSG_CHECKING([for UMFPACK seperate complex matrix and rhs split]) |
|
929 AC_CACHE_VAL(octave_cv_umfpack_seperate_split, |
5844
|
930 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
5505
|
931 #include <stdlib.h> |
5512
|
932 #if defined (HAVE_UFSPARSE_UMFPACK_h) |
|
933 #include <ufsparse/umfpack.h> |
|
934 #elif defined (HAVE_UMFPACK_UMFPACK_H) |
|
935 #include <umfpack/umfpack.h> |
|
936 #elif defined (HAVE_UMFPACK_H) |
|
937 #include <umfpack.h> |
|
938 #endif |
5505
|
939 int n = 5; |
|
940 int Ap[] = {0, 2, 5, 9, 10, 12}; |
|
941 int Ai[] = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4}; |
|
942 double Ax[] = {2., 0., 3., 0., 3., 0., -1., 0., 4., 0., 4., 0., |
|
943 -3., 0., 1., 0., 2., 0., 2., 0., 6., 0., 1., 0.}; |
|
944 double br[] = {8., 45., -3., 3., 19.}; |
|
945 double bi[] = {0., 0., 0., 0., 0.}; |
|
946 int main (void) |
|
947 { |
|
948 double *null = (double *) NULL ; |
|
949 double *x = (double *)malloc (2 * n * sizeof(double)); |
|
950 int i ; |
|
951 void *Symbolic, *Numeric ; |
|
952 (void) umfpack_zi_symbolic (n, n, Ap, Ai, Ax, null, &Symbolic, null, null) ; |
|
953 (void) umfpack_zi_numeric (Ap, Ai, Ax, null, Symbolic, &Numeric, null, null) ; |
|
954 umfpack_zi_free_symbolic (&Symbolic) ; |
|
955 (void) umfpack_zi_solve (0, Ap, Ai, Ax, null, x, null, br, bi, |
|
956 Numeric, null, null) ; |
|
957 umfpack_zi_free_numeric (&Numeric) ; |
|
958 for (i = 0; i < n; i++, x+=2) |
|
959 if (fabs(*x - i - 1.) > 1.e-13) |
|
960 return (1); |
|
961 return (0) ; |
|
962 } |
5844
|
963 ]])], |
5505
|
964 octave_cv_umfpack_seperate_split=yes, |
|
965 octave_cv_umfpack_seperate_split=no, |
|
966 octave_cv_umfpack_seperate_split=no)]) |
|
967 if test "$cross_compiling" = yes; then |
|
968 AC_MSG_RESULT([$octave_cv_umfpack_seperate_split assumed for cross compilation]) |
|
969 else |
|
970 AC_MSG_RESULT($octave_cv_umfpack_seperate_split) |
|
971 fi |
|
972 if test "$octave_cv_umfpack_seperate_split" = yes; then |
|
973 AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1, [Define if the UMFPACK Complex solver allow matrix and RHS to be split independently]) |
|
974 fi |
|
975 ]) |
6276
|
976 dnl |
|
977 dnl Check whether using HDF5 DLL under Windows. This is done by |
|
978 dnl testing for a data symbol in the HDF5 library, which would |
|
979 dnl requires the definition of _HDF5USEDL_ under MSVC compiler. |
|
980 dnl |
|
981 AC_DEFUN([OCTAVE_HDF5_DLL], [ |
|
982 AC_CACHE_CHECK([if _HDF5USEDLL_ needs to be defined],octave_cv_hdf5_dll, [ |
6724
|
983 AC_TRY_LINK([#include <hdf5.h>], [hid_t x = H5T_NATIVE_DOUBLE; return x], |
6276
|
984 octave_cv_hdf5_dll=no, [ |
|
985 CFLAGS_old=$CFLAGS |
|
986 CFLAGS="$CFLAGS -DWIN32 -D_HDF5USEDLL_" |
6724
|
987 AC_TRY_LINK([#include <hdf5.h>], [hid_t x = H5T_NATIVE_DOUBLE; return x], |
6276
|
988 octave_cv_hdf5_dll=yes, |
|
989 octave_cv_hdf5_dll=no) |
|
990 CFLAGS=$CFLAGS_old])]) |
|
991 if test "$octave_cv_hdf5_dll" = yes; then |
|
992 AC_DEFINE(_HDF5USEDLL_, 1, [Define if using HDF5 dll (Win32)]) |
|
993 fi]) |
6823
|
994 dnl |
|
995 dnl Check for the QHull version. |
|
996 dnl |
|
997 AC_DEFUN(AC_CHECK_QHULL_VERSION, |
|
998 [AC_MSG_CHECKING([for qh_qhull in -lqhull with qh_version]) |
|
999 AC_CACHE_VAL(octave_cv_lib_qhull_version, [ |
|
1000 cat > conftest.c <<EOF |
|
1001 #include <stdio.h> |
|
1002 char *qh_version = "version"; |
|
1003 char qh_qhull(); |
|
1004 int |
|
1005 main(argc, argv) |
|
1006 int argc; |
|
1007 char **argv; |
|
1008 { |
|
1009 qh_qhull(); |
|
1010 return 0; |
|
1011 } |
|
1012 EOF |
|
1013 |
|
1014 octave_qhull_try="${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS conftest.c -o conftest -lqhull $LIBS" |
|
1015 if AC_TRY_EVAL(octave_qhull_try) && test -s conftest ; then |
|
1016 octave_cv_lib_qhull_version=yes |
|
1017 else |
|
1018 octave_cv_lib_qhull_version=no |
|
1019 fi |
|
1020 rm -f conftest.c conftest.o conftest |
|
1021 ])dnl |
|
1022 if test "$octave_cv_lib_qhull_version" = "yes"; then |
|
1023 AC_MSG_RESULT(yes) |
|
1024 ifelse([$1], , , [$1]) |
|
1025 else |
|
1026 AC_MSG_RESULT(no) |
|
1027 ifelse([$2], , , [$2]) |
|
1028 fi |
|
1029 ]) |
|
1030 |