]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgfortran/configure.ac
Fortran: Re-enable 128-bit integers for AMD GCN
[thirdparty/gcc.git] / libgfortran / configure.ac
CommitLineData
96b8a615
AJ
1# Process this file with autoconf to produce a configure script, like so:
2# aclocal && autoconf && autoheader && automake
3
0dce3ca1 4AC_INIT([GNU Fortran Runtime Library], 0.3,,[libgfortran])
96b8a615 5AC_CONFIG_HEADER(config.h)
891c05b1 6GCC_TOPLEV_SUBDIRS
96b8a615 7
96b8a615
AJ
8# -------
9# Options
10# -------
11
12AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
13AC_ARG_ENABLE(version-specific-runtime-libs,
87e6d9dc
TB
14AS_HELP_STRING([--enable-version-specific-runtime-libs],
15 [specify that runtime libraries should be installed in a compiler-specific directory]),
96b8a615
AJ
16[case "$enableval" in
17 yes) version_specific_libs=yes ;;
18 no) version_specific_libs=no ;;
19 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
20 esac],
21[version_specific_libs=no])
22AC_MSG_RESULT($version_specific_libs)
23
b808ac33
BF
24# Build with intermodule optimisations
25AC_MSG_CHECKING([for --enable-intermodule])
26AC_ARG_ENABLE(intermodule,
87e6d9dc 27AS_HELP_STRING([--enable-intermodule],[build the library in one step]),
b808ac33
BF
28[case "$enable_intermodule" in
29 yes) onestep="-onestep";;
30 *) onestep="";;
31esac],
32[onestep=""])
33AC_MSG_RESULT($enable_intermodule)
34AM_CONDITIONAL(onestep,[test x$onestep = x-onestep])
35AC_SUBST(onestep)
96b8a615
AJ
36
37# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
38#
39# You will slowly go insane if you do not grok the following fact: when
40# building this library, the top-level /target/ becomes the library's /host/.
41#
42# configure then causes --target to default to --host, exactly like any
43# other package using autoconf. Therefore, 'target' and 'host' will
44# always be the same. This makes sense both for native and cross compilers
45# just think about it for a little while. :-)
46#
47# Also, if this library is being configured as part of a cross compiler, the
48# top-level configure script will pass the "real" host as $with_cross_host.
49#
50# Do not delete or change the following two lines. For why, see
51# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
52AC_CANONICAL_SYSTEM
60858d8a
TB
53ACX_NONCANONICAL_TARGET
54
96b8a615 55target_alias=${target_alias-$host_alias}
60858d8a 56AC_SUBST(target_alias)
96b8a615
AJ
57
58# Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
59# following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
679c0f9a 60# 1.9.6: minimum required version
96b8a615
AJ
61# no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
62# of other PACKAGE_* variables will, however, and there's nothing
63# we can do about that; they come from AC_INIT).
64# foreign: we don't follow the normal rules for GNU packages (no COPYING
65# file in the top srcdir, etc, etc), so stop complaining.
13917ae3 66# no-dist: we don't want 'dist' and related rules.
96b8a615
AJ
67# -Wall: turns on all automake warnings...
68# -Wno-portability: ...except this one, since GNU make is required.
13917ae3 69AM_INIT_AUTOMAKE([1.9.6 no-define foreign no-dist -Wall -Wno-portability])
96b8a615
AJ
70
71AM_MAINTAINER_MODE
72AM_ENABLE_MULTILIB(, ..)
73
74# Handy for debugging:
75#AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5
76
77# Are we being configured with some form of cross compiler?
78# NB: We don't actually need to know this just now, but when, say, a test
79# suite is included, we'll have to know.
80if test "$build" != "$host"; then
81 LIBGFOR_IS_NATIVE=false
82 GCC_NO_EXECUTABLES
83else
84 LIBGFOR_IS_NATIVE=true
85fi
86
21be0a5a
JB
87AC_USE_SYSTEM_EXTENSIONS
88
e8e66971
MR
89GCC_WITH_TOOLEXECLIBDIR
90
96b8a615
AJ
91# Calculate toolexeclibdir
92# Also toolexecdir, though it's only used in toolexeclibdir
93case ${version_specific_libs} in
94 yes)
95 # Need the gcc compiler version to know where to install libraries
96 # and header files if --enable-version-specific-runtime-libs option
97 # is selected.
98 toolexecdir='$(libdir)/gcc/$(target_alias)'
140e859c 99 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
96b8a615
AJ
100 ;;
101 no)
102 if test -n "$with_cross_host" &&
103 test x"$with_cross_host" != x"no"; then
104 # Install a library built with a cross compiler in tooldir, not libdir.
105 toolexecdir='$(exec_prefix)/$(target_alias)'
e8e66971
MR
106 case ${with_toolexeclibdir} in
107 no)
108 toolexeclibdir='$(toolexecdir)/lib'
109 ;;
110 *)
111 toolexeclibdir=${with_toolexeclibdir}
112 ;;
113 esac
96b8a615
AJ
114 else
115 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
116 toolexeclibdir='$(libdir)'
117 fi
118 multi_os_directory=`$CC -print-multi-os-directory`
119 case $multi_os_directory in
120 .) ;; # Avoid trailing /.
121 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
122 esac
123 ;;
124esac
125AC_SUBST(toolexecdir)
126AC_SUBST(toolexeclibdir)
127
1ec601bf
FXC
128# Create a spec file, so that compile/link tests don't fail
129test -f libgfortran.spec || touch libgfortran.spec
130
60858d8a 131AC_LANG_C
96b8a615
AJ
132# Check the compiler.
133# The same as in boehm-gc and libstdc++. Have to borrow it from there.
134# We must force CC to /not/ be precious variables; otherwise
135# the wrong, non-multilib-adjusted value will be used in multilibs.
136# As a side effect, we have to subst CFLAGS ourselves.
137
138m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
139m4_define([_AC_ARG_VAR_PRECIOUS],[])
140AC_PROG_CC
1b3b24c2 141m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
96b8a615 142
60858d8a
TB
143AC_SUBST(CFLAGS)
144
145AM_PROG_CC_C_O
146
17109ecb 147# Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
96b8a615 148if test "x$GCC" = "xyes"; then
c3e9b6ab 149 AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
f7b6856f
JB
150 ## We like to use C11 and C99 routines when available. This makes
151 ## sure that
e606fb39 152 ## __STDC_VERSION__ is set such that libc includes make them available.
581d2326 153 AM_CFLAGS="-std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Werror=vla"
d1f37bc6
RS
154 ## Compile the following tests with the same system header contents
155 ## that we'll encounter when compiling our own source files.
f7b6856f 156 CFLAGS="-std=gnu11 $CFLAGS"
96b8a615 157fi
26724ef9
IT
158
159# Add CET specific flags if CET is enabled
160GCC_CET_FLAGS(CET_FLAGS)
161AM_FCFLAGS="$AM_FCFLAGS $CET_FLAGS"
162AM_CFLAGS="$AM_CFLAGS $CET_FLAGS"
163CFLAGS="$CFLAGS $CET_FLAGS"
164
e606fb39
AJ
165AC_SUBST(AM_FCFLAGS)
166AC_SUBST(AM_CFLAGS)
3d22e001 167AC_SUBST(CFLAGS)
96b8a615 168
c0e7e2bf
JB
169# Check for symbol versioning (copied from libssp).
170AC_MSG_CHECKING([whether symbol versioning is supported])
bf382f5f
RO
171AC_ARG_ENABLE(symvers,
172AS_HELP_STRING([--disable-symvers],
173 [disable symbol versioning for libgfortran]),
174gfortran_use_symver=$enableval,
175gfortran_use_symver=yes)
19af62db 176if test "x$gfortran_use_symver" != xno; then
bf382f5f
RO
177 save_LDFLAGS="$LDFLAGS"
178 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
179 cat > conftest.map <<EOF
c0e7e2bf
JB
180FOO_1.0 {
181 global: *foo*; bar; local: *;
182};
183EOF
bf382f5f
RO
184 AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]],[[]])],[gfortran_use_symver=gnu],[gfortran_use_symver=no])
185 if test x$gfortran_use_symver = xno; then
186 case "$target_os" in
187 solaris2*)
188 LDFLAGS="$save_LDFLAGS"
189 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
190 # Sun ld cannot handle wildcards and treats all entries as undefined.
191 cat > conftest.map <<EOF
49ea7a0e
RO
192FOO_1.0 {
193 global: foo; local: *;
194};
195EOF
bf382f5f
RO
196 AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]],[[]])],[gfortran_use_symver=sun],[gfortran_use_symver=no])
197 ;;
198 esac
199 fi
200 LDFLAGS="$save_LDFLAGS"
49ea7a0e 201fi
c0e7e2bf 202AC_MSG_RESULT($gfortran_use_symver)
49ea7a0e
RO
203AM_CONDITIONAL(LIBGFOR_USE_SYMVER, [test "x$gfortran_use_symver" != xno])
204AM_CONDITIONAL(LIBGFOR_USE_SYMVER_GNU, [test "x$gfortran_use_symver" = xgnu])
205AM_CONDITIONAL(LIBGFOR_USE_SYMVER_SUN, [test "x$gfortran_use_symver" = xsun])
c0e7e2bf 206
ee95f928
BS
207# For GPU offloading, not everything in libfortran can be supported.
208# Currently, the only target that has this problem is nvptx. The
209# following is a (partial) list of features that are unsupportable on
210# this particular target:
211# * Constructors
212# * alloca
213# * C library support for I/O, with printf as the one notable exception
214# * C library support for other features such as signal, environment
215# variables, time functions
216
b1e86e33 217AM_CONDITIONAL(LIBGFOR_MINIMAL, [test "x${target_cpu}" = xnvptx])
ee95f928 218
2e764ae1
TB
219# Some compiler target support may have limited support for integer
220# or floating point numbers – or may want to reduce the libgfortran size
221# although they do have the support.
222LIBGOMP_CHECKED_INT_KINDS="1 2 4 8 16"
223LIBGOMP_CHECKED_REAL_KINDS="4 8 10 16"
224
2e764ae1
TB
225AC_SUBST(LIBGOMP_CHECKED_INT_KINDS)
226AC_SUBST(LIBGOMP_CHECKED_REAL_KINDS)
227
c049309d
UW
228# Figure out whether the compiler supports "-ffunction-sections -fdata-sections",
229# similarly to how libstdc++ does it
230ac_test_CFLAGS="${CFLAGS+set}"
231ac_save_CFLAGS="$CFLAGS"
232
233# Check for -ffunction-sections -fdata-sections
234AC_MSG_CHECKING([for gcc that supports -ffunction-sections -fdata-sections])
235CFLAGS='-Werror -ffunction-sections -fdata-sections'
de15ea94 236AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int foo;]])], [ac_fdsections=yes], [ac_fdsections=no])
c049309d
UW
237if test "$ac_test_CFLAGS" = set; then
238 CFLAGS="$ac_save_CFLAGS"
239else
240 # this is the suspicious part
241 CFLAGS=""
242fi
243if test x"$ac_fdsections" = x"yes"; then
244 SECTION_FLAGS='-ffunction-sections -fdata-sections'
245fi
246AC_MSG_RESULT($ac_fdsections)
247AC_SUBST(SECTION_FLAGS)
248
66dbcf2d
RO
249# Check linker hardware capability support.
250GCC_CHECK_LINKER_HWCAP
251
96b8a615
AJ
252# Find other programs we need.
253AC_CHECK_TOOL(AS, as)
254AC_CHECK_TOOL(AR, ar)
255AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
256AC_PROG_MAKE_SET
257AC_PROG_INSTALL
258
259# Configure libtool
260#AC_MSG_NOTICE([====== Starting libtool configuration])
261AC_LIBTOOL_DLOPEN
262AM_PROG_LIBTOOL
7de6ba7a 263ACX_LT_HOST_FLAGS
96b8a615
AJ
264AC_SUBST(enable_shared)
265AC_SUBST(enable_static)
266#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
267
268# We need gfortran to compile parts of the library
c7a35fe9
AS
269#AC_PROG_FC(gfortran)
270FC="$GFORTRAN"
271AC_PROG_FC(gfortran)
96b8a615 272
e87045f3
AP
273# extra LD Flags which are required for targets
274case "${host}" in
275 *-darwin*)
276 # Darwin needs -single_module when linking libgfortran
277 extra_ldflags_libgfortran=-Wl,-single_module
278 ;;
279esac
280AC_SUBST(extra_ldflags_libgfortran)
281
15e92535
FXC
282# We need a working compiler at that point, otherwise give a clear
283# error message and bail out.
284LIBGFOR_WORKING_GFORTRAN
285
9cdc381b 286AC_SYS_LARGEFILE
44720bef
JB
287
288# Types
96b8a615 289AC_TYPE_OFF_T
44720bef
JB
290AC_TYPE_INTPTR_T
291AC_TYPE_UINTPTR_T
292AC_CHECK_TYPES([ptrdiff_t])
96b8a615 293
74544378 294# check header files (we assume C89 is available, so don't check for that)
864c28e1 295AC_CHECK_HEADERS_ONCE(unistd.h sys/random.h sys/time.h sys/times.h \
edaaef60 296sys/resource.h sys/types.h sys/stat.h sys/uio.h sys/wait.h \
864c28e1 297floatingpoint.h ieeefp.h fenv.h fptrap.h \
9cbecd06 298fpxcp.h pwd.h complex.h xlocale.h)
74544378 299
4c4b3eb0 300GCC_HEADER_STDINT(gstdint.h)
96b8a615 301
74544378 302AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev])
df65f093 303
bd459d0b
JG
304case "${host}--x${with_newlib}" in
305 mips*--xyes)
306 hardwire_newlib=1;;
d3ca2257
NS
307 nvptx*--xyes)
308 hardwire_newlib=1;;
bd459d0b
JG
309esac
310
96b8a615 311# Check for library functions.
bd459d0b 312if test "${hardwire_newlib:-0}" -eq 1; then
b4005c71
SE
313 # We are being configured with a cross compiler. AC_REPLACE_FUNCS
314 # may not work correctly, because the compiler may not be able to
315 # link executables.
316 AC_DEFINE(HAVE_MKSTEMP, 1, [Define if you have mkstemp.])
317 AC_DEFINE(HAVE_STRTOF, 1, [Define if you have strtof.])
b4005c71 318 AC_DEFINE(HAVE_SNPRINTF, 1, [Define if you have snprintf.])
b4005c71
SE
319 AC_DEFINE(HAVE_VSNPRINTF, 1, [Define if you have vsnprintf.])
320 AC_DEFINE(HAVE_LOCALTIME_R, 1, [Define if you have localtime_r.])
321 AC_DEFINE(HAVE_GMTIME_R, 1, [Define if you have gmtime_r.])
ebfedee6
HPN
322 AC_DEFINE(HAVE_STRNLEN, 1, [Define if you have strnlen.])
323 AC_DEFINE(HAVE_STRNDUP, 1, [Define if you have strndup.])
cb83df66
SE
324
325 # At some point, we should differentiate between architectures
326 # like x86, which have long double versions, and alpha/powerpc/etc.,
327 # which don't. For the time being, punt.
328 if test x"long_double_math_on_this_cpu" = x"yes"; then
329 AC_DEFINE(HAVE_STRTOLD, 1, [Define if you have strtold.])
330 fi
b4005c71
SE
331else
332 AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \
d66d6d15 333 ftruncate chsize chdir getentropy getlogin gethostname kill link symlink \
ef536b41 334 sleep ttyname sigaction waitpid \
f8886038 335 alarm access fork posix_spawn setmode fcntl writev \
4879fba9 336 gettimeofday stat fstat lstat getpwuid vsnprintf dup \
b4005c71 337 getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \
4879fba9 338 getgid getpid getuid geteuid umask getegid \
ad4f95e3 339 secure_getenv __secure_getenv mkostemp strnlen strndup newlocale \
9cbecd06 340 freelocale uselocale strerror_l)
b4005c71 341fi
4c0c6b9f 342
4179e59a
TB
343# Check strerror_r, cannot be above as versions with two and three arguments exist
344LIBGFOR_CHECK_STRERROR_R
345
453310d8 346# Check for C99 (and other IEEE) math functions
f38a14ca
TG
347GCC_CHECK_MATH_FUNC([acosf])
348GCC_CHECK_MATH_FUNC([acos])
349GCC_CHECK_MATH_FUNC([acosl])
350GCC_CHECK_MATH_FUNC([acoshf])
351GCC_CHECK_MATH_FUNC([acosh])
352GCC_CHECK_MATH_FUNC([acoshl])
353GCC_CHECK_MATH_FUNC([asinf])
354GCC_CHECK_MATH_FUNC([asin])
355GCC_CHECK_MATH_FUNC([asinl])
356GCC_CHECK_MATH_FUNC([asinhf])
357GCC_CHECK_MATH_FUNC([asinh])
358GCC_CHECK_MATH_FUNC([asinhl])
359GCC_CHECK_MATH_FUNC([atan2f])
360GCC_CHECK_MATH_FUNC([atan2])
361GCC_CHECK_MATH_FUNC([atan2l])
362GCC_CHECK_MATH_FUNC([atanf])
363GCC_CHECK_MATH_FUNC([atan])
364GCC_CHECK_MATH_FUNC([atanl])
365GCC_CHECK_MATH_FUNC([atanhf])
366GCC_CHECK_MATH_FUNC([atanh])
367GCC_CHECK_MATH_FUNC([atanhl])
368GCC_CHECK_MATH_FUNC([cargf])
369GCC_CHECK_MATH_FUNC([carg])
370GCC_CHECK_MATH_FUNC([cargl])
371GCC_CHECK_MATH_FUNC([ceilf])
372GCC_CHECK_MATH_FUNC([ceil])
373GCC_CHECK_MATH_FUNC([ceill])
374GCC_CHECK_MATH_FUNC([copysignf])
375GCC_CHECK_MATH_FUNC([copysign])
376GCC_CHECK_MATH_FUNC([copysignl])
377GCC_CHECK_MATH_FUNC([cosf])
378GCC_CHECK_MATH_FUNC([cos])
379GCC_CHECK_MATH_FUNC([cosl])
380GCC_CHECK_MATH_FUNC([ccosf])
381GCC_CHECK_MATH_FUNC([ccos])
382GCC_CHECK_MATH_FUNC([ccosl])
383GCC_CHECK_MATH_FUNC([coshf])
384GCC_CHECK_MATH_FUNC([cosh])
385GCC_CHECK_MATH_FUNC([coshl])
386GCC_CHECK_MATH_FUNC([ccoshf])
387GCC_CHECK_MATH_FUNC([ccosh])
388GCC_CHECK_MATH_FUNC([ccoshl])
389GCC_CHECK_MATH_FUNC([expf])
390GCC_CHECK_MATH_FUNC([exp])
391GCC_CHECK_MATH_FUNC([expl])
392GCC_CHECK_MATH_FUNC([cexpf])
393GCC_CHECK_MATH_FUNC([cexp])
394GCC_CHECK_MATH_FUNC([cexpl])
395GCC_CHECK_MATH_FUNC([fabsf])
396GCC_CHECK_MATH_FUNC([fabs])
397GCC_CHECK_MATH_FUNC([fabsl])
398GCC_CHECK_MATH_FUNC([cabsf])
399GCC_CHECK_MATH_FUNC([cabs])
400GCC_CHECK_MATH_FUNC([cabsl])
401GCC_CHECK_MATH_FUNC([floorf])
402GCC_CHECK_MATH_FUNC([floor])
403GCC_CHECK_MATH_FUNC([floorl])
1868599f
JJ
404GCC_CHECK_MATH_FUNC([fmaf])
405GCC_CHECK_MATH_FUNC([fma])
406GCC_CHECK_MATH_FUNC([fmal])
f38a14ca
TG
407GCC_CHECK_MATH_FUNC([fmodf])
408GCC_CHECK_MATH_FUNC([fmod])
409GCC_CHECK_MATH_FUNC([fmodl])
410GCC_CHECK_MATH_FUNC([frexpf])
411GCC_CHECK_MATH_FUNC([frexp])
412GCC_CHECK_MATH_FUNC([frexpl])
413GCC_CHECK_MATH_FUNC([hypotf])
414GCC_CHECK_MATH_FUNC([hypot])
415GCC_CHECK_MATH_FUNC([hypotl])
416GCC_CHECK_MATH_FUNC([ldexpf])
417GCC_CHECK_MATH_FUNC([ldexp])
418GCC_CHECK_MATH_FUNC([ldexpl])
419GCC_CHECK_MATH_FUNC([logf])
420GCC_CHECK_MATH_FUNC([log])
421GCC_CHECK_MATH_FUNC([logl])
422GCC_CHECK_MATH_FUNC([clogf])
423GCC_CHECK_MATH_FUNC([clog])
424GCC_CHECK_MATH_FUNC([clogl])
425GCC_CHECK_MATH_FUNC([log10f])
426GCC_CHECK_MATH_FUNC([log10])
427GCC_CHECK_MATH_FUNC([log10l])
428GCC_CHECK_MATH_FUNC([clog10f])
429GCC_CHECK_MATH_FUNC([clog10])
430GCC_CHECK_MATH_FUNC([clog10l])
431GCC_CHECK_MATH_FUNC([nextafterf])
432GCC_CHECK_MATH_FUNC([nextafter])
433GCC_CHECK_MATH_FUNC([nextafterl])
434GCC_CHECK_MATH_FUNC([powf])
435GCC_CHECK_MATH_FUNC([pow])
f38a14ca
TG
436GCC_CHECK_MATH_FUNC([cpowf])
437GCC_CHECK_MATH_FUNC([cpow])
438GCC_CHECK_MATH_FUNC([cpowl])
439GCC_CHECK_MATH_FUNC([roundf])
440GCC_CHECK_MATH_FUNC([round])
441GCC_CHECK_MATH_FUNC([roundl])
442GCC_CHECK_MATH_FUNC([lroundf])
443GCC_CHECK_MATH_FUNC([lround])
444GCC_CHECK_MATH_FUNC([lroundl])
445GCC_CHECK_MATH_FUNC([llroundf])
446GCC_CHECK_MATH_FUNC([llround])
447GCC_CHECK_MATH_FUNC([llroundl])
448GCC_CHECK_MATH_FUNC([scalbnf])
449GCC_CHECK_MATH_FUNC([scalbn])
450GCC_CHECK_MATH_FUNC([scalbnl])
451GCC_CHECK_MATH_FUNC([sinf])
452GCC_CHECK_MATH_FUNC([sin])
453GCC_CHECK_MATH_FUNC([sinl])
454GCC_CHECK_MATH_FUNC([csinf])
455GCC_CHECK_MATH_FUNC([csin])
456GCC_CHECK_MATH_FUNC([csinl])
457GCC_CHECK_MATH_FUNC([sinhf])
458GCC_CHECK_MATH_FUNC([sinh])
459GCC_CHECK_MATH_FUNC([sinhl])
460GCC_CHECK_MATH_FUNC([csinhf])
461GCC_CHECK_MATH_FUNC([csinh])
462GCC_CHECK_MATH_FUNC([csinhl])
463GCC_CHECK_MATH_FUNC([sqrtf])
464GCC_CHECK_MATH_FUNC([sqrt])
465GCC_CHECK_MATH_FUNC([sqrtl])
466GCC_CHECK_MATH_FUNC([csqrtf])
467GCC_CHECK_MATH_FUNC([csqrt])
468GCC_CHECK_MATH_FUNC([csqrtl])
469GCC_CHECK_MATH_FUNC([tanf])
470GCC_CHECK_MATH_FUNC([tan])
471GCC_CHECK_MATH_FUNC([tanl])
472GCC_CHECK_MATH_FUNC([ctanf])
473GCC_CHECK_MATH_FUNC([ctan])
474GCC_CHECK_MATH_FUNC([ctanl])
475GCC_CHECK_MATH_FUNC([tanhf])
476GCC_CHECK_MATH_FUNC([tanh])
477GCC_CHECK_MATH_FUNC([tanhl])
478GCC_CHECK_MATH_FUNC([ctanhf])
479GCC_CHECK_MATH_FUNC([ctanh])
480GCC_CHECK_MATH_FUNC([ctanhl])
481GCC_CHECK_MATH_FUNC([truncf])
482GCC_CHECK_MATH_FUNC([trunc])
483GCC_CHECK_MATH_FUNC([truncl])
484GCC_CHECK_MATH_FUNC([erff])
485GCC_CHECK_MATH_FUNC([erf])
f38a14ca
TG
486GCC_CHECK_MATH_FUNC([erfcf])
487GCC_CHECK_MATH_FUNC([erfc])
488GCC_CHECK_MATH_FUNC([erfcl])
489GCC_CHECK_MATH_FUNC([j0f])
490GCC_CHECK_MATH_FUNC([j0])
f38a14ca
TG
491GCC_CHECK_MATH_FUNC([j1f])
492GCC_CHECK_MATH_FUNC([j1])
f38a14ca
TG
493GCC_CHECK_MATH_FUNC([jnf])
494GCC_CHECK_MATH_FUNC([jn])
495GCC_CHECK_MATH_FUNC([jnl])
496GCC_CHECK_MATH_FUNC([y0f])
497GCC_CHECK_MATH_FUNC([y0])
f38a14ca
TG
498GCC_CHECK_MATH_FUNC([y1f])
499GCC_CHECK_MATH_FUNC([y1])
f38a14ca
TG
500GCC_CHECK_MATH_FUNC([ynf])
501GCC_CHECK_MATH_FUNC([yn])
502GCC_CHECK_MATH_FUNC([ynl])
503GCC_CHECK_MATH_FUNC([tgamma])
504GCC_CHECK_MATH_FUNC([tgammaf])
f38a14ca
TG
505GCC_CHECK_MATH_FUNC([lgamma])
506GCC_CHECK_MATH_FUNC([lgammaf])
a2a2059f 507
db1cf15c 508# Check for GFORTRAN_C99_1.1 funcs
f38a14ca
TG
509GCC_CHECK_MATH_FUNC([cacos])
510GCC_CHECK_MATH_FUNC([cacosf])
511GCC_CHECK_MATH_FUNC([cacosh])
512GCC_CHECK_MATH_FUNC([cacoshf])
513GCC_CHECK_MATH_FUNC([cacoshl])
514GCC_CHECK_MATH_FUNC([cacosl])
515GCC_CHECK_MATH_FUNC([casin])
516GCC_CHECK_MATH_FUNC([casinf])
517GCC_CHECK_MATH_FUNC([casinh])
518GCC_CHECK_MATH_FUNC([casinhf])
519GCC_CHECK_MATH_FUNC([casinhl])
520GCC_CHECK_MATH_FUNC([casinl])
521GCC_CHECK_MATH_FUNC([catan])
522GCC_CHECK_MATH_FUNC([catanf])
523GCC_CHECK_MATH_FUNC([catanh])
524GCC_CHECK_MATH_FUNC([catanhf])
525GCC_CHECK_MATH_FUNC([catanhl])
526GCC_CHECK_MATH_FUNC([catanl])
db1cf15c 527
e097b4f1
DE
528# On AIX, clog is present in libm as __clog
529AC_CHECK_LIB([m],[__clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])])
530
1868599f
JJ
531GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2([copysign], [double])
532GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2([copysignl], [long double])
533GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1([fabs], [double])
534GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1([fabsl], [long double])
535
ad238e4f
FXC
536# Check whether the system has a working stat()
537LIBGFOR_CHECK_WORKING_STAT
538
db8092dc
FXC
539# Check whether __mingw_snprintf() is present
540LIBGFOR_CHECK_MINGW_SNPRINTF
541
87e6d9dc
TB
542# Check whether libquadmath should be used
543AC_ARG_ENABLE(libquadmath-support,
544AS_HELP_STRING([--disable-libquadmath-support],
545 [disable libquadmath support for Fortran]),
546ENABLE_LIBQUADMATH_SUPPORT=$enableval,
547ENABLE_LIBQUADMATH_SUPPORT=yes)
548enable_libquadmath_support=
549if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then
550 enable_libquadmath_support=no
551fi
552
553# Check whether we have a __float128 type, depends on enable_libquadmath_support
1ec601bf
FXC
554LIBGFOR_CHECK_FLOAT128
555
944b8b35
FXC
556# Check for GNU libc feenableexcept
557AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])])
558
5c30094f 559# At least for glibc, clock_gettime is in librt. But don't
2aadeae2
JB
560# pull that in if it still doesn't give us the function we want. This
561# test is copied from libgomp, and modified to not link in -lrt as
562# libgfortran calls clock_gettime via a weak reference if it's found
563# in librt.
deb9dd74 564if test "$ac_cv_func_clock_gettime" = no; then
b6e7a3d1 565 AC_CHECK_LIB(rt, clock_gettime,
2aadeae2
JB
566 [AC_DEFINE(HAVE_CLOCK_GETTIME_LIBRT, 1,
567 [Define to 1 if you have the `clock_gettime' function in librt.])])
b6e7a3d1
JB
568fi
569
3b14f664
FXC
570# Check for SysV fpsetmask
571LIBGFOR_CHECK_FPSETMASK
6faf4751 572AC_CHECK_TYPES([fp_except,fp_except_t], [], [], [[
67c4c164 573#ifdef HAVE_IEEEFP_H
6faf4751 574#include <ieeefp.h>
67c4c164 575#endif
6faf4751
FXC
576#include <math.h>
577]])
578AC_CHECK_TYPES([fp_rnd,fp_rnd_t], [], [], [[
67c4c164 579#ifdef HAVE_IEEEFP_H
6faf4751 580#include <ieeefp.h>
67c4c164 581#endif
6faf4751
FXC
582#include <math.h>
583]])
3b14f664 584
8b198102
FXC
585# Check whether we have fpsetsticky or fpresetsticky
586AC_CHECK_FUNC([fpsetsticky],[have_fpsetsticky=yes AC_DEFINE([HAVE_FPSETSTICKY],[1],[fpsetsticky is present])])
587AC_CHECK_FUNC([fpresetsticky],[have_fpresetsticky=yes AC_DEFINE([HAVE_FPRESETSTICKY],[1],[fpresetsticky is present])])
588
3b14f664
FXC
589# Check for AIX fp_trap and fp_enable
590AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])])
591AC_CHECK_FUNC([fp_enable],[have_fp_enable=yes AC_DEFINE([HAVE_FP_ENABLE],[1],[fp_enable is present])])
592
7b32a8f6
UB
593# Check if _SOFT_FLOAT is defined
594AC_CHECK_DEFINE([_SOFT_FLOAT],[have_soft_float=yes])
595
944b8b35
FXC
596# Runs configure.host to set up necessary host-dependent shell variables.
597# We then display a message about it, and propagate them through the
598# build chain.
599. ${srcdir}/configure.host
600AC_MSG_NOTICE([FPU dependent file will be ${fpu_host}.h])
8b198102 601AC_MSG_NOTICE([Support for IEEE modules: ${ieee_support}])
944b8b35
FXC
602FPU_HOST_HEADER=config/${fpu_host}.h
603AC_SUBST(FPU_HOST_HEADER)
604
8b198102
FXC
605# Whether we will build the IEEE modules
606AM_CONDITIONAL(IEEE_SUPPORT,[test x${ieee_support} = xyes])
607AC_SUBST(IEEE_SUPPORT)
608
9fc77574
KK
609# Some targets require additional compiler options for IEEE compatibility.
610IEEE_FLAGS="${ieee_flags}"
611AC_SUBST(IEEE_FLAGS)
612
47ddb895
DE
613# Conditionalize the makefile for this target machine.
614tmake_file_=
615for f in ${tmake_file}
616do
617 if test -f ${srcdir}/config/$f
618 then
619 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
620 fi
621done
622tmake_file="${tmake_file_}"
623AC_SUBST(tmake_file)
624
23e6d4a5
JB
625
626# Check for POSIX getpwuid_r
627#
628# There are two versions of getpwuid_r, the POSIX one with 5
629# arguments, and another one with 4 arguments used by at least HP-UX
630# 10.2.
631if test "$ac_cv_func_getpwuid_r" = "yes"; then
632 AC_CACHE_CHECK([POSIX version of getpwuid_r with 5 arguments], libgfor_cv_posix_getpwuid_r, [
633 AC_LINK_IFELSE([AC_LANG_PROGRAM([
634#include <stdio.h>
635#include <sys/types.h>
636#include <pwd.h>], [
637 getpwuid_r(0, NULL, NULL, 0, NULL);
638 ])], [libgfor_cv_posix_getpwuid_r="yes"], [libgfor_cv_posix_getpwuid_r="no"])])
639fi
640if test "$libgfor_cv_posix_getpwuid_r" = "yes"; then
641 AC_DEFINE([HAVE_POSIX_GETPWUID_R], [1], [Define to 1 if we have POSIX getpwuid_r which takes 5 arguments.])
642fi
643
644
7d7b8bfe
RH
645# Check out attribute support.
646LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY
7d7b8bfe
RH
647LIBGFOR_CHECK_ATTRIBUTE_ALIAS
648
0536d5b3
JB
649# Check out atomic builtins support.
650LIBGFOR_CHECK_ATOMIC_FETCH_ADD
5e805e44 651
6a822a74
FXC
652# Check out #pragma weak.
653LIBGFOR_GTHREAD_WEAK
654
e7854993
FXC
655# Check out weakref support.
656LIBGFOR_CHECK_WEAKREF
5e805e44 657
10c682a0
FXC
658# Various other checks on target
659LIBGFOR_CHECK_UNLINK_OPEN_FILE
660
3c127520
FXC
661# Check whether line terminator is LF or CRLF
662LIBGFOR_CHECK_CRLF
663
31cfd832
TK
664# Check whether we support AVX extensions
665LIBGFOR_CHECK_AVX
666
667# Check wether we support AVX2 extensions
668LIBGFOR_CHECK_AVX2
669
670# Check wether we support AVX512f extensions
671LIBGFOR_CHECK_AVX512F
672
1d5cf7fc
TK
673# Check for FMA3 extensions
674LIBGFOR_CHECK_FMA3
675
676# Check for FMA4 extensions
677LIBGFOR_CHECK_FMA4
678
679# Check if AVX128 works
680LIBGFOR_CHECK_AVX128
681
3c36aa6b
JJ
682# Determine what GCC version number to use in filesystem paths.
683GCC_BASE_VER
684
96b8a615
AJ
685AC_CACHE_SAVE
686
687if test ${multilib} = yes; then
688 multilib_arg="--enable-multilib"
689else
690 multilib_arg=
691fi
692
1ec601bf
FXC
693# Write our Makefile and spec file.
694AC_CONFIG_FILES([
695Makefile
696libgfortran.spec
697])
96b8a615 698AC_OUTPUT