# HG changeset patch # User Rik # Date 1344526190 25200 # Node ID edae65062740af4158e64a0e2328f0f56c05ad11 # Parent f91eac1bc66d7295434690b477600925ac4a78f1 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. diff --git a/configure.ac b/configure.ac --- 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 , but still have to check whether - ## tr1 namespace is required (like MSVC, for instance). - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([ - #include - ], [ - std::unordered_map 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 diff --git a/m4/acinclude.m4 b/m4/acinclude.m4 --- 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 , but still have to check whether + ## tr1 namespace is required (like MSVC, for instance). + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([ + #include + ], [ + std::unordered_map 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.