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