Added --enable-8139too; cleaned up configure.ac and devices/Kbuild.
authorFlorian Pose <fp@igh-essen.com>
Wed, 21 Feb 2007 10:41:54 +0000
changeset 582 39f1704b0c99
parent 581 99623f8a8493
child 583 172d42146930
Added --enable-8139too; cleaned up configure.ac and devices/Kbuild.
configure.ac
devices/Kbuild
--- a/configure.ac	Wed Feb 21 10:26:19 2007 +0000
+++ b/configure.ac	Wed Feb 21 10:41:54 2007 +0000
@@ -77,8 +77,26 @@
 AC_MSG_RESULT([$LINUX_SOURCE_DIR (Kernel $LINUX_KERNEL_RELEASE)])
 
 #------------------------------------------------------------------------------
-# 8139too Kernel
-#------------------------------------------------------------------------------
+# 8139too driver
+#------------------------------------------------------------------------------
+
+AC_ARG_ENABLE([8139too],
+    AS_HELP_STRING([--enable-8139too],
+                   [Enable 8139too driver]),
+    [
+        case "${enableval}" in
+            yes) enable8139too=1
+                ;;
+            no) enable8139too=0
+                ;;
+            *) AC_MSG_ERROR([Invalid value for --enable-8139too])
+                ;;
+        esac
+    ],
+    [enable8139too=1]
+)
+
+AM_CONDITIONAL(ENABLE_8139TOO, test "x$enable8139too" = "x1")
 
 AC_ARG_WITH([8139too-kernel],
     AC_HELP_STRING(
@@ -93,23 +111,25 @@
     ]
 )
 
-AC_MSG_CHECKING([for kernel for 8139too driver])
-
-kernels=`ls -1 devices/ | grep -oE "^8139too-.*-" | cut -d "-" -f 2 | uniq`
-found=0
-for k in $kernels; do
-    if test "$kernel8139too" = "$k"; then
-        found=1
-    fi
-done
-if test $found -ne 1; then
-    AC_MSG_ERROR([kernel $kernel8139too not available for 8139too driver!])
-fi
-
-AC_MSG_RESULT([$kernel8139too])
-
-#------------------------------------------------------------------------------
-# Disable e100
+if test "x${enable8139too}" = "x1"; then
+    AC_MSG_CHECKING([for kernel for 8139too driver])
+
+    kernels=`ls -1 devices/ | grep -oE "^8139too-.*-" | cut -d "-" -f 2 | uniq`
+    found=0
+    for k in $kernels; do
+        if test "$kernel8139too" = "$k"; then
+            found=1
+        fi
+    done
+    if test $found -ne 1; then
+        AC_MSG_ERROR([kernel $kernel8139too not available for 8139too driver!])
+    fi
+
+    AC_MSG_RESULT([$kernel8139too])
+fi
+
+#------------------------------------------------------------------------------
+# e100 driver
 #------------------------------------------------------------------------------
 
 AC_ARG_ENABLE([e100],
@@ -125,14 +145,10 @@
                 ;;
         esac
     ],
-    [enablee100=0]
-)
-
-AM_CONDITIONAL(ENABLE_E100, test "x$enablee100" = x1)
-
-#------------------------------------------------------------------------------
-# e100 Kernel
-#------------------------------------------------------------------------------
+    [enablee100=0] # disabled by default
+)
+
+AM_CONDITIONAL(ENABLE_E100, test "x$enablee100" = "x1")
 
 AC_ARG_WITH([e100-kernel],
     AC_HELP_STRING(
@@ -147,7 +163,7 @@
     ]
 )
 
-if test ${enablee100} -eq 1; then
+if test "x${enablee100}" = "x1"; then
     AC_MSG_CHECKING([for kernel for e100 driver])
 
     kernels=`ls -1 devices/ | grep -oE "^e100-.*-" | cut -d "-" -f 2 | uniq`
@@ -165,7 +181,7 @@
 fi
 
 #------------------------------------------------------------------------------
-# forcedeth
+# forcedeth driver
 #------------------------------------------------------------------------------
 
 AC_ARG_ENABLE([forcedeth],
@@ -181,10 +197,10 @@
                 ;;
         esac
     ],
-    [enableforcedeth=0]
-)
-
-AM_CONDITIONAL(ENABLE_FORCEDETH, test "x$enableforcedeth" = x1)
+    [enableforcedeth=0] # disabled by default!
+)
+
+AM_CONDITIONAL(ENABLE_FORCEDETH, test "x$enableforcedeth" = "x1")
 
 AC_ARG_WITH([forcedeth-kernel],
     AC_HELP_STRING(
@@ -199,7 +215,7 @@
     ]
 )
 
-if test ${enableforcedeth} -eq 1; then
+if test "x${enableforcedeth}" = "x1"; then
     AC_MSG_CHECKING([for kernel for forcedeth driver])
 
     kernels=`ls -1 devices/ | grep -oE "^forcedeth-.*-" | cut -d "-" -f 2 | uniq`
@@ -295,7 +311,7 @@
     [dbg=0]
 )
 
-AM_CONDITIONAL(EC_DBG_IF, test "x$dbg" = x1)
+AM_CONDITIONAL(EC_DBG_IF, test "x$dbg" = "x1")
 AC_SUBST([EC_DBG_IF],${dbg})
 
 #------------------------------------------------------------------------------
@@ -307,10 +323,11 @@
 cat > config.kbuild <<EOF
 # config.kbuild - created by configure
 EC_DBG_IF := ${dbg}
+EC_ENABLE_8139TOO := ${enablee100}
 EC_8139TOO_KERNEL := ${kernel8139too}
-ENABLE_E100 := ${enablee100}
+EC_ENABLE_E100 := ${enablee100}
 EC_E100_KERNEL := ${kernele100}
-ENABLE_FORCEDETH := ${enableforcedeth}
+EC_ENABLE_FORCEDETH := ${enableforcedeth}
 EC_FORCEDETH_KERNEL := ${kernelforcedeth}
 EC_RTAI_DIR := "${rtaidir}"
 EC_MSR_DIR := "${msrdir}"
--- a/devices/Kbuild	Wed Feb 21 10:26:19 2007 +0000
+++ b/devices/Kbuild	Wed Feb 21 10:41:54 2007 +0000
@@ -33,30 +33,28 @@
 
 include $(src)/../config.kbuild
 
-EC_8139TOO_OBJ = 8139too-$(EC_8139TOO_KERNEL)-ethercat.o
-EC_E100_OBJ = e100-$(EC_E100_KERNEL)-ethercat.o
-EC_FORCEDETH_OBJ = forcedeth-$(EC_FORCEDETH_KERNEL)-ethercat.o
-
-obj-m := ec_8139too.o
-ifeq ($(ENABLE_E100),1)
-	obj-m += ec_e100.o
-endif
-ifeq ($(ENABLE_FORCEDETH),1)
-	obj-m += ec_forcedeth.o
-endif
-
-ec_8139too-objs := $(EC_8139TOO_OBJ)
-ec_e100-objs := $(EC_E100_OBJ)
-ec_forcedeth-objs := $(EC_FORCEDETH_OBJ)
-
 REV := $(shell if test -s $(src)/../svnrevision; then \
 		cat $(src)/../svnrevision; \
 	else \
 		svnversion $(src)/.. 2>/dev/null || echo "unknown"; \
 	fi)
 
-CFLAGS_$(EC_8139TOO_OBJ) = -DSVNREV=$(REV)
-CFLAGS_$(EC_E100_OBJ) = -DSVNREV=$(REV)
-CFLAGS_$(EC_FORCEDETH_OBJ) = -DSVNREV=$(REV)
+ifeq ($(EC_ENABLE_8139TOO),1)
+	obj-m += ec_8139too.o
+	ec_8139too-objs := 8139too-$(EC_8139TOO_KERNEL)-ethercat.o
+	CFLAGS_$(EC_8139TOO_OBJ) = -DSVNREV=$(REV)
+endif
+
+ifeq ($(EC_ENABLE_E100),1)
+	obj-m += ec_e100.o
+	ec_e100-objs := e100-$(EC_E100_KERNEL)-ethercat.o
+	CFLAGS_$(EC_E100_OBJ) = -DSVNREV=$(REV)
+endif
+
+ifeq ($(EC_ENABLE_FORCEDETH),1)
+	obj-m += ec_forcedeth.o
+	ec_forcedeth-objs := forcedeth-$(EC_FORCEDETH_KERNEL)-ethercat.o
+	CFLAGS_$(EC_FORCEDETH_OBJ) = -DSVNREV=$(REV)
+endif
 
 #------------------------------------------------------------------------------