From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 9HxUDuG/l2E6fwAAWB0awg (envelope-from ) for ; Fri, 19 Nov 2021 10:16:49 -0500 Received: by simark.ca (Postfix, from userid 112) id 2A97D1F0CE; Fri, 19 Nov 2021 10:16:49 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5CAB21EDEE for ; Fri, 19 Nov 2021 10:16:45 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC8F9385800C for ; Fri, 19 Nov 2021 15:16:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC8F9385800C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1637335004; bh=xK0jRGUbC6cPhNstp+G9xOBqySeVCvtNEURW6Ym8G+c=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=W44W99Qtix5224eiuC1p7KLpo1dG4yqlMFFsq5tU5a+UmK4Y4k4MOwPgu7f0X5FuU xtce5AYud0pqdksp0wGwkgKFtG+7GG8mQZiq1FtMynUnjATbrzDi74qNktaVBBEaOg TjNn8NRp+rN672Tku1/lVogwlC9ofAMkf33Do9H8= 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 To: Tom de Vries 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-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: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > 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 >