autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: optional features and AC_ARG_WITH


From: Stepan Kasal
Subject: Re: optional features and AC_ARG_WITH
Date: Fri, 18 Feb 2005 15:56:24 +0100
User-agent: Mutt/1.4.1i

Hello,

On Thu, Feb 17, 2005 at 11:28:08AM +0100, Gregorio Guidi wrote:
> > actually, I believe that both my proposals will get actually implemented.
> > But the AS_IF solution is already checked in to the autoconf CVS.
> 
> If there will be another solution, I would prefer to avoid AS_IF.

we cannot rely on any time frame for another solution.  So please use AS_IF
for now.  You can add this to the texinfo source, though:

@c FIXME: Remove AS_IF when the problem of AC_REQUIRE within `if' is solved.

> an example is meant to be a way to demonstate how easy it is to do something, 
> and using another macro can only scare away people that are already 
> intimidated by autoconf :)

I have a few comments.  Mostly aesthetics, but also fixing some bugs in your
examples (underquoted AS_HELP_STRING, for example):

+support for an external library (e.g. the readline library); if the user

Please use a comma for consistency with the rest of autoconf.texi:
        ... (e.g., the ...   

Example 1:

AC_ARG_WITH(readline,
        [AS_HELP_STRING(--with-readline,
           [support fancy command line editing <default=check>])],
        [],
        with_readline=check)
LIBREADLINE=
AS_IF([test "x$with_readline" != xno],
  [AC_CHECK_LIB(readline, main,
        [AC_SUBST(LIBREADLINE, "-lreadline -lncurses")
         AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have libreadline])
        ],
        [test "x$with_readline" = xcheck ||
           AC_MSG_FAILURE([--with-readline was given, but test for readline 
failed])
        ],
        -lncurses)])

Example2:

AC_ARG_WITH(readline,
        [AS_HELP_STRING(--with-readline,
           [enable experimental support for readline <default=disabled>])],
        [],
        with_readline=no)
LIBREADLINE=
AS_IF([test "x$with_readline" != xno],
  [AC_CHECK_LIB(readline, main,
        [AC_SUBST(LIBREADLINE, "-lreadline -lncurses")
         AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have libreadline])
        ],
        [AC_MSG_FAILURE([--with-readline was given, but test for readline 
failed])],
        -lncurses)])

Example 3:

AC_ARG_WITH(readline,
        [AS_HELP_STRING(--without-readline,
           [disable support for readline <default=enabled>])],
        [],
        with_readline=yes)
LIBREADLINE=
AS_IF([test "x$with_readline" != xno],
  [AC_CHECK_LIB(readline, main,
        [AC_SUBST(LIBREADLINE, "-lreadline -lncurses")
         AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have libreadline])
        ],
        [AC_MSG_FAILURE([test for readline failed, use --without-readline if 
you want to force readline support off])],
        -lncurses)])

And here:

+The examples above can be adapted with small effort to the case where
address@hidden should be preferred to @code{AC_ARG_WITH} (see
address@hidden Options}).

I'd say:
        These three examples can be easily adapted to the case...

Have a nice day,
        Stepan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]