"Fossies" - the Fresh Open Source Software Archive

Member "openmpi-3.1.6/ompi/mca/io/romio314/romio/confdb/aclocal_coverage.m4" (18 Mar 2020, 3711 Bytes) of package /linux/misc/openmpi-3.1.6.tar.bz2:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 
    2 dnl Macro to add --enable-coverage option (disabled by default) and add
    3 dnl appropriate compiler flags to permit usage of gcov if that option is
    4 dnl enabled.  If WRAPPER_xFLAGS variables are set then the flags will also be
    5 dnl added to those variables.
    6 dnl
    7 dnl Sets "pac_cv_use_coverage=yes" and AC_DEFINEs USE_COVERAGE if coverage was
    8 dnl successfully enabled.  Also creates an AM_CONDITIONAL with the name
    9 dnl "BUILD_COVERAGE" that is true iff pac_cv_use_coverage=yes.
   10 dnl
   11 dnl Usage: PAC_CONFIG_SUBDIR_ARGS
   12 dnl
   13 dnl Assumes that all of the compiler macros have already been invoked
   14 dnl (AC_PROG_CC and friends).
   15 AC_DEFUN([PAC_ENABLE_COVERAGE],[
   16 
   17 AC_ARG_VAR([GCOV],[name/path for the gcov utility])
   18 AC_CHECK_PROGS([GCOV],[gcov])
   19 
   20 AC_ARG_ENABLE([coverage],
   21               [AC_HELP_STRING([--enable-coverage],
   22                               [Turn on coverage analysis using gcc and gcov])],
   23               [],[enable_coverage=no])
   24 
   25 if test "$enable_coverage" = "yes" ; then
   26     if test "$ac_cv_prog_gcc" = "yes" ; then
   27         CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
   28         LIBS="$LIBS -lgcov"
   29         if test ${WRAPPER_CFLAGS+set} = set ; then
   30             WRAPPER_CFLAGS="$WRAPPER_CFLAGS -fprofile-arcs -ftest-coverage"
   31         fi
   32     else
   33         AC_MSG_WARN([--enable-coverage only supported for GCC])
   34     fi
   35     if test "$enable_cxx" = "yes" ; then
   36         if test "$ac_cv_cxx_compiler_gnu" = "yes" ; then
   37             CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
   38             LIBS="$LIBS -lgcov"
   39             if test ${WRAPPER_CXXFLAGS+set} = set ; then
   40                 WRAPPER_CXXFLAGS="$WRAPPER_CXXFLAGS -fprofile-arcs -ftest-coverage"
   41             fi
   42         else
   43             AC_MSG_WARN([--enable-coverage only supported for GCC])
   44         fi
   45     fi
   46     # Add similar options for g77 so that the Fortran tests will also
   47     #
   48     if test "$enable_f77" = yes ; then
   49         if test "$ac_cv_f77_compiler_gnu" = "yes" ; then
   50              FFLAGS="$FFLAGS -fprofile-arcs -ftest-coverage"
   51              LIBS="$LIBS -lgcov"
   52              if test ${WRAPPER_FFLAGS+set} = set ; then
   53                  WRAPPER_FFLAGS="$WRAPPER_FFLAGS -fprofile-arcs -ftest-coverage"
   54              fi
   55         else
   56             AC_MSG_WARN([--enable-coverage only supported for G77/GFORTRAN])
   57         fi
   58     fi
   59     if test "$enable_fc" = yes ; then
   60         if test "$ac_cv_fc_compiler_gnu" = "yes" ; then
   61              FCFLAGS="$FCFLAGS -fprofile-arcs -ftest-coverage"
   62              LIBS="$LIBS -lgcov"
   63              if test ${WRAPPER_FCFLAGS+set} = set ; then
   64                  WRAPPER_FCFLAGS="$WRAPPER_FCFLAGS -fprofile-arcs -ftest-coverage"
   65              fi
   66         else
   67             AC_MSG_WARN([--enable-coverage only supported for GFORTRAN])
   68         fi
   69     fi
   70     # On some platforms (e.g., Mac Darwin), we must also *link*
   71     # with the -fprofile-args -ftest-coverage option.
   72     AC_MSG_CHECKING([whether compilation with coverage analysis enabled works])
   73     AC_LINK_IFELSE([AC_LANG_SOURCE([int main(int argc, char **argv){return 1;}])],
   74                    [AC_MSG_RESULT([yes])],
   75                    [AC_MSG_RESULT([no])
   76                     AC_MSG_ERROR([Unable to link programs when coverage analysis enabled])])
   77 
   78     # Test for the routines that we need to use to ensure that the
   79     # data files are (usually) written out
   80     # FIXME: Some versions of Linux provide usleep, but it rounds times
   81     # up to the next second (!)
   82     AC_CHECK_FUNCS([usleep])
   83 
   84     # NOTE: using a "pac_cv_" prefix but not caching because of xFLAGS "side effects"
   85     pac_cv_use_coverage=yes
   86     AC_DEFINE([USE_COVERAGE],[1],[Define if performing coverage tests])
   87 fi
   88 AM_CONDITIONAL([BUILD_COVERAGE],[test "X$pac_cv_use_coverage" = "Xyes"])
   89 ])
   90