All of lore.kernel.org
 help / color / mirror / Atom feed
From: peterz@infradead.org
Cc: grub-devel@gnu.org, development@efficientek.com,
	dkiper@net-space.pl, peterz@infradead.org
Subject: [PATCH v2 1/3] configure: Add -DGRUB_HAS_PCI when compiling C/C++ files on targets that support PCI
Date: Fri, 26 Aug 2022 13:01:43 +0200	[thread overview]
Message-ID: <20220826111358.296974956@alderlake.programming.kicks-ass.net> (raw)
In-Reply-To: 20220826110142.966628595@alderlake.programming.kicks-ass.net

From: Glenn Washburn <development@efficientek.com>

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 <development@efficientek.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 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





  reply	other threads:[~2022-08-26 11:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26 11:01 [PATCH v2 0/3] term/serial: Add PCI-serial device support peterz
2022-08-26 11:01 ` peterz [this message]
2022-08-26 11:01 ` [PATCH v2 2/3] term/serial: Add support for PCI serial devices peterz
2022-08-26 18:32   ` Glenn Washburn
2022-08-29 10:53     ` Peter Zijlstra
2022-08-30 19:51       ` Glenn Washburn
2022-12-21 12:59   ` Daniel Kiper
2023-01-26  9:37     ` Peter Zijlstra
2023-01-26 21:16       ` Glenn Washburn
2023-02-09 10:36       ` Peter Zijlstra
2023-02-09 14:52         ` Daniel Kiper
2023-02-12 21:23           ` Benjamin Herrenschmidt
2023-02-14 13:49             ` Daniel Kiper
2022-08-26 11:01 ` [PATCH v2 3/3] pci: Rename GRUB_PCI_CLASS_* peterz
2022-12-21 15:52   ` Daniel Kiper
2022-08-31  6:18 ` [PATCH v2 0/3] term/serial: Add PCI-serial device support Herrenschmidt, Benjamin
2022-12-17 17:52 ` Glenn Washburn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220826111358.296974956@alderlake.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=development@efficientek.com \
    --cc=dkiper@net-space.pl \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.