Re: How to enable configure.ac to generate configure to must take arguments ?

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

 



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], [test@xxxxxxxx])
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

[tjyang@f12 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
[tjyang@f12 test]$


On Wed, Mar 10, 2010 at 2:50 PM, Eric Blake <eblake@xxxxxxxxxx> 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   eblake@xxxxxxxxxx    +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
>
>



-- 
T.J. Yang


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux