+AC_ARG_ENABLE(
+ [mtd],
+ [AS_HELP_STRING(
+ [--enable-mtd],
+ [Add support for MTD devices on certain platforms [default=no]]
+ )],
+ [],
+ [enable_mtd=no]
+)
+AM_CONDITIONAL([ENABLE_MTD], [test "x$enable_mtd" = "xyes"])
+AS_IF([test "x$enable_mtd" = "xyes"],
+ [AC_DEFINE(MTD_SUPPORT, 1, [Enable MTD support])],
+ []
+)
+
+AS_IF(
+ [test "x$enable_mtd" = "xyes"],
+ AC_CHECK_LIB([flash], [arch_flash_init],
+ [LIBFLASH_LIBS=-lflash],
+ [AC_MSG_FAILURE([--enable-mtd requires the libflash library])]
+ )
+)
+AS_IF(
+ [test "x$enable_mtd" = "xyes"],
+ [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $libflash_CFLAGS"
+ AC_CHECK_HEADERS(
+ [libflash/libflash.h],
+ [],
+ [AC_MSG_FAILURE([--enable-mtd given but libflash/libflash.h not found])]
+ )
+ CPPFLAGS="$SAVE_CPPFLAGS"
+ ]
+)
+