Hi David, * David Fang wrote on Fri, Mar 31, 2006 at 03:53:16AM CEST: > > As I said in the other message, I just need to see if it is openable and > usable with std::ifstream, so I've devised the following test. Does this > look reasonable? Yes (without having tested it). A couple of very minor nits inline: > dnl > dnl Category: C++ > dnl Checks to see if std::ifstream can open "/dev/stdin" > dnl AC_DEFINEs HAVE_STD_IFSTREAM_DEV_STDIN if successful. > dnl Outside of AC_DEFUNs (outside of configure.ac), even comments starting with a hash mark # will be discarded. > AC_DEFUN([AC_CXX_STD_IFSTREAM_DEV_STDIN], Please do not name your private macro with `AC_*'. That's the "name space" reserved for macros from Autoconf proper. It's commonly seen to use ones initials or a project prefix for that, e.g., df_CXX_*. > [AC_REQUIRE([AC_PROG_CXX]) > AC_CACHE_CHECK( > [whether std::ifstream works with /dev/stdin], > [ac_cv_cxx_std_ifstream_dev_stdin], Same issue with the cache variable prefix: df_cv_cxx_*. > [AC_LANG_PUSH(C++) > dnl default/initially no > ac_cv_cxx_std_ifstream_dev_stdin=no > AC_LINK_IFELSE( > AC_LANG_PROGRAM([[ > #include <iostream> > #include <fstream> > #include <string> > using namespace std; You are assuming an ISO C++ compiler with proper namespace support anyway, right? If not, there's a namespace macro in the Autoconf archive, and then doing something like #ifdef HAVE_IOSTREAM # include <iostream> #else # include <iostream.h> #endif //... #ifdef HAVE_NAMESPACES namespace std { } using namespace std; #endif will get this working on more systems. (Of course, you'd have to lay out your complete source code that way, too. The empty namespace addition is because IIRC one HP-UX has namespaces but doesn't define the std namespace.) *snip* > if test "$ac_cv_cxx_std_ifstream_dev_stdin" = yes ; then > AC_DEFINE(HAVE_STD_IFSTREAM_DEV_STDIN, [], > [Define if std::ifstream(/dev/stdin) works]) > fi > ]) > > dnl End of macro. Again a very minor nit, but it's customary (in Autoconf) to end macros with ])# MACRO-NAME which both signals the end of the macro well, and helps navigating. :-) Cheers, Ralf _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf