1*4882a593SmuzhiyunFrom ebf0236270b977a62c522bc32810bc9f8edc72d1 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
3*4882a593SmuzhiyunDate: Wed, 24 Mar 2021 13:40:14 +0100
4*4882a593SmuzhiyunSubject: [PATCH] configure.ac: add option --enable-kernel-64-userland-32
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThe ebtables build system seems to assume that 'sparc64' is the
7*4882a593Smuzhiyunonly case where KERNEL_64_USERSPACE_32 is relevant, but this is not true.
8*4882a593SmuzhiyunThis situation can happen on many architectures, especially in embedded
9*4882a593Smuzhiyunsystems. For example, an Aarch64 processor with kernel in 64-bit but
10*4882a593Smuzhiyunuserland build for 32-bit Arm. Or a 64-bit MIPS Octeon III processor, with
11*4882a593Smuzhiyunuserland running in the 'n32' ABI.
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunWhile it is possible to set CFLAGS in the environment when calling the
14*4882a593Smuzhiyunconfigure script, the caller would need to know to not only specify
15*4882a593SmuzhiyunKERNEL_64_USERSPACE_32 but also the EBT_MIN_ALIGN value.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunInstead, add a configure option. All internal details can then be handled by
18*4882a593Smuzhiyunthe configure script.
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunSigned-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
21*4882a593SmuzhiyunUpstream-Status: http://patchwork.ozlabs.org/project/netfilter-devel/patch/20210518181730.13436-2-patrickdepinguin@gmail.com/
22*4882a593Smuzhiyun---
23*4882a593Smuzhiyun configure.ac | 9 ++++++++-
24*4882a593Smuzhiyun 1 file changed, 8 insertions(+), 1 deletion(-)
25*4882a593Smuzhiyun
26*4882a593Smuzhiyundiff --git a/configure.ac b/configure.ac
27*4882a593Smuzhiyunindex c24ede3..3e89c0c 100644
28*4882a593Smuzhiyun--- a/configure.ac
29*4882a593Smuzhiyun+++ b/configure.ac
30*4882a593Smuzhiyun@@ -15,10 +15,17 @@ AS_IF([test "x$LOCKFILE" = x], [LOCKFILE="/var/lib/ebtables/lock"])
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun regular_CFLAGS="-Wall -Wunused"
33*4882a593Smuzhiyun regular_CPPFLAGS=""
34*4882a593Smuzhiyun+
35*4882a593Smuzhiyun case "$host" in
36*4882a593Smuzhiyun 	sparc64-*)
37*4882a593Smuzhiyun-		regular_CPPFLAGS="$regular_CPPFLAGS -DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32";;
38*4882a593Smuzhiyun+		enable_kernel_64_userland_32=yes ;;
39*4882a593Smuzhiyun esac
40*4882a593Smuzhiyun+AC_ARG_ENABLE([kernel-64-userland-32],
41*4882a593Smuzhiyun+    AC_HELP_STRING([--enable-kernel-64-userland-32], [indicate that ebtables will be built as a 32-bit application but run under a 64-bit kernel])
42*4882a593Smuzhiyun+)
43*4882a593Smuzhiyun+AS_IF([test "x$enable_kernel_64_userland_32" = xyes],
44*4882a593Smuzhiyun+    [regular_CPPFLAGS="$regular_CPPFLAGS -DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32"]
45*4882a593Smuzhiyun+)
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun AC_SUBST([regular_CFLAGS])
48*4882a593Smuzhiyun AC_SUBST([regular_CPPFLAGS])
49*4882a593Smuzhiyun--
50*4882a593Smuzhiyun2.26.2
51*4882a593Smuzhiyun
52