unify r8169 configure for kernels >= 5.0.0

NOTE: this adds a dependency on autoconf-archive package,
because `AX_COMPARE_VERSION` macro is used.
This commit is contained in:
Bjarne von Horn 2023-08-12 11:52:19 +02:00
parent 79998219bc
commit 52100d9278
3 changed files with 13 additions and 24 deletions

View File

@ -578,25 +578,6 @@ AC_SUBST(KERNEL_IGC,[$kerneligc])
# r8169 driver
#------------------------------------------------------------------------------
AC_ARG_ENABLE([r8169x],
AS_HELP_STRING([--enable-r8169x],
[Enable r8169 driver (kernel > 4.0)]),
[
case "${enableval}" in
yes) enable_r8169x=1
;;
no) enable_r8169x=0
;;
*) AC_MSG_ERROR([Invalid value for --enable-r8169x])
;;
esac
],
[enable_r8169x=0] # disabled by default
)
AM_CONDITIONAL(ENABLE_R8169X, test "x$enable_r8169x" = "x1")
AC_SUBST(ENABLE_R8169X,[$enable_r8169x])
AC_ARG_ENABLE([r8169],
AS_HELP_STRING([--enable-r8169],
[Enable r8169 driver]),
@ -629,12 +610,18 @@ AC_ARG_WITH([r8169-kernel],
]
)
AX_COMPARE_VERSION(["$kernel_r8169"], [ge], [5.0.0],
AC_SUBST(R8169_KERNEL_5, [1]),
AC_SUBST(R8169_KERNEL_5, [0])
)
if test "x${enable_r8169}" = "x1"; then
AC_MSG_CHECKING([for kernel for r8169 driver])
kernels=`ls -1 ${srcdir}/devices/ | grep -oE "^r8169-.*-" | cut -d "-" -f 2 | uniq`
kernels5=`ls -1 ${srcdir}/devices/r8169/ | grep -oE "^r8169_main-.*-" | cut -d "-" -f 2 | uniq`
found=0
for k in $kernels; do
for k in $kernels $kernels5; do
if test "$kernel_r8169" = "$k"; then
found=1
fi

View File

@ -83,14 +83,14 @@ ifeq (@ENABLE_IGC@,1)
endif
ifeq (@ENABLE_R8169@,1)
ifeq (@R8169_KERNEL_5@,1)
obj-m += r8169/
else
EC_R8169_OBJ := r8169-@KERNEL_R8169@-ethercat.o
obj-m += ec_r8169.o
ec_r8169-objs := $(EC_R8169_OBJ)
CFLAGS_$(EC_R8169_OBJ) = -DREV=$(REV)
endif
ifeq (@ENABLE_R8169X@,1)
obj-m += r8169/
endif
KBUILD_EXTRA_SYMBOLS := \

View File

@ -40,7 +40,8 @@ REV := $(shell if test -s $(TOPDIR)/revision; then \
git -C $(TOPDIR) describe 2>/dev/null || echo "unknown"; \
fi)
ifeq (@ENABLE_R8169X@,1)
ifeq (@ENABLE_R8169@,1)
ifeq (@R8169_KERNEL_5@,1)
obj-m += ec_r8169.o
ec_r8169-objs := \
@ -50,6 +51,7 @@ ifeq (@ENABLE_R8169X@,1)
CFLAGS_r8169_main-@KERNEL_R8169@-ethercat.o = -DREV=$(REV)
endif
endif
KBUILD_EXTRA_SYMBOLS := \