* [PATCH] configure: Add -DGRUB_HAS_PCI when compiling C/C++ files on targets that support PCI
@ 2022-08-26 3:52 Glenn Washburn
2022-09-29 15:55 ` Daniel Kiper
0 siblings, 1 reply; 2+ messages in thread
From: Glenn Washburn @ 2022-08-26 3:52 UTC (permalink / raw)
To: grub-devel, Daniel Kiper, Peter Zijlstra; +Cc: Glenn Washburn
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] configure: Add -DGRUB_HAS_PCI when compiling C/C++ files on targets that support PCI
2022-08-26 3:52 [PATCH] configure: Add -DGRUB_HAS_PCI when compiling C/C++ files on targets that support PCI Glenn Washburn
@ 2022-09-29 15:55 ` Daniel Kiper
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Kiper @ 2022-09-29 15:55 UTC (permalink / raw)
To: Glenn Washburn; +Cc: grub-devel, Peter Zijlstra
On Thu, Aug 25, 2022 at 10:52:26PM -0500, Glenn Washburn wrote:
> 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>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Daniel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-29 15:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-26 3:52 [PATCH] configure: Add -DGRUB_HAS_PCI when compiling C/C++ files on targets that support PCI Glenn Washburn
2022-09-29 15:55 ` Daniel Kiper
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.