Import fmit upstream version 0.97.6
[fmit.git] / m4 / ac_cxx_templates.m4
1 dnl @synopsis AC_CXX_TEMPLATES
2 dnl
3 dnl If the compiler supports basic templates, define HAVE_TEMPLATES.
4 dnl
5 dnl @version $Id: ac_cxx_templates.m4,v 1.1 2005/01/07 02:52:49 norwin Exp $
6 dnl @author Todd Veldhuizen and Luc Maisonobe <luc@spaceroots.org>
7 dnl
8 AC_DEFUN([AC_CXX_TEMPLATES],
9 [AC_CACHE_CHECK(whether the compiler supports basic templates,
10 ac_cv_cxx_templates,
11 [AC_LANG_SAVE
12  AC_LANG_CPLUSPLUS
13  AC_TRY_COMPILE([template<class T> class A {public:A(){}};
14 template<class T> void f(const A<T>& ){}],[
15 A<double> d; A<int> i; f(d); f(i); return 0;],
16  ac_cv_cxx_templates=yes, ac_cv_cxx_templates=no)
17  AC_LANG_RESTORE
18 ])
19 if test "$ac_cv_cxx_templates" = yes; then
20   AC_DEFINE(HAVE_TEMPLATES,,[define if the compiler supports basic templates])
21 fi
22 ])