mirror of
git://git.savannah.gnu.org/libtool.git
synced 2024-11-21 01:40:57 +08:00
Make tagdemo work smoothly with both pre- and ISO C++ compilers,
and remove all use of libstdc from other tests. * tests/tagdemo/configure.ac (HAVE_NAMESPACES, HAVE_IOSTREAM): New tests for ISO C++ features. Reimplementation of similar macros from the autoconf archive. * tests/tagdemo/foo.cpp, tests/tagdemo/main.cpp: Adjusted. * tests/am-subdir.at, tests/template.at: Do not use iostream.
This commit is contained in:
parent
ff60e2f202
commit
2055f11ca7
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2005-09-12 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||
|
||||
Make tagdemo work smoothly with both pre- and ISO C++ compilers,
|
||||
and remove all use of libstdc from other tests.
|
||||
|
||||
* tests/tagdemo/configure.ac (HAVE_NAMESPACES, HAVE_IOSTREAM):
|
||||
New tests for ISO C++ features. Reimplementation of similar
|
||||
macros from the autoconf archive.
|
||||
* tests/tagdemo/foo.cpp, tests/tagdemo/main.cpp: Adjusted.
|
||||
* tests/am-subdir.at, tests/template.at: Do not use iostream.
|
||||
|
||||
2005-09-12 Peter Ekberg <peda@axentia.se>,
|
||||
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||
|
||||
|
@ -129,37 +129,27 @@ subdir_subdemo_LDADD = subdir/libsub.la
|
||||
test -d subdir || { rm -f subdir && mkdir subdir; }
|
||||
|
||||
AT_DATA([[subdir/sub.hxx]],
|
||||
[[class libsub { public: void sub (void); };
|
||||
[[class libsub { public: int sub (void); };
|
||||
]])
|
||||
|
||||
AT_DATA([[subdir/main.cxx]],
|
||||
[[#include <iostream.h>
|
||||
#include "sub.hxx"
|
||||
[[#include "sub.hxx"
|
||||
|
||||
int main (int, char *[])
|
||||
{
|
||||
libsub SUB;
|
||||
|
||||
cout << "Welcome to GNU Libtool subdir-objects C++ test!" << endl;
|
||||
SUB.sub();
|
||||
return 0;
|
||||
return SUB.sub() != 27;
|
||||
}
|
||||
]])
|
||||
|
||||
AT_DATA([[subdir/sub.cxx]],
|
||||
[[#include <iostream.h>
|
||||
#include "sub.hxx"
|
||||
[[#include "sub.hxx"
|
||||
|
||||
void libsub::sub (void) { cout << "** This is libsub::sub **" << endl; }
|
||||
]])
|
||||
|
||||
AT_DATA(expout,
|
||||
[[Welcome to GNU Libtool subdir-objects C++ test!
|
||||
** This is libsub::sub **
|
||||
int libsub::sub (void) { return 27; }
|
||||
]])
|
||||
|
||||
LT_AT_BOOTSTRAP
|
||||
"${MAKE-make}"
|
||||
LT_AT_EXEC_CHECK([subdir/subdemo], 0, expout)
|
||||
LT_AT_EXEC_CHECK([subdir/subdemo], 0)
|
||||
|
||||
AT_CLEANUP
|
||||
|
@ -45,6 +45,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
|
||||
|
@ -20,7 +20,14 @@
|
||||
// USA.
|
||||
|
||||
#include "foo.h"
|
||||
#include <iostream.h>
|
||||
#ifdef HAVE_IOSTREAM
|
||||
# include <iostream>
|
||||
#else
|
||||
# include <iostream.h>
|
||||
#endif
|
||||
#ifdef HAVE_NAMESPACES
|
||||
using namespace std;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MATH_H
|
||||
#include <math.h>
|
||||
|
@ -23,7 +23,14 @@
|
||||
#include "foo.h"
|
||||
#include "baz.h"
|
||||
#include "conv.h"
|
||||
#include <iostream.h>
|
||||
#ifdef HAVE_IOSTREAM
|
||||
# include <iostream>
|
||||
#else
|
||||
# include <iostream.h>
|
||||
#endif
|
||||
#ifdef HAVE_NAMESPACES
|
||||
using namespace std;
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
|
@ -62,18 +62,12 @@ int f(int i)
|
||||
]])
|
||||
|
||||
AT_DATA(prog.cpp,
|
||||
[[#include <iostream>
|
||||
#include "alib.h"
|
||||
[[#include "alib.h"
|
||||
#include "aclib.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
cout << "a sample prog" << endl;
|
||||
cout << "f(3) = " << f(3) << endl;
|
||||
cout << "cf(3) = " << cf(3) << endl;
|
||||
return (f(3) + 3 - cf(3) != 0);
|
||||
return f(3) + 3 - cf(3) != 0;
|
||||
}
|
||||
]])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user