configure.ac: Check for the readline.h explicitly

Message ID 20211118121440.558038-1-ahajkova@redhat.com
State New
Headers show
Series
  • configure.ac: Check for the readline.h explicitly
Related show

Commit Message

Mike Frysinger via Gdb-patches Nov. 18, 2021, 12:14 p.m.
From: Alexandra Hájková <ahajkova@redhat.com>


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.
---
 configure               | 14 +++++++++++++-
 gdb/config.in           |  3 +++
 gdb/configure           | 31 ++++++++++++++++++++++++++++++-
 gdb/configure.ac        |  4 ++++
 gdb/testsuite/configure | 14 +++++++++++++-
 5 files changed, 63 insertions(+), 3 deletions(-)

-- 
2.33.1

Comments

Tom Tromey Nov. 18, 2021, 3:36 p.m. | #1
>>>>> ">" == Alexandra Hájková via Gdb-patches <gdb-patches@sourceware.org> writes:


>> From: Alexandra Hájková <ahajkova@redhat.com>

>> 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.


Hi.  Thanks for the patch.

>> diff --git a/configure b/configure

>> index 787fcf89100..6a1da1665d8 100755

>> --- a/configure

>> +++ b/configure

>> @@ -755,6 +755,7 @@ infodir

>>  docdir

>>  oldincludedir

>>  includedir

>> +runstatedir

>>  localstatedir

>>  sharedstatedir

>>  sysconfdir


This hunk and some of the other ones may mean that you're regenerating
configure with a distro-modified autoconf rather than the pristine
upstream version.  I'm not sure (maybe someone else did this and your
patch is correcting it, I never remember), but FAOD make sure you're
using the unmodified one.

>>  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


This seems reasonable to me.

Tom

Patch

diff --git a/configure b/configure
index 787fcf89100..6a1da1665d8 100755
--- a/configure
+++ b/configure
@@ -755,6 +755,7 @@  infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -919,6 +920,7 @@  datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE}'
@@ -1171,6 +1173,15 @@  do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1308,7 +1319,7 @@  fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1468,6 +1479,7 @@  Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/gdb/config.in b/gdb/config.in
index 773a0ba91ef..4b8f1f7e1c6 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -382,6 +382,9 @@ 
 /* 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
 
diff --git a/gdb/configure b/gdb/configure
index 6e2dfb766c8..229103730dc 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -848,6 +848,7 @@  infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -998,6 +999,7 @@  datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE}'
@@ -1250,6 +1252,15 @@  do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1387,7 +1398,7 @@  fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1540,6 +1551,7 @@  Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -9224,6 +9236,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 :
diff --git a/gdb/configure.ac b/gdb/configure.ac
index d4cfb6a7624..eab45f6d263 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -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],
diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure
index 3b0d4ed8ad3..482427f948b 100755
--- a/gdb/testsuite/configure
+++ b/gdb/testsuite/configure
@@ -672,6 +672,7 @@  infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -745,6 +746,7 @@  datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE}'
@@ -997,6 +999,15 @@  do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1134,7 +1145,7 @@  fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1287,6 +1298,7 @@  Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]