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