зеркало из https://github.com/microsoft/LightGBM.git
[R-package] pass R-configured compiler flags to checks in configure (#4506)
* [R-package] pass compiler flags to checks in configure * leave OpenMP check alone * prefer C++11 flags * install Matrix in valgrind tests * one less AC_LANG() call Co-authored-by: Nikita Titov <nekit94-12@hotmail.com>
This commit is contained in:
Родитель
112db8ab82
Коммит
2edb818848
|
@ -1694,7 +1694,17 @@ if test -z "${R_HOME}"; then
|
|||
exit 1
|
||||
fi
|
||||
CC=`"${R_HOME}/bin/R" CMD config CC`
|
||||
CXX=`"${R_HOME}/bin/R" CMD config CXX11`
|
||||
CXX11=`"${R_HOME}/bin/R" CMD config CXX11`
|
||||
CXX11STD=`"${R_HOME}/bin/R" CMD config CXX11STD`
|
||||
CXX="${CXX11} ${CXX11STD}"
|
||||
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
|
||||
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXX11FLAGS`
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
|
||||
# LightGBM-specific flags
|
||||
LGB_CPPFLAGS=""
|
||||
|
@ -1712,12 +1722,6 @@ LGB_CPPFLAGS="${LGB_CPPFLAGS} -DEIGEN_MPL2_ONLY"
|
|||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether MM_PREFETCH works" >&5
|
||||
$as_echo_n "checking whether MM_PREFETCH works... " >&6; }
|
||||
ac_mmprefetch=no
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
@ -1739,7 +1743,7 @@ main ()
|
|||
|
||||
|
||||
_ACEOF
|
||||
${CXX} -o conftest conftest.cpp 2>/dev/null && ./conftest && ac_mmprefetch=yes
|
||||
${CXX} ${CPPFLAGS} ${CXXFLAGS} -o conftest conftest.cpp 2>/dev/null && ./conftest && ac_mmprefetch=yes
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_mmprefetch}" >&5
|
||||
$as_echo "${ac_mmprefetch}" >&6; }
|
||||
if test "${ac_mmprefetch}" = yes; then
|
||||
|
@ -1753,12 +1757,6 @@ fi
|
|||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether MM_MALLOC works" >&5
|
||||
$as_echo_n "checking whether MM_MALLOC works... " >&6; }
|
||||
ac_mm_malloc=no
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
@ -1780,7 +1778,7 @@ main ()
|
|||
|
||||
|
||||
_ACEOF
|
||||
${CXX} -o conftest conftest.cpp 2>/dev/null && ./conftest && ac_mm_malloc=yes
|
||||
${CXX} ${CPPFLAGS} ${CXXFLAGS} -o conftest conftest.cpp 2>/dev/null && ./conftest && ac_mm_malloc=yes
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_mm_malloc}" >&5
|
||||
$as_echo "${ac_mm_malloc}" >&6; }
|
||||
if test "${ac_mm_malloc}" = yes; then
|
||||
|
|
|
@ -21,7 +21,12 @@ if test -z "${R_HOME}"; then
|
|||
exit 1
|
||||
fi
|
||||
CC=`"${R_HOME}/bin/R" CMD config CC`
|
||||
CXX=`"${R_HOME}/bin/R" CMD config CXX11`
|
||||
CXX11=`"${R_HOME}/bin/R" CMD config CXX11`
|
||||
CXX11STD=`"${R_HOME}/bin/R" CMD config CXX11STD`
|
||||
CXX="${CXX11} ${CXX11STD}"
|
||||
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
|
||||
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXX11FLAGS`
|
||||
AC_LANG(C++)
|
||||
|
||||
# LightGBM-specific flags
|
||||
LGB_CPPFLAGS=""
|
||||
|
@ -38,7 +43,6 @@ LGB_CPPFLAGS="${LGB_CPPFLAGS} -DEIGEN_MPL2_ONLY"
|
|||
|
||||
AC_MSG_CHECKING([whether MM_PREFETCH works])
|
||||
ac_mmprefetch=no
|
||||
AC_LANG(C++)
|
||||
AC_LANG_CONFTEST(
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
|
@ -53,7 +57,7 @@ AC_LANG_CONFTEST(
|
|||
)
|
||||
]
|
||||
)
|
||||
${CXX} -o conftest conftest.cpp 2>/dev/null && ./conftest && ac_mmprefetch=yes
|
||||
${CXX} ${CPPFLAGS} ${CXXFLAGS} -o conftest conftest.cpp 2>/dev/null && ./conftest && ac_mmprefetch=yes
|
||||
AC_MSG_RESULT([${ac_mmprefetch}])
|
||||
if test "${ac_mmprefetch}" = yes; then
|
||||
LGB_CPPFLAGS+=" -DMM_PREFETCH=1"
|
||||
|
@ -65,7 +69,6 @@ fi
|
|||
|
||||
AC_MSG_CHECKING([whether MM_MALLOC works])
|
||||
ac_mm_malloc=no
|
||||
AC_LANG(C++)
|
||||
AC_LANG_CONFTEST(
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
|
@ -80,7 +83,7 @@ AC_LANG_CONFTEST(
|
|||
)
|
||||
]
|
||||
)
|
||||
${CXX} -o conftest conftest.cpp 2>/dev/null && ./conftest && ac_mm_malloc=yes
|
||||
${CXX} ${CPPFLAGS} ${CXXFLAGS} -o conftest conftest.cpp 2>/dev/null && ./conftest && ac_mm_malloc=yes
|
||||
AC_MSG_RESULT([${ac_mm_malloc}])
|
||||
if test "${ac_mm_malloc}" = yes; then
|
||||
LGB_CPPFLAGS+=" -DMM_MALLOC=1"
|
||||
|
|
Загрузка…
Ссылка в новой задаче