From 34bab2b0caa6ee955d5d2f7882a6cd36cf142536 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 18 Jan 2016 17:29:58 +0100 Subject: Allow user to pass NVCCFLAGS to configure --- build/linux/Makefile.in | 3 ++- build/linux/acinclude.m4 | 6 +++--- build/linux/configure.ac | 9 +++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/build/linux/Makefile.in b/build/linux/Makefile.in index 8eb5ffe..01ef527 100644 --- a/build/linux/Makefile.in +++ b/build/linux/Makefile.in @@ -25,6 +25,7 @@ VPATH=../.. CPPFLAGS=@SAVED_CPPFLAGS@ CXXFLAGS=@SAVED_CXXFLAGS@ +NVCCFLAGS=@SAVED_NVCCFLAGS@ LDFLAGS=@SAVED_LDFLAGS@ LIBS=@SAVED_LIBS@ @@ -37,7 +38,7 @@ CPPFLAGS+=@CPPFLAGS_OS@ ifeq ($(cuda),yes) CPPFLAGS += @CPPFLAGS_CUDA@ -DASTRA_CUDA -NVCCFLAGS = @NVCCFLAGS@ @CPPFLAGS_CUDA@ -I../.. -I../../include -DASTRA_CUDA +NVCCFLAGS += @NVCCFLAGS_EXTRA@ @CPPFLAGS_CUDA@ -I../.. -I../../include -DASTRA_CUDA LDFLAGS += @LDFLAGS_CUDA@ LIBS += -lcudart -lcufft NVCC = @NVCC@ diff --git a/build/linux/acinclude.m4 b/build/linux/acinclude.m4 index e4b6de7..d6866c3 100644 --- a/build/linux/acinclude.m4 +++ b/build/linux/acinclude.m4 @@ -93,13 +93,13 @@ int main() { } _ACEOF $1="yes" -ASTRA_RUN_STOREOUTPUT([$NVCC -c -o conftest.o conftest.cu $$2],conftest.nvcc.out) || { +ASTRA_RUN_STOREOUTPUT([$NVCC -c -o conftest.o conftest.cu $NVCCFLAGS $$2],conftest.nvcc.out) || { $1="no" # Check if hack for gcc 4.4 helps if grep -q __builtin_stdarg_start conftest.nvcc.out; then AS_ECHO(["$as_me:${as_lineno-$LINENO}: Trying CUDA hack for gcc 4.4"]) >&AS_MESSAGE_LOG_FD NVCC_OPT="-Xcompiler -D__builtin_stdarg_start=__builtin_va_start" - ASTRA_RUN_LOGOUTPUT([$NVCC -c -o conftest.o conftest.cu $$2 $NVCC_OPT]) && { + ASTRA_RUN_LOGOUTPUT([$NVCC -c -o conftest.o conftest.cu $NVCCFLAGS $$2 $NVCC_OPT]) && { $1="yes" $2="$$2 $NVCC_OPT" } @@ -133,7 +133,7 @@ IFS=, for arch in $1; do IFS=$astra_save_IFS NVCC_opt="-gencode=arch=compute_$arch,code=sm_$arch" - $NVCC -c -o conftest.o conftest.cu $$2 $NVCC_opt >conftest.nvcc.out 2>&1 && { + $NVCC -c -o conftest.o conftest.cu $NVCCFLAGS $$2 $NVCC_opt >conftest.nvcc.out 2>&1 && { NVCC_lastarch=$arch NVCC_extra="$NVCC_extra $NVCC_opt" NVCC_list="${NVCC_list:+$NVCC_list, }$arch" diff --git a/build/linux/configure.ac b/build/linux/configure.ac index 85e4324..487a8cc 100644 --- a/build/linux/configure.ac +++ b/build/linux/configure.ac @@ -30,6 +30,7 @@ LT_INIT([disable-static]) SAVED_CPPFLAGS="$CPPFLAGS" SAVED_CXXFLAGS="$CXXFLAGS" +SAVED_NVCCFLAGS="$NVCCFLAGS" SAVED_LDFLAGS="$LDFLAGS" SAVED_LIBS="$LIBS" @@ -124,10 +125,9 @@ if test x"$NVCC" != xno; then AC_SUBST(NVCC) fi -NVCCFLAGS="" if test x"$HAVECUDA" = xyes; then AC_MSG_CHECKING([if nvcc works]) - ASTRA_CHECK_NVCC(HAVECUDA,NVCCFLAGS) + ASTRA_CHECK_NVCC(HAVECUDA,NVCCFLAGS_EXTRA) AC_MSG_RESULT($HAVECUDA) fi @@ -138,7 +138,7 @@ if test x"$HAVECUDA" = xyes; then if test x"$with_cuda_compute" = x; then with_cuda_compute="10,12,20,30,35,50" fi - ASTRA_FIND_NVCC_ARCHS([$with_cuda_compute],NVCCFLAGS,NVCCARCHS) + ASTRA_FIND_NVCC_ARCHS([$with_cuda_compute],NVCCFLAGS_EXTRA,NVCCARCHS) AC_MSG_RESULT([$NVCCARCHS]) fi @@ -146,7 +146,7 @@ fi AC_SUBST(HAVECUDA) AC_SUBST(LDFLAGS_CUDA) AC_SUBST(CPPFLAGS_CUDA) -AC_SUBST(NVCCFLAGS) +AC_SUBST(NVCCFLAGS_EXTRA) # mex, matlab @@ -249,6 +249,7 @@ AC_SUBST(CPPFLAGS_OS) AC_SUBST(SAVED_CPPFLAGS) AC_SUBST(SAVED_CXXFLAGS) +AC_SUBST(SAVED_NVCCFLAGS) AC_SUBST(SAVED_LDFLAGS) AC_SUBST(SAVED_LIBS) AC_CONFIG_FILES([Makefile]) -- cgit v1.2.3