Simon Josefsson wrote: > >> > + printf ("%s", prompt); > > > > You can simplify that to > > > > fputs (prompt);
Oops, I meant: fputs (prompt, stdout). Sorry. > No, I don't want a newline. fputs() doesn't output an extra newline. Only puts() does. > +#include <stdio.h> > +#include <getline.h> > + > +/* Get specification. */ > +#include "readline.h" Can you put the specification header include _before_ the others, to verify that "readline.h" is self-contained? > +#if HAVE_READLINE_READLINE_H > +# include <readline/readline.h> > +#else You need a #include <stdio.h> before including <readline/readline.h>, because <readline/readline.h> makes use of the FILE type without including <stdio.h> itself. > + AC_CHECK_HEADERS(readline/readline.h) > + AC_LIB_LINKFLAGS(readline) That won't work if the readline library is installed in $PREFIX but not in /usr: The AC_CHECK_HEADERS won't find the readline.h include file. I suggest this code, taken from iconv.m4 with all required modifications. ============================================================================== dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Search for libreadline and define LIBREADLINE, LTLIBREADLINE and dnl INCREADLINE accordingly. AC_LIB_LINKFLAGS_BODY([readline]) dnl Add $INCREADLINE to CPPFLAGS before performing the following checks, dnl because if the user has installed libreadline and not disabled its use dnl via --without-libreadline-prefix, he wants to use it. The AC_TRY_LINK dnl will then succeed. am_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCREADLINE]) AC_CACHE_CHECK(for readline, gl_cv_lib_readline, [ gl_cv_lib_readline=no am_save_LIBS="$LIBS" LIBS="$LIBS $LIBREADLINE" AC_TRY_LINK([#include <stdio.h> #include <readline/readline.h>], [readline((char*)0);], gl_cv_lib_readline=yes) LIBS="$am_save_LIBS" ]) if test "$gl_cv_lib_readline" = yes; then AC_DEFINE(HAVE_READLINE, 1, [Define if you have the readline() library.]) fi if test "$gl_cv_lib_readline" = yes; then AC_MSG_CHECKING([how to link with libreadline]) AC_MSG_RESULT([$LIBREADLINE]) else dnl If $LIBREADLINE didn't lead to a usable library, we don't need $INCREADLINE dnl either. CPPFLAGS="$am_save_CPPFLAGS" LIBREADLINE= LTLIBREADLINE= fi AC_SUBST(LIBREADLINE) AC_SUBST(LTLIBREADLINE) ============================================================================= Bruno _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib