+dnl Usage: GINAC_STD_CXX_HEADERS
+dnl Check for standard C++ headers, bail out if something is missing.
+AC_DEFUN([GINAC_STD_CXX_HEADERS], [
+AC_CACHE_CHECK([for standard C++ header files], [ginac_cv_std_cxx_headers], [
+ ginac_cv_std_cxx_headers="no"
+ AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <iosfwd>
+ #include <iostream>
+ #include <vector>
+ #include <list>
+ #include <map>
+ #include <set>
+ #include <string>
+ #include <sstream>
+ #include <typeinfo>
+ #include <stdexcept>
+ #include <algorithm>
+ #include <limits>
+ #include <ctime>
+ ]])], [ginac_cv_std_cxx_headers="yes"])
+ AC_LANG_POP([C++])])
+if test "${ginac_cv_std_cxx_headers}" != "yes"; then
+ AC_MSG_ERROR([Standard ISO C++ 98 headers are missing])
+fi
+])
+
+dnl Usage: GINAC_LIBREADLINE
+dnl
+dnl Check if GNU readline library and headers are avialable.
+dnl Defines GINSH_LIBS variable, and HAVE_LIBREADLINE,
+dnl HAVE_READLINE_READLINE_H, HAVE_READLINE_HISTORY_H preprocessor macros.
+dnl
+dnl Note: this macro rejects readline versions <= 4.2 and non-GNU
+dnl implementations.
+dnl
+AC_DEFUN([GINAC_READLINE],[
+AC_REQUIRE([GINAC_TERMCAP])
+GINSH_LIBS=""
+AC_CHECK_HEADERS(readline/readline.h readline/history.h)
+if test "x${ac_cv_header_readline_readline_h}" != "xyes" -o "x${ac_cv_header_readline_history_h}" != "xyes"; then
+ GINAC_WARNING([readline headers could not be found.])
+else
+ AC_CACHE_CHECK([for version of libreadline], [ginac_cv_rl_supported], [
+ ginac_cv_rl_supported="no"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <stdio.h>
+ #include <readline/readline.h>
+ #if !defined(RL_VERSION_MAJOR) || !defined(RL_VERSION_MINOR)
+ #error "Ancient/unsupported version of readline"
+ #endif]])],
+ [ginac_cv_rl_supported="yes"])])
+ if test "x${ginac_cv_rl_supported}" != "xyes"; then
+ GINAC_WARNING([Unsupported version of readline (<= 4.2 or non-GNU).])
+ else
+ save_LIBS="$LIBS"
+ LIBS="$LIBTERMCAP $LIBS"
+ AC_CHECK_LIB(readline, readline)
+ if test "x${ac_cv_lib_readline_readline}" != "xyes"; then
+ GINAC_WARNING([libreadline could not be found.])
+ fi
+ GINSH_LIBS="$LIBS"
+ LIBS="$save_LIBS"
+ fi
+fi
+AC_SUBST(GINSH_LIBS)])
+