Mercurial > hg > octave-jordi
changeset 15134:edae65062740
build: Move unordered_map header tests to acinclude.m4 and add caching of results.
* configure.ac: Remove unordered_map header tests
* m4/acinclude.m4: New OCTAVE_UNORDERED_MAP_HEADERS macro which checks
and caches results of undordered_map and tr1_namespace checks.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 09 Aug 2012 08:29:50 -0700 |
parents | f91eac1bc66d |
children | bd6bb87e2bea |
files | configure.ac m4/acinclude.m4 |
diffstat | 2 files changed, 33 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac +++ b/configure.ac @@ -1771,27 +1771,10 @@ ## C++ headers AC_LANG_PUSH(C++) + AC_CHECK_HEADERS(sstream) -AC_CHECK_HEADERS([unordered_map], [], [ - AC_CHECK_HEADERS([tr1/unordered_map])]) -AC_MSG_CHECKING([whether unordered_map requires tr1 namespace]) -unordered_map_requires_tr1_namespace=no -if test "$ac_cv_header_unordered_map" = "yes"; then - ## Have <unordered_map>, but still have to check whether - ## tr1 namespace is required (like MSVC, for instance). - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([ - #include <unordered_map> - ], [ - std::unordered_map<int,int> m; - ])], [], [unordered_map_requires_tr1_namespace=yes]) -elif test "$ac_cv_header_tr1_unordered_map" = "yes"; then - unordered_map_requires_tr1_namespace=yes -fi -if test "$unordered_map_requires_tr1_namespace" = "yes"; then - AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, [Define to 1 if unordered_map requires the use of tr1 namespace.]) -fi -AC_MSG_RESULT([$unordered_map_requires_tr1_namespace]) +OCTAVE_UNORDERED_MAP_HEADERS + AC_LANG_POP(C++) ## Find a termio header to include. @@ -1838,10 +1821,8 @@ ### Check structures and existence of necessary members -AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev, struct group.gr_passwd]) -#AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev]) -#AC_CHECK_MEMBERS(struct group.gr_passwd) -#AC_CHECK_MEMBERS(struct group.gr_passwd) +AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev]) +AC_CHECK_MEMBERS([struct group.gr_passwd]) AC_STRUCT_TIMEZONE
--- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -73,6 +73,34 @@ AC_SUBST(ARFLAGS) ]) dnl +dnl Check for unordered map headers and whether tr1 namespace is +dnl required. +dnl +AC_DEFUN([OCTAVE_UNORDERED_MAP_HEADERS], [ +AC_CHECK_HEADERS([unordered_map], [], [ + AC_CHECK_HEADERS([tr1/unordered_map])]) +AC_CACHE_CHECK([whether unordered_map requires tr1 namespace], + [octave_cv_header_require_tr1_namespace], + [AC_LANG_PUSH(C++) + octave_cv_header_require_tr1_namespace=no + if test "$ac_cv_header_unordered_map" = "yes"; then + ## Have <unordered_map>, but still have to check whether + ## tr1 namespace is required (like MSVC, for instance). + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([ + #include <unordered_map> + ], [ + std::unordered_map<int,int> m; + ])], octave_cv_header_require_tr1_namespace=no, octave_cv_header_require_tr1_namespace=yes) + elif test "$ac_cv_header_tr1_unordered_map" = "yes"; then + octave_cv_header_require_tr1_namespace=yes + fi + AC_LANG_POP(C++)]) + if test "$octave_cv_header_require_tr1_namespace" = "yes"; then + AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, [Define to 1 if unordered_map requires the use of tr1 namespace.]) + fi +]) +dnl dnl Check if the compiler supports placement delete. dnl AC_DEFUN([OCTAVE_PLACEMENT_DELETE], @@ -122,7 +150,6 @@ fi AC_LANG_POP(C++) ]) - dnl dnl Check if the C++ library has functions to set real and imaginary dnl parts of complex numbers independently.