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 |
2548
|
19 dnl Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
|
20 dnl 02111-1307, USA. |
|
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++) |
2574
|
81 AC_TRY_COMPILE([#include <string>], |
|
82 [size_t foo = NPOS], |
|
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 |
1707
|
90 dnl The following test is from Karl Berry's Kpathseach library. I'm |
|
91 dnl including it here in case we someday want to make the use of |
|
92 dnl kpathsea optional. |
1708
|
93 dnl |
|
94 dnl Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment. |
|
95 dnl This test program is due to Mike Hibler <mike@cs.utah.edu>. |
|
96 dnl We don't actually need to run this if we don't have putenv, but it |
|
97 dnl doesn't hurt. |
|
98 AC_DEFUN(OCTAVE_SMART_PUTENV, |
|
99 [AC_MSG_CHECKING(whether putenv uses malloc) |
1707
|
100 AC_CACHE_VAL(octave_cv_func_putenv_malloc, |
|
101 [AC_TRY_RUN([ |
|
102 #define VAR "YOW_VAR" |
|
103 #define STRING1 "GabbaGabbaHey" |
|
104 #define STRING2 "Yow!!" /* should be shorter than STRING1 */ |
|
105 extern char *getenv (); /* in case char* and int don't mix gracefully */ |
|
106 main () |
|
107 { |
|
108 char *str1, *rstr1, *str2, *rstr2; |
|
109 str1 = getenv (VAR); |
|
110 if (str1) |
|
111 exit (1); |
|
112 str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1); |
|
113 if (str1 == 0) |
|
114 exit (2); |
|
115 strcpy (str1, VAR); |
|
116 strcat (str1, "="); |
|
117 strcat (str1, STRING1); |
|
118 if (putenv (str1) < 0) |
|
119 exit (3); |
|
120 rstr1 = getenv (VAR); |
|
121 if (rstr1 == 0) |
|
122 exit (4); |
|
123 rstr1 -= strlen (VAR) + 1; |
|
124 if (strncmp (rstr1, VAR, strlen (VAR))) |
|
125 exit (5); |
|
126 str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1); |
|
127 if (str2 == 0 || str1 == str2) |
|
128 exit (6); |
|
129 strcpy (str2, VAR); |
|
130 strcat (str2, "="); |
|
131 strcat (str2, STRING2); |
|
132 if (putenv (str2) < 0) |
|
133 exit (7); |
|
134 rstr2 = getenv (VAR); |
|
135 if (rstr2 == 0) |
|
136 exit (8); |
|
137 rstr2 -= strlen (VAR) + 1; |
|
138 #if 0 |
|
139 printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2); |
|
140 /* |
|
141 * If string from first call was reused for the second call, |
|
142 * you had better not do a free on the first string! |
|
143 */ |
|
144 if (rstr1 == rstr2) |
|
145 printf ("#define SMART_PUTENV\n"); |
|
146 else |
|
147 printf ("#undef SMART_PUTENV\n"); |
|
148 #endif |
|
149 exit (rstr1 == rstr2 ? 0 : 1); |
|
150 }], octave_cv_func_putenv_malloc=yes, octave_cv_func_putenv_malloc=no, |
|
151 octave_cv_func_putenv_malloc=no)])dnl |
|
152 AC_MSG_RESULT($octave_cv_func_putenv_malloc) |
|
153 if test $octave_cv_func_putenv_malloc = yes; then |
3887
|
154 AC_DEFINE(SMART_PUTENV,1,[To quiet autoheader.]) |
1708
|
155 fi]) |
1788
|
156 dnl |
2469
|
157 dnl These two checks for signal functions were originally part of the |
|
158 dnl aclocal.m4 file distributed with bash 2.0. |
|
159 dnl |
|
160 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) |
|
161 AC_DEFUN(OCTAVE_SIGNAL_CHECK, |
|
162 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
163 AC_MSG_CHECKING(for type of signal functions) |
|
164 AC_CACHE_VAL(octave_cv_signal_vintage, |
|
165 [ |
|
166 AC_TRY_LINK([#include <signal.h>],[ |
|
167 sigset_t ss; |
|
168 struct sigaction sa; |
|
169 sigemptyset(&ss); sigsuspend(&ss); |
|
170 sigaction(SIGINT, &sa, (struct sigaction *) 0); |
|
171 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); |
|
172 ], octave_cv_signal_vintage=posix, |
|
173 [ |
|
174 AC_TRY_LINK([#include <signal.h>], [ |
|
175 int mask = sigmask(SIGINT); |
|
176 sigsetmask(mask); sigblock(mask); sigpause(mask); |
|
177 ], octave_cv_signal_vintage=4.2bsd, |
|
178 [ |
|
179 AC_TRY_LINK([ |
|
180 #include <signal.h> |
|
181 RETSIGTYPE foo() { }], [ |
|
182 int mask = sigmask(SIGINT); |
|
183 sigset(SIGINT, foo); sigrelse(SIGINT); |
|
184 sighold(SIGINT); sigpause(SIGINT); |
2491
|
185 ], octave_cv_signal_vintage=svr3, octave_cv_signal_vintage=v7 |
2469
|
186 )] |
|
187 )] |
|
188 ) |
|
189 ]) |
|
190 AC_MSG_RESULT($octave_cv_signal_vintage) |
2491
|
191 if test "$octave_cv_signal_vintage" = posix; then |
3887
|
192 AC_DEFINE(HAVE_POSIX_SIGNALS,1,[Define if you have POSIX style signals.]) |
2491
|
193 elif test "$octave_cv_signal_vintage" = "4.2bsd"; then |
3887
|
194 AC_DEFINE(HAVE_BSD_SIGNALS,1,[Define if you have BSD style signals.]) |
2491
|
195 elif test "$octave_cv_signal_vintage" = svr3; then |
3887
|
196 AC_DEFINE(HAVE_USG_SIGHOLD,1,[Define if you have System V Release 3 signals.]) |
2469
|
197 fi |
|
198 ]) |
|
199 dnl |
|
200 AC_DEFUN(OCTAVE_REINSTALL_SIGHANDLERS, |
|
201 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
202 AC_REQUIRE([OCTAVE_SIGNAL_CHECK]) |
|
203 AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked]) |
|
204 AC_CACHE_VAL(octave_cv_must_reinstall_sighandlers, |
|
205 [AC_TRY_RUN([ |
|
206 #include <signal.h> |
|
207 #ifdef HAVE_UNISTD_H |
|
208 #include <unistd.h> |
|
209 #endif |
|
210 typedef RETSIGTYPE sigfunc(); |
|
211 int nsigint; |
|
212 #ifdef HAVE_POSIX_SIGNALS |
|
213 sigfunc * |
|
214 set_signal_handler(sig, handler) |
|
215 int sig; |
|
216 sigfunc *handler; |
|
217 { |
|
218 struct sigaction act, oact; |
|
219 act.sa_handler = handler; |
|
220 act.sa_flags = 0; |
|
221 sigemptyset (&act.sa_mask); |
|
222 sigemptyset (&oact.sa_mask); |
|
223 sigaction (sig, &act, &oact); |
|
224 return (oact.sa_handler); |
|
225 } |
|
226 #else |
|
227 #define set_signal_handler(s, h) signal(s, h) |
|
228 #endif |
|
229 RETSIGTYPE |
|
230 sigint(s) |
|
231 int s; |
|
232 { |
|
233 nsigint++; |
|
234 } |
|
235 main() |
|
236 { |
|
237 nsigint = 0; |
|
238 set_signal_handler(SIGINT, sigint); |
|
239 kill((int)getpid(), SIGINT); |
|
240 kill((int)getpid(), SIGINT); |
|
241 exit(nsigint != 2); |
|
242 } |
|
243 ], octave_cv_must_reinstall_sighandlers=no, octave_cv_must_reinstall_sighandlers=yes, |
3130
|
244 if test "$octave_cv_signal_vintage" = svr3; then |
|
245 octave_cv_must_reinstall_sighandlers=yes |
|
246 else |
|
247 octave_cv_must_reinstall_sighandlers=no |
|
248 fi)]) |
|
249 if test "$cross_compiling" = yes; then |
|
250 AC_MSG_RESULT([$octave_cv_must_reinstall_sighandlers assumed for cross compilation]) |
|
251 else |
|
252 AC_MSG_RESULT($octave_cv_must_reinstall_sighandlers) |
|
253 fi |
2491
|
254 if test "$octave_cv_must_reinstall_sighandlers" = yes; then |
3887
|
255 AC_DEFINE(MUST_REINSTALL_SIGHANDLERS,1,[Define if signal handlers must be reinstalled after they are called.]) |
2469
|
256 fi |
|
257 ]) |
2626
|
258 dnl |
3107
|
259 dnl Check to see if C++ compiler needs the new friend template declaration |
|
260 dnl syntax. |
|
261 dnl |
|
262 dnl OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL |
|
263 AC_DEFUN(OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL, [ |
|
264 AC_REQUIRE([AC_PROG_CXX]) |
|
265 AC_MSG_CHECKING([for C++ support for new friend template declaration]) |
|
266 AC_CACHE_VAL(octave_cv_cxx_new_friend_template_decl, [ |
3888
|
267 AC_LANG_PUSH(C++) |
3107
|
268 rm -f conftest.h |
|
269 cat > conftest.h <<EOB |
|
270 struct A { |
|
271 friend int operator== (const A&, const A&); |
|
272 A (int) { } |
|
273 }; |
|
274 |
|
275 template <class T> int |
|
276 operator== (const T&, const T&) |
|
277 { |
|
278 return 0; |
|
279 } |
|
280 EOB |
|
281 AC_TRY_LINK([#include "conftest.h"], [ |
|
282 A a (1); |
|
283 return a == A(1); |
|
284 ], |
|
285 octave_cv_cxx_new_friend_template_decl=no, |
|
286 octave_cv_cxx_new_friend_template_decl=yes |
|
287 ) |
3888
|
288 AC_LANG_POP(C++) |
3107
|
289 ]) |
|
290 AC_MSG_RESULT($octave_cv_cxx_new_friend_template_decl) |
|
291 if test $octave_cv_cxx_new_friend_template_decl = yes; then |
3887
|
292 AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL,1,[Define if your compiler supports `<>' stuff for template friends.]) |
3107
|
293 fi |
|
294 ]) |
3126
|
295 dnl |
3233
|
296 dnl Check to see if C compiler handles FLAG command line option. If |
|
297 dnl two arguments are specified, execute the second arg as shell |
|
298 dnl commands. Otherwise, add FLAG to CFLAGS if the compiler accepts |
|
299 dnl the flag. |
3126
|
300 dnl |
|
301 dnl OCTAVE_CC_FLAG |
|
302 AC_DEFUN(OCTAVE_CC_FLAG, [ |
3908
|
303 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` |
3126
|
304 AC_MSG_CHECKING(whether ${CC-cc} accepts $1) |
|
305 AC_CACHE_VAL(octave_cv_cc_flag_$ac_safe, [ |
3888
|
306 AC_LANG_PUSH(C) |
3126
|
307 XCFLAGS="$CFLAGS" |
|
308 CFLAGS="$CFLAGS $1" |
|
309 AC_TRY_LINK([], [], |
|
310 eval "octave_cv_cc_flag_$ac_safe=yes", |
|
311 eval "octave_cv_cc_flag_$ac_safe=no") |
|
312 CFLAGS="$XCFLAGS" |
3888
|
313 AC_LANG_POP(C) |
3126
|
314 ]) |
|
315 if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then |
|
316 AC_MSG_RESULT(yes) |
3131
|
317 ifelse([$2], , [ |
|
318 CFLAGS="$CFLAGS $1" |
|
319 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2]) |
3126
|
320 else |
|
321 AC_MSG_RESULT(no) |
|
322 ifelse([$3], , , [$3]) |
|
323 fi |
|
324 ]) |
|
325 dnl |
3233
|
326 dnl Check to see if C++ compiler handles FLAG command line option. If |
|
327 dnl two arguments are specified, execute the second arg as shell |
|
328 dnl commands. Otherwise, add FLAG to CXXFLAGS if the compiler accepts |
|
329 dnl the flag. |
3126
|
330 dnl |
|
331 dnl OCTAVE_CXX_FLAG |
|
332 AC_DEFUN(OCTAVE_CXX_FLAG, [ |
3908
|
333 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` |
3222
|
334 AC_MSG_CHECKING(whether ${CXX-g++} accepts $1) |
3126
|
335 AC_CACHE_VAL(octave_cv_cxx_flag_$ac_safe, [ |
3888
|
336 AC_LANG_PUSH(C++) |
3126
|
337 XCXXFLAGS="$CXXFLAGS" |
|
338 CXXFLAGS="$CXXFLAGS $1" |
|
339 AC_TRY_LINK([], [], |
|
340 eval "octave_cv_cxx_flag_$ac_safe=yes", |
|
341 eval "octave_cv_cxx_flag_$ac_safe=no") |
|
342 CXXFLAGS="$XCXXFLAGS" |
3888
|
343 AC_LANG_POP(C++) |
3126
|
344 ]) |
|
345 if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then |
|
346 AC_MSG_RESULT(yes) |
3131
|
347 ifelse([$2], , [ |
|
348 CXXFLAGS="$CXXFLAGS $1" |
|
349 AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2]) |
3126
|
350 else |
|
351 AC_MSG_RESULT(no) |
|
352 ifelse([$3], , , [$3]) |
|
353 fi |
|
354 ]) |
3130
|
355 dnl |
4094
|
356 dnl Check to see if GNU C++ barfs on #pragma interface/#pragma implementation. |
|
357 dnl |
|
358 dnl OCTAVE_CXX_PRAGMA_INTERFACE_IMPLEMENTATION |
|
359 AC_DEFUN(OCTAVE_CXX_PRAGMA_INTERFACE_IMPLEMENTATION, [ |
|
360 AC_REQUIRE([AC_PROG_CXX]) |
|
361 AC_MSG_CHECKING([for C++ support for pragma interface/implementation]) |
|
362 AC_CACHE_VAL(octave_cv_cxx_pragma_interface_implementation, [ |
|
363 AC_LANG_PUSH(C++) |
|
364 rm -f conftest.h |
|
365 cat > conftest.h <<EOB |
|
366 #include <iostream> |
|
367 #if defined (__GNUG__) |
|
368 #pragma interface |
|
369 #endif |
|
370 template <class T> class A |
|
371 { |
|
372 public: |
|
373 A (void) {} |
|
374 ~A (void); |
|
375 }; |
|
376 |
|
377 class B : public A<int> |
|
378 { |
|
379 public: |
|
380 |
|
381 B (void) : A<int> () { } |
|
382 }; |
|
383 EOB |
4095
|
384 AC_TRY_LINK([#include "conftest.h"], [], [ |
|
385 rm -f conftest.h |
|
386 cat > conftest.h <<EOB |
|
387 #pragma interface |
|
388 class A |
|
389 { |
|
390 public: |
|
391 virtual ~A (void) {} |
|
392 }; |
|
393 EOB |
|
394 AC_TRY_COMPILE([#pragma implementation |
|
395 #include "confdefs.h"], [], |
|
396 octave_cv_cxx_pragma_interface_implementation=yes, |
|
397 octave_cv_cxx_pragma_interface_implementation=no |
|
398 )], |
4094
|
399 octave_cv_cxx_pragma_interface_implementation=no |
|
400 ) |
|
401 AC_LANG_POP(C++) |
|
402 ]) |
|
403 AC_MSG_RESULT($octave_cv_cxx_pragma_interface_implementation) |
|
404 if test $octave_cv_cxx_pragma_interface_implementation = no; then |
|
405 XTRA_CXXFLAGS="$XTRA_CXXFLAGS -DNO_PRAGMA_INTERFACE_IMPLEMENTATION=1" |
|
406 AC_SUBST(XTRA_CXXFLAGS) |
|
407 fi |
|
408 ]) |
|
409 dnl |
3729
|
410 dnl Check for flex |
|
411 dnl |
|
412 AC_DEFUN(OCTAVE_PROG_FLEX, [ |
|
413 ### For now, don't define LEXLIB to be -lfl -- we don't use anything in |
|
414 ### it, and it might not be installed. |
|
415 ### |
|
416 ### Also make sure that we generate an interactive scanner if we are |
|
417 ### using flex. |
|
418 AC_PROG_LEX |
|
419 case "$LEX" in |
|
420 flex*) |
|
421 LFLAGS="-t -I" |
|
422 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) |
|
423 LEXLIB= |
|
424 ;; |
|
425 *) |
|
426 LEX='$(top_srcdir)/missing flex' |
|
427 warn_flex="I didn't find flex, but it's only a problem if you need to reconstruct lex.cc" |
|
428 AC_MSG_WARN($warn_flex) |
|
429 ;; |
|
430 esac |
|
431 AC_SUBST(LFLAGS) |
|
432 ]) |
|
433 dnl |
|
434 dnl Check for bison |
|
435 dnl |
|
436 AC_DEFUN(OCTAVE_PROG_BISON, [ |
|
437 AC_PROG_YACC |
|
438 case "$YACC" in |
|
439 bison*) |
|
440 ;; |
|
441 *) |
|
442 YACC='$(top_srcdir)/missing bison' |
|
443 warn_bison="I didn't find bison, but it's only a problem if you need to reconstruct parse.cc" |
|
444 AC_MSG_WARN($warn_bison) |
|
445 ;; |
|
446 esac |
|
447 ]) |
|
448 dnl |
3130
|
449 dnl What pager should we use? |
|
450 dnl |
|
451 AC_DEFUN(OCTAVE_PROG_PAGER, |
|
452 [if test "$cross_compiling" = yes; then |
|
453 DEFAULT_PAGER=less |
|
454 AC_MSG_RESULT(assuming $DEFAULT_PAGER exists on $canonical_host_type host) |
|
455 AC_SUBST(DEFAULT_PAGER) |
|
456 else |
|
457 octave_possible_pagers="less more page pg" |
|
458 case "$canonical_host_type" in |
3971
|
459 *-*-cygwin*) |
3130
|
460 octave_possible_pagers="$octave_possible_pagers more.com" |
|
461 ;; |
|
462 esac |
|
463 |
|
464 AC_CHECK_PROGS(DEFAULT_PAGER, $octave_possible_pagers, []) |
|
465 if test -z "$DEFAULT_PAGER"; then |
|
466 warn_less="I couldn't find \`less', \`more', \`page', or \`pg'" |
|
467 AC_MSG_WARN($warn_less) |
|
468 fi |
|
469 fi |
|
470 ]) |
|
471 dnl |
|
472 dnl Does gnuplot exist? Is it a recent version? |
|
473 dnl |
4098
|
474 AC_DEFUN(OCTAVE_PROG_GNUPLOT, [ |
|
475 case "$canonical_host_type" in |
|
476 *-*-cygwin*|*-*-mingw32*) |
|
477 gp_names="pgnuplot pipe-gnuplot gnuplot" |
|
478 gp_default=pgnuplot |
|
479 ;; |
|
480 *) |
|
481 gp_names=gnuplot |
|
482 gp_default=gnuplot |
|
483 ;; |
|
484 esac |
|
485 GNUPLOT_BINARY="$gp_default" |
|
486 GNUPLOT_HAS_MULTIPLOT=1 |
|
487 GNUPLOT_HAS_FRAMES=1 |
|
488 if test "$cross_compiling" = yes; then |
3130
|
489 AC_MSG_RESULT(assuming $GNUPLOT_BINARY exists on $canonical_host_type host) |
|
490 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiplot mode) |
|
491 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiple frams) |
|
492 else |
4098
|
493 AC_CHECK_PROGS(GNUPLOT_BINARY, $gp_names) |
3130
|
494 if test -n "$GNUPLOT_BINARY"; then |
|
495 AC_MSG_CHECKING([to see if your gnuplot supports multiplot]) |
|
496 if test -z "`echo 'set term unknown; set multiplot' | \ |
|
497 $GNUPLOT_BINARY 2>&1`"; then |
|
498 AC_MSG_RESULT([yes]) |
|
499 else |
4098
|
500 GNUPLOT_HAS_MULTIPLOT= |
3130
|
501 AC_MSG_RESULT([no]) |
|
502 fi |
|
503 AC_MSG_CHECKING([to see if your gnuplot supports multiple plot windows]) |
|
504 if test -z "`echo 'set term x11 2' | $GNUPLOT_BINARY 2>&1`"; then |
|
505 AC_MSG_RESULT([yes]) |
|
506 else |
4098
|
507 GNUPLOT_HAS_FRAMES= |
3130
|
508 AC_MSG_RESULT([no]) |
|
509 fi |
|
510 else |
|
511 warn_gnuplot="yes" |
|
512 |
|
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.]) |
|
526 fi |
|
527 fi |
4098
|
528 AC_DEFINE_UNQUOTED(GNUPLOT_BINARY, "$GNUPLOT_BINARY", [Name of gnuplot program.]) |
|
529 AC_DEFINE_UNQUOTED(GNUPLOT_HAS_MULTIPLOT, $GNUPLOT_HAS_MULTIPLOT, [Define if your gnuplot program supports multiplot mode.]) |
|
530 AC_DEFINE_UNQUOTED(GNUPLOT_HAS_FRAMES, $GNUPLOT_HAS_FRAMES, [Define if your gnuplot program supports multiple plot windows.]) |
3130
|
531 ]) |
|
532 dnl |
|
533 dnl Is DejaGNU installed? |
|
534 dnl |
3222
|
535 dnl OCTAVE_PROG_RUNTEST |
3130
|
536 AC_DEFUN(OCTAVE_PROG_RUNTEST, |
|
537 [if test "$cross_compiling" = yes; then |
|
538 RUNTEST=runtest |
|
539 AC_MSG_RESULT(assuming $RUNTEST exists on $canonical_host_type host) |
|
540 AC_SUBST(RUNTEST) |
|
541 else |
|
542 AC_CHECK_PROG(RUNTEST, runtest, runtest, []) |
|
543 if test -z "$RUNTEST"; then |
|
544 warn_runtest="I didn't find runtest -- install DejaGNU if you want to run \`make check'" |
|
545 AC_MSG_WARN($warn_runtest) |
|
546 fi |
|
547 AC_SUBST(RUNTEST) |
|
548 fi |
|
549 ]) |
3222
|
550 dnl |
3673
|
551 dnl Is gperf installed? |
|
552 dnl |
|
553 dnl OCTAVE_PROG_GPERF |
3731
|
554 AC_DEFUN(OCTAVE_PROG_GPERF, [ |
|
555 AC_CHECK_PROG(GPERF, gperf, gperf, []) |
|
556 if test -n "$GPERF"; then |
|
557 if echo "%{ |
|
558 %} |
|
559 %% |
3750
|
560 foo" | $GPERF -t -C -D -E -G -L ANSI-C -H octave_kw_hash -N octave_kw_lookup > /dev/null 2>&1; then |
3731
|
561 true |
|
562 else |
|
563 GPERF="" |
|
564 warn_gperf="I found gperf, but it does not support all of the following options: -t -C -D -E -G -L ANSI-C -H -N; you need gperf 2.7 or a more recent version" |
|
565 AC_MSG_WARN($warn_gperf) |
|
566 fi |
|
567 else |
|
568 GPERF='$(top_srcdir)/missing gperf' |
|
569 warn_gperf="I didn't find gperf, but it's only a problem if you need to reconstruct oct-gperf.h" |
|
570 AC_MSG_WARN($warn_gperf) |
|
571 fi |
|
572 AC_SUBST(GPERF) |
3673
|
573 ]) |
|
574 dnl |
3222
|
575 dnl Find nm. |
|
576 dnl |
|
577 dnl OCTAVE_PROG_NM |
|
578 AC_DEFUN(OCTAVE_PROG_NM, |
4093
|
579 [AC_CHECK_PROG(NM, ${ac_tool_prefix}nm, ${ac_tool_prefix}nm, []) |
3222
|
580 AC_SUBST(NM) |
|
581 ]) |
|
582 dnl |
|
583 dnl See if the C++ compiler prepends an underscore to external names. |
|
584 dnl |
|
585 dnl OCTAVE_CXX_PREPENDS_UNDERSCORE |
4093
|
586 AC_DEFUN(OCTAVE_CXX_PREPENDS_UNDERSCORE, [ |
|
587 AC_REQUIRE([OCTAVE_PROG_NM]) |
|
588 AC_MSG_CHECKING([whether ${CXX-g++} prepends an underscore to external names]) |
3222
|
589 AC_CACHE_VAL(octave_cv_cxx_prepends_underscore, |
|
590 [octave_cv_cxx_prepends_underscore=no |
3888
|
591 AC_LANG_PUSH(C++) |
3222
|
592 cat > conftest.$ac_ext <<EOF |
3842
|
593 bool FSmy_dld_fcn (void) { return false; } |
3222
|
594 EOF |
|
595 if AC_TRY_EVAL(ac_compile); then |
|
596 if test "`${NM-nm} conftest.o | grep _FSmy_dld_fcn`" != ""; then |
|
597 octave_cv_cxx_prepends_underscore=yes |
|
598 fi |
|
599 else |
3888
|
600 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
|
601 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD |
3222
|
602 fi |
3888
|
603 AC_LANG_POP(C++) |
4105
|
604 ### XXX FIXME XXX -- Ignore test result on Windows. Yes it prepends |
|
605 ### underscore, but LoadLibrary ignores it automatically. The |
4102
|
606 ### correct test is to build the shared library then try to grab the |
|
607 ### symbol from it with and without underscore. |
|
608 case "$canonical_host_type" in |
4105
|
609 *-*-cygwin* | *-*-mingw*) |
4102
|
610 octave_cv_cxx_prepends_underscore=no |
|
611 ;; |
|
612 esac |
3222
|
613 ]) |
|
614 AC_MSG_RESULT($octave_cv_cxx_prepends_underscore) |
|
615 if test $octave_cv_cxx_prepends_underscore = yes; then |
3887
|
616 AC_DEFINE(CXX_PREPENDS_UNDERSCORE, 1, [Define if your compiler prepends underscores to external names.]) |
3222
|
617 fi |
|
618 ]) |
3769
|
619 dnl |
|
620 dnl See if the C++ library is ISO compliant. |
|
621 dnl FIXME: This is obviously very simplistic, and trivially fooled. |
|
622 dnl |
|
623 dnl OCTAVE_CXX_ISO_COMPLIANT_LIBRARY |
|
624 AC_DEFUN(OCTAVE_CXX_ISO_COMPLIANT_LIBRARY, [ |
|
625 AC_REQUIRE([AC_PROG_CXX]) |
|
626 AC_MSG_CHECKING([if C++ library is ISO compliant]) |
|
627 AC_CACHE_VAL(octave_cv_cxx_iso_compliant_library, [ |
3888
|
628 AC_LANG_PUSH(C++) |
3769
|
629 rm -f conftest.h |
3943
|
630 ### Omitting cwctype for now, since it is broken with gcc-3.0.x and |
|
631 ### possibly other versions... |
3769
|
632 for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \ |
|
633 climits clocale cmath complex csetjmp csignal cstdarg cstddef \ |
3943
|
634 cstdio cstdlib cstring ctime cwchar deque exception \ |
3769
|
635 fstream functional iomanip ios iosfwd iostream istream iterator \ |
|
636 limits list locale map memory new numeric ostream queue set \ |
|
637 sstream stack stdexcept streambuf string strstream typeinfo \ |
|
638 utility valarray vector; do |
|
639 echo "#include <$inc>" >> conftest.h |
|
640 done |
|
641 AC_TRY_LINK([#include "conftest.h"], [ |
|
642 std::bitset<50> flags; |
|
643 flags.set(); |
|
644 int digits = std::numeric_limits<unsigned long>::digits; |
|
645 digits = 0; |
|
646 ], |
|
647 octave_cv_cxx_iso_compliant_library=yes, |
|
648 octave_cv_cxx_iso_compliant_library=no |
|
649 ) |
3888
|
650 AC_LANG_POP(C++) |
3769
|
651 ]) |
|
652 AC_MSG_RESULT($octave_cv_cxx_iso_compliant_library) |
|
653 if test $octave_cv_cxx_iso_compliant_library = yes; then |
3887
|
654 AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, [Define if your C++ runtime library is ISO compliant.]) |
3769
|
655 fi |
|
656 ]) |
3822
|
657 dnl |
|
658 dnl Allow the user disable support for command line editing using GNU |
|
659 dnl readline. |
|
660 dnl |
|
661 dnl OCTAVE_ENABLE_READLINE |
|
662 AC_DEFUN(OCTAVE_ENABLE_READLINE, [ |
|
663 USE_READLINE=true |
4102
|
664 LIBREADLINE= |
3822
|
665 AC_ARG_ENABLE(readline, |
|
666 [ --enable-readline use readline library (default is yes)], |
|
667 [if test "$enableval" = no; then |
3824
|
668 USE_READLINE=false |
3825
|
669 warn_readline="command editing and history features require GNU Readline" |
3824
|
670 fi]) |
3822
|
671 if $USE_READLINE; then |
|
672 AC_CHECK_LIB(readline, rl_set_keyboard_input_timeout, [ |
4102
|
673 LIBREADLINE="-lreadline" |
|
674 LIBS="$LIBREADLINE $LIBS" |
3887
|
675 AC_DEFINE(USE_READLINE, 1, [Define to use the readline library.]) |
3822
|
676 ], [ |
3824
|
677 AC_MSG_WARN([I need GNU Readline 4.2 or later]) |
|
678 AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) |
3822
|
679 ]) |
|
680 fi |
4102
|
681 AC_SUBST(LIBREADLINE) |
3822
|
682 ]) |
3842
|
683 dnl |
|
684 dnl Determine the C++ compiler ABI. It sets the macro CXX_ABI to the |
|
685 dnl name of the ABI, and is used to mangle the C linkage loadable |
|
686 dnl functions to avoid ABI mismatch. GNU C++ currently uses gnu_v2 |
|
687 dnl (GCC versions <= 2.95.x) dnl or gnu_v3 (GCC versions >= 3.0). |
|
688 dnl Set to "unknown" is when we don't know enough about the ABI, which |
|
689 dnl will happen when using an unsupported C++ compiler. |
|
690 dnl |
|
691 dnl OCTAVE_CXX_ABI |
4093
|
692 AC_DEFUN(OCTAVE_CXX_ABI, [ |
|
693 AC_REQUIRE([OCTAVE_PROG_NM]) |
|
694 AC_MSG_CHECKING([C++ ABI version used by ${CXX}]) |
3842
|
695 AC_CACHE_VAL(octave_cv_cxx_abi, |
|
696 [octave_cv_cxx_abi='unknown' |
3888
|
697 AC_LANG_PUSH(C++) |
3842
|
698 cat > conftest.$ac_ext <<EOF |
|
699 bool FSmy_dld_fcn (void) { return false; } |
|
700 EOF |
|
701 if AC_TRY_EVAL(ac_compile); then |
|
702 if test "`${NM-nm} conftest.o | grep FSmy_dld_fcn__Fv`" != ""; then |
|
703 octave_cv_cxx_abi='gnu_v2' |
|
704 fi |
|
705 if test "`${NM-nm} conftest.o | grep _Z12FSmy_dld_fcnv`" != ""; then |
|
706 octave_cv_cxx_abi='gnu_v3' |
|
707 fi |
|
708 if test "`${NM-nm} conftest.o | grep __1cMFSmy_dld_fcn6F_b_`" != ""; then |
3843
|
709 octave_cv_cxx_abi='sun_v5' |
3842
|
710 fi |
|
711 else |
3888
|
712 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
|
713 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD |
3842
|
714 fi |
3888
|
715 AC_LANG_POP(C++) |
3842
|
716 ]) |
|
717 AC_MSG_RESULT($octave_cv_cxx_abi) |
3887
|
718 AC_DEFINE_UNQUOTED(CXX_ABI, $octave_cv_cxx_abi, [Define to the C++ ABI your compiler uses.]) |
3842
|
719 ]) |
4067
|
720 dnl |
|
721 dnl Determine if mkdir accepts only one argument instead dnl of the usual 2. |
|
722 dnl |
|
723 AC_DEFUN(OCTAVE_MKDIR_TAKES_ONE_ARG, |
|
724 [AC_CACHE_CHECK([if mkdir takes one argument], octave_cv_mkdir_takes_one_arg, |
|
725 [AC_TRY_COMPILE([ |
|
726 #include <sys/types.h> |
|
727 #ifdef HAVE_SYS_STAT_H |
|
728 # include <sys/stat.h> |
|
729 #endif |
|
730 #ifdef HAVE_UNISTD_H |
|
731 # include <unistd.h> |
|
732 #endif |
|
733 #ifdef HAVE_DIRECT_H |
|
734 # include <direct.h> |
|
735 #endif], [mkdir ("foo", 0);], |
|
736 octave_cv_mkdir_takes_one_arg=no, octave_cv_mkdir_takes_one_arg=yes)]) |
|
737 if test $octave_cv_mkdir_takes_one_arg = yes ; then |
|
738 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.]) |
|
739 fi |
|
740 ]) |
4084
|
741 # OCTAVE_PROG_SED |
|
742 # -------------- |
|
743 # Check for a fully-functional sed program, that truncates |
|
744 # as few characters as possible. Prefer GNU sed if found. |
|
745 AC_DEFUN([OCTAVE_PROG_SED], |
|
746 [AC_MSG_CHECKING([for a sed that does not truncate output]) |
|
747 if test -z "$SED"; then |
|
748 AC_CACHE_VAL(ac_cv_path_sed, |
|
749 [# Loop through the user's path and test for sed and gsed. |
|
750 # Then use that list of sed's as ones to test for truncation. |
|
751 _AS_PATH_WALK([$PATH], |
|
752 [for ac_prog in sed gsed; do |
|
753 for ac_exec_ext in '' $ac_executable_extensions; do |
|
754 if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then |
|
755 _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" |
|
756 fi |
|
757 done |
|
758 done |
|
759 ]) |
|
760 AS_TMPDIR(sed) |
|
761 _max=0 |
|
762 _count=0 |
|
763 # Add /usr/xpg4/bin/sed as it is typically found on Solaris |
|
764 # along with /bin/sed that truncates output. |
|
765 for _sed in $_sed_list /usr/xpg4/bin/sed; do |
|
766 test ! -f ${_sed} && break |
|
767 cat /dev/null > "$tmp/sed.in" |
|
768 _count=0 |
|
769 echo $ECHO_N "0123456789$ECHO_C" >"$tmp/sed.in" |
|
770 # Check for GNU sed and select it if it is found. |
|
771 if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; |
|
772 then |
|
773 octave_cv_path_sed=${_sed} |
|
774 break; |
|
775 fi |
|
776 while true; do |
|
777 cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" |
|
778 mv "$tmp/sed.tmp" "$tmp/sed.in" |
|
779 cp "$tmp/sed.in" "$tmp/sed.nl" |
|
780 echo >>"$tmp/sed.nl" |
|
781 ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break |
|
782 cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break |
|
783 # 10000 chars as input seems more than enough |
|
784 test $_count -gt 10 && break |
|
785 _count=`expr $_count + 1` |
|
786 if test $_count -gt $_max; then |
|
787 _max=$_count |
|
788 octave_cv_path_sed=$_sed |
|
789 fi |
|
790 done |
|
791 done |
|
792 rm -rf "$tmp" |
|
793 ]) |
|
794 fi |
|
795 AC_SUBST([SED], $octave_cv_path_sed) |
|
796 AC_MSG_RESULT([$SED]) |
|
797 ]) |