diff aclocal.m4 @ 3107:a8dcfbf87ea3

[project @ 1997-11-19 22:34:59 by jwe]
author jwe
date Wed, 19 Nov 1997 22:35:03 +0000
parents 3462187925ff
children 0f6ec7b761a6
line wrap: on
line diff
--- a/aclocal.m4	Wed Nov 19 06:26:04 1997 +0000
+++ b/aclocal.m4	Wed Nov 19 22:35:03 1997 +0000
@@ -565,3 +565,42 @@
   AC_DEFINE($1, $3)
 fi
 ])
+dnl
+dnl Check to see if C++ compiler needs the new friend template declaration 
+dnl syntax. 
+dnl
+dnl OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL
+AC_DEFUN(OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL, [
+  AC_REQUIRE([AC_PROG_CXX])
+  AC_MSG_CHECKING([for C++ support for new friend template declaration])
+  AC_CACHE_VAL(octave_cv_cxx_new_friend_template_decl, [
+    AC_LANG_SAVE
+    AC_LANG_CPLUSPLUS
+    rm -f conftest.h
+    cat > conftest.h <<EOB
+       struct A {
+	 friend int operator== (const A&, const A&);
+	 A (int) { }
+       };
+
+       template <class T> int
+       operator== (const T&, const T&)
+       {
+	 return 0;
+       }
+EOB
+    AC_TRY_LINK([#include "conftest.h"], [
+        A a (1);
+        return a == A(1);
+      ], 
+      octave_cv_cxx_new_friend_template_decl=no,
+      octave_cv_cxx_new_friend_template_decl=yes,
+      octave_cv_cxx_new_friend_template_decl=yes
+    )
+    AC_LANG_RESTORE
+  ])
+  AC_MSG_RESULT($octave_cv_cxx_new_friend_template_decl)
+  if test $octave_cv_cxx_new_friend_template_decl = yes; then
+    AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL)
+  fi
+])