1# Process this file with autoconf to produce a configure script, like so: 2# aclocal && autoconf && autoheader && automake 3 4AC_INIT([GNU Fortran Runtime Library], 0.3,,[libgfortran]) 5AC_CONFIG_HEADER(config.h) 6GCC_TOPLEV_SUBDIRS 7 8# ------- 9# Options 10# ------- 11 12AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) 13AC_ARG_ENABLE(version-specific-runtime-libs, 14AS_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]) 22AC_MSG_RESULT($version_specific_libs) 23 24# Build with intermodule optimisations 25AC_MSG_CHECKING([for --enable-intermodule]) 26AC_ARG_ENABLE(intermodule, 27AS_HELP_STRING([--enable-intermodule],[build the library in one step]), 28[case "$enable_intermodule" in 29 yes) onestep="-onestep";; 30 *) onestep="";; 31esac], 32[onestep=""]) 33AC_MSG_RESULT($enable_intermodule) 34AM_CONDITIONAL(onestep,[test x$onestep = x-onestep]) 35AC_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 52AC_CANONICAL_SYSTEM 53ACX_NONCANONICAL_TARGET 54 55target_alias=${target_alias-$host_alias} 56AC_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. 69AM_INIT_AUTOMAKE([1.9.6 no-define foreign no-dist -Wall -Wno-portability]) 70 71AM_MAINTAINER_MODE 72AM_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. 80if test "$build" != "$host"; then 81 LIBGFOR_IS_NATIVE=false 82 GCC_NO_EXECUTABLES 83else 84 LIBGFOR_IS_NATIVE=true 85fi 86 87AC_USE_SYSTEM_EXTENSIONS 88 89GCC_WITH_TOOLEXECLIBDIR 90 91# Calculate toolexeclibdir 92# Also toolexecdir, though it's only used in toolexeclibdir 93case ${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 ;; 124esac 125AC_SUBST(toolexecdir) 126AC_SUBST(toolexeclibdir) 127 128# Create a spec file, so that compile/link tests don't fail 129test -f libgfortran.spec || touch libgfortran.spec 130 131AC_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 138m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) 139m4_define([_AC_ARG_VAR_PRECIOUS],[]) 140AC_PROG_CC 141m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) 142 143AC_SUBST(CFLAGS) 144 145AM_PROG_CC_C_O 146 147# Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC. 148have_real_17=no 149if 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 174fi 175AM_CONDITIONAL([HAVE_REAL_17], [test "x$have_real_17" != xno]) 176 177# Add CET specific flags if CET is enabled 178GCC_CET_FLAGS(CET_FLAGS) 179AM_FCFLAGS="$AM_FCFLAGS $CET_FLAGS" 180AM_CFLAGS="$AM_CFLAGS $CET_FLAGS" 181CFLAGS="$CFLAGS $CET_FLAGS" 182 183AC_SUBST(AM_FCFLAGS) 184AC_SUBST(AM_CFLAGS) 185AC_SUBST(CFLAGS) 186 187# Check for symbol versioning (copied from libssp). 188AC_MSG_CHECKING([whether symbol versioning is supported]) 189AC_ARG_ENABLE(symvers, 190AS_HELP_STRING([--disable-symvers], 191 [disable symbol versioning for libgfortran]), 192gfortran_use_symver=$enableval, 193gfortran_use_symver=yes) 194if 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 198FOO_1.0 { 199 global: *foo*; bar; local: *; 200}; 201EOF 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 210FOO_1.0 { 211 global: foo; local: *; 212}; 213EOF 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" 219fi 220AC_MSG_RESULT($gfortran_use_symver) 221AM_CONDITIONAL(LIBGFOR_USE_SYMVER, [test "x$gfortran_use_symver" != xno]) 222AM_CONDITIONAL(LIBGFOR_USE_SYMVER_GNU, [test "x$gfortran_use_symver" = xgnu]) 223AM_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 235AM_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. 240LIBGOMP_CHECKED_INT_KINDS="1 2 4 8 16" 241LIBGOMP_CHECKED_REAL_KINDS="4 8 10 16" 242 243AC_SUBST(LIBGOMP_CHECKED_INT_KINDS) 244AC_SUBST(LIBGOMP_CHECKED_REAL_KINDS) 245 246# Figure out whether the compiler supports "-ffunction-sections -fdata-sections", 247# similarly to how libstdc++ does it 248ac_test_CFLAGS="${CFLAGS+set}" 249ac_save_CFLAGS="$CFLAGS" 250 251# Check for -ffunction-sections -fdata-sections 252AC_MSG_CHECKING([for gcc that supports -ffunction-sections -fdata-sections]) 253CFLAGS='-Werror -ffunction-sections -fdata-sections' 254AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int foo;]])], [ac_fdsections=yes], [ac_fdsections=no]) 255if test "$ac_test_CFLAGS" = set; then 256 CFLAGS="$ac_save_CFLAGS" 257else 258 # this is the suspicious part 259 CFLAGS="" 260fi 261if test x"$ac_fdsections" = x"yes"; then 262 SECTION_FLAGS='-ffunction-sections -fdata-sections' 263fi 264AC_MSG_RESULT($ac_fdsections) 265AC_SUBST(SECTION_FLAGS) 266 267# Check linker hardware capability support. 268GCC_CHECK_LINKER_HWCAP 269 270# Find other programs we need. 271AC_CHECK_TOOL(AS, as) 272AC_CHECK_TOOL(AR, ar) 273AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) 274AC_PROG_MAKE_SET 275AC_PROG_INSTALL 276 277# Configure libtool 278#AC_MSG_NOTICE([====== Starting libtool configuration]) 279AC_LIBTOOL_DLOPEN 280AM_PROG_LIBTOOL 281LT_LIB_M 282ACX_LT_HOST_FLAGS 283AC_SUBST(enable_shared) 284AC_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) 289FC="$GFORTRAN" 290AC_PROG_FC(gfortran) 291 292# extra LD Flags which are required for targets 293case "${host}" in 294 *-darwin*) 295 # Darwin needs -single_module when linking libgfortran 296 extra_ldflags_libgfortran=-Wl,-single_module 297 ;; 298esac 299AC_SUBST(extra_ldflags_libgfortran) 300 301# We need a working compiler at that point, otherwise give a clear 302# error message and bail out. 303LIBGFOR_WORKING_GFORTRAN 304 305AC_SYS_LARGEFILE 306 307# Types 308AC_TYPE_OFF_T 309AC_TYPE_INTPTR_T 310AC_TYPE_UINTPTR_T 311AC_CHECK_TYPES([ptrdiff_t]) 312 313# check header files (we assume C89 is available, so don't check for that) 314AC_CHECK_HEADERS_ONCE(unistd.h sys/random.h sys/time.h sys/times.h \ 315sys/resource.h sys/types.h sys/stat.h sys/uio.h sys/wait.h \ 316floatingpoint.h ieeefp.h fenv.h fptrap.h \ 317fpxcp.h pwd.h complex.h xlocale.h) 318 319GCC_HEADER_STDINT(gstdint.h) 320 321AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev]) 322 323case "${host}--x${with_newlib}" in 324 mips*--xyes) 325 hardwire_newlib=1;; 326 nvptx*--xyes) 327 hardwire_newlib=1;; 328esac 329 330# Check for library functions. 331if 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 350else 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) 360fi 361 362# Check strerror_r, cannot be above as versions with two and three arguments exist 363LIBGFOR_CHECK_STRERROR_R 364 365# Check for C99 (and other IEEE) math functions 366GCC_CHECK_MATH_FUNC([acosf]) 367GCC_CHECK_MATH_FUNC([acos]) 368GCC_CHECK_MATH_FUNC([acosl]) 369GCC_CHECK_MATH_FUNC([acoshf]) 370GCC_CHECK_MATH_FUNC([acosh]) 371GCC_CHECK_MATH_FUNC([acoshl]) 372GCC_CHECK_MATH_FUNC([asinf]) 373GCC_CHECK_MATH_FUNC([asin]) 374GCC_CHECK_MATH_FUNC([asinl]) 375GCC_CHECK_MATH_FUNC([asinhf]) 376GCC_CHECK_MATH_FUNC([asinh]) 377GCC_CHECK_MATH_FUNC([asinhl]) 378GCC_CHECK_MATH_FUNC([atan2f]) 379GCC_CHECK_MATH_FUNC([atan2]) 380GCC_CHECK_MATH_FUNC([atan2l]) 381GCC_CHECK_MATH_FUNC([atanf]) 382GCC_CHECK_MATH_FUNC([atan]) 383GCC_CHECK_MATH_FUNC([atanl]) 384GCC_CHECK_MATH_FUNC([atanhf]) 385GCC_CHECK_MATH_FUNC([atanh]) 386GCC_CHECK_MATH_FUNC([atanhl]) 387GCC_CHECK_MATH_FUNC([cargf]) 388GCC_CHECK_MATH_FUNC([carg]) 389GCC_CHECK_MATH_FUNC([cargl]) 390GCC_CHECK_MATH_FUNC([ceilf]) 391GCC_CHECK_MATH_FUNC([ceil]) 392GCC_CHECK_MATH_FUNC([ceill]) 393GCC_CHECK_MATH_FUNC([copysignf]) 394GCC_CHECK_MATH_FUNC([copysign]) 395GCC_CHECK_MATH_FUNC([copysignl]) 396GCC_CHECK_MATH_FUNC([cosf]) 397GCC_CHECK_MATH_FUNC([cos]) 398GCC_CHECK_MATH_FUNC([cosl]) 399GCC_CHECK_MATH_FUNC([ccosf]) 400GCC_CHECK_MATH_FUNC([ccos]) 401GCC_CHECK_MATH_FUNC([ccosl]) 402GCC_CHECK_MATH_FUNC([coshf]) 403GCC_CHECK_MATH_FUNC([cosh]) 404GCC_CHECK_MATH_FUNC([coshl]) 405GCC_CHECK_MATH_FUNC([ccoshf]) 406GCC_CHECK_MATH_FUNC([ccosh]) 407GCC_CHECK_MATH_FUNC([ccoshl]) 408GCC_CHECK_MATH_FUNC([expf]) 409GCC_CHECK_MATH_FUNC([exp]) 410GCC_CHECK_MATH_FUNC([expl]) 411GCC_CHECK_MATH_FUNC([cexpf]) 412GCC_CHECK_MATH_FUNC([cexp]) 413GCC_CHECK_MATH_FUNC([cexpl]) 414GCC_CHECK_MATH_FUNC([fabsf]) 415GCC_CHECK_MATH_FUNC([fabs]) 416GCC_CHECK_MATH_FUNC([fabsl]) 417GCC_CHECK_MATH_FUNC([cabsf]) 418GCC_CHECK_MATH_FUNC([cabs]) 419GCC_CHECK_MATH_FUNC([cabsl]) 420GCC_CHECK_MATH_FUNC([floorf]) 421GCC_CHECK_MATH_FUNC([floor]) 422GCC_CHECK_MATH_FUNC([floorl]) 423GCC_CHECK_MATH_FUNC([fmaf]) 424GCC_CHECK_MATH_FUNC([fma]) 425GCC_CHECK_MATH_FUNC([fmal]) 426GCC_CHECK_MATH_FUNC([fmodf]) 427GCC_CHECK_MATH_FUNC([fmod]) 428GCC_CHECK_MATH_FUNC([fmodl]) 429GCC_CHECK_MATH_FUNC([frexpf]) 430GCC_CHECK_MATH_FUNC([frexp]) 431GCC_CHECK_MATH_FUNC([frexpl]) 432GCC_CHECK_MATH_FUNC([hypotf]) 433GCC_CHECK_MATH_FUNC([hypot]) 434GCC_CHECK_MATH_FUNC([hypotl]) 435GCC_CHECK_MATH_FUNC([ldexpf]) 436GCC_CHECK_MATH_FUNC([ldexp]) 437GCC_CHECK_MATH_FUNC([ldexpl]) 438GCC_CHECK_MATH_FUNC([logf]) 439GCC_CHECK_MATH_FUNC([log]) 440GCC_CHECK_MATH_FUNC([logl]) 441GCC_CHECK_MATH_FUNC([clogf]) 442GCC_CHECK_MATH_FUNC([clog]) 443GCC_CHECK_MATH_FUNC([clogl]) 444GCC_CHECK_MATH_FUNC([log10f]) 445GCC_CHECK_MATH_FUNC([log10]) 446GCC_CHECK_MATH_FUNC([log10l]) 447GCC_CHECK_MATH_FUNC([clog10f]) 448GCC_CHECK_MATH_FUNC([clog10]) 449GCC_CHECK_MATH_FUNC([clog10l]) 450GCC_CHECK_MATH_FUNC([nextafterf]) 451GCC_CHECK_MATH_FUNC([nextafter]) 452GCC_CHECK_MATH_FUNC([nextafterl]) 453GCC_CHECK_MATH_FUNC([powf]) 454GCC_CHECK_MATH_FUNC([pow]) 455GCC_CHECK_MATH_FUNC([cpowf]) 456GCC_CHECK_MATH_FUNC([cpow]) 457GCC_CHECK_MATH_FUNC([cpowl]) 458GCC_CHECK_MATH_FUNC([roundf]) 459GCC_CHECK_MATH_FUNC([round]) 460GCC_CHECK_MATH_FUNC([roundl]) 461GCC_CHECK_MATH_FUNC([lroundf]) 462GCC_CHECK_MATH_FUNC([lround]) 463GCC_CHECK_MATH_FUNC([lroundl]) 464GCC_CHECK_MATH_FUNC([llroundf]) 465GCC_CHECK_MATH_FUNC([llround]) 466GCC_CHECK_MATH_FUNC([llroundl]) 467GCC_CHECK_MATH_FUNC([scalbnf]) 468GCC_CHECK_MATH_FUNC([scalbn]) 469GCC_CHECK_MATH_FUNC([scalbnl]) 470GCC_CHECK_MATH_FUNC([sinf]) 471GCC_CHECK_MATH_FUNC([sin]) 472GCC_CHECK_MATH_FUNC([sinl]) 473GCC_CHECK_MATH_FUNC([csinf]) 474GCC_CHECK_MATH_FUNC([csin]) 475GCC_CHECK_MATH_FUNC([csinl]) 476GCC_CHECK_MATH_FUNC([sinhf]) 477GCC_CHECK_MATH_FUNC([sinh]) 478GCC_CHECK_MATH_FUNC([sinhl]) 479GCC_CHECK_MATH_FUNC([csinhf]) 480GCC_CHECK_MATH_FUNC([csinh]) 481GCC_CHECK_MATH_FUNC([csinhl]) 482GCC_CHECK_MATH_FUNC([sqrtf]) 483GCC_CHECK_MATH_FUNC([sqrt]) 484GCC_CHECK_MATH_FUNC([sqrtl]) 485GCC_CHECK_MATH_FUNC([csqrtf]) 486GCC_CHECK_MATH_FUNC([csqrt]) 487GCC_CHECK_MATH_FUNC([csqrtl]) 488GCC_CHECK_MATH_FUNC([tanf]) 489GCC_CHECK_MATH_FUNC([tan]) 490GCC_CHECK_MATH_FUNC([tanl]) 491GCC_CHECK_MATH_FUNC([ctanf]) 492GCC_CHECK_MATH_FUNC([ctan]) 493GCC_CHECK_MATH_FUNC([ctanl]) 494GCC_CHECK_MATH_FUNC([tanhf]) 495GCC_CHECK_MATH_FUNC([tanh]) 496GCC_CHECK_MATH_FUNC([tanhl]) 497GCC_CHECK_MATH_FUNC([ctanhf]) 498GCC_CHECK_MATH_FUNC([ctanh]) 499GCC_CHECK_MATH_FUNC([ctanhl]) 500GCC_CHECK_MATH_FUNC([truncf]) 501GCC_CHECK_MATH_FUNC([trunc]) 502GCC_CHECK_MATH_FUNC([truncl]) 503GCC_CHECK_MATH_FUNC([erff]) 504GCC_CHECK_MATH_FUNC([erf]) 505GCC_CHECK_MATH_FUNC([erfcf]) 506GCC_CHECK_MATH_FUNC([erfc]) 507GCC_CHECK_MATH_FUNC([erfcl]) 508GCC_CHECK_MATH_FUNC([j0f]) 509GCC_CHECK_MATH_FUNC([j0]) 510GCC_CHECK_MATH_FUNC([j1f]) 511GCC_CHECK_MATH_FUNC([j1]) 512GCC_CHECK_MATH_FUNC([jnf]) 513GCC_CHECK_MATH_FUNC([jn]) 514GCC_CHECK_MATH_FUNC([jnl]) 515GCC_CHECK_MATH_FUNC([y0f]) 516GCC_CHECK_MATH_FUNC([y0]) 517GCC_CHECK_MATH_FUNC([y1f]) 518GCC_CHECK_MATH_FUNC([y1]) 519GCC_CHECK_MATH_FUNC([ynf]) 520GCC_CHECK_MATH_FUNC([yn]) 521GCC_CHECK_MATH_FUNC([ynl]) 522GCC_CHECK_MATH_FUNC([tgamma]) 523GCC_CHECK_MATH_FUNC([tgammaf]) 524GCC_CHECK_MATH_FUNC([lgamma]) 525GCC_CHECK_MATH_FUNC([lgammaf]) 526 527# Check for GFORTRAN_C99_1.1 funcs 528GCC_CHECK_MATH_FUNC([cacos]) 529GCC_CHECK_MATH_FUNC([cacosf]) 530GCC_CHECK_MATH_FUNC([cacosh]) 531GCC_CHECK_MATH_FUNC([cacoshf]) 532GCC_CHECK_MATH_FUNC([cacoshl]) 533GCC_CHECK_MATH_FUNC([cacosl]) 534GCC_CHECK_MATH_FUNC([casin]) 535GCC_CHECK_MATH_FUNC([casinf]) 536GCC_CHECK_MATH_FUNC([casinh]) 537GCC_CHECK_MATH_FUNC([casinhf]) 538GCC_CHECK_MATH_FUNC([casinhl]) 539GCC_CHECK_MATH_FUNC([casinl]) 540GCC_CHECK_MATH_FUNC([catan]) 541GCC_CHECK_MATH_FUNC([catanf]) 542GCC_CHECK_MATH_FUNC([catanh]) 543GCC_CHECK_MATH_FUNC([catanhf]) 544GCC_CHECK_MATH_FUNC([catanhl]) 545GCC_CHECK_MATH_FUNC([catanl]) 546 547# For POWER, check the ieee128 math functions 548 549if test "x$have_real_17" = "xyes"; then 550AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_REAL_17),[1], 551 [Define to 1 if you have REAL(KIND=17)]) 552 553LIBGFOR_CHECK_MATH_IEEE128([__acoshieee128]) 554LIBGFOR_CHECK_MATH_IEEE128([__acosieee128]) 555LIBGFOR_CHECK_MATH_IEEE128([__asinhieee128]) 556LIBGFOR_CHECK_MATH_IEEE128([__asinieee128]) 557LIBGFOR_CHECK_MATH_IEEE128([__atan2ieee128]) 558LIBGFOR_CHECK_MATH_IEEE128([__atanhieee128]) 559LIBGFOR_CHECK_MATH_IEEE128([__atanieee128]) 560LIBGFOR_CHECK_MATH_IEEE128([__coshieee128]) 561LIBGFOR_CHECK_MATH_IEEE128([__cosieee128]) 562LIBGFOR_CHECK_MATH_IEEE128([__erfieee128]) 563LIBGFOR_CHECK_MATH_IEEE128([__expieee128]) 564LIBGFOR_CHECK_MATH_IEEE128([__fabsieee128]) 565LIBGFOR_CHECK_MATH_IEEE128([__jnieee128]) 566LIBGFOR_CHECK_MATH_IEEE128([__log10ieee128]) 567LIBGFOR_CHECK_MATH_IEEE128([__logieee128]) 568LIBGFOR_CHECK_MATH_IEEE128([__powieee128]) 569LIBGFOR_CHECK_MATH_IEEE128([__sinhieee128]) 570LIBGFOR_CHECK_MATH_IEEE128([__sinieee128]) 571LIBGFOR_CHECK_MATH_IEEE128([__sqrtieee128]) 572LIBGFOR_CHECK_MATH_IEEE128([__tanhieee128]) 573LIBGFOR_CHECK_MATH_IEEE128([__tanieee128]) 574LIBGFOR_CHECK_MATH_IEEE128([__ynieee128]) 575fi 576 577# On AIX, clog is present in libm as __clog 578AC_CHECK_LIB([m],[__clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])]) 579 580GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2([copysign], [double]) 581GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2([copysignl], [long double]) 582GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1([fabs], [double]) 583GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1([fabsl], [long double]) 584 585# Check whether the system has a working stat() 586LIBGFOR_CHECK_WORKING_STAT 587 588# Check whether __mingw_snprintf() is present 589LIBGFOR_CHECK_MINGW_SNPRINTF 590 591# Check whether libquadmath should be used 592AC_ARG_ENABLE(libquadmath-support, 593AS_HELP_STRING([--disable-libquadmath-support], 594 [disable libquadmath support for Fortran]), 595ENABLE_LIBQUADMATH_SUPPORT=$enableval, 596ENABLE_LIBQUADMATH_SUPPORT=yes) 597enable_libquadmath_support= 598if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then 599 enable_libquadmath_support=no 600fi 601 602# Check whether we have a __float128 type, depends on enable_libquadmath_support 603LIBGFOR_CHECK_FLOAT128 604 605# Check for GNU libc feenableexcept 606AC_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. 613if 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.])]) 617fi 618 619# Check for SysV fpsetmask 620LIBGFOR_CHECK_FPSETMASK 621AC_CHECK_TYPES([fp_except,fp_except_t], [], [], [[ 622#ifdef HAVE_IEEEFP_H 623#include <ieeefp.h> 624#endif 625#include <math.h> 626]]) 627AC_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 635AC_CHECK_FUNC([fpsetsticky],[have_fpsetsticky=yes AC_DEFINE([HAVE_FPSETSTICKY],[1],[fpsetsticky is present])]) 636AC_CHECK_FUNC([fpresetsticky],[have_fpresetsticky=yes AC_DEFINE([HAVE_FPRESETSTICKY],[1],[fpresetsticky is present])]) 637 638# Check for AIX fp_trap and fp_enable 639AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])]) 640AC_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 643AC_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 649AC_MSG_NOTICE([FPU dependent file will be ${fpu_host}.h]) 650AC_MSG_NOTICE([Support for IEEE modules: ${ieee_support}]) 651FPU_HOST_HEADER=config/${fpu_host}.h 652AC_SUBST(FPU_HOST_HEADER) 653 654# Whether we will build the IEEE modules 655AM_CONDITIONAL(IEEE_SUPPORT,[test x${ieee_support} = xyes]) 656AC_SUBST(IEEE_SUPPORT) 657 658# Some targets require additional compiler options for IEEE compatibility. 659IEEE_FLAGS="${ieee_flags}" 660AC_SUBST(IEEE_FLAGS) 661 662# Conditionalize the makefile for this target machine. 663tmake_file_= 664for f in ${tmake_file} 665do 666 if test -f ${srcdir}/config/$f 667 then 668 tmake_file_="${tmake_file_} \$(srcdir)/config/$f" 669 fi 670done 671tmake_file="${tmake_file_}" 672AC_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. 680if 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"])]) 688fi 689if 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.]) 691fi 692 693 694# Check out attribute support. 695LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY 696LIBGFOR_CHECK_ATTRIBUTE_ALIAS 697 698# Check out atomic builtins support. 699LIBGFOR_CHECK_ATOMIC_FETCH_ADD 700 701# Check out #pragma weak. 702LIBGFOR_GTHREAD_WEAK 703 704# Check out weakref support. 705LIBGFOR_CHECK_WEAKREF 706 707# Various other checks on target 708LIBGFOR_CHECK_UNLINK_OPEN_FILE 709 710# Check whether line terminator is LF or CRLF 711LIBGFOR_CHECK_CRLF 712 713# Check whether we support AVX extensions 714LIBGFOR_CHECK_AVX 715 716# Check whether we support AVX2 extensions 717LIBGFOR_CHECK_AVX2 718 719# Check whether we support AVX512f extensions 720LIBGFOR_CHECK_AVX512F 721 722# Check for FMA3 extensions 723LIBGFOR_CHECK_FMA3 724 725# Check for FMA4 extensions 726LIBGFOR_CHECK_FMA4 727 728# Check if AVX128 works 729LIBGFOR_CHECK_AVX128 730 731# Determine what GCC version number to use in filesystem paths. 732GCC_BASE_VER 733 734AC_CACHE_SAVE 735 736if test ${multilib} = yes; then 737 multilib_arg="--enable-multilib" 738else 739 multilib_arg= 740fi 741 742# Write our Makefile and spec file. 743AC_CONFIG_FILES([ 744Makefile 745libgfortran.spec 746]) 747AC_OUTPUT 748