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, |
|
43 [ifelse($#, 2, [$1=$2 |
|
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 |
|
75 dnl See if $F77 is the GNU Fortran compiler |
|
76 dnl |
|
77 AC_DEFUN(OCTAVE_PROG_G77, |
|
78 [AC_CACHE_CHECK([whether ${F77-f77} is the GNU Fortran compiler], |
|
79 octave_cv_f77_is_g77, |
|
80 [if $use_g77; then |
|
81 octave_cv_f77_is_g77=yes |
|
82 else |
|
83 f77_output=`$F77 -v 2>&1 | grep "GNU F77"` |
|
84 if test -n "$f77_output"; then |
|
85 octave_cv_f77_is_g77=yes |
|
86 fi |
|
87 fi]) |
|
88 ]) |
|
89 dnl |
1232
|
90 dnl See what libraries are used by the Fortran compiler. |
|
91 dnl |
|
92 dnl Write a minimal program and compile it with -v. I don't know what |
|
93 dnl to do if your compiler doesn't have -v... |
|
94 dnl |
|
95 dnl OCTAVE_FLIBS() |
|
96 AC_DEFUN(OCTAVE_FLIBS, |
2039
|
97 [AC_MSG_CHECKING([for Fortran libraries]) |
2854
|
98 AC_REQUIRE([OCTAVE_HOST_TYPE]) |
1232
|
99 AC_CACHE_VAL(octave_cv_flibs, |
|
100 [changequote(, )dnl |
|
101 echo " END" > conftest.f |
|
102 foutput=`${F77-f77} -v -o conftest conftest.f 2>&1` |
|
103 dnl |
|
104 dnl The easiest thing to do for xlf output is to replace all the commas |
|
105 dnl with spaces. Try to only do that if the output is really from xlf, |
|
106 dnl since doing that causes problems on other systems. |
|
107 dnl |
|
108 xlf_p=`echo $foutput | grep xlfentry` |
|
109 if test -n "$xlf_p"; then |
|
110 foutput=`echo $foutput | sed 's/,/ /g'` |
|
111 fi |
|
112 dnl |
|
113 ld_run_path=`echo $foutput | \ |
2638
|
114 sed -n -e 's/^.*LD_RUN_PATH *= *\([^ ]*\).*/\1/p'` |
1232
|
115 dnl |
3074
|
116 dnl We are only supposed to find this on Solaris systems... |
|
117 dnl Uh, the run path should be absolute, shouldn't it? |
1232
|
118 dnl |
3074
|
119 case "$ld_run_path" in |
|
120 /*) |
|
121 if test "$ac_cv_prog_gcc" = yes; then |
|
122 ld_run_path="-Xlinker -R -Xlinker $ld_run_path" |
|
123 else |
|
124 ld_run_path="-R $ld_run_path" |
|
125 fi |
|
126 ;; |
|
127 esac |
1232
|
128 dnl |
|
129 flibs= |
|
130 lflags= |
|
131 dnl |
|
132 dnl If want_arg is set, we know we want the arg to be added to the list, |
|
133 dnl so we don't have to examine it. |
|
134 dnl |
|
135 want_arg= |
|
136 dnl |
|
137 for arg in $foutput; do |
|
138 old_want_arg=$want_arg |
|
139 want_arg= |
3069
|
140 dnl |
|
141 dnl None of the options that take arguments expect the argument to |
|
142 dnl start with a -, so pretend we didn't see anything special. |
|
143 dnl |
|
144 if test -n "$old_want_arg"; then |
|
145 case "$arg" in |
|
146 -*) |
|
147 old_want_arg= |
|
148 ;; |
|
149 esac |
|
150 fi |
1232
|
151 case "$old_want_arg" in |
|
152 '') |
|
153 case $arg in |
2641
|
154 /*.a) |
1232
|
155 exists=false |
|
156 for f in $lflags; do |
|
157 if test x$arg = x$f; then |
|
158 exists=true |
|
159 fi |
|
160 done |
|
161 if $exists; then |
|
162 arg= |
|
163 else |
|
164 lflags="$lflags $arg" |
|
165 fi |
|
166 ;; |
2351
|
167 -bI:*) |
|
168 exists=false |
|
169 for f in $lflags; do |
|
170 if test x$arg = x$f; then |
|
171 exists=true |
|
172 fi |
|
173 done |
|
174 if $exists; then |
|
175 arg= |
|
176 else |
2600
|
177 if test "$ac_cv_prog_gcc" = yes; then |
|
178 lflags="$lflags -Xlinker $arg" |
|
179 else |
|
180 lflags="$lflags $arg" |
|
181 fi |
2351
|
182 fi |
|
183 ;; |
3089
|
184 -lang* | -lcrt0.o | -lc | -lgcc) |
1232
|
185 arg= |
|
186 ;; |
|
187 -[lLR]) |
|
188 want_arg=$arg |
|
189 arg= |
|
190 ;; |
|
191 -[lLR]*) |
|
192 exists=false |
|
193 for f in $lflags; do |
|
194 if test x$arg = x$f; then |
|
195 exists=true |
|
196 fi |
|
197 done |
2862
|
198 if $exists; then |
1232
|
199 arg= |
|
200 else |
2854
|
201 case "$arg" in |
|
202 -lkernel32) |
|
203 case "$canonical_host_type" in |
|
204 *-*-cygwin32) |
|
205 ;; |
|
206 *) |
|
207 lflags="$lflags $arg" |
|
208 ;; |
|
209 esac |
|
210 ;; |
3089
|
211 -lm) |
2854
|
212 ;; |
|
213 *) |
|
214 lflags="$lflags $arg" |
|
215 ;; |
|
216 esac |
1232
|
217 fi |
|
218 ;; |
|
219 -u) |
|
220 want_arg=$arg |
3069
|
221 arg= |
1232
|
222 ;; |
|
223 -Y) |
|
224 want_arg=$arg |
|
225 arg= |
|
226 ;; |
|
227 *) |
|
228 arg= |
|
229 ;; |
|
230 esac |
|
231 ;; |
|
232 -[lLR]) |
|
233 arg="$old_want_arg $arg" |
|
234 ;; |
3069
|
235 -u) |
|
236 arg="-u $arg" |
|
237 ;; |
1232
|
238 -Y) |
|
239 dnl |
|
240 dnl Should probably try to ensure unique directory options here too. |
|
241 dnl This probably only applies to Solaris systems, and then will only |
|
242 dnl work with gcc... |
|
243 dnl |
|
244 arg=`echo $arg | sed -e 's%^P,%%'` |
|
245 SAVE_IFS=$IFS |
|
246 IFS=: |
|
247 list= |
|
248 for elt in $arg; do |
2641
|
249 list="$list -L$elt" |
1232
|
250 done |
|
251 IFS=$SAVE_IFS |
|
252 arg="$list" |
|
253 ;; |
|
254 esac |
|
255 dnl |
|
256 if test -n "$arg"; then |
|
257 flibs="$flibs $arg" |
|
258 fi |
|
259 done |
1953
|
260 if test -n "$ld_run_path"; then |
|
261 flibs_result="$ld_run_path $flibs" |
|
262 else |
|
263 flibs_result="$flibs" |
|
264 fi |
1232
|
265 changequote([, ])dnl |
1953
|
266 octave_cv_flibs="$flibs_result"]) |
1232
|
267 FLIBS="$octave_cv_flibs" |
|
268 AC_MSG_RESULT([$FLIBS])]) |
2548
|
269 dnl |
3130
|
270 dnl This is apparently needed on some Linux systems. |
|
271 dnl |
|
272 AC_DEFUN(OCTAVE_F77_MAIN_FLAG, |
|
273 [FORTRAN_MAIN_FLAG= |
|
274 case "$canonical_host_type" in |
|
275 *-linux-*) |
|
276 FORTRAN_MAIN_FLAG="-u MAIN__" |
|
277 ;; |
|
278 esac |
|
279 if test -n "$FORTRAN_MAIN_FLAG"; then |
|
280 AC_MSG_RESULT([defining FORTRAN_MAIN_FLAG to be $FORTRAN_MAIN_FLAG]) |
|
281 fi |
|
282 AC_SUBST(FORTRAN_MAIN_FLAG) |
|
283 ]) |
|
284 dnl |
1257
|
285 dnl See if the Fortran compiler uses uppercase external names. |
|
286 dnl |
|
287 dnl OCTAVE_F77_UPPERCASE_NAMES() |
|
288 AC_DEFUN(OCTAVE_F77_UPPERCASE_NAMES, |
|
289 [AC_MSG_CHECKING([whether $F77 uses uppercase external names]) |
|
290 AC_CACHE_VAL(octave_cv_f77_uppercase_names, |
|
291 [octave_cv_f77_uppercase_names=no |
|
292 cat > conftest.f <<EOF |
|
293 subroutine xxyyzz () |
|
294 return |
|
295 end |
|
296 EOF |
|
297 if ${F77-f77} -c conftest.f 1>&AC_FD_CC 2>&AC_FD_CC; then |
|
298 if test "`${NM-nm} conftest.o | grep XXYYZZ`" != ""; then |
|
299 octave_cv_f77_uppercase_names=yes |
|
300 fi |
|
301 fi]) |
|
302 AC_MSG_RESULT([$octave_cv_f77_uppercase_names]) |
|
303 if test "$octave_cv_f77_uppercase_names" = yes; then |
|
304 AC_DEFINE(F77_UPPERCASE_NAMES, 1) |
|
305 fi]) |
2548
|
306 dnl |
1232
|
307 dnl See if the Fortran compiler appends underscores to external names. |
|
308 dnl |
|
309 dnl OCTAVE_F77_APPEND_UNDERSCORE() |
|
310 AC_DEFUN(OCTAVE_F77_APPEND_UNDERSCORE, |
|
311 [AC_MSG_CHECKING([whether $F77 appends underscores to external names]) |
1257
|
312 AC_REQUIRE([OCTAVE_F77_UPPERCASE_NAMES]) |
1232
|
313 AC_CACHE_VAL(octave_cv_f77_append_underscore, |
|
314 [octave_cv_f77_append_underscore=no |
|
315 cat > conftest.f <<EOF |
|
316 subroutine xxyyzz () |
|
317 return |
|
318 end |
|
319 EOF |
|
320 if ${F77-f77} -c conftest.f 1>&AC_FD_CC 2>&AC_FD_CC; then |
1257
|
321 if test "$octave_cv_f77_uppercase_names" = yes; then |
|
322 if test "`${NM-nm} conftest.o | grep XXYYZZ_`" != ""; then |
|
323 octave_cv_f77_append_underscore=yes |
|
324 fi |
|
325 else |
|
326 if test "`${NM-nm} conftest.o | grep xxyyzz_`" != ""; then |
|
327 octave_cv_f77_append_underscore=yes |
|
328 fi |
1232
|
329 fi |
|
330 fi]) |
|
331 AC_MSG_RESULT([$octave_cv_f77_append_underscore]) |
|
332 if test "$octave_cv_f77_append_underscore" = yes; then |
|
333 AC_DEFINE(F77_APPEND_UNDERSCORE, 1) |
|
334 fi]) |
2548
|
335 dnl |
1232
|
336 dnl See if the Fortran compiler is compatible with f2c. |
|
337 dnl |
|
338 dnl Write a minimal program, compile it, and see if it works as |
|
339 dnl expected. |
|
340 dnl |
|
341 dnl OCTAVE_F2C_F77_COMPAT() |
|
342 AC_DEFUN(OCTAVE_F2C_F77_COMPAT, |
3130
|
343 [AC_REQUIRE([OCTAVE_PROG_G77]) |
|
344 AC_REQUIRE([OCTAVE_FLIBS]) |
1232
|
345 AC_REQUIRE([OCTAVE_F77_APPEND_UNDERSCORE]) |
3130
|
346 if test "$cross_compiling" = yes; then |
|
347 octave_cv_f2c_f77_compat=yes |
|
348 if test "$octave_cv_f77_is_g77" = yes; then |
|
349 AC_MSG_RESULT([assuming ${F77-f77} cross compiler is f2c compatible]) |
|
350 else |
|
351 AC_MSG_WARN([assuming ${F77-f77} cross compiler is f2c compatible]) |
|
352 fi |
|
353 else |
|
354 AC_CACHE_CHECK([$F77/f2c compatibility], octave_cv_f2c_f77_compat, |
|
355 [trap 'rm -f ftest* ctest* core; exit 1' 1 3 15 |
|
356 octave_cv_f2c_f77_compat=no |
|
357 cat > ftest.f <<EOF |
1232
|
358 INTEGER FUNCTION FORSUB (C, D) |
|
359 CHARACTER *(*) C |
|
360 INTEGER L |
|
361 DOUBLE PRECISION D |
|
362 L = LEN (C) |
|
363 WRITE (*, '(A,1X,I2)') C(1:L), INT (D) |
|
364 FORSUB = 1 |
|
365 RETURN |
|
366 END |
|
367 EOF |
3130
|
368 ${F77-f77} -c ftest.f 1>&AC_FD_CC 2>&AC_FD_CC |
|
369 changequote(, ) |
|
370 cat > ctest.c <<EOF |
1232
|
371 #include "confdefs.h" |
|
372 static char s[14]; |
|
373 int main () |
|
374 { |
|
375 double d = 10.0; |
|
376 int len; |
|
377 strcpy (s, "FOO-I-HITHERE"); |
|
378 len = strlen (s); |
|
379 #ifdef F77_APPEND_UNDERSCORE |
|
380 return (! forsub_ (s, &d, len)); |
|
381 #else |
|
382 return (! forsub (s, &d, len)); |
|
383 #endif |
|
384 } |
2218
|
385 #if defined (sun) |
1232
|
386 int MAIN_ () { return 0; } |
2126
|
387 #elif defined (linux) && defined (__ELF__) |
|
388 int MAIN__ () { return 0; } |
1232
|
389 #endif |
|
390 EOF |
3130
|
391 changequote([, ]) |
|
392 if ${CC-cc} -c ctest.c 1>&AC_FD_CC 2>&AC_FD_CC; then |
|
393 if ${CC-cc} -o ctest ctest.o ftest.o $FLIBS -lm 1>&AC_FD_CC 2>&AC_FD_CC; then |
|
394 ctest_output=`./ctest 2>&1` |
|
395 status=$? |
|
396 if test $status -eq 0 && test "$ctest_output" = "FOO-I-HITHERE 10"; then |
|
397 octave_cv_f2c_f77_compat=yes |
|
398 fi |
1232
|
399 fi |
3130
|
400 fi]) |
|
401 fi |
1232
|
402 rm -f ftest* ctest* core |
3130
|
403 ]) |
2548
|
404 dnl |
|
405 dnl See if struct group has a gr_passwd field. |
|
406 dnl |
|
407 AC_DEFUN(OCTAVE_STRUCT_GR_PASSWD, |
|
408 [AC_CACHE_CHECK([for gr_passwd in struct group], octave_cv_struct_gr_passwd, |
|
409 [AC_TRY_COMPILE([#include <sys/types.h> |
|
410 #include <grp.h>], [struct group s; s.gr_passwd;], |
|
411 octave_cv_struct_gr_passwd=yes, octave_cv_struct_gr_passwd=no)]) |
|
412 if test $octave_cv_struct_gr_passwd = yes; then |
|
413 AC_DEFINE(HAVE_GR_PASSWD) |
|
414 fi |
|
415 ]) |
|
416 dnl |
2574
|
417 dnl See if the standard string class has npos as a member. |
|
418 dnl |
|
419 AC_DEFUN(OCTAVE_STRING_NPOS, |
|
420 [AC_CACHE_CHECK([whether including <string> defines NPOS], |
|
421 octave_cv_string_npos, |
|
422 [AC_LANG_SAVE |
|
423 AC_LANG_CPLUSPLUS |
|
424 AC_TRY_COMPILE([#include <string>], |
|
425 [size_t foo = NPOS], |
|
426 octave_cv_string_npos=yes, octave_cv_string_npos=no)]) |
|
427 if test $octave_cv_string_npos = no; then |
|
428 AC_DEFINE(NPOS, string::npos) |
|
429 fi |
|
430 AC_LANG_RESTORE |
|
431 ]) |
|
432 dnl |
1707
|
433 dnl The following test is from Karl Berry's Kpathseach library. I'm |
|
434 dnl including it here in case we someday want to make the use of |
|
435 dnl kpathsea optional. |
1708
|
436 dnl |
|
437 dnl Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment. |
|
438 dnl This test program is due to Mike Hibler <mike@cs.utah.edu>. |
|
439 dnl We don't actually need to run this if we don't have putenv, but it |
|
440 dnl doesn't hurt. |
|
441 AC_DEFUN(OCTAVE_SMART_PUTENV, |
|
442 [AC_MSG_CHECKING(whether putenv uses malloc) |
1707
|
443 AC_CACHE_VAL(octave_cv_func_putenv_malloc, |
|
444 [AC_TRY_RUN([ |
|
445 #define VAR "YOW_VAR" |
|
446 #define STRING1 "GabbaGabbaHey" |
|
447 #define STRING2 "Yow!!" /* should be shorter than STRING1 */ |
|
448 extern char *getenv (); /* in case char* and int don't mix gracefully */ |
|
449 main () |
|
450 { |
|
451 char *str1, *rstr1, *str2, *rstr2; |
|
452 str1 = getenv (VAR); |
|
453 if (str1) |
|
454 exit (1); |
|
455 str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1); |
|
456 if (str1 == 0) |
|
457 exit (2); |
|
458 strcpy (str1, VAR); |
|
459 strcat (str1, "="); |
|
460 strcat (str1, STRING1); |
|
461 if (putenv (str1) < 0) |
|
462 exit (3); |
|
463 rstr1 = getenv (VAR); |
|
464 if (rstr1 == 0) |
|
465 exit (4); |
|
466 rstr1 -= strlen (VAR) + 1; |
|
467 if (strncmp (rstr1, VAR, strlen (VAR))) |
|
468 exit (5); |
|
469 str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1); |
|
470 if (str2 == 0 || str1 == str2) |
|
471 exit (6); |
|
472 strcpy (str2, VAR); |
|
473 strcat (str2, "="); |
|
474 strcat (str2, STRING2); |
|
475 if (putenv (str2) < 0) |
|
476 exit (7); |
|
477 rstr2 = getenv (VAR); |
|
478 if (rstr2 == 0) |
|
479 exit (8); |
|
480 rstr2 -= strlen (VAR) + 1; |
|
481 #if 0 |
|
482 printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2); |
|
483 /* |
|
484 * If string from first call was reused for the second call, |
|
485 * you had better not do a free on the first string! |
|
486 */ |
|
487 if (rstr1 == rstr2) |
|
488 printf ("#define SMART_PUTENV\n"); |
|
489 else |
|
490 printf ("#undef SMART_PUTENV\n"); |
|
491 #endif |
|
492 exit (rstr1 == rstr2 ? 0 : 1); |
|
493 }], octave_cv_func_putenv_malloc=yes, octave_cv_func_putenv_malloc=no, |
|
494 octave_cv_func_putenv_malloc=no)])dnl |
|
495 AC_MSG_RESULT($octave_cv_func_putenv_malloc) |
|
496 if test $octave_cv_func_putenv_malloc = yes; then |
|
497 AC_DEFINE(SMART_PUTENV) |
1708
|
498 fi]) |
1788
|
499 dnl |
2469
|
500 dnl These two checks for signal functions were originally part of the |
|
501 dnl aclocal.m4 file distributed with bash 2.0. |
|
502 dnl |
|
503 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) |
|
504 AC_DEFUN(OCTAVE_SIGNAL_CHECK, |
|
505 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
506 AC_MSG_CHECKING(for type of signal functions) |
|
507 AC_CACHE_VAL(octave_cv_signal_vintage, |
|
508 [ |
|
509 AC_TRY_LINK([#include <signal.h>],[ |
|
510 sigset_t ss; |
|
511 struct sigaction sa; |
|
512 sigemptyset(&ss); sigsuspend(&ss); |
|
513 sigaction(SIGINT, &sa, (struct sigaction *) 0); |
|
514 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); |
|
515 ], octave_cv_signal_vintage=posix, |
|
516 [ |
|
517 AC_TRY_LINK([#include <signal.h>], [ |
|
518 int mask = sigmask(SIGINT); |
|
519 sigsetmask(mask); sigblock(mask); sigpause(mask); |
|
520 ], octave_cv_signal_vintage=4.2bsd, |
|
521 [ |
|
522 AC_TRY_LINK([ |
|
523 #include <signal.h> |
|
524 RETSIGTYPE foo() { }], [ |
|
525 int mask = sigmask(SIGINT); |
|
526 sigset(SIGINT, foo); sigrelse(SIGINT); |
|
527 sighold(SIGINT); sigpause(SIGINT); |
2491
|
528 ], octave_cv_signal_vintage=svr3, octave_cv_signal_vintage=v7 |
2469
|
529 )] |
|
530 )] |
|
531 ) |
|
532 ]) |
|
533 AC_MSG_RESULT($octave_cv_signal_vintage) |
2491
|
534 if test "$octave_cv_signal_vintage" = posix; then |
2469
|
535 AC_DEFINE(HAVE_POSIX_SIGNALS) |
2491
|
536 elif test "$octave_cv_signal_vintage" = "4.2bsd"; then |
2469
|
537 AC_DEFINE(HAVE_BSD_SIGNALS) |
2491
|
538 elif test "$octave_cv_signal_vintage" = svr3; then |
2469
|
539 AC_DEFINE(HAVE_USG_SIGHOLD) |
|
540 fi |
|
541 ]) |
|
542 dnl |
|
543 AC_DEFUN(OCTAVE_REINSTALL_SIGHANDLERS, |
|
544 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
545 AC_REQUIRE([OCTAVE_SIGNAL_CHECK]) |
|
546 AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked]) |
|
547 AC_CACHE_VAL(octave_cv_must_reinstall_sighandlers, |
|
548 [AC_TRY_RUN([ |
|
549 #include <signal.h> |
|
550 #ifdef HAVE_UNISTD_H |
|
551 #include <unistd.h> |
|
552 #endif |
|
553 typedef RETSIGTYPE sigfunc(); |
|
554 int nsigint; |
|
555 #ifdef HAVE_POSIX_SIGNALS |
|
556 sigfunc * |
|
557 set_signal_handler(sig, handler) |
|
558 int sig; |
|
559 sigfunc *handler; |
|
560 { |
|
561 struct sigaction act, oact; |
|
562 act.sa_handler = handler; |
|
563 act.sa_flags = 0; |
|
564 sigemptyset (&act.sa_mask); |
|
565 sigemptyset (&oact.sa_mask); |
|
566 sigaction (sig, &act, &oact); |
|
567 return (oact.sa_handler); |
|
568 } |
|
569 #else |
|
570 #define set_signal_handler(s, h) signal(s, h) |
|
571 #endif |
|
572 RETSIGTYPE |
|
573 sigint(s) |
|
574 int s; |
|
575 { |
|
576 nsigint++; |
|
577 } |
|
578 main() |
|
579 { |
|
580 nsigint = 0; |
|
581 set_signal_handler(SIGINT, sigint); |
|
582 kill((int)getpid(), SIGINT); |
|
583 kill((int)getpid(), SIGINT); |
|
584 exit(nsigint != 2); |
|
585 } |
|
586 ], octave_cv_must_reinstall_sighandlers=no, octave_cv_must_reinstall_sighandlers=yes, |
3130
|
587 if test "$octave_cv_signal_vintage" = svr3; then |
|
588 octave_cv_must_reinstall_sighandlers=yes |
|
589 else |
|
590 octave_cv_must_reinstall_sighandlers=no |
|
591 fi)]) |
|
592 if test "$cross_compiling" = yes; then |
|
593 AC_MSG_RESULT([$octave_cv_must_reinstall_sighandlers assumed for cross compilation]) |
|
594 else |
|
595 AC_MSG_RESULT($octave_cv_must_reinstall_sighandlers) |
|
596 fi |
2491
|
597 if test "$octave_cv_must_reinstall_sighandlers" = yes; then |
3130
|
598 AC_DEFINE(MUST_REINSTALL_SIGHANDLERS) |
2469
|
599 fi |
|
600 ]) |
2626
|
601 dnl |
|
602 dnl This check originally from bash 2.0. |
|
603 dnl |
|
604 dnl Check for typedef'd symbols in header files, but allow the caller to |
|
605 dnl specify the include files to be checked in addition to the default. |
|
606 dnl |
|
607 dnl OCTAVE_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND]) |
|
608 AC_DEFUN(OCTAVE_CHECK_TYPE, |
|
609 [AC_REQUIRE([AC_HEADER_STDC])dnl |
|
610 AC_MSG_CHECKING(for $1) |
|
611 AC_CACHE_VAL(octave_cv_type_$1, |
|
612 [AC_EGREP_CPP($1, [#include <sys/types.h> |
|
613 #if STDC_HEADERS |
|
614 #include <stdlib.h> |
|
615 #endif |
|
616 $2 |
|
617 ], octave_cv_type_$1=yes, octave_cv_type_$1=no)]) |
|
618 AC_MSG_RESULT($octave_cv_type_$1) |
|
619 ifelse($#, 4, [if test $octave_cv_type_$1 = yes; then |
|
620 AC_DEFINE($4) |
|
621 fi]) |
|
622 if test $octave_cv_type_$1 = no; then |
|
623 AC_DEFINE($1, $3) |
|
624 fi |
|
625 ]) |
3107
|
626 dnl |
|
627 dnl Check to see if C++ compiler needs the new friend template declaration |
|
628 dnl syntax. |
|
629 dnl |
|
630 dnl OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL |
|
631 AC_DEFUN(OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL, [ |
|
632 AC_REQUIRE([AC_PROG_CXX]) |
|
633 AC_MSG_CHECKING([for C++ support for new friend template declaration]) |
|
634 AC_CACHE_VAL(octave_cv_cxx_new_friend_template_decl, [ |
|
635 AC_LANG_SAVE |
|
636 AC_LANG_CPLUSPLUS |
|
637 rm -f conftest.h |
|
638 cat > conftest.h <<EOB |
|
639 struct A { |
|
640 friend int operator== (const A&, const A&); |
|
641 A (int) { } |
|
642 }; |
|
643 |
|
644 template <class T> int |
|
645 operator== (const T&, const T&) |
|
646 { |
|
647 return 0; |
|
648 } |
|
649 EOB |
|
650 AC_TRY_LINK([#include "conftest.h"], [ |
|
651 A a (1); |
|
652 return a == A(1); |
|
653 ], |
|
654 octave_cv_cxx_new_friend_template_decl=no, |
|
655 octave_cv_cxx_new_friend_template_decl=yes |
|
656 ) |
|
657 AC_LANG_RESTORE |
|
658 ]) |
|
659 AC_MSG_RESULT($octave_cv_cxx_new_friend_template_decl) |
|
660 if test $octave_cv_cxx_new_friend_template_decl = yes; then |
|
661 AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL) |
|
662 fi |
|
663 ]) |
3126
|
664 dnl |
|
665 dnl Check to see if C compiler handles FLAG command line option and |
|
666 dnl add it to CFLAGS if it does. |
|
667 dnl |
|
668 dnl OCTAVE_CC_FLAG |
|
669 AC_DEFUN(OCTAVE_CC_FLAG, [ |
|
670 ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` |
|
671 AC_MSG_CHECKING(whether ${CC-cc} accepts $1) |
|
672 AC_CACHE_VAL(octave_cv_cc_flag_$ac_safe, [ |
|
673 AC_LANG_SAVE |
|
674 AC_LANG_C |
|
675 XCFLAGS="$CFLAGS" |
|
676 CFLAGS="$CFLAGS $1" |
|
677 AC_TRY_LINK([], [], |
|
678 eval "octave_cv_cc_flag_$ac_safe=yes", |
|
679 eval "octave_cv_cc_flag_$ac_safe=no") |
|
680 CFLAGS="$XCFLAGS" |
|
681 AC_LANG_RESTORE |
|
682 ]) |
|
683 if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then |
|
684 AC_MSG_RESULT(yes) |
|
685 ifelse([$2], , [CFLAGS="$CFLAGS $1"], [$2]) |
|
686 else |
|
687 AC_MSG_RESULT(no) |
|
688 ifelse([$3], , , [$3]) |
|
689 fi |
|
690 ]) |
|
691 dnl |
|
692 dnl Check to see if C++ compiler handles FLAG command line option and |
|
693 dnl add it to CXXFLAGS if it does. |
|
694 dnl |
|
695 dnl OCTAVE_CXX_FLAG |
|
696 AC_DEFUN(OCTAVE_CXX_FLAG, [ |
|
697 ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` |
|
698 AC_MSG_CHECKING(whether ${CXX-c++} accepts $1) |
|
699 AC_CACHE_VAL(octave_cv_cxx_flag_$ac_safe, [ |
|
700 AC_LANG_SAVE |
|
701 AC_LANG_CPLUSPLUS |
|
702 XCXXFLAGS="$CXXFLAGS" |
|
703 CXXFLAGS="$CXXFLAGS $1" |
|
704 AC_TRY_LINK([], [], |
|
705 eval "octave_cv_cxx_flag_$ac_safe=yes", |
|
706 eval "octave_cv_cxx_flag_$ac_safe=no") |
|
707 CXXFLAGS="$XCXXFLAGS" |
|
708 AC_LANG_RESTORE |
|
709 ]) |
|
710 if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then |
|
711 AC_MSG_RESULT(yes) |
|
712 ifelse([$2], , [CXXFLAGS="$CXXFLAGS $1"], [$2]) |
|
713 else |
|
714 AC_MSG_RESULT(no) |
|
715 ifelse([$3], , , [$3]) |
|
716 fi |
|
717 ]) |
3130
|
718 dnl |
|
719 dnl What pager should we use? |
|
720 dnl |
|
721 AC_DEFUN(OCTAVE_PROG_PAGER, |
|
722 [if test "$cross_compiling" = yes; then |
|
723 DEFAULT_PAGER=less |
|
724 AC_MSG_RESULT(assuming $DEFAULT_PAGER exists on $canonical_host_type host) |
|
725 AC_SUBST(DEFAULT_PAGER) |
|
726 else |
|
727 octave_possible_pagers="less more page pg" |
|
728 case "$canonical_host_type" in |
|
729 *-*-cygwin32) |
|
730 octave_possible_pagers="$octave_possible_pagers more.com" |
|
731 ;; |
|
732 esac |
|
733 |
|
734 AC_CHECK_PROGS(DEFAULT_PAGER, $octave_possible_pagers, []) |
|
735 if test -z "$DEFAULT_PAGER"; then |
|
736 warn_less="I couldn't find \`less', \`more', \`page', or \`pg'" |
|
737 AC_MSG_WARN($warn_less) |
|
738 fi |
|
739 fi |
|
740 ]) |
|
741 dnl |
|
742 dnl Does gnuplot exist? Is it a recent version? |
|
743 dnl |
|
744 AC_DEFUN(OCTAVE_PROG_GNUPLOT, |
|
745 [if test "$cross_compiling" = yes; then |
|
746 GNUPLOT_BINARY=gnuplot |
|
747 AC_MSG_RESULT(assuming $GNUPLOT_BINARY exists on $canonical_host_type host) |
|
748 AC_SUBST(DEFAULT_PAGER) |
|
749 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiplot mode) |
|
750 AC_DEFINE(GNUPLOT_HAS_MULTIPLOT, 1) |
|
751 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiple frams) |
|
752 AC_DEFINE(GNUPLOT_HAS_FRAMES, 1) |
|
753 else |
|
754 AC_CHECK_PROG(GNUPLOT_BINARY, gnuplot, gnuplot, []) |
|
755 if test -n "$GNUPLOT_BINARY"; then |
|
756 AC_MSG_CHECKING([to see if your gnuplot supports multiplot]) |
|
757 if test -z "`echo 'set term unknown; set multiplot' | \ |
|
758 $GNUPLOT_BINARY 2>&1`"; then |
|
759 AC_MSG_RESULT([yes]) |
|
760 AC_DEFINE(GNUPLOT_HAS_MULTIPLOT, 1) |
|
761 else |
|
762 AC_MSG_RESULT([no]) |
|
763 fi |
|
764 AC_MSG_CHECKING([to see if your gnuplot supports multiple plot windows]) |
|
765 if test -z "`echo 'set term x11 2' | $GNUPLOT_BINARY 2>&1`"; then |
|
766 AC_MSG_RESULT([yes]) |
|
767 AC_DEFINE(GNUPLOT_HAS_FRAMES, 1) |
|
768 else |
|
769 AC_MSG_RESULT([no]) |
|
770 fi |
|
771 else |
|
772 warn_gnuplot="yes" |
|
773 |
|
774 ## If you change this text, be sure to also copy it to the set of |
|
775 ## warnings at the end of the script |
|
776 |
|
777 AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot]) |
|
778 AC_MSG_WARN([installed, but you won't be able to use any of Octave's]) |
|
779 AC_MSG_WARN([plotting commands without it.]) |
|
780 AC_MSG_WARN([]) |
|
781 AC_MSG_WARN([If gnuplot is installed but it isn't in your path, you can]) |
|
782 AC_MSG_WARN([tell Octave where to find it by typing the command]) |
|
783 AC_MSG_WARN([]) |
|
784 AC_MSG_WARN([gnuplot_binary = "/full/path/to/gnuplot/binary"]) |
|
785 AC_MSG_WARN([]) |
|
786 AC_MSG_WARN([at the Octave prompt.]) |
|
787 fi |
|
788 fi |
|
789 ]) |
|
790 dnl |
|
791 dnl Is DejaGNU installed? |
|
792 dnl |
|
793 AC_DEFUN(OCTAVE_PROG_RUNTEST, |
|
794 [if test "$cross_compiling" = yes; then |
|
795 RUNTEST=runtest |
|
796 AC_MSG_RESULT(assuming $RUNTEST exists on $canonical_host_type host) |
|
797 AC_SUBST(RUNTEST) |
|
798 else |
|
799 AC_CHECK_PROG(RUNTEST, runtest, runtest, []) |
|
800 if test -z "$RUNTEST"; then |
|
801 warn_runtest="I didn't find runtest -- install DejaGNU if you want to run \`make check'" |
|
802 AC_MSG_WARN($warn_runtest) |
|
803 fi |
|
804 AC_SUBST(RUNTEST) |
|
805 fi |
|
806 ]) |