bug-autoconf
[Top][All Lists]
Advanced

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

Re: Setting a default value for an AC_ARG_VAR


From: Reuben Thomas
Subject: Re: Setting a default value for an AC_ARG_VAR
Date: Sun, 16 Dec 2018 21:29:03 +0000

On Fri, 14 Dec 2018 at 14:51, Nick Bowler <address@hidden> wrote:

>
> If you want to set a value to a variable only if the variable is
> unset, a typical way to do that in shell programming is:
>
>   : "${FOO=value-if-unset}"
>
> Or if you prefer also to set it the variable is _empty_ (i.e., including
> the case where it is set to the empty string):
>
>   : "${FOO:=value-if-empty}"--
>

So the answer seems to be "do it with shell". I still get confused (as
here) with whether it's possible (or good style) to use shell directly, or
whether there's something I should be doing with autoconf macros.

So in the end I have this:

dnl Set size of word and address
AC_ARG_VAR([WORD_SIZE],
  [value of WORD_SIZE register [default: sizeof(long)]])
AC_CHECK_SIZEOF([long])
: "${WORD_SIZE=SIZEOF_LONG}"
AC_ARG_VAR([ADDRESS_SIZE],
  [value of ADDRESS_SIZE register [default: sizeof(size_t)]])
AC_CHECK_SIZEOF([size_t])
: "${ADDRESS_SIZE=SIZEOF_SIZE_T}"

Does that look about right?

-- 
https://rrt.sc3d.org


reply via email to

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