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 |
2548
|
75 dnl See if struct group has a gr_passwd field. |
|
76 dnl |
|
77 AC_DEFUN(OCTAVE_STRUCT_GR_PASSWD, |
|
78 [AC_CACHE_CHECK([for gr_passwd in struct group], octave_cv_struct_gr_passwd, |
|
79 [AC_TRY_COMPILE([#include <sys/types.h> |
|
80 #include <grp.h>], [struct group s; s.gr_passwd;], |
|
81 octave_cv_struct_gr_passwd=yes, octave_cv_struct_gr_passwd=no)]) |
|
82 if test $octave_cv_struct_gr_passwd = yes; then |
3887
|
83 AC_DEFINE(HAVE_GR_PASSWD,1,[Define if your system's struct group has a gr_passwd field.]) |
2548
|
84 fi |
|
85 ]) |
|
86 dnl |
2574
|
87 dnl See if the standard string class has npos as a member. |
|
88 dnl |
|
89 AC_DEFUN(OCTAVE_STRING_NPOS, |
|
90 [AC_CACHE_CHECK([whether including <string> defines NPOS], |
|
91 octave_cv_string_npos, |
|
92 [AC_LANG_SAVE |
|
93 AC_LANG_CPLUSPLUS |
|
94 AC_TRY_COMPILE([#include <string>], |
|
95 [size_t foo = NPOS], |
|
96 octave_cv_string_npos=yes, octave_cv_string_npos=no)]) |
|
97 if test $octave_cv_string_npos = no; then |
3887
|
98 AC_DEFINE(NPOS, [std::string::npos], [Define (to string::npos) if <string> doesn't]) |
2574
|
99 fi |
|
100 AC_LANG_RESTORE |
|
101 ]) |
|
102 dnl |
1707
|
103 dnl The following test is from Karl Berry's Kpathseach library. I'm |
|
104 dnl including it here in case we someday want to make the use of |
|
105 dnl kpathsea optional. |
1708
|
106 dnl |
|
107 dnl Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment. |
|
108 dnl This test program is due to Mike Hibler <mike@cs.utah.edu>. |
|
109 dnl We don't actually need to run this if we don't have putenv, but it |
|
110 dnl doesn't hurt. |
|
111 AC_DEFUN(OCTAVE_SMART_PUTENV, |
|
112 [AC_MSG_CHECKING(whether putenv uses malloc) |
1707
|
113 AC_CACHE_VAL(octave_cv_func_putenv_malloc, |
|
114 [AC_TRY_RUN([ |
|
115 #define VAR "YOW_VAR" |
|
116 #define STRING1 "GabbaGabbaHey" |
|
117 #define STRING2 "Yow!!" /* should be shorter than STRING1 */ |
|
118 extern char *getenv (); /* in case char* and int don't mix gracefully */ |
|
119 main () |
|
120 { |
|
121 char *str1, *rstr1, *str2, *rstr2; |
|
122 str1 = getenv (VAR); |
|
123 if (str1) |
|
124 exit (1); |
|
125 str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1); |
|
126 if (str1 == 0) |
|
127 exit (2); |
|
128 strcpy (str1, VAR); |
|
129 strcat (str1, "="); |
|
130 strcat (str1, STRING1); |
|
131 if (putenv (str1) < 0) |
|
132 exit (3); |
|
133 rstr1 = getenv (VAR); |
|
134 if (rstr1 == 0) |
|
135 exit (4); |
|
136 rstr1 -= strlen (VAR) + 1; |
|
137 if (strncmp (rstr1, VAR, strlen (VAR))) |
|
138 exit (5); |
|
139 str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1); |
|
140 if (str2 == 0 || str1 == str2) |
|
141 exit (6); |
|
142 strcpy (str2, VAR); |
|
143 strcat (str2, "="); |
|
144 strcat (str2, STRING2); |
|
145 if (putenv (str2) < 0) |
|
146 exit (7); |
|
147 rstr2 = getenv (VAR); |
|
148 if (rstr2 == 0) |
|
149 exit (8); |
|
150 rstr2 -= strlen (VAR) + 1; |
|
151 #if 0 |
|
152 printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2); |
|
153 /* |
|
154 * If string from first call was reused for the second call, |
|
155 * you had better not do a free on the first string! |
|
156 */ |
|
157 if (rstr1 == rstr2) |
|
158 printf ("#define SMART_PUTENV\n"); |
|
159 else |
|
160 printf ("#undef SMART_PUTENV\n"); |
|
161 #endif |
|
162 exit (rstr1 == rstr2 ? 0 : 1); |
|
163 }], octave_cv_func_putenv_malloc=yes, octave_cv_func_putenv_malloc=no, |
|
164 octave_cv_func_putenv_malloc=no)])dnl |
|
165 AC_MSG_RESULT($octave_cv_func_putenv_malloc) |
|
166 if test $octave_cv_func_putenv_malloc = yes; then |
3887
|
167 AC_DEFINE(SMART_PUTENV,1,[To quiet autoheader.]) |
1708
|
168 fi]) |
1788
|
169 dnl |
2469
|
170 dnl These two checks for signal functions were originally part of the |
|
171 dnl aclocal.m4 file distributed with bash 2.0. |
|
172 dnl |
|
173 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) |
|
174 AC_DEFUN(OCTAVE_SIGNAL_CHECK, |
|
175 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
176 AC_MSG_CHECKING(for type of signal functions) |
|
177 AC_CACHE_VAL(octave_cv_signal_vintage, |
|
178 [ |
|
179 AC_TRY_LINK([#include <signal.h>],[ |
|
180 sigset_t ss; |
|
181 struct sigaction sa; |
|
182 sigemptyset(&ss); sigsuspend(&ss); |
|
183 sigaction(SIGINT, &sa, (struct sigaction *) 0); |
|
184 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); |
|
185 ], octave_cv_signal_vintage=posix, |
|
186 [ |
|
187 AC_TRY_LINK([#include <signal.h>], [ |
|
188 int mask = sigmask(SIGINT); |
|
189 sigsetmask(mask); sigblock(mask); sigpause(mask); |
|
190 ], octave_cv_signal_vintage=4.2bsd, |
|
191 [ |
|
192 AC_TRY_LINK([ |
|
193 #include <signal.h> |
|
194 RETSIGTYPE foo() { }], [ |
|
195 int mask = sigmask(SIGINT); |
|
196 sigset(SIGINT, foo); sigrelse(SIGINT); |
|
197 sighold(SIGINT); sigpause(SIGINT); |
2491
|
198 ], octave_cv_signal_vintage=svr3, octave_cv_signal_vintage=v7 |
2469
|
199 )] |
|
200 )] |
|
201 ) |
|
202 ]) |
|
203 AC_MSG_RESULT($octave_cv_signal_vintage) |
2491
|
204 if test "$octave_cv_signal_vintage" = posix; then |
3887
|
205 AC_DEFINE(HAVE_POSIX_SIGNALS,1,[Define if you have POSIX style signals.]) |
2491
|
206 elif test "$octave_cv_signal_vintage" = "4.2bsd"; then |
3887
|
207 AC_DEFINE(HAVE_BSD_SIGNALS,1,[Define if you have BSD style signals.]) |
2491
|
208 elif test "$octave_cv_signal_vintage" = svr3; then |
3887
|
209 AC_DEFINE(HAVE_USG_SIGHOLD,1,[Define if you have System V Release 3 signals.]) |
2469
|
210 fi |
|
211 ]) |
|
212 dnl |
|
213 AC_DEFUN(OCTAVE_REINSTALL_SIGHANDLERS, |
|
214 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
215 AC_REQUIRE([OCTAVE_SIGNAL_CHECK]) |
|
216 AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked]) |
|
217 AC_CACHE_VAL(octave_cv_must_reinstall_sighandlers, |
|
218 [AC_TRY_RUN([ |
|
219 #include <signal.h> |
|
220 #ifdef HAVE_UNISTD_H |
|
221 #include <unistd.h> |
|
222 #endif |
|
223 typedef RETSIGTYPE sigfunc(); |
|
224 int nsigint; |
|
225 #ifdef HAVE_POSIX_SIGNALS |
|
226 sigfunc * |
|
227 set_signal_handler(sig, handler) |
|
228 int sig; |
|
229 sigfunc *handler; |
|
230 { |
|
231 struct sigaction act, oact; |
|
232 act.sa_handler = handler; |
|
233 act.sa_flags = 0; |
|
234 sigemptyset (&act.sa_mask); |
|
235 sigemptyset (&oact.sa_mask); |
|
236 sigaction (sig, &act, &oact); |
|
237 return (oact.sa_handler); |
|
238 } |
|
239 #else |
|
240 #define set_signal_handler(s, h) signal(s, h) |
|
241 #endif |
|
242 RETSIGTYPE |
|
243 sigint(s) |
|
244 int s; |
|
245 { |
|
246 nsigint++; |
|
247 } |
|
248 main() |
|
249 { |
|
250 nsigint = 0; |
|
251 set_signal_handler(SIGINT, sigint); |
|
252 kill((int)getpid(), SIGINT); |
|
253 kill((int)getpid(), SIGINT); |
|
254 exit(nsigint != 2); |
|
255 } |
|
256 ], octave_cv_must_reinstall_sighandlers=no, octave_cv_must_reinstall_sighandlers=yes, |
3130
|
257 if test "$octave_cv_signal_vintage" = svr3; then |
|
258 octave_cv_must_reinstall_sighandlers=yes |
|
259 else |
|
260 octave_cv_must_reinstall_sighandlers=no |
|
261 fi)]) |
|
262 if test "$cross_compiling" = yes; then |
|
263 AC_MSG_RESULT([$octave_cv_must_reinstall_sighandlers assumed for cross compilation]) |
|
264 else |
|
265 AC_MSG_RESULT($octave_cv_must_reinstall_sighandlers) |
|
266 fi |
2491
|
267 if test "$octave_cv_must_reinstall_sighandlers" = yes; then |
3887
|
268 AC_DEFINE(MUST_REINSTALL_SIGHANDLERS,1,[Define if signal handlers must be reinstalled after they are called.]) |
2469
|
269 fi |
|
270 ]) |
2626
|
271 dnl |
|
272 dnl This check originally from bash 2.0. |
|
273 dnl |
|
274 dnl Check for typedef'd symbols in header files, but allow the caller to |
|
275 dnl specify the include files to be checked in addition to the default. |
|
276 dnl |
|
277 dnl OCTAVE_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND]) |
|
278 AC_DEFUN(OCTAVE_CHECK_TYPE, |
|
279 [AC_REQUIRE([AC_HEADER_STDC])dnl |
|
280 AC_MSG_CHECKING(for $1) |
|
281 AC_CACHE_VAL(octave_cv_type_$1, |
|
282 [AC_EGREP_CPP($1, [#include <sys/types.h> |
|
283 #if STDC_HEADERS |
|
284 #include <stdlib.h> |
|
285 #endif |
|
286 $2 |
|
287 ], octave_cv_type_$1=yes, octave_cv_type_$1=no)]) |
|
288 AC_MSG_RESULT($octave_cv_type_$1) |
|
289 ifelse($#, 4, [if test $octave_cv_type_$1 = yes; then |
3887
|
290 AC_DEFINE($4, 1, [Define if you have typedef $1.]) |
2626
|
291 fi]) |
|
292 if test $octave_cv_type_$1 = no; then |
3887
|
293 AC_DEFINE($1, $3, [Define to typedef for $1.]) |
2626
|
294 fi |
|
295 ]) |
3107
|
296 dnl |
|
297 dnl Check to see if C++ compiler needs the new friend template declaration |
|
298 dnl syntax. |
|
299 dnl |
|
300 dnl OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL |
|
301 AC_DEFUN(OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL, [ |
|
302 AC_REQUIRE([AC_PROG_CXX]) |
|
303 AC_MSG_CHECKING([for C++ support for new friend template declaration]) |
|
304 AC_CACHE_VAL(octave_cv_cxx_new_friend_template_decl, [ |
|
305 AC_LANG_SAVE |
|
306 AC_LANG_CPLUSPLUS |
|
307 rm -f conftest.h |
|
308 cat > conftest.h <<EOB |
|
309 struct A { |
|
310 friend int operator== (const A&, const A&); |
|
311 A (int) { } |
|
312 }; |
|
313 |
|
314 template <class T> int |
|
315 operator== (const T&, const T&) |
|
316 { |
|
317 return 0; |
|
318 } |
|
319 EOB |
|
320 AC_TRY_LINK([#include "conftest.h"], [ |
|
321 A a (1); |
|
322 return a == A(1); |
|
323 ], |
|
324 octave_cv_cxx_new_friend_template_decl=no, |
|
325 octave_cv_cxx_new_friend_template_decl=yes |
|
326 ) |
|
327 AC_LANG_RESTORE |
|
328 ]) |
|
329 AC_MSG_RESULT($octave_cv_cxx_new_friend_template_decl) |
|
330 if test $octave_cv_cxx_new_friend_template_decl = yes; then |
3887
|
331 AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL,1,[Define if your compiler supports `<>' stuff for template friends.]) |
3107
|
332 fi |
|
333 ]) |
3126
|
334 dnl |
3233
|
335 dnl Check to see if C compiler handles FLAG command line option. If |
|
336 dnl two arguments are specified, execute the second arg as shell |
|
337 dnl commands. Otherwise, add FLAG to CFLAGS if the compiler accepts |
|
338 dnl the flag. |
3126
|
339 dnl |
|
340 dnl OCTAVE_CC_FLAG |
|
341 AC_DEFUN(OCTAVE_CC_FLAG, [ |
|
342 ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` |
|
343 AC_MSG_CHECKING(whether ${CC-cc} accepts $1) |
|
344 AC_CACHE_VAL(octave_cv_cc_flag_$ac_safe, [ |
|
345 AC_LANG_SAVE |
|
346 AC_LANG_C |
|
347 XCFLAGS="$CFLAGS" |
|
348 CFLAGS="$CFLAGS $1" |
|
349 AC_TRY_LINK([], [], |
|
350 eval "octave_cv_cc_flag_$ac_safe=yes", |
|
351 eval "octave_cv_cc_flag_$ac_safe=no") |
|
352 CFLAGS="$XCFLAGS" |
|
353 AC_LANG_RESTORE |
|
354 ]) |
|
355 if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then |
|
356 AC_MSG_RESULT(yes) |
3131
|
357 ifelse([$2], , [ |
|
358 CFLAGS="$CFLAGS $1" |
|
359 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2]) |
3126
|
360 else |
|
361 AC_MSG_RESULT(no) |
|
362 ifelse([$3], , , [$3]) |
|
363 fi |
|
364 ]) |
|
365 dnl |
3233
|
366 dnl Check to see if C++ compiler handles FLAG command line option. If |
|
367 dnl two arguments are specified, execute the second arg as shell |
|
368 dnl commands. Otherwise, add FLAG to CXXFLAGS if the compiler accepts |
|
369 dnl the flag. |
3126
|
370 dnl |
|
371 dnl OCTAVE_CXX_FLAG |
|
372 AC_DEFUN(OCTAVE_CXX_FLAG, [ |
|
373 ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` |
3222
|
374 AC_MSG_CHECKING(whether ${CXX-g++} accepts $1) |
3126
|
375 AC_CACHE_VAL(octave_cv_cxx_flag_$ac_safe, [ |
|
376 AC_LANG_SAVE |
|
377 AC_LANG_CPLUSPLUS |
|
378 XCXXFLAGS="$CXXFLAGS" |
|
379 CXXFLAGS="$CXXFLAGS $1" |
|
380 AC_TRY_LINK([], [], |
|
381 eval "octave_cv_cxx_flag_$ac_safe=yes", |
|
382 eval "octave_cv_cxx_flag_$ac_safe=no") |
|
383 CXXFLAGS="$XCXXFLAGS" |
|
384 AC_LANG_RESTORE |
|
385 ]) |
|
386 if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then |
|
387 AC_MSG_RESULT(yes) |
3131
|
388 ifelse([$2], , [ |
|
389 CXXFLAGS="$CXXFLAGS $1" |
|
390 AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2]) |
3126
|
391 else |
|
392 AC_MSG_RESULT(no) |
|
393 ifelse([$3], , , [$3]) |
|
394 fi |
|
395 ]) |
3130
|
396 dnl |
3729
|
397 dnl Check for flex |
|
398 dnl |
|
399 AC_DEFUN(OCTAVE_PROG_FLEX, [ |
|
400 ### For now, don't define LEXLIB to be -lfl -- we don't use anything in |
|
401 ### it, and it might not be installed. |
|
402 ### |
|
403 ### Also make sure that we generate an interactive scanner if we are |
|
404 ### using flex. |
|
405 AC_PROG_LEX |
|
406 case "$LEX" in |
|
407 flex*) |
|
408 LFLAGS="-t -I" |
|
409 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) |
|
410 LEXLIB= |
|
411 ;; |
|
412 *) |
|
413 LEX='$(top_srcdir)/missing flex' |
|
414 warn_flex="I didn't find flex, but it's only a problem if you need to reconstruct lex.cc" |
|
415 AC_MSG_WARN($warn_flex) |
|
416 ;; |
|
417 esac |
|
418 AC_SUBST(LFLAGS) |
|
419 ]) |
|
420 dnl |
|
421 dnl Check for bison |
|
422 dnl |
|
423 AC_DEFUN(OCTAVE_PROG_BISON, [ |
|
424 AC_PROG_YACC |
|
425 case "$YACC" in |
|
426 bison*) |
|
427 ;; |
|
428 *) |
|
429 YACC='$(top_srcdir)/missing bison' |
|
430 warn_bison="I didn't find bison, but it's only a problem if you need to reconstruct parse.cc" |
|
431 AC_MSG_WARN($warn_bison) |
|
432 ;; |
|
433 esac |
|
434 ]) |
|
435 dnl |
3130
|
436 dnl What pager should we use? |
|
437 dnl |
|
438 AC_DEFUN(OCTAVE_PROG_PAGER, |
|
439 [if test "$cross_compiling" = yes; then |
|
440 DEFAULT_PAGER=less |
|
441 AC_MSG_RESULT(assuming $DEFAULT_PAGER exists on $canonical_host_type host) |
|
442 AC_SUBST(DEFAULT_PAGER) |
|
443 else |
|
444 octave_possible_pagers="less more page pg" |
|
445 case "$canonical_host_type" in |
|
446 *-*-cygwin32) |
|
447 octave_possible_pagers="$octave_possible_pagers more.com" |
|
448 ;; |
|
449 esac |
|
450 |
|
451 AC_CHECK_PROGS(DEFAULT_PAGER, $octave_possible_pagers, []) |
|
452 if test -z "$DEFAULT_PAGER"; then |
|
453 warn_less="I couldn't find \`less', \`more', \`page', or \`pg'" |
|
454 AC_MSG_WARN($warn_less) |
|
455 fi |
|
456 fi |
|
457 ]) |
|
458 dnl |
|
459 dnl Does gnuplot exist? Is it a recent version? |
|
460 dnl |
|
461 AC_DEFUN(OCTAVE_PROG_GNUPLOT, |
|
462 [if test "$cross_compiling" = yes; then |
|
463 GNUPLOT_BINARY=gnuplot |
|
464 AC_MSG_RESULT(assuming $GNUPLOT_BINARY exists on $canonical_host_type host) |
|
465 AC_SUBST(DEFAULT_PAGER) |
|
466 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiplot mode) |
3887
|
467 AC_DEFINE(GNUPLOT_HAS_MULTIPLOT, 1, [Define if gnuplot has multiplot.]) |
3130
|
468 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiple frams) |
3887
|
469 AC_DEFINE(GNUPLOT_HAS_FRAMES, 1, [Define if gnuplot has frames.]) |
3130
|
470 else |
|
471 AC_CHECK_PROG(GNUPLOT_BINARY, gnuplot, gnuplot, []) |
|
472 if test -n "$GNUPLOT_BINARY"; then |
|
473 AC_MSG_CHECKING([to see if your gnuplot supports multiplot]) |
|
474 if test -z "`echo 'set term unknown; set multiplot' | \ |
|
475 $GNUPLOT_BINARY 2>&1`"; then |
|
476 AC_MSG_RESULT([yes]) |
|
477 AC_DEFINE(GNUPLOT_HAS_MULTIPLOT, 1) |
|
478 else |
|
479 AC_MSG_RESULT([no]) |
|
480 fi |
|
481 AC_MSG_CHECKING([to see if your gnuplot supports multiple plot windows]) |
|
482 if test -z "`echo 'set term x11 2' | $GNUPLOT_BINARY 2>&1`"; then |
|
483 AC_MSG_RESULT([yes]) |
|
484 AC_DEFINE(GNUPLOT_HAS_FRAMES, 1) |
|
485 else |
|
486 AC_MSG_RESULT([no]) |
|
487 fi |
|
488 else |
|
489 warn_gnuplot="yes" |
|
490 |
|
491 ## If you change this text, be sure to also copy it to the set of |
|
492 ## warnings at the end of the script |
|
493 |
|
494 AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot]) |
|
495 AC_MSG_WARN([installed, but you won't be able to use any of Octave's]) |
|
496 AC_MSG_WARN([plotting commands without it.]) |
|
497 AC_MSG_WARN([]) |
|
498 AC_MSG_WARN([If gnuplot is installed but it isn't in your path, you can]) |
|
499 AC_MSG_WARN([tell Octave where to find it by typing the command]) |
|
500 AC_MSG_WARN([]) |
|
501 AC_MSG_WARN([gnuplot_binary = "/full/path/to/gnuplot/binary"]) |
|
502 AC_MSG_WARN([]) |
|
503 AC_MSG_WARN([at the Octave prompt.]) |
|
504 fi |
|
505 fi |
|
506 ]) |
|
507 dnl |
|
508 dnl Is DejaGNU installed? |
|
509 dnl |
3222
|
510 dnl OCTAVE_PROG_RUNTEST |
3130
|
511 AC_DEFUN(OCTAVE_PROG_RUNTEST, |
|
512 [if test "$cross_compiling" = yes; then |
|
513 RUNTEST=runtest |
|
514 AC_MSG_RESULT(assuming $RUNTEST exists on $canonical_host_type host) |
|
515 AC_SUBST(RUNTEST) |
|
516 else |
|
517 AC_CHECK_PROG(RUNTEST, runtest, runtest, []) |
|
518 if test -z "$RUNTEST"; then |
|
519 warn_runtest="I didn't find runtest -- install DejaGNU if you want to run \`make check'" |
|
520 AC_MSG_WARN($warn_runtest) |
|
521 fi |
|
522 AC_SUBST(RUNTEST) |
|
523 fi |
|
524 ]) |
3222
|
525 dnl |
3673
|
526 dnl Is gperf installed? |
|
527 dnl |
|
528 dnl OCTAVE_PROG_GPERF |
3731
|
529 AC_DEFUN(OCTAVE_PROG_GPERF, [ |
|
530 AC_CHECK_PROG(GPERF, gperf, gperf, []) |
|
531 if test -n "$GPERF"; then |
|
532 if echo "%{ |
|
533 %} |
|
534 %% |
3750
|
535 foo" | $GPERF -t -C -D -E -G -L ANSI-C -H octave_kw_hash -N octave_kw_lookup > /dev/null 2>&1; then |
3731
|
536 true |
|
537 else |
|
538 GPERF="" |
|
539 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" |
|
540 AC_MSG_WARN($warn_gperf) |
|
541 fi |
|
542 else |
|
543 GPERF='$(top_srcdir)/missing gperf' |
|
544 warn_gperf="I didn't find gperf, but it's only a problem if you need to reconstruct oct-gperf.h" |
|
545 AC_MSG_WARN($warn_gperf) |
|
546 fi |
|
547 AC_SUBST(GPERF) |
3673
|
548 ]) |
|
549 dnl |
3222
|
550 dnl Find nm. |
|
551 dnl |
|
552 dnl OCTAVE_PROG_NM |
|
553 AC_DEFUN(OCTAVE_PROG_NM, |
|
554 [if test "$cross_compiling" = yes; then |
|
555 NM=nm |
|
556 AC_MSG_RESULT(assuming $NM exists on $canonical_host_type host) |
|
557 AC_SUBST(NM) |
|
558 else |
|
559 AC_CHECK_PROG(NM, nm, nm, []) |
|
560 AC_SUBST(NM) |
|
561 fi |
|
562 ]) |
|
563 dnl |
|
564 dnl See if the C++ compiler prepends an underscore to external names. |
|
565 dnl |
|
566 dnl OCTAVE_CXX_PREPENDS_UNDERSCORE |
|
567 AC_DEFUN(OCTAVE_CXX_PREPENDS_UNDERSCORE, |
|
568 [AC_MSG_CHECKING([whether ${CXX-g++} prepends an underscore to external names]) |
|
569 AC_CACHE_VAL(octave_cv_cxx_prepends_underscore, |
|
570 [octave_cv_cxx_prepends_underscore=no |
|
571 AC_LANG_SAVE |
|
572 AC_LANG_CPLUSPLUS |
|
573 cat > conftest.$ac_ext <<EOF |
3842
|
574 bool FSmy_dld_fcn (void) { return false; } |
3222
|
575 EOF |
|
576 if AC_TRY_EVAL(ac_compile); then |
|
577 if test "`${NM-nm} conftest.o | grep _FSmy_dld_fcn`" != ""; then |
|
578 octave_cv_cxx_prepends_underscore=yes |
|
579 fi |
|
580 else |
|
581 echo "configure: failed program was:" >&AC_FD_CC |
|
582 cat conftest.$ac_ext >&AC_FD_CC |
|
583 fi |
|
584 AC_LANG_RESTORE |
|
585 ]) |
|
586 AC_MSG_RESULT($octave_cv_cxx_prepends_underscore) |
|
587 if test $octave_cv_cxx_prepends_underscore = yes; then |
3887
|
588 AC_DEFINE(CXX_PREPENDS_UNDERSCORE, 1, [Define if your compiler prepends underscores to external names.]) |
3222
|
589 fi |
|
590 ]) |
3769
|
591 dnl |
|
592 dnl See if the C++ library is ISO compliant. |
|
593 dnl FIXME: This is obviously very simplistic, and trivially fooled. |
|
594 dnl |
|
595 dnl OCTAVE_CXX_ISO_COMPLIANT_LIBRARY |
|
596 AC_DEFUN(OCTAVE_CXX_ISO_COMPLIANT_LIBRARY, [ |
|
597 AC_REQUIRE([AC_PROG_CXX]) |
|
598 AC_MSG_CHECKING([if C++ library is ISO compliant]) |
|
599 AC_CACHE_VAL(octave_cv_cxx_iso_compliant_library, [ |
|
600 AC_LANG_SAVE |
|
601 AC_LANG_CPLUSPLUS |
|
602 rm -f conftest.h |
|
603 for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \ |
|
604 climits clocale cmath complex csetjmp csignal cstdarg cstddef \ |
|
605 cstdio cstdlib cstring ctime cwchar cwctype deque exception \ |
|
606 fstream functional iomanip ios iosfwd iostream istream iterator \ |
|
607 limits list locale map memory new numeric ostream queue set \ |
|
608 sstream stack stdexcept streambuf string strstream typeinfo \ |
|
609 utility valarray vector; do |
|
610 echo "#include <$inc>" >> conftest.h |
|
611 done |
|
612 AC_TRY_LINK([#include "conftest.h"], [ |
|
613 std::bitset<50> flags; |
|
614 flags.set(); |
|
615 int digits = std::numeric_limits<unsigned long>::digits; |
|
616 digits = 0; |
|
617 ], |
|
618 octave_cv_cxx_iso_compliant_library=yes, |
|
619 octave_cv_cxx_iso_compliant_library=no |
|
620 ) |
|
621 AC_LANG_RESTORE |
|
622 ]) |
|
623 AC_MSG_RESULT($octave_cv_cxx_iso_compliant_library) |
|
624 if test $octave_cv_cxx_iso_compliant_library = yes; then |
3887
|
625 AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, [Define if your C++ runtime library is ISO compliant.]) |
3769
|
626 fi |
|
627 ]) |
3822
|
628 dnl |
|
629 dnl Allow the user disable support for command line editing using GNU |
|
630 dnl readline. |
|
631 dnl |
|
632 dnl OCTAVE_ENABLE_READLINE |
|
633 AC_DEFUN(OCTAVE_ENABLE_READLINE, [ |
|
634 USE_READLINE=true |
|
635 AC_ARG_ENABLE(readline, |
|
636 [ --enable-readline use readline library (default is yes)], |
|
637 [if test "$enableval" = no; then |
3824
|
638 USE_READLINE=false |
3825
|
639 warn_readline="command editing and history features require GNU Readline" |
3824
|
640 fi]) |
3822
|
641 if $USE_READLINE; then |
|
642 AC_CHECK_LIB(readline, rl_set_keyboard_input_timeout, [ |
|
643 LIBS="-lreadline $LIBS" |
3887
|
644 AC_DEFINE(USE_READLINE, 1, [Define to use the readline library.]) |
3822
|
645 ], [ |
3824
|
646 AC_MSG_WARN([I need GNU Readline 4.2 or later]) |
|
647 AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) |
3822
|
648 ]) |
|
649 fi |
|
650 ]) |
3842
|
651 dnl |
|
652 dnl Determine the C++ compiler ABI. It sets the macro CXX_ABI to the |
|
653 dnl name of the ABI, and is used to mangle the C linkage loadable |
|
654 dnl functions to avoid ABI mismatch. GNU C++ currently uses gnu_v2 |
|
655 dnl (GCC versions <= 2.95.x) dnl or gnu_v3 (GCC versions >= 3.0). |
|
656 dnl Set to "unknown" is when we don't know enough about the ABI, which |
|
657 dnl will happen when using an unsupported C++ compiler. |
|
658 dnl |
|
659 dnl OCTAVE_CXX_ABI |
|
660 AC_DEFUN(OCTAVE_CXX_ABI, |
|
661 [AC_MSG_CHECKING([C++ ABI version used by ${CXX}]) |
|
662 AC_CACHE_VAL(octave_cv_cxx_abi, |
|
663 [octave_cv_cxx_abi='unknown' |
|
664 AC_LANG_SAVE |
|
665 AC_LANG_CPLUSPLUS |
|
666 cat > conftest.$ac_ext <<EOF |
|
667 bool FSmy_dld_fcn (void) { return false; } |
|
668 EOF |
|
669 if AC_TRY_EVAL(ac_compile); then |
|
670 if test "`${NM-nm} conftest.o | grep FSmy_dld_fcn__Fv`" != ""; then |
|
671 octave_cv_cxx_abi='gnu_v2' |
|
672 fi |
|
673 if test "`${NM-nm} conftest.o | grep _Z12FSmy_dld_fcnv`" != ""; then |
|
674 octave_cv_cxx_abi='gnu_v3' |
|
675 fi |
|
676 if test "`${NM-nm} conftest.o | grep __1cMFSmy_dld_fcn6F_b_`" != ""; then |
3843
|
677 octave_cv_cxx_abi='sun_v5' |
3842
|
678 fi |
|
679 else |
|
680 echo "configure: failed program was:" >&AC_FD_CC |
|
681 cat conftest.$ac_ext >&AC_FD_CC |
|
682 fi |
|
683 AC_LANG_RESTORE |
|
684 ]) |
|
685 AC_MSG_RESULT($octave_cv_cxx_abi) |
3887
|
686 AC_DEFINE_UNQUOTED(CXX_ABI, $octave_cv_cxx_abi, [Define to the C++ ABI your compiler uses.]) |
3842
|
687 ]) |
|
688 |