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