Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergei Trofimovich <slyfox@gentoo.org>
To: gdb-patches@sourceware.org
Cc: Sergei Trofimovich <slyfox@gentoo.org>
Subject: [PATCH] gdb/configure.ac: add --enable-source-highlight
Date: Wed, 13 Mar 2019 21:50:00 -0000	[thread overview]
Message-ID: <20190313215020.11959-1-slyfox@gentoo.org> (raw)

Allow disabling source-highlight dependency autodetection even
it exists in the system. More details on problem of automatic
dependencies:
https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Automagic_dependencies

Noticed by Jeroen Roovers in https://bugs.gentoo.org/680238

gd/ChangeLog Sergei Trofimovich <slyfox@gentoo.org>
	* configure.ac: add --enable-source-highlight switch.
	* configure: Regenerate.
---
 gdb/ChangeLog    |  5 +++++
 gdb/configure    | 38 +++++++++++++++++++++++++++++++-------
 gdb/configure.ac | 33 ++++++++++++++++++++++++++-------
 3 files changed, 62 insertions(+), 14 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 24de651bf9..35b66f02a6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-13  Sergei Trofimovich <slyfox@gentoo.org>
+
+	* configure.ac: add --enable-source-highlight switch.
+	* configure: Regenerate.
+
 2019-03-13  Tom Tromey  <tromey@adacore.com>
 
 	* i386-gnu-nat.c (i386_gnu_nat_target::fetch_registers)
diff --git a/gdb/configure b/gdb/configure
index f2d271e23a..15a96afcca 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -879,6 +879,7 @@ with_mpfr
 with_libmpfr_prefix
 with_python
 with_guile
+enable_source_highlight
 enable_libmcheck
 with_intel_pt
 with_libipt_prefix
@@ -1554,6 +1555,8 @@ Optional Features:
   --enable-profiling      enable profiling of GDB
   --enable-codesign=CERT  sign gdb with 'codesign -s CERT'
   --disable-rpath         do not hardcode runtime library paths
+  --enable-source-highlight
+                          enable source-highlight for source listings
   --enable-libmcheck      Try linking with -lmcheck if available
   --enable-werror         treat compile warnings as errors
   --enable-build-warnings enable build-time compiler warnings if gcc is used
@@ -11393,13 +11396,30 @@ fi
 
 SRCHIGH_LIBS=
 SRCHIGH_CFLAGS=
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the source-highlight library" >&5
+
+# Check whether --enable-source-highlight was given.
+if test "${enable_source_highlight+set}" = set; then :
+  enableval=$enable_source_highlight; case "${enableval}" in
+  yes)  enable_source_highlight=yes ;;
+  no)   enable_source_highlight=no  ;;
+  *)    as_fn_error $? "bad value ${enableval} for source-highlight option" "$LINENO" 5 ;;
+esac
+else
+  enable_source_highlight=auto
+fi
+
+
+if test "${enable_source_highlight}" != "no"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the source-highlight library" >&5
 $as_echo_n "checking for the source-highlight library... " >&6; }
-if test "${pkg_config_prog_path}" = "missing"; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - pkg-config not found" >&5
+  if test "${pkg_config_prog_path}" = "missing"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - pkg-config not found" >&5
 $as_echo "no - pkg-config not found" >&6; }
-else
-   if ${pkg_config_prog_path} --exists source-highlight; then
+    if test "${enable_source_highlight}" = "yes"; then
+      as_fn_error $? "pkg-config was not found in your system" "$LINENO" 5
+    fi
+  else
+    if ${pkg_config_prog_path} --exists source-highlight; then
       SRCHIGH_CFLAGS=`${pkg_config_prog_path} --cflags source-highlight`
       SRCHIGH_LIBS=`${pkg_config_prog_path} --libs source-highlight`
 
@@ -11407,10 +11427,14 @@ $as_echo "#define HAVE_SOURCE_HIGHLIGHT 1" >>confdefs.h
 
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-   else
+    else
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-   fi
+      if test "${enable_source_highlight}" = "yes"; then
+        as_fn_error $? "source-highlight was not found in your system" "$LINENO" 5
+      fi
+    fi
+  fi
 fi
 
 
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 8ddd0fda61..1318c8d008 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1220,19 +1220,38 @@ AM_CONDITIONAL(HAVE_GUILE, test "${have_libguile}" != no)
 
 SRCHIGH_LIBS=
 SRCHIGH_CFLAGS=
-AC_MSG_CHECKING([for the source-highlight library])
-if test "${pkg_config_prog_path}" = "missing"; then
-   AC_MSG_RESULT([no - pkg-config not found])
-else
-   if ${pkg_config_prog_path} --exists source-highlight; then
+
+AC_ARG_ENABLE(source-highlight,
+  AS_HELP_STRING([--enable-source-highlight],
+    [enable source-highlight for source listings]),
+  [case "${enableval}" in
+  yes)  enable_source_highlight=yes ;;
+  no)   enable_source_highlight=no  ;;
+  *)    AC_MSG_ERROR(bad value ${enableval} for source-highlight option) ;;
+esac],
+[enable_source_highlight=auto])
+
+if test "${enable_source_highlight}" != "no"; then
+  AC_MSG_CHECKING([for the source-highlight library])
+  if test "${pkg_config_prog_path}" = "missing"; then
+    AC_MSG_RESULT([no - pkg-config not found])
+    if test "${enable_source_highlight}" = "yes"; then
+      AC_MSG_ERROR([pkg-config was not found in your system])
+    fi
+  else
+    if ${pkg_config_prog_path} --exists source-highlight; then
       SRCHIGH_CFLAGS=`${pkg_config_prog_path} --cflags source-highlight`
       SRCHIGH_LIBS=`${pkg_config_prog_path} --libs source-highlight`
       AC_DEFINE([HAVE_SOURCE_HIGHLIGHT], 1,
                 [Define to 1 if the source-highlight library is available])
       AC_MSG_RESULT([yes])
-   else
+    else
       AC_MSG_RESULT([no])
-   fi
+      if test "${enable_source_highlight}" = "yes"; then
+        AC_MSG_ERROR([source-highlight was not found in your system])
+      fi
+    fi
+  fi
 fi
 AC_SUBST(SRCHIGH_LIBS)
 AC_SUBST(SRCHIGH_CFLAGS)
-- 
2.21.0


             reply	other threads:[~2019-03-13 21:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 21:50 Sergei Trofimovich [this message]
2019-03-15 14:18 ` Tom Tromey
2019-03-17 22:47   ` Sergei Trofimovich
2019-03-17 22:48     ` [PATCH v2] " Sergei Trofimovich
2019-04-19 20:09       ` Tom Tromey
2019-03-18  3:52     ` [PATCH] " Sergio Durigan Junior
2019-03-18 16:02       ` Tom Tromey
2019-03-18 16:45       ` Eli Zaretskii
2019-03-18 17:10         ` Sergio Durigan Junior
2019-03-18 17:56           ` Eli Zaretskii
2019-03-18 16:01     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190313215020.11959-1-slyfox@gentoo.org \
    --to=slyfox@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox