dnl Copyright (C) 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl Copyright (C) 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_READLINE],
[
AC_LIBSOURCES([readline.c, readline.h])
AC_DEFUN([gl_FUNC_READLINE],
[
AC_LIBSOURCES([readline.c, readline.h])
- LIBS="$LIBS $LIBREADLINE"
- AC_TRY_LINK([#include <stdio.h>
+ for extra_lib in "" termcap curses ncurses; do
+ LIBS="$am_save_LIBS $LIBREADLINE"
+ if test -n "$extra_lib"; then
+ LIBS="$LIBS -l$extra_lib"
+ fi
+ AC_TRY_LINK([#include <stdio.h>
- [readline((char*)0);],
- gl_cv_lib_readline=yes)
+ [readline((char*)0);],
+ gl_cv_lib_readline=yes)
+ if test "$gl_cv_lib_readline" = yes; then
+ if test -n "$extra_lib"; then
+ LIBREADLINE="$LIBREADLINE -l$extra_lib"
+ LTLIBREADLINE="$LTLIBREADLINE -l$extra_lib"
+ fi
+ break
+ fi
+ done
if test "$gl_cv_lib_readline" = yes; then
AC_MSG_CHECKING([how to link with libreadline])
AC_MSG_RESULT([$LIBREADLINE])
else
if test "$gl_cv_lib_readline" = yes; then
AC_MSG_CHECKING([how to link with libreadline])
AC_MSG_RESULT([$LIBREADLINE])
else