1 dnl @synopsis AC_CXX_NAMESPACES
3 dnl If the compiler can prevent names clashes using namespaces, define
6 dnl @author Luc Maisonobe
8 AC_DEFUN([AC_CXX_NAMESPACES],
9 [AC_CACHE_CHECK(whether the compiler implements namespaces,
13 AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}],
14 [using namespace Outer::Inner; return i;],
15 ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no)
18 if test "$ac_cv_cxx_namespaces" = yes; then
19 AC_DEFINE(HAVE_NAMESPACES,1,[define if the compiler implements namespaces])
25 dnl @author Luc Maisonobe
27 AC_DEFUN([AC_CXX_REQUIRE_STL],
28 [AC_CACHE_CHECK(whether the compiler supports Standard Template Library,
30 [AC_REQUIRE([AC_CXX_NAMESPACES])
33 AC_TRY_COMPILE([#include <list>
35 #ifdef HAVE_NAMESPACES
37 #endif],[list<int> x; x.push_back(5);
38 list<int>::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0;],
39 ac_cv_cxx_have_stl=yes, ac_cv_cxx_have_stl=no)
42 if test "x_$ac_cv_cxx_have_stl" != x_yes; then
43 AC_MSG_ERROR([C++ Standard Template Libary unsupported])
47 dnl@synopsys YAD_CHECK_INCLUDE_LIB(INCLUDE, LIBRARY, CODE
48 dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
49 dnl [, OTHER-LIBRARIES]]])
51 dnl same as the AC_CHECK_LIB except of the following:
52 dnl - You sholud specify include part of test.
53 dnl - You can test any code for linking, not just function calls.
55 dnl@author Alexandr Yanovets <yad@gradsoft.kiev.ua>
57 AC_DEFUN(YAD_CHECK_INCLUDE_LIB,
58 [AC_MSG_CHECKING([for $3 in -l$2])
59 dnl Use a cache variable name containing both the library and function name,
60 dnl because the test really is for library $2 defining function $3, not
61 dnl just for library $2. Separate tests with the same $2 and different $3s
62 dnl may have different results.
63 ac_lib_var=`echo $2['_']include | sed 'y%./+-%__p_%'`
64 AC_CACHE_VAL(ac_cv_lib_$ac_lib_var,
65 [yad_check_lib_save_LIBS="$LIBS"
70 eval "ac_cv_lib_$ac_lib_var=yes",
71 eval "ac_cv_lib_$ac_lib_var=no")
72 LIBS="$yad_check_lib_save_LIBS"
74 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
78 ac_tr_lib=HAVE_LIB`echo $2 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
79 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
81 AC_DEFINE_UNQUOTED($ac_tr_lib)