Discussion:
Like config.h.in but in Ada
Victor Porton
2017-10-30 12:47:17 UTC
Permalink
I want to create file config.ads similar to config.h but with Ada
syntax instead of C.

I created config.ads.in, added it to configure.ac and got:

package Boiler.Config is
Data_Dir: constant String := "${prefix}/share";
end Boiler.Config;

from

package Boiler.Config is
Data_Dir: constant String := "@datadir@";
end Boiler.Config;

It is not acceptable because Ada does not understand ${prefix}.

How to make a value into an Ada string (a string delimited by double
quotes)?

It could be not ideal but acceptable if the code didn't work with paths
containing double quotes.
Mathieu Lirzin
2017-10-30 13:28:48 UTC
Permalink
Post by Victor Porton
I want to create file config.ads similar to config.h but with Ada
syntax instead of C.
package Boiler.Config is
Data_Dir: constant String := "${prefix}/share";
end Boiler.Config;
from
package Boiler.Config is
end Boiler.Config;
It is not acceptable because Ada does not understand ${prefix}.
How to make a value into an Ada string (a string delimited by double
quotes)?
It could be not ideal but acceptable if the code didn't work with paths
containing double quotes.
I have no experience with Ada however the general fix is to generate
"config.ads" at "make" time so that $prefix variable will be expanded.
in C you can achieve that with CPPFLAGS:

AM_CPPFLAGS = -DPACKAGE_LOAD_PATH=\"$(moduledir)\"

With other language this has to be done differently, you can use 'sed'
or 'config.status' in your Makefile. More details are provided in the
Autoconf manual [1].

[1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Installation-Directory-Variables
--
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37
Loading...