libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: branch-1-5 tagdemo and ISO C++


From: Ralf Wildenhues
Subject: FYI: branch-1-5 tagdemo and ISO C++
Date: Sat, 19 Jan 2008 09:48:07 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

To avoid getting bogus error reports for Libtool 1.5.26 when future GCC
4.3.0 is used, I'm applying this backport from HEAD to branch-1-5.

Cheers,
Ralf

2008-01-19  Ralf Wildenhues  <address@hidden>

        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.

Index: tagdemo/configure.ac
===================================================================
RCS file: /cvsroot/libtool/libtool/tagdemo/Attic/configure.ac,v
retrieving revision 1.3.4.1
diff -u -r1.3.4.1 configure.ac
--- tagdemo/configure.ac        22 Apr 2005 09:05:43 -0000      1.3.4.1
+++ tagdemo/configure.ac        19 Jan 2008 08:47:14 -0000
@@ -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_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: tagdemo/foo.cpp
===================================================================
RCS file: /cvsroot/libtool/libtool/tagdemo/Attic/foo.cpp,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 foo.cpp
--- tagdemo/foo.cpp     22 Apr 2005 09:05:43 -0000      1.4.2.1
+++ tagdemo/foo.cpp     19 Jan 2008 08:47:14 -0000
@@ -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 <address@hidden>
 //    This file is part of GNU Libtool.
 
@@ -20,7 +20,15 @@
 // 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: tagdemo/main.cpp
===================================================================
RCS file: /cvsroot/libtool/libtool/tagdemo/Attic/main.cpp,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 main.cpp
--- tagdemo/main.cpp    22 Apr 2005 09:05:43 -0000      1.4.2.1
+++ tagdemo/main.cpp    19 Jan 2008 08:47:14 -0000
@@ -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 <address@hidden>
 //    This file is part of GNU Libtool.
 
@@ -22,7 +22,15 @@
 
 #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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]