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