]> gcc.gnu.org Git - gcc.git/blame - libf2c/configure.in
Makefile.in (BASE_FLAGS_TO_PASS): Add gcc_version_trigger.
[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
f30bc2e7 24AC_REVISION(1.11)
81fea2b1 25
f30bc2e7
CB
26dnl Checks for programs.
27# For g77 we'll set CC to point at the built gcc, but this will get it into
28# the makefiles
29AC_PROG_CC
81fea2b1
JL
30
31dnl These should be inherited in the recursive make, but ensure they are
32dnl defined:
33test "$AR" || AR=ar
34AC_SUBST(AR)
35if test "$RANLIB"; then :
36 AC_SUBST(RANLIB)
37dnl Make sure that RANLIB_TEST is set also.
38 if test -z "$RANLIB_TEST"; then
39 RANLIB_TEST=true
40 fi
41else
42 RANLIB_TEST=true
43 AC_PROG_RANLIB
44fi
45AC_SUBST(RANLIB_TEST)
46
47dnl not needed for g77?
48dnl AC_PROG_MAKE_SET
49
50dnl Checks for libraries.
51
52dnl Checks for header files.
53# Sanity check for the cross-compilation case:
54AC_CHECK_HEADER(stdio.h,:,
55 [AC_MSG_ERROR([Can't find stdio.h.
56You must have a usable C system for the target already installed, at least
57including headers and, preferably, the library, before you can configure
58the G77 runtime system. If necessary, install gcc now with \`LANGUAGES=c',
59then the target library, then build with \`LANGUAGES=f77'.])])
60
61AC_HEADER_STDC
62dnl We could do this if we didn't know we were using gcc
63dnl AC_MSG_CHECKING(for prototype-savvy compiler)
64dnl AC_CACHE_VAL(g77_cv_sys_proto,
65dnl [AC_TRY_LINK(,
66dnl dnl looks screwy because TRY_LINK expects a function body
67dnl [return 0;} int foo (int * bar) {],
68dnl g77_cv_sys_proto=yes,
69dnl [g77_cv_sys_proto=no
70dnl AC_DEFINE(KR_headers)])])
71dnl AC_MSG_RESULT($g77_cv_sys_proto)
72
73dnl for U77
74dnl AC_CHECK_HEADERS(unistd.h)
75
76AC_MSG_CHECKING(for posix)
77AC_CACHE_VAL(g77_cv_header_posix,
78 AC_EGREP_CPP(yes,
79 [#include <sys/types.h>
80#include <unistd.h>
81#ifdef _POSIX_VERSION
82 yes
83#endif
84],
85 g77_cv_header_posix=yes,
86 g77_cv_header_posix=no))
87AC_MSG_RESULT($g77_cv_header_posix)
88
89# We can rely on the GNU library being posix-ish. I guess checking the
90# header isn't actually like checking the functions, though...
91AC_MSG_CHECKING(for GNU library)
92AC_CACHE_VAL(g77_cv_lib_gnu,
93 AC_EGREP_CPP(yes,
94 [#include <stdio.h>
95#ifdef __GNU_LIBRARY__
96 yes
97#endif
98],
99 g77_cv_lib_gnu=yes, g77_cv_lib_gnu=no))
100AC_MSG_RESULT($g77_cv_lib_gnu)
101
102# Apparently cygwin needs to be special-cased.
103AC_MSG_CHECKING([for cyg\`win'32])
104AC_CACHE_VAL(g77_cv_sys_cygwin32,
105 AC_EGREP_CPP(yes,
106 [#ifdef __CYGWIN32__
107 yes
108#endif
109],
110 g77_cv_sys_cygwin32=yes,
111 g77_cv_sys_cygwin32=no))
112AC_MSG_RESULT($g77_cv_sys_cygwin32)
113
114# ditto for mingw32.
115AC_MSG_CHECKING([for mingw32])
116AC_CACHE_VAL(g77_cv_sys_mingw32,
117 AC_EGREP_CPP(yes,
118 [#ifdef __MINGW32__
119 yes
120#endif
121],
122 g77_cv_sys_mingw32=yes,
123 g77_cv_sys_mingw32=no))
124AC_MSG_RESULT($g77_cv_sys_mingw32)
125
126
127AC_CHECK_HEADER(fcntl.h,
128 test $g77_cv_header_posix = yes && AC_DEFINE(_POSIX_SOURCE),
129 AC_DEFINE(NO_FCNTL) AC_DEFINE(OPEN_DECL))
130
131dnl Checks for typedefs, structures, and compiler characteristics.
132AC_C_CONST
133AC_TYPE_SIZE_T
134
135dnl Checks for library functions.
136AC_TYPE_SIGNAL
137# we'll get atexit by default
138if test $ac_cv_header_stdc != yes; then
139AC_CHECK_FUNC(atexit,
140 AC_DEFINE(onexit,atexit),dnl just in case
141 [AC_DEFINE(NO_ONEXIT)
142 AC_CHECK_FUNC(onexit,,
143 [AC_CHECK_FUNC(on_exit,
144 AC_DEFINE(onexit,on_exit),)])])
145else true
146fi
147
148# This should always succeed on unix.
149# Apparently positive result on cygwin loses re. NON_UNIX_STDIO
150# (as of cygwin b18). Likewise on mingw.
151AC_CHECK_FUNC(fstat)
152AC_MSG_CHECKING([need for NON_UNIX_STDIO])
153if test $g77_cv_sys_cygwin32 = yes \
154 || test $g77_cv_sys_mingw32 = yes \
155 || test $ac_cv_func_fstat = no; then
156 AC_MSG_RESULT(yes)
157 AC_DEFINE(NON_UNIX_STDIO)
158else
159 AC_MSG_RESULT(no)
160fi
161
162# This is necessary for e.g. Linux:
163AC_MSG_CHECKING([for necessary members of struct FILE])
164AC_CACHE_VAL(g77_cv_struct_FILE,
165[AC_TRY_COMPILE([#include <stdio.h>],
166 [FILE s; s._ptr; s._base; s._flag;],g77_cv_struct_FILE=yes,
167 g77_cv_struct_FILE=no)])dnl
168AC_MSG_RESULT($g77_cv_struct_FILE)
169if test $g77_cv_struct_FILE = no; then
170 AC_DEFINE(MISSING_FILE_ELEMS)
171fi
172
173dnl perhaps should check also for remainder
174dnl Unfortunately, the message implies we're just checking for -lm...
175AC_CHECK_LIB(m,drem,AC_DEFINE(IEEE_drem))
176
177dnl for U77:
178dnl AC_CHECK_FUNCS(symlink getcwd lstat)
179dnl test $ac_cv_func_symlink = yes && SYMLNK=symlnk_.o
180dnl test $ac_cv_func_lstat = yes && SYMLNK="$SYMLNK lstat_.o"
181dnl AC_SUBST(SYMLNK)
182
2731cc56
JL
183AC_CHECK_FUNCS(tempnam)
184
81fea2b1
JL
185# posix will guarantee the right behaviour for sprintf, else we can't be
186# sure; HEADER_STDC wouldn't be the right check in sunos4, for instance.
187# However, on my sunos4/gcc setup unistd.h leads us wrongly to believe
188# we're posix-conformant, so always do the test.
189AC_MSG_CHECKING(for ansi/posix sprintf result)
190dnl This loses if included as an argument to AC_CACHE_VAL because the
191dnl changequote doesn't take effect and the [] vanish.
192dnl fixme: use cached value
193AC_TRY_RUN(changequote(<<, >>)dnl
194 <<#include <stdio.h>
195 /* does sprintf return the number of chars transferred? */
196 main () {char foo[2]; (sprintf(foo, "1") == 1) ? exit(0) : exit(1);}
197>>changequote([, ]),
198 g77_cv_sys_sprintf_ansi=yes,
199 g77_cv_sys_sprintf_ansi=no,
200 g77_cv_sys_sprintf_ansi=no)
201AC_CACHE_VAL(g77_cv_sys_sprintf_ansi,
202 g77_cv_sys_sprintf_ansi=$g77_cv_sys_sprintf_ansi)
203dnl We get a misleading `(cached)' message...
f30bc2e7
CB
204AC_MSG_RESULT($g77_cv_sys_sprintf_ansi)
205
81fea2b1
JL
206# The cygwin patch takes steps to avoid defining USE_STRLEN here -- I don't
207# understand why.
208if test $g77_cv_sys_sprintf_ansi != yes; then
209 AC_DEFINE(USE_STRLEN)
210fi
211
212# define NON_ANSI_RW_MODES on unix (can't hurt)
213AC_MSG_CHECKING(NON_ANSI_RW_MODES)
214AC_EGREP_CPP(yes,
215[#ifdef unix
216 yes
217#endif
218#ifdef __unix
219 yes
220#endif
221#ifdef __unix__
222 yes
223#endif
224], is_unix=yes, is_unix=no)
225if test $g77_cv_sys_cygwin32 = yes || test $g77_cv_sys_mingw32 = yes; then
226 AC_MSG_RESULT(no)
227else
228 if test $is_unix = yes; then
229 AC_DEFINE(NON_ANSI_RW_MODES)
230 AC_MSG_RESULT(yes)
231 else
232 AC_MSG_RESULT(no)
233 fi
234fi
235
236# We have to firkle with the info in hconfig.h to figure out suitable types
237# (via com.h). proj.h and com.h are in $srcdir/.., config.h which they need
238# is in ../.. and the config files are in $srcdir/../../config.
239AC_MSG_CHECKING(f2c integer type)
240late_ac_cpp=$ac_cpp
8746c235
RH
241ac_cpp="$late_ac_cpp -I../../gcc/f -I../../gcc -I../../gcc/config"
242if test "$subdir" != . ; then
243 ac_cpp="$ac_cpp -I$srcdir/../gcc/f -I$srcdir/../gcc -I$srcdir/../gcc/config"
fcce69a9 244fi
81fea2b1 245AC_CACHE_VAL(g77_cv_sys_f2cinteger,
8746c235 246echo "configure:__oline__: using $ac_cpp" >&AC_FD_CC
81fea2b1
JL
247AC_EGREP_CPP(F2C_INTEGER=long int,
248[#include "proj.h"
249#define FFECOM_DETERMINE_TYPES 1
250#include "com.h"
251#if FFECOM_f2cINTEGER == FFECOM_f2ccodeLONG
252F2C_INTEGER=long int
253#elif FFECOM_f2cINTEGER == FFECOM_f2ccodeINT
254F2C_INTEGER=int
255#else
256# error "Cannot find a suitable type for F2C_INTEGER"
257#endif
258],
259 g77_cv_sys_f2cinteger="long int",)
260if test "$g77_cv_sys_f2cinteger" = ""; then
8746c235 261echo "configure:__oline__: using $ac_cpp" >&AC_FD_CC
81fea2b1
JL
262 AC_EGREP_CPP(F2C_INTEGER=int,
263[#include "proj.h"
264#define FFECOM_DETERMINE_TYPES 1
265#include "com.h"
266#if FFECOM_f2cINTEGER == FFECOM_f2ccodeLONG
267F2C_INTEGER=long int
268#elif FFECOM_f2cINTEGER == FFECOM_f2ccodeINT
269F2C_INTEGER=int
270#else
271# error "Cannot find a suitable type for F2C_INTEGER"
272#endif
273],
274 g77_cv_sys_f2cinteger=int,)
275fi
276if test "$g77_cv_sys_f2cinteger" = ""; then
277 AC_MSG_RESULT("")
278 AC_MSG_ERROR([Can't determine type for f2c integer; config.log may help.])
279fi
280)
281AC_MSG_RESULT($g77_cv_sys_f2cinteger)
282F2C_INTEGER=$g77_cv_sys_f2cinteger
283ac_cpp=$late_ac_cpp
284AC_SUBST(F2C_INTEGER)
285
286AC_MSG_CHECKING(f2c long int type)
287late_ac_cpp=$ac_cpp
8746c235
RH
288ac_cpp="$late_ac_cpp -I../../gcc/f -I../../gcc -I../../gcc/config"
289if test "$subdir" != . ; then
290 ac_cpp="$ac_cpp -I$srcdir/../gcc/f -I$srcdir/../gcc -I$srcdir/../gcc/config"
fcce69a9 291fi
81fea2b1 292AC_CACHE_VAL(g77_cv_sys_f2clongint,
8746c235 293echo "configure:__oline__: using $ac_cpp" >&AC_FD_CC
81fea2b1
JL
294AC_EGREP_CPP(F2C_LONGINT=long int,
295[#include "proj.h"
296#define FFECOM_DETERMINE_TYPES 1
297#include "com.h"
298#if FFECOM_f2cLONGINT == FFECOM_f2ccodeLONG
299F2C_LONGINT=long int
300#elif FFECOM_f2cLONGINT == FFECOM_f2ccodeLONGLONG
301F2C_LONGINT=long long int
302#else
303# error "Cannot find a suitable type for F2C_LONGINT"
304#endif
305],
306 g77_cv_sys_f2clongint="long int",)
307if test "$g77_cv_sys_f2clongint" = ""; then
8746c235 308echo "configure:__oline__: using $ac_cpp" >&AC_FD_CC
81fea2b1
JL
309 AC_EGREP_CPP(F2C_LONGINT=long long int,
310[#include "proj.h"
311#define FFECOM_DETERMINE_TYPES 1
312#include "com.h"
313#if FFECOM_f2cLONGINT == FFECOM_f2ccodeLONG
314F2C_LONGINT=long int
315#elif FFECOM_f2cLONGINT == FFECOM_f2ccodeLONGLONG
316F2C_LONGINT=long long int
317#else
318# error "Cannot find a suitable type for F2C_LONGINT"
319#endif
320],
321 g77_cv_sys_f2clongint="long long int",)
322fi
323if test "$g77_cv_sys_f2clongint" = ""; then
324 AC_MSG_RESULT("")
325 AC_MSG_ERROR([Can't determine type for f2c long int; config.log may help.])
326fi
327)
328AC_MSG_RESULT($g77_cv_sys_f2clongint)
329F2C_LONGINT=$g77_cv_sys_f2clongint
330ac_cpp=$late_ac_cpp
331AC_SUBST(F2C_LONGINT)
332
333dnl maybe check for drem/remainder
334
81fea2b1
JL
335# This EOF_CHAR is a misfeature on unix.
336AC_DEFINE(NO_EOF_CHAR_CHECK)
337
338AC_DEFINE(Skip_f2c_Undefs)
339
81fea2b1
JL
340# avoid confusion in case the `makefile's from the f2c distribution have
341# got put here
342test -f libF77/makefile && mv libF77/makefile libF77/makefile.ori
343test -f libI77/makefile && mv libI77/makefile libI77/makefile.ori
344test -f libU77/makefile && mv libU77/makefile libU77/makefile.ori
345
487eb4b8 346# Get the version number from the toplevel
6174dcf3
MH
347if test x${with_gcc_version} = x; then
348 # Try to get the version number from a hopefully existing gcc directory.
349 if test -d ${srcdir}/../gcc; then
350 gcc_version=`sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/' < ${srcdir}/../gcc/version.c`
351 else
352 gcc_version=UNKNOWN
353 fi
354else
355 gcc_version=${with_gcc_version}
356fi
357AC_SUBST(gcc_version)
487eb4b8
JL
358AC_CANONICAL_SYSTEM
359AC_SUBST(target_alias)
360
81fea2b1 361AC_CONFIG_SUBDIRS(libU77)
f30bc2e7 362AC_OUTPUT(Makefile g2c.h libI77/Makefile libF77/Makefile)
81fea2b1
JL
363
364dnl We might have configuration options to:
81fea2b1
JL
365dnl * change unit preconnexion in libI77/err.c (f_init.c)
366dnl * -DALWAYS_FLUSH in libI77
367dnl * -DOMIT_BLANK_CC in libI77
368
369dnl Local Variables:
370dnl comment-start: "dnl "
371dnl comment-end: ""
372dnl comment-start-skip: "\\bdnl\\b\\s *"
373dnl End:
This page took 0.085955 seconds and 5 git commands to generate.