[icinga-checkins] icinga.org: icinga-core/mfriedrich/workers: libicinga: install headers with absolute path search #2960

git at icinga.org git at icinga.org
Sun Aug 5 23:32:13 CEST 2012


Module: icinga-core
Branch: mfriedrich/workers
Commit: a1f4a3f17491fa98c9e19878e5f9762c12d42cb8
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=a1f4a3f17491fa98c9e19878e5f9762c12d42cb8

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Sun Aug  5 19:07:55 2012 +0200

libicinga: install headers with absolute path search #2960

we've got "lib/libicinga.h" to link once - no matter if that is now in
$root source dir, or installed systemwide into

"/usr/local/include/icinga/lib/libicinga.h"

so in order to safely include that, we need to tell all sub directories
where to look for the root to start. for base, contrib, cgi this can be
done with -I.. (one up), for modules/idoutils/src, -I../../.. (three up)
is required in order to compile safely.

this will allow building icinga and modules against libicinga, being
installed as seperated package with libs and headers.

refs #2960

---

 base/Makefile.in                |    2 +-
 cgi/Makefile.in                 |    3 ++-
 include/icinga.h                |    2 +-
 module/Makefile.in              |    2 +-
 module/idoutils/src/Makefile.in |    3 ++-
 5 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/base/Makefile.in b/base/Makefile.in
index 15121f0..87172e0 100644
--- a/base/Makefile.in
+++ b/base/Makefile.in
@@ -10,7 +10,7 @@ SRC_XDATA=../xdata
 SRC_LIB=../lib
 
 CC=@CC@
-CFLAGS=@CFLAGS@ @DEFS@ -DNSCORE
+CFLAGS=-Wall -I.. @CFLAGS@ @DEFS@ -DNSCORE
 
 # Compiler flags for use with gprof
 # when running prof, make sure to remove drop_privilegues when running!
diff --git a/cgi/Makefile.in b/cgi/Makefile.in
index 5b61592..fe90e49 100644
--- a/cgi/Makefile.in
+++ b/cgi/Makefile.in
@@ -27,7 +27,8 @@ CGIEXTRAS=@CGIEXTRAS@
 
 CP=@CP@
 CC=@CC@
-CFLAGS=@CFLAGS@ @DEFS@ -DNSCGI
+# avail.cgi uses base/statsprofiler.c which will link icinga.h->lib/libicinga.h
+CFLAGS=-Wall -I.. @CFLAGS@ @DEFS@ -DNSCGI
 
 # for profiling
 CFLAGS += -pg -ftest-coverage
diff --git a/include/icinga.h b/include/icinga.h
index 007264b..6e79864 100644
--- a/include/icinga.h
+++ b/include/icinga.h
@@ -36,7 +36,7 @@
 #include "locations.h"
 #include "objects.h"
 #include "macros.h"
-#include "../lib/libicinga.h"
+#include "lib/libicinga.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/module/Makefile.in b/module/Makefile.in
index 19fad22..6fec929 100644
--- a/module/Makefile.in
+++ b/module/Makefile.in
@@ -27,7 +27,7 @@ CP=@CP@
 all:	helloworld.so
 
 helloworld.so: helloworld.c
-	$(CC) $(MOD_CFLAGS) $(CFLAGS) -o helloworld.so helloworld.c $(MOD_LDFLAGS) $(LDFLAGS) $(LIBS)
+	$(CC) -I.. $(MOD_CFLAGS) $(CFLAGS) -o helloworld.so helloworld.c $(MOD_LDFLAGS) $(LDFLAGS) $(LIBS)
 
 clean:
 	rm -f helloworld.o
diff --git a/module/idoutils/src/Makefile.in b/module/idoutils/src/Makefile.in
index d93bb84..66e2232 100644
--- a/module/idoutils/src/Makefile.in
+++ b/module/idoutils/src/Makefile.in
@@ -20,7 +20,8 @@ INSTALL_OPTS=@INSTALL_OPTS@
 
 CC=@CC@
 
-CFLAGS=@CFLAGS@ @DEFS@ 
+# we link to icinga.h which uses absolute path to lib/libicinga.h
+CFLAGS=-Wall -I../../.. @CFLAGS@ @DEFS@
 
 # We don't like ANSI because ANSI doesn't like us! phhht!
 #CFLAGS=-g -Wall -ansi -pedantic -DHAVE_CONFIG_H





More information about the icinga-checkins mailing list