# Check for hash_map extension. This is from
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_map.html
#
-AC_DEFUN([AC_CXX_HAVE_EXT_HASH_MAP],
-[AC_CACHE_CHECK(whether the compiler has ext/hash_map,
-ac_cv_cxx_have_ext_hash_map,
-[AC_REQUIRE([AC_CXX_NAMESPACES])
+AC_DEFUN([AC_CXX_HAVE_STD_EXT_HASH_MAP],
+[AC_CACHE_CHECK([whether the compiler has <ext/hash_map> defining template class std::hash_map],
+ ac_cv_cxx_have_std_ext_hash_map,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <ext/hash_map>
#ifdef HAVE_NAMESPACES
using namespace std;
-#endif],[hash_map<int, int> t; return 0;],
- ac_cv_cxx_have_ext_hash_map=std, ac_cv_cxx_have_ext_hash_map=no)
+#endif],[hash_map<int, int> t;],
+ [ac_cv_cxx_have_std_ext_hash_map=yes], [ac_cv_cxx_have_std_ext_hash_map=no])
+ AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_std_ext_hash_map" = yes; then
+ AC_DEFINE(HAVE_STD_EXT_HASH_MAP,,[Define if the compiler has a header <ext/hash_map> that defines template class std::hash_map.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_MAP],
+[AC_CACHE_CHECK([whether the compiler has <ext/hash_map> defining template class __gnu_cxx::hash_map],
+ ac_cv_cxx_have_gnu_ext_hash_map,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <ext/hash_map>
#ifdef HAVE_NAMESPACES
using namespace __gnu_cxx;
-#endif],[hash_map<int, int> t; return 0;],
- ac_cv_cxx_have_ext_hash_map=gnu, ac_cv_cxx_have_ext_hash_map=no)
- AC_LANG_RESTORE
-])
-if test "$ac_cv_cxx_have_ext_hash_map" = std; then
- AC_DEFINE(HAVE_STD_EXT_HASH_MAP,,[define if the compiler has ext/hash_map])
-fi
-if test "$ac_cv_cxx_have_ext_hash_map" = gnu; then
- AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,,[define if the compiler has ext/hash_map])
-fi
-])
-
+#endif],[hash_map<int,int> t; ],
+ [ac_cv_cxx_have_gnu_ext_hash_map=yes],[ac_cv_cxx_have_gnu_ext_hash_map=no])
+ AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_gnu_ext_hash_map" = yes; then
+ AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,,[Define if the compiler has a header <ext/hash_map> that defines template class __gnu_cxx::hash_map.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_MAP],
+[AC_CACHE_CHECK([whether the compiler has <hash_map> defining template class ::hash_map],
+ ac_cv_cxx_have_global_hash_map,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([#include <hash_map>],[hash_map<int,int> t; ],
+ [ac_cv_cxx_have_global_hash_map=yes], [ac_cv_cxx_have_global_hash_map=no])
+ AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_global_hash_map" = yes; then
+ AC_DEFINE(HAVE_GLOBAL_HASH_MAP,,[Define if the compiler has a header <hash_map> that defines template class ::hash_map.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_HASH_MAP],
+[AC_CXX_HAVE_STD_EXT_HASH_MAP
+ AC_CXX_HAVE_GNU_EXT_HASH_MAP
+ AC_CXX_HAVE_GLOBAL_HASH_MAP])
#
# Check for hash_set extension. This is modified from
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html
#
-AC_DEFUN([AC_CXX_HAVE_EXT_HASH_SET],
-[AC_CACHE_CHECK(whether the compiler has ext/hash_set,
-ac_cv_cxx_have_ext_hash_set,
-[AC_REQUIRE([AC_CXX_NAMESPACES])
+AC_DEFUN([AC_CXX_HAVE_STD_EXT_HASH_SET],
+[AC_CACHE_CHECK([whether the compiler has <ext/hash_set> defining template class std::hash_set],
+ ac_cv_cxx_have_std_ext_hash_set,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <ext/hash_set>
#ifdef HAVE_NAMESPACES
using namespace std;
-#endif],[hash_set<int> t; return 0;],
- ac_cv_cxx_have_ext_hash_set=std, ac_cv_cxx_have_ext_hash_set=no)
+#endif],[hash_set<int> t; ],
+ [ac_cv_cxx_have_std_ext_hash_set=yes], [ac_cv_cxx_have_std_ext_hash_set=no])
+ AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_std_ext_hash_set" = yes; then
+ AC_DEFINE(HAVE_STD_EXT_HASH_SET,,[Define if the compiler has a header <ext/hash_set> that defines template class std::hash_set.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_SET],
+[AC_CACHE_CHECK(
+ [whether the compiler has <ext/hash_set> defining template class __gnu_cxx::hash_set],
+ ac_cv_cxx_have_gnu_ext_hash_set,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <ext/hash_set>
#ifdef HAVE_NAMESPACES
using namespace __gnu_cxx;
-#endif],[hash_set<int> t; return 0;],
- ac_cv_cxx_have_ext_hash_set=gnu, ac_cv_cxx_have_ext_hash_set=no)
- AC_LANG_RESTORE
-])
-if test "$ac_cv_cxx_have_ext_hash_set" = std; then
- AC_DEFINE(HAVE_STD_EXT_HASH_SET,,[define if the compiler has ext/hash_set in std])
-fi
-if test "$ac_cv_cxx_have_ext_hash_set" = gnu; then
- AC_DEFINE(HAVE_GNU_EXT_HASH_SET,,[define if the compiler has ext/hash_set in __gnu_cc])
-fi
-])
+#endif],[hash_set<int> t; ],
+ [ac_cv_cxx_have_gnu_ext_hash_set=yes], [ac_cv_cxx_have_gnu_ext_hash_set=no])
+ AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_gnu_ext_hash_set" = yes; then
+ AC_DEFINE(HAVE_GNU_EXT_HASH_SET,,[Define if the compiler has a header <ext/hash_set> that defines template class __gnu_cxx::hash_set.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_SET],
+[AC_CACHE_CHECK([whether the compiler has <hash_set> defining template class ::hash_set],
+ ac_cv_cxx_have_global_hash_set,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([#include <hash_set>],[hash_set<int> t; return 0;],
+ [ac_cv_cxx_have_global_hash_set=yes], [ac_cv_cxx_have_global_hash_set=no])
+ AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_global_hash_set" = yes; then
+ AC_DEFINE(HAVE_GLOBAL_HASH_SET,,[Define if the compiler has a header <hash_set> that defines template class ::hash_set.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_HASH_SET],
+[AC_CXX_HAVE_STD_EXT_HASH_SET
+ AC_CXX_HAVE_GNU_EXT_HASH_SET
+ AC_CXX_HAVE_GLOBAL_HASH_SET])
#
# Check for standard iterator extension. This is modified from
[AC_LANG_SAVE
AC_LANG_C
AC_TRY_RUN([
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
int fd;
int main () {
- fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != MAP_FAILED);}],
+ fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != (int) MAP_FAILED);}],
ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no)
AC_LANG_RESTORE
])
if test "$ac_cv_func_mmap_file" = yes; then
- AC_DEFINE(HAVE_MMAP_FILE)
+ AC_DEFINE([HAVE_MMAP_FILE],[],[Define if mmap() can map files into memory])
AC_SUBST(MMAP_FILE,[yes])
fi
])
AC_LANG_RESTORE
])
if test "$ac_cv_header_mmap_anon" = yes; then
- AC_DEFINE(HAVE_MMAP_ANONYMOUS)
+ AC_DEFINE([HAVE_MMAP_ANONYMOUS],[],[Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if it uses MAP_ANON])
fi
])
+#
+# Configure a Makefile without clobbering it if it exists and is not out of
+# date. This is modified from:
+# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html
+#[AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1)
+#
+AC_DEFUN([AC_CONFIG_MAKEFILE],
+[AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1,${srcdir}/autoconf/mkinstalldirs `dirname $1`)
+])
+
+#
+# Determine if the printf() functions have the %a format character.
+# This is modified from:
+# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html
+AC_DEFUN([AC_C_PRINTF_A],
+[
+ AC_LANG_SAVE
+ AC_LANG_C
+ AC_RUN_IFELSE(
+ AC_LANG_PROGRAM([#include <stdio.h>
+ #include <stdlib.h>],
+ [[[
+ volatile double A, B;
+ char Buffer[100];
+ A = 1;
+ A /= 10.0;
+ sprintf(Buffer, "%a", A);
+ B = atof(Buffer);
+ if (A != B)
+ return (1);
+ if (A != 0x1.999999999999ap-4)
+ return (1);
+ return (0);]]]),
+ ac_c_printf_a=yes,ac_c_printf_a=no)
+ AC_LANG_RESTORE
+ if test "$ac_c_printf_a" = "yes"; then
+ AC_DEFINE([HAVE_PRINTF_A],[1],[Define to have the %a format string])
+ fi
+])
+
+