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