diff --git a/H/Yap.h b/H/Yap.h index f95a52dee..e77096ed7 100755 --- a/H/Yap.h +++ b/H/Yap.h @@ -117,6 +117,25 @@ typedef int _Bool; #define FALSE false #endif +/** + * Stolen from Mozzila, this code should deal with bad implementations of stdc++. + * + * Use C++11 nullptr if available; otherwise use a C++ typesafe template; and + * for C, fall back to longs. See bugs 547964 and 626472. + */ +#ifndef HAVE_NULLPTR +#ifndef __cplusplus +# define nullptr ((void*)0) +#elif defined(__GNUC__) +# define nullptr __null +#elif defined(_WIN64) +# define nullptr 0LL +#else +# define nullptr 0L +#endif +#endif /* defined(HAVE_NULLPTR) */ + + /* Microsoft's Visual C++ Compiler */ #ifdef _MSC_VER /* adjust a config.h from mingw32 to work with vc++ */ #ifdef HAVE_GCC diff --git a/configure b/configure index 4e5beb6d4..69e3553cc 100755 --- a/configure +++ b/configure @@ -4401,6 +4401,55 @@ case "$target_cpu" in esac +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for nullptr" >&5 +$as_echo_n "checking for nullptr... " >&6; } + +if ${ac_cv_nullptr+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +int* foo = nullptr; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_nullptr=true +else + ac_cv_nullptr=false +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +if test "$ac_cv_nullptr" = true -o $_MSC_VER -ge 1600; then + $as_echo "#define HAVE_NULLPTR 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + $as_echo "#define MSHIFTOFFS 1" >>confdefs.h @@ -4814,8 +4863,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu CXXFLAGS=-std=c++0x { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CXX supports -std-c++0x" >&5 $as_echo_n "checking whether CXX supports -std-c++0x... " >&6; } - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -12295,7 +12343,7 @@ if test "$PKG_ODBC" != ""; then # Check whether --with-odbc was given. if test "${with_odbc+set}" = set; then : withval=$with_odbc; case $withval in - no|yes) echo 'Specify dir for ODBC please'; + no|yes) echo 'Specify dir for XPM please'; exit 1 ;; *) ODBC_DIR=${withval} esac @@ -13904,7 +13952,7 @@ else JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST -/* #line 13907 "configure" */ +/* #line 13955 "configure" */ public class Test { } EOF @@ -14080,7 +14128,7 @@ EOF if uudecode$EXEEXT Test.uue; then ac_cv_prog_uudecode_base64=yes else - echo "configure: 14083: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 + echo "configure: 14131: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 echo "configure: failed file was:" >&5 cat Test.uue >&5 ac_cv_prog_uudecode_base64=no @@ -14211,7 +14259,7 @@ else JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST -/* #line 14214 "configure" */ +/* #line 14262 "configure" */ public class Test { } EOF @@ -14246,7 +14294,7 @@ JAVA_TEST=Test.java CLASS_TEST=Test.class TEST=Test cat << \EOF > $JAVA_TEST -/* [#]line 14249 "configure" */ +/* [#]line 14297 "configure" */ public class Test { public static void main (String args[]) { System.exit (0); @@ -16941,7 +16989,7 @@ fi *darwin*) CUDA_LDFLAGS="$LDFLAGS" CUDA_CPPFLAGS="-arch=sm_20 -Xcompiler -fPIC -O3 " - CUDA_SHLIB_LD="$NVCC -L../.. -lYap " + CUDA_SHLIB_LD="$NVCC -Xcompiler -shared -L../.. -lYap " ;; *linux*) CUDA_LDFLAGS="$LDFLAGS" diff --git a/configure.in b/configure.in index fea7090d1..ea086b6dd 100755 --- a/configure.in +++ b/configure.in @@ -111,6 +111,24 @@ case "$target_cpu" in YAP_TARGET=unknown ;; esac + + +dnl Check for nullptr (bug 626472) +AC_LANG_CPLUSPLUS +AC_MSG_CHECKING(for nullptr) +AC_CACHE_VAL(ac_cv_nullptr, + [AC_TRY_COMPILE([], + [int* foo = nullptr;], + [ac_cv_nullptr=true], + [ac_cv_nullptr=false])]) +if test "$ac_cv_nullptr" = true -o $_MSC_VER -ge 1600; then + AC_DEFINE(HAVE_NULLPTR) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_LANG_C dnl hardware/engine AC_DEFINE(MSHIFTOFFS, 1, [compiler should shift offsets.]) diff --git a/packages/cuda/configure.in b/packages/cuda/configure.in index c06fa8177..7dfa0569b 100644 --- a/packages/cuda/configure.in +++ b/packages/cuda/configure.in @@ -26,7 +26,7 @@ else *darwin*) CUDA_LDFLAGS="$LDFLAGS" CUDA_CPPFLAGS="-arch=sm_20 -Xcompiler -fPIC -O3 " - CUDA_SHLIB_LD="$NVCC -L../.. -lYap " + CUDA_SHLIB_LD="$NVCC -Xcompiler -shared -L../.. -lYap " ;; *linux*) CUDA_LDFLAGS="$LDFLAGS"