gdb/configure.ac: add --enable-source-highlight
authorSergei Trofimovich <siarheit@google.com>
Sun, 17 Mar 2019 22:48:02 +0000 (22:48 +0000)
committerTom Tromey <tromey@adacore.com>
Fri, 19 Apr 2019 20:05:47 +0000 (14:05 -0600)
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

* configure.ac: add --enable-source-highlight switch.
* configure: Regenerate.
* top.c (print_gdb_version): plumb --enable-source-highlight
status to "show configuration".

gdb/ChangeLog
2019-04-19  Sergei Trofimovich <siarheit@google.com>

* configure.ac: add --enable-source-highlight switch.
* configure: Regenerate.
* top.c (print_gdb_version): plumb --enable-source-highlight
status to "show configuration".

gdb/ChangeLog
gdb/configure
gdb/configure.ac
gdb/top.c

index 013d80b83f21a0851ff64cf9fc6bc2a722896f1c..88ae5ddd6d735b479f5fb61cbbd0701f6bbe579f 100644 (file)
@@ -1,3 +1,10 @@
+2019-04-19  Sergei Trofimovich <siarheit@google.com>
+
+       * configure.ac: add --enable-source-highlight switch.
+       * configure: Regenerate.
+       * top.c (print_gdb_version): plumb --enable-source-highlight
+       status to "show configuration".
+
 2019-04-19  Tom Tromey  <tromey@adacore.com>
 
        * ada-lang.c (ada_is_variant_part, ada_to_fixed_type_1):
index f2d271e23a2ace1c36a8a483b2e1af9ec4d7be0d..15a96afcca8a5cc34957896eca572d63ecaadee9 100755 (executable)
@@ -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
 
 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
 
 
index 8ddd0fda61c528b86fa2beb99bc0b502f07d5d04..1318c8d008734ba1c566339080649533c74dbd6c 100644 (file)
@@ -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)
index 60ca74da2530c836d66d29abe6e22702e4c1d2f6..9a1c258d3f7456be6d915defad85523853bb7008 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1450,6 +1450,15 @@ This GDB was configured as follows:\n\
              --without-guile\n\
 "));
 #endif
+#if HAVE_SOURCE_HIGHLIGHT
+  fprintf_filtered (stream, _("\
+             --enable-source-highlight\n\
+"));
+#else
+  fprintf_filtered (stream, _("\
+             --disable-source-highlight\n\
+"));
+#endif
 #ifdef RELOC_SRCDIR
   fprintf_filtered (stream, _("\
              --with-relocated-sources=%s\n\