]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Backport ISO C++ support from HEAD, 2006-03-17 and 2005-09-12 patches.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 19 Jan 2008 08:48:04 +0000 (08:48 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 19 Jan 2008 08:48:04 +0000 (08:48 +0000)
* tagdemo/configure.ac (HAVE_NAMESPACES, HAVE_IOSTREAM):
New tests for ISO C++ features.  Reimplementation of similar
macros from the autoconf archive.
* tagdemo/foo.cpp, tagdemo/main.cpp: Adjusted.  Provide dummy
`std' namespace for the HPPA C++ compiler.

ChangeLog
tagdemo/configure.ac
tagdemo/foo.cpp
tagdemo/main.cpp

index 92dac2c3ca34ef3d0511bdb7ed40b0c886884ee7..c2903f697e539202e523428f29540e3467829215 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-01-19  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Backport ISO C++ support from HEAD, 2006-03-17 and 2005-09-12 patches.
+
+       * tagdemo/configure.ac (HAVE_NAMESPACES, HAVE_IOSTREAM):
+       New tests for ISO C++ features.  Reimplementation of similar
+       macros from the autoconf archive.
+       * tagdemo/foo.cpp, tagdemo/main.cpp: Adjusted.  Provide dummy
+       `std' namespace for the HPPA C++ compiler.
+
 2008-01-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * Makefile.am (fetch): Update to match upstream git sources.
index 783571e4a3a30da0dc969ef3c5577f92713989fd..678b3cec8e85a4a88c219915cabeb2bdc5418285 100644 (file)
@@ -1,5 +1,5 @@
 ## Process this file with autoconf to create configure. -*- autoconf -*-
-# Copyright 2001  Free Software Foundation, Inc.
+# Copyright 2001, 2008  Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -44,6 +44,30 @@ AC_PROG_CC_C_O
 AC_PROG_CXX
 AC_PROG_CXXCPP
 
+# Check for namespace support and new-style headers
+AC_LANG_PUSH([C++])
+AC_MSG_CHECKING([whether the compiler implements namespaces])
+AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([[namespace A { namespace B { int i = 0; }}]],
+                    [[using namespace A::B; return i;]])],
+    [AC_MSG_RESULT([yes])
+     AC_DEFINE([HAVE_NAMESPACES],[1],
+              [define if the compiler implements namespaces])],
+    [AC_MSG_RESULT([no])])
+
+AC_MSG_CHECKING([whether the compiler has ISO C++ iostream])
+AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([[#include <iostream>
+#ifdef HAVE_NAMESPACES
+using namespace std;
+#endif ]], [[cout << "bingo\n"; return 0;]])],
+    [AC_MSG_RESULT([yes])
+     AC_DEFINE([HAVE_IOSTREAM],[1],
+              [define if the compiler has ISO C++ iostream])],
+    [AC_MSG_RESULT([no])])
+AC_LANG_POP([C++])
+
+
 # As of the writing of this demo, GNU Autoconf's AC_OBJEXT and
 # AC_EXEEXT macros only works for C compilers!
 # Libtool's setup macro calls AC_OBJEXT and AC_EXEEXT without setting
index 2867ed9683bb4eec37561e7fb070b0c55c844b79..7ea63199f7420737ae2f2b4edf5bed259ba1918f 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 //    foo.cpp -- trivial test library
-//    Copyright (C) 1998-2000 Free Software Foundation, Inc.
+//    Copyright (C) 1998-2000, 2008 Free Software Foundation, Inc.
 //    Originally by Thomas Tanner <tanner@ffii.org>
 //    This file is part of GNU Libtool.
 
 // USA.
 
 #include "foo.h"
-#include <iostream.h>
+#ifdef HAVE_IOSTREAM
+# include <iostream>
+#else
+# include <iostream.h>
+#endif
+#ifdef HAVE_NAMESPACES
+namespace std { }
+using namespace std;
+#endif
 
 #ifdef HAVE_MATH_H
 #include <math.h>
index 111d5277f9e075c4933300f27ff438bfc29974b1..b3cca1c4ed6f52c6e6f970fe60d90a906fde1e42 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 //    main.cpp -- tagdemo test program
-//    Copyright (C) 1998-2000 Free Software Foundation, Inc.
+//    Copyright (C) 1998-2000, 2008 Free Software Foundation, Inc.
 //    Originally by Thomas Tanner <tanner@ffii.org>
 //    This file is part of GNU Libtool.
 
 
 #include "foo.h"
 #include "baz.h"
-#include <iostream.h>
+#ifdef HAVE_IOSTREAM
+# include <iostream>
+#else
+# include <iostream.h>
+#endif
+#ifdef HAVE_NAMESPACES
+namespace std { }
+using namespace std;
+#endif
 
 
 int