14.11.2022 11:58, Daniel P. Berrangé wrote:
..
On current systems, using <capstone/capstone.h> works
now (despite the pkg-config-supplied -I/usr/include/capstone) -
since on all systems capstone headers are put into capstone/
subdirectory of a system include dir. So this change is
compatible with both the obsolete way of including it
and the only future way.

AFAIR, macOS HomeBrew does not put anything into the system
include dir, and always requires -I flags to be correct.

Does it work with the capstone-supplied --cflags and the proposed
include path?  What does pkg-config --cflags capstone return there?

..
-  if capstone.found() and not cc.compiles('#include <capstone.h>',
+  if capstone.found() and not cc.compiles('#include <capstone/capstone.h>',
                                            dependencies: [capstone])

To retain back compat this could probe for both ways

     if capstone.found()
         if cc.compiles('#include <capstone/capstone.h>',
                       dependencies: [capstone])
            ...
         else if cc.compiles('#include <capstone.h>',
                            dependencies: [capstone])
            ...
then, the source file can try the correct #include based on what
we detect works here.

I don't think this deserves the complexity really, unless there *is*
a system out there which actually needs this.

I mean, these little compat tweaks, - it becomes twisty with time,
and no one knows which code paths and config variables are needed
for what, and whole thing slowly becomes unmanageable... If it's
easy to make it unconditional, it should be done. IMHO anyway :)

Thanks!

/mjt

Reply via email to