[PATCH] mtd-utils: Add configure switches to disable jffsX or ubifs tools

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Thu Dec 22 01:19:09 PST 2016


Hello,

On Wed, 21 Dec 2016 16:54:12 +0100, David Oberhollenzer wrote:

> +AC_ARG_WITH([jffs],
> +	[AS_HELP_STRING([--without-jffs], [Disable jffsX utilities])],
> +	[case "${withval}" in
> +	yes) AM_CONDITIONAL([BUILD_JFFSX], [true]) ;;
> +	no)  AM_CONDITIONAL([BUILD_JFFSX], [false]) ;;
> +	*) AC_MSG_ERROR([bad value ${withval} for --without-jffs]) ;;
> +	esac],
> +	[AM_CONDITIONAL([BUILD_JFFSX], [true])])
> +
> +AC_ARG_WITH([ubifs],
> +	[AS_HELP_STRING([--without-ubifs], [Disable ubifs utilities])],
> +	[case "${withval}" in
> +	yes) AM_CONDITIONAL([BUILD_UBIFS], [true]) ;;
> +	no)  AM_CONDITIONAL([BUILD_UBIFS], [false]) ;;
> +	*) AC_MSG_ERROR([bad value ${withval} for --without-ubifs]) ;;
> +	esac],
> +	[AM_CONDITIONAL([BUILD_UBIFS], [true])])

If the only two correct values are "yes" or "no", then you should use
AC_ARG_ENABLE() and not AC_ARG_WITH().

Also, I believe a much more autoconf-ish way of writing this is:

AC_ARG_ENABLE([jffs],
	[AS_HELP_STRING([--without-jffs], [Disable jffsX utilities])],
	[], [enable_jffs=yes])

if "${enable_jffs}" = "yes" ; then
	need_uuid="yes"
	need_zlib="yes"
	need_lzo="yes"
fi

Indeed, using AM_CONDITIONAL() is useful to assign automake variable.
Here, BUILD_JFFS and BUILD_UBIFS are apparently only used within the
configure.ac, so using AM_CONDITIONAL() is useless.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com



More information about the linux-mtd mailing list