[Libvir] Request for changing #include directives to conform to Linux standard

Daniel Veillard veillard at redhat.com
Fri Jun 23 12:46:06 UTC 2006


On Fri, Jun 23, 2006 at 12:48:26PM +0200, Philippe Berthault wrote:
> The 'virterror.h' file has an #include directive to "libvirt.h" which 
> isn't correct
> because libvirt include files are installed on a sub-directory named 
> 'libvirt'.

  I think this is correct because libvirt.h and virterror.h are in the
same directory. I think this is a relative address path and a relatively
common practice.

> i.e. when libvirt is compiled with configure --script=/usr, then libvirt 
> files are
> installed in /usr/include/libvirt/.*
> 
> To be standard with Linux usage of include files, the correct directive in
> virterror.h will be:
>    #include <libvirt/libvirt.h>
> instead of:
>    #include "libvirt.h"

  I must be using a non linux system :-)

paphio:~/XML -> grep '#include "' /usr/include/*/*.h | wc -l
1165

> and in C/C++ source files using libvirt, there is just to include 
> libvirt with:
>    #include <libvirt/libvirt.h>
>    #include <libvirt/virterror.h>

  that I agree with. Doesn't mean that relative addressing between header
files should be forbidden !

> This is conform to Linux usage of include files and this permit to simplify
> Makefile(s) because there is no need to add option -I/usr/include/libvirt
> to compile sources files.

  The bug is that one should use "pkg-config libvirt --cflags" to get the
C compiler options and it does not return '-I/usr/include/libvirt'.

  That said, I'm actually not against making the change. The problem this
raises is a problem of source tree. If you just modify the header, then
when compiling libvirt and including virterror.h you would load the installed
include libvirt.h and not the one from the source tree which is a very good
way to break the build or introduce very pernicious errors. What is required
to make that change is to reflect the include/libvirt structure in the
tree, moving headers in the structure, that doable but requires some not
so nice tweaks to try to preserve CVS history without breaking existing CVS
checkouts. I will try to do that, 

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




More information about the libvir-list mailing list