Fix ICE in output_rnglists, at dwarf2out.c:12294
[official-gcc.git] / libgfortran / configure.ac
blob8961e314d82b47dade89452a213481c8cc077e57
1 # Process this file with autoconf to produce a configure script, like so:
2 # aclocal && autoconf && autoheader && automake
4 AC_INIT([GNU Fortran Runtime Library], 0.3,,[libgfortran])
5 AC_CONFIG_HEADER(config.h)
6 GCC_TOPLEV_SUBDIRS
8 # -------
9 # Options
10 # -------
12 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
13 AC_ARG_ENABLE(version-specific-runtime-libs,
14 AS_HELP_STRING([--enable-version-specific-runtime-libs],
15   [specify that runtime libraries should be installed in a compiler-specific directory]),
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])
22 AC_MSG_RESULT($version_specific_libs)
24 # Build with intermodule optimisations
25 AC_MSG_CHECKING([for --enable-intermodule])
26 AC_ARG_ENABLE(intermodule,
27 AS_HELP_STRING([--enable-intermodule],[build the library in one step]),
28 [case "$enable_intermodule" in
29   yes) onestep="-onestep";;
30     *) onestep="";;
31 esac],
32 [onestep=""])
33 AC_MSG_RESULT($enable_intermodule)
34 AM_CONDITIONAL(onestep,[test x$onestep = x-onestep])
35 AC_SUBST(onestep)
37 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
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/.
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.  :-)
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.
50 # Do not delete or change the following two lines.  For why, see
51 # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
52 AC_CANONICAL_SYSTEM
53 ACX_NONCANONICAL_TARGET
55 target_alias=${target_alias-$host_alias}
56 AC_SUBST(target_alias)
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.
60 #  1.9.6:  minimum required version
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.
66 #  no-dist:  we don't want 'dist' and related rules.
67 #  -Wall:  turns on all automake warnings...
68 #  -Wno-portability:  ...except this one, since GNU make is required.
69 AM_INIT_AUTOMAKE([1.9.6 no-define foreign no-dist -Wall -Wno-portability])
71 AM_MAINTAINER_MODE
72 AM_ENABLE_MULTILIB(, ..)
74 # Handy for debugging:
75 #AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5
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.
80 if test "$build" != "$host"; then
81   LIBGFOR_IS_NATIVE=false
82   GCC_NO_EXECUTABLES
83 else
84   LIBGFOR_IS_NATIVE=true
87 AC_USE_SYSTEM_EXTENSIONS
89 GCC_WITH_TOOLEXECLIBDIR
91 # Calculate toolexeclibdir
92 # Also toolexecdir, though it's only used in toolexeclibdir
93 case ${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)'
99     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
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)'
106       case ${with_toolexeclibdir} in
107         no)
108           toolexeclibdir='$(toolexecdir)/lib'
109           ;;
110         *)
111           toolexeclibdir=${with_toolexeclibdir}
112           ;;
113       esac
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     ;;
124 esac
125 AC_SUBST(toolexecdir)
126 AC_SUBST(toolexeclibdir)
128 # Create a spec file, so that compile/link tests don't fail
129 test -f libgfortran.spec || touch libgfortran.spec
131 AC_LANG_C
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.
138 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
139 m4_define([_AC_ARG_VAR_PRECIOUS],[])
140 AC_PROG_CC
141 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
143 AC_SUBST(CFLAGS)
145 AM_PROG_CC_C_O
147 # Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
148 if test "x$GCC" = "xyes"; then
149   AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
150   ## We like to use C11 and C99 routines when available.  This makes
151   ## sure that
152   ## __STDC_VERSION__ is set such that libc includes make them available.
153   AM_CFLAGS="-std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Werror=vla"
154   ## Compile the following tests with the same system header contents
155   ## that we'll encounter when compiling our own source files.
156   CFLAGS="-std=gnu11 $CFLAGS"
159 # Add CET specific flags if CET is enabled
160 GCC_CET_FLAGS(CET_FLAGS)
161 AM_FCFLAGS="$AM_FCFLAGS $CET_FLAGS"
162 AM_CFLAGS="$AM_CFLAGS $CET_FLAGS"
163 CFLAGS="$CFLAGS $CET_FLAGS"
165 AC_SUBST(AM_FCFLAGS)
166 AC_SUBST(AM_CFLAGS)
167 AC_SUBST(CFLAGS)
169 # Check for symbol versioning (copied from libssp).
170 AC_MSG_CHECKING([whether symbol versioning is supported])
171 AC_ARG_ENABLE(symvers,
172 AS_HELP_STRING([--disable-symvers],
173   [disable symbol versioning for libgfortran]),
174 gfortran_use_symver=$enableval,
175 gfortran_use_symver=yes)
176 if test "x$gfortran_use_symver" != xno; then
177   save_LDFLAGS="$LDFLAGS"
178   LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
179   cat > conftest.map <<EOF
180 FOO_1.0 {
181   global: *foo*; bar; local: *;
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
192 FOO_1.0 {
193   global: foo; local: *;
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"
202 AC_MSG_RESULT($gfortran_use_symver)
203 AM_CONDITIONAL(LIBGFOR_USE_SYMVER, [test "x$gfortran_use_symver" != xno])
204 AM_CONDITIONAL(LIBGFOR_USE_SYMVER_GNU, [test "x$gfortran_use_symver" = xgnu])
205 AM_CONDITIONAL(LIBGFOR_USE_SYMVER_SUN, [test "x$gfortran_use_symver" = xsun])
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
217 AM_CONDITIONAL(LIBGFOR_MINIMAL, [test "x${target_cpu}" = xnvptx])
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.
222 LIBGOMP_CHECKED_INT_KINDS="1 2 4 8 16"
223 LIBGOMP_CHECKED_REAL_KINDS="4 8 10 16"
225 if test "x${target_cpu}" = xamdgcn; then
226   # amdgcn only has limited support for __int128.
227   LIBGOMP_CHECKED_INT_KINDS="1 2 4 8"
229 AC_SUBST(LIBGOMP_CHECKED_INT_KINDS)
230 AC_SUBST(LIBGOMP_CHECKED_REAL_KINDS)
232 # Figure out whether the compiler supports "-ffunction-sections -fdata-sections",
233 # similarly to how libstdc++ does it
234 ac_test_CFLAGS="${CFLAGS+set}"
235 ac_save_CFLAGS="$CFLAGS"
237 # Check for -ffunction-sections -fdata-sections
238 AC_MSG_CHECKING([for gcc that supports -ffunction-sections -fdata-sections])
239 CFLAGS='-Werror -ffunction-sections -fdata-sections'
240 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int foo;]])], [ac_fdsections=yes], [ac_fdsections=no])
241 if test "$ac_test_CFLAGS" = set; then
242   CFLAGS="$ac_save_CFLAGS"
243 else
244   # this is the suspicious part
245   CFLAGS=""
247 if test x"$ac_fdsections" = x"yes"; then
248   SECTION_FLAGS='-ffunction-sections -fdata-sections'
250 AC_MSG_RESULT($ac_fdsections)
251 AC_SUBST(SECTION_FLAGS)
253 # Check linker hardware capability support.
254 GCC_CHECK_LINKER_HWCAP
256 # Find other programs we need.
257 AC_CHECK_TOOL(AS, as)
258 AC_CHECK_TOOL(AR, ar)
259 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
260 AC_PROG_MAKE_SET
261 AC_PROG_INSTALL
263 # Configure libtool
264 #AC_MSG_NOTICE([====== Starting libtool configuration])
265 AC_LIBTOOL_DLOPEN
266 AM_PROG_LIBTOOL
267 ACX_LT_HOST_FLAGS
268 AC_SUBST(enable_shared)
269 AC_SUBST(enable_static)
270 #AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
272 # We need gfortran to compile parts of the library
273 #AC_PROG_FC(gfortran)
274 FC="$GFORTRAN"
275 AC_PROG_FC(gfortran)
277 # extra LD Flags which are required for targets
278 case "${host}" in
279   *-darwin*)
280     # Darwin needs -single_module when linking libgfortran
281     extra_ldflags_libgfortran=-Wl,-single_module
282     ;;
283 esac
284 AC_SUBST(extra_ldflags_libgfortran)
286 # We need a working compiler at that point, otherwise give a clear
287 # error message and bail out.
288 LIBGFOR_WORKING_GFORTRAN
290 AC_SYS_LARGEFILE
292 # Types
293 AC_TYPE_OFF_T
294 AC_TYPE_INTPTR_T
295 AC_TYPE_UINTPTR_T
296 AC_CHECK_TYPES([ptrdiff_t])
298 # check header files (we assume C89 is available, so don't check for that)
299 AC_CHECK_HEADERS_ONCE(unistd.h sys/random.h sys/time.h sys/times.h \
300 sys/resource.h sys/types.h sys/stat.h sys/uio.h sys/wait.h \
301 floatingpoint.h ieeefp.h fenv.h fptrap.h \
302 fpxcp.h pwd.h complex.h xlocale.h)
304 GCC_HEADER_STDINT(gstdint.h)
306 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev])
308 case "${host}--x${with_newlib}" in
309   mips*--xyes)
310     hardwire_newlib=1;;
311   nvptx*--xyes)
312     hardwire_newlib=1;;
313 esac
315 # Check for library functions.
316 if test "${hardwire_newlib:-0}" -eq 1; then
317    # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
318    # may not work correctly, because the compiler may not be able to
319    # link executables.
320    AC_DEFINE(HAVE_MKSTEMP, 1, [Define if you have mkstemp.])
321    AC_DEFINE(HAVE_STRTOF, 1, [Define if you have strtof.])
322    AC_DEFINE(HAVE_SNPRINTF, 1, [Define if you have snprintf.])
323    AC_DEFINE(HAVE_VSNPRINTF, 1, [Define if you have vsnprintf.])
324    AC_DEFINE(HAVE_LOCALTIME_R, 1, [Define if you have localtime_r.])
325    AC_DEFINE(HAVE_GMTIME_R, 1, [Define if you have gmtime_r.])
326    AC_DEFINE(HAVE_STRNLEN, 1, [Define if you have strnlen.])
327    AC_DEFINE(HAVE_STRNDUP, 1, [Define if you have strndup.])
329    # At some point, we should differentiate between architectures
330    # like x86, which have long double versions, and alpha/powerpc/etc.,
331    # which don't. For the time being, punt.
332    if test x"long_double_math_on_this_cpu" = x"yes"; then
333      AC_DEFINE(HAVE_STRTOLD, 1, [Define if you have strtold.])
334    fi
335 else
336    AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \
337    ftruncate chsize chdir getentropy getlogin gethostname kill link symlink \
338    sleep ttyname sigaction waitpid \
339    alarm access fork posix_spawn setmode fcntl writev \
340    gettimeofday stat fstat lstat getpwuid vsnprintf dup \
341    getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \
342    getgid getpid getuid geteuid umask getegid \
343    secure_getenv __secure_getenv mkostemp strnlen strndup newlocale \
344    freelocale uselocale strerror_l)
347 # Check strerror_r, cannot be above as versions with two and three arguments exist
348 LIBGFOR_CHECK_STRERROR_R
350 # Check for C99 (and other IEEE) math functions
351 GCC_CHECK_MATH_FUNC([acosf])
352 GCC_CHECK_MATH_FUNC([acos])
353 GCC_CHECK_MATH_FUNC([acosl])
354 GCC_CHECK_MATH_FUNC([acoshf])
355 GCC_CHECK_MATH_FUNC([acosh])
356 GCC_CHECK_MATH_FUNC([acoshl])
357 GCC_CHECK_MATH_FUNC([asinf])
358 GCC_CHECK_MATH_FUNC([asin])
359 GCC_CHECK_MATH_FUNC([asinl])
360 GCC_CHECK_MATH_FUNC([asinhf])
361 GCC_CHECK_MATH_FUNC([asinh])
362 GCC_CHECK_MATH_FUNC([asinhl])
363 GCC_CHECK_MATH_FUNC([atan2f])
364 GCC_CHECK_MATH_FUNC([atan2])
365 GCC_CHECK_MATH_FUNC([atan2l])
366 GCC_CHECK_MATH_FUNC([atanf])
367 GCC_CHECK_MATH_FUNC([atan])
368 GCC_CHECK_MATH_FUNC([atanl])
369 GCC_CHECK_MATH_FUNC([atanhf])
370 GCC_CHECK_MATH_FUNC([atanh])
371 GCC_CHECK_MATH_FUNC([atanhl])
372 GCC_CHECK_MATH_FUNC([cargf])
373 GCC_CHECK_MATH_FUNC([carg])
374 GCC_CHECK_MATH_FUNC([cargl])
375 GCC_CHECK_MATH_FUNC([ceilf])
376 GCC_CHECK_MATH_FUNC([ceil])
377 GCC_CHECK_MATH_FUNC([ceill])
378 GCC_CHECK_MATH_FUNC([copysignf])
379 GCC_CHECK_MATH_FUNC([copysign])
380 GCC_CHECK_MATH_FUNC([copysignl])
381 GCC_CHECK_MATH_FUNC([cosf])
382 GCC_CHECK_MATH_FUNC([cos])
383 GCC_CHECK_MATH_FUNC([cosl])
384 GCC_CHECK_MATH_FUNC([ccosf])
385 GCC_CHECK_MATH_FUNC([ccos])
386 GCC_CHECK_MATH_FUNC([ccosl])
387 GCC_CHECK_MATH_FUNC([coshf])
388 GCC_CHECK_MATH_FUNC([cosh])
389 GCC_CHECK_MATH_FUNC([coshl])
390 GCC_CHECK_MATH_FUNC([ccoshf])
391 GCC_CHECK_MATH_FUNC([ccosh])
392 GCC_CHECK_MATH_FUNC([ccoshl])
393 GCC_CHECK_MATH_FUNC([expf])
394 GCC_CHECK_MATH_FUNC([exp])
395 GCC_CHECK_MATH_FUNC([expl])
396 GCC_CHECK_MATH_FUNC([cexpf])
397 GCC_CHECK_MATH_FUNC([cexp])
398 GCC_CHECK_MATH_FUNC([cexpl])
399 GCC_CHECK_MATH_FUNC([fabsf])
400 GCC_CHECK_MATH_FUNC([fabs])
401 GCC_CHECK_MATH_FUNC([fabsl])
402 GCC_CHECK_MATH_FUNC([cabsf])
403 GCC_CHECK_MATH_FUNC([cabs])
404 GCC_CHECK_MATH_FUNC([cabsl])
405 GCC_CHECK_MATH_FUNC([floorf])
406 GCC_CHECK_MATH_FUNC([floor])
407 GCC_CHECK_MATH_FUNC([floorl])
408 GCC_CHECK_MATH_FUNC([fmaf])
409 GCC_CHECK_MATH_FUNC([fma])
410 GCC_CHECK_MATH_FUNC([fmal])
411 GCC_CHECK_MATH_FUNC([fmodf])
412 GCC_CHECK_MATH_FUNC([fmod])
413 GCC_CHECK_MATH_FUNC([fmodl])
414 GCC_CHECK_MATH_FUNC([frexpf])
415 GCC_CHECK_MATH_FUNC([frexp])
416 GCC_CHECK_MATH_FUNC([frexpl])
417 GCC_CHECK_MATH_FUNC([hypotf])
418 GCC_CHECK_MATH_FUNC([hypot])
419 GCC_CHECK_MATH_FUNC([hypotl])
420 GCC_CHECK_MATH_FUNC([ldexpf])
421 GCC_CHECK_MATH_FUNC([ldexp])
422 GCC_CHECK_MATH_FUNC([ldexpl])
423 GCC_CHECK_MATH_FUNC([logf])
424 GCC_CHECK_MATH_FUNC([log])
425 GCC_CHECK_MATH_FUNC([logl])
426 GCC_CHECK_MATH_FUNC([clogf])
427 GCC_CHECK_MATH_FUNC([clog])
428 GCC_CHECK_MATH_FUNC([clogl])
429 GCC_CHECK_MATH_FUNC([log10f])
430 GCC_CHECK_MATH_FUNC([log10])
431 GCC_CHECK_MATH_FUNC([log10l])
432 GCC_CHECK_MATH_FUNC([clog10f])
433 GCC_CHECK_MATH_FUNC([clog10])
434 GCC_CHECK_MATH_FUNC([clog10l])
435 GCC_CHECK_MATH_FUNC([nextafterf])
436 GCC_CHECK_MATH_FUNC([nextafter])
437 GCC_CHECK_MATH_FUNC([nextafterl])
438 GCC_CHECK_MATH_FUNC([powf])
439 GCC_CHECK_MATH_FUNC([pow])
440 GCC_CHECK_MATH_FUNC([cpowf])
441 GCC_CHECK_MATH_FUNC([cpow])
442 GCC_CHECK_MATH_FUNC([cpowl])
443 GCC_CHECK_MATH_FUNC([roundf])
444 GCC_CHECK_MATH_FUNC([round])
445 GCC_CHECK_MATH_FUNC([roundl])
446 GCC_CHECK_MATH_FUNC([lroundf])
447 GCC_CHECK_MATH_FUNC([lround])
448 GCC_CHECK_MATH_FUNC([lroundl])
449 GCC_CHECK_MATH_FUNC([llroundf])
450 GCC_CHECK_MATH_FUNC([llround])
451 GCC_CHECK_MATH_FUNC([llroundl])
452 GCC_CHECK_MATH_FUNC([scalbnf])
453 GCC_CHECK_MATH_FUNC([scalbn])
454 GCC_CHECK_MATH_FUNC([scalbnl])
455 GCC_CHECK_MATH_FUNC([sinf])
456 GCC_CHECK_MATH_FUNC([sin])
457 GCC_CHECK_MATH_FUNC([sinl])
458 GCC_CHECK_MATH_FUNC([csinf])
459 GCC_CHECK_MATH_FUNC([csin])
460 GCC_CHECK_MATH_FUNC([csinl])
461 GCC_CHECK_MATH_FUNC([sinhf])
462 GCC_CHECK_MATH_FUNC([sinh])
463 GCC_CHECK_MATH_FUNC([sinhl])
464 GCC_CHECK_MATH_FUNC([csinhf])
465 GCC_CHECK_MATH_FUNC([csinh])
466 GCC_CHECK_MATH_FUNC([csinhl])
467 GCC_CHECK_MATH_FUNC([sqrtf])
468 GCC_CHECK_MATH_FUNC([sqrt])
469 GCC_CHECK_MATH_FUNC([sqrtl])
470 GCC_CHECK_MATH_FUNC([csqrtf])
471 GCC_CHECK_MATH_FUNC([csqrt])
472 GCC_CHECK_MATH_FUNC([csqrtl])
473 GCC_CHECK_MATH_FUNC([tanf])
474 GCC_CHECK_MATH_FUNC([tan])
475 GCC_CHECK_MATH_FUNC([tanl])
476 GCC_CHECK_MATH_FUNC([ctanf])
477 GCC_CHECK_MATH_FUNC([ctan])
478 GCC_CHECK_MATH_FUNC([ctanl])
479 GCC_CHECK_MATH_FUNC([tanhf])
480 GCC_CHECK_MATH_FUNC([tanh])
481 GCC_CHECK_MATH_FUNC([tanhl])
482 GCC_CHECK_MATH_FUNC([ctanhf])
483 GCC_CHECK_MATH_FUNC([ctanh])
484 GCC_CHECK_MATH_FUNC([ctanhl])
485 GCC_CHECK_MATH_FUNC([truncf])
486 GCC_CHECK_MATH_FUNC([trunc])
487 GCC_CHECK_MATH_FUNC([truncl])
488 GCC_CHECK_MATH_FUNC([erff])
489 GCC_CHECK_MATH_FUNC([erf])
490 GCC_CHECK_MATH_FUNC([erfcf])
491 GCC_CHECK_MATH_FUNC([erfc])
492 GCC_CHECK_MATH_FUNC([erfcl])
493 GCC_CHECK_MATH_FUNC([j0f])
494 GCC_CHECK_MATH_FUNC([j0])
495 GCC_CHECK_MATH_FUNC([j1f])
496 GCC_CHECK_MATH_FUNC([j1])
497 GCC_CHECK_MATH_FUNC([jnf])
498 GCC_CHECK_MATH_FUNC([jn])
499 GCC_CHECK_MATH_FUNC([jnl])
500 GCC_CHECK_MATH_FUNC([y0f])
501 GCC_CHECK_MATH_FUNC([y0])
502 GCC_CHECK_MATH_FUNC([y1f])
503 GCC_CHECK_MATH_FUNC([y1])
504 GCC_CHECK_MATH_FUNC([ynf])
505 GCC_CHECK_MATH_FUNC([yn])
506 GCC_CHECK_MATH_FUNC([ynl])
507 GCC_CHECK_MATH_FUNC([tgamma])
508 GCC_CHECK_MATH_FUNC([tgammaf])
509 GCC_CHECK_MATH_FUNC([lgamma])
510 GCC_CHECK_MATH_FUNC([lgammaf])
512 # Check for GFORTRAN_C99_1.1 funcs
513 GCC_CHECK_MATH_FUNC([cacos])
514 GCC_CHECK_MATH_FUNC([cacosf])
515 GCC_CHECK_MATH_FUNC([cacosh])
516 GCC_CHECK_MATH_FUNC([cacoshf])
517 GCC_CHECK_MATH_FUNC([cacoshl])
518 GCC_CHECK_MATH_FUNC([cacosl])
519 GCC_CHECK_MATH_FUNC([casin])
520 GCC_CHECK_MATH_FUNC([casinf])
521 GCC_CHECK_MATH_FUNC([casinh])
522 GCC_CHECK_MATH_FUNC([casinhf])
523 GCC_CHECK_MATH_FUNC([casinhl])
524 GCC_CHECK_MATH_FUNC([casinl])
525 GCC_CHECK_MATH_FUNC([catan])
526 GCC_CHECK_MATH_FUNC([catanf])
527 GCC_CHECK_MATH_FUNC([catanh])
528 GCC_CHECK_MATH_FUNC([catanhf])
529 GCC_CHECK_MATH_FUNC([catanhl])
530 GCC_CHECK_MATH_FUNC([catanl])
532 # On AIX, clog is present in libm as __clog
533 AC_CHECK_LIB([m],[__clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])])
535 GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2([copysign], [double])
536 GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2([copysignl], [long double])
537 GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1([fabs], [double])
538 GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1([fabsl], [long double])
540 # Check whether the system has a working stat()
541 LIBGFOR_CHECK_WORKING_STAT
543 # Check whether __mingw_snprintf() is present
544 LIBGFOR_CHECK_MINGW_SNPRINTF
546 # Check whether libquadmath should be used
547 AC_ARG_ENABLE(libquadmath-support,
548 AS_HELP_STRING([--disable-libquadmath-support],
549   [disable libquadmath support for Fortran]),
550 ENABLE_LIBQUADMATH_SUPPORT=$enableval,
551 ENABLE_LIBQUADMATH_SUPPORT=yes)
552 enable_libquadmath_support=
553 if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then
554   enable_libquadmath_support=no
557 # Check whether we have a __float128 type, depends on enable_libquadmath_support
558 LIBGFOR_CHECK_FLOAT128
560 # Check for GNU libc feenableexcept
561 AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])])
563 # At least for glibc, clock_gettime is in librt.  But don't
564 # pull that in if it still doesn't give us the function we want.  This
565 # test is copied from libgomp, and modified to not link in -lrt as
566 # libgfortran calls clock_gettime via a weak reference if it's found
567 # in librt.
568 if test "$ac_cv_func_clock_gettime" = no; then
569   AC_CHECK_LIB(rt, clock_gettime,
570     [AC_DEFINE(HAVE_CLOCK_GETTIME_LIBRT, 1,
571                [Define to 1 if you have the `clock_gettime' function in librt.])])
574 # Check for SysV fpsetmask
575 LIBGFOR_CHECK_FPSETMASK
576 AC_CHECK_TYPES([fp_except,fp_except_t], [], [], [[
577 #ifdef HAVE_IEEEFP_H
578 #include <ieeefp.h>
579 #endif
580 #include <math.h>
582 AC_CHECK_TYPES([fp_rnd,fp_rnd_t], [], [], [[
583 #ifdef HAVE_IEEEFP_H
584 #include <ieeefp.h>
585 #endif
586 #include <math.h>
589 # Check whether we have fpsetsticky or fpresetsticky
590 AC_CHECK_FUNC([fpsetsticky],[have_fpsetsticky=yes AC_DEFINE([HAVE_FPSETSTICKY],[1],[fpsetsticky is present])])
591 AC_CHECK_FUNC([fpresetsticky],[have_fpresetsticky=yes AC_DEFINE([HAVE_FPRESETSTICKY],[1],[fpresetsticky is present])])
593 # Check for AIX fp_trap and fp_enable
594 AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])])
595 AC_CHECK_FUNC([fp_enable],[have_fp_enable=yes AC_DEFINE([HAVE_FP_ENABLE],[1],[fp_enable is present])])
597 # Check if _SOFT_FLOAT is defined
598 AC_CHECK_DEFINE([_SOFT_FLOAT],[have_soft_float=yes])
600 # Runs configure.host to set up necessary host-dependent shell variables.
601 # We then display a message about it, and propagate them through the
602 # build chain.
603 . ${srcdir}/configure.host
604 AC_MSG_NOTICE([FPU dependent file will be ${fpu_host}.h])
605 AC_MSG_NOTICE([Support for IEEE modules: ${ieee_support}])
606 FPU_HOST_HEADER=config/${fpu_host}.h
607 AC_SUBST(FPU_HOST_HEADER)
609 # Whether we will build the IEEE modules
610 AM_CONDITIONAL(IEEE_SUPPORT,[test x${ieee_support} = xyes])
611 AC_SUBST(IEEE_SUPPORT)
613 # Some targets require additional compiler options for IEEE compatibility.
614 IEEE_FLAGS="${ieee_flags}"
615 AC_SUBST(IEEE_FLAGS)
617 # Conditionalize the makefile for this target machine.
618 tmake_file_=
619 for f in ${tmake_file}
621         if test -f ${srcdir}/config/$f
622         then
623                 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
624         fi
625 done
626 tmake_file="${tmake_file_}"
627 AC_SUBST(tmake_file)
630 # Check for POSIX getpwuid_r 
632 # There are two versions of getpwuid_r, the POSIX one with 5
633 # arguments, and another one with 4 arguments used by at least HP-UX
634 # 10.2.
635 if test "$ac_cv_func_getpwuid_r" = "yes"; then
636    AC_CACHE_CHECK([POSIX version of getpwuid_r with 5 arguments], libgfor_cv_posix_getpwuid_r, [
637    AC_LINK_IFELSE([AC_LANG_PROGRAM([
638 #include <stdio.h>
639 #include <sys/types.h>
640 #include <pwd.h>], [
641     getpwuid_r(0, NULL, NULL, 0, NULL);
642     ])],  [libgfor_cv_posix_getpwuid_r="yes"], [libgfor_cv_posix_getpwuid_r="no"])])
644 if test "$libgfor_cv_posix_getpwuid_r" = "yes"; then
645     AC_DEFINE([HAVE_POSIX_GETPWUID_R], [1], [Define to 1 if we have POSIX getpwuid_r which takes 5 arguments.])
649 # Check out attribute support.
650 LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY
651 LIBGFOR_CHECK_ATTRIBUTE_ALIAS
653 # Check out atomic builtins support.
654 LIBGFOR_CHECK_ATOMIC_FETCH_ADD
656 # Check out #pragma weak.
657 LIBGFOR_GTHREAD_WEAK
659 # Check out weakref support.
660 LIBGFOR_CHECK_WEAKREF
662 # Various other checks on target
663 LIBGFOR_CHECK_UNLINK_OPEN_FILE
665 # Check whether line terminator is LF or CRLF
666 LIBGFOR_CHECK_CRLF
668 # Check whether we support AVX extensions
669 LIBGFOR_CHECK_AVX
671 # Check wether we support AVX2 extensions
672 LIBGFOR_CHECK_AVX2
674 # Check wether we support AVX512f extensions
675 LIBGFOR_CHECK_AVX512F
677 # Check for FMA3 extensions
678 LIBGFOR_CHECK_FMA3
680 # Check for FMA4 extensions
681 LIBGFOR_CHECK_FMA4
683 # Check if AVX128 works
684 LIBGFOR_CHECK_AVX128
686 # Determine what GCC version number to use in filesystem paths.
687 GCC_BASE_VER
689 AC_CACHE_SAVE
691 if test ${multilib} = yes; then
692   multilib_arg="--enable-multilib"
693 else
694   multilib_arg=
697 # Write our Makefile and spec file.
698 AC_CONFIG_FILES([
699 Makefile
700 libgfortran.spec
702 AC_OUTPUT