[gjs/wip/ptomato/autotools: 13/18] build: Improve readline check
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/autotools: 13/18] build: Improve readline check
- Date: Wed, 28 Sep 2016 06:48:23 +0000 (UTC)
commit f8ac1ffd2a60d5f6e465d49487282ca1be0abc4e
Author: Philip Chimento <philip chimento gmail com>
Date: Mon Sep 26 22:39:33 2016 -0700
build: Improve readline check
The AC_TRY_CPP macro is deprecated, and Automake provides a better macro
to use: AC_CHECK_HEADERS. This works despite the possibly extra required
linker flags because we call it within the scope where we have readline's
flags added to LIBS.
AC_CHECK_HEADERS defines its own preprocessor symbol with the result, so
we can use that. The AM_CONDITIONAL symbol was unused anyway, so that can
be removed.
configure.ac | 11 +++--------
modules/console.cpp | 4 ++--
2 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a261f50..9bd8673 100644
--- a/configure.ac
+++ b/configure.ac
@@ -134,18 +134,13 @@ done
if test $gjs_cv_lib_readline = no; then
AC_MSG_RESULT([none])
READLINE_LIBS=""
+ ac_cv_header_readline_readline_h=no
else
AC_MSG_RESULT([$READLINE_LIBS])
- AC_DEFINE(HAVE_LIBREADLINE, 1,
- [Define if you have the readline library (-lreadline).])
+ AC_CHECK_HEADERS([readline/readline.h])
fi
-AC_TRY_CPP([#include <readline/readline.h>],
-have_readline=yes, have_readline=no)
-
-AM_CONDITIONAL([HAVE_READLINE], [test x$have_readline = xyes])
AC_SUBST([READLINE_LIBS])
-AC_SUBST([HAVE_READLINE])
# End of readline checks: restore LIBS
LIBS=$LIBS_no_readline
@@ -241,7 +236,7 @@ AC_MSG_RESULT([
cairo: ${have_cairo}
GTK+: ${have_gtk}
- readline: ${have_readline}
+ readline: ${ac_cv_header_readline_readline_h}
dtrace: ${ENABLE_DTRACE}
systemtap: ${ENABLE_SYSTEMTAP}
Run tests under: ${TEST_MSG}
diff --git a/modules/console.cpp b/modules/console.cpp
index 9fc9d8d..a85ed50 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -43,7 +43,7 @@
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_LIBREADLINE
+#ifdef HAVE_READLINE_READLINE_H
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
@@ -127,7 +127,7 @@ gjs_console_error_reporter(JSContext *cx, const char *message, JSErrorReport *re
g_free(prefix);
}
-#ifdef HAVE_LIBREADLINE
+#ifdef HAVE_READLINE_READLINE_H
static JSBool
gjs_console_readline(JSContext *cx, char **bufp, FILE *file, const char *prompt)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]