turn pcmcia support on or off by default depending on whether
authorFrank Mori Hess <fmhess@speakeasy.net>
Tue, 18 Jul 2006 02:31:50 +0000 (02:31 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Tue, 18 Jul 2006 02:31:50 +0000 (02:31 +0000)
the kernel's pcmcia_driver struct has a probe function pointer.

configure.ac
m4/as-linux.m4

index 7fa375c59b76644ceda5a743d39731dd0982bf95..54ebdeaa0af02f2ed54723f8713917b1bd5de8a8 100644 (file)
@@ -66,8 +66,9 @@ CC=$LINUX_CC
  -DKBUILD_BASENAME=\$(shell basename \$< .c)"]
 AC_SUBST(COMEDI_CFLAGS)
 
+COMEDI_CHECK_PCMCIA_PROBE([$LINUX_DIR], [ENABLE_PCMCIA="yes"], [ENABLE_PCMCIA="no"])
 AC_ARG_ENABLE([pcmcia],[  --disable-pcmcia     Disable support for PCMCIA devices],
-       [ENABLE_PCMCIA=$enableval],[ENABLE_PCMCIA="yes"])
+       [ENABLE_PCMCIA=$enableval],[])
 if test "$ENABLE_PCMCIA" = "yes" ; then
        AS_LINUX_CONFIG_OPTION_MODULE(CONFIG_PCMCIA)
 else
index 0d9ba40bebbf502cd6f65b969c8c504d4756b10c..de6e09864ac0a8b137bb919dd8c2e298a8f15aff 100644 (file)
@@ -698,3 +698,22 @@ AC_DEFUN([COMEDI_CHECK_LINUX_KBUILD],
        fi
        fi
 ])
+
+# COMEDI_CHECK_PCMCIA_PROBE([LINUX_SOURCE_PATH], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -------------------------------------------------------------
+#
+# Check if kernel pcmcia support is new enough to have a probe member in the pcmcia_driver
+# struct.
+AC_DEFUN([COMEDI_CHECK_PCMCIA_PROBE],
+[
+       AC_REQUIRE([AC_PROG_EGREP])
+       AC_MSG_CHECKING([$1 for probe in pcmcia_driver struct])
+       cat "$1/include/pcmcia/ds.h" | tr \\n ' ' | [$EGREP "struct[[:space:]]+pcmcia_driver[[:space:]]*[{][^}]*probe"] > /dev/null
+       if (($?)); then
+               AC_MSG_RESULT([no])
+               $3
+       else
+               AC_MSG_RESULT([yes])
+               $2
+       fi
+])