From: Wolfgang Bangerth Date: Mon, 9 Nov 2009 17:20:07 +0000 (+0000) Subject: Add a test to see if vector iterators are just plain pointers. X-Git-Tag: v8.0.0~6828 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5b1fbdc964ee88cc59eab556992d62fd1b7ac6b;p=dealii.git Add a test to see if vector iterators are just plain pointers. git-svn-id: https://svn.dealii.org/trunk@20077 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index e4f2f9e9de..1d5c72d55a 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -5017,6 +5017,40 @@ void f (const std::ostream &out); ]) + +dnl ------------------------------------------------------------- +dnl Check whether the std::vector::iterator is just a plain pointer +dnl +dnl Usage: DEAL_II_CHECK_VECTOR_ITERATOR_IS_POINTER +dnl +dnl ------------------------------------------------------------- +AC_DEFUN(DEAL_II_CHECK_VECTOR_ITERATOR_IS_POINTER, dnl +[ + AC_MSG_CHECKING(whether vector iterators are plain pointers) + AC_LANG(C++) + CXXFLAGS="$CXXFLAGSG" + AC_TRY_COMPILE( + [ +#include +template void f(T) {} + +template void f(int *); +template void f(std::vector::iterator); + ], + [ + ], + [ + AC_MSG_RESULT(no) + ], + [ + AC_MSG_RESULT(yes) + AC_DEFINE(DEAL_II_VECTOR_ITERATOR_IS_POINTER, 1, + [Define if vector iterators are just plain pointers]) + ]) +]) + + + dnl ------------------------------------------------------------- dnl Check whether glibc-like stacktrace information is available dnl for the Exception class. If it is, then try to also determine diff --git a/deal.II/base/include/base/config.h.in b/deal.II/base/include/base/config.h.in index e590b5912a..b883566d31 100644 --- a/deal.II/base/include/base/config.h.in +++ b/deal.II/base/include/base/config.h.in @@ -235,8 +235,8 @@ /* Defined if a PETSc installation was found and is going to be used */ #undef DEAL_II_USE_PETSC -/* Defined if a PETSc installation with complex scalar type was found - and is going to be used */ +/* Defined if a PETSc installation was found with complex scalar type and is + going to be used */ #undef DEAL_II_USE_PETSC_COMPLEX /* Defined if a SLEPc installation was found and is going to be used */ @@ -245,6 +245,9 @@ /* Defined if a Trilinos installation was found and is going to be used */ #undef DEAL_II_USE_TRILINOS +/* Define if vector iterators are just plain pointers */ +#undef DEAL_II_VECTOR_ITERATOR_IS_POINTER + /* This error appears in the Apple edition of the gcc 3.3, which ships with Darwin7.9.0 and probably previous version. It leads to problems during linking. For the details, look at aclocal.m4 in the top-level directory. */ diff --git a/deal.II/configure b/deal.II/configure index c3fb04bd58..a1b167a236 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -8543,6 +8543,76 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + { echo "$as_me:$LINENO: checking whether vector iterators are plain pointers" >&5 +echo $ECHO_N "checking whether vector iterators are plain pointers... $ECHO_C" >&6; } + 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 + + CXXFLAGS="$CXXFLAGSG" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +template void f(T) {} + +template void f(int *); +template void f(std::vector::iterator); + +int +main () +{ + + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define DEAL_II_VECTOR_ITERATOR_IS_POINTER 1 +_ACEOF + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for __PRETTY_FUNCTION__" >&5 echo $ECHO_N "checking for __PRETTY_FUNCTION__... $ECHO_C" >&6; } ac_ext=cpp @@ -13030,12 +13100,14 @@ fi 2.2*) if test ! -d $DEAL_II_PETSC_DIR/lib/libg_c++/$DEAL_II_PETSC_ARCH \ ; then + if test -d $DEAL_II_PETSC_DIR/lib/libg/$DEAL_II_PETSC_ARCH \ + -o -d $DEAL_II_PETSC_DIR/lib/libg_complex/$DEAL_II_PETSC_ARCH \ ; then - { { echo "$as_me:$LINENO: error: PETSc has not been compiled for C++, but - deal.II needs this" >&5 -echo "$as_me: error: PETSc has not been compiled for C++, but - deal.II needs this" >&2;} + { { echo "$as_me:$LINENO: error: PETSc has not been compiled for C++ with scalar type real, + but deal.II needs this for this PETSc version $PETSC_VERSION" >&5 +echo "$as_me: error: PETSc has not been compiled for C++ with scalar type real, + but deal.II needs this for this PETSc version $PETSC_VERSION" >&2;} { (exit 1); exit 1; }; } else { { echo "$as_me:$LINENO: error: PETSc has not been compiled for the architecture @@ -13085,14 +13157,65 @@ echo $ECHO_N "checking for PETSc libmpiuni library... $ECHO_C" >&6; } DEAL_II_PETSC_MPIUNI_LIB="$DEAL_II_PETSC_DIR/lib/libg_c++/$DEAL_II_PETSC_ARCH/libmpiuni.a" ; else if test -f $DEAL_II_PETSC_DIR/lib/$DEAL_II_PETSC_ARCH/libmpiuni.a ; then DEAL_II_PETSC_MPIUNI_LIB="$DEAL_II_PETSC_DIR/lib/$DEAL_II_PETSC_ARCH/libmpiuni.a" ; + else if test -f $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib/libmpiuni.a ; then + DEAL_II_PETSC_MPIUNI_LIB="$DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib/libmpiuni.a" ; else if test -f $DEAL_II_PETSC_DIR/lib/libg_c++/$DEAL_II_PETSC_ARCH/libmpiuni.so ; then DEAL_II_PETSC_MPIUNI_LIB="$DEAL_II_PETSC_DIR/lib/libg_c++/$DEAL_II_PETSC_ARCH/libmpiuni.so" ; else if test -f $DEAL_II_PETSC_DIR/lib/$DEAL_II_PETSC_ARCH/libmpiuni.so ; then DEAL_II_PETSC_MPIUNI_LIB="$DEAL_II_PETSC_DIR/lib/$DEAL_II_PETSC_ARCH/libmpiuni.so" ; - fi fi fi fi + else if test -f $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib/libmpiuni.so ; then + DEAL_II_PETSC_MPIUNI_LIB="$DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib/libmpiuni.so" ; + fi fi fi fi fi fi - { echo "$as_me:$LINENO: result: $DEAL_II_PETSC_MPIUNI_LIB" >&5 + if test "$DEAL_II_PETSC_MPIUNI_LIB" = "" ; then + { echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6; } + else + { echo "$as_me:$LINENO: result: $DEAL_II_PETSC_MPIUNI_LIB" >&5 echo "${ECHO_T}$DEAL_II_PETSC_MPIUNI_LIB" >&6; } + fi + + + { echo "$as_me:$LINENO: checking for PETSc scalar complex" >&5 +echo $ECHO_N "checking for PETSc scalar complex... $ECHO_C" >&6; } + + case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in + 2.*) + DEAL_II_PETSC_COMPLEX="-1" + ;; + 3.*) + DEAL_II_PETSC_COMPLEX=`cat $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/include/petscconf.h \ + | grep "#define PETSC_USE_COMPLEX" \ + | perl -pi -e 's/.*COMPLEX\s+//g;'` + ;; + *) + { { echo "$as_me:$LINENO: error: Unknown PETSc version" >&5 +echo "$as_me: error: Unknown PETSc version" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if test "$DEAL_II_PETSC_COMPLEX" = "1" ; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + + else if test "$DEAL_II_PETSC_COMPLEX" = "-1" ; then + { echo "$as_me:$LINENO: result: ignored test. complex not supported" >&5 +echo "${ECHO_T}ignored test. complex not supported" >&6; } + + else + { echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6; } + fi fi + + if test "$USE_CONTRIB_PETSC" = "yes" ; then + if test "$DEAL_II_PETSC_COMPLEX" = "1" ; then + +cat >>confdefs.h <<\_ACEOF +#define DEAL_II_USE_PETSC_COMPLEX 1 +_ACEOF + + fi fi DEAL_II_EXPAND_PETSC_VECTOR="PETScWrappers::Vector" diff --git a/deal.II/configure.in b/deal.II/configure.in index 76a936b3cc..b6908ce7e2 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -193,6 +193,7 @@ DEAL_II_CHECK_CONST_MEMBER_DEDUCTION_BUG DEAL_II_CHECK_TYPE_QUALIFIER_BUG DEAL_II_CHECK_WSYNTH_AND_STD_COMPLEX DEAL_II_CHECK_CTOR_DTOR_PRIVACY +DEAL_II_CHECK_VECTOR_ITERATOR_IS_POINTER DEAL_II_HAVE_PRETTY_FUNCTION DEAL_II_HAVE_STD_ITERATOR DEAL_II_HAVE_STD_STRINGSTREAM