From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1oRQOj-0003BW-Jk for mharc-grub-devel@gnu.org; Thu, 25 Aug 2022 23:52:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRQOh-0003BM-O0 for grub-devel@gnu.org; Thu, 25 Aug 2022 23:52:43 -0400 Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]:33351) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oRQOd-0003Ra-Pn for grub-devel@gnu.org; Thu, 25 Aug 2022 23:52:43 -0400 Received: by mail-qv1-xf2d.google.com with SMTP id d1so243492qvs.0 for ; Thu, 25 Aug 2022 20:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=BUdmyoCu4w34iJ7FKvvnGMnd1D6teho1CorvwZjXX4I=; b=yCnYdnsuRwqnr/eXE690irVcmZ6kxJ21KhwS8QwZPQYwAbgJbzGjqxlme9xPZwrlu5 BSWH2KRkwfMPwe4jFxQH0L8a8uBKbTg/A4gr9rnYLtPhEj7HR4sYaeJQqtMZr4qILi3N eZSVof+r7FxBQcOAmoTHZtRtlwxl0eNqchc4zH2Uybby9suoYLfF4vAnJ51HmhEmK2oW zPQFUWOFJkTlvPQ2C7NBAV6pJxqWK7mekaY6wK5vyyEeV0YCDTg8lYGP0o00iJNRHZZt k9R1dlJVjzOm/ywPt+zbh5gl2JjHzP7dgpW/oh05KZMVNiAbs+E2eDhiMfLuJWVjlDHQ oVmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=BUdmyoCu4w34iJ7FKvvnGMnd1D6teho1CorvwZjXX4I=; b=UcK/TaMm7uGgNWgnP3kfq/2YjfImb7KaChiAjIX/dgtyXMFZ9oBf9QT6hdbn8XsyE1 9PMuEYuUKy6G1VUijmeiQ20GoOX+k4/bZLU0OwN7Jxe5b14wLu3/JbkMEtWaFCboxyMj xNBufQ3Lbt95Go5avCIF4d1Byy4fp8jrmCaKpJEdskXUVAhp2ZSjBiiaWYnKcf6FaM0V O0XKhsK5AqfaZdFWhYyv3zv9J2xTrhUlz9UzSHARVv8vupuIiSE4INySQ8vKrF/1GXvW LUcUkW5jgmkBAZqloA92KnWmQtyOzmcHdS5IiporTrO8be0aFb8afAtWGm+eytEwDRL3 3utw== X-Gm-Message-State: ACgBeo05N2uPcy7tbHZAPyDYCGcRhNkJ7GT4zFPLyJXlfWj+HDZxOkDz OoyMhFgAKBju5jMAmh4jE0QSSTxQiBe7/Q== X-Google-Smtp-Source: AA6agR5QCCZhLlF/kATz1AeYVDS5LzwEoljb7yltBQz6LzejE568TCroOzDRTo6nzdSeq1/854wEIw== X-Received: by 2002:ad4:4ead:0:b0:496:e5e4:a6b9 with SMTP id ed13-20020ad44ead000000b00496e5e4a6b9mr6254346qvb.18.1661485958483; Thu, 25 Aug 2022 20:52:38 -0700 (PDT) Received: from localhost.localdomain ([37.218.244.249]) by smtp.gmail.com with ESMTPSA id r22-20020ae9d616000000b006bbc3724affsm960227qkk.45.2022.08.25.20.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 20:52:38 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper , Peter Zijlstra Cc: Glenn Washburn Subject: [PATCH] configure: Add -DGRUB_HAS_PCI when compiling C/C++ files on targets that support PCI Date: Thu, 25 Aug 2022 22:52:26 -0500 Message-Id: <20220826035226.708171-1-development@efficientek.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::f2d; envelope-from=development@efficientek.com; helo=mail-qv1-xf2d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2022 03:52:43 -0000 The list of targets that support PCI is in gentpl.py. However, there is no support for generating makefile script from a .def file that will apply globally to the makefile, but on a per target basis. So instead, use gentpl.py in configure to get the list of targets and check if the current build target is one of them. If it is, set the automake conditional COND_HAVE_PCI. Then in conf/Makefile.common add -DGRUB_HAS_PCI for the platform if COND_HAVE_PCI is true. Signed-off-by: Glenn Washburn --- The immediate need that this satisfies to allowing PCI serial port patch to conditionally include code based on whether the target supports PCI. Glenn --- conf/Makefile.common | 3 +++ configure.ac | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/conf/Makefile.common b/conf/Makefile.common index 2d8f1bf2e8..f8faa92e92 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -20,6 +20,9 @@ endif if COND_powerpc_ieee1275 CFLAGS_PLATFORM += -mcpu=powerpc endif +if COND_HAVE_PCI + CFLAGS_PLATFORM += -DGRUB_HAS_PCI +endif # Other options diff --git a/configure.ac b/configure.ac index 90f686f799..1348b06a98 100644 --- a/configure.ac +++ b/configure.ac @@ -375,6 +375,11 @@ AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION([0.18.3]) AC_SYS_LARGEFILE +PLATFORMS_PCI=" $(PYTHONPATH="${srcdir}" $PYTHON -c 'import gentpl; print(" ".join(gentpl.GROUPS[["pci"]]))') " +if test x"${PLATFORMS_PCI##* ${target_cpu}_${platform} *}" = x ; then + have_pci=y +fi + # Identify characteristics of the host architecture. unset ac_cv_c_bigendian @@ -2042,6 +2047,7 @@ AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1]) AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x]) AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy]) +AM_CONDITIONAL([COND_HAVE_PCI], [test "x$have_pci" = xy]) test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" -- 2.34.1