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 |
3729
|
356 dnl Check for flex |
|
357 dnl |
|
358 AC_DEFUN(OCTAVE_PROG_FLEX, [ |
|
359 ### For now, don't define LEXLIB to be -lfl -- we don't use anything in |
|
360 ### it, and it might not be installed. |
|
361 ### |
|
362 ### Also make sure that we generate an interactive scanner if we are |
|
363 ### using flex. |
|
364 AC_PROG_LEX |
|
365 case "$LEX" in |
|
366 flex*) |
|
367 LFLAGS="-t -I" |
|
368 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) |
|
369 LEXLIB= |
|
370 ;; |
|
371 *) |
|
372 LEX='$(top_srcdir)/missing flex' |
|
373 warn_flex="I didn't find flex, but it's only a problem if you need to reconstruct lex.cc" |
|
374 AC_MSG_WARN($warn_flex) |
|
375 ;; |
|
376 esac |
|
377 AC_SUBST(LFLAGS) |
|
378 ]) |
|
379 dnl |
|
380 dnl Check for bison |
|
381 dnl |
|
382 AC_DEFUN(OCTAVE_PROG_BISON, [ |
|
383 AC_PROG_YACC |
|
384 case "$YACC" in |
|
385 bison*) |
|
386 ;; |
|
387 *) |
|
388 YACC='$(top_srcdir)/missing bison' |
|
389 warn_bison="I didn't find bison, but it's only a problem if you need to reconstruct parse.cc" |
|
390 AC_MSG_WARN($warn_bison) |
|
391 ;; |
|
392 esac |
|
393 ]) |
|
394 dnl |
3130
|
395 dnl What pager should we use? |
|
396 dnl |
|
397 AC_DEFUN(OCTAVE_PROG_PAGER, |
|
398 [if test "$cross_compiling" = yes; then |
|
399 DEFAULT_PAGER=less |
|
400 AC_MSG_RESULT(assuming $DEFAULT_PAGER exists on $canonical_host_type host) |
|
401 AC_SUBST(DEFAULT_PAGER) |
|
402 else |
|
403 octave_possible_pagers="less more page pg" |
|
404 case "$canonical_host_type" in |
3971
|
405 *-*-cygwin*) |
3130
|
406 octave_possible_pagers="$octave_possible_pagers more.com" |
|
407 ;; |
|
408 esac |
|
409 |
|
410 AC_CHECK_PROGS(DEFAULT_PAGER, $octave_possible_pagers, []) |
|
411 if test -z "$DEFAULT_PAGER"; then |
|
412 warn_less="I couldn't find \`less', \`more', \`page', or \`pg'" |
|
413 AC_MSG_WARN($warn_less) |
|
414 fi |
|
415 fi |
|
416 ]) |
|
417 dnl |
|
418 dnl Does gnuplot exist? Is it a recent version? |
|
419 dnl |
|
420 AC_DEFUN(OCTAVE_PROG_GNUPLOT, |
|
421 [if test "$cross_compiling" = yes; then |
|
422 GNUPLOT_BINARY=gnuplot |
|
423 AC_MSG_RESULT(assuming $GNUPLOT_BINARY exists on $canonical_host_type host) |
|
424 AC_SUBST(DEFAULT_PAGER) |
|
425 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiplot mode) |
3887
|
426 AC_DEFINE(GNUPLOT_HAS_MULTIPLOT, 1, [Define if gnuplot has multiplot.]) |
3130
|
427 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiple frams) |
3887
|
428 AC_DEFINE(GNUPLOT_HAS_FRAMES, 1, [Define if gnuplot has frames.]) |
3130
|
429 else |
|
430 AC_CHECK_PROG(GNUPLOT_BINARY, gnuplot, gnuplot, []) |
|
431 if test -n "$GNUPLOT_BINARY"; then |
|
432 AC_MSG_CHECKING([to see if your gnuplot supports multiplot]) |
|
433 if test -z "`echo 'set term unknown; set multiplot' | \ |
|
434 $GNUPLOT_BINARY 2>&1`"; then |
|
435 AC_MSG_RESULT([yes]) |
|
436 AC_DEFINE(GNUPLOT_HAS_MULTIPLOT, 1) |
|
437 else |
|
438 AC_MSG_RESULT([no]) |
|
439 fi |
|
440 AC_MSG_CHECKING([to see if your gnuplot supports multiple plot windows]) |
|
441 if test -z "`echo 'set term x11 2' | $GNUPLOT_BINARY 2>&1`"; then |
|
442 AC_MSG_RESULT([yes]) |
|
443 AC_DEFINE(GNUPLOT_HAS_FRAMES, 1) |
|
444 else |
|
445 AC_MSG_RESULT([no]) |
|
446 fi |
|
447 else |
|
448 warn_gnuplot="yes" |
|
449 |
|
450 ## If you change this text, be sure to also copy it to the set of |
|
451 ## warnings at the end of the script |
|
452 |
|
453 AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot]) |
|
454 AC_MSG_WARN([installed, but you won't be able to use any of Octave's]) |
|
455 AC_MSG_WARN([plotting commands without it.]) |
|
456 AC_MSG_WARN([]) |
|
457 AC_MSG_WARN([If gnuplot is installed but it isn't in your path, you can]) |
|
458 AC_MSG_WARN([tell Octave where to find it by typing the command]) |
|
459 AC_MSG_WARN([]) |
|
460 AC_MSG_WARN([gnuplot_binary = "/full/path/to/gnuplot/binary"]) |
|
461 AC_MSG_WARN([]) |
|
462 AC_MSG_WARN([at the Octave prompt.]) |
|
463 fi |
|
464 fi |
|
465 ]) |
|
466 dnl |
|
467 dnl Is DejaGNU installed? |
|
468 dnl |
3222
|
469 dnl OCTAVE_PROG_RUNTEST |
3130
|
470 AC_DEFUN(OCTAVE_PROG_RUNTEST, |
|
471 [if test "$cross_compiling" = yes; then |
|
472 RUNTEST=runtest |
|
473 AC_MSG_RESULT(assuming $RUNTEST exists on $canonical_host_type host) |
|
474 AC_SUBST(RUNTEST) |
|
475 else |
|
476 AC_CHECK_PROG(RUNTEST, runtest, runtest, []) |
|
477 if test -z "$RUNTEST"; then |
|
478 warn_runtest="I didn't find runtest -- install DejaGNU if you want to run \`make check'" |
|
479 AC_MSG_WARN($warn_runtest) |
|
480 fi |
|
481 AC_SUBST(RUNTEST) |
|
482 fi |
|
483 ]) |
3222
|
484 dnl |
3673
|
485 dnl Is gperf installed? |
|
486 dnl |
|
487 dnl OCTAVE_PROG_GPERF |
3731
|
488 AC_DEFUN(OCTAVE_PROG_GPERF, [ |
|
489 AC_CHECK_PROG(GPERF, gperf, gperf, []) |
|
490 if test -n "$GPERF"; then |
|
491 if echo "%{ |
|
492 %} |
|
493 %% |
3750
|
494 foo" | $GPERF -t -C -D -E -G -L ANSI-C -H octave_kw_hash -N octave_kw_lookup > /dev/null 2>&1; then |
3731
|
495 true |
|
496 else |
|
497 GPERF="" |
|
498 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" |
|
499 AC_MSG_WARN($warn_gperf) |
|
500 fi |
|
501 else |
|
502 GPERF='$(top_srcdir)/missing gperf' |
|
503 warn_gperf="I didn't find gperf, but it's only a problem if you need to reconstruct oct-gperf.h" |
|
504 AC_MSG_WARN($warn_gperf) |
|
505 fi |
|
506 AC_SUBST(GPERF) |
3673
|
507 ]) |
|
508 dnl |
3222
|
509 dnl Find nm. |
|
510 dnl |
|
511 dnl OCTAVE_PROG_NM |
|
512 AC_DEFUN(OCTAVE_PROG_NM, |
|
513 [if test "$cross_compiling" = yes; then |
|
514 NM=nm |
|
515 AC_MSG_RESULT(assuming $NM exists on $canonical_host_type host) |
|
516 AC_SUBST(NM) |
|
517 else |
|
518 AC_CHECK_PROG(NM, nm, nm, []) |
|
519 AC_SUBST(NM) |
|
520 fi |
|
521 ]) |
|
522 dnl |
|
523 dnl See if the C++ compiler prepends an underscore to external names. |
|
524 dnl |
|
525 dnl OCTAVE_CXX_PREPENDS_UNDERSCORE |
|
526 AC_DEFUN(OCTAVE_CXX_PREPENDS_UNDERSCORE, |
|
527 [AC_MSG_CHECKING([whether ${CXX-g++} prepends an underscore to external names]) |
|
528 AC_CACHE_VAL(octave_cv_cxx_prepends_underscore, |
|
529 [octave_cv_cxx_prepends_underscore=no |
3888
|
530 AC_LANG_PUSH(C++) |
3222
|
531 cat > conftest.$ac_ext <<EOF |
3842
|
532 bool FSmy_dld_fcn (void) { return false; } |
3222
|
533 EOF |
|
534 if AC_TRY_EVAL(ac_compile); then |
|
535 if test "`${NM-nm} conftest.o | grep _FSmy_dld_fcn`" != ""; then |
|
536 octave_cv_cxx_prepends_underscore=yes |
|
537 fi |
|
538 else |
3888
|
539 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
|
540 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD |
3222
|
541 fi |
3888
|
542 AC_LANG_POP(C++) |
3222
|
543 ]) |
|
544 AC_MSG_RESULT($octave_cv_cxx_prepends_underscore) |
|
545 if test $octave_cv_cxx_prepends_underscore = yes; then |
3887
|
546 AC_DEFINE(CXX_PREPENDS_UNDERSCORE, 1, [Define if your compiler prepends underscores to external names.]) |
3222
|
547 fi |
|
548 ]) |
3769
|
549 dnl |
|
550 dnl See if the C++ library is ISO compliant. |
|
551 dnl FIXME: This is obviously very simplistic, and trivially fooled. |
|
552 dnl |
|
553 dnl OCTAVE_CXX_ISO_COMPLIANT_LIBRARY |
|
554 AC_DEFUN(OCTAVE_CXX_ISO_COMPLIANT_LIBRARY, [ |
|
555 AC_REQUIRE([AC_PROG_CXX]) |
|
556 AC_MSG_CHECKING([if C++ library is ISO compliant]) |
|
557 AC_CACHE_VAL(octave_cv_cxx_iso_compliant_library, [ |
3888
|
558 AC_LANG_PUSH(C++) |
3769
|
559 rm -f conftest.h |
3943
|
560 ### Omitting cwctype for now, since it is broken with gcc-3.0.x and |
|
561 ### possibly other versions... |
3769
|
562 for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \ |
|
563 climits clocale cmath complex csetjmp csignal cstdarg cstddef \ |
3943
|
564 cstdio cstdlib cstring ctime cwchar deque exception \ |
3769
|
565 fstream functional iomanip ios iosfwd iostream istream iterator \ |
|
566 limits list locale map memory new numeric ostream queue set \ |
|
567 sstream stack stdexcept streambuf string strstream typeinfo \ |
|
568 utility valarray vector; do |
|
569 echo "#include <$inc>" >> conftest.h |
|
570 done |
|
571 AC_TRY_LINK([#include "conftest.h"], [ |
|
572 std::bitset<50> flags; |
|
573 flags.set(); |
|
574 int digits = std::numeric_limits<unsigned long>::digits; |
|
575 digits = 0; |
|
576 ], |
|
577 octave_cv_cxx_iso_compliant_library=yes, |
|
578 octave_cv_cxx_iso_compliant_library=no |
|
579 ) |
3888
|
580 AC_LANG_POP(C++) |
3769
|
581 ]) |
|
582 AC_MSG_RESULT($octave_cv_cxx_iso_compliant_library) |
|
583 if test $octave_cv_cxx_iso_compliant_library = yes; then |
3887
|
584 AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, [Define if your C++ runtime library is ISO compliant.]) |
3769
|
585 fi |
|
586 ]) |
3822
|
587 dnl |
|
588 dnl Allow the user disable support for command line editing using GNU |
|
589 dnl readline. |
|
590 dnl |
|
591 dnl OCTAVE_ENABLE_READLINE |
|
592 AC_DEFUN(OCTAVE_ENABLE_READLINE, [ |
|
593 USE_READLINE=true |
|
594 AC_ARG_ENABLE(readline, |
|
595 [ --enable-readline use readline library (default is yes)], |
|
596 [if test "$enableval" = no; then |
3824
|
597 USE_READLINE=false |
3825
|
598 warn_readline="command editing and history features require GNU Readline" |
3824
|
599 fi]) |
3822
|
600 if $USE_READLINE; then |
|
601 AC_CHECK_LIB(readline, rl_set_keyboard_input_timeout, [ |
|
602 LIBS="-lreadline $LIBS" |
3887
|
603 AC_DEFINE(USE_READLINE, 1, [Define to use the readline library.]) |
3822
|
604 ], [ |
3824
|
605 AC_MSG_WARN([I need GNU Readline 4.2 or later]) |
|
606 AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) |
3822
|
607 ]) |
|
608 fi |
|
609 ]) |
3842
|
610 dnl |
|
611 dnl Determine the C++ compiler ABI. It sets the macro CXX_ABI to the |
|
612 dnl name of the ABI, and is used to mangle the C linkage loadable |
|
613 dnl functions to avoid ABI mismatch. GNU C++ currently uses gnu_v2 |
|
614 dnl (GCC versions <= 2.95.x) dnl or gnu_v3 (GCC versions >= 3.0). |
|
615 dnl Set to "unknown" is when we don't know enough about the ABI, which |
|
616 dnl will happen when using an unsupported C++ compiler. |
|
617 dnl |
|
618 dnl OCTAVE_CXX_ABI |
|
619 AC_DEFUN(OCTAVE_CXX_ABI, |
|
620 [AC_MSG_CHECKING([C++ ABI version used by ${CXX}]) |
|
621 AC_CACHE_VAL(octave_cv_cxx_abi, |
|
622 [octave_cv_cxx_abi='unknown' |
3888
|
623 AC_LANG_PUSH(C++) |
3842
|
624 cat > conftest.$ac_ext <<EOF |
|
625 bool FSmy_dld_fcn (void) { return false; } |
|
626 EOF |
|
627 if AC_TRY_EVAL(ac_compile); then |
|
628 if test "`${NM-nm} conftest.o | grep FSmy_dld_fcn__Fv`" != ""; then |
|
629 octave_cv_cxx_abi='gnu_v2' |
|
630 fi |
|
631 if test "`${NM-nm} conftest.o | grep _Z12FSmy_dld_fcnv`" != ""; then |
|
632 octave_cv_cxx_abi='gnu_v3' |
|
633 fi |
|
634 if test "`${NM-nm} conftest.o | grep __1cMFSmy_dld_fcn6F_b_`" != ""; then |
3843
|
635 octave_cv_cxx_abi='sun_v5' |
3842
|
636 fi |
|
637 else |
3888
|
638 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
|
639 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD |
3842
|
640 fi |
3888
|
641 AC_LANG_POP(C++) |
3842
|
642 ]) |
|
643 AC_MSG_RESULT($octave_cv_cxx_abi) |
3887
|
644 AC_DEFINE_UNQUOTED(CXX_ABI, $octave_cv_cxx_abi, [Define to the C++ ABI your compiler uses.]) |
3842
|
645 ]) |
|
646 |