On 06/15/2012 04:55 PM, Vincent Torri wrote: > > thank you for all the tips ! Just for information, I use > > EFL_CHECK_COMPILER_FLAGS([-Wno-foo -Wbar]) Don't you mean: EFL_CHECK_COMPILER_FLAGS([efl], [-Wno-foo -Wbar]) > > with the code below (i've taken into account your remarks) > > i'm not sure that the m4_foreach below is properly quoted > > AC_DEFUN([EFL_CHECK_COMPILER_FLAG], > [ > m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z])) > m4_pushdef([UP], m4_translit([[$2]], [-a-z], [_A-Z])) > > m4_if(m4_index([$2], [-Wno-]), [0], [m4_pushdef([flagm4], > [m4_bpatsubst([[$2]], [no-])])], [m4_pushdef([flagm4], [$2])]) This can be shortened: m4_pushdef([flagm4], m4_bpatsubst([[$2]], [no-])) since m4_bpatsubst is a no-op if the pattern 'no-' doesn't appear. > > option=flagm4 And since this is the only use of flagm4, and I have now shortened the computation, you could inline the computation instead of using a temp m4 variable: option=m4_bpatsubst([[$2]], [no-]) > CFLAGS_save="${CFLAGS}" Personally, I'd write this as: CFLAGS_save=$CFLAGS as "" are unnecessary in a single-word assignment, and {} is unnecessary when there is nothing after the variable name. I might not be terse in my comments, but I try to be terse in my code :) But what you have is correct, and I won't fault you if that is your personal shell coding style. > CFLAGS="${CFLAGS} ${option}" Here, the "" are necessary, but again the ${} is extra typing. > > UPEFL[_CFLAGS]="${UPEFL[_CFLAGS]} [$2]" > AC_ARG_VAR(UPEFL[_CFLAGS], [preprocessor flags for $2]) > AC_SUBST(UPFEL[_CFLAGS]) Hope that typo was unintentional (EFL vs. FEL). > > AM_CONDITIONAL([EFL_HAVE]UP, [test "x${have_flag}" = "xyes"]) > > m4_popdef([UP]) > m4_popdef([UPEFL]) missing m4_popdef([flagm4]) if you keep the temp m4 variable. > ]) > > dnl Macro that iterates over a sequence of white separated flags > dnl and that call EFL_CHECK_COMPILER_FLAG() for each of these flags > dnl > dnl EFL_CHECK_COMPILER_FLAGS(EFL, FLAGS) > > AC_DEFUN([EFL_CHECK_COMPILER_FLAGS], > [ > m4_foreach_w([flag], [$2], [EFL_CHECK_COMPILER_FLAG($1, m4_defn([flag]))]) Almost. m4_foreach_w([flag], [$2], [EFL_CHECK_COMPILER_FLAG([$1], m4_defn([flag]))]) -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf