From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id AEB4A385800C for ; Fri, 19 Nov 2021 15:16:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AEB4A385800C Received: from ubuntu.lan (unknown [IPv6:2a02:390:9086::635]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id BBA0F823BB; Fri, 19 Nov 2021 15:16:22 +0000 (UTC) Date: Fri, 19 Nov 2021 15:16:17 +0000 From: Lancelot SIX To: Tom de Vries Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] [gdb/build] Check if libsource-highlight is usable Message-ID: <20211119151617.d7o7k44w63f35ebl@ubuntu.lan> References: <20211119123423.8459-1-tdevries@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211119123423.8459-1-tdevries@suse.de> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Fri, 19 Nov 2021 15:16:22 +0000 (UTC) X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2021 15:16:27 -0000 > diff --git a/gdb/configure.ac b/gdb/configure.ac > index d4cfb6a7624..e4fed3c575c 100644 > --- a/gdb/configure.ac > +++ b/gdb/configure.ac > @@ -1248,11 +1248,48 @@ either use --disable-source-highlight or dnl > ;; > esac > > - 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]) > + srchigh_pkg_cflags=`${pkg_config_prog_path} --cflags source-highlight` > + srchigh_pkg_libs=`${pkg_config_prog_path} --libs source-highlight` > + > + # Now that we have found a source-highlight library, check if we can use > + # it. In particular, we're trying to detect the situation that the > + # library is using the new libstdc++ library abi ( see > + # https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html ) > + # while the compiler being used to compile gdb is using the old abi. > + # Such a situation will result in an undefined reference to > + # srchilite::SourceHighlight::SourceHighlight(std::string const&). > + # This situation can occur when f.i. using a source highlight library > + # compiled with g++ 7.5.0 while building gdb with g++ 4.8.5. > + AC_LANG_PUSH(C++) > + save_CFLAGS=$CFLAGS > + save_LDFLAGS=$LDFLAGS > + CFLAGS="$CFLAGS $srchigh_pkg_cflags" > + LDFLAGS="$LDFLAGS $srchigh_pkg_libs" > + AC_LINK_IFELSE( > + [AC_LANG_PROGRAM( > + [#include ], > + [std::string outlang = "esc.outlang"; > + new srchilite::SourceHighlight (outlang);] > + )], > + [have_usable_source_highlight=yes], > + [have_usable_source_highlight=no] > + ) > + CFLAGS="$SAVE_CFLAGS" > + LDFLAGS="$SAVE_LDFLAGS" > + AC_LANG_POP(C++) > + > + if test "${have_usable_source_highlight}" = "yes"; then > + AC_DEFINE([HAVE_SOURCE_HIGHLIGHT], 1, > + [Define to 1 if the source-highlight library is available]) > + AC_MSG_RESULT([yes]) > + SRCHIGH_CFLAGS="$srchigh_pkg_cflags" > + SRCHIGH_LIBS="$srchigh_pkg_libs" > + else > + AC_MSG_RESULT([no]) > + if test "${enable_source_highlight}" = "yes"; then Hi, I do not know what it the indentation policy for the configure.ac file, but you use tabs in the 'AC_MSG_RESULT' and 'if test' lines above (2 lines above), and nowhere else. The rest of the file does not seem to be completely consistent regarding this particular subject, so I do not know if there is a preferred formatting that should be used, but I guess that having the same across the patch could make sense. Otherwise, and for what it is worth, this looks reasonable to me. Best, Lancelot. > + AC_MSG_ERROR([source-highlight in your system could not be used]) > + fi > + fi > else > AC_MSG_RESULT([no]) > if test "${enable_source_highlight}" = "yes"; then > > base-commit: fd0ff19bf435b267caae6a1ae04e7b4a4ba64f5b > -- > 2.26.2 >