Bill Moseley <[EMAIL PROTECTED]> writes:
> For example, is there a better (or more compact) way to write:
> AC_ARG_ENABLE([memdebug],
> AC_HELP_STRING([--enable-memdebug], [debug memory),
> ,
> enableval=no)
> if test "$enableval" != "no"; then
> AC_MSG_NOTICE([MEM_DEBUG enabled])
> AC_DEFINE(MEM_DEBUG,1,[debug memory])
> fi
I generally do something like:
AC_MSG_CHECKING([if memory debugging is requested])
AC_ARG_ENABLE([memdebug],
AC_HELP_STRING([--enable-memdebug], [Enable memory debugging]),
,
enableval=no)
AC_MSG_RESULT($enableval)
if test x"$enableval" != xno ; then
AC_DEFINE([MEM_DEBUG], 1, [Define to 1 to enable memory debugging])
fi
Since you have a lot of those, I'd parameterize the whole thing and turn
it into a macro. It would probably need to take five arguments (the name
of the enable string, the variable to set, the checking output, the help
string, and the string for config.h), which is sort of annoying, but it
might still be more compact.
--
Russ Allbery ([EMAIL PROTECTED]) <http://www.eyrie.org/~eagle/>