On Fri, 12 Apr 2024 at 21:20, Bruno Haible <br...@clisp.org> wrote:

> Reuben Thomas wrote:
> > gcc -DHAVE_CONFIG_H -I. -I..  --include configmake.h --include config.h
>

Oh dear, the command-line includes were right in front of me, sorry!


> > ... enchant.c
>
> If you #include these two files from the .c file, rather than from the
> command line, you will have a location where to put '#undef DATADIR'.
>

That works, thanks!

Alternatively, you could swap the two --include options.
>

That didn't work (I guess not surprisingly, as it leaves configmake.h
included before system include files).

In any case, the reason for the two --include options is that in this
project I'm mostly compiling Vala-generated C, and Vala is a bit inflexible
with where it puts #include directives in its generated code. Specifically,
there's no way to get it to put config.h at the top of the file. However, I
don't need to have configmake.h on the command line like this (I can have
it automatically added later by Vala); this was just my being lazy. So, I
think I have a neat solution now.

Many thanks as always for your help.

-- 
https://rrt.sc3d.org

Reply via email to