From: Ralf Wildenhues Date: Sat, 19 Jan 2008 08:48:04 +0000 (+0000) Subject: Backport ISO C++ support from HEAD, 2006-03-17 and 2005-09-12 patches. X-Git-Tag: release-1-5-26~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e7a8a42beaaa555b8099c85e8248ee8cb90964d;p=thirdparty%2Flibtool.git 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. --- diff --git a/ChangeLog b/ChangeLog index 92dac2c3c..c2903f697 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-01-19 Ralf Wildenhues + + 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 * Makefile.am (fetch): Update to match upstream git sources. diff --git a/tagdemo/configure.ac b/tagdemo/configure.ac index 783571e4a..678b3cec8 100644 --- a/tagdemo/configure.ac +++ b/tagdemo/configure.ac @@ -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 +#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 diff --git a/tagdemo/foo.cpp b/tagdemo/foo.cpp index 2867ed968..7ea63199f 100644 --- a/tagdemo/foo.cpp +++ b/tagdemo/foo.cpp @@ -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 // This file is part of GNU Libtool. @@ -20,7 +20,15 @@ // USA. #include "foo.h" -#include +#ifdef HAVE_IOSTREAM +# include +#else +# include +#endif +#ifdef HAVE_NAMESPACES +namespace std { } +using namespace std; +#endif #ifdef HAVE_MATH_H #include diff --git a/tagdemo/main.cpp b/tagdemo/main.cpp index 111d5277f..b3cca1c4e 100644 --- a/tagdemo/main.cpp +++ b/tagdemo/main.cpp @@ -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 // This file is part of GNU Libtool. @@ -22,7 +22,15 @@ #include "foo.h" #include "baz.h" -#include +#ifdef HAVE_IOSTREAM +# include +#else +# include +#endif +#ifdef HAVE_NAMESPACES +namespace std { } +using namespace std; +#endif int