Permalink
Browse files

Change LDFLAGS_PVFMM to LDLIBS_PVFMM

- LDLIBS_PVFMM contains both LDFLAGS and LDLIBS. LDFLAGS_PVFMM is now
  deprecated.
- Separate variables for different libraries and PVFMM_INCLUDES and
  PVFMM_LIBS, so that external projects do not have to use all of the
  libraries and flags set by PVFMM configure script.
- Add libstdc++ and libdl to configure.ac
- In m4/ax_check_cuda.m4 change CUDA_LDFLAGS to CUDA_LDLIBS.
- In Makefile.am change NVCC to NVCC_PVMM and NVCCFLAGS to
  NVCCFLAGS_PVFMM.
  • Loading branch information...
dmalhotra committed Oct 6, 2014
1 parent 1b8d858 commit 89eb63461fa1a7e5be727427e3035fea2a74de05
Showing with 42 additions and 34 deletions.
  1. +24 −22 MakeVariables.in
  2. +7 −5 Makefile.am
  3. +4 −0 configure.ac
  4. +7 −7 m4/ax_check_cuda.m4
@@ -1,38 +1,40 @@
# Load this file inside your Makefile and use the variables CXXFLAGS_PVFMM and
# LDFLAGS_PVFMM for compiling your code. You can use examples/Makefile as a
# LDLIBS_PVFMM for compiling your code. You can use examples/Makefile as a
# template makefile for your projects linking to this library.
INSTALL_DIR_PVFMM = @prefix@
TOP_SRCDIR_PVFMM = @abs_top_srcdir@
PKG_SUBDIR_PVFMM =
PKG_SUBDIR_PVFMM =
# Compiler and flags.
CXX_PVFMM = @MPICXX@
INTEL_OFFLOAD_OK=@intel_offload_ok@
# nvcc compiler and flags.
NVCC_PVFMM = @NVCC@
NVCCFLAGS_PVFMM = @NVCCFLAGS@ @CUDA_CFLAGS@
# The PVFMM library and headers.
PVFMM_INCLUDES = -I$(TOP_SRCDIR_PVFMM)/include$(PKG_SUBDIR_PVFMM)
PVFMM_LIBS = -L$(TOP_SRCDIR_PVFMM)/lib$(PKG_SUBDIR_PVFMM) -lpvfmm
CXXFLAGS_PVFMM = @CXXFLAGS@ -DALLTOALLV_FIX
LDFLAGS_PVFMM = @LIBS@
# Add FFTW include and lib paths.
FFTW_INCLUDES_PVFMM = @FFTW_INCLUDE@
FFTW_LIBS_PVFMM = @FFTW_LIB@ @FFTWF_LIB@
# The PVFMM library and headers..
CXXFLAGS_PVFMM += -I$(TOP_SRCDIR_PVFMM)/include$(PKG_SUBDIR_PVFMM)
LDFLAGS_PVFMM += -L$(TOP_SRCDIR_PVFMM)/lib$(PKG_SUBDIR_PVFMM) -lpvfmm
# BLAS, LAPACK libs.
BLAS_LAPACK_LIB_PVFMM = @LAPACK_LIBS@ @BLAS_LIBS@ @FLIBS@
# Add CUDA include and libs.
CXXFLAGS_PVFMM += @CUDA_CFLAGS@
LDFLAGS_PVFMM += @CUDA_LDFLAGS@
# X include and lib paths.
X_INCLUDES_PVFMM = @X_INCLUDES@
X_LIBS_PVFMM = @X_LIBS@
# Add FFTW include and lib paths.
CXXFLAGS_PVFMM += @FFTW_INCLUDE@
LDFLAGS_PVFMM += @FFTW_LIB@ @FFTWF_LIB@
# nvcc compiler and flags.
NVCC_PVFMM = @NVCC@
NVCCFLAGS_PVFMM = @NVCCFLAGS@ @CUDA_CFLAGS@ $(PVFMM_INCLUDES)
# CUDA include and libs.
CUDA_CFLAGS_PVFMM = @CUDA_CFLAGS@
CUDA_LDLIBS_PVFMM = @CUDA_LDLIBS@
# Add BLAS, LAPACK libs.
LDFLAGS_PVFMM += @LAPACK_LIBS@ @BLAS_LIBS@ @FLIBS@
# Add all CXXFLAGS_PVFMM and LDLIBS_PVFMM
CXXFLAGS_PVFMM = @CXXFLAGS@ -DALLTOALLV_FIX $(PVFMM_INCLUDES) $(FFTW_INCLUDES_PVFMM) $(X_INCLUDES_PVFMM) $(CUDA_CFLAGS_PVFMM)
LDLIBS_PVFMM = @LDFLAGS@ $(PVFMM_LIBS) $(FFTW_LIBS_PVFMM) $(BLAS_LAPACK_LIB_PVFMM) $(X_LIBS_PVFMM) $(CUDA_LDLIBS_PVFMM) @LIBS@
# Add X include and lib paths.
CXXFLAGS_PVFMM += @X_INCLUDES@
LDFLAGS_PVFMM += @X_LIBS@
LDFLAGS_PVFMM +=-ldl -lstdc++
LDFLAGS_PVFMM = $(LDLIBS_PVFMM) # Deprecated, use LDLIBS_PVFMM instead
@@ -1,8 +1,10 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
ACLOCAL_AMFLAGS = -I m4 $(ACLOCAL_FLAGS)
AUTOMAKE_OPTIONS = subdir-objects
@SET_MAKE@
include MakeVariables.in
CXXFLAGS = $(CXXFLAGS_PVFMM)
LDLIBS = $(LDLIBS_PVFMM)
# DOXYGEN SUPPORT
include aminclude.am
@@ -25,8 +27,8 @@ EXTRA_DIST = \
scripts
# additional include pathes necessary to compile the C++ library
AM_CXXFLAGS = $(CXXFLAGS_PVFMM)
AM_LDFLAGS = -static $(LDFLAGS_PVFMM)
AM_CXXFLAGS =
AM_LDFLAGS = -static
###############################################################################
# THE LIBRARIES TO BUILD
@@ -127,7 +129,7 @@ all: #all-docs all-examples
if NVCC_OK
.cu.o :
$(NVCC) $(NVCCFLAGS) ${INCLUDE_PVFMM} -c $< -o $@
$(NVCC_PVFMM) $(NVCCFLAGS_PVFMM) -c $< -o $@
endif
@@ -203,7 +205,7 @@ install: install-am
@echo ' export PVFMM_DIR=$(INSTALL_DIR)'
@echo
@echo 'You will need to load $$(PVFMM_DIR)/MakeVariables in your Makefile and'
@echo 'use the variables CXXFLAGS_PVFMM and LDFLAGS_PVFMM for compiling your code.'
@echo 'use the variables CXXFLAGS_PVFMM and LDLIBS_PVFMM for compiling your code.'
@echo '======================================================================='
install-data-local: install-make-variables install-doxygen-doc
@@ -90,6 +90,10 @@ else
AC_SUBST(X_LIBS)
fi
# Check for libstdc++, libdl
AC_CHECK_LIB(stdc++,main)
AC_CHECK_LIB(dl,dlopen)
# Check for OpenMP
AC_LANG_WERROR([on])
if $USE_OPENMP; then
@@ -17,7 +17,7 @@
# NVCC : the nvcc compiler command.
# NVCCFLAGS : nvcc specific flags
# CUDA_CFLAGS : CUDA includes
# CUDA_LDFLAGS: CUDA libraries
# CUDA_LDLIBS : CUDA libraries
# NVCC_OK : Automake conditional (defined if CUDA is enabled)
#
# Defines HAVE_CUDA in config.h
@@ -37,7 +37,7 @@ AC_ARG_WITH([cuda],
NVCC=no
CUDA_CFLAGS=
CUDA_LDFLAGS=
CUDA_LDLIBS=
if test "x$with_cuda" != "xno"
then
@@ -50,13 +50,13 @@ then
AX_NORMALIZE_PATH([with_cuda], ["/"])
CUDAPATH="$with_cuda"
CUDA_CFLAGS+=" -I$with_cuda/include"
CUDA_LDFLAGS+=" -L$with_cuda/lib64"
CUDA_LDLIBS+=" -L$with_cuda/lib64"
else
AC_CHECK_FILE(/usr/local/cuda/,[CUDAPATH="/usr/local/cuda"],[])
AC_CHECK_FILE(/usr/local/cuda/include,[CUDA_CFLAGS+=" -I/usr/local/cuda/include"],[CUDA_CFLAGS=""])
AC_CHECK_FILE(/usr/local/cuda/lib64,[CUDA_LDFLAGS+=" -L/usr/local/cuda/lib64"],[])
AC_CHECK_FILE(/usr/local/cuda/lib64,[CUDA_LDLIBS+=" -L/usr/local/cuda/lib64"],[])
fi
CUDA_LDFLAGS+=" -lcuda -lcudart -lcublas"
CUDA_LDLIBS+=" -lcuda -lcudart -lcublas"
# -----------------------------------------
@@ -128,7 +128,7 @@ EOF
ax_save_LIBS="${LIBS}"
CXXFLAGS="$CUDA_CFLAGS $CXXFLAGS"
LIBS="$CUDA_LDFLAGS $LIBS"
LIBS="$CUDA_LDLIBS $LIBS"
# And the header and the lib
AC_CHECK_HEADER([cuda.h], [], AC_MSG_FAILURE([Couldn't find cuda.h]), [#include <cuda.h>])
@@ -150,7 +150,7 @@ fi
AC_SUBST([NVCC])
AC_SUBST([NVCCFLAGS])
AC_SUBST([CUDA_CFLAGS])
AC_SUBST([CUDA_LDFLAGS])
AC_SUBST([CUDA_LDLIBS])
AM_CONDITIONAL([NVCC_OK], [test "x$ac_compile_nvcc" = "xyes"])
])

0 comments on commit 89eb634

Please sign in to comment.