Warn about static libs vs. source-highlight only when necessary

Message ID AM6PR03MB517009DC44211E552697C0EAE4C50@AM6PR03MB5170.eurprd03.prod.outlook.com
State New
Headers show
Series
  • Warn about static libs vs. source-highlight only when necessary
Related show

Commit Message

Bernd Edlinger Dec. 16, 2020, 7:57 p.m.
Hi,

this is a small improvement regarding the error message when static system libraries are
used, but source-highlight does not support that.

I have however right now a question about our use of pkg-config.

That is: what happens if I build gcc for build != host ?
will pkg-config then find the build libraries, and we use them
for host, where they might be unavailable?
That is probably bound to fail, isn't it?

Anyway, is this change OK for trunk?

Thanks
Bernd.

Patch

From 4086ea744e5eca51db3298a73684045b08e0b588 Mon Sep 17 00:00:00 2001
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date: Wed, 16 Dec 2020 19:47:18 +0100
Subject: [PATCH] Warn about static libs vs. source-highlight only when
 necessary

This avoids the error message when pkg-config is available but
source-highlight is not installed.

2020-12-16  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* configure.ac: Move the static libs vs. source-highlight
	error message to a better place.
	* configure: Regenerate.
---
 gdb/configure    | 12 ++++++------
 gdb/configure.ac | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gdb/configure b/gdb/configure
index 2bf8014..5819002 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -12083,13 +12083,13 @@  $as_echo "no - pkg-config not found" >&6; }
       as_fn_error $? "pkg-config was not found in your system" "$LINENO" 5
     fi
   else
-    case "$LDFLAGS" in
-      *static-libstdc*)
-        as_fn_error $? "source highlight is incompatible with -static-libstdc++; either use --disable-source-highlight or --without-static-standard-libraries" "$LINENO" 5
-        ;;
-    esac
-
     if ${pkg_config_prog_path} --exists source-highlight; then
+      case "$LDFLAGS" in
+        *static-libstdc*)
+          as_fn_error $? "source highlight is incompatible with -static-libstdc++; either use --disable-source-highlight or --without-static-standard-libraries" "$LINENO" 5
+          ;;
+      esac
+
       SRCHIGH_CFLAGS=`${pkg_config_prog_path} --cflags source-highlight`
       SRCHIGH_LIBS=`${pkg_config_prog_path} --libs source-highlight`
 
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 376643c..f1c233c 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1248,15 +1248,15 @@  if test "${enable_source_highlight}" != "no"; then
       AC_MSG_ERROR([pkg-config was not found in your system])
     fi
   else
-    case "$LDFLAGS" in
-      *static-libstdc*)
-        AC_MSG_ERROR([source highlight is incompatible with -static-libstdc++; dnl
+    if ${pkg_config_prog_path} --exists source-highlight; then
+      case "$LDFLAGS" in
+        *static-libstdc*)
+          AC_MSG_ERROR([source highlight is incompatible with -static-libstdc++; dnl
 either use --disable-source-highlight or dnl
 --without-static-standard-libraries])
-        ;;
-    esac
+          ;;
+      esac
 
-    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,
-- 
1.9.1