From 52100d92784c18b73743cae0e04bee01545d3a87 Mon Sep 17 00:00:00 2001 From: Bjarne von Horn Date: Sat, 12 Aug 2023 11:52:19 +0200 Subject: [PATCH] unify r8169 configure for kernels >= 5.0.0 NOTE: this adds a dependency on autoconf-archive package, because `AX_COMPARE_VERSION` macro is used. --- configure.ac | 27 +++++++-------------------- devices/Kbuild.in | 6 +++--- devices/r8169/Kbuild.in | 4 +++- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index 0b15a629..aca6e551 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/devices/Kbuild.in b/devices/Kbuild.in index 01ff71e8..6de73e03 100644 --- a/devices/Kbuild.in +++ b/devices/Kbuild.in @@ -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 := \ diff --git a/devices/r8169/Kbuild.in b/devices/r8169/Kbuild.in index 60af2d3a..a5e1d06f 100644 --- a/devices/r8169/Kbuild.in +++ b/devices/r8169/Kbuild.in @@ -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 := \