Mercurial > hg > octave-nkf
annotate aclocal.m4 @ 11951:9cfbc1a1bf0b release-3-0-x
this branch is no longer maintained and is closed for further development
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 22 Jan 2011 00:59:43 -0500 |
parents | bc2ead6b4d6c |
children |
rev | line source |
---|---|
1232 | 1 dnl aclocal.m4 -- extra macros for configuring Octave |
2 dnl | |
7017 | 3 dnl Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
4 dnl 2003, 2004, 2005, 2006, 2007 John W. Eaton | |
1232 | 5 dnl |
6 dnl This file is part of Octave. | |
7 dnl | |
8 dnl Octave is free software; you can redistribute it and/or modify it | |
9 dnl under the terms of the GNU General Public License as published by the | |
7016 | 10 dnl Free Software Foundation; either version 3 of the License, or (at |
11 dnl your option) any later version. | |
1232 | 12 dnl |
13 dnl Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 dnl for more details. | |
17 dnl | |
18 dnl You should have received a copy of the GNU General Public License | |
7016 | 19 dnl along with Octave; see the file COPYING. If not, see |
20 dnl <http://www.gnu.org/licenses/>. | |
2548 | 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 | |
3130 | 48 dnl Check for ar. |
49 dnl | |
50 AC_DEFUN(OCTAVE_PROG_AR, | |
51 [if test -z "$AR"; then | |
52 AR=ar | |
53 fi | |
54 AC_SUBST(AR) | |
55 | |
56 if test -z "$ARFLAGS"; then | |
57 ARFLAGS="rc" | |
58 fi | |
59 AC_SUBST(ARFLAGS) | |
60 ]) | |
61 dnl | |
2574 | 62 dnl See if the standard string class has npos as a member. |
63 dnl | |
64 AC_DEFUN(OCTAVE_STRING_NPOS, | |
65 [AC_CACHE_CHECK([whether including <string> defines NPOS], | |
66 octave_cv_string_npos, | |
3888 | 67 [AC_LANG_PUSH(C++) |
5844 | 68 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string>]], |
69 [[size_t foo = NPOS]])], | |
2574 | 70 octave_cv_string_npos=yes, octave_cv_string_npos=no)]) |
71 if test $octave_cv_string_npos = no; then | |
3887 | 72 AC_DEFINE(NPOS, [std::string::npos], [Define (to string::npos) if <string> doesn't]) |
2574 | 73 fi |
3888 | 74 AC_LANG_POP(C++) |
2574 | 75 ]) |
76 dnl | |
4360 | 77 dnl See if the compiler supports placement delete |
78 dnl | |
79 AC_DEFUN(OCTAVE_PLACEMENT_DELETE, | |
80 [AC_CACHE_CHECK([whether <new> defines placement delete operator], | |
81 octave_cv_placement_delete, | |
82 [AC_LANG_PUSH(C++) | |
5844 | 83 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <new>]], |
84 [[operator delete((void *)0, (void *)0);]])], | |
4360 | 85 octave_cv_placement_delete=yes, octave_cv_placement_delete=no)]) |
86 if test $octave_cv_placement_delete = yes; then | |
87 AC_DEFINE(HAVE_PLACEMENT_DELETE,1,[Define if C++ supports operator delete(void *, void *)]) | |
88 fi | |
89 AC_LANG_POP(C++) | |
90 ]) | |
91 dnl | |
4366 | 92 dnl See if the compiler dynamic auto arrays |
93 dnl | |
94 AC_DEFUN(OCTAVE_DYNAMIC_AUTO_ARRAYS, | |
95 [AC_CACHE_CHECK([whether C++ supports dynamic auto arrays], | |
96 octave_cv_dynamic_auto_arrays, | |
97 [AC_LANG_PUSH(C++) | |
5844 | 98 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], |
99 [[void test(char *); int length(); char x[length()]; test(x);]])], | |
4366 | 100 octave_cv_dynamic_auto_arrays=yes, octave_cv_dynamic_auto_arrays=no)]) |
101 if test $octave_cv_dynamic_auto_arrays = yes; then | |
102 AC_DEFINE(HAVE_DYNAMIC_AUTO_ARRAYS,1,[Define if C++ supports dynamic auto arrays]) | |
103 fi | |
104 AC_LANG_POP(C++) | |
105 ]) | |
106 dnl | |
7058 | 107 dnl Check for broken strptime |
108 dnl | |
109 AC_DEFUN(OCTAVE_STRPTIME_BROKEN, | |
110 [AC_CACHE_CHECK([whether strptime is broken], | |
111 octave_cv_strptime_broken, | |
112 [AC_LANG_PUSH(C) | |
113 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | |
114 #define _XOPEN_SOURCE | |
115 #if defined (HAVE_SYS_TYPES_H) | |
116 #include <sys/types.h> | |
117 #if defined (HAVE_UNISTD_H) | |
118 #include <unistd.h> | |
119 #endif | |
120 #endif | |
121 #include <stdio.h> | |
122 #include <time.h> | |
123 ]], [[ | |
124 struct tm t; | |
125 char *q = strptime ("09/13", "%m/%d/%y", &t); | |
126 return q ? 1 : 0; | |
127 ]])], [octave_cv_strptime_broken=no], [octave_cv_strptime_broken=yes])]) | |
128 if test $octave_cv_strptime_broken = yes; then | |
129 AC_DEFINE(OCTAVE_HAVE_BROKEN_STRPTIME, 1, [Define if strptime is broken on your system]) | |
130 fi | |
131 AC_LANG_POP(C) | |
132 ]) | |
133 dnl | |
1707 | 134 dnl The following test is from Karl Berry's Kpathseach library. I'm |
135 dnl including it here in case we someday want to make the use of | |
136 dnl kpathsea optional. | |
1708 | 137 dnl |
138 dnl Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment. | |
139 dnl This test program is due to Mike Hibler <mike@cs.utah.edu>. | |
140 dnl We don't actually need to run this if we don't have putenv, but it | |
141 dnl doesn't hurt. | |
142 AC_DEFUN(OCTAVE_SMART_PUTENV, | |
143 [AC_MSG_CHECKING(whether putenv uses malloc) | |
1707 | 144 AC_CACHE_VAL(octave_cv_func_putenv_malloc, |
5844 | 145 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
1707 | 146 #define VAR "YOW_VAR" |
147 #define STRING1 "GabbaGabbaHey" | |
148 #define STRING2 "Yow!!" /* should be shorter than STRING1 */ | |
149 extern char *getenv (); /* in case char* and int don't mix gracefully */ | |
150 main () | |
151 { | |
152 char *str1, *rstr1, *str2, *rstr2; | |
153 str1 = getenv (VAR); | |
154 if (str1) | |
155 exit (1); | |
156 str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1); | |
157 if (str1 == 0) | |
158 exit (2); | |
159 strcpy (str1, VAR); | |
160 strcat (str1, "="); | |
161 strcat (str1, STRING1); | |
162 if (putenv (str1) < 0) | |
163 exit (3); | |
164 rstr1 = getenv (VAR); | |
165 if (rstr1 == 0) | |
166 exit (4); | |
167 rstr1 -= strlen (VAR) + 1; | |
168 if (strncmp (rstr1, VAR, strlen (VAR))) | |
169 exit (5); | |
170 str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1); | |
171 if (str2 == 0 || str1 == str2) | |
172 exit (6); | |
173 strcpy (str2, VAR); | |
174 strcat (str2, "="); | |
175 strcat (str2, STRING2); | |
176 if (putenv (str2) < 0) | |
177 exit (7); | |
178 rstr2 = getenv (VAR); | |
179 if (rstr2 == 0) | |
180 exit (8); | |
181 rstr2 -= strlen (VAR) + 1; | |
182 #if 0 | |
183 printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2); | |
184 /* | |
185 * If string from first call was reused for the second call, | |
186 * you had better not do a free on the first string! | |
187 */ | |
188 if (rstr1 == rstr2) | |
189 printf ("#define SMART_PUTENV\n"); | |
190 else | |
191 printf ("#undef SMART_PUTENV\n"); | |
192 #endif | |
193 exit (rstr1 == rstr2 ? 0 : 1); | |
5844 | 194 }]])], octave_cv_func_putenv_malloc=yes, octave_cv_func_putenv_malloc=no, |
1707 | 195 octave_cv_func_putenv_malloc=no)])dnl |
196 AC_MSG_RESULT($octave_cv_func_putenv_malloc) | |
197 if test $octave_cv_func_putenv_malloc = yes; then | |
3887 | 198 AC_DEFINE(SMART_PUTENV,1,[To quiet autoheader.]) |
1708 | 199 fi]) |
1788 | 200 dnl |
2469 | 201 dnl These two checks for signal functions were originally part of the |
202 dnl aclocal.m4 file distributed with bash 2.0. | |
203 dnl | |
204 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) | |
205 AC_DEFUN(OCTAVE_SIGNAL_CHECK, | |
206 [AC_REQUIRE([AC_TYPE_SIGNAL]) | |
207 AC_MSG_CHECKING(for type of signal functions) | |
208 AC_CACHE_VAL(octave_cv_signal_vintage, | |
209 [ | |
5842 | 210 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], |
211 [[sigset_t ss; | |
212 struct sigaction sa; | |
213 sigemptyset (&ss); | |
214 sigsuspend (&ss); | |
215 sigaction (SIGINT, &sa, (struct sigaction *) 0); | |
216 sigprocmask (SIG_BLOCK, &ss, (sigset_t *) 0);]])], | |
217 [octave_cv_signal_vintage=posix], | |
218 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], | |
219 [[int mask = sigmask (SIGINT); | |
220 sigsetmask (mask); | |
221 sigblock (mask); | |
222 sigpause (mask);]])], | |
223 [octave_cv_signal_vintage=4.2bsd], | |
224 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h> | |
5844 | 225 RETSIGTYPE foo() { }]], |
5842 | 226 [[int mask = sigmask (SIGINT); |
227 sigset (SIGINT, foo); | |
228 sigrelse (SIGINT); | |
229 sighold (SIGINT); | |
5844 | 230 sigpause (SIGINT);]])], |
5842 | 231 [octave_cv_signal_vintage=svr3], |
232 [octave_cv_signal_vintage=v7])])])]) | |
2469 | 233 AC_MSG_RESULT($octave_cv_signal_vintage) |
2491 | 234 if test "$octave_cv_signal_vintage" = posix; then |
5842 | 235 AC_DEFINE(HAVE_POSIX_SIGNALS, 1, [Define if you have POSIX style signals.]) |
2491 | 236 elif test "$octave_cv_signal_vintage" = "4.2bsd"; then |
5842 | 237 AC_DEFINE(HAVE_BSD_SIGNALS, 1, [Define if you have BSD style signals.]) |
2491 | 238 elif test "$octave_cv_signal_vintage" = svr3; then |
5842 | 239 AC_DEFINE(HAVE_USG_SIGHOLD, 1, [Define if you have System V Release 3 signals.]) |
2469 | 240 fi |
241 ]) | |
242 dnl | |
243 AC_DEFUN(OCTAVE_REINSTALL_SIGHANDLERS, | |
244 [AC_REQUIRE([AC_TYPE_SIGNAL]) | |
245 AC_REQUIRE([OCTAVE_SIGNAL_CHECK]) | |
246 AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked]) | |
247 AC_CACHE_VAL(octave_cv_must_reinstall_sighandlers, | |
5844 | 248 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
2469 | 249 #include <signal.h> |
250 #ifdef HAVE_UNISTD_H | |
251 #include <unistd.h> | |
252 #endif | |
253 typedef RETSIGTYPE sigfunc(); | |
254 int nsigint; | |
255 #ifdef HAVE_POSIX_SIGNALS | |
256 sigfunc * | |
257 set_signal_handler(sig, handler) | |
258 int sig; | |
259 sigfunc *handler; | |
260 { | |
261 struct sigaction act, oact; | |
262 act.sa_handler = handler; | |
263 act.sa_flags = 0; | |
264 sigemptyset (&act.sa_mask); | |
265 sigemptyset (&oact.sa_mask); | |
266 sigaction (sig, &act, &oact); | |
267 return (oact.sa_handler); | |
268 } | |
269 #else | |
270 #define set_signal_handler(s, h) signal(s, h) | |
271 #endif | |
272 RETSIGTYPE | |
273 sigint(s) | |
274 int s; | |
275 { | |
276 nsigint++; | |
277 } | |
278 main() | |
279 { | |
280 nsigint = 0; | |
281 set_signal_handler(SIGINT, sigint); | |
282 kill((int)getpid(), SIGINT); | |
283 kill((int)getpid(), SIGINT); | |
284 exit(nsigint != 2); | |
285 } | |
5844 | 286 ]])], |
287 octave_cv_must_reinstall_sighandlers=no, | |
288 octave_cv_must_reinstall_sighandlers=yes, | |
3130 | 289 if test "$octave_cv_signal_vintage" = svr3; then |
290 octave_cv_must_reinstall_sighandlers=yes | |
291 else | |
292 octave_cv_must_reinstall_sighandlers=no | |
293 fi)]) | |
294 if test "$cross_compiling" = yes; then | |
295 AC_MSG_RESULT([$octave_cv_must_reinstall_sighandlers assumed for cross compilation]) | |
296 else | |
297 AC_MSG_RESULT($octave_cv_must_reinstall_sighandlers) | |
298 fi | |
2491 | 299 if test "$octave_cv_must_reinstall_sighandlers" = yes; then |
3887 | 300 AC_DEFINE(MUST_REINSTALL_SIGHANDLERS,1,[Define if signal handlers must be reinstalled after they are called.]) |
2469 | 301 fi |
302 ]) | |
2626 | 303 dnl |
3107 | 304 dnl Check to see if C++ compiler needs the new friend template declaration |
305 dnl syntax. | |
306 dnl | |
307 dnl OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL | |
308 AC_DEFUN(OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL, [ | |
309 AC_REQUIRE([AC_PROG_CXX]) | |
310 AC_MSG_CHECKING([for C++ support for new friend template declaration]) | |
311 AC_CACHE_VAL(octave_cv_cxx_new_friend_template_decl, [ | |
3888 | 312 AC_LANG_PUSH(C++) |
3107 | 313 rm -f conftest.h |
314 cat > conftest.h <<EOB | |
315 struct A { | |
316 friend int operator== (const A&, const A&); | |
317 A (int) { } | |
318 }; | |
319 | |
320 template <class T> int | |
321 operator== (const T&, const T&) | |
322 { | |
323 return 0; | |
324 } | |
325 EOB | |
5842 | 326 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "conftest.h"]], |
327 [[A a (1); | |
328 return a == A(1);]])], | |
329 [octave_cv_cxx_new_friend_template_decl=no], | |
330 [octave_cv_cxx_new_friend_template_decl=yes]) | |
3888 | 331 AC_LANG_POP(C++) |
3107 | 332 ]) |
333 AC_MSG_RESULT($octave_cv_cxx_new_friend_template_decl) | |
334 if test $octave_cv_cxx_new_friend_template_decl = yes; then | |
3887 | 335 AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL,1,[Define if your compiler supports `<>' stuff for template friends.]) |
3107 | 336 fi |
337 ]) | |
3126 | 338 dnl |
3233 | 339 dnl Check to see if C compiler handles FLAG command line option. If |
340 dnl two arguments are specified, execute the second arg as shell | |
341 dnl commands. Otherwise, add FLAG to CFLAGS if the compiler accepts | |
342 dnl the flag. | |
3126 | 343 dnl |
344 dnl OCTAVE_CC_FLAG | |
345 AC_DEFUN(OCTAVE_CC_FLAG, [ | |
3908 | 346 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` |
3126 | 347 AC_MSG_CHECKING(whether ${CC-cc} accepts $1) |
348 AC_CACHE_VAL(octave_cv_cc_flag_$ac_safe, [ | |
3888 | 349 AC_LANG_PUSH(C) |
3126 | 350 XCFLAGS="$CFLAGS" |
351 CFLAGS="$CFLAGS $1" | |
5177 | 352 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], |
3126 | 353 eval "octave_cv_cc_flag_$ac_safe=yes", |
354 eval "octave_cv_cc_flag_$ac_safe=no") | |
355 CFLAGS="$XCFLAGS" | |
3888 | 356 AC_LANG_POP(C) |
3126 | 357 ]) |
358 if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then | |
359 AC_MSG_RESULT(yes) | |
3131 | 360 ifelse([$2], , [ |
361 CFLAGS="$CFLAGS $1" | |
362 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2]) | |
3126 | 363 else |
364 AC_MSG_RESULT(no) | |
365 ifelse([$3], , , [$3]) | |
366 fi | |
367 ]) | |
368 dnl | |
3233 | 369 dnl Check to see if C++ compiler handles FLAG command line option. If |
370 dnl two arguments are specified, execute the second arg as shell | |
371 dnl commands. Otherwise, add FLAG to CXXFLAGS if the compiler accepts | |
372 dnl the flag. | |
3126 | 373 dnl |
374 dnl OCTAVE_CXX_FLAG | |
375 AC_DEFUN(OCTAVE_CXX_FLAG, [ | |
3908 | 376 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` |
3222 | 377 AC_MSG_CHECKING(whether ${CXX-g++} accepts $1) |
3126 | 378 AC_CACHE_VAL(octave_cv_cxx_flag_$ac_safe, [ |
3888 | 379 AC_LANG_PUSH(C++) |
3126 | 380 XCXXFLAGS="$CXXFLAGS" |
381 CXXFLAGS="$CXXFLAGS $1" | |
5177 | 382 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], |
3126 | 383 eval "octave_cv_cxx_flag_$ac_safe=yes", |
384 eval "octave_cv_cxx_flag_$ac_safe=no") | |
385 CXXFLAGS="$XCXXFLAGS" | |
3888 | 386 AC_LANG_POP(C++) |
3126 | 387 ]) |
388 if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then | |
389 AC_MSG_RESULT(yes) | |
3131 | 390 ifelse([$2], , [ |
391 CXXFLAGS="$CXXFLAGS $1" | |
392 AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2]) | |
3126 | 393 else |
394 AC_MSG_RESULT(no) | |
395 ifelse([$3], , , [$3]) | |
396 fi | |
397 ]) | |
3130 | 398 dnl |
5076 | 399 dnl Check to see if Fortran compiler handles FLAG command line option. If |
400 dnl two arguments are specified, execute the second arg as shell | |
401 dnl commands. Otherwise, add FLAG to FFLAGS if the compiler accepts | |
402 dnl the flag. | |
403 dnl | |
404 dnl OCTAVE_F77_FLAG | |
405 AC_DEFUN(OCTAVE_F77_FLAG, [ | |
406 ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'` | |
407 AC_MSG_CHECKING(whether ${F77-g77} accepts $1) | |
408 AC_CACHE_VAL(octave_cv_f77_flag_$ac_safe, [ | |
409 AC_LANG_PUSH(Fortran 77) | |
410 XFFLAGS="$FFLAGS" | |
411 FFLAGS="$FFLAGS $1" | |
5177 | 412 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], |
5076 | 413 eval "octave_cv_f77_flag_$ac_safe=yes", |
414 eval "octave_cv_f77_flag_$ac_safe=no") | |
415 FFLAGS="$XFFLAGS" | |
416 AC_LANG_POP(Fortran 77) | |
417 ]) | |
418 if eval "test \"`echo '$octave_cv_f77_flag_'$ac_safe`\" = yes"; then | |
419 AC_MSG_RESULT(yes) | |
420 ifelse([$2], , [ | |
421 FFLAGS="$FFLAGS $1" | |
422 AC_MSG_RESULT([adding $1 to FFLAGS])], [$2]) | |
423 else | |
424 AC_MSG_RESULT(no) | |
425 ifelse([$3], , , [$3]) | |
426 fi | |
427 ]) | |
428 dnl | |
3729 | 429 dnl Check for flex |
430 dnl | |
431 AC_DEFUN(OCTAVE_PROG_FLEX, [ | |
432 ### For now, don't define LEXLIB to be -lfl -- we don't use anything in | |
433 ### it, and it might not be installed. | |
434 ### | |
435 ### Also make sure that we generate an interactive scanner if we are | |
436 ### using flex. | |
437 AC_PROG_LEX | |
438 case "$LEX" in | |
439 flex*) | |
440 LFLAGS="-t -I" | |
441 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) | |
442 LEXLIB= | |
443 ;; | |
444 *) | |
445 LEX='$(top_srcdir)/missing flex' | |
446 warn_flex="I didn't find flex, but it's only a problem if you need to reconstruct lex.cc" | |
447 AC_MSG_WARN($warn_flex) | |
448 ;; | |
449 esac | |
450 AC_SUBST(LFLAGS) | |
451 ]) | |
452 dnl | |
453 dnl Check for bison | |
454 dnl | |
455 AC_DEFUN(OCTAVE_PROG_BISON, [ | |
456 AC_PROG_YACC | |
457 case "$YACC" in | |
458 bison*) | |
459 ;; | |
460 *) | |
461 YACC='$(top_srcdir)/missing bison' | |
462 warn_bison="I didn't find bison, but it's only a problem if you need to reconstruct parse.cc" | |
463 AC_MSG_WARN($warn_bison) | |
464 ;; | |
465 esac | |
466 ]) | |
467 dnl | |
3130 | 468 dnl What pager should we use? |
469 dnl | |
470 AC_DEFUN(OCTAVE_PROG_PAGER, | |
471 [if test "$cross_compiling" = yes; then | |
472 DEFAULT_PAGER=less | |
473 AC_MSG_RESULT(assuming $DEFAULT_PAGER exists on $canonical_host_type host) | |
474 AC_SUBST(DEFAULT_PAGER) | |
475 else | |
476 octave_possible_pagers="less more page pg" | |
477 case "$canonical_host_type" in | |
6103 | 478 *-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc) |
3130 | 479 octave_possible_pagers="$octave_possible_pagers more.com" |
480 ;; | |
481 esac | |
482 | |
483 AC_CHECK_PROGS(DEFAULT_PAGER, $octave_possible_pagers, []) | |
484 if test -z "$DEFAULT_PAGER"; then | |
485 warn_less="I couldn't find \`less', \`more', \`page', or \`pg'" | |
486 AC_MSG_WARN($warn_less) | |
487 fi | |
488 fi | |
489 ]) | |
490 dnl | |
6821 | 491 dnl Does gnuplot exist? |
3130 | 492 dnl |
4098 | 493 AC_DEFUN(OCTAVE_PROG_GNUPLOT, [ |
494 case "$canonical_host_type" in | |
6103 | 495 *-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc) |
4098 | 496 gp_names="pgnuplot pipe-gnuplot gnuplot" |
497 gp_default=pgnuplot | |
498 ;; | |
499 *) | |
500 gp_names=gnuplot | |
501 gp_default=gnuplot | |
502 ;; | |
503 esac | |
504 if test "$cross_compiling" = yes; then | |
3130 | 505 AC_MSG_RESULT(assuming $GNUPLOT_BINARY exists on $canonical_host_type host) |
506 else | |
4098 | 507 AC_CHECK_PROGS(GNUPLOT_BINARY, $gp_names) |
6821 | 508 if test -z "$GNUPLOT_BINARY"; then |
5513 | 509 warn_gnuplot=yes |
3130 | 510 |
5076 | 511 GNUPLOT_BINARY="$gp_default" |
512 | |
3130 | 513 ## If you change this text, be sure to also copy it to the set of |
514 ## warnings at the end of the script | |
515 | |
516 AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot]) | |
517 AC_MSG_WARN([installed, but you won't be able to use any of Octave's]) | |
518 AC_MSG_WARN([plotting commands without it.]) | |
519 AC_MSG_WARN([]) | |
520 AC_MSG_WARN([If gnuplot is installed but it isn't in your path, you can]) | |
521 AC_MSG_WARN([tell Octave where to find it by typing the command]) | |
522 AC_MSG_WARN([]) | |
523 AC_MSG_WARN([gnuplot_binary = "/full/path/to/gnuplot/binary"]) | |
524 AC_MSG_WARN([]) | |
525 AC_MSG_WARN([at the Octave prompt.]) | |
5076 | 526 AC_MSG_WARN([]) |
527 AC_MSG_WARN([Setting default value to $GNUPLOT_BINARY]) | |
3130 | 528 fi |
529 fi | |
4098 | 530 AC_DEFINE_UNQUOTED(GNUPLOT_BINARY, "$GNUPLOT_BINARY", [Name of gnuplot program.]) |
3130 | 531 ]) |
532 dnl | |
3673 | 533 dnl Is gperf installed? |
534 dnl | |
535 dnl OCTAVE_PROG_GPERF | |
3731 | 536 AC_DEFUN(OCTAVE_PROG_GPERF, [ |
6119 | 537 AC_CHECK_PROG(GPERF, gperf, gperf, []) |
3731 | 538 if test -n "$GPERF"; then |
539 if echo "%{ | |
4416 | 540 enum octave_kw_id { a_kw }; |
3731 | 541 %} |
4416 | 542 struct octave_kw { const char *name; int tok; octave_kw_id kw_id; }; |
3731 | 543 %% |
5094 | 544 foo" | $GPERF -t -C -D -E -G -L C++ -H octave_kw_hash -N octave_kw_lookup > /dev/null 2>&1; then |
3731 | 545 true |
546 else | |
547 GPERF="" | |
5094 | 548 warn_gperf="I found gperf, but it does not support all of the following options: -t -C -D -E -G -L C++ -H -N; you need gperf 3.0.1 or a more recent version" |
3731 | 549 AC_MSG_WARN($warn_gperf) |
550 fi | |
551 else | |
552 GPERF='$(top_srcdir)/missing gperf' | |
553 warn_gperf="I didn't find gperf, but it's only a problem if you need to reconstruct oct-gperf.h" | |
554 AC_MSG_WARN($warn_gperf) | |
555 fi | |
556 AC_SUBST(GPERF) | |
3673 | 557 ]) |
558 dnl | |
5934 | 559 dnl Is ghostscript installed? |
560 dnl | |
561 dnl OCTAVE_PROG_GHOSTSCRIPT | |
562 AC_DEFUN(OCTAVE_PROG_GHOSTSCRIPT, [ | |
6116 | 563 case "$canonical_host_type" in |
564 *-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc) | |
565 gs_names="gs gswin32" | |
566 ;; | |
567 *) | |
568 gs_names=gs | |
569 ;; | |
570 esac | |
571 AC_CHECK_PROGS(GHOSTSCRIPT, $gs_names) | |
5934 | 572 if test -z "$GHOSTSCRIPT"; then |
573 GHOSTSCRIPT='$(top_srcdir)/missing gs' | |
574 warn_ghostscript="I didn't find ghostscript, but it's only a problem if you need to reconstruct figures for the manual" | |
575 AC_MSG_WARN($warn_ghostscript) | |
576 fi | |
577 AC_SUBST(GHOSTSCRIPT) | |
578 ]) | |
579 dnl | |
580 dnl Is makeinfo installed? | |
581 dnl | |
582 dnl OCTAVE_PROG_MAKEINFO | |
583 AC_DEFUN(OCTAVE_PROG_MAKEINFO, [ | |
6119 | 584 AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, []) |
5934 | 585 if test -z "$MAKEINFO"; then |
586 MAKEINFO='$(top_srcdir)/missing makeinfo' | |
587 warn_makeinfo="I didn't find makeinfo, but it's only a problem if you need to reconstruct the Info version of the manual" | |
588 AC_MSG_WARN($warn_makeinfo) | |
589 fi | |
590 AC_SUBST(MAKEINFO) | |
591 ]) | |
592 dnl | |
593 dnl Is texi2dvi installed? | |
594 dnl | |
595 dnl OCTAVE_PROG_TEXI2DVI | |
596 AC_DEFUN(OCTAVE_PROG_TEXI2DVI, [ | |
6119 | 597 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, []) |
5934 | 598 if test -z "$TEXI2DVI"; then |
599 TEXI2DVI='$(top_srcdir)/missing texi2dvi' | |
600 warn_texi2dvi="I didn't find texi2dvi, but it's only a problem if you need to reconstruct the DVI version of the manual" | |
601 AC_MSG_WARN($warn_texi2dvi) | |
602 fi | |
603 AC_SUBST(TEXI2DVI) | |
604 ]) | |
605 dnl | |
606 dnl Is texi2pdf installed? | |
607 dnl | |
608 dnl OCTAVE_PROG_TEXI2PDF | |
609 AC_DEFUN(OCTAVE_PROG_TEXI2PDF, [ | |
6116 | 610 AC_REQUIRE([OCTAVE_PROG_TEXI2DVI]) |
6119 | 611 AC_CHECK_PROG(TEXI2PDF, texi2pdf, texi2pdf, []) |
5934 | 612 if test -z "$TEXI2PDF"; then |
6116 | 613 missing=true; |
614 if test -n "$TEXI2DVI"; then | |
615 TEXI2PDF="$TEXI2DVI --pdf" | |
616 missing=false; | |
617 fi | |
618 else | |
619 missing=false; | |
620 fi | |
621 if $missing; then | |
5934 | 622 TEXI2PDF='$(top_srcdir)/missing texi2pdf' |
623 warn_texi2pdf="I didn't find texi2pdf, but it's only a problem if you need to reconstruct the PDF version of the manual" | |
624 AC_MSG_WARN($warn_texi2pdf) | |
625 fi | |
626 AC_SUBST(TEXI2PDF) | |
627 ]) | |
628 dnl | |
3222 | 629 dnl Find nm. |
630 dnl | |
631 dnl OCTAVE_PROG_NM | |
632 AC_DEFUN(OCTAVE_PROG_NM, | |
4093 | 633 [AC_CHECK_PROG(NM, ${ac_tool_prefix}nm, ${ac_tool_prefix}nm, []) |
3222 | 634 AC_SUBST(NM) |
635 ]) | |
636 dnl | |
637 dnl See if the C++ compiler prepends an underscore to external names. | |
638 dnl | |
639 dnl OCTAVE_CXX_PREPENDS_UNDERSCORE | |
4093 | 640 AC_DEFUN(OCTAVE_CXX_PREPENDS_UNDERSCORE, [ |
641 AC_REQUIRE([OCTAVE_PROG_NM]) | |
642 AC_MSG_CHECKING([whether ${CXX-g++} prepends an underscore to external names]) | |
3222 | 643 AC_CACHE_VAL(octave_cv_cxx_prepends_underscore, |
644 [octave_cv_cxx_prepends_underscore=no | |
3888 | 645 AC_LANG_PUSH(C++) |
3222 | 646 cat > conftest.$ac_ext <<EOF |
3842 | 647 bool FSmy_dld_fcn (void) { return false; } |
3222 | 648 EOF |
7061 | 649 if (eval "$ac_compile") 2>&AS_MESSAGE_LOG_FD; then |
6057 | 650 if test "`${NM-nm} conftest.$ac_objext | grep _FSmy_dld_fcn`" != ""; then |
3222 | 651 octave_cv_cxx_prepends_underscore=yes |
652 fi | |
653 else | |
3888 | 654 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
655 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD | |
3222 | 656 fi |
3888 | 657 AC_LANG_POP(C++) |
5775 | 658 ### FIXME -- Ignore test result on Windows. Yes it prepends |
4105 | 659 ### underscore, but LoadLibrary ignores it automatically. The |
4102 | 660 ### correct test is to build the shared library then try to grab the |
661 ### symbol from it with and without underscore. | |
662 case "$canonical_host_type" in | |
4105 | 663 *-*-cygwin* | *-*-mingw*) |
4102 | 664 octave_cv_cxx_prepends_underscore=no |
665 ;; | |
5775 | 666 ### FIXME -- Ignore test result on OS X. Yes it prepends |
4162 | 667 ### underscore, but also messes with the name so test fails (incorrectly). |
4685 | 668 *-*-darwin*) |
4162 | 669 octave_cv_cxx_prepends_underscore=yes |
670 ;; | |
4102 | 671 esac |
3222 | 672 ]) |
673 AC_MSG_RESULT($octave_cv_cxx_prepends_underscore) | |
674 if test $octave_cv_cxx_prepends_underscore = yes; then | |
3887 | 675 AC_DEFINE(CXX_PREPENDS_UNDERSCORE, 1, [Define if your compiler prepends underscores to external names.]) |
3222 | 676 fi |
677 ]) | |
3769 | 678 dnl |
679 dnl See if the C++ library is ISO compliant. | |
680 dnl FIXME: This is obviously very simplistic, and trivially fooled. | |
681 dnl | |
682 dnl OCTAVE_CXX_ISO_COMPLIANT_LIBRARY | |
683 AC_DEFUN(OCTAVE_CXX_ISO_COMPLIANT_LIBRARY, [ | |
684 AC_REQUIRE([AC_PROG_CXX]) | |
685 AC_MSG_CHECKING([if C++ library is ISO compliant]) | |
686 AC_CACHE_VAL(octave_cv_cxx_iso_compliant_library, [ | |
3888 | 687 AC_LANG_PUSH(C++) |
3769 | 688 rm -f conftest.h |
3943 | 689 ### Omitting cwctype for now, since it is broken with gcc-3.0.x and |
690 ### possibly other versions... | |
3769 | 691 for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \ |
692 climits clocale cmath complex csetjmp csignal cstdarg cstddef \ | |
3943 | 693 cstdio cstdlib cstring ctime cwchar deque exception \ |
3769 | 694 fstream functional iomanip ios iosfwd iostream istream iterator \ |
695 limits list locale map memory new numeric ostream queue set \ | |
696 sstream stack stdexcept streambuf string strstream typeinfo \ | |
697 utility valarray vector; do | |
698 echo "#include <$inc>" >> conftest.h | |
699 done | |
5842 | 700 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "conftest.h"]], |
701 [[std::bitset<50> flags; | |
3769 | 702 flags.set(); |
703 int digits = std::numeric_limits<unsigned long>::digits; | |
5842 | 704 digits = 0;]])], |
705 [octave_cv_cxx_iso_compliant_library=yes], | |
706 [octave_cv_cxx_iso_compliant_library=no]) | |
3888 | 707 AC_LANG_POP(C++) |
3769 | 708 ]) |
709 AC_MSG_RESULT($octave_cv_cxx_iso_compliant_library) | |
710 if test $octave_cv_cxx_iso_compliant_library = yes; then | |
3887 | 711 AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, [Define if your C++ runtime library is ISO compliant.]) |
3769 | 712 fi |
713 ]) | |
3822 | 714 dnl |
715 dnl Allow the user disable support for command line editing using GNU | |
716 dnl readline. | |
717 dnl | |
718 dnl OCTAVE_ENABLE_READLINE | |
719 AC_DEFUN(OCTAVE_ENABLE_READLINE, [ | |
720 USE_READLINE=true | |
4102 | 721 LIBREADLINE= |
3822 | 722 AC_ARG_ENABLE(readline, |
723 [ --enable-readline use readline library (default is yes)], | |
724 [if test "$enableval" = no; then | |
3824 | 725 USE_READLINE=false |
3825 | 726 warn_readline="command editing and history features require GNU Readline" |
3824 | 727 fi]) |
3822 | 728 if $USE_READLINE; then |
729 AC_CHECK_LIB(readline, rl_set_keyboard_input_timeout, [ | |
4102 | 730 LIBREADLINE="-lreadline" |
731 LIBS="$LIBREADLINE $LIBS" | |
3887 | 732 AC_DEFINE(USE_READLINE, 1, [Define to use the readline library.]) |
3822 | 733 ], [ |
3824 | 734 AC_MSG_WARN([I need GNU Readline 4.2 or later]) |
735 AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) | |
3822 | 736 ]) |
737 fi | |
4102 | 738 AC_SUBST(LIBREADLINE) |
3822 | 739 ]) |
3842 | 740 dnl |
741 dnl Determine the C++ compiler ABI. It sets the macro CXX_ABI to the | |
742 dnl name of the ABI, and is used to mangle the C linkage loadable | |
743 dnl functions to avoid ABI mismatch. GNU C++ currently uses gnu_v2 | |
744 dnl (GCC versions <= 2.95.x) dnl or gnu_v3 (GCC versions >= 3.0). | |
745 dnl Set to "unknown" is when we don't know enough about the ABI, which | |
746 dnl will happen when using an unsupported C++ compiler. | |
747 dnl | |
748 dnl OCTAVE_CXX_ABI | |
4093 | 749 AC_DEFUN(OCTAVE_CXX_ABI, [ |
750 AC_REQUIRE([OCTAVE_PROG_NM]) | |
751 AC_MSG_CHECKING([C++ ABI version used by ${CXX}]) | |
3842 | 752 AC_CACHE_VAL(octave_cv_cxx_abi, |
753 [octave_cv_cxx_abi='unknown' | |
3888 | 754 AC_LANG_PUSH(C++) |
3842 | 755 cat > conftest.$ac_ext <<EOF |
756 bool FSmy_dld_fcn (void) { return false; } | |
757 EOF | |
7061 | 758 if (eval "$ac_compile") 2>&AS_MESSAGE_LOG_FD; then |
6057 | 759 if test "`${NM-nm} conftest.$ac_objext | grep FSmy_dld_fcn__Fv`" != ""; then |
3842 | 760 octave_cv_cxx_abi='gnu_v2' |
761 fi | |
6057 | 762 if test "`${NM-nm} conftest.$ac_objext | grep _Z12FSmy_dld_fcnv`" != ""; then |
3842 | 763 octave_cv_cxx_abi='gnu_v3' |
764 fi | |
6057 | 765 if test "`${NM-nm} conftest.$ac_objext | grep __1cMFSmy_dld_fcn6F_b_`" != ""; then |
3843 | 766 octave_cv_cxx_abi='sun_v5' |
3842 | 767 fi |
768 else | |
3888 | 769 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD |
770 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD | |
3842 | 771 fi |
3888 | 772 AC_LANG_POP(C++) |
3842 | 773 ]) |
774 AC_MSG_RESULT($octave_cv_cxx_abi) | |
3887 | 775 AC_DEFINE_UNQUOTED(CXX_ABI, $octave_cv_cxx_abi, [Define to the C++ ABI your compiler uses.]) |
3842 | 776 ]) |
4067 | 777 dnl |
5854 | 778 dnl Check to see if C++ reintrepret cast works for function pointers. |
779 dnl | |
780 dnl OCTAVE_CXX_BROKEN_REINTERPRET_CAST | |
781 dnl | |
782 AC_DEFUN(OCTAVE_CXX_BROKEN_REINTERPRET_CAST, [ | |
783 AC_REQUIRE([AC_PROG_CXX]) | |
784 AC_LANG_PUSH(C++) | |
785 AC_CACHE_CHECK([for broken C++ reinterpret_cast], | |
786 octave_cv_cxx_broken_reinterpret_cast, [ | |
787 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <cmath>]], [[ | |
788 typedef double (*fptr) (double); | |
789 fptr psin = sin; | |
790 void *vptr = reinterpret_cast<void *> (psin); | |
791 psin = reinterpret_cast<fptr> (vptr);]])], | |
792 octave_cv_cxx_broken_reinterpret_cast=no, | |
793 octave_cv_cxx_broken_reinterpret_cast=yes)]) | |
794 if test $octave_cv_cxx_broken_reinterpret_cast = yes ; then | |
795 AC_DEFINE(CXX_BROKEN_REINTERPRET_CAST, 1, [Define if C++ reinterpret_cast fails for function pointers.]) | |
796 fi | |
797 AC_LANG_POP(C++)]) | |
798 dnl | |
4067 | 799 dnl Determine if mkdir accepts only one argument instead dnl of the usual 2. |
800 dnl | |
6104 | 801 AC_DEFUN(OCTAVE_MKDIR_TAKES_ONE_ARG, [ |
802 AC_LANG_PUSH(C++) | |
803 AC_CACHE_CHECK([if mkdir takes one argument], octave_cv_mkdir_takes_one_arg, | |
5844 | 804 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
4067 | 805 #ifdef HAVE_SYS_STAT_H |
806 # include <sys/stat.h> | |
807 #endif | |
808 #ifdef HAVE_UNISTD_H | |
809 # include <unistd.h> | |
810 #endif | |
811 #ifdef HAVE_DIRECT_H | |
812 # include <direct.h> | |
5844 | 813 #endif]], [[mkdir ("foo", 0);]])], |
4067 | 814 octave_cv_mkdir_takes_one_arg=no, octave_cv_mkdir_takes_one_arg=yes)]) |
6104 | 815 AC_LANG_POP(C++) |
4067 | 816 if test $octave_cv_mkdir_takes_one_arg = yes ; then |
817 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.]) | |
818 fi | |
819 ]) | |
7244 | 820 dnl |
821 dnl Find find. | |
822 dnl | |
823 # Prefer GNU find if found. | |
824 AN_MAKEVAR([FIND], [OCTAVE_PROG_FIND]) | |
825 AN_PROGRAM([gfind], [OCTAVE_PROG_FIND]) | |
826 AN_PROGRAM([find], [OCTAVE_PROG_FIND]) | |
827 AC_DEFUN([OCTAVE_PROG_FIND], | |
828 [AC_CHECK_PROGS(FIND, gfind find, )]) | |
829 dnl | |
830 dnl Find sed. | |
831 dnl | |
4084 | 832 # Check for a fully-functional sed program, that truncates |
6955 | 833 # as few characters as possible and that supports "\(X\|Y\)" |
834 # style regular expression alternation. Prefer GNU sed if found. | |
4084 | 835 AC_DEFUN([OCTAVE_PROG_SED], |
6955 | 836 [AC_MSG_CHECKING([for a usable sed]) |
4084 | 837 if test -z "$SED"; then |
6822 | 838 AC_CACHE_VAL(ac_cv_path_sed, [ |
839 # Loop through the user's path and test for sed and gsed. | |
840 # Then use that list of sed's as ones to test for truncation. | |
841 _AS_PATH_WALK([$PATH], | |
842 [for ac_prog in sed gsed; do | |
843 for ac_exec_ext in '' $ac_executable_extensions; do | |
844 if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then | |
845 _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" | |
846 fi | |
847 done | |
4084 | 848 done |
6822 | 849 ]) |
850 AS_TMPDIR(sed) | |
851 _max=0 | |
4084 | 852 _count=0 |
6822 | 853 # Add /usr/xpg4/bin/sed as it is typically found on Solaris |
854 # along with /bin/sed that truncates output. | |
855 for _sed in $_sed_list /usr/xpg4/bin/sed; do | |
856 test ! -f ${_sed} && break | |
857 cat /dev/null > "$tmp/sed.in" | |
858 _count=0 | |
859 echo $ECHO_N "0123456789$ECHO_C" >"$tmp/sed.in" | |
860 # Check for GNU sed and select it if it is found. | |
861 if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then | |
862 octave_cv_path_sed=${_sed} | |
863 break; | |
4084 | 864 fi |
6955 | 865 # Reject if RE alternation is not handled. |
866 if test "`echo 'this and that' | ${_sed} -n 's/\(this\|that\).*$/\1/p'`" != "this"; then | |
867 continue; | |
868 fi | |
6822 | 869 while true; do |
870 cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" | |
871 mv "$tmp/sed.tmp" "$tmp/sed.in" | |
872 cp "$tmp/sed.in" "$tmp/sed.nl" | |
873 echo >>"$tmp/sed.nl" | |
874 ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break | |
875 cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break | |
876 # 10000 chars as input seems more than enough | |
877 test $_count -gt 10 && break | |
878 _count=`expr $_count + 1` | |
879 if test $_count -gt $_max; then | |
880 _max=$_count | |
881 octave_cv_path_sed=$_sed | |
882 fi | |
883 done | |
4084 | 884 done |
6822 | 885 rm -rf "$tmp" |
886 ]) | |
887 SED=$octave_cv_path_sed | |
11798
bc2ead6b4d6c
aclocal.m4 (OCTAVE_PROG_SED): fail if no usable sed is found
John W. Eaton <jwe@octave.org>
parents:
7244
diff
changeset
|
888 if test -z "$SED"; then |
bc2ead6b4d6c
aclocal.m4 (OCTAVE_PROG_SED): fail if no usable sed is found
John W. Eaton <jwe@octave.org>
parents:
7244
diff
changeset
|
889 AC_MSG_ERROR([no usable version of sed found]) |
bc2ead6b4d6c
aclocal.m4 (OCTAVE_PROG_SED): fail if no usable sed is found
John W. Eaton <jwe@octave.org>
parents:
7244
diff
changeset
|
890 fi |
4084 | 891 fi |
6822 | 892 AC_SUBST(SED) |
4084 | 893 AC_MSG_RESULT([$SED]) |
894 ]) | |
5465 | 895 dnl |
896 dnl Find Perl. | |
897 dnl | |
898 dnl OCTAVE_PROG_PERL | |
899 AC_DEFUN(OCTAVE_PROG_PERL, | |
6119 | 900 [AC_CHECK_PROG(PERL, perl, perl, []) |
5465 | 901 AC_SUBST(PERL) |
902 ]) | |
5468 | 903 dnl |
5495 | 904 dnl Find Python. |
905 dnl | |
906 dnl OCTAVE_PROG_PYTHON | |
907 AC_DEFUN(OCTAVE_PROG_PYTHON, | |
6119 | 908 [AC_CHECK_PROG(PYTHON, python, python, []) |
5495 | 909 AC_SUBST(PYTHON) |
910 ]) | |
911 dnl | |
5468 | 912 dnl Find desktop-file-install. |
913 dnl | |
914 dnl OCTAVE_PROG_DESKTOP_FILE_INSTALL | |
915 AC_DEFUN(OCTAVE_PROG_DESKTOP_FILE_INSTALL, | |
6119 | 916 [AC_CHECK_PROG(DESKTOP_FILE_INSTALL, desktop-file-install, desktop-file-install, []) |
5468 | 917 AC_SUBST(DESKTOP_FILE_INSTALL) |
918 ]) | |
919 dnl | |
920 dnl Check for IEEE 754 data format. | |
921 dnl | |
4853 | 922 AC_DEFUN([OCTAVE_IEEE754_DATA_FORMAT], |
923 [AC_MSG_CHECKING([for IEEE 754 data format]) | |
924 AC_CACHE_VAL(octave_cv_ieee754_data_format, | |
5844 | 925 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
4853 | 926 int |
927 main (void) | |
928 { | |
929 typedef union { unsigned char c[8]; double d; } ieeebytes; | |
930 | |
931 ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43}; | |
932 ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c}; | |
933 | |
934 return l.d != 1234567891234567.0 && b.d != 1234567891234567.0; | |
5844 | 935 }]])], |
4853 | 936 octave_cv_ieee754_data_format=yes, |
937 octave_cv_ieee754_data_format=no, | |
938 octave_cv_ieee754_data_format=no)]) | |
939 if test "$cross_compiling" = yes; then | |
940 AC_MSG_RESULT([$octave_cv_ieee754_data_format assumed for cross compilation]) | |
941 else | |
942 AC_MSG_RESULT($octave_cv_ieee754_data_format) | |
943 fi | |
944 if test "$octave_cv_ieee754_data_format" = yes; then | |
945 AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1, [Define if your system uses IEEE 754 data format.]) | |
946 fi | |
947 ]) | |
5505 | 948 dnl |
949 dnl Check for UMFPACK seperately split complex matrix and RHS. Note | |
950 dnl that as umfpack.h can be in three different places, rather than | |
951 dnl include it, just declare the functions needed. | |
952 dnl | |
5512 | 953 dnl Assumes that the check for umfpack has already been performed. |
5505 | 954 dnl |
955 AC_DEFUN([OCTAVE_UMFPACK_SEPERATE_SPLIT], | |
956 [AC_MSG_CHECKING([for UMFPACK seperate complex matrix and rhs split]) | |
957 AC_CACHE_VAL(octave_cv_umfpack_seperate_split, | |
5844 | 958 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
5505 | 959 #include <stdlib.h> |
5512 | 960 #if defined (HAVE_UFSPARSE_UMFPACK_h) |
961 #include <ufsparse/umfpack.h> | |
962 #elif defined (HAVE_UMFPACK_UMFPACK_H) | |
963 #include <umfpack/umfpack.h> | |
964 #elif defined (HAVE_UMFPACK_H) | |
965 #include <umfpack.h> | |
966 #endif | |
5505 | 967 int n = 5; |
968 int Ap[] = {0, 2, 5, 9, 10, 12}; | |
969 int Ai[] = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4}; | |
970 double Ax[] = {2., 0., 3., 0., 3., 0., -1., 0., 4., 0., 4., 0., | |
971 -3., 0., 1., 0., 2., 0., 2., 0., 6., 0., 1., 0.}; | |
972 double br[] = {8., 45., -3., 3., 19.}; | |
973 double bi[] = {0., 0., 0., 0., 0.}; | |
974 int main (void) | |
975 { | |
976 double *null = (double *) NULL ; | |
977 double *x = (double *)malloc (2 * n * sizeof(double)); | |
978 int i ; | |
979 void *Symbolic, *Numeric ; | |
980 (void) umfpack_zi_symbolic (n, n, Ap, Ai, Ax, null, &Symbolic, null, null) ; | |
981 (void) umfpack_zi_numeric (Ap, Ai, Ax, null, Symbolic, &Numeric, null, null) ; | |
982 umfpack_zi_free_symbolic (&Symbolic) ; | |
983 (void) umfpack_zi_solve (0, Ap, Ai, Ax, null, x, null, br, bi, | |
984 Numeric, null, null) ; | |
985 umfpack_zi_free_numeric (&Numeric) ; | |
986 for (i = 0; i < n; i++, x+=2) | |
987 if (fabs(*x - i - 1.) > 1.e-13) | |
988 return (1); | |
989 return (0) ; | |
990 } | |
5844 | 991 ]])], |
5505 | 992 octave_cv_umfpack_seperate_split=yes, |
993 octave_cv_umfpack_seperate_split=no, | |
994 octave_cv_umfpack_seperate_split=no)]) | |
995 if test "$cross_compiling" = yes; then | |
996 AC_MSG_RESULT([$octave_cv_umfpack_seperate_split assumed for cross compilation]) | |
997 else | |
998 AC_MSG_RESULT($octave_cv_umfpack_seperate_split) | |
999 fi | |
1000 if test "$octave_cv_umfpack_seperate_split" = yes; then | |
1001 AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1, [Define if the UMFPACK Complex solver allow matrix and RHS to be split independently]) | |
1002 fi | |
1003 ]) | |
6276 | 1004 dnl |
1005 dnl Check whether using HDF5 DLL under Windows. This is done by | |
1006 dnl testing for a data symbol in the HDF5 library, which would | |
1007 dnl requires the definition of _HDF5USEDL_ under MSVC compiler. | |
1008 dnl | |
1009 AC_DEFUN([OCTAVE_HDF5_DLL], [ | |
1010 AC_CACHE_CHECK([if _HDF5USEDLL_ needs to be defined],octave_cv_hdf5_dll, [ | |
6724 | 1011 AC_TRY_LINK([#include <hdf5.h>], [hid_t x = H5T_NATIVE_DOUBLE; return x], |
6276 | 1012 octave_cv_hdf5_dll=no, [ |
1013 CFLAGS_old=$CFLAGS | |
1014 CFLAGS="$CFLAGS -DWIN32 -D_HDF5USEDLL_" | |
6724 | 1015 AC_TRY_LINK([#include <hdf5.h>], [hid_t x = H5T_NATIVE_DOUBLE; return x], |
6276 | 1016 octave_cv_hdf5_dll=yes, |
1017 octave_cv_hdf5_dll=no) | |
1018 CFLAGS=$CFLAGS_old])]) | |
1019 if test "$octave_cv_hdf5_dll" = yes; then | |
1020 AC_DEFINE(_HDF5USEDLL_, 1, [Define if using HDF5 dll (Win32)]) | |
1021 fi]) | |
6823 | 1022 dnl |
1023 dnl Check for the QHull version. | |
1024 dnl | |
1025 AC_DEFUN(AC_CHECK_QHULL_VERSION, | |
1026 [AC_MSG_CHECKING([for qh_qhull in -lqhull with qh_version]) | |
1027 AC_CACHE_VAL(octave_cv_lib_qhull_version, [ | |
1028 cat > conftest.c <<EOF | |
1029 #include <stdio.h> | |
1030 char *qh_version = "version"; | |
1031 char qh_qhull(); | |
1032 int | |
1033 main(argc, argv) | |
1034 int argc; | |
1035 char **argv; | |
1036 { | |
1037 qh_qhull(); | |
1038 return 0; | |
1039 } | |
1040 EOF | |
1041 | |
1042 octave_qhull_try="${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS conftest.c -o conftest -lqhull $LIBS" | |
7061 | 1043 if (eval "$octave_qhull_try") 2>&AS_MESSAGE_LOG_FD && test -s conftest ; then |
6823 | 1044 octave_cv_lib_qhull_version=yes |
1045 else | |
1046 octave_cv_lib_qhull_version=no | |
1047 fi | |
1048 rm -f conftest.c conftest.o conftest | |
1049 ])dnl | |
1050 if test "$octave_cv_lib_qhull_version" = "yes"; then | |
1051 AC_MSG_RESULT(yes) | |
1052 ifelse([$1], , , [$1]) | |
1053 else | |
1054 AC_MSG_RESULT(no) | |
1055 ifelse([$2], , , [$2]) | |
1056 fi | |
1057 ]) | |
1058 |