Broken example in autoconf manual

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Broken example in autoconf manual

Max Horn
Hi there,

on https://www.gnu.org/software/autoconf/manual/autoconf.html#Using-System-Type

this example is given:

     case $host in
       alpha*-*-*)   AC_CONFIG_LINKS([dither.c:alpha/dither.c]) ;;
       powerpc*-*-*) AC_CONFIG_LINKS([dither.c:powerpc/dither.c]) ;;
       *-*-*)        AC_CONFIG_LINKS([dither.c:generic/dither.c]) ;;
     esac

But that doesn't actually work; inserting it into configure.ac leads to this error:

configure.ac:396: error: `dither.c' is already registered with AC_CONFIG_LINKS.
../../lib/autoconf/status.m4:921: AC_CONFIG_LINKS is expanded from...
configure.ac:396: the top level
autom4te-2.69: /usr/bin/m4 failed with exit status: 1


Which leaves me wondering how to achieve equivalent behavior correctly?


Cheers,
Max
Reply | Threaded
Open this post in threaded view
|

Re: Broken example in autoconf manual

Nick Bowler-2
Hello,

On 2017-03-16, Max Horn <[hidden email]> wrote:

> on
> https://www.gnu.org/software/autoconf/manual/autoconf.html#Using-System-Type
>
> this example is given:
>
>      case $host in
>        alpha*-*-*)   AC_CONFIG_LINKS([dither.c:alpha/dither.c]) ;;
>        powerpc*-*-*) AC_CONFIG_LINKS([dither.c:powerpc/dither.c]) ;;
>        *-*-*)        AC_CONFIG_LINKS([dither.c:generic/dither.c]) ;;
>      esac
>
> But that doesn't actually work; inserting it into configure.ac leads to this
> error:
>
> configure.ac:396: error: `dither.c' is already registered with
> AC_CONFIG_LINKS.

Nice catch.

[...]
> Which leaves me wondering how to achieve equivalent behavior correctly?

Probably the example could be written something like this (untested):

   case $host in
     alpha*-*-*)   dither_src=alpha ;;
     powerpc*-*-*) dither_src=powerpc ;;
     *-*-*)        dither_src=generic ;;
   esac
   AC_CONFIG_LINKS([dither.c:$dither_src/dither.c]) ;;

Cheers,
  Nick

Reply | Threaded
Open this post in threaded view
|

Re: Broken example in autoconf manual

Bert Wesarg-2
On Thu, Mar 16, 2017 at 11:26 PM, Nick Bowler <[hidden email]> wrote:

> Hello,
>
> On 2017-03-16, Max Horn <[hidden email]> wrote:
>> on
>> https://www.gnu.org/software/autoconf/manual/autoconf.html#Using-System-Type
>>
>> this example is given:
>>
>>      case $host in
>>        alpha*-*-*)   AC_CONFIG_LINKS([dither.c:alpha/dither.c]) ;;
>>        powerpc*-*-*) AC_CONFIG_LINKS([dither.c:powerpc/dither.c]) ;;
>>        *-*-*)        AC_CONFIG_LINKS([dither.c:generic/dither.c]) ;;
>>      esac
>>
>> But that doesn't actually work; inserting it into configure.ac leads to this
>> error:
>>
>> configure.ac:396: error: `dither.c' is already registered with
>> AC_CONFIG_LINKS.
>
> Nice catch.
>
> [...]
>> Which leaves me wondering how to achieve equivalent behavior correctly?
>
> Probably the example could be written something like this (untested):
>
>    case $host in
>      alpha*-*-*)   dither_src=alpha ;;
>      powerpc*-*-*) dither_src=powerpc ;;
>      *-*-*)        dither_src=generic ;;
>    esac
>    AC_CONFIG_LINKS([dither.c:$dither_src/dither.c]) ;;
>

I think you also need to pass the value of 'dither_src' to
config.status (still untested):

AC_CONFIG_LINKS([dither.c:$dither_src/dither.c], [], [dither_src='$dither_src'])

Bert

> Cheers,
>   Nick
>