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, [ |
6119
|
541 AC_CHECK_PROG(GPERF, gperf, gperf, []) |
3731
|
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, [ |
6116
|
567 case "$canonical_host_type" in |
|
568 *-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc) |
|
569 gs_names="gs gswin32" |
|
570 ;; |
|
571 *) |
|
572 gs_names=gs |
|
573 ;; |
|
574 esac |
|
575 AC_CHECK_PROGS(GHOSTSCRIPT, $gs_names) |
5934
|
576 if test -z "$GHOSTSCRIPT"; then |
|
577 GHOSTSCRIPT='$(top_srcdir)/missing gs' |
|
578 warn_ghostscript="I didn't find ghostscript, but it's only a problem if you need to reconstruct figures for the manual" |
|
579 AC_MSG_WARN($warn_ghostscript) |
|
580 fi |
|
581 AC_SUBST(GHOSTSCRIPT) |
|
582 ]) |
|
583 dnl |
|
584 dnl Is makeinfo installed? |
|
585 dnl |
|
586 dnl OCTAVE_PROG_MAKEINFO |
|
587 AC_DEFUN(OCTAVE_PROG_MAKEINFO, [ |
6119
|
588 AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, []) |
5934
|
589 if test -z "$MAKEINFO"; then |
|
590 MAKEINFO='$(top_srcdir)/missing makeinfo' |
|
591 warn_makeinfo="I didn't find makeinfo, but it's only a problem if you need to reconstruct the Info version of the manual" |
|
592 AC_MSG_WARN($warn_makeinfo) |
|
593 fi |
|
594 AC_SUBST(MAKEINFO) |
|
595 ]) |
|
596 dnl |
|
597 dnl Is texi2dvi installed? |
|
598 dnl |
|
599 dnl OCTAVE_PROG_TEXI2DVI |
|
600 AC_DEFUN(OCTAVE_PROG_TEXI2DVI, [ |
6119
|
601 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, []) |
5934
|
602 if test -z "$TEXI2DVI"; then |
|
603 TEXI2DVI='$(top_srcdir)/missing texi2dvi' |
|
604 warn_texi2dvi="I didn't find texi2dvi, but it's only a problem if you need to reconstruct the DVI version of the manual" |
|
605 AC_MSG_WARN($warn_texi2dvi) |
|
606 fi |
|
607 AC_SUBST(TEXI2DVI) |
|
608 ]) |
|
609 dnl |
|
610 dnl Is texi2pdf installed? |
|
611 dnl |
|
612 dnl OCTAVE_PROG_TEXI2PDF |
|
613 AC_DEFUN(OCTAVE_PROG_TEXI2PDF, [ |
6116
|
614 AC_REQUIRE([OCTAVE_PROG_TEXI2DVI]) |
6119
|
615 AC_CHECK_PROG(TEXI2PDF, texi2pdf, texi2pdf, []) |
5934
|
616 if test -z "$TEXI2PDF"; then |
6116
|
617 missing=true; |
|
618 if test -n "$TEXI2DVI"; then |
|
619 TEXI2PDF="$TEXI2DVI --pdf" |
|
620 missing=false; |
|
621 fi |
|
622 else |
|
623 missing=false; |
|
624 fi |
|
625 if $missing; then |
5934
|
626 TEXI2PDF='$(top_srcdir)/missing texi2pdf' |
|
627 warn_texi2pdf="I didn't find texi2pdf, but it's only a problem if you need to reconstruct the PDF version of the manual" |
|
628 AC_MSG_WARN($warn_texi2pdf) |
|
629 fi |
|
630 AC_SUBST(TEXI2PDF) |
|
631 ]) |
|
632 dnl |
3222
|
633 dnl Find nm. |
|
634 dnl |
|
635 dnl OCTAVE_PROG_NM |
|
636 AC_DEFUN(OCTAVE_PROG_NM, |
4093
|
637 [AC_CHECK_PROG(NM, ${ac_tool_prefix}nm, ${ac_tool_prefix}nm, []) |
3222
|
638 AC_SUBST(NM) |
|
639 ]) |
|
640 dnl |
|
641 dnl See if the C++ compiler prepends an underscore to external names. |
|
642 dnl |
|
643 dnl OCTAVE_CXX_PREPENDS_UNDERSCORE |
4093
|
644 AC_DEFUN(OCTAVE_CXX_PREPENDS_UNDERSCORE, [ |
|
645 AC_REQUIRE([OCTAVE_PROG_NM]) |
|
646 AC_MSG_CHECKING([whether ${CXX-g++} prepends an underscore to external names]) |
3222
|
647 AC_CACHE_VAL(octave_cv_cxx_prepends_underscore, |
|
648 [octave_cv_cxx_prepends_underscore=no |
3888
|
649 AC_LANG_PUSH(C++) |
3222
|
650 cat > conftest.$ac_ext <<EOF |
3842
|
651 bool FSmy_dld_fcn (void) { return false; } |
3222
|
652 EOF |
|
653 if AC_TRY_EVAL(ac_compile); then |
6057
|
654 if test "`${NM-nm} conftest.$ac_objext | grep _FSmy_dld_fcn`" != ""; then |
3222
|
655 octave_cv_cxx_prepends_underscore=yes |
|
656 fi |
|
657 else |
3888
|
658 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
|
659 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD |
3222
|
660 fi |
3888
|
661 AC_LANG_POP(C++) |
5775
|
662 ### FIXME -- Ignore test result on Windows. Yes it prepends |
4105
|
663 ### underscore, but LoadLibrary ignores it automatically. The |
4102
|
664 ### correct test is to build the shared library then try to grab the |
|
665 ### symbol from it with and without underscore. |
|
666 case "$canonical_host_type" in |
4105
|
667 *-*-cygwin* | *-*-mingw*) |
4102
|
668 octave_cv_cxx_prepends_underscore=no |
|
669 ;; |
5775
|
670 ### FIXME -- Ignore test result on OS X. Yes it prepends |
4162
|
671 ### underscore, but also messes with the name so test fails (incorrectly). |
4685
|
672 *-*-darwin*) |
4162
|
673 octave_cv_cxx_prepends_underscore=yes |
|
674 ;; |
4102
|
675 esac |
3222
|
676 ]) |
|
677 AC_MSG_RESULT($octave_cv_cxx_prepends_underscore) |
|
678 if test $octave_cv_cxx_prepends_underscore = yes; then |
3887
|
679 AC_DEFINE(CXX_PREPENDS_UNDERSCORE, 1, [Define if your compiler prepends underscores to external names.]) |
3222
|
680 fi |
|
681 ]) |
3769
|
682 dnl |
|
683 dnl See if the C++ library is ISO compliant. |
|
684 dnl FIXME: This is obviously very simplistic, and trivially fooled. |
|
685 dnl |
|
686 dnl OCTAVE_CXX_ISO_COMPLIANT_LIBRARY |
|
687 AC_DEFUN(OCTAVE_CXX_ISO_COMPLIANT_LIBRARY, [ |
|
688 AC_REQUIRE([AC_PROG_CXX]) |
|
689 AC_MSG_CHECKING([if C++ library is ISO compliant]) |
|
690 AC_CACHE_VAL(octave_cv_cxx_iso_compliant_library, [ |
3888
|
691 AC_LANG_PUSH(C++) |
3769
|
692 rm -f conftest.h |
3943
|
693 ### Omitting cwctype for now, since it is broken with gcc-3.0.x and |
|
694 ### possibly other versions... |
3769
|
695 for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \ |
|
696 climits clocale cmath complex csetjmp csignal cstdarg cstddef \ |
3943
|
697 cstdio cstdlib cstring ctime cwchar deque exception \ |
3769
|
698 fstream functional iomanip ios iosfwd iostream istream iterator \ |
|
699 limits list locale map memory new numeric ostream queue set \ |
|
700 sstream stack stdexcept streambuf string strstream typeinfo \ |
|
701 utility valarray vector; do |
|
702 echo "#include <$inc>" >> conftest.h |
|
703 done |
5842
|
704 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "conftest.h"]], |
|
705 [[std::bitset<50> flags; |
3769
|
706 flags.set(); |
|
707 int digits = std::numeric_limits<unsigned long>::digits; |
5842
|
708 digits = 0;]])], |
|
709 [octave_cv_cxx_iso_compliant_library=yes], |
|
710 [octave_cv_cxx_iso_compliant_library=no]) |
3888
|
711 AC_LANG_POP(C++) |
3769
|
712 ]) |
|
713 AC_MSG_RESULT($octave_cv_cxx_iso_compliant_library) |
|
714 if test $octave_cv_cxx_iso_compliant_library = yes; then |
3887
|
715 AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, [Define if your C++ runtime library is ISO compliant.]) |
3769
|
716 fi |
|
717 ]) |
3822
|
718 dnl |
|
719 dnl Allow the user disable support for command line editing using GNU |
|
720 dnl readline. |
|
721 dnl |
|
722 dnl OCTAVE_ENABLE_READLINE |
|
723 AC_DEFUN(OCTAVE_ENABLE_READLINE, [ |
|
724 USE_READLINE=true |
4102
|
725 LIBREADLINE= |
3822
|
726 AC_ARG_ENABLE(readline, |
|
727 [ --enable-readline use readline library (default is yes)], |
|
728 [if test "$enableval" = no; then |
3824
|
729 USE_READLINE=false |
3825
|
730 warn_readline="command editing and history features require GNU Readline" |
3824
|
731 fi]) |
3822
|
732 if $USE_READLINE; then |
|
733 AC_CHECK_LIB(readline, rl_set_keyboard_input_timeout, [ |
4102
|
734 LIBREADLINE="-lreadline" |
|
735 LIBS="$LIBREADLINE $LIBS" |
3887
|
736 AC_DEFINE(USE_READLINE, 1, [Define to use the readline library.]) |
3822
|
737 ], [ |
3824
|
738 AC_MSG_WARN([I need GNU Readline 4.2 or later]) |
|
739 AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) |
3822
|
740 ]) |
|
741 fi |
4102
|
742 AC_SUBST(LIBREADLINE) |
3822
|
743 ]) |
3842
|
744 dnl |
|
745 dnl Determine the C++ compiler ABI. It sets the macro CXX_ABI to the |
|
746 dnl name of the ABI, and is used to mangle the C linkage loadable |
|
747 dnl functions to avoid ABI mismatch. GNU C++ currently uses gnu_v2 |
|
748 dnl (GCC versions <= 2.95.x) dnl or gnu_v3 (GCC versions >= 3.0). |
|
749 dnl Set to "unknown" is when we don't know enough about the ABI, which |
|
750 dnl will happen when using an unsupported C++ compiler. |
|
751 dnl |
|
752 dnl OCTAVE_CXX_ABI |
4093
|
753 AC_DEFUN(OCTAVE_CXX_ABI, [ |
|
754 AC_REQUIRE([OCTAVE_PROG_NM]) |
|
755 AC_MSG_CHECKING([C++ ABI version used by ${CXX}]) |
3842
|
756 AC_CACHE_VAL(octave_cv_cxx_abi, |
|
757 [octave_cv_cxx_abi='unknown' |
3888
|
758 AC_LANG_PUSH(C++) |
3842
|
759 cat > conftest.$ac_ext <<EOF |
|
760 bool FSmy_dld_fcn (void) { return false; } |
|
761 EOF |
|
762 if AC_TRY_EVAL(ac_compile); then |
6057
|
763 if test "`${NM-nm} conftest.$ac_objext | grep FSmy_dld_fcn__Fv`" != ""; then |
3842
|
764 octave_cv_cxx_abi='gnu_v2' |
|
765 fi |
6057
|
766 if test "`${NM-nm} conftest.$ac_objext | grep _Z12FSmy_dld_fcnv`" != ""; then |
3842
|
767 octave_cv_cxx_abi='gnu_v3' |
|
768 fi |
6057
|
769 if test "`${NM-nm} conftest.$ac_objext | grep __1cMFSmy_dld_fcn6F_b_`" != ""; then |
3843
|
770 octave_cv_cxx_abi='sun_v5' |
3842
|
771 fi |
|
772 else |
3888
|
773 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
|
774 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD |
3842
|
775 fi |
3888
|
776 AC_LANG_POP(C++) |
3842
|
777 ]) |
|
778 AC_MSG_RESULT($octave_cv_cxx_abi) |
3887
|
779 AC_DEFINE_UNQUOTED(CXX_ABI, $octave_cv_cxx_abi, [Define to the C++ ABI your compiler uses.]) |
3842
|
780 ]) |
4067
|
781 dnl |
5854
|
782 dnl Check to see if C++ reintrepret cast works for function pointers. |
|
783 dnl |
|
784 dnl OCTAVE_CXX_BROKEN_REINTERPRET_CAST |
|
785 dnl |
|
786 AC_DEFUN(OCTAVE_CXX_BROKEN_REINTERPRET_CAST, [ |
|
787 AC_REQUIRE([AC_PROG_CXX]) |
|
788 AC_LANG_PUSH(C++) |
|
789 AC_CACHE_CHECK([for broken C++ reinterpret_cast], |
|
790 octave_cv_cxx_broken_reinterpret_cast, [ |
|
791 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <cmath>]], [[ |
|
792 typedef double (*fptr) (double); |
|
793 fptr psin = sin; |
|
794 void *vptr = reinterpret_cast<void *> (psin); |
|
795 psin = reinterpret_cast<fptr> (vptr);]])], |
|
796 octave_cv_cxx_broken_reinterpret_cast=no, |
|
797 octave_cv_cxx_broken_reinterpret_cast=yes)]) |
|
798 if test $octave_cv_cxx_broken_reinterpret_cast = yes ; then |
|
799 AC_DEFINE(CXX_BROKEN_REINTERPRET_CAST, 1, [Define if C++ reinterpret_cast fails for function pointers.]) |
|
800 fi |
|
801 AC_LANG_POP(C++)]) |
|
802 dnl |
4067
|
803 dnl Determine if mkdir accepts only one argument instead dnl of the usual 2. |
|
804 dnl |
6104
|
805 AC_DEFUN(OCTAVE_MKDIR_TAKES_ONE_ARG, [ |
|
806 AC_LANG_PUSH(C++) |
|
807 AC_CACHE_CHECK([if mkdir takes one argument], octave_cv_mkdir_takes_one_arg, |
5844
|
808 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
4067
|
809 #ifdef HAVE_SYS_STAT_H |
|
810 # include <sys/stat.h> |
|
811 #endif |
|
812 #ifdef HAVE_UNISTD_H |
|
813 # include <unistd.h> |
|
814 #endif |
|
815 #ifdef HAVE_DIRECT_H |
|
816 # include <direct.h> |
5844
|
817 #endif]], [[mkdir ("foo", 0);]])], |
4067
|
818 octave_cv_mkdir_takes_one_arg=no, octave_cv_mkdir_takes_one_arg=yes)]) |
6104
|
819 AC_LANG_POP(C++) |
4067
|
820 if test $octave_cv_mkdir_takes_one_arg = yes ; then |
|
821 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.]) |
|
822 fi |
|
823 ]) |
4084
|
824 # OCTAVE_PROG_SED |
|
825 # -------------- |
|
826 # Check for a fully-functional sed program, that truncates |
|
827 # as few characters as possible. Prefer GNU sed if found. |
|
828 AC_DEFUN([OCTAVE_PROG_SED], |
|
829 [AC_MSG_CHECKING([for a sed that does not truncate output]) |
|
830 if test -z "$SED"; then |
|
831 AC_CACHE_VAL(ac_cv_path_sed, |
|
832 [# Loop through the user's path and test for sed and gsed. |
|
833 # Then use that list of sed's as ones to test for truncation. |
|
834 _AS_PATH_WALK([$PATH], |
|
835 [for ac_prog in sed gsed; do |
|
836 for ac_exec_ext in '' $ac_executable_extensions; do |
|
837 if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then |
|
838 _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" |
|
839 fi |
|
840 done |
|
841 done |
|
842 ]) |
|
843 AS_TMPDIR(sed) |
|
844 _max=0 |
|
845 _count=0 |
|
846 # Add /usr/xpg4/bin/sed as it is typically found on Solaris |
|
847 # along with /bin/sed that truncates output. |
|
848 for _sed in $_sed_list /usr/xpg4/bin/sed; do |
|
849 test ! -f ${_sed} && break |
|
850 cat /dev/null > "$tmp/sed.in" |
|
851 _count=0 |
|
852 echo $ECHO_N "0123456789$ECHO_C" >"$tmp/sed.in" |
|
853 # Check for GNU sed and select it if it is found. |
|
854 if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; |
|
855 then |
|
856 octave_cv_path_sed=${_sed} |
|
857 break; |
|
858 fi |
|
859 while true; do |
|
860 cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" |
|
861 mv "$tmp/sed.tmp" "$tmp/sed.in" |
|
862 cp "$tmp/sed.in" "$tmp/sed.nl" |
|
863 echo >>"$tmp/sed.nl" |
|
864 ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break |
|
865 cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break |
|
866 # 10000 chars as input seems more than enough |
|
867 test $_count -gt 10 && break |
|
868 _count=`expr $_count + 1` |
|
869 if test $_count -gt $_max; then |
|
870 _max=$_count |
|
871 octave_cv_path_sed=$_sed |
|
872 fi |
|
873 done |
|
874 done |
|
875 rm -rf "$tmp" |
|
876 ]) |
|
877 fi |
|
878 AC_SUBST([SED], $octave_cv_path_sed) |
|
879 AC_MSG_RESULT([$SED]) |
|
880 ]) |
5465
|
881 dnl |
|
882 dnl Find Perl. |
|
883 dnl |
|
884 dnl OCTAVE_PROG_PERL |
|
885 AC_DEFUN(OCTAVE_PROG_PERL, |
6119
|
886 [AC_CHECK_PROG(PERL, perl, perl, []) |
5465
|
887 AC_SUBST(PERL) |
|
888 ]) |
5468
|
889 dnl |
5495
|
890 dnl Find Python. |
|
891 dnl |
|
892 dnl OCTAVE_PROG_PYTHON |
|
893 AC_DEFUN(OCTAVE_PROG_PYTHON, |
6119
|
894 [AC_CHECK_PROG(PYTHON, python, python, []) |
5495
|
895 AC_SUBST(PYTHON) |
|
896 ]) |
|
897 dnl |
5468
|
898 dnl Find desktop-file-install. |
|
899 dnl |
|
900 dnl OCTAVE_PROG_DESKTOP_FILE_INSTALL |
|
901 AC_DEFUN(OCTAVE_PROG_DESKTOP_FILE_INSTALL, |
6119
|
902 [AC_CHECK_PROG(DESKTOP_FILE_INSTALL, desktop-file-install, desktop-file-install, []) |
5468
|
903 AC_SUBST(DESKTOP_FILE_INSTALL) |
|
904 ]) |
|
905 dnl |
|
906 dnl Check for IEEE 754 data format. |
|
907 dnl |
4853
|
908 AC_DEFUN([OCTAVE_IEEE754_DATA_FORMAT], |
|
909 [AC_MSG_CHECKING([for IEEE 754 data format]) |
|
910 AC_CACHE_VAL(octave_cv_ieee754_data_format, |
5844
|
911 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
4853
|
912 int |
|
913 main (void) |
|
914 { |
|
915 typedef union { unsigned char c[8]; double d; } ieeebytes; |
|
916 |
|
917 ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43}; |
|
918 ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c}; |
|
919 |
|
920 return l.d != 1234567891234567.0 && b.d != 1234567891234567.0; |
5844
|
921 }]])], |
4853
|
922 octave_cv_ieee754_data_format=yes, |
|
923 octave_cv_ieee754_data_format=no, |
|
924 octave_cv_ieee754_data_format=no)]) |
|
925 if test "$cross_compiling" = yes; then |
|
926 AC_MSG_RESULT([$octave_cv_ieee754_data_format assumed for cross compilation]) |
|
927 else |
|
928 AC_MSG_RESULT($octave_cv_ieee754_data_format) |
|
929 fi |
|
930 if test "$octave_cv_ieee754_data_format" = yes; then |
|
931 AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1, [Define if your system uses IEEE 754 data format.]) |
|
932 fi |
|
933 ]) |
5505
|
934 dnl |
|
935 dnl Check for UMFPACK seperately split complex matrix and RHS. Note |
|
936 dnl that as umfpack.h can be in three different places, rather than |
|
937 dnl include it, just declare the functions needed. |
|
938 dnl |
5512
|
939 dnl Assumes that the check for umfpack has already been performed. |
5505
|
940 dnl |
|
941 AC_DEFUN([OCTAVE_UMFPACK_SEPERATE_SPLIT], |
|
942 [AC_MSG_CHECKING([for UMFPACK seperate complex matrix and rhs split]) |
|
943 AC_CACHE_VAL(octave_cv_umfpack_seperate_split, |
5844
|
944 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
5505
|
945 #include <stdlib.h> |
5512
|
946 #if defined (HAVE_UFSPARSE_UMFPACK_h) |
|
947 #include <ufsparse/umfpack.h> |
|
948 #elif defined (HAVE_UMFPACK_UMFPACK_H) |
|
949 #include <umfpack/umfpack.h> |
|
950 #elif defined (HAVE_UMFPACK_H) |
|
951 #include <umfpack.h> |
|
952 #endif |
5505
|
953 int n = 5; |
|
954 int Ap[] = {0, 2, 5, 9, 10, 12}; |
|
955 int Ai[] = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4}; |
|
956 double Ax[] = {2., 0., 3., 0., 3., 0., -1., 0., 4., 0., 4., 0., |
|
957 -3., 0., 1., 0., 2., 0., 2., 0., 6., 0., 1., 0.}; |
|
958 double br[] = {8., 45., -3., 3., 19.}; |
|
959 double bi[] = {0., 0., 0., 0., 0.}; |
|
960 int main (void) |
|
961 { |
|
962 double *null = (double *) NULL ; |
|
963 double *x = (double *)malloc (2 * n * sizeof(double)); |
|
964 int i ; |
|
965 void *Symbolic, *Numeric ; |
|
966 (void) umfpack_zi_symbolic (n, n, Ap, Ai, Ax, null, &Symbolic, null, null) ; |
|
967 (void) umfpack_zi_numeric (Ap, Ai, Ax, null, Symbolic, &Numeric, null, null) ; |
|
968 umfpack_zi_free_symbolic (&Symbolic) ; |
|
969 (void) umfpack_zi_solve (0, Ap, Ai, Ax, null, x, null, br, bi, |
|
970 Numeric, null, null) ; |
|
971 umfpack_zi_free_numeric (&Numeric) ; |
|
972 for (i = 0; i < n; i++, x+=2) |
|
973 if (fabs(*x - i - 1.) > 1.e-13) |
|
974 return (1); |
|
975 return (0) ; |
|
976 } |
5844
|
977 ]])], |
5505
|
978 octave_cv_umfpack_seperate_split=yes, |
|
979 octave_cv_umfpack_seperate_split=no, |
|
980 octave_cv_umfpack_seperate_split=no)]) |
|
981 if test "$cross_compiling" = yes; then |
|
982 AC_MSG_RESULT([$octave_cv_umfpack_seperate_split assumed for cross compilation]) |
|
983 else |
|
984 AC_MSG_RESULT($octave_cv_umfpack_seperate_split) |
|
985 fi |
|
986 if test "$octave_cv_umfpack_seperate_split" = yes; then |
|
987 AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1, [Define if the UMFPACK Complex solver allow matrix and RHS to be split independently]) |
|
988 fi |
|
989 ]) |
6276
|
990 dnl |
|
991 dnl Check whether using HDF5 DLL under Windows. This is done by |
|
992 dnl testing for a data symbol in the HDF5 library, which would |
|
993 dnl requires the definition of _HDF5USEDL_ under MSVC compiler. |
|
994 dnl |
|
995 AC_DEFUN([OCTAVE_HDF5_DLL], [ |
|
996 AC_CACHE_CHECK([if _HDF5USEDLL_ needs to be defined],octave_cv_hdf5_dll, [ |
|
997 AC_TRY_LINK([#include <hdf5.h>], [hid_t x = H5T_NATIVE_DOUBLE;], |
|
998 octave_cv_hdf5_dll=no, [ |
|
999 CFLAGS_old=$CFLAGS |
|
1000 CFLAGS="$CFLAGS -DWIN32 -D_HDF5USEDLL_" |
|
1001 AC_TRY_LINK([#include <hdf5.h>], [hid_t x = H5T_NATIVE_DOUBLE;], |
|
1002 octave_cv_hdf5_dll=yes, |
|
1003 octave_cv_hdf5_dll=no) |
|
1004 CFLAGS=$CFLAGS_old])]) |
|
1005 if test "$octave_cv_hdf5_dll" = yes; then |
|
1006 AC_DEFINE(_HDF5USEDLL_, 1, [Define if using HDF5 dll (Win32)]) |
|
1007 fi]) |