From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id B8074385800C for ; Fri, 19 Nov 2021 15:22:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B8074385800C Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DCC17212C8; Fri, 19 Nov 2021 15:22:41 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C5D0313216; Fri, 19 Nov 2021 15:22:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eeXwLkHBl2FFHAAAMHmgww (envelope-from ); Fri, 19 Nov 2021 15:22:41 +0000 Subject: Re: [PATCH] [gdb/build] Check if libsource-highlight is usable To: Lancelot SIX Cc: gdb-patches@sourceware.org References: <20211119123423.8459-1-tdevries@suse.de> <20211119151617.d7o7k44w63f35ebl@ubuntu.lan> From: Tom de Vries Message-ID: <417f2b82-e830-8e1d-fe54-84abe707d110@suse.de> Date: Fri, 19 Nov 2021 16:22:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20211119151617.d7o7k44w63f35ebl@ubuntu.lan> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, 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:22:44 -0000 On 11/19/21 4:16 PM, Lancelot SIX wrote: >> 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, Me neither, I just used what I saw around. > but you use tabs in the 'AC_MSG_RESULT' and 'if test' lines above (2 > lines above), and nowhere else. > Ack, fixed now, I guess I forgot to untabify those. Thanks for noticing. > 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. > Agreed. > Otherwise, and for what it is worth, this looks reasonable to me. > Thanks for the review, - Tom > 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 >>