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 89# Calculate toolexeclibdir 90# Also toolexecdir, though it's only used in toolexeclibdir 91case ${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 ;; 115esac 116AC_SUBST(toolexecdir) 117AC_SUBST(toolexeclibdir) 118 119# Create a spec file, so that compile/link tests don't fail 120test -f libgfortran.spec || touch libgfortran.spec 121 122AC_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. 128 129m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) 130m4_define([_AC_ARG_VAR_PRECIOUS],[]) 131AC_PROG_CC 132m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) 133 134AC_SUBST(CFLAGS) 135 136AM_PROG_CC_C_O 137 138# Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC. 139if 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" 148fi 149 150# Add CET specific flags if CET is enabled 151GCC_CET_FLAGS(CET_FLAGS) 152AM_FCFLAGS="$AM_FCFLAGS $CET_FLAGS" 153AM_CFLAGS="$AM_CFLAGS $CET_FLAGS" 154CFLAGS="$CFLAGS $CET_FLAGS" 155 156AC_SUBST(AM_FCFLAGS) 157AC_SUBST(AM_CFLAGS) 158AC_SUBST(CFLAGS) 159 160# Check for symbol versioning (copied from libssp). 161AC_MSG_CHECKING([whether symbol versioning is supported]) 162AC_ARG_ENABLE(symvers, 163AS_HELP_STRING([--disable-symvers], 164 [disable symbol versioning for libgfortran]), 165gfortran_use_symver=$enableval, 166gfortran_use_symver=yes) 167if 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 171FOO_1.0 { 172 global: *foo*; bar; local: *; 173}; 174EOF 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 183FOO_1.0 { 184 global: foo; local: *; 185}; 186EOF 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" 192fi 193AC_MSG_RESULT($gfortran_use_symver) 194AM_CONDITIONAL(LIBGFOR_USE_SYMVER, [test "x$gfortran_use_symver" != xno]) 195AM_CONDITIONAL(LIBGFOR_USE_SYMVER_GNU, [test "x$gfortran_use_symver" = xgnu]) 196AM_CONDITIONAL(LIBGFOR_USE_SYMVER_SUN, [test "x$gfortran_use_symver" = xsun]) 197 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 207 208AM_CONDITIONAL(LIBGFOR_MINIMAL, [test "x${target_cpu}" = xnvptx \ 209 || test "x${target_cpu}" = xamdgcn]) 210 211# Figure out whether the compiler supports "-ffunction-sections -fdata-sections", 212# similarly to how libstdc++ does it 213ac_test_CFLAGS="${CFLAGS+set}" 214ac_save_CFLAGS="$CFLAGS" 215 216# Check for -ffunction-sections -fdata-sections 217AC_MSG_CHECKING([for gcc that supports -ffunction-sections -fdata-sections]) 218CFLAGS='-Werror -ffunction-sections -fdata-sections' 219AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int foo;]])], [ac_fdsections=yes], [ac_fdsections=no]) 220if test "$ac_test_CFLAGS" = set; then 221 CFLAGS="$ac_save_CFLAGS" 222else 223 # this is the suspicious part 224 CFLAGS="" 225fi 226if test x"$ac_fdsections" = x"yes"; then 227 SECTION_FLAGS='-ffunction-sections -fdata-sections' 228fi 229AC_MSG_RESULT($ac_fdsections) 230AC_SUBST(SECTION_FLAGS) 231 232# Check linker hardware capability support. 233GCC_CHECK_LINKER_HWCAP 234 235# Find other programs we need. 236AC_CHECK_TOOL(AS, as) 237AC_CHECK_TOOL(AR, ar) 238AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) 239AC_PROG_MAKE_SET 240AC_PROG_INSTALL 241 242# Configure libtool 243#AC_MSG_NOTICE([====== Starting libtool configuration]) 244AC_LIBTOOL_DLOPEN 245AM_PROG_LIBTOOL 246ACX_LT_HOST_FLAGS 247AC_SUBST(enable_shared) 248AC_SUBST(enable_static) 249#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10 250 251# We need gfortran to compile parts of the library 252#AC_PROG_FC(gfortran) 253FC="$GFORTRAN" 254AC_PROG_FC(gfortran) 255 256# extra LD Flags which are required for targets 257case "${host}" in 258 *-darwin*) 259 # Darwin needs -single_module when linking libgfortran 260 extra_ldflags_libgfortran=-Wl,-single_module 261 ;; 262esac 263AC_SUBST(extra_ldflags_libgfortran) 264 265# We need a working compiler at that point, otherwise give a clear 266# error message and bail out. 267LIBGFOR_WORKING_GFORTRAN 268 269AC_SYS_LARGEFILE 270 271# Types 272AC_TYPE_OFF_T 273AC_TYPE_INTPTR_T 274AC_TYPE_UINTPTR_T 275AC_CHECK_TYPES([ptrdiff_t]) 276 277# check header files (we assume C89 is available, so don't check for that) 278AC_CHECK_HEADERS_ONCE(unistd.h sys/random.h sys/time.h sys/times.h \ 279sys/resource.h sys/types.h sys/stat.h sys/uio.h sys/wait.h \ 280floatingpoint.h ieeefp.h fenv.h fptrap.h \ 281fpxcp.h pwd.h complex.h xlocale.h) 282 283GCC_HEADER_STDINT(gstdint.h) 284 285AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev]) 286 287case "${host}--x${with_newlib}" in 288 mips*--xyes) 289 hardwire_newlib=1;; 290 nvptx*--xyes) 291 hardwire_newlib=1;; 292esac 293 294# Check for library functions. 295if test "${hardwire_newlib:-0}" -eq 1; then 296 # We are being configured with a cross compiler. AC_REPLACE_FUNCS 297 # may not work correctly, because the compiler may not be able to 298 # link executables. 299 AC_DEFINE(HAVE_MKSTEMP, 1, [Define if you have mkstemp.]) 300 AC_DEFINE(HAVE_STRTOF, 1, [Define if you have strtof.]) 301 AC_DEFINE(HAVE_SNPRINTF, 1, [Define if you have snprintf.]) 302 AC_DEFINE(HAVE_VSNPRINTF, 1, [Define if you have vsnprintf.]) 303 AC_DEFINE(HAVE_LOCALTIME_R, 1, [Define if you have localtime_r.]) 304 AC_DEFINE(HAVE_GMTIME_R, 1, [Define if you have gmtime_r.]) 305 AC_DEFINE(HAVE_STRNLEN, 1, [Define if you have strnlen.]) 306 AC_DEFINE(HAVE_STRNDUP, 1, [Define if you have strndup.]) 307 308 # At some point, we should differentiate between architectures 309 # like x86, which have long double versions, and alpha/powerpc/etc., 310 # which don't. For the time being, punt. 311 if test x"long_double_math_on_this_cpu" = x"yes"; then 312 AC_DEFINE(HAVE_STRTOLD, 1, [Define if you have strtold.]) 313 fi 314else 315 AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \ 316 ftruncate chsize chdir getentropy getlogin gethostname kill link symlink \ 317 sleep ttyname sigaction waitpid \ 318 alarm access fork posix_spawn setmode fcntl writev \ 319 gettimeofday stat fstat lstat getpwuid vsnprintf dup \ 320 getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \ 321 getgid getpid getuid geteuid umask getegid \ 322 secure_getenv __secure_getenv mkostemp strnlen strndup newlocale \ 323 freelocale uselocale strerror_l) 324fi 325 326# Check strerror_r, cannot be above as versions with two and three arguments exist 327LIBGFOR_CHECK_STRERROR_R 328 329# Check for C99 (and other IEEE) math functions 330GCC_CHECK_MATH_FUNC([acosf]) 331GCC_CHECK_MATH_FUNC([acos]) 332GCC_CHECK_MATH_FUNC([acosl]) 333GCC_CHECK_MATH_FUNC([acoshf]) 334GCC_CHECK_MATH_FUNC([acosh]) 335GCC_CHECK_MATH_FUNC([acoshl]) 336GCC_CHECK_MATH_FUNC([asinf]) 337GCC_CHECK_MATH_FUNC([asin]) 338GCC_CHECK_MATH_FUNC([asinl]) 339GCC_CHECK_MATH_FUNC([asinhf]) 340GCC_CHECK_MATH_FUNC([asinh]) 341GCC_CHECK_MATH_FUNC([asinhl]) 342GCC_CHECK_MATH_FUNC([atan2f]) 343GCC_CHECK_MATH_FUNC([atan2]) 344GCC_CHECK_MATH_FUNC([atan2l]) 345GCC_CHECK_MATH_FUNC([atanf]) 346GCC_CHECK_MATH_FUNC([atan]) 347GCC_CHECK_MATH_FUNC([atanl]) 348GCC_CHECK_MATH_FUNC([atanhf]) 349GCC_CHECK_MATH_FUNC([atanh]) 350GCC_CHECK_MATH_FUNC([atanhl]) 351GCC_CHECK_MATH_FUNC([cargf]) 352GCC_CHECK_MATH_FUNC([carg]) 353GCC_CHECK_MATH_FUNC([cargl]) 354GCC_CHECK_MATH_FUNC([ceilf]) 355GCC_CHECK_MATH_FUNC([ceil]) 356GCC_CHECK_MATH_FUNC([ceill]) 357GCC_CHECK_MATH_FUNC([copysignf]) 358GCC_CHECK_MATH_FUNC([copysign]) 359GCC_CHECK_MATH_FUNC([copysignl]) 360GCC_CHECK_MATH_FUNC([cosf]) 361GCC_CHECK_MATH_FUNC([cos]) 362GCC_CHECK_MATH_FUNC([cosl]) 363GCC_CHECK_MATH_FUNC([ccosf]) 364GCC_CHECK_MATH_FUNC([ccos]) 365GCC_CHECK_MATH_FUNC([ccosl]) 366GCC_CHECK_MATH_FUNC([coshf]) 367GCC_CHECK_MATH_FUNC([cosh]) 368GCC_CHECK_MATH_FUNC([coshl]) 369GCC_CHECK_MATH_FUNC([ccoshf]) 370GCC_CHECK_MATH_FUNC([ccosh]) 371GCC_CHECK_MATH_FUNC([ccoshl]) 372GCC_CHECK_MATH_FUNC([expf]) 373GCC_CHECK_MATH_FUNC([exp]) 374GCC_CHECK_MATH_FUNC([expl]) 375GCC_CHECK_MATH_FUNC([cexpf]) 376GCC_CHECK_MATH_FUNC([cexp]) 377GCC_CHECK_MATH_FUNC([cexpl]) 378GCC_CHECK_MATH_FUNC([fabsf]) 379GCC_CHECK_MATH_FUNC([fabs]) 380GCC_CHECK_MATH_FUNC([fabsl]) 381GCC_CHECK_MATH_FUNC([cabsf]) 382GCC_CHECK_MATH_FUNC([cabs]) 383GCC_CHECK_MATH_FUNC([cabsl]) 384GCC_CHECK_MATH_FUNC([floorf]) 385GCC_CHECK_MATH_FUNC([floor]) 386GCC_CHECK_MATH_FUNC([floorl]) 387GCC_CHECK_MATH_FUNC([fmodf]) 388GCC_CHECK_MATH_FUNC([fmod]) 389GCC_CHECK_MATH_FUNC([fmodl]) 390GCC_CHECK_MATH_FUNC([frexpf]) 391GCC_CHECK_MATH_FUNC([frexp]) 392GCC_CHECK_MATH_FUNC([frexpl]) 393GCC_CHECK_MATH_FUNC([hypotf]) 394GCC_CHECK_MATH_FUNC([hypot]) 395GCC_CHECK_MATH_FUNC([hypotl]) 396GCC_CHECK_MATH_FUNC([ldexpf]) 397GCC_CHECK_MATH_FUNC([ldexp]) 398GCC_CHECK_MATH_FUNC([ldexpl]) 399GCC_CHECK_MATH_FUNC([logf]) 400GCC_CHECK_MATH_FUNC([log]) 401GCC_CHECK_MATH_FUNC([logl]) 402GCC_CHECK_MATH_FUNC([clogf]) 403GCC_CHECK_MATH_FUNC([clog]) 404GCC_CHECK_MATH_FUNC([clogl]) 405GCC_CHECK_MATH_FUNC([log10f]) 406GCC_CHECK_MATH_FUNC([log10]) 407GCC_CHECK_MATH_FUNC([log10l]) 408GCC_CHECK_MATH_FUNC([clog10f]) 409GCC_CHECK_MATH_FUNC([clog10]) 410GCC_CHECK_MATH_FUNC([clog10l]) 411GCC_CHECK_MATH_FUNC([nextafterf]) 412GCC_CHECK_MATH_FUNC([nextafter]) 413GCC_CHECK_MATH_FUNC([nextafterl]) 414GCC_CHECK_MATH_FUNC([powf]) 415GCC_CHECK_MATH_FUNC([pow]) 416GCC_CHECK_MATH_FUNC([cpowf]) 417GCC_CHECK_MATH_FUNC([cpow]) 418GCC_CHECK_MATH_FUNC([cpowl]) 419GCC_CHECK_MATH_FUNC([roundf]) 420GCC_CHECK_MATH_FUNC([round]) 421GCC_CHECK_MATH_FUNC([roundl]) 422GCC_CHECK_MATH_FUNC([lroundf]) 423GCC_CHECK_MATH_FUNC([lround]) 424GCC_CHECK_MATH_FUNC([lroundl]) 425GCC_CHECK_MATH_FUNC([llroundf]) 426GCC_CHECK_MATH_FUNC([llround]) 427GCC_CHECK_MATH_FUNC([llroundl]) 428GCC_CHECK_MATH_FUNC([scalbnf]) 429GCC_CHECK_MATH_FUNC([scalbn]) 430GCC_CHECK_MATH_FUNC([scalbnl]) 431GCC_CHECK_MATH_FUNC([sinf]) 432GCC_CHECK_MATH_FUNC([sin]) 433GCC_CHECK_MATH_FUNC([sinl]) 434GCC_CHECK_MATH_FUNC([csinf]) 435GCC_CHECK_MATH_FUNC([csin]) 436GCC_CHECK_MATH_FUNC([csinl]) 437GCC_CHECK_MATH_FUNC([sinhf]) 438GCC_CHECK_MATH_FUNC([sinh]) 439GCC_CHECK_MATH_FUNC([sinhl]) 440GCC_CHECK_MATH_FUNC([csinhf]) 441GCC_CHECK_MATH_FUNC([csinh]) 442GCC_CHECK_MATH_FUNC([csinhl]) 443GCC_CHECK_MATH_FUNC([sqrtf]) 444GCC_CHECK_MATH_FUNC([sqrt]) 445GCC_CHECK_MATH_FUNC([sqrtl]) 446GCC_CHECK_MATH_FUNC([csqrtf]) 447GCC_CHECK_MATH_FUNC([csqrt]) 448GCC_CHECK_MATH_FUNC([csqrtl]) 449GCC_CHECK_MATH_FUNC([tanf]) 450GCC_CHECK_MATH_FUNC([tan]) 451GCC_CHECK_MATH_FUNC([tanl]) 452GCC_CHECK_MATH_FUNC([ctanf]) 453GCC_CHECK_MATH_FUNC([ctan]) 454GCC_CHECK_MATH_FUNC([ctanl]) 455GCC_CHECK_MATH_FUNC([tanhf]) 456GCC_CHECK_MATH_FUNC([tanh]) 457GCC_CHECK_MATH_FUNC([tanhl]) 458GCC_CHECK_MATH_FUNC([ctanhf]) 459GCC_CHECK_MATH_FUNC([ctanh]) 460GCC_CHECK_MATH_FUNC([ctanhl]) 461GCC_CHECK_MATH_FUNC([truncf]) 462GCC_CHECK_MATH_FUNC([trunc]) 463GCC_CHECK_MATH_FUNC([truncl]) 464GCC_CHECK_MATH_FUNC([erff]) 465GCC_CHECK_MATH_FUNC([erf]) 466GCC_CHECK_MATH_FUNC([erfcf]) 467GCC_CHECK_MATH_FUNC([erfc]) 468GCC_CHECK_MATH_FUNC([erfcl]) 469GCC_CHECK_MATH_FUNC([j0f]) 470GCC_CHECK_MATH_FUNC([j0]) 471GCC_CHECK_MATH_FUNC([j1f]) 472GCC_CHECK_MATH_FUNC([j1]) 473GCC_CHECK_MATH_FUNC([jnf]) 474GCC_CHECK_MATH_FUNC([jn]) 475GCC_CHECK_MATH_FUNC([jnl]) 476GCC_CHECK_MATH_FUNC([y0f]) 477GCC_CHECK_MATH_FUNC([y0]) 478GCC_CHECK_MATH_FUNC([y1f]) 479GCC_CHECK_MATH_FUNC([y1]) 480GCC_CHECK_MATH_FUNC([ynf]) 481GCC_CHECK_MATH_FUNC([yn]) 482GCC_CHECK_MATH_FUNC([ynl]) 483GCC_CHECK_MATH_FUNC([tgamma]) 484GCC_CHECK_MATH_FUNC([tgammaf]) 485GCC_CHECK_MATH_FUNC([lgamma]) 486GCC_CHECK_MATH_FUNC([lgammaf]) 487 488# Check for GFORTRAN_C99_1.1 funcs 489GCC_CHECK_MATH_FUNC([cacos]) 490GCC_CHECK_MATH_FUNC([cacosf]) 491GCC_CHECK_MATH_FUNC([cacosh]) 492GCC_CHECK_MATH_FUNC([cacoshf]) 493GCC_CHECK_MATH_FUNC([cacoshl]) 494GCC_CHECK_MATH_FUNC([cacosl]) 495GCC_CHECK_MATH_FUNC([casin]) 496GCC_CHECK_MATH_FUNC([casinf]) 497GCC_CHECK_MATH_FUNC([casinh]) 498GCC_CHECK_MATH_FUNC([casinhf]) 499GCC_CHECK_MATH_FUNC([casinhl]) 500GCC_CHECK_MATH_FUNC([casinl]) 501GCC_CHECK_MATH_FUNC([catan]) 502GCC_CHECK_MATH_FUNC([catanf]) 503GCC_CHECK_MATH_FUNC([catanh]) 504GCC_CHECK_MATH_FUNC([catanhf]) 505GCC_CHECK_MATH_FUNC([catanhl]) 506GCC_CHECK_MATH_FUNC([catanl]) 507 508# On AIX, clog is present in libm as __clog 509AC_CHECK_LIB([m],[__clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])]) 510 511# Check whether the system has a working stat() 512LIBGFOR_CHECK_WORKING_STAT 513 514# Check whether __mingw_snprintf() is present 515LIBGFOR_CHECK_MINGW_SNPRINTF 516 517# Check whether libquadmath should be used 518AC_ARG_ENABLE(libquadmath-support, 519AS_HELP_STRING([--disable-libquadmath-support], 520 [disable libquadmath support for Fortran]), 521ENABLE_LIBQUADMATH_SUPPORT=$enableval, 522ENABLE_LIBQUADMATH_SUPPORT=yes) 523enable_libquadmath_support= 524if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then 525 enable_libquadmath_support=no 526fi 527 528# Check whether we have a __float128 type, depends on enable_libquadmath_support 529LIBGFOR_CHECK_FLOAT128 530 531# Check for GNU libc feenableexcept 532AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])]) 533 534# At least for glibc, clock_gettime is in librt. But don't 535# pull that in if it still doesn't give us the function we want. This 536# test is copied from libgomp, and modified to not link in -lrt as 537# libgfortran calls clock_gettime via a weak reference if it's found 538# in librt. 539if test "$ac_cv_func_clock_gettime" = no; then 540 AC_CHECK_LIB(rt, clock_gettime, 541 [AC_DEFINE(HAVE_CLOCK_GETTIME_LIBRT, 1, 542 [Define to 1 if you have the `clock_gettime' function in librt.])]) 543fi 544 545# Check for SysV fpsetmask 546LIBGFOR_CHECK_FPSETMASK 547AC_CHECK_TYPES([fp_except,fp_except_t], [], [], [[ 548#ifdef HAVE_IEEEFP_H 549#include <ieeefp.h> 550#endif 551#include <math.h> 552]]) 553AC_CHECK_TYPES([fp_rnd,fp_rnd_t], [], [], [[ 554#ifdef HAVE_IEEEFP_H 555#include <ieeefp.h> 556#endif 557#include <math.h> 558]]) 559 560# Check whether we have fpsetsticky or fpresetsticky 561AC_CHECK_FUNC([fpsetsticky],[have_fpsetsticky=yes AC_DEFINE([HAVE_FPSETSTICKY],[1],[fpsetsticky is present])]) 562AC_CHECK_FUNC([fpresetsticky],[have_fpresetsticky=yes AC_DEFINE([HAVE_FPRESETSTICKY],[1],[fpresetsticky is present])]) 563 564# Check for AIX fp_trap and fp_enable 565AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])]) 566AC_CHECK_FUNC([fp_enable],[have_fp_enable=yes AC_DEFINE([HAVE_FP_ENABLE],[1],[fp_enable is present])]) 567 568# Check if _SOFT_FLOAT is defined 569AC_CHECK_DEFINE([_SOFT_FLOAT],[have_soft_float=yes]) 570 571# Runs configure.host to set up necessary host-dependent shell variables. 572# We then display a message about it, and propagate them through the 573# build chain. 574. ${srcdir}/configure.host 575AC_MSG_NOTICE([FPU dependent file will be ${fpu_host}.h]) 576AC_MSG_NOTICE([Support for IEEE modules: ${ieee_support}]) 577FPU_HOST_HEADER=config/${fpu_host}.h 578AC_SUBST(FPU_HOST_HEADER) 579 580# Whether we will build the IEEE modules 581AM_CONDITIONAL(IEEE_SUPPORT,[test x${ieee_support} = xyes]) 582AC_SUBST(IEEE_SUPPORT) 583 584# Some targets require additional compiler options for IEEE compatibility. 585IEEE_FLAGS="${ieee_flags}" 586AC_SUBST(IEEE_FLAGS) 587 588 589# Check for POSIX getpwuid_r 590# 591# There are two versions of getpwuid_r, the POSIX one with 5 592# arguments, and another one with 4 arguments used by at least HP-UX 593# 10.2. 594if test "$ac_cv_func_getpwuid_r" = "yes"; then 595 AC_CACHE_CHECK([POSIX version of getpwuid_r with 5 arguments], libgfor_cv_posix_getpwuid_r, [ 596 AC_LINK_IFELSE([AC_LANG_PROGRAM([ 597#include <stdio.h> 598#include <sys/types.h> 599#include <pwd.h>], [ 600 getpwuid_r(0, NULL, NULL, 0, NULL); 601 ])], [libgfor_cv_posix_getpwuid_r="yes"], [libgfor_cv_posix_getpwuid_r="no"])]) 602fi 603if test "$libgfor_cv_posix_getpwuid_r" = "yes"; then 604 AC_DEFINE([HAVE_POSIX_GETPWUID_R], [1], [Define to 1 if we have POSIX getpwuid_r which takes 5 arguments.]) 605fi 606 607 608# Check out attribute support. 609LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY 610LIBGFOR_CHECK_ATTRIBUTE_ALIAS 611 612# Check out atomic builtins support. 613LIBGFOR_CHECK_ATOMIC_FETCH_ADD 614 615# Check out #pragma weak. 616LIBGFOR_GTHREAD_WEAK 617 618# Check out weakref support. 619LIBGFOR_CHECK_WEAKREF 620 621# Various other checks on target 622LIBGFOR_CHECK_UNLINK_OPEN_FILE 623 624# Check whether line terminator is LF or CRLF 625LIBGFOR_CHECK_CRLF 626 627# Check whether we support AVX extensions 628LIBGFOR_CHECK_AVX 629 630# Check wether we support AVX2 extensions 631LIBGFOR_CHECK_AVX2 632 633# Check wether we support AVX512f extensions 634LIBGFOR_CHECK_AVX512F 635 636# Check for FMA3 extensions 637LIBGFOR_CHECK_FMA3 638 639# Check for FMA4 extensions 640LIBGFOR_CHECK_FMA4 641 642# Check if AVX128 works 643LIBGFOR_CHECK_AVX128 644 645# Determine what GCC version number to use in filesystem paths. 646GCC_BASE_VER 647 648AC_CACHE_SAVE 649 650if test ${multilib} = yes; then 651 multilib_arg="--enable-multilib" 652else 653 multilib_arg= 654fi 655 656# Write our Makefile and spec file. 657AC_CONFIG_FILES([ 658Makefile 659libgfortran.spec 660]) 661AC_OUTPUT 662