Libgccjit detection

Li, Yicheng yli137@vols.utk.edu
Wed Aug 9 19:35:58 GMT 2023


Hi,

Adding the macro is what I’ve done.

Thank you
Yicheng Li

> On Aug 9, 2023, at 3:31 PM, David Malcolm <dmalcolm@redhat.com> wrote:
> 
> On Wed, 2023-08-09 at 17:45 +0000, Li, Yicheng via Jit wrote:
>> Hi,
>> 
>> Is there a way to detect libgccjit within C code?
> 
> I'm not sure what you mean here, sorry.
> 
> If you want the ability to compile a source file containing gcc_jit_*
> calls, but want to make having libgccjit.h optional at compile-time,
> then presumably you need your project to have some kind of configure
> test that determines if ligccjit is available, sets up a macro define,
> and to wrap your calls to gcc_jit_* in some kind of
>  #if HAVE_LIBGCCJIT 
> to use the macro.
> 
> For specific features within libgccjit.h, I've tried to add a 
> 
> #ifdef LIBGCCJIT_HAVE_name_of_feature
> 
> as I add them.  For example, there's a:
> 
> #ifdef LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks
> 
> which could be used to wrap calls to that specific function.
> 
>> I’m trying to compile the program without “-lgccjit”, but I load the
>> corresponding PATH and LD_LIBRARY_PATH.
> 
> Did the above answer your question, or did I misunderstand?
> 
> Dave
> 



More information about the Jit mailing list