Fix build on sparc64-linux-gnu.
[official-gcc.git] / libgfortran / configure.ac
blob76007d38f6fbe7bcc7883d466c5e6e78c26e19c9
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 # Calculate toolexeclibdir
90 # Also toolexecdir, though it's only used in toolexeclibdir
91 case ${version_specific_libs} in
92   yes)
93     # Need the gcc compiler version to know where to install libraries
94     # and header files if --enable-version-specific-runtime-libs option
95     # is selected.
96     toolexecdir='$(libdir)/gcc/$(target_alias)'
97     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
98     ;;
99   no)
100     if test -n "$with_cross_host" &&
101        test x"$with_cross_host" != x"no"; then
102       # Install a library built with a cross compiler in tooldir, not libdir.
103       toolexecdir='$(exec_prefix)/$(target_alias)'
104       toolexeclibdir='$(toolexecdir)/lib'
105     else
106       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
107       toolexeclibdir='$(libdir)'
108     fi
109     multi_os_directory=`$CC -print-multi-os-directory`
110     case $multi_os_directory in
111       .) ;; # Avoid trailing /.
112       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
113     esac
114     ;;
115 esac
116 AC_SUBST(toolexecdir)
117 AC_SUBST(toolexeclibdir)
119 # Create a spec file, so that compile/link tests don't fail
120 test -f libgfortran.spec || touch libgfortran.spec
122 AC_LANG_C
123 # Check the compiler.
124 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
125 # We must force CC to /not/ be precious variables; otherwise
126 # the wrong, non-multilib-adjusted value will be used in multilibs.
127 # As a side effect, we have to subst CFLAGS ourselves.
129 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
130 m4_define([_AC_ARG_VAR_PRECIOUS],[])
131 AC_PROG_CC
132 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
134 AC_SUBST(CFLAGS)
136 AM_PROG_CC_C_O
138 # Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
139 if test "x$GCC" = "xyes"; then
140   AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
141   ## We like to use C11 and C99 routines when available.  This makes
142   ## sure that
143   ## __STDC_VERSION__ is set such that libc includes make them available.
144   AM_CFLAGS="-std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Werror=vla"
145   ## Compile the following tests with the same system header contents
146   ## that we'll encounter when compiling our own source files.
147   CFLAGS="-std=gnu11 $CFLAGS"
150 # Add CET specific flags if CET is enabled
151 GCC_CET_FLAGS(CET_FLAGS)
152 AM_FCFLAGS="$AM_FCFLAGS $CET_FLAGS"
153 AM_CFLAGS="$AM_CFLAGS $CET_FLAGS"
154 CFLAGS="$CFLAGS $CET_FLAGS"
156 AC_SUBST(AM_FCFLAGS)
157 AC_SUBST(AM_CFLAGS)
158 AC_SUBST(CFLAGS)
160 # Check for symbol versioning (copied from libssp).
161 AC_MSG_CHECKING([whether symbol versioning is supported])
162 AC_ARG_ENABLE(symvers,
163 AS_HELP_STRING([--disable-symvers],
164   [disable symbol versioning for libgfortran]),
165 gfortran_use_symver=$enableval,
166 gfortran_use_symver=yes)
167 if test "x$gfortran_use_symver" != xno; then
168   save_LDFLAGS="$LDFLAGS"
169   LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
170   cat > conftest.map <<EOF
171 FOO_1.0 {
172   global: *foo*; bar; local: *;
175   AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]],[[]])],[gfortran_use_symver=gnu],[gfortran_use_symver=no])
176   if test x$gfortran_use_symver = xno; then
177     case "$target_os" in
178       solaris2*)
179         LDFLAGS="$save_LDFLAGS"
180         LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
181         # Sun ld cannot handle wildcards and treats all entries as undefined.
182         cat > conftest.map <<EOF
183 FOO_1.0 {
184   global: foo; local: *;
187         AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]],[[]])],[gfortran_use_symver=sun],[gfortran_use_symver=no])
188         ;;
189     esac
190   fi
191   LDFLAGS="$save_LDFLAGS"
193 AC_MSG_RESULT($gfortran_use_symver)
194 AM_CONDITIONAL(LIBGFOR_USE_SYMVER, [test "x$gfortran_use_symver" != xno])
195 AM_CONDITIONAL(LIBGFOR_USE_SYMVER_GNU, [test "x$gfortran_use_symver" = xgnu])
196 AM_CONDITIONAL(LIBGFOR_USE_SYMVER_SUN, [test "x$gfortran_use_symver" = xsun])
198 # For GPU offloading, not everything in libfortran can be supported.
199 # Currently, the only target that has this problem is nvptx.  The
200 # following is a (partial) list of features that are unsupportable on
201 # this particular target:
202 # * Constructors
203 # * alloca
204 # * C library support for I/O, with printf as the one notable exception
205 # * C library support for other features such as signal, environment
206 #   variables, time functions
208 AM_CONDITIONAL(LIBGFOR_MINIMAL, [test "x${target_cpu}" = xnvptx])
210 # Figure out whether the compiler supports "-ffunction-sections -fdata-sections",
211 # similarly to how libstdc++ does it
212 ac_test_CFLAGS="${CFLAGS+set}"
213 ac_save_CFLAGS="$CFLAGS"
215 # Check for -ffunction-sections -fdata-sections
216 AC_MSG_CHECKING([for gcc that supports -ffunction-sections -fdata-sections])
217 CFLAGS='-Werror -ffunction-sections -fdata-sections'
218 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int foo;]])], [ac_fdsections=yes], [ac_fdsections=no])
219 if test "$ac_test_CFLAGS" = set; then
220   CFLAGS="$ac_save_CFLAGS"
221 else
222   # this is the suspicious part
223   CFLAGS=""
225 if test x"$ac_fdsections" = x"yes"; then
226   SECTION_FLAGS='-ffunction-sections -fdata-sections'
228 AC_MSG_RESULT($ac_fdsections)
229 AC_SUBST(SECTION_FLAGS)
231 # Check linker hardware capability support.
232 GCC_CHECK_LINKER_HWCAP
234 # Find other programs we need.
235 AC_CHECK_TOOL(AS, as)
236 AC_CHECK_TOOL(AR, ar)
237 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
238 AC_PROG_MAKE_SET
239 AC_PROG_INSTALL
241 # Configure libtool
242 #AC_MSG_NOTICE([====== Starting libtool configuration])
243 AC_LIBTOOL_DLOPEN
244 AM_PROG_LIBTOOL
245 ACX_LT_HOST_FLAGS
246 AC_SUBST(enable_shared)
247 AC_SUBST(enable_static)
248 #AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
250 # We need gfortran to compile parts of the library
251 #AC_PROG_FC(gfortran)
252 FC="$GFORTRAN"
253 AC_PROG_FC(gfortran)
255 # extra LD Flags which are required for targets
256 case "${host}" in
257   *-darwin*)
258     # Darwin needs -single_module when linking libgfortran
259     extra_ldflags_libgfortran=-Wl,-single_module
260     ;;
261 esac
262 AC_SUBST(extra_ldflags_libgfortran)
264 # We need a working compiler at that point, otherwise give a clear
265 # error message and bail out.
266 LIBGFOR_WORKING_GFORTRAN
268 AC_SYS_LARGEFILE
270 # Types
271 AC_TYPE_OFF_T
272 AC_TYPE_INTPTR_T
273 AC_TYPE_UINTPTR_T
274 AC_CHECK_TYPES([ptrdiff_t])
276 # check header files (we assume C89 is available, so don't check for that)
277 AC_CHECK_HEADERS_ONCE(unistd.h sys/random.h sys/time.h sys/times.h \
278 sys/resource.h sys/types.h sys/stat.h sys/uio.h sys/wait.h \
279 floatingpoint.h ieeefp.h fenv.h fptrap.h \
280 fpxcp.h pwd.h complex.h xlocale.h)
282 GCC_HEADER_STDINT(gstdint.h)
284 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev])
286 case "${host}--x${with_newlib}" in
287   mips*--xyes)
288     hardwire_newlib=1;;
289   nvptx*--xyes)
290     hardwire_newlib=1;;
291 esac
293 # Check for library functions.
294 if test "${hardwire_newlib:-0}" -eq 1; then
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.])
300    AC_DEFINE(HAVE_SNPRINTF, 1, [Define if you have snprintf.])
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.])
304    AC_DEFINE(HAVE_STRNLEN, 1, [Define if you have strnlen.])
305    AC_DEFINE(HAVE_STRNDUP, 1, [Define if you have strndup.])
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
313 else
314    AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \
315    ftruncate chsize chdir getentropy getlogin gethostname kill link symlink \
316    sleep ttyname \
317    alarm access fork setmode fcntl writev \
318    gettimeofday stat fstat lstat getpwuid vsnprintf dup \
319    getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \
320    getgid getpid getuid geteuid umask getegid \
321    secure_getenv __secure_getenv mkostemp strnlen strndup newlocale \
322    freelocale uselocale strerror_l)
325 # Check strerror_r, cannot be above as versions with two and three arguments exist
326 LIBGFOR_CHECK_STRERROR_R
328 # Check for C99 (and other IEEE) math functions
329 GCC_CHECK_MATH_FUNC([acosf])
330 GCC_CHECK_MATH_FUNC([acos])
331 GCC_CHECK_MATH_FUNC([acosl])
332 GCC_CHECK_MATH_FUNC([acoshf])
333 GCC_CHECK_MATH_FUNC([acosh])
334 GCC_CHECK_MATH_FUNC([acoshl])
335 GCC_CHECK_MATH_FUNC([asinf])
336 GCC_CHECK_MATH_FUNC([asin])
337 GCC_CHECK_MATH_FUNC([asinl])
338 GCC_CHECK_MATH_FUNC([asinhf])
339 GCC_CHECK_MATH_FUNC([asinh])
340 GCC_CHECK_MATH_FUNC([asinhl])
341 GCC_CHECK_MATH_FUNC([atan2f])
342 GCC_CHECK_MATH_FUNC([atan2])
343 GCC_CHECK_MATH_FUNC([atan2l])
344 GCC_CHECK_MATH_FUNC([atanf])
345 GCC_CHECK_MATH_FUNC([atan])
346 GCC_CHECK_MATH_FUNC([atanl])
347 GCC_CHECK_MATH_FUNC([atanhf])
348 GCC_CHECK_MATH_FUNC([atanh])
349 GCC_CHECK_MATH_FUNC([atanhl])
350 GCC_CHECK_MATH_FUNC([cargf])
351 GCC_CHECK_MATH_FUNC([carg])
352 GCC_CHECK_MATH_FUNC([cargl])
353 GCC_CHECK_MATH_FUNC([ceilf])
354 GCC_CHECK_MATH_FUNC([ceil])
355 GCC_CHECK_MATH_FUNC([ceill])
356 GCC_CHECK_MATH_FUNC([copysignf])
357 GCC_CHECK_MATH_FUNC([copysign])
358 GCC_CHECK_MATH_FUNC([copysignl])
359 GCC_CHECK_MATH_FUNC([cosf])
360 GCC_CHECK_MATH_FUNC([cos])
361 GCC_CHECK_MATH_FUNC([cosl])
362 GCC_CHECK_MATH_FUNC([ccosf])
363 GCC_CHECK_MATH_FUNC([ccos])
364 GCC_CHECK_MATH_FUNC([ccosl])
365 GCC_CHECK_MATH_FUNC([coshf])
366 GCC_CHECK_MATH_FUNC([cosh])
367 GCC_CHECK_MATH_FUNC([coshl])
368 GCC_CHECK_MATH_FUNC([ccoshf])
369 GCC_CHECK_MATH_FUNC([ccosh])
370 GCC_CHECK_MATH_FUNC([ccoshl])
371 GCC_CHECK_MATH_FUNC([expf])
372 GCC_CHECK_MATH_FUNC([exp])
373 GCC_CHECK_MATH_FUNC([expl])
374 GCC_CHECK_MATH_FUNC([cexpf])
375 GCC_CHECK_MATH_FUNC([cexp])
376 GCC_CHECK_MATH_FUNC([cexpl])
377 GCC_CHECK_MATH_FUNC([fabsf])
378 GCC_CHECK_MATH_FUNC([fabs])
379 GCC_CHECK_MATH_FUNC([fabsl])
380 GCC_CHECK_MATH_FUNC([cabsf])
381 GCC_CHECK_MATH_FUNC([cabs])
382 GCC_CHECK_MATH_FUNC([cabsl])
383 GCC_CHECK_MATH_FUNC([floorf])
384 GCC_CHECK_MATH_FUNC([floor])
385 GCC_CHECK_MATH_FUNC([floorl])
386 GCC_CHECK_MATH_FUNC([fmodf])
387 GCC_CHECK_MATH_FUNC([fmod])
388 GCC_CHECK_MATH_FUNC([fmodl])
389 GCC_CHECK_MATH_FUNC([frexpf])
390 GCC_CHECK_MATH_FUNC([frexp])
391 GCC_CHECK_MATH_FUNC([frexpl])
392 GCC_CHECK_MATH_FUNC([hypotf])
393 GCC_CHECK_MATH_FUNC([hypot])
394 GCC_CHECK_MATH_FUNC([hypotl])
395 GCC_CHECK_MATH_FUNC([ldexpf])
396 GCC_CHECK_MATH_FUNC([ldexp])
397 GCC_CHECK_MATH_FUNC([ldexpl])
398 GCC_CHECK_MATH_FUNC([logf])
399 GCC_CHECK_MATH_FUNC([log])
400 GCC_CHECK_MATH_FUNC([logl])
401 GCC_CHECK_MATH_FUNC([clogf])
402 GCC_CHECK_MATH_FUNC([clog])
403 GCC_CHECK_MATH_FUNC([clogl])
404 GCC_CHECK_MATH_FUNC([log10f])
405 GCC_CHECK_MATH_FUNC([log10])
406 GCC_CHECK_MATH_FUNC([log10l])
407 GCC_CHECK_MATH_FUNC([clog10f])
408 GCC_CHECK_MATH_FUNC([clog10])
409 GCC_CHECK_MATH_FUNC([clog10l])
410 GCC_CHECK_MATH_FUNC([nextafterf])
411 GCC_CHECK_MATH_FUNC([nextafter])
412 GCC_CHECK_MATH_FUNC([nextafterl])
413 GCC_CHECK_MATH_FUNC([powf])
414 GCC_CHECK_MATH_FUNC([pow])
415 GCC_CHECK_MATH_FUNC([cpowf])
416 GCC_CHECK_MATH_FUNC([cpow])
417 GCC_CHECK_MATH_FUNC([cpowl])
418 GCC_CHECK_MATH_FUNC([roundf])
419 GCC_CHECK_MATH_FUNC([round])
420 GCC_CHECK_MATH_FUNC([roundl])
421 GCC_CHECK_MATH_FUNC([lroundf])
422 GCC_CHECK_MATH_FUNC([lround])
423 GCC_CHECK_MATH_FUNC([lroundl])
424 GCC_CHECK_MATH_FUNC([llroundf])
425 GCC_CHECK_MATH_FUNC([llround])
426 GCC_CHECK_MATH_FUNC([llroundl])
427 GCC_CHECK_MATH_FUNC([scalbnf])
428 GCC_CHECK_MATH_FUNC([scalbn])
429 GCC_CHECK_MATH_FUNC([scalbnl])
430 GCC_CHECK_MATH_FUNC([sinf])
431 GCC_CHECK_MATH_FUNC([sin])
432 GCC_CHECK_MATH_FUNC([sinl])
433 GCC_CHECK_MATH_FUNC([csinf])
434 GCC_CHECK_MATH_FUNC([csin])
435 GCC_CHECK_MATH_FUNC([csinl])
436 GCC_CHECK_MATH_FUNC([sinhf])
437 GCC_CHECK_MATH_FUNC([sinh])
438 GCC_CHECK_MATH_FUNC([sinhl])
439 GCC_CHECK_MATH_FUNC([csinhf])
440 GCC_CHECK_MATH_FUNC([csinh])
441 GCC_CHECK_MATH_FUNC([csinhl])
442 GCC_CHECK_MATH_FUNC([sqrtf])
443 GCC_CHECK_MATH_FUNC([sqrt])
444 GCC_CHECK_MATH_FUNC([sqrtl])
445 GCC_CHECK_MATH_FUNC([csqrtf])
446 GCC_CHECK_MATH_FUNC([csqrt])
447 GCC_CHECK_MATH_FUNC([csqrtl])
448 GCC_CHECK_MATH_FUNC([tanf])
449 GCC_CHECK_MATH_FUNC([tan])
450 GCC_CHECK_MATH_FUNC([tanl])
451 GCC_CHECK_MATH_FUNC([ctanf])
452 GCC_CHECK_MATH_FUNC([ctan])
453 GCC_CHECK_MATH_FUNC([ctanl])
454 GCC_CHECK_MATH_FUNC([tanhf])
455 GCC_CHECK_MATH_FUNC([tanh])
456 GCC_CHECK_MATH_FUNC([tanhl])
457 GCC_CHECK_MATH_FUNC([ctanhf])
458 GCC_CHECK_MATH_FUNC([ctanh])
459 GCC_CHECK_MATH_FUNC([ctanhl])
460 GCC_CHECK_MATH_FUNC([truncf])
461 GCC_CHECK_MATH_FUNC([trunc])
462 GCC_CHECK_MATH_FUNC([truncl])
463 GCC_CHECK_MATH_FUNC([erff])
464 GCC_CHECK_MATH_FUNC([erf])
465 GCC_CHECK_MATH_FUNC([erfcf])
466 GCC_CHECK_MATH_FUNC([erfc])
467 GCC_CHECK_MATH_FUNC([erfcl])
468 GCC_CHECK_MATH_FUNC([j0f])
469 GCC_CHECK_MATH_FUNC([j0])
470 GCC_CHECK_MATH_FUNC([j1f])
471 GCC_CHECK_MATH_FUNC([j1])
472 GCC_CHECK_MATH_FUNC([jnf])
473 GCC_CHECK_MATH_FUNC([jn])
474 GCC_CHECK_MATH_FUNC([jnl])
475 GCC_CHECK_MATH_FUNC([y0f])
476 GCC_CHECK_MATH_FUNC([y0])
477 GCC_CHECK_MATH_FUNC([y1f])
478 GCC_CHECK_MATH_FUNC([y1])
479 GCC_CHECK_MATH_FUNC([ynf])
480 GCC_CHECK_MATH_FUNC([yn])
481 GCC_CHECK_MATH_FUNC([ynl])
482 GCC_CHECK_MATH_FUNC([tgamma])
483 GCC_CHECK_MATH_FUNC([tgammaf])
484 GCC_CHECK_MATH_FUNC([lgamma])
485 GCC_CHECK_MATH_FUNC([lgammaf])
487 # Check for GFORTRAN_C99_1.1 funcs
488 GCC_CHECK_MATH_FUNC([cacos])
489 GCC_CHECK_MATH_FUNC([cacosf])
490 GCC_CHECK_MATH_FUNC([cacosh])
491 GCC_CHECK_MATH_FUNC([cacoshf])
492 GCC_CHECK_MATH_FUNC([cacoshl])
493 GCC_CHECK_MATH_FUNC([cacosl])
494 GCC_CHECK_MATH_FUNC([casin])
495 GCC_CHECK_MATH_FUNC([casinf])
496 GCC_CHECK_MATH_FUNC([casinh])
497 GCC_CHECK_MATH_FUNC([casinhf])
498 GCC_CHECK_MATH_FUNC([casinhl])
499 GCC_CHECK_MATH_FUNC([casinl])
500 GCC_CHECK_MATH_FUNC([catan])
501 GCC_CHECK_MATH_FUNC([catanf])
502 GCC_CHECK_MATH_FUNC([catanh])
503 GCC_CHECK_MATH_FUNC([catanhf])
504 GCC_CHECK_MATH_FUNC([catanhl])
505 GCC_CHECK_MATH_FUNC([catanl])
507 # On AIX, clog is present in libm as __clog
508 AC_CHECK_LIB([m],[__clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])])
510 # Check whether the system has a working stat()
511 LIBGFOR_CHECK_WORKING_STAT
513 # Check whether __mingw_snprintf() is present
514 LIBGFOR_CHECK_MINGW_SNPRINTF
516 # Check whether libquadmath should be used
517 AC_ARG_ENABLE(libquadmath-support,
518 AS_HELP_STRING([--disable-libquadmath-support],
519   [disable libquadmath support for Fortran]),
520 ENABLE_LIBQUADMATH_SUPPORT=$enableval,
521 ENABLE_LIBQUADMATH_SUPPORT=yes)
522 enable_libquadmath_support=
523 if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then
524   enable_libquadmath_support=no
527 # Check whether we have a __float128 type, depends on enable_libquadmath_support
528 LIBGFOR_CHECK_FLOAT128
530 # Check for GNU libc feenableexcept
531 AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])])
533 # At least for glibc, clock_gettime is in librt.  But don't
534 # pull that in if it still doesn't give us the function we want.  This
535 # test is copied from libgomp, and modified to not link in -lrt as
536 # libgfortran calls clock_gettime via a weak reference if it's found
537 # in librt.
538 if test "$ac_cv_func_clock_gettime" = no; then
539   AC_CHECK_LIB(rt, clock_gettime,
540     [AC_DEFINE(HAVE_CLOCK_GETTIME_LIBRT, 1,
541                [Define to 1 if you have the `clock_gettime' function in librt.])])
544 # Check for SysV fpsetmask
545 LIBGFOR_CHECK_FPSETMASK
546 AC_CHECK_TYPES([fp_except,fp_except_t], [], [], [[
547 #ifdef HAVE_IEEEFP_H
548 #include <ieeefp.h>
549 #endif
550 #include <math.h>
552 AC_CHECK_TYPES([fp_rnd,fp_rnd_t], [], [], [[
553 #ifdef HAVE_IEEEFP_H
554 #include <ieeefp.h>
555 #endif
556 #include <math.h>
559 # Check whether we have fpsetsticky or fpresetsticky
560 AC_CHECK_FUNC([fpsetsticky],[have_fpsetsticky=yes AC_DEFINE([HAVE_FPSETSTICKY],[1],[fpsetsticky is present])])
561 AC_CHECK_FUNC([fpresetsticky],[have_fpresetsticky=yes AC_DEFINE([HAVE_FPRESETSTICKY],[1],[fpresetsticky is present])])
563 # Check for AIX fp_trap and fp_enable
564 AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])])
565 AC_CHECK_FUNC([fp_enable],[have_fp_enable=yes AC_DEFINE([HAVE_FP_ENABLE],[1],[fp_enable is present])])
567 # Check if _SOFT_FLOAT is defined
568 AC_CHECK_DEFINE([_SOFT_FLOAT],[have_soft_float=yes])
570 # Runs configure.host to set up necessary host-dependent shell variables.
571 # We then display a message about it, and propagate them through the
572 # build chain.
573 . ${srcdir}/configure.host
574 AC_MSG_NOTICE([FPU dependent file will be ${fpu_host}.h])
575 AC_MSG_NOTICE([Support for IEEE modules: ${ieee_support}])
576 FPU_HOST_HEADER=config/${fpu_host}.h
577 AC_SUBST(FPU_HOST_HEADER)
579 # Whether we will build the IEEE modules
580 AM_CONDITIONAL(IEEE_SUPPORT,[test x${ieee_support} = xyes])
581 AC_SUBST(IEEE_SUPPORT)
583 # Some targets require additional compiler options for IEEE compatibility.
584 IEEE_FLAGS="${ieee_flags}"
585 AC_SUBST(IEEE_FLAGS)
588 # Check for POSIX getpwuid_r 
590 # There are two versions of getpwuid_r, the POSIX one with 5
591 # arguments, and another one with 4 arguments used by at least HP-UX
592 # 10.2.
593 if test "$ac_cv_func_getpwuid_r" = "yes"; then
594    AC_CACHE_CHECK([POSIX version of getpwuid_r with 5 arguments], libgfor_cv_posix_getpwuid_r, [
595    AC_LINK_IFELSE([AC_LANG_PROGRAM([
596 #include <stdio.h>
597 #include <sys/types.h>
598 #include <pwd.h>], [
599     getpwuid_r(0, NULL, NULL, 0, NULL);
600     ])],  [libgfor_cv_posix_getpwuid_r="yes"], [libgfor_cv_posix_getpwuid_r="no"])])
602 if test "$libgfor_cv_posix_getpwuid_r" = "yes"; then
603     AC_DEFINE([HAVE_POSIX_GETPWUID_R], [1], [Define to 1 if we have POSIX getpwuid_r which takes 5 arguments.])
607 # Check out attribute support.
608 LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY
609 LIBGFOR_CHECK_ATTRIBUTE_ALIAS
611 # Check out sync builtins support.
612 LIBGFOR_CHECK_SYNC_FETCH_AND_ADD
614 # Check out #pragma weak.
615 LIBGFOR_GTHREAD_WEAK
617 # Check out weakref support.
618 LIBGFOR_CHECK_WEAKREF
620 # Various other checks on target
621 LIBGFOR_CHECK_UNLINK_OPEN_FILE
623 # Check whether line terminator is LF or CRLF
624 LIBGFOR_CHECK_CRLF
626 # Check whether we support AVX extensions
627 LIBGFOR_CHECK_AVX
629 # Check wether we support AVX2 extensions
630 LIBGFOR_CHECK_AVX2
632 # Check wether we support AVX512f extensions
633 LIBGFOR_CHECK_AVX512F
635 # Check for FMA3 extensions
636 LIBGFOR_CHECK_FMA3
638 # Check for FMA4 extensions
639 LIBGFOR_CHECK_FMA4
641 # Check if AVX128 works
642 LIBGFOR_CHECK_AVX128
644 # Determine what GCC version number to use in filesystem paths.
645 GCC_BASE_VER
647 AC_CACHE_SAVE
649 if test ${multilib} = yes; then
650   multilib_arg="--enable-multilib"
651 else
652   multilib_arg=
655 # Write our Makefile and spec file.
656 AC_CONFIG_FILES([
657 Makefile
658 libgfortran.spec
660 AC_OUTPUT