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 |
4109
|
356 dnl |
|
357 dnl |
|
358 dnl OCTAVE_LANG_PROG_NO_CONFDEFS |
|
359 AC_DEFUN(OCTAVE_LANG_PROG_NO_CONFDEFS, |
|
360 [_AC_LANG_DISPATCH([AC_LANG_PROGRAM], _AC_LANG, [$@])]) |
|
361 dnl |
4094
|
362 dnl Check to see if GNU C++ barfs on #pragma interface/#pragma implementation. |
|
363 dnl |
4109
|
364 dnl Note that we are using AC_LINK_IFELSE and OCTAVE_LANG_PROG_NO_CONFDEFS |
|
365 dnl to prevent autoconf from including confdefs.h ahead of the #pragma |
|
366 dnl interface/implementation line. |
|
367 dnl |
4094
|
368 dnl OCTAVE_CXX_PRAGMA_INTERFACE_IMPLEMENTATION |
|
369 AC_DEFUN(OCTAVE_CXX_PRAGMA_INTERFACE_IMPLEMENTATION, [ |
|
370 AC_REQUIRE([AC_PROG_CXX]) |
|
371 AC_MSG_CHECKING([for C++ support for pragma interface/implementation]) |
|
372 AC_CACHE_VAL(octave_cv_cxx_pragma_interface_implementation, [ |
|
373 AC_LANG_PUSH(C++) |
|
374 rm -f conftest.h |
|
375 cat > conftest.h <<EOB |
|
376 #include <iostream> |
|
377 #pragma interface |
|
378 template <class T> class A |
|
379 { |
|
380 public: |
|
381 A (void) {} |
|
382 ~A (void); |
|
383 }; |
|
384 |
|
385 class B : public A<int> |
|
386 { |
|
387 public: |
|
388 |
|
389 B (void) : A<int> () { } |
|
390 }; |
|
391 EOB |
4109
|
392 AC_LINK_IFELSE([OCTAVE_LANG_PROG_NO_CONFDEFS([#include "conftest.h"])], |
|
393 [octave_pii_test_1=yes], [octave_pii_test_1=no]) |
|
394 rm -f conftest.h |
|
395 cat > conftest.h <<EOB |
4095
|
396 #pragma interface |
|
397 class A |
|
398 { |
|
399 public: |
|
400 virtual ~A (void) {} |
|
401 }; |
|
402 EOB |
4109
|
403 AC_LINK_IFELSE([OCTAVE_LANG_PROG_NO_CONFDEFS([#pragma implementation |
|
404 #include "conftest.h"])], |
|
405 [octave_pii_test_2=yes], [octave_pii_test_2=no]) |
|
406 if test $octave_pii_test_1 = yes && test $octave_pii_test_1 = yes; then |
|
407 octave_cv_cxx_pragma_interface_implementation=yes |
|
408 else |
4094
|
409 octave_cv_cxx_pragma_interface_implementation=no |
4109
|
410 fi |
4094
|
411 AC_LANG_POP(C++) |
|
412 ]) |
|
413 AC_MSG_RESULT($octave_cv_cxx_pragma_interface_implementation) |
|
414 if test $octave_cv_cxx_pragma_interface_implementation = no; then |
|
415 XTRA_CXXFLAGS="$XTRA_CXXFLAGS -DNO_PRAGMA_INTERFACE_IMPLEMENTATION=1" |
|
416 AC_SUBST(XTRA_CXXFLAGS) |
|
417 fi |
|
418 ]) |
|
419 dnl |
3729
|
420 dnl Check for flex |
|
421 dnl |
|
422 AC_DEFUN(OCTAVE_PROG_FLEX, [ |
|
423 ### For now, don't define LEXLIB to be -lfl -- we don't use anything in |
|
424 ### it, and it might not be installed. |
|
425 ### |
|
426 ### Also make sure that we generate an interactive scanner if we are |
|
427 ### using flex. |
|
428 AC_PROG_LEX |
|
429 case "$LEX" in |
|
430 flex*) |
|
431 LFLAGS="-t -I" |
|
432 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) |
|
433 LEXLIB= |
|
434 ;; |
|
435 *) |
|
436 LEX='$(top_srcdir)/missing flex' |
|
437 warn_flex="I didn't find flex, but it's only a problem if you need to reconstruct lex.cc" |
|
438 AC_MSG_WARN($warn_flex) |
|
439 ;; |
|
440 esac |
|
441 AC_SUBST(LFLAGS) |
|
442 ]) |
|
443 dnl |
|
444 dnl Check for bison |
|
445 dnl |
|
446 AC_DEFUN(OCTAVE_PROG_BISON, [ |
|
447 AC_PROG_YACC |
|
448 case "$YACC" in |
|
449 bison*) |
|
450 ;; |
|
451 *) |
|
452 YACC='$(top_srcdir)/missing bison' |
|
453 warn_bison="I didn't find bison, but it's only a problem if you need to reconstruct parse.cc" |
|
454 AC_MSG_WARN($warn_bison) |
|
455 ;; |
|
456 esac |
|
457 ]) |
|
458 dnl |
3130
|
459 dnl What pager should we use? |
|
460 dnl |
|
461 AC_DEFUN(OCTAVE_PROG_PAGER, |
|
462 [if test "$cross_compiling" = yes; then |
|
463 DEFAULT_PAGER=less |
|
464 AC_MSG_RESULT(assuming $DEFAULT_PAGER exists on $canonical_host_type host) |
|
465 AC_SUBST(DEFAULT_PAGER) |
|
466 else |
|
467 octave_possible_pagers="less more page pg" |
|
468 case "$canonical_host_type" in |
3971
|
469 *-*-cygwin*) |
3130
|
470 octave_possible_pagers="$octave_possible_pagers more.com" |
|
471 ;; |
|
472 esac |
|
473 |
|
474 AC_CHECK_PROGS(DEFAULT_PAGER, $octave_possible_pagers, []) |
|
475 if test -z "$DEFAULT_PAGER"; then |
|
476 warn_less="I couldn't find \`less', \`more', \`page', or \`pg'" |
|
477 AC_MSG_WARN($warn_less) |
|
478 fi |
|
479 fi |
|
480 ]) |
|
481 dnl |
|
482 dnl Does gnuplot exist? Is it a recent version? |
|
483 dnl |
4098
|
484 AC_DEFUN(OCTAVE_PROG_GNUPLOT, [ |
|
485 case "$canonical_host_type" in |
|
486 *-*-cygwin*|*-*-mingw32*) |
|
487 gp_names="pgnuplot pipe-gnuplot gnuplot" |
|
488 gp_default=pgnuplot |
|
489 ;; |
|
490 *) |
|
491 gp_names=gnuplot |
|
492 gp_default=gnuplot |
|
493 ;; |
|
494 esac |
|
495 GNUPLOT_BINARY="$gp_default" |
|
496 GNUPLOT_HAS_MULTIPLOT=1 |
|
497 GNUPLOT_HAS_FRAMES=1 |
|
498 if test "$cross_compiling" = yes; then |
3130
|
499 AC_MSG_RESULT(assuming $GNUPLOT_BINARY exists on $canonical_host_type host) |
|
500 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiplot mode) |
|
501 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiple frams) |
|
502 else |
4098
|
503 AC_CHECK_PROGS(GNUPLOT_BINARY, $gp_names) |
3130
|
504 if test -n "$GNUPLOT_BINARY"; then |
|
505 AC_MSG_CHECKING([to see if your gnuplot supports multiplot]) |
|
506 if test -z "`echo 'set term unknown; set multiplot' | \ |
|
507 $GNUPLOT_BINARY 2>&1`"; then |
|
508 AC_MSG_RESULT([yes]) |
|
509 else |
4098
|
510 GNUPLOT_HAS_MULTIPLOT= |
3130
|
511 AC_MSG_RESULT([no]) |
|
512 fi |
|
513 AC_MSG_CHECKING([to see if your gnuplot supports multiple plot windows]) |
|
514 if test -z "`echo 'set term x11 2' | $GNUPLOT_BINARY 2>&1`"; then |
|
515 AC_MSG_RESULT([yes]) |
|
516 else |
4098
|
517 GNUPLOT_HAS_FRAMES= |
3130
|
518 AC_MSG_RESULT([no]) |
|
519 fi |
|
520 else |
|
521 warn_gnuplot="yes" |
|
522 |
|
523 ## If you change this text, be sure to also copy it to the set of |
|
524 ## warnings at the end of the script |
|
525 |
|
526 AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot]) |
|
527 AC_MSG_WARN([installed, but you won't be able to use any of Octave's]) |
|
528 AC_MSG_WARN([plotting commands without it.]) |
|
529 AC_MSG_WARN([]) |
|
530 AC_MSG_WARN([If gnuplot is installed but it isn't in your path, you can]) |
|
531 AC_MSG_WARN([tell Octave where to find it by typing the command]) |
|
532 AC_MSG_WARN([]) |
|
533 AC_MSG_WARN([gnuplot_binary = "/full/path/to/gnuplot/binary"]) |
|
534 AC_MSG_WARN([]) |
|
535 AC_MSG_WARN([at the Octave prompt.]) |
|
536 fi |
|
537 fi |
4098
|
538 AC_DEFINE_UNQUOTED(GNUPLOT_BINARY, "$GNUPLOT_BINARY", [Name of gnuplot program.]) |
|
539 AC_DEFINE_UNQUOTED(GNUPLOT_HAS_MULTIPLOT, $GNUPLOT_HAS_MULTIPLOT, [Define if your gnuplot program supports multiplot mode.]) |
|
540 AC_DEFINE_UNQUOTED(GNUPLOT_HAS_FRAMES, $GNUPLOT_HAS_FRAMES, [Define if your gnuplot program supports multiple plot windows.]) |
3130
|
541 ]) |
|
542 dnl |
|
543 dnl Is DejaGNU installed? |
|
544 dnl |
3222
|
545 dnl OCTAVE_PROG_RUNTEST |
3130
|
546 AC_DEFUN(OCTAVE_PROG_RUNTEST, |
|
547 [if test "$cross_compiling" = yes; then |
|
548 RUNTEST=runtest |
|
549 AC_MSG_RESULT(assuming $RUNTEST exists on $canonical_host_type host) |
|
550 AC_SUBST(RUNTEST) |
|
551 else |
|
552 AC_CHECK_PROG(RUNTEST, runtest, runtest, []) |
|
553 if test -z "$RUNTEST"; then |
|
554 warn_runtest="I didn't find runtest -- install DejaGNU if you want to run \`make check'" |
|
555 AC_MSG_WARN($warn_runtest) |
|
556 fi |
|
557 AC_SUBST(RUNTEST) |
|
558 fi |
|
559 ]) |
3222
|
560 dnl |
3673
|
561 dnl Is gperf installed? |
|
562 dnl |
|
563 dnl OCTAVE_PROG_GPERF |
3731
|
564 AC_DEFUN(OCTAVE_PROG_GPERF, [ |
|
565 AC_CHECK_PROG(GPERF, gperf, gperf, []) |
|
566 if test -n "$GPERF"; then |
|
567 if echo "%{ |
|
568 %} |
|
569 %% |
3750
|
570 foo" | $GPERF -t -C -D -E -G -L ANSI-C -H octave_kw_hash -N octave_kw_lookup > /dev/null 2>&1; then |
3731
|
571 true |
|
572 else |
|
573 GPERF="" |
|
574 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" |
|
575 AC_MSG_WARN($warn_gperf) |
|
576 fi |
|
577 else |
|
578 GPERF='$(top_srcdir)/missing gperf' |
|
579 warn_gperf="I didn't find gperf, but it's only a problem if you need to reconstruct oct-gperf.h" |
|
580 AC_MSG_WARN($warn_gperf) |
|
581 fi |
|
582 AC_SUBST(GPERF) |
3673
|
583 ]) |
|
584 dnl |
3222
|
585 dnl Find nm. |
|
586 dnl |
|
587 dnl OCTAVE_PROG_NM |
|
588 AC_DEFUN(OCTAVE_PROG_NM, |
4093
|
589 [AC_CHECK_PROG(NM, ${ac_tool_prefix}nm, ${ac_tool_prefix}nm, []) |
3222
|
590 AC_SUBST(NM) |
|
591 ]) |
|
592 dnl |
|
593 dnl See if the C++ compiler prepends an underscore to external names. |
|
594 dnl |
|
595 dnl OCTAVE_CXX_PREPENDS_UNDERSCORE |
4093
|
596 AC_DEFUN(OCTAVE_CXX_PREPENDS_UNDERSCORE, [ |
|
597 AC_REQUIRE([OCTAVE_PROG_NM]) |
|
598 AC_MSG_CHECKING([whether ${CXX-g++} prepends an underscore to external names]) |
3222
|
599 AC_CACHE_VAL(octave_cv_cxx_prepends_underscore, |
|
600 [octave_cv_cxx_prepends_underscore=no |
3888
|
601 AC_LANG_PUSH(C++) |
3222
|
602 cat > conftest.$ac_ext <<EOF |
3842
|
603 bool FSmy_dld_fcn (void) { return false; } |
3222
|
604 EOF |
|
605 if AC_TRY_EVAL(ac_compile); then |
|
606 if test "`${NM-nm} conftest.o | grep _FSmy_dld_fcn`" != ""; then |
|
607 octave_cv_cxx_prepends_underscore=yes |
|
608 fi |
|
609 else |
3888
|
610 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
|
611 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD |
3222
|
612 fi |
3888
|
613 AC_LANG_POP(C++) |
4105
|
614 ### XXX FIXME XXX -- Ignore test result on Windows. Yes it prepends |
|
615 ### underscore, but LoadLibrary ignores it automatically. The |
4102
|
616 ### correct test is to build the shared library then try to grab the |
|
617 ### symbol from it with and without underscore. |
|
618 case "$canonical_host_type" in |
4105
|
619 *-*-cygwin* | *-*-mingw*) |
4102
|
620 octave_cv_cxx_prepends_underscore=no |
|
621 ;; |
|
622 esac |
3222
|
623 ]) |
|
624 AC_MSG_RESULT($octave_cv_cxx_prepends_underscore) |
|
625 if test $octave_cv_cxx_prepends_underscore = yes; then |
3887
|
626 AC_DEFINE(CXX_PREPENDS_UNDERSCORE, 1, [Define if your compiler prepends underscores to external names.]) |
3222
|
627 fi |
|
628 ]) |
3769
|
629 dnl |
|
630 dnl See if the C++ library is ISO compliant. |
|
631 dnl FIXME: This is obviously very simplistic, and trivially fooled. |
|
632 dnl |
|
633 dnl OCTAVE_CXX_ISO_COMPLIANT_LIBRARY |
|
634 AC_DEFUN(OCTAVE_CXX_ISO_COMPLIANT_LIBRARY, [ |
|
635 AC_REQUIRE([AC_PROG_CXX]) |
|
636 AC_MSG_CHECKING([if C++ library is ISO compliant]) |
|
637 AC_CACHE_VAL(octave_cv_cxx_iso_compliant_library, [ |
3888
|
638 AC_LANG_PUSH(C++) |
3769
|
639 rm -f conftest.h |
3943
|
640 ### Omitting cwctype for now, since it is broken with gcc-3.0.x and |
|
641 ### possibly other versions... |
3769
|
642 for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \ |
|
643 climits clocale cmath complex csetjmp csignal cstdarg cstddef \ |
3943
|
644 cstdio cstdlib cstring ctime cwchar deque exception \ |
3769
|
645 fstream functional iomanip ios iosfwd iostream istream iterator \ |
|
646 limits list locale map memory new numeric ostream queue set \ |
|
647 sstream stack stdexcept streambuf string strstream typeinfo \ |
|
648 utility valarray vector; do |
|
649 echo "#include <$inc>" >> conftest.h |
|
650 done |
|
651 AC_TRY_LINK([#include "conftest.h"], [ |
|
652 std::bitset<50> flags; |
|
653 flags.set(); |
|
654 int digits = std::numeric_limits<unsigned long>::digits; |
|
655 digits = 0; |
|
656 ], |
|
657 octave_cv_cxx_iso_compliant_library=yes, |
|
658 octave_cv_cxx_iso_compliant_library=no |
|
659 ) |
3888
|
660 AC_LANG_POP(C++) |
3769
|
661 ]) |
|
662 AC_MSG_RESULT($octave_cv_cxx_iso_compliant_library) |
|
663 if test $octave_cv_cxx_iso_compliant_library = yes; then |
3887
|
664 AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, [Define if your C++ runtime library is ISO compliant.]) |
3769
|
665 fi |
|
666 ]) |
3822
|
667 dnl |
|
668 dnl Allow the user disable support for command line editing using GNU |
|
669 dnl readline. |
|
670 dnl |
|
671 dnl OCTAVE_ENABLE_READLINE |
|
672 AC_DEFUN(OCTAVE_ENABLE_READLINE, [ |
|
673 USE_READLINE=true |
4102
|
674 LIBREADLINE= |
3822
|
675 AC_ARG_ENABLE(readline, |
|
676 [ --enable-readline use readline library (default is yes)], |
|
677 [if test "$enableval" = no; then |
3824
|
678 USE_READLINE=false |
3825
|
679 warn_readline="command editing and history features require GNU Readline" |
3824
|
680 fi]) |
3822
|
681 if $USE_READLINE; then |
|
682 AC_CHECK_LIB(readline, rl_set_keyboard_input_timeout, [ |
4102
|
683 LIBREADLINE="-lreadline" |
|
684 LIBS="$LIBREADLINE $LIBS" |
3887
|
685 AC_DEFINE(USE_READLINE, 1, [Define to use the readline library.]) |
3822
|
686 ], [ |
3824
|
687 AC_MSG_WARN([I need GNU Readline 4.2 or later]) |
|
688 AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) |
3822
|
689 ]) |
|
690 fi |
4102
|
691 AC_SUBST(LIBREADLINE) |
3822
|
692 ]) |
3842
|
693 dnl |
|
694 dnl Determine the C++ compiler ABI. It sets the macro CXX_ABI to the |
|
695 dnl name of the ABI, and is used to mangle the C linkage loadable |
|
696 dnl functions to avoid ABI mismatch. GNU C++ currently uses gnu_v2 |
|
697 dnl (GCC versions <= 2.95.x) dnl or gnu_v3 (GCC versions >= 3.0). |
|
698 dnl Set to "unknown" is when we don't know enough about the ABI, which |
|
699 dnl will happen when using an unsupported C++ compiler. |
|
700 dnl |
|
701 dnl OCTAVE_CXX_ABI |
4093
|
702 AC_DEFUN(OCTAVE_CXX_ABI, [ |
|
703 AC_REQUIRE([OCTAVE_PROG_NM]) |
|
704 AC_MSG_CHECKING([C++ ABI version used by ${CXX}]) |
3842
|
705 AC_CACHE_VAL(octave_cv_cxx_abi, |
|
706 [octave_cv_cxx_abi='unknown' |
3888
|
707 AC_LANG_PUSH(C++) |
3842
|
708 cat > conftest.$ac_ext <<EOF |
|
709 bool FSmy_dld_fcn (void) { return false; } |
|
710 EOF |
|
711 if AC_TRY_EVAL(ac_compile); then |
|
712 if test "`${NM-nm} conftest.o | grep FSmy_dld_fcn__Fv`" != ""; then |
|
713 octave_cv_cxx_abi='gnu_v2' |
|
714 fi |
|
715 if test "`${NM-nm} conftest.o | grep _Z12FSmy_dld_fcnv`" != ""; then |
|
716 octave_cv_cxx_abi='gnu_v3' |
|
717 fi |
|
718 if test "`${NM-nm} conftest.o | grep __1cMFSmy_dld_fcn6F_b_`" != ""; then |
3843
|
719 octave_cv_cxx_abi='sun_v5' |
3842
|
720 fi |
|
721 else |
3888
|
722 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
|
723 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD |
3842
|
724 fi |
3888
|
725 AC_LANG_POP(C++) |
3842
|
726 ]) |
|
727 AC_MSG_RESULT($octave_cv_cxx_abi) |
3887
|
728 AC_DEFINE_UNQUOTED(CXX_ABI, $octave_cv_cxx_abi, [Define to the C++ ABI your compiler uses.]) |
3842
|
729 ]) |
4067
|
730 dnl |
|
731 dnl Determine if mkdir accepts only one argument instead dnl of the usual 2. |
|
732 dnl |
|
733 AC_DEFUN(OCTAVE_MKDIR_TAKES_ONE_ARG, |
|
734 [AC_CACHE_CHECK([if mkdir takes one argument], octave_cv_mkdir_takes_one_arg, |
|
735 [AC_TRY_COMPILE([ |
|
736 #include <sys/types.h> |
|
737 #ifdef HAVE_SYS_STAT_H |
|
738 # include <sys/stat.h> |
|
739 #endif |
|
740 #ifdef HAVE_UNISTD_H |
|
741 # include <unistd.h> |
|
742 #endif |
|
743 #ifdef HAVE_DIRECT_H |
|
744 # include <direct.h> |
|
745 #endif], [mkdir ("foo", 0);], |
|
746 octave_cv_mkdir_takes_one_arg=no, octave_cv_mkdir_takes_one_arg=yes)]) |
|
747 if test $octave_cv_mkdir_takes_one_arg = yes ; then |
|
748 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.]) |
|
749 fi |
|
750 ]) |
4084
|
751 # OCTAVE_PROG_SED |
|
752 # -------------- |
|
753 # Check for a fully-functional sed program, that truncates |
|
754 # as few characters as possible. Prefer GNU sed if found. |
|
755 AC_DEFUN([OCTAVE_PROG_SED], |
|
756 [AC_MSG_CHECKING([for a sed that does not truncate output]) |
|
757 if test -z "$SED"; then |
|
758 AC_CACHE_VAL(ac_cv_path_sed, |
|
759 [# Loop through the user's path and test for sed and gsed. |
|
760 # Then use that list of sed's as ones to test for truncation. |
|
761 _AS_PATH_WALK([$PATH], |
|
762 [for ac_prog in sed gsed; do |
|
763 for ac_exec_ext in '' $ac_executable_extensions; do |
|
764 if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then |
|
765 _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" |
|
766 fi |
|
767 done |
|
768 done |
|
769 ]) |
|
770 AS_TMPDIR(sed) |
|
771 _max=0 |
|
772 _count=0 |
|
773 # Add /usr/xpg4/bin/sed as it is typically found on Solaris |
|
774 # along with /bin/sed that truncates output. |
|
775 for _sed in $_sed_list /usr/xpg4/bin/sed; do |
|
776 test ! -f ${_sed} && break |
|
777 cat /dev/null > "$tmp/sed.in" |
|
778 _count=0 |
|
779 echo $ECHO_N "0123456789$ECHO_C" >"$tmp/sed.in" |
|
780 # Check for GNU sed and select it if it is found. |
|
781 if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; |
|
782 then |
|
783 octave_cv_path_sed=${_sed} |
|
784 break; |
|
785 fi |
|
786 while true; do |
|
787 cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" |
|
788 mv "$tmp/sed.tmp" "$tmp/sed.in" |
|
789 cp "$tmp/sed.in" "$tmp/sed.nl" |
|
790 echo >>"$tmp/sed.nl" |
|
791 ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break |
|
792 cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break |
|
793 # 10000 chars as input seems more than enough |
|
794 test $_count -gt 10 && break |
|
795 _count=`expr $_count + 1` |
|
796 if test $_count -gt $_max; then |
|
797 _max=$_count |
|
798 octave_cv_path_sed=$_sed |
|
799 fi |
|
800 done |
|
801 done |
|
802 rm -rf "$tmp" |
|
803 ]) |
|
804 fi |
|
805 AC_SUBST([SED], $octave_cv_path_sed) |
|
806 AC_MSG_RESULT([$SED]) |
|
807 ]) |