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