Skip to content
Snippets Groups Projects
Commit ac1f2dc8 authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

[cleanup] Remove remaining check from dune_tr1_headers.m4

With GCC 4.4 or newer HAVE_INTEGRL_CONSTANT, HAVE_STD_HASH, and
HAVE_TYPE_TRAITS is always 1, no further testing necessary.
The test defines will be removed after the next Dune release.
parent f9e3fbf6
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,6 @@
# HAS_ATTRIBUTE_UNUSED True if attribute unused is supported
# HAS_ATTRIBUTE_DEPRECATED True if attribute deprecated is supported
# HAS_ATTRIBUTE_DEPRECATED_MSG True if attribute deprecated("msg") is supported
# HAVE_INTEGRAL_CONSTANT True if compiler supports integral_constant
# HAVE_CONSTEXPR True if constexpr is supported
# HAVE_KEYWORD_FINAL True if final is supported.
......@@ -60,53 +59,6 @@ check_cxx_source_compiles("
}
" HAVE_NULLPTR
)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
if(NOT DISABLE_TR1_HEADERS)
# Search for some tr1 headers
foreach(_HEADER type_traits tr1/type_traits)
string(REPLACE "/" "_" _HEADER_VAR ${_HEADER})
string(TOUPPER ${_HEADER_VAR} _HEADER_VAR )
check_include_file_cxx(${_HEADER} "HAVE_${_HEADER_VAR}")
endforeach()
# Check for hash support
check_include_file_cxx("functional" "HAVE_FUNCTIONAL")
if(NOT HAVE_FUNCTIONAL)
check_include_file_cxx("tr1/functional" "HAVE_TR1_FUNCTIONAL")
if(HAVE_TR1_FUNCTIONAL)
set(_functional_header "tr1/functional")
set(_hash_type "std::tr1::hash")
set(_hash_variable "HAVE_TR1_HASH")
endif(HAVE_TR1_FUNCTIONAL)
else()
set(_functional_header "functional")
set(_hash_type "std::hash")
set(_hash_variable "HAVE_STD_HASH")
endif(NOT HAVE_FUNCTIONAL)
if(_functional_header)
check_cxx_source_compiles("
#include <${_functional_header}>
int main(void){
${_hash_type}<int> hasher; hasher(42);
}
" ${_hash_variable})
endif(_functional_header)
# Check whether if std::integral_constant< T, v > is supported and casts into T
check_cxx_source_compiles("
#include <type_traits>
void f( int ){}
int main(void){
f( std::integral_constant< int, 42 >() );
}
" HAVE_INTEGRAL_CONSTANT
)
endif(NOT DISABLE_TR1_HEADERS)
# __attribute__((unused))
check_cxx_source_compiles("
......
......@@ -29,6 +29,9 @@
/* old feature support macros which were tested until 2.3, keep around for one more release */
/* As these are now always supported due to the new compiler requirements, they are directly */
/* defined without an explicit test. */
#define HAVE_INTEGRAL_CONSTANT 1
#define HAVE_STD_HASH 1
#define HAVE_TYPE_TRAITS 1
#define HAVE_VARIADIC_TEMPLATES 1
#define HAVE_VARIADIC_CONSTRUCTOR_SFINAE 1
#define HAVE_RVALUE_REFERENCES 1
......@@ -69,23 +72,6 @@
/* Define to 1 if you have <sys/mman.h>. */
#cmakedefine HAVE_SYS_MMAN_H 1
/* Define to 1 if the std::tr1::hash template from TR1 is available. */
#cmakedefine HAVE_TR1_HASH 1
/* Define to 1 if you have the <tr1/type_traits> header file. */
#cmakedefine HAVE_TR1_TYPE_TRAITS 1
/* Define to 1 if std::integral_constant< T, v > is supported
* and casts into T
*/
#cmakedefine HAVE_INTEGRAL_CONSTANT 1
/* Define to 1 if the std::hash template from C++11 is available. */
#cmakedefine HAVE_STD_HASH 1
/* Define to 1 if you have the <type_traits> header file. */
#cmakedefine HAVE_TYPE_TRAITS 1
/* Define to 1 if the MPI2 Standard is supported */
#cmakedefine MPI_2 1
......
......@@ -25,7 +25,6 @@ install(PROGRAMS
dune_linkcxx.m4
dune_mpi.m4
dune_streams.m4
dune_tr1_headers.m4
dune_unused.m4
fortran_overwrite.m4
gmp.m4
......
......@@ -28,7 +28,6 @@ ALLM4S = \
dune_linkcxx.m4 \
dune_mpi.m4 \
dune_streams.m4 \
dune_tr1_headers.m4 \
dune_unused.m4 \
fortran_overwrite.m4 \
gmp.m4 \
......
......@@ -65,6 +65,9 @@ AC_DEFUN([CXX11],[
fi
# set feature support macros for backwards compatibility
AC_DEFINE(HAVE_INTEGRAL_CONSTANT, 1, [THIS MACRO IS DEPRECATED AND ONLY KEPT FOR BACKWARDS COMPATIBILITY UNTIL THE NEXT RELEASE!])
AC_DEFINE(HAVE_STD_HASH, 1, [THIS MACRO IS DEPRECATED AND ONLY KEPT FOR BACKWARDS COMPATIBILITY UNTIL THE NEXT RELEASE!])
AC_DEFINE(HAVE_TYPE_TRAITS, 1, [THIS MACRO IS DEPRECATED AND ONLY KEPT FOR BACKWARDS COMPATIBILITY UNTIL THE NEXT RELEASE!])
AC_DEFINE(HAVE_VARIADIC_TEMPLATES, 1, [THIS MACRO IS DEPRECATED AND ONLY KEPT FOR BACKWARDS COMPATIBILITY UNTIL THE NEXT RELEASE!])
AC_DEFINE(HAVE_VARIADIC_CONSTRUCTOR_SFINAE, 1, [THIS MACRO IS DEPRECATED AND ONLY KEPT FOR BACKWARDS COMPATIBILITY UNTIL THE NEXT RELEASE!])
AC_DEFINE(HAVE_RVALUE_REFERENCES, 1, [THIS MACRO IS DEPRECATED AND ONLY KEPT FOR BACKWARDS COMPATIBILITY UNTIL THE NEXT RELEASE!])
......
......@@ -31,7 +31,6 @@ AC_DEFUN([DUNE_COMMON_CHECKS],
AC_REQUIRE([DUNE_PATH_XDR])
AC_REQUIRE([DUNE_MPI])
AC_REQUIRE([DUNE_SYS_MPROTECT])
AC_REQUIRE([DUNE_TR1_HEADERS])
dnl check for programs
AC_REQUIRE([AC_PROG_CC])
......
## -*- autoconf -*-
AC_DEFUN([DUNE_TR1_HEADERS], [
# Allow disabling tr1 headers. E.g. needed for broken xlc on Blue Gene
AC_LANG_PUSH([C++])
AC_ARG_ENABLE([tr1-headers],
[AS_HELP_STRING([--disable-tr1-headers],
[Prevents checking for tr1 headers like tuple, array, etc.
This might be needed for broken compilers like xlc on Blue Gene])],
[],
[enable_tr1_headers=yes])
AS_IF([test "x$enable_tr1_headers" != "xno"],
[AC_CHECK_HEADERS([type_traits tr1/type_traits])
AC_CACHE_CHECK([whether integral_constant conforming to C++11 is supported], dune_cv_integral_constant_cplusplus11, [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#include <type_traits>
void f( int );
],[
f( std::integral_constant< int, 42 >() );
])
],[
dune_cv_integral_constant_cplusplus11=yes
],[
dune_cv_integral_constant_cplusplus11=no
])
])
AS_IF([test "x$dune_cv_integral_constant_cplusplus11" != "xno"],[
AC_DEFINE([HAVE_INTEGRAL_CONSTANT], 1, [Define to 1 if std::integral_constant< T, v > is supported and casts into T])
])
AC_CACHE_CHECK([whether std::hash from C++11 is supported], dune_cv_hash_cplusplus11, [
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <functional>]],
[[std::hash<int> hasher; hasher(42);]])],
dune_cv_hash_cplusplus11=yes,
dune_cv_hash_cplusplus11=no)
])
AS_IF([test "x$dune_cv_hash_cplusplus11" != "xno"],
[AC_DEFINE([HAVE_STD_HASH], 1, [Define to 1 if the std::hash template from C++11 is available])
])
AC_CACHE_CHECK([whether std::tr1::hash from TR1 is supported], dune_cv_hash_cplusplustr1, [
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <tr1/functional>]],
[[std::tr1::hash<int> hasher; hasher(42);]])],
dune_cv_hash_cplusplustr1=yes,
dune_cv_hash_cplusplustr1=no)
])
AS_IF([test "x$dune_cv_hash_cplusplustr1" != "xno"],
[AC_DEFINE([HAVE_TR1_HASH], 1, [Define to 1 if the std::tr1::hash template from TR1 is available])
])
])
AC_LANG_POP([C++])
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment