[icinga-checkins] icinga.org: icinga-core/test/cgis: install: add --with-p1-file-dir allowing custom location ( default is now $libdir instead of $bindir) #1569

git at icinga.org git at icinga.org
Tue Jul 5 21:38:12 CEST 2011


Module: icinga-core
Branch: test/cgis
Commit: 08b0437c5648bfe014e096c14be73b784e2d4f02
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=08b0437c5648bfe014e096c14be73b784e2d4f02

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Thu Jun 16 17:33:56 2011 +0200

install: add --with-p1-file-dir allowing custom location (default is now $libdir instead of $bindir) #1569

refs #1569
refs #1660

---

 Changelog                   |    4 ++++
 Makefile.in                 |    4 +++-
 configure                   |   19 +++++++++++++++++++
 configure.in                |    9 +++++++++
 contrib/epn_icinga.h        |    2 ++
 contrib/mini_epn.c          |    2 +-
 contrib/new_mini_epn.c      |    2 +-
 include/epn_icinga.h        |    3 +++
 include/locations.h.in      |    2 +-
 sample-config/icinga.cfg.in |    2 +-
 subst.in                    |    1 +
 11 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/Changelog b/Changelog
index dd37d69..fd3e08f 100644
--- a/Changelog
+++ b/Changelog
@@ -10,6 +10,10 @@ ENHANCEMENTS
 * classic ui: Added option to suppress coloring of hosts/services in maintenance (Matthew Brooks) #992
 * classic ui: Added option to show partial hostgroups (Matthew Brooks) #1013
 
+* install: add --with-p1-file-dir allowing custom location (default is now $libdir instead of $bindir) #1569
+	** only when embedded perl is enabled
+	** affects (new_)mini_epn and icinga.cfg
+
 FIXES
 * core: remove duplicated unlinks for check result files with multiple results #1615
 * core: fix retain status file over an init script reload #1579
diff --git a/Makefile.in b/Makefile.in
index c17865f..a57b07b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -36,6 +36,7 @@ exec_prefix=@exec_prefix@
 LOGDIR=@localstatedir@
 CHECKRESULTDIR=@CHECKRESULTDIR@
 EXTCMDFILEDIR=@EXTCMDFILEDIR@
+P1FILELOC=@P1FILELOC@
 CFGDIR=@sysconfdir@
 BINDIR=@bindir@
 CGIDIR=@sbindir@
@@ -385,7 +386,8 @@ install-basic:
 	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/archives
 	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CHECKRESULTDIR)
 	if [ $(INSTALLPERLSTUFF) = yes ]; then \
-		$(INSTALL) -m 664 $(INSTALL_OPTS) p1.pl $(DESTDIR)$(BINDIR); \
+		$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(P1FILELOC); \
+		$(INSTALL) -m 664 $(INSTALL_OPTS) p1.pl $(DESTDIR)$(P1FILELOC); \
 	fi;
 
 	@echo ""
diff --git a/configure b/configure
index 65dd09f..15492b3 100755
--- a/configure
+++ b/configure
@@ -654,6 +654,7 @@ XSDH
 XSDC
 lockfile
 init_dir
+P1FILELOC
 EXTCMDFILEDIR
 TMPDIR
 CHECKRESULTDIR
@@ -744,6 +745,7 @@ with_httpd_conf
 with_checkresult_dir
 with_temp_dir
 with_ext_cmd_file_dir
+with_p1_file_dir
 with_init_dir
 with_lockfile
 with_gd_lib
@@ -1437,6 +1439,8 @@ Optional Packages:
   --with-temp-dir=<path>  sets path to temp directory
   --with-ext-cmd-file-dir=<path>
                           sets path to external command file directory
+  --with-p1-file-dir=<path>
+                          sets path to embedded perl p1.pl directory
   --with-init-dir=<path>  sets directory to place init script into
   --with-lockfile=<path>  sets path and file name for lock file
   --with-gd-lib=DIR       sets location of the gd library
@@ -5277,6 +5281,21 @@ if test x$EXTCMDFILEDIR = xno; then
 fi
 
 
+P1FILELOC=no
+
+# Check whether --with-p1-file-dir was given.
+if test "${with_p1_file_dir+set}" = set; then :
+  withval=$with_p1_file_dir; P1FILELOC=$withval
+else
+  P1FILELOC=no
+fi
+
+if test x$P1FILELOC = xno; then
+        P1FILELOC="$libdir"
+fi
+
+
+
 
 init_dir=/etc/rc.d/init.d
 if test -d /etc/rc.d/init.d; then
diff --git a/configure.in b/configure.in
index e3be0df..3a0aef6 100644
--- a/configure.in
+++ b/configure.in
@@ -286,6 +286,15 @@ if test x$EXTCMDFILEDIR = xno; then
 fi
 AC_SUBST(EXTCMDFILEDIR)
 
+dnl Location of the embedded perl p1.pl
+P1FILELOC=no
+AC_ARG_WITH(p1-file-dir,AC_HELP_STRING([--with-p1-file-dir=<path>],[sets path to embedded perl p1.pl directory]),P1FILELOC=$withval,P1FILELOC=no)
+if test x$P1FILELOC = xno; then
+        P1FILELOC="$libdir"
+fi
+AC_SUBST(P1FILELOC)
+
+
 
 dnl Check for location of init scripts
 init_dir=/etc/rc.d/init.d
diff --git a/contrib/epn_icinga.h b/contrib/epn_icinga.h
index b6ea749..c09ab20 100644
--- a/contrib/epn_icinga.h
+++ b/contrib/epn_icinga.h
@@ -1,3 +1,5 @@
+#include "../include/locations.h"
+
 /******** BEGIN EMBEDDED PERL INTERPRETER DECLARATIONS ********/
 
 #include <EXTERN.h>
diff --git a/contrib/mini_epn.c b/contrib/mini_epn.c
index 09be082..4a8887b 100644
--- a/contrib/mini_epn.c
+++ b/contrib/mini_epn.c
@@ -19,7 +19,7 @@ int main(int argc, char **argv, char **env) {
 #endif
 */
 
-	char *embedding[] = { "", "p1.pl" };
+	char *embedding[] = { "", DEFAULT_P1_FILE };
 	char *plugin_output ;
 	char fname[MAX_INPUT_CHARS];
 	char *args[] = {"","0", "", "", NULL };
diff --git a/contrib/new_mini_epn.c b/contrib/new_mini_epn.c
index 5c7447e..a3fff03 100644
--- a/contrib/new_mini_epn.c
+++ b/contrib/new_mini_epn.c
@@ -176,7 +176,7 @@ void init_term_readline(void) {
 }
 
 void init_embedded_perl(void) {
-	char *embedding[] = { "", "p1.pl" };
+	char *embedding[] = { "", DEFAULT_P1_FILE };
 										/* embedding takes the place of argv[] ($argv[0] is the program name.
 										 * - which is not given to Perl).
 										 * Note that the number of args (ie the number of elements in embedding
diff --git a/include/epn_icinga.h b/include/epn_icinga.h
index 2cd96f3..f89a5c8 100644
--- a/include/epn_icinga.h
+++ b/include/epn_icinga.h
@@ -22,6 +22,9 @@
  *
  *****************************************************************************/
 
+/* needed for location of p1.pl */
+#include "locations.h"
+
 /******** BEGIN EMBEDDED PERL INTERPRETER DECLARATIONS ********/
 
 #include <EXTERN.h>
diff --git a/include/locations.h.in b/include/locations.h.in
index 4a0e457..c7cbf35 100644
--- a/include/locations.h.in
+++ b/include/locations.h.in
@@ -40,5 +40,5 @@
 #define DEFAULT_OBJECT_CACHE_FILE		"@localstatedir@/objects.cache"
 #define DEFAULT_PRECACHED_OBJECT_FILE		"@localstatedir@/objects.precache"
 #define DEFAULT_EVENT_BROKER_FILE		"@localstatedir@/broker.socket"
-#define DEFAULT_P1_FILE				"@bindir@/p1.pl"	/**** EMBEDDED PERL ****/
+#define DEFAULT_P1_FILE				"@P1FILELOC@/p1.pl"	/**** EMBEDDED PERL ****/
 #define DEFAULT_AUTH_FILE			""			/**** EMBEDDED PERL - IS THIS USED? ****/
diff --git a/sample-config/icinga.cfg.in b/sample-config/icinga.cfg.in
index 62afca3..9a14ffa 100644
--- a/sample-config/icinga.cfg.in
+++ b/sample-config/icinga.cfg.in
@@ -1229,7 +1229,7 @@ date_format=us
 # embedded Perl interpreter) is located.  If you didn't compile
 # Icinga with embedded Perl support, this option has no effect.
 
-p1_file=@bindir@/p1.pl
+p1_file=@P1FILELOC@/p1.pl
 
 
 
diff --git a/subst.in b/subst.in
index 5afca3f..ec03c00 100755
--- a/subst.in
+++ b/subst.in
@@ -28,6 +28,7 @@ while ($f = shift @ARGV) {
 		s|\@sysconfdir\@|@sysconfdir@|g;
 		s|\@TMPDIR\@|@TMPDIR@|g;
 		s|\@EXTCMDFILEDIR\@|@EXTCMDFILEDIR@|g;
+		s|\@P1FILELOC\@|@P1FILELOC@|g;
 		s|\@IDO_INSTANCE_NAME\@|@IDO_INSTANCE_NAME@|g;
 		s|\@CHECKRESULTDIR\@|@CHECKRESULTDIR@|g;
 		s|\@datadir\@|@datarootdir@|g;





More information about the icinga-checkins mailing list