Commit 30ea0414 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Enable optional NVTX profiling and add clang specific compiler flags

parent 434dddaa
Loading
Loading
Loading
Loading
+37 −9
Original line number Diff line number Diff line
@@ -92,7 +92,11 @@ AC_ARG_ENABLE(
  [AS_HELP_STRING([--enable-mpi], [enable MPI compilation [default=auto]])],
  [
    if test "x$enableval" = "xno"; then
      AC_PROG_CXX([g++ clang])
      if test "x$CXX" = "x"; then
        AC_PROG_CXX([g++ clang++])
      else
        AC_PROG_CXX([$CXX])
      fi
      AC_MSG_NOTICE([Using $CXX])
      AC_SUBST([MPIFLAGS], [""])
    elif test "x$enableval" = "xauto"; then
@@ -100,7 +104,7 @@ AC_ARG_ENABLE(
      if test "x$CXX" != "x"; then
        AC_SUBST([MPIFLAGS], [-DUSE_MPI])
      else
        AC_PROG_CXX([g++ clang])
        AC_PROG_CXX([g++ clang++])
        AC_SUBST([MPIFLAGS], [""])
      fi
    elif test "x$enableval" = "xyes"; then
@@ -113,17 +117,28 @@ AC_ARG_ENABLE(
    fi
  ],
  [
    if test "x$CXX" = "x"; then
      AC_PROG_CXX([mpicxx mpic++ mpiCC])
      if test "x$CXX" != "x"; then
        AC_SUBST([MPIFLAGS], [-DUSE_MPI])
      else
      AC_PROG_CXX([g++ clang])
        AC_PROG_CXX([g++ clang++])
        AC_SUBST([MPIFLAGS], [""])
        AC_MSG_NOTICE([Using $CXX])
      fi
    else
      AC_PROG_CXX([$CXX])
    fi
  ]
)
AC_PROG_F77([gfortran f77])
# Check whether the compiler is clang++ (needs additional flags)
CXX_IS_CLANG=$($CXX --version | grep clang)
AS_IF(
  [test "x$CXX_IS_CLANG" = "x0"],
  [AC_SUBST([CLANGFLAGS], [-stdlib=libstdc++])],
  [AC_SUBST([CLANGFLAGS], [""])]
)

# Libtool initialization
LT_INIT
@@ -219,8 +234,21 @@ AC_ARG_WITH(
  ]
)

AC_ARG_ENABLE(
  [nvtx],
  [AS_HELP_STRING([--enable-nvtx], [use NVTX profiling @<:@default=no@:>@])],
  [
    if test "x$enableval" = "xyes"; then
      AC_SUBST([NVTXFLAGS], ["-DUSE_NVTX"])
    fi
  ],
  [
    AC_SUBST([NVTXFLAGS], [""])
  ]
)

FFLAGS="-std=legacy -O3"
CXXFLAGS="-O3 -ggdb -I$HDF5_INCLUDE $MPIFLAGS $OMPFLAGS $LAPACKFLAGS $MAGMAFLAGS"
CXXFLAGS="$CLANGFLAGS -O3 -ggdb -I$HDF5_INCLUDE $OMPFLAGS $MPIFLAGS $LAPACKFLAGS $MAGMAFLAGS $NVTXFLAGS"
SUBDIRS="cluster libnptm sphere testing trapping"

# Send output to Makefiles