[build] Fix the 'readline' ac macro.

The macro does not track the include directory when it is passed in
using the '--with-readline=/foo/bar' invocation of '--with-readline'
flag.

This change should fix the problem. I've tried to keep the functionality
exactly the same as before and converted the script to pure M4sh, which
should produce a more portable configure script.
pull/130/head
Suresh Sundriyal 9 years ago
parent df5045a64c
commit 31c4669a8a

@ -104,7 +104,7 @@ if test "x$ax_cv_curses" != xyes; then
fi
AX_PATH_LIB_PCRE([], [AC_MSG_ERROR([pcre required to build])])
AX_PATH_LIB_READLINE([], [AC_MSG_ERROR([readline required to build])])
AX_PATH_LIB_READLINE
AX_LIB_SQLITE3("3.0.0")

@ -1,38 +1,49 @@
AC_DEFUN([AX_PATH_LIB_READLINE],[dnl
AC_MSG_CHECKING([lib readline])
AC_ARG_WITH(readline,
[ --with-readline[[=prefix]] compile xmlreadline part (via libreadline check)],,
with_readline="yes")
if test ".$with_readline" = ".no" ; then
AC_MSG_RESULT([disabled])
m4_ifval($2,$2)
else
if test ".$with_readline" = ".yes"; then
OLD_LIBS="$LIBS"
AC_CHECK_LIB(readline, readline, [], [], [$CURSES_LIB])
LIBS="$OLD_LIBS"
if test "$ac_cv_lib_readline_readline" = "yes"; then
READLINE_LIBS="-lreadline"
AC_MSG_CHECKING([lib readline])
AC_MSG_RESULT([$READLINE_LIBS])
m4_ifval($1,$1)
else
AC_MSG_CHECKING([lib readline])
AC_MSG_RESULT([no, (WARNING)])
m4_ifval($2,$2)
fi
else
LIBS="$LIBS $with_readline/lib/libreadline.a"
OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_readline/include"
AC_CHECK_HEADERS(readline.h readline/readline.h)
CPPFLAGS="$OLDCPPFLAGS"
READLINE_LIBS="$with_readline/lib/libreadline.a"
test -d "$with_readline/include" && READLINE_CFLAGS="-I$with_readline/include"
AC_DEFUN([AX_PATH_LIB_READLINE],
[
AC_MSG_CHECKING([lib readline])
AC_MSG_RESULT([$READLINE_LIBS])
m4_ifval($1,$1)
fi
fi
AC_SUBST([READLINE_LIBS])
AC_SUBST([READLINE_CFLAGS])
])dnl
AC_ARG_WITH([readline],
AC_HELP_STRING(
[--with-readline@<:@=prefix@:>@],
[compile xmlreadline part (via libreadline check)]
),
[],
[with_readline="yes"]
)dnl
AS_CASE(["$with_readline"],
[no],
AC_MSG_ERROR([readline required to build]),
[yes],
[dnl
AC_SEARCH_LIBS([readline], [readline],
[AS_VAR_SET([READLINE_LIBS], ["-lreadline"])],
[AC_MSG_ERROR([libreadline library not found])],
[$CURSES_LIB]
)dnl
],
[dnl
AS_VAR_SET([READLINE_LIBS], ["$with_readline/lib/libreadline.a"])
AC_CHECK_FILE("$READLINE_LIBS", [],
AC_MSG_ERROR([readline library not found])
)dnl
AS_VAR_SET([READLINE_CFLAGS], ["-I$with_readline/include"])
LNAV_ADDTO(CPPFLAGS, ["-I$with_readline/include"])
]dnl
)
AC_CHECK_HEADERS([readline.h readline/readline.h],
[dnl
AS_VAR_SET([HAVE_READLINE_HEADERS], [1])
break
]dnl
)
AS_VAR_SET_IF([HAVE_READLINE_HEADERS], [],
[AC_MSG_ERROR([readline headers not found])]
)
AC_SUBST([READLINE_LIBS])
AC_SUBST([READLINE_CFLAGS])
]dnl
)dnl

Loading…
Cancel
Save