[Nagios-devel] Patch to get Nagios header files also installed

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Patch to get Nagios header files also installed

Post by Guest »

Hi,

it would be more easy for developers to distribute and users to build
NEB modules if Nagios would be installed with its header files. I have
written a patch for configure.in, Makefile.in and include/Makefile.in
to support this. The latter is completely new since it didn't exist
yet. I used the existing include/Makefile as a starting point.

###########################################
diff -up nagios-3.0b7/configure.in nagios-3.0b7-new/configure.in
--- nagios-3.0b7/configure.in 2007-11-23 19:24:50.000000000 +0100
+++ nagios-3.0b7-new/configure.in 2007-12-17 23:49:25.000000000 +0100
@@ -5,6 +5,7 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],)

AC_INIT(base/nagios.c)
+dnl Files given in AC_CONFIG_HEADER don't have to get installed by
make, see include/Makefile.in
AC_CONFIG_HEADER(include/config.h include/snprintf.h include/cgiutils.h)
AC_PREFIX_DEFAULT(/usr/local/nagios)

@@ -758,7 +759,7 @@ AC_SUBST(INITDIR)
AC_SUBST(INSTALLPERLSTUFF)

AC_PATH_PROG(PERL,perl)
-AC_OUTPUT(Makefile subst pkginfo base/Makefile common/Makefile
contrib/Makefile cgi/Makefile html/Makefile module/Makefile
xdata/Makefile daemon-init html/index.html html/side.html)
+AC_OUTPUT(Makefile subst pkginfo base/Makefile common/Makefile
contrib/Makefile cgi/Makefile html/Makefile include/Makefile
module/Makefile xdata/Makefile daemon-init html/index.html
html/side.html)


perl subst include/locations.h
###########################################

###########################################
diff -up nagios-3.0b7/Makefile.in nagios-3.0b7-new/Makefile.in
--- nagios-3.0b7/Makefile.in 2007-11-10 23:54:35.000000000 +0100
+++ nagios-3.0b7-new/Makefile.in 2007-12-17 23:36:36.000000000 +0100
@@ -1,7 +1,7 @@
###############################
# Makefile for Nagios
#
-# Last Modified: 11-10-2007
+# Last Modified: 12-17-2007
###############################


@@ -28,6 +28,7 @@ BINDIR=@bindir@
CGIDIR=@sbindir@
LIBEXECDIR=@libexecdir@
HTMLDIR=@datadir@
+INCLUDEDIR=@includedir@
INSTALL=@INSTALL@
INSTALL_OPTS=@INSTALL_OPTS@
COMMAND_OPTS=@COMMAND_OPTS@
@@ -175,6 +176,7 @@ install-cgis:
install:
cd $(SRC_BASE) && $(MAKE) $@
cd $(SRC_CGI) && $(MAKE) $@
+ cd $(SRC_INCLUDE) && $(MAKE) $@
cd $(SRC_HTM) && $(MAKE) $@
$(MAKE) install-basic

@@ -185,6 +187,7 @@ install-unstripped:
$(MAKE) install-basic

install-basic:
+ $(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(INCLUDEDIR)
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LIBEXECDIR)
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/archives
###########################################

###########################################
--- nagios-3.0b7/include/Makefile 2007-10-18 14:57:22.000000000 +0200
+++ nagios-3.0b7-new/include/Makefile.in 2007-12-18
00:12:30.000000000 +0100
@@ -1,9 +1,14 @@
###############################
# Makefile for Include Files
#
-# Last Modified: 10-18-2007
+# Last Modified: 12-17-2007
###############################

+prefix=@prefix@
+INCLUDEDIR=@includedir@
+INSTALL=@INSTALL@
+INSTALL_OPTS=@INSTALL_OPTS@
+
clean:
rm -f *~

@@ -11,3 +16,14 @@ distclean: clean
rm -f cgiutils.h config.h locations.h snprintf.h

devclean: distclean
+
+install:
+ $(MAKE) install-basic
+
+install-basic:
+ $(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(INCLUDEDIR)
+ for file in *.h; do \
+ if test "x${file}" != "xconfig.h" -a "x${file}" !=
"xsnprintf.h" -a "x${file}" != "xcgiutils.h" ; then \
+ $(INSTALL) -m 644 $(INSTALL_OPTS) $$file
$(DESTDIR)$(INCLUDEDIR); \
+ fi; \
+ done
###########################################

I have tested these changes on my Linux box. Since bash code is copied
from configure script it should be already portable to other
platforms. Please use your version of autoconf to update your
configure script.

Would be nice to see this patch in Nagios 3.0.

Thanks.

Tobias





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked