# Process this file with autoconf to produce a configure script, like so: # aclocal && autoconf && autoheader && automake AC_PREREQ(2.64) AC_INIT([GNU Fortran Runtime Library], 0.3,,[liblfortran]) AC_CONFIG_HEADER(config.h) GCC_TOPLEV_SUBDIRS # ------- # Options # ------- AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) AC_ARG_ENABLE(version-specific-runtime-libs, AS_HELP_STRING([--enable-version-specific-runtime-libs], [specify that runtime libraries should be installed in a compiler-specific directory]), [case "$enableval" in yes) version_specific_libs=yes ;; no) version_specific_libs=no ;; *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; esac], [version_specific_libs=no]) AC_MSG_RESULT($version_specific_libs) # Build with intermodule optimisations AC_MSG_CHECKING([for --enable-intermodule]) AC_ARG_ENABLE(intermodule, AS_HELP_STRING([--enable-intermodule],[build the library in one step]), [case "$enable_intermodule" in yes) onestep="-onestep";; *) onestep="";; esac], [onestep=""]) AC_MSG_RESULT($enable_intermodule) AM_CONDITIONAL(onestep,[test x$onestep = x-onestep]) AC_SUBST(onestep) # Gets build, host, target, *_vendor, *_cpu, *_os, etc. # # You will slowly go insane if you do not grok the following fact: when # building this library, the top-level /target/ becomes the library's /host/. # # configure then causes --target to default to --host, exactly like any # other package using autoconf. Therefore, 'target' and 'host' will # always be the same. This makes sense both for native and cross compilers # just think about it for a little while. :-) # # Also, if this library is being configured as part of a cross compiler, the # top-level configure script will pass the "real" host as $with_cross_host. # # Do not delete or change the following two lines. For why, see # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html AC_CANONICAL_SYSTEM ACX_NONCANONICAL_TARGET target_alias=${target_alias-$host_alias} AC_SUBST(target_alias) # Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the # following is magically included in AUTOMAKE_OPTIONS in each Makefile.am. # 1.9.6: minimum required version # no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch # of other PACKAGE_* variables will, however, and there's nothing # we can do about that; they come from AC_INIT). # foreign: we don't follow the normal rules for GNU packages (no COPYING # file in the top srcdir, etc, etc), so stop complaining. # no-dist: we don't want 'dist' and related rules. # -Wall: turns on all automake warnings... # -Wno-portability: ...except this one, since GNU make is required. AM_INIT_AUTOMAKE([1.9.6 no-define foreign no-dist -Wall -Wno-portability]) AM_MAINTAINER_MODE toolexecdir='$(libdir)' toolexeclibdir='$(toolexecdir)' AC_SUBST(toolexecdir) AC_SUBST(toolexeclibdir) # Create a spec file, so that compile/link tests don't fail test -f liblfortran.spec || touch liblfortran.spec AC_LANG_C # Check the compiler. # The same as in boehm-gc and libstdc++. Have to borrow it from there. # We must force CC to /not/ be precious variables; otherwise # the wrong, non-multilib-adjusted value will be used in multilibs. # As a side effect, we have to subst CFLAGS ourselves. m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) m4_define([_AC_ARG_VAR_PRECIOUS],[]) AC_PROG_CC m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) AC_SUBST(CFLAGS) AM_PROG_CC_C_O # Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC. if test "x$GCC" = "xyes"; then AM_FCFLAGS="-I. -I${srcdir} -Wall -Werror -fimplicit-none" stdf= case "${FORTRAN}" in *gfortran*) AM_FCFLAGS="$AM_FCFLAGS -fno-underscoring -Wno-unused-dummy-argument -Wno-c-binding-type -fallow-leading-underscore" stdf="-std=gnu99" ## stdf="-std=gnu11" ;; *) AM_FCFLAGS="$AM_FCFLAGS -Wf,-fno-underscoring -Wf,-fallow-leading-underscore -Wf,-Wno-unused-dummy-argument -Wf,-Wno-c-binding-type" stdf="-std=gnu99" ;; esac ## We like to use C11 and C99 routines when available. This makes ## sure that ## __STDC_VERSION__ is set such that libc includes make them available. AM_CFLAGS="$stdf -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Wno-unknown-pragmas" ## Compile the following tests with the same system header contents ## that we'll encounter when compiling our own source files. CFLAGS="$stdf $CFLAGS" fi AC_SUBST(AM_FCFLAGS) AC_SUBST(AM_CFLAGS) AC_SUBST(CFLAGS) # Check for symbol versioning (copied from libssp). AC_MSG_CHECKING([whether symbol versioning is supported]) AC_ARG_ENABLE(symvers, AS_HELP_STRING([--disable-symvers], [disable symbol versioning for liblfortran]), gfortran_use_symver=$enableval, gfortran_use_symver=yes) if test "x$gfortran_use_symver" != xno; then save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map" cat > conftest.map < conftest.map < #endif #include ]]) AC_CHECK_TYPES([fp_rnd,fp_rnd_t], [], [], [[ #ifdef HAVE_IEEEFP_H #include #endif #include ]]) # Check whether we have fpsetsticky or fpresetsticky AC_CHECK_FUNC([fpsetsticky],[have_fpsetsticky=yes AC_DEFINE([HAVE_FPSETSTICKY],[1],[fpsetsticky is present])]) AC_CHECK_FUNC([fpresetsticky],[have_fpresetsticky=yes AC_DEFINE([HAVE_FPRESETSTICKY],[1],[fpresetsticky is present])]) # Check for AIX fp_trap and fp_enable AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])]) AC_CHECK_FUNC([fp_enable],[have_fp_enable=yes AC_DEFINE([HAVE_FP_ENABLE],[1],[fp_enable is present])]) # Check if _SOFT_FLOAT is defined AC_CHECK_DEFINE([_SOFT_FLOAT],[have_soft_float=yes]) # Runs configure.host to set up necessary host-dependent shell variables. # We then display a message about it, and propagate them through the # build chain. . ${srcdir}/configure.host AC_MSG_NOTICE([FPU dependent file will be ${fpu_host}.h]) AC_MSG_NOTICE([Support for IEEE modules: ${ieee_support}]) FPU_HOST_HEADER=config/${fpu_host}.h AC_SUBST(FPU_HOST_HEADER) # Whether we will build the IEEE modules AM_CONDITIONAL(IEEE_SUPPORT,[test x${ieee_support} = xyes]) AC_SUBST(IEEE_SUPPORT) # Some targets require additional compiler options for IEEE compatibility. IEEE_FLAGS="${ieee_flags}" AC_SUBST(IEEE_FLAGS) # Check for POSIX getpwuid_r # # There are two versions of getpwuid_r, the POSIX one with 5 # arguments, and another one with 4 arguments used by at least HP-UX # 10.2. if test "$ac_cv_func_getpwuid_r" = "yes"; then AC_CACHE_CHECK([POSIX version of getpwuid_r with 5 arguments], libgfor_cv_posix_getpwuid_r, [ AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include #include ], [ getpwuid_r(0, NULL, NULL, 0, NULL); ])], [libgfor_cv_posix_getpwuid_r="yes"], [libgfor_cv_posix_getpwuid_r="no"])]) fi if test "$libgfor_cv_posix_getpwuid_r" = "yes"; then AC_DEFINE([HAVE_POSIX_GETPWUID_R], [1], [Define to 1 if we have POSIX getpwuid_r which takes 5 arguments.]) fi # Check out attribute support. LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY LIBGFOR_CHECK_ATTRIBUTE_ALIAS # Check out sync builtins support. LIBGFOR_CHECK_SYNC_FETCH_AND_ADD # Check out #pragma weak. LIBGFOR_GTHREAD_WEAK # Check out weakref support. LIBGFOR_CHECK_WEAKREF # Various other checks on target LIBGFOR_CHECK_UNLINK_OPEN_FILE # Check whether line terminator is LF or CRLF LIBGFOR_CHECK_CRLF # Check whether we support AVX extensions ## LIBGFOR_CHECK_AVX # Check wether we support AVX2 extensions LIBGFOR_CHECK_AVX2 # Check wether we support AVX512f extensions LIBGFOR_CHECK_AVX512F # Determine what GCC version number to use in filesystem paths. GCC_BASE_VER AC_CACHE_SAVE if test ${multilib} = yes; then multilib_arg="--enable-multilib" else multilib_arg= fi # Write our Makefile and spec file. AC_CONFIG_FILES([ Makefile liblfortran.spec ]) AC_OUTPUT