From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) From: b7.10110111@gmail.com 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-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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, 11 Feb 2022 17:11:04 -0000 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