How to get fully extended variables from a configuration?

I created the configure.ac file as follows:

AC_INIT()
set

the purpose of this is to print any available environment variable that the configure script creates with set, so I do this:

user@host:~$ autoconf
user@host:~$ ./configure

which prints a bunch of variables like

build=
cache_file=/dev/null
IFS='   
'
LANG=C
LANGUAGE=C
datarootdir='${prefix}/share'
mandir='${datarootdir}/man'
no_create=

So far so good. The problem is this:

  • I want to expand variables, such as ${prefix}/share- but piping everything into a file example.shand executing it with bash does not work, because bash complains about changing read-only variables, such as UID, and the extension itself does not work either.
  • I tried to use makefilefor this where the extension works, but it complains about newlines in lines, for example, in the above output, lineIFS=' causes an error message Makefile:24: *** missing separator. Stop.

- , configure?

+5
1

Autoconf ( ) "" ​​ Makefile.in( .am, Automake):

Makefile.in

[...]
foo.sh: foo.sh.in
        $(SED) \
            -e 's|[@]prefix@|$(prefix)|g' \
            -e 's|[@]exec_prefix@|$(exec_prefix)|g' \
            -e 's|[@]bindir@|$(bindir)|g' \
            -e 's|[@]datarootdir@|$(datarootdir)|g' \
            < "$<" > "$@"
[...]

foo.sh.in

#!/bin/sh
datarootdir=@datarootdir@
du "$datarootdir"
+6

All Articles