configure.ac: Check for the readline.h explicitly
authorAlexandra Hájková <ahajkova@redhat.com>
Thu, 18 Nov 2021 08:49:52 +0000 (03:49 -0500)
committerAlexandra Hájková <ahajkova@redhat.com>
Tue, 23 Nov 2021 14:01:08 +0000 (15:01 +0100)
When readline development package is missing make fails with
"configure: error: system readline is not new enough" which
might be confusing. This patch checks for the readline.h explicitly
and makes make to warn about the missing package.

gdb/config.in
gdb/configure
gdb/configure.ac

index 773a0ba91efdb7cf0f9556b6907b4bb61853db05..4b8f1f7e1c6588cf1d8ded4ceb9cf01e8cb1ed62 100644 (file)
 /* Define if Python interpreter is being linked in. */
 #undef HAVE_PYTHON
 
+/* Define to 1 if you have the <readline/readline.h> header file. */
+#undef HAVE_READLINE_READLINE_H
+
 /* Define to 1 if you have the `resize_term' function. */
 #undef HAVE_RESIZE_TERM
 
index fe685f2d3d5f856b810b6b689a8162e7605ab7a2..90c1e3d7948ba9585506a13cd4607a21ece3da53 100755 (executable)
@@ -9224,6 +9224,23 @@ fi
 
 
 if test "$with_system_readline" = yes; then
+  for ac_header in readline/readline.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
+if test "x$ac_cv_header_readline_readline_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_READLINE_READLINE_H 1
+_ACEOF
+ readline_h=yes
+else
+  readline_h=no
+fi
+
+done
+
+  if test "$readline_h" = "no"; then
+    as_fn_error $? "readline development packages are probably missing" "$LINENO" 5
+  fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system readline is new enough" >&5
 $as_echo_n "checking whether system readline is new enough... " >&6; }
 if ${gdb_cv_readline_ok+:} false; then :
index 56e8a2d804495ef0fd5c420097fe6ca2e10323e8..29c1c4589c953ab7c37f590f3d7570248fdc21a3 100644 (file)
@@ -596,6 +596,10 @@ AC_ARG_WITH([system-readline],
                   [use installed readline library])])
 
 if test "$with_system_readline" = yes; then
+  AC_CHECK_HEADERS(readline/readline.h, [readline_h=yes], [readline_h=no])
+  if test "$readline_h" = "no"; then
+    AC_MSG_ERROR([readline development packages are probably missing])
+  fi
   AC_CACHE_CHECK(
     [whether system readline is new enough],
     [gdb_cv_readline_ok],