Mercurial > octave
comparison aclocal.m4 @ 1232:5f1bb459e99c
[project @ 1995-04-10 05:20:52 by jwe]
Initial revision
author | jwe |
---|---|
date | Mon, 10 Apr 1995 05:20:52 +0000 |
parents | |
children | 345c21405c57 |
comparison
equal
deleted
inserted
replaced
1231:6f1da2eacae3 | 1232:5f1bb459e99c |
---|---|
1 dnl aclocal.m4 -- extra macros for configuring Octave | |
2 dnl | |
3 dnl Copyright (C) 1995 John W. Eaton | |
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 | |
19 dnl Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 | |
21 dnl See what libraries are used by the C++ compiler. Need this for | |
22 dnl dynamic linking. | |
23 dnl | |
24 dnl Write a minimal program and compile it with -v. I don't know what | |
25 dnl to do if your compiler doesn't have -v... | |
26 dnl | |
27 dnl OCTAVE_CXXLIBS() | |
28 AC_DEFUN(OCTAVE_CXXLIBS, | |
29 [AC_REQUIRE([AC_PROG_CXXCPP]) | |
30 AC_REQUIRE([AC_PROG_CXX]) | |
31 AC_MSG_CHECKING([for C++ libraries]) | |
32 AC_CACHE_VAL(octave_cv_cxxlibs, | |
33 [AC_LANG_SAVE | |
34 AC_LANG_CPLUSPLUS | |
35 XCXXFLAGS="$CXXFLAGS" | |
36 CXXFLAGS="$XCXXFLAGS -v" | |
37 export CXXFLAGS | |
38 dnl | |
39 dnl This may be too tricky and break with future autoconf releases, | |
40 dnl but it works with version 2.3, even with the Ultrix /bin/sh. | |
41 dnl | |
42 dnl I don't think that stripping commas out of this will ever hurt. | |
43 dnl | |
44 coutput=`( AC_TRY_LINK([], [], []) ) AC_FD_CC>&1 | sed 's/,/ /g'` | |
45 CXXFLAGS="$XCXXFLAGS" | |
46 AC_LANG_RESTORE | |
47 changequote(, )dnl | |
48 dnl | |
49 octave_cv_cxxlibs= | |
50 lflags= | |
51 want_arg= | |
52 dnl | |
53 for arg in $coutput; do | |
54 if test x$want_arg = x; then | |
55 want_arg= | |
56 case $arg in | |
57 /*.a) | |
58 exists=false | |
59 for f in $lflags; do | |
60 if test x$arg = x$f; then | |
61 exists=true | |
62 fi | |
63 done | |
64 if $exists; then | |
65 arg= | |
66 else | |
67 lflags="$lflags $arg" | |
68 fi | |
69 ;; | |
70 -[LR]*) | |
71 exists=false | |
72 for f in $lflags; do | |
73 if test x$arg = x$f; then | |
74 exists=true | |
75 fi | |
76 done | |
77 ;; | |
78 -l*) | |
79 if test x$arg = x-lang-c++; then | |
80 arg= | |
81 else | |
82 lflags="$lflags $arg" | |
83 fi | |
84 ;; | |
85 -u) | |
86 want_arg=$arg | |
87 ;; | |
88 *) | |
89 arg= | |
90 ;; | |
91 esac | |
92 else | |
93 want_arg= | |
94 fi | |
95 if test x$arg != x; then | |
96 octave_cv_cxxlibs="$octave_cv_cxxlibs $arg" | |
97 fi | |
98 done | |
99 dnl | |
100 changequote([, ])]) | |
101 AC_MSG_RESULT([$octave_cv_cxxlibs]) | |
102 CXXLIBS="$octave_cv_cxxlibs" | |
103 AC_SUBST(CXXLIBS)]) | |
104 | |
105 dnl See what libraries are used by the Fortran compiler. | |
106 dnl | |
107 dnl Write a minimal program and compile it with -v. I don't know what | |
108 dnl to do if your compiler doesn't have -v... | |
109 dnl | |
110 dnl OCTAVE_FLIBS() | |
111 AC_DEFUN(OCTAVE_FLIBS, | |
112 [AC_MSG_CHECKING([for Fortran librarires]) | |
113 AC_CACHE_VAL(octave_cv_flibs, | |
114 [changequote(, )dnl | |
115 echo " END" > conftest.f | |
116 foutput=`${F77-f77} -v -o conftest conftest.f 2>&1` | |
117 dnl | |
118 dnl The easiest thing to do for xlf output is to replace all the commas | |
119 dnl with spaces. Try to only do that if the output is really from xlf, | |
120 dnl since doing that causes problems on other systems. | |
121 dnl | |
122 xlf_p=`echo $foutput | grep xlfentry` | |
123 if test -n "$xlf_p"; then | |
124 foutput=`echo $foutput | sed 's/,/ /g'` | |
125 fi | |
126 dnl | |
127 ld_run_path=`echo $foutput | \ | |
128 sed -n -e 's/.*\(LD_RUN_PATH *= *[^ ]*\).*/\1/p' | \ | |
129 sed -e 's/LD_RUN_PATH *= *//'` | |
130 dnl | |
131 dnl We are only supposed to find this on Solaris systems, and this | |
132 dnl substitution is probably only going to work with gcc on those | |
133 dnl systems... | |
134 dnl | |
135 if test -n "$ld_run_path"; then | |
136 ld_run_path="-Xlinker -R -Xlinker $ld_run_path" | |
137 fi | |
138 dnl | |
139 flibs= | |
140 lflags= | |
141 dnl | |
142 dnl If want_arg is set, we know we want the arg to be added to the list, | |
143 dnl so we don't have to examine it. | |
144 dnl | |
145 want_arg= | |
146 dnl | |
147 for arg in $foutput; do | |
148 old_want_arg=$want_arg | |
149 want_arg= | |
150 case "$old_want_arg" in | |
151 '') | |
152 case $arg in | |
153 /*.a | /*values-X*.o) | |
154 exists=false | |
155 for f in $lflags; do | |
156 if test x$arg = x$f; then | |
157 exists=true | |
158 fi | |
159 done | |
160 if $exists; then | |
161 arg= | |
162 else | |
163 lflags="$lflags $arg" | |
164 fi | |
165 ;; | |
166 -lang*) | |
167 arg= | |
168 ;; | |
169 -[lLR]) | |
170 want_arg=$arg | |
171 arg= | |
172 ;; | |
173 -[lLR]*) | |
174 exists=false | |
175 for f in $lflags; do | |
176 if test x$arg = x$f; then | |
177 exists=true | |
178 fi | |
179 done | |
180 if $exists || test x$arg = x-lm -o x$arg = x-lc; then | |
181 arg= | |
182 else | |
183 lflags="$lflags $arg" | |
184 fi | |
185 ;; | |
186 -u) | |
187 want_arg=$arg | |
188 ;; | |
189 -Y) | |
190 want_arg=$arg | |
191 arg= | |
192 ;; | |
193 *) | |
194 arg= | |
195 ;; | |
196 esac | |
197 ;; | |
198 -[lLR]) | |
199 arg="$old_want_arg $arg" | |
200 ;; | |
201 -Y) | |
202 dnl | |
203 dnl Should probably try to ensure unique directory options here too. | |
204 dnl This probably only applies to Solaris systems, and then will only | |
205 dnl work with gcc... | |
206 dnl | |
207 arg=`echo $arg | sed -e 's%^P,%%'` | |
208 SAVE_IFS=$IFS | |
209 IFS=: | |
210 list= | |
211 for elt in $arg; do | |
212 list="$list -L $elt" | |
213 done | |
214 IFS=$SAVE_IFS | |
215 arg="$list" | |
216 ;; | |
217 esac | |
218 dnl | |
219 if test -n "$arg"; then | |
220 flibs="$flibs $arg" | |
221 fi | |
222 done | |
223 changequote([, ])dnl | |
224 octave_cv_flibs="$ld_run_path $flibs"]) | |
225 FLIBS="$octave_cv_flibs" | |
226 AC_MSG_RESULT([$FLIBS])]) | |
227 | |
228 dnl See if the Fortran compiler appends underscores to external names. | |
229 dnl | |
230 dnl OCTAVE_F77_APPEND_UNDERSCORE() | |
231 AC_DEFUN(OCTAVE_F77_APPEND_UNDERSCORE, | |
232 [AC_MSG_CHECKING([whether $F77 appends underscores to external names]) | |
233 AC_CACHE_VAL(octave_cv_f77_append_underscore, | |
234 [octave_cv_f77_append_underscore=no | |
235 cat > conftest.f <<EOF | |
236 subroutine xxyyzz () | |
237 return | |
238 end | |
239 EOF | |
240 if ${F77-f77} -c conftest.f 1>&AC_FD_CC 2>&AC_FD_CC; then | |
241 if test "`${NM-nm} conftest.o | grep xxyyzz_`" != ""; then | |
242 octave_cv_f77_append_underscore=yes | |
243 elif test "`${NM-nm} conftest.o | grep XXYYZZ_`" != ""; then | |
244 octave_cv_f77_append_underscore=yes | |
245 fi | |
246 fi]) | |
247 AC_MSG_RESULT([$octave_cv_f77_append_underscore]) | |
248 if test "$octave_cv_f77_append_underscore" = yes; then | |
249 AC_DEFINE(F77_APPEND_UNDERSCORE, 1) | |
250 fi]) | |
251 | |
252 dnl See if the Fortran compiler is compatible with f2c. | |
253 dnl | |
254 dnl Write a minimal program, compile it, and see if it works as | |
255 dnl expected. | |
256 dnl | |
257 dnl OCTAVE_F2C_F77_COMPAT() | |
258 AC_DEFUN(OCTAVE_F2C_F77_COMPAT, | |
259 [AC_REQUIRE([OCTAVE_FLIBS]) | |
260 AC_REQUIRE([OCTAVE_F77_APPEND_UNDERSCORE]) | |
261 AC_MSG_CHECKING([$F77/f2c compatibility]) | |
262 AC_CACHE_VAL(octave_cv_f2c_f77_compat, | |
263 [trap 'rm -f ftest* ctest* core; exit 1' 1 3 15 | |
264 octave_cv_f2c_f77_compat=no | |
265 cat > ftest.f <<EOF | |
266 INTEGER FUNCTION FORSUB (C, D) | |
267 CHARACTER *(*) C | |
268 INTEGER L | |
269 DOUBLE PRECISION D | |
270 L = LEN (C) | |
271 WRITE (*, '(A,1X,I2)') C(1:L), INT (D) | |
272 FORSUB = 1 | |
273 RETURN | |
274 END | |
275 EOF | |
276 ${F77-f77} -c ftest.f 1>&AC_FD_CC 2>&AC_FD_CC | |
277 dnl | |
278 changequote(, ) | |
279 cat > ctest.c <<EOF | |
280 #include "confdefs.h" | |
281 static char s[14]; | |
282 int main () | |
283 { | |
284 double d = 10.0; | |
285 int len; | |
286 strcpy (s, "FOO-I-HITHERE"); | |
287 len = strlen (s); | |
288 #ifdef F77_APPEND_UNDERSCORE | |
289 return (! forsub_ (s, &d, len)); | |
290 #else | |
291 return (! forsub (s, &d, len)); | |
292 #endif | |
293 } | |
294 #ifdef sun | |
295 int MAIN_ () { return 0; } | |
296 #endif | |
297 EOF | |
298 changequote([, ]) | |
299 dnl | |
300 if ${CC-cc} -c ctest.c 1>&AC_FD_CC 2>&AC_FD_CC; then | |
301 if ${CC-cc} -o ctest ctest.o ftest.o $FLIBS -lm 1>&AC_FD_CC 2>&AC_FD_CC; then | |
302 ctest_output=`./ctest 2>&1` | |
303 status=$? | |
304 if test $status -eq 0 && test "$ctest_output" = "FOO-I-HITHERE 10"; then | |
305 octave_cv_f2c_f77_compat=yes | |
306 fi | |
307 fi | |
308 fi]) | |
309 rm -f ftest* ctest* core | |
310 AC_MSG_RESULT([$octave_cv_f2c_f77_compat])]) |