Moved the requires, header check, and language save and restore outside of the cache check.

This commit is contained in:
zeekec 2006-02-22 02:10:28 +00:00
parent 6717c894d0
commit 0301639b84
2 changed files with 12 additions and 12 deletions

View File

@ -3,22 +3,23 @@ dnl
dnl If the C++ library has a working stringstream, define HAVE_SSTREAM. dnl If the C++ library has a working stringstream, define HAVE_SSTREAM.
dnl dnl
dnl @author Ben Stanley dnl @author Ben Stanley
dnl @version $Id: ac_cxx_have_sstream.m4,v 1.1 2003/03/19 02:40:00 mes5k Exp $ dnl @version $Id: ac_cxx_have_sstream.m4,v 1.2 2006/02/22 02:10:28 zeekec Exp $
dnl dnl
AC_DEFUN([AC_CXX_HAVE_SSTREAM], AC_DEFUN([AC_CXX_HAVE_SSTREAM],
[AC_CACHE_CHECK(whether the compiler has stringstream,
ac_cv_cxx_have_sstream,
[AC_REQUIRE([AC_CXX_NAMESPACES]) [AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE AC_LANG_SAVE
AC_LANG_CPLUSPLUS AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <sstream> AC_CHECK_HEADERS(sstream)
AC_CACHE_CHECK([whether the STL defines stringstream],
[ac_cv_cxx_have_sstream],
[AC_TRY_COMPILE([#include <sstream>
#ifdef HAVE_NAMESPACES #ifdef HAVE_NAMESPACES
using namespace std; using namespace std;
#endif],[stringstream message; message << "Hello"; return 0;], #endif],[stringstream message; message << "Hello"; return 0;],
ac_cv_cxx_have_sstream=yes, ac_cv_cxx_have_sstream=no) ac_cv_cxx_have_sstream=yes, ac_cv_cxx_have_sstream=no)
AC_LANG_RESTORE
]) ])
if test "$ac_cv_cxx_have_sstream" = yes; then if test "$ac_cv_cxx_have_sstream" = yes; then
AC_DEFINE(HAVE_SSTREAM,1,[define if the compiler has stringstream]) AC_DEFINE(HAVE_SSTREAM,1,[define if the compiler has stringstream])
fi fi
AC_LANG_RESTORE
]) ])

View File

@ -5,14 +5,13 @@ dnl
dnl Adapted from ac_cxx_have_sstream.m4 by Steve Robbins dnl Adapted from ac_cxx_have_sstream.m4 by Steve Robbins
dnl dnl
AC_DEFUN([AC_CXX_HAVE_STRSTREAM], AC_DEFUN([AC_CXX_HAVE_STRSTREAM],
[AC_CACHE_CHECK(whether the library defines class strstream,
ac_cv_cxx_have_class_strstream,
[AC_REQUIRE([AC_CXX_NAMESPACES]) [AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE AC_LANG_SAVE
AC_LANG_CPLUSPLUS AC_LANG_CPLUSPLUS
AC_CHECK_HEADERS(strstream) AC_CHECK_HEADERS(strstream)
AC_TRY_COMPILE([ AC_CACHE_CHECK([whether the STL defines strstream],
#if HAVE_STRSTREAM [ac_cv_cxx_have_class_strstream],
[AC_TRY_COMPILE([#if HAVE_STRSTREAM
# include <strstream> # include <strstream>
#else #else
# include <strstream.h> # include <strstream.h>
@ -21,9 +20,9 @@ ac_cv_cxx_have_class_strstream,
using namespace std; using namespace std;
#endif],[ostrstream message; message << "Hello"; return 0;], #endif],[ostrstream message; message << "Hello"; return 0;],
ac_cv_cxx_have_class_strstream=yes, ac_cv_cxx_have_class_strstream=no) ac_cv_cxx_have_class_strstream=yes, ac_cv_cxx_have_class_strstream=no)
AC_LANG_RESTORE
]) ])
if test "$ac_cv_cxx_have_class_strstream" = yes; then if test "$ac_cv_cxx_have_class_strstream" = yes; then
AC_DEFINE(HAVE_CLASS_STRSTREAM,1,[define if the library defines strstream]) AC_DEFINE(HAVE_CLASS_STRSTREAM,1,[define if the library defines strstream])
fi fi
AC_LANG_RESTORE
]) ])