autoconf
[Top][All Lists]
Advanced

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

Re: How to enable configure.ac to generate configure to must take argum


From: TJ Yang
Subject: Re: How to enable configure.ac to generate configure to must take arguments ?
Date: Wed, 10 Mar 2010 15:39:27 -0600

Thanks for the helps.
Lesson learn: I didn't put the argument process block of code
underneath AC_INIT().


my test configure.ac

AC_PREREQ([2.60])
AC_INIT([mytest], [1.0], address@hidden)
MYARGS=0

if test $# == $MYARGS; then
  AS_MSG_ERROR([Invalid options, use --help to see good help stuff])
fi
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT

address@hidden test]$ ./autogen.sh ;./configure
Preparing the mytest build system...please wait

Found GNU Autoconf version 2.63
Found GNU Automake version 1.11.1
Found GNU Libtool version 2.2.6b

Automatically preparing build ... done

The mytest build system is now prepared.  To build here, run:
  ./configure
  make
configure: error: Invalid options, use --help to see good help stuff
address@hidden test]$


On Wed, Mar 10, 2010 at 2:50 PM, Eric Blake <address@hidden> wrote:
> On 03/10/2010 01:35 PM, TJ Yang wrote:
>> By default "./configure " will proceed to run itself and collect all
>> the system information.
>>
>> I am thinking  of writing my own configure.ac to generate configure to split 
>> out
>> the content of "--help"  or shoowing a usage message when there is no
>> argument provided.
>
> Why?  That violates the GNU Coding Standards - many developers have come
> to expect configure to work without arguments, and your package would be
> broken in their eyes.
>
>>
>> Following code in configure.ac doesn't exit out right away when I type
>> in "./configure"
>>
>> MYARGS=2
>> if test $#  ne $MYARGS
>
> If you _absolutely_ must access $@ (or $*, $#), then your code to do so
> must occur immediately after AC_INIT:
> http://www.gnu.org/software/autoconf/manual/autoconf.html#Initializing-configure
>
>> then
>>    echo "Need one argument at least.\n"
>>    exit 0
>
> Please don't.  If you are going to make configure exit without
> completing, then at least exit with a non-zero status.
>
> --
> Eric Blake   address@hidden    +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
>
>



-- 
T.J. Yang




reply via email to

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