From octave-maintainers-request at bevo dot che dot wisc dot edu Wed Jan 31 11:05:27 2001 Subject: Re: ISO C++ and Octave From: Mumit Khan To: octave-maintainers at bevo dot che dot wisc dot edu cc: khan at xraylith dot wisc dot edu Date: Wed, 31 Jan 2001 11:05:25 -0600 (CST) Here's the config patch for checking for ISO-C++ compliant library. It's extremely naive, but it's a start. I use it for a variety of reasonable compilers (KAI, Sun Forte, and a few other EDG derived ones), and it does the job for me. I need numeric_limits<> in my numerical code, and I check for the explicitly. Octave doesn't need anything special here. 2001-01-31 Mumit Khan * aclocal.m4 (OCTAVE_CXX_ISO_COMPLIANT_LIBRARY): New macro. * configure.in: Use. Index: aclocal.m4 =================================================================== RCS file: /homes/khan/src/math/CVSROOT/octave-test/aclocal.m4,v retrieving revision 1.1.1.2 diff -u -3 -p -r1.1.1.2 aclocal.m4 --- aclocal.m4 2001/01/30 04:41:41 1.1.1.2 +++ aclocal.m4 2001/01/31 16:53:10 at @ -931,3 +931,40 @@ EOF AC_DEFINE(CXX_PREPENDS_UNDERSCORE) fi ]) +dnl +dnl See if the C++ library is ISO compliant. +dnl FIXME: This is obviously very simplistic, and trivially fooled. +dnl +dnl OCTAVE_CXX_ISO_COMPLIANT_LIBRARY +AC_DEFUN(OCTAVE_CXX_ISO_COMPLIANT_LIBRARY, [ + AC_REQUIRE([AC_PROG_CXX]) + AC_MSG_CHECKING([if C++ library is ISO compliant]) + AC_CACHE_VAL(octave_cv_cxx_iso_compliant_library, [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + rm -f conftest.h + for inc in algorithm bitset cassert cctype cerrno cfloat ciso646 \ + climits clocale cmath complex csetjmp csignal cstdarg cstddef \ + cstdio cstdlib cstring ctime cwchar cwctype deque exception \ + fstream functional iomanip ios iosfwd iostream istream iterator \ + limits list locale map memory new numeric ostream queue set \ + sstream stack stdexcept streambuf string strstream typeinfo \ + utility valarray vector; do + echo "#include <$inc>" >> conftest.h + done + AC_TRY_LINK([#include "conftest.h"], [ + std::bitset<50> flags; + flags.set(); + int digits = std::numeric_limits::digits; + digits = 0; + ], + octave_cv_cxx_iso_compliant_library=yes, + octave_cv_cxx_iso_compliant_library=no + ) + AC_LANG_RESTORE + ]) + AC_MSG_RESULT($octave_cv_cxx_iso_compliant_library) + if test $octave_cv_cxx_iso_compliant_library = yes; then + AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY) + fi +]) Index: configure.in =================================================================== RCS file: /homes/khan/src/math/CVSROOT/octave-test/configure.in,v retrieving revision 1.1.1.2 diff -u -3 -p -r1.1.1.2 configure.in --- configure.in 2001/01/30 04:41:41 1.1.1.2 +++ configure.in 2001/01/31 16:53:42 at @ -199,6 +199,7 @@ fi AC_SUBST(CXX_VERSION) OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL +OCTAVE_CXX_ISO_COMPLIANT_LIBRARY ### See which C compiler to use (we expect to find gcc).