From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id zUBZIdSYBmIRYQAAWB0awg (envelope-from ) for ; Fri, 11 Feb 2022 12:11:48 -0500 Received: by simark.ca (Postfix, from userid 112) id 730E31F3B6; Fri, 11 Feb 2022 12:11:48 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_REPLYTO_END_DIGIT,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 170B71EE1A for ; Fri, 11 Feb 2022 12:11:45 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 85A5A385801C for ; Fri, 11 Feb 2022 17:11:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85A5A385801C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1644599504; bh=hv8IgsrKrYd9tYYoSbA2+2G8aUSJttiwfr1AyeS7fQ8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=WYqRybVUuXV8dpRIteLM0ARCvHuaEMcB+czMw1OYDs2uglNmDmgwyoyFOV7Y0gg3q s+PbaojKaBvONfvhoRcQ3qaKVc5+ODMceQspCQ7S0roFaH+dDKJuGULU/veqSfjapM 5H5owk0wS80Ehd1yynRyrNGrPg7LPaecznzdYVuk= Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by sourceware.org (Postfix) with ESMTPS id B81B7385842F for ; Fri, 11 Feb 2022 17:10:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B81B7385842F Received: by mail-lf1-x136.google.com with SMTP id u6so17831366lfc.3 for ; Fri, 11 Feb 2022 09:10:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hv8IgsrKrYd9tYYoSbA2+2G8aUSJttiwfr1AyeS7fQ8=; b=idmfQH1Jqfu6LRWIHC29tj22Z5n/OUWWyVXXVBXFA69W9otXcho4a2Bf5JBbsYoz8k 9Dv/Bm08AZrLrW4a6vgHCz65S+PTPFolJBI+NI7MUlLsbzIOdvSBy3TibIgbl6xSqhu7 W1upihNXE+ftX0eK6XE3YgP7xfGZbTNsHVKYZLR26UGFp6TkMsGOLzaP0WaLSaQzU7Iw t9Hat6osafVugtHnKa92vTLlrHrlVAnpvPLdpPHZH9MM1FN6KQYJPsUSufi3oNbeKj1g Vg18oLVV6ANfsvAG4aczxtg+J4VLQLD12eq761qspJnAeofnwntc4ga9jBO3vZ2gblsu 2VoQ== X-Gm-Message-State: AOAM533CNpIhaJAaavLWX+mewbRzxawLkcF+Y9Wm//nYYEFuRm/V8djo dD9aj1xBewmBqWIyJ80ASvkNz7SQ4pxKAw== X-Google-Smtp-Source: ABdhPJwDKWFR4Sm99HkwkJwgR5W1MrglUa6ybKuX170lOaziuoAl0tzSQBypAIaGa6KzgRss2Mi0FQ== X-Received: by 2002:a19:ca4d:: with SMTP id h13mr1881186lfj.32.1644599457988; Fri, 11 Feb 2022 09:10:57 -0800 (PST) Received: from localhost.localdomain ([146.120.66.91]) by smtp.gmail.com with ESMTPSA id g7sm3260997ljk.83.2022.02.11.09.10.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Feb 2022 09:10:57 -0800 (PST) To: gdb-patches@sourceware.org Subject: [PATCH] Fix detection of compilation and linking flags for source-highlight Date: Fri, 11 Feb 2022 20:10:23 +0300 Message-Id: <20220211171023.20246-1-b7.10110111@gmail.com> X-Mailer: git-send-email 2.16.2 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: "b7.10110111--- via Gdb-patches" Reply-To: b7.10110111@gmail.com Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" From: Ruslan Kabatsayev Currently there are two problems with the detection via pkg-config: 1. LDFLAGS variable is used to pass --libs to AC_LINK_IFELSE, which results in the "-L/some/path -lsource-highlight" preceding the conftest.cpp, which results in failure to find symbol referenced in conftest.cpp. 2. CFLAGS variable is used to compile C++ code instead of CXXFLAGS. This results in --cflags not being passed to the compiler at all. This patch fixes both of these mistakes, letting me get a working GDB with source-highlight installed into a custom prefix ~/opt/gdb-git (because system repos provide too old version). --- gdb/configure.ac | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gdb/configure.ac b/gdb/configure.ac index 5a380ce38d9..c6fa19b20bc 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1242,10 +1242,10 @@ either use --disable-source-highlight or dnl # This situation can occur for instance when 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" + save_CXXFLAGS="$CXXFLAGS" + save_LIBS="$LIBS" + CXXFLAGS="$CXXFLAGS $srchigh_pkg_cflags" + LIBS="$LIBS $srchigh_pkg_libs" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [#include ], @@ -1255,8 +1255,8 @@ either use --disable-source-highlight or dnl [have_usable_source_highlight=yes], [have_usable_source_highlight=no] ) - CFLAGS="$save_CFLAGS" - LDFLAGS="$save_LDFLAGS" + CXXFLAGS="$save_CXXFLAGS" + LIBS="$save_LIBS" AC_LANG_POP(C++) if test "${have_usable_source_highlight}" = "yes"; then -- 2.16.2