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