1 dnl OJ_CHECK_SIZEOF(TYPE, HEADER [, CROSS-SIZE])
2 AC_DEFUN([OJ_CHECK_SIZEOF],
3 [changequote(<<, >>)dnl
4 dnl The name to #define.
5 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
6 dnl The cache variable name.
7 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
9 AC_MSG_CHECKING(size of $1)
10 AC_CACHE_VAL(AC_CV_NAME,
11 [AC_TRY_RUN([#include <stdio.h>
15 FILE *f=fopen("conftestval", "w");
17 fprintf(f, "%d\n", sizeof($1));
19 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3] , , AC_CV_NAME=$3))])dnl
20 AC_MSG_RESULT($AC_CV_NAME)
21 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
22 undefine([AC_TYPE_NAME])dnl
23 undefine([AC_CV_NAME])dnl
27 dnl @synopsis AC_CXX_PLACEMENT_OPERATOR_DELETE
29 dnl If the compiler supports void delete(size_t,void*), define
30 dnl HAVE_PLACEMENT_OPERATOR_DELETE.
32 dnl @author Matthias Clasen
34 AC_DEFUN([AC_CXX_PLACEMENT_OPERATOR_DELETE],
35 [AC_CACHE_CHECK(whether the compiler supports placement operator delete,
36 ac_cv_cxx_placement_operator_delete,
39 AC_TRY_COMPILE([#include <stddef.h>],
43 void *operator new(size_t,bool) { };
44 void operator delete(size_t,void*) { };
46 ac_cv_cxx_placement_operator_delete=yes,
47 ac_cv_cxx_placement_operator_delete=no)
50 if test "$ac_cv_cxx_placement_operator_delete" = yes; then
51 AC_DEFINE(HAVE_PLACEMENT_OPERATOR_DELETE,,
52 [define if the compiler supports placement operator delete])
57 dnl @synopsis AC_CXX_BOOL
59 dnl If the compiler recognizes bool as a separate built-in type,
60 dnl define HAVE_BOOL. Note that a typedef is not a separate
61 dnl type since you cannot overload a function such that it accepts either
62 dnl the basic type or the typedef.
64 dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
65 dnl @author Luc Maisonobe
67 AC_DEFUN([AC_CXX_BOOL],
68 [AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
73 int f(int x){return 1;}
74 int f(char x){return 1;}
75 int f(bool x){return 1;}
76 ],[bool b = true; return f(b);],
77 ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)
80 if test "$ac_cv_cxx_bool" = yes; then
81 AC_DEFINE(HAVE_BOOL,,[define if bool is a built-in type])
85 dnl @synopsis AC_CXX_TYPENAME
87 dnl If the compiler recognizes the typename keyword, define HAVE_TYPENAME.
89 dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
90 dnl @author Luc Maisonobe
92 AC_DEFUN([AC_CXX_TYPENAME],
93 [AC_CACHE_CHECK(whether the compiler recognizes typename,
97 AC_TRY_COMPILE([template<typename T>class X {public:X(){}};],
98 [X<float> z; return 0;],
99 ac_cv_cxx_typename=yes, ac_cv_cxx_typename=no)
102 if test "$ac_cv_cxx_typename" = yes; then
103 AC_DEFINE(HAVE_TYPENAME,,[define if the compiler recognizes typename])
107 dnl @synopsis AC_CXX_NEW_FOR_SCOPING
109 dnl If the compiler accepts the new for scoping rules (the scope of a
110 dnl variable declared inside the parentheses is restricted to the
111 dnl for-body), define HAVE_NEW_FOR_SCOPING.
113 dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
114 dnl @author Luc Maisonobe
116 AC_DEFUN([AC_CXX_NEW_FOR_SCOPING],
117 [AC_CACHE_CHECK(whether the compiler accepts the new for scoping rules,
118 ac_cv_cxx_new_for_scoping,
123 for (int i = 0; i < 10; ++i)
125 for (int i = 0; i < 10; ++i)
128 ac_cv_cxx_new_for_scoping=yes, ac_cv_cxx_new_for_scoping=no)
131 if test "$ac_cv_cxx_new_for_scoping" = yes; then
132 AC_DEFINE(HAVE_NEW_FOR_SCOPING,,[define if the compiler accepts the new for scoping rules])
137 dnl @synopsis AC_CXX_DYNAMIC_CAST
139 dnl If the compiler supports dynamic_cast<>, define HAVE_DYNAMIC_CAST.
141 dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
142 dnl @author Luc Maisonobe
144 AC_DEFUN([AC_CXX_DYNAMIC_CAST],
145 [AC_CACHE_CHECK(whether the compiler supports dynamic_cast<>,
146 ac_cv_cxx_dynamic_cast,
149 AC_TRY_COMPILE([#include <typeinfo>
150 class Base { public : Base () {} virtual void f () = 0;};
151 class Derived : public Base { public : Derived () {} virtual void f () {} };],[
152 Derived d; Base& b=d; return dynamic_cast<Derived*>(&b) ? 0 : 1;],
153 ac_cv_cxx_dynamic_cast=yes, ac_cv_cxx_dynamic_cast=no)
156 if test "$ac_cv_cxx_dynamic_cast" = yes; then
157 AC_DEFINE(HAVE_DYNAMIC_CAST,,[define if the compiler supports dynamic_cast<>])
162 dnl @synopsis AC_CXX_NAMESPACES
164 dnl If the compiler can prevent names clashes using namespaces, define
167 dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
168 dnl @author Luc Maisonobe
170 AC_DEFUN([AC_CXX_NAMESPACES],
171 [AC_CACHE_CHECK(whether the compiler implements namespaces,
172 ac_cv_cxx_namespaces,
175 AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}],
176 [using namespace Outer::Inner; return i;],
177 ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no)
180 if test "$ac_cv_cxx_namespaces" = yes; then
181 AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
186 dnl @synopsis ACX_CHECK_PATHNAME_STYLE_DOS
188 dnl Check if host OS uses DOS-style pathnames. This includes the use
189 dnl of drive letters and backslashes. Under DOS, Windows, and OS/2,
190 dnl defines HAVE_PATHNAME_STYLE_DOS and PATH_SEPARATOR to ';'.
191 dnl Otherwise, defines PATH_SEPARATOR to ':'.
193 dnl Use for enabling code to handle drive letters, backslashes in
194 dnl filenames and semicolons in the PATH.
196 dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
197 dnl @author Mark Elbrecht <snowball3@bigfoot.com>
199 AC_DEFUN([ACX_CHECK_PATHNAME_STYLE_DOS],
200 [AC_MSG_CHECKING(for Windows and DOS and OS/2 style pathnames)
201 AC_CACHE_VAL(acx_cv_pathname_style_dos,
202 [AC_REQUIRE([AC_CANONICAL_HOST])
204 acx_cv_pathname_style_dos="no"
206 *djgpp | *mingw32 | *emx*) acx_cv_pathname_style_dos="yes" ;;
209 AC_MSG_RESULT($acx_cv_pathname_style_dos)
210 if test $acx_cv_pathname_style_dos = "yes"; then
211 AC_DEFINE(HAVE_PATHNAME_STYLE_DOS)
212 AC_DEFINE(PATH_SEPARATOR, ';')
214 AC_DEFINE(PATH_SEPARATOR, ':')
219 dnl @synopsis AC_CXX_EXPLICIT_INSTANTIATIONS
221 dnl If the C++ compiler supports explicit instanciations syntax,
222 dnl define HAVE_INSTANTIATIONS.
224 dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
225 dnl @author Luc Maisonobe
227 AC_DEFUN([AC_CXX_EXPLICIT_INSTANTIATIONS],
228 [AC_CACHE_CHECK(whether the compiler supports explicit instantiations,
232 AC_TRY_COMPILE([template <class T> class A { T t; }; template class A<int>;],
233 [], ac_cv_cxx_explinst=yes, ac_cv_cxx_explinst=no)
236 if test "$ac_cv_cxx_explinst" = yes; then
237 AC_DEFINE(HAVE_INSTANTIATIONS,,
238 [define if the compiler supports explicit instantiations])
242 AC_DEFUN([AC_DEFINE_DIR], [
244 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
245 test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
246 eval echo \""[$]$2"\"
249 AC_DEFINE_UNQUOTED($1, "$ac_expanded"),
250 AC_DEFINE_UNQUOTED($1, "$ac_expanded", $3))
253 dnl @synopsis AC_CXX_MUTABLE
255 dnl If the compiler allows modifying class data members flagged with
256 dnl the mutable keyword even in const objects (for example in the
257 dnl body of a const member function), define HAVE_MUTABLE.
259 dnl @version $Id: acinclude.m4,v 1.9.2.1 2004/06/30 13:16:25 keichwa Exp $
260 dnl @author Luc Maisonobe
262 AC_DEFUN([AC_CXX_MUTABLE],
263 [AC_CACHE_CHECK(whether the compiler supports the mutable keyword,
268 class A { mutable int i;
270 int f (int n) const { i = n; return i; }
272 ],[A a; return a.f (1);],
273 ac_cv_cxx_mutable=yes, ac_cv_cxx_mutable=no)
276 if test "$ac_cv_cxx_mutable" = yes; then
277 AC_DEFINE(HAVE_MUTABLE,,[define if the compiler supports the mutable keyword])