]> gcc.gnu.org Git - gcc.git/blame - libf2c/configure.in
cp-tree.h (CLASSTYPE_IS_TEMPLATE): New macro.
[gcc.git] / libf2c / configure.in
CommitLineData
81fea2b1
JL
1# Process this file with autoconf to produce a configure script.
2# Copyright (C) 1995, 1997 Free Software Foundation, Inc.
3# Contributed by Dave Love (d.love@dl.ac.uk).
4#
5#This file is part of GNU Fortran.
6#
7#GNU Fortran is free software; you can redistribute it and/or modify
8#it under the terms of the GNU General Public License as published by
9#the Free Software Foundation; either version 2, or (at your option)
10#any later version.
11#
12#GNU Fortran is distributed in the hope that it will be useful,
13#but WITHOUT ANY WARRANTY; without even the implied warranty of
14#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15#GNU General Public License for more details.
16#
17#You should have received a copy of the GNU General Public License
18#along with GNU Fortran; see the file COPYING. If not, write to
19#the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20#02111-1307, USA.
21
22AC_INIT(libF77/Version.c)
23
24AC_REVISION(1.10)
25
81fea2b1
JL
26dnl AC_C_CROSS
27dnl Gives misleading `(cached)' message from the check.
28if test "$CROSS";then
56a0044b
JL
29 if test "$CC_FOR_TARGET"; then
30 CC="$CC_FOR_TARGET"
31 else
32 CC="../../xgcc -B../../xgcc/"
33 fi
81fea2b1
JL
34 ac_cv_c_cross=yes
35else
56a0044b
JL
36 dnl Checks for programs.
37 # For g77 we'll set CC to point at the built gcc, but this will get it into
38 # the makefiles
39 AC_PROG_CC
81fea2b1
JL
40 ac_cv_c_cross=no
41fi
42
43dnl These should be inherited in the recursive make, but ensure they are
44dnl defined:
45test "$AR" || AR=ar
46AC_SUBST(AR)
47if test "$RANLIB"; then :
48 AC_SUBST(RANLIB)
49dnl Make sure that RANLIB_TEST is set also.
50 if test -z "$RANLIB_TEST"; then
51 RANLIB_TEST=true
52 fi
53else
54 RANLIB_TEST=true
55 AC_PROG_RANLIB
56fi
57AC_SUBST(RANLIB_TEST)
58
59dnl not needed for g77?
60dnl AC_PROG_MAKE_SET
61
62dnl Checks for libraries.
63
64dnl Checks for header files.
65# Sanity check for the cross-compilation case:
66AC_CHECK_HEADER(stdio.h,:,
67 [AC_MSG_ERROR([Can't find stdio.h.
68You must have a usable C system for the target already installed, at least
69including headers and, preferably, the library, before you can configure
70the G77 runtime system. If necessary, install gcc now with \`LANGUAGES=c',
71then the target library, then build with \`LANGUAGES=f77'.])])
72
73AC_HEADER_STDC
74dnl We could do this if we didn't know we were using gcc
75dnl AC_MSG_CHECKING(for prototype-savvy compiler)
76dnl AC_CACHE_VAL(g77_cv_sys_proto,
77dnl [AC_TRY_LINK(,
78dnl dnl looks screwy because TRY_LINK expects a function body
79dnl [return 0;} int foo (int * bar) {],
80dnl g77_cv_sys_proto=yes,
81dnl [g77_cv_sys_proto=no
82dnl AC_DEFINE(KR_headers)])])
83dnl AC_MSG_RESULT($g77_cv_sys_proto)
84
85dnl for U77
86dnl AC_CHECK_HEADERS(unistd.h)
87
88AC_MSG_CHECKING(for posix)
89AC_CACHE_VAL(g77_cv_header_posix,
90 AC_EGREP_CPP(yes,
91 [#include <sys/types.h>
92#include <unistd.h>
93#ifdef _POSIX_VERSION
94 yes
95#endif
96],
97 g77_cv_header_posix=yes,
98 g77_cv_header_posix=no))
99AC_MSG_RESULT($g77_cv_header_posix)
100
101# We can rely on the GNU library being posix-ish. I guess checking the
102# header isn't actually like checking the functions, though...
103AC_MSG_CHECKING(for GNU library)
104AC_CACHE_VAL(g77_cv_lib_gnu,
105 AC_EGREP_CPP(yes,
106 [#include <stdio.h>
107#ifdef __GNU_LIBRARY__
108 yes
109#endif
110],
111 g77_cv_lib_gnu=yes, g77_cv_lib_gnu=no))
112AC_MSG_RESULT($g77_cv_lib_gnu)
113
114# Apparently cygwin needs to be special-cased.
115AC_MSG_CHECKING([for cyg\`win'32])
116AC_CACHE_VAL(g77_cv_sys_cygwin32,
117 AC_EGREP_CPP(yes,
118 [#ifdef __CYGWIN32__
119 yes
120#endif
121],
122 g77_cv_sys_cygwin32=yes,
123 g77_cv_sys_cygwin32=no))
124AC_MSG_RESULT($g77_cv_sys_cygwin32)
125
126# ditto for mingw32.
127AC_MSG_CHECKING([for mingw32])
128AC_CACHE_VAL(g77_cv_sys_mingw32,
129 AC_EGREP_CPP(yes,
130 [#ifdef __MINGW32__
131 yes
132#endif
133],
134 g77_cv_sys_mingw32=yes,
135 g77_cv_sys_mingw32=no))
136AC_MSG_RESULT($g77_cv_sys_mingw32)
137
138
139AC_CHECK_HEADER(fcntl.h,
140 test $g77_cv_header_posix = yes && AC_DEFINE(_POSIX_SOURCE),
141 AC_DEFINE(NO_FCNTL) AC_DEFINE(OPEN_DECL))
142
143dnl Checks for typedefs, structures, and compiler characteristics.
144AC_C_CONST
145AC_TYPE_SIZE_T
146
147dnl Checks for library functions.
148AC_TYPE_SIGNAL
149# we'll get atexit by default
150if test $ac_cv_header_stdc != yes; then
151AC_CHECK_FUNC(atexit,
152 AC_DEFINE(onexit,atexit),dnl just in case
153 [AC_DEFINE(NO_ONEXIT)
154 AC_CHECK_FUNC(onexit,,
155 [AC_CHECK_FUNC(on_exit,
156 AC_DEFINE(onexit,on_exit),)])])
157else true
158fi
159
160# This should always succeed on unix.
161# Apparently positive result on cygwin loses re. NON_UNIX_STDIO
162# (as of cygwin b18). Likewise on mingw.
163AC_CHECK_FUNC(fstat)
164AC_MSG_CHECKING([need for NON_UNIX_STDIO])
165if test $g77_cv_sys_cygwin32 = yes \
166 || test $g77_cv_sys_mingw32 = yes \
167 || test $ac_cv_func_fstat = no; then
168 AC_MSG_RESULT(yes)
169 AC_DEFINE(NON_UNIX_STDIO)
170else
171 AC_MSG_RESULT(no)
172fi
173
174# This is necessary for e.g. Linux:
175AC_MSG_CHECKING([for necessary members of struct FILE])
176AC_CACHE_VAL(g77_cv_struct_FILE,
177[AC_TRY_COMPILE([#include <stdio.h>],
178 [FILE s; s._ptr; s._base; s._flag;],g77_cv_struct_FILE=yes,
179 g77_cv_struct_FILE=no)])dnl
180AC_MSG_RESULT($g77_cv_struct_FILE)
181if test $g77_cv_struct_FILE = no; then
182 AC_DEFINE(MISSING_FILE_ELEMS)
183fi
184
185dnl perhaps should check also for remainder
186dnl Unfortunately, the message implies we're just checking for -lm...
187AC_CHECK_LIB(m,drem,AC_DEFINE(IEEE_drem))
188
189dnl for U77:
190dnl AC_CHECK_FUNCS(symlink getcwd lstat)
191dnl test $ac_cv_func_symlink = yes && SYMLNK=symlnk_.o
192dnl test $ac_cv_func_lstat = yes && SYMLNK="$SYMLNK lstat_.o"
193dnl AC_SUBST(SYMLNK)
194
2731cc56
JL
195AC_CHECK_FUNCS(tempnam)
196
81fea2b1
JL
197# posix will guarantee the right behaviour for sprintf, else we can't be
198# sure; HEADER_STDC wouldn't be the right check in sunos4, for instance.
199# However, on my sunos4/gcc setup unistd.h leads us wrongly to believe
200# we're posix-conformant, so always do the test.
201AC_MSG_CHECKING(for ansi/posix sprintf result)
202dnl This loses if included as an argument to AC_CACHE_VAL because the
203dnl changequote doesn't take effect and the [] vanish.
204dnl fixme: use cached value
205AC_TRY_RUN(changequote(<<, >>)dnl
206 <<#include <stdio.h>
207 /* does sprintf return the number of chars transferred? */
208 main () {char foo[2]; (sprintf(foo, "1") == 1) ? exit(0) : exit(1);}
209>>changequote([, ]),
210 g77_cv_sys_sprintf_ansi=yes,
211 g77_cv_sys_sprintf_ansi=no,
212 g77_cv_sys_sprintf_ansi=no)
213AC_CACHE_VAL(g77_cv_sys_sprintf_ansi,
214 g77_cv_sys_sprintf_ansi=$g77_cv_sys_sprintf_ansi)
215dnl We get a misleading `(cached)' message...
216if test $ac_cv_c_cross = no; then
217 AC_MSG_RESULT($g77_cv_sys_sprintf_ansi)
218else
219 AC_MSG_RESULT([can't tell -- assuming no])
220fi
221# The cygwin patch takes steps to avoid defining USE_STRLEN here -- I don't
222# understand why.
223if test $g77_cv_sys_sprintf_ansi != yes; then
224 AC_DEFINE(USE_STRLEN)
225fi
226
227# define NON_ANSI_RW_MODES on unix (can't hurt)
228AC_MSG_CHECKING(NON_ANSI_RW_MODES)
229AC_EGREP_CPP(yes,
230[#ifdef unix
231 yes
232#endif
233#ifdef __unix
234 yes
235#endif
236#ifdef __unix__
237 yes
238#endif
239], is_unix=yes, is_unix=no)
240if test $g77_cv_sys_cygwin32 = yes || test $g77_cv_sys_mingw32 = yes; then
241 AC_MSG_RESULT(no)
242else
243 if test $is_unix = yes; then
244 AC_DEFINE(NON_ANSI_RW_MODES)
245 AC_MSG_RESULT(yes)
246 else
247 AC_MSG_RESULT(no)
248 fi
249fi
250
251# We have to firkle with the info in hconfig.h to figure out suitable types
252# (via com.h). proj.h and com.h are in $srcdir/.., config.h which they need
253# is in ../.. and the config files are in $srcdir/../../config.
254AC_MSG_CHECKING(f2c integer type)
255late_ac_cpp=$ac_cpp
318e3b20 256ac_cpp="$late_ac_cpp -I$srcdir/../gcc/f -I../../gcc -I$srcdir/../gcc -I$srcdir/../gcc/config"
81fea2b1
JL
257AC_CACHE_VAL(g77_cv_sys_f2cinteger,
258AC_EGREP_CPP(F2C_INTEGER=long int,
259[#include "proj.h"
260#define FFECOM_DETERMINE_TYPES 1
261#include "com.h"
262#if FFECOM_f2cINTEGER == FFECOM_f2ccodeLONG
263F2C_INTEGER=long int
264#elif FFECOM_f2cINTEGER == FFECOM_f2ccodeINT
265F2C_INTEGER=int
266#else
267# error "Cannot find a suitable type for F2C_INTEGER"
268#endif
269],
270 g77_cv_sys_f2cinteger="long int",)
271if test "$g77_cv_sys_f2cinteger" = ""; then
272 AC_EGREP_CPP(F2C_INTEGER=int,
273[#include "proj.h"
274#define FFECOM_DETERMINE_TYPES 1
275#include "com.h"
276#if FFECOM_f2cINTEGER == FFECOM_f2ccodeLONG
277F2C_INTEGER=long int
278#elif FFECOM_f2cINTEGER == FFECOM_f2ccodeINT
279F2C_INTEGER=int
280#else
281# error "Cannot find a suitable type for F2C_INTEGER"
282#endif
283],
284 g77_cv_sys_f2cinteger=int,)
285fi
286if test "$g77_cv_sys_f2cinteger" = ""; then
287 AC_MSG_RESULT("")
288 AC_MSG_ERROR([Can't determine type for f2c integer; config.log may help.])
289fi
290)
291AC_MSG_RESULT($g77_cv_sys_f2cinteger)
292F2C_INTEGER=$g77_cv_sys_f2cinteger
293ac_cpp=$late_ac_cpp
294AC_SUBST(F2C_INTEGER)
295
296AC_MSG_CHECKING(f2c long int type)
297late_ac_cpp=$ac_cpp
318e3b20 298ac_cpp="$late_ac_cpp -I$srcdir/../gcc/f -I../../gcc -I$srcdir/../gcc -I$srcdir/../gcc/config"
81fea2b1
JL
299AC_CACHE_VAL(g77_cv_sys_f2clongint,
300AC_EGREP_CPP(F2C_LONGINT=long int,
301[#include "proj.h"
302#define FFECOM_DETERMINE_TYPES 1
303#include "com.h"
304#if FFECOM_f2cLONGINT == FFECOM_f2ccodeLONG
305F2C_LONGINT=long int
306#elif FFECOM_f2cLONGINT == FFECOM_f2ccodeLONGLONG
307F2C_LONGINT=long long int
308#else
309# error "Cannot find a suitable type for F2C_LONGINT"
310#endif
311],
312 g77_cv_sys_f2clongint="long int",)
313if test "$g77_cv_sys_f2clongint" = ""; then
314 AC_EGREP_CPP(F2C_LONGINT=long long int,
315[#include "proj.h"
316#define FFECOM_DETERMINE_TYPES 1
317#include "com.h"
318#if FFECOM_f2cLONGINT == FFECOM_f2ccodeLONG
319F2C_LONGINT=long int
320#elif FFECOM_f2cLONGINT == FFECOM_f2ccodeLONGLONG
321F2C_LONGINT=long long int
322#else
323# error "Cannot find a suitable type for F2C_LONGINT"
324#endif
325],
326 g77_cv_sys_f2clongint="long long int",)
327fi
328if test "$g77_cv_sys_f2clongint" = ""; then
329 AC_MSG_RESULT("")
330 AC_MSG_ERROR([Can't determine type for f2c long int; config.log may help.])
331fi
332)
333AC_MSG_RESULT($g77_cv_sys_f2clongint)
334F2C_LONGINT=$g77_cv_sys_f2clongint
335ac_cpp=$late_ac_cpp
336AC_SUBST(F2C_LONGINT)
337
338dnl maybe check for drem/remainder
339
340AC_SUBST(CROSS)
341
342
343# This EOF_CHAR is a misfeature on unix.
344AC_DEFINE(NO_EOF_CHAR_CHECK)
345
346AC_DEFINE(Skip_f2c_Undefs)
347
348dnl Craig had these in f2c.h, but they're only relevant for building libf2c
349dnl anyway.
350
351dnl For GNU Fortran (g77), we always enable the following behaviors for
352dnl libf2c, to make things easy on the programmer. The alternate
353dnl behaviors have their uses, and g77 might provide them as compiler,
354dnl rather than library, options, so only a single copy of a shared libf2c
355dnl need be built for a system.
356
357dnl This makes unformatted I/O more consistent in relation to other
358dnl systems. It is not required by the F77 standard.
359
360AC_DEFINE(Pad_UDread)
361
362dnl This makes ERR= and IOSTAT= returns work properly in disk-full
363dnl situations, making things work more as expected. It slows things
364dnl down, so g77 will probably someday choose the original implementation
365dnl on a case-by-case basis when it can be shown to not be necessary
366dnl (e.g. no ERR= or IOSTAT=) or when it is given the appropriate
367dnl compile-time option or, perhaps, source-code directive.
368
369dnl AC_DEFINE(ALWAYS_FLUSH)
370
371dnl Most Fortran implementations do this, so to make it easier
372dnl to compare the output of g77-compiled programs to those compiled
373dnl by most other compilers, tell libf2c to put leading zeros in
374dnl appropriate places on output
375
376AC_DEFINE(WANT_LEAD_0)
377
378# avoid confusion in case the `makefile's from the f2c distribution have
379# got put here
380test -f libF77/makefile && mv libF77/makefile libF77/makefile.ori
381test -f libI77/makefile && mv libI77/makefile libI77/makefile.ori
382test -f libU77/makefile && mv libU77/makefile libU77/makefile.ori
383
384AC_CONFIG_SUBDIRS(libU77)
385AC_OUTPUT(Makefile f2c.h libI77/Makefile libF77/Makefile)
386
387dnl We might have configuration options to:
388dnl * allow non-standard string concatenation (use libF77 s_catow.o,
389dnl not s_cat.o)
390dnl * change unit preconnexion in libI77/err.c (f_init.c)
391dnl * -DALWAYS_FLUSH in libI77
392dnl * -DOMIT_BLANK_CC in libI77
393
394dnl Local Variables:
395dnl comment-start: "dnl "
396dnl comment-end: ""
397dnl comment-start-skip: "\\bdnl\\b\\s *"
398dnl End:
This page took 0.081209 seconds and 5 git commands to generate.