Permalink
Browse files

Configuration files and scripts are now created during the install ph…

…ase rather than during configure. This allows values such as @sysconfdir@ to be used in the template configuration files.
  • Loading branch information...
1 parent f1a708c commit 6e21604756907217a5d52b54bd4e96b9e799b233 d_pocock committed Jan 14, 2010
View
@@ -1,12 +1,15 @@
# $Id$
#
+
+include $(top_srcdir)/ganglia.inc
+
if BUILD_GMETAD
-GMETAD_SUBDIR = gmetad
+GMETAD_SUBDIR = gmetad web
else
GMETAD_SUBDIR =
endif
-EXTRA_SUBDIRS = "web gmetad-python contrib"
+EXTRA_SUBDIRS = "gmetad-python contrib"
EXTRA_DIST_FILES =
INCLUDES = @APR_INCLUDES@
@@ -16,7 +19,7 @@ GANGLIA_SUBDIRS = lib libmetrics tests $(GMETAD_SUBDIR) gmond gstat gmetric incl
SUBDIRS = $(GANGLIA_SUBDIRS)
# Make sure that no matter the setting for --with-gmetad
# that the gmetad directory gets distributed
-GANGLIA_SUBDIRS_DIST = lib libmetrics tests gmetad gmond gstat gmetric include
+GANGLIA_SUBDIRS_DIST = lib libmetrics tests gmetad web gmond gstat gmetric include
DIST_SUBDIRS = $(GANGLIA_SUBDIRS_DIST)
EXTRA_DIST = README.WIN README.AIX ganglia.spec.aix ganglia.spec ganglia.pod ganglia.html mans $(EXTRA_DIST_FILES)
@@ -65,4 +68,26 @@ dist-hook:
touch $(distdir)/Makefile.am
find $(distdir) -exec touch -r $(distdir)/Makefile.am {} \;
-bin_SCRIPTS = ganglia-config
+# _SCRIPTS causes the target to be built at build time
+# we want it done at install time
+#bin_SCRIPTS = ganglia-config
+
+ganglia-config: ganglia-config.in $(FIXCONFIG)
+ $(FIXCONFIG) ganglia-config.in
+
+install-exec-hook: ganglia-config
+ mkdir -p $(DESTDIR)$(bindir) && \
+ $(INSTALL_SCRIPT) ganglia-config $(DESTDIR)$(bindir)/ganglia-config
+
+contrib/ganglia_gmond.xml: contrib/ganglia_gmond.xml.in $(FIXCONFIG)
+ $(FIXCONFIG) contrib/ganglia_gmond.xml.in
+
+solaris/pkginfo: solaris/pkginfo.in $(FIXCONFIG)
+ $(FIXCONFIG) solaris/pkginfo.in
+
+# Notice that some files declared in this hook never get installed anywhere
+# We use the hook to force the files to be generated, but they remain
+# within the build tree for someone to inspect or manually copy to
+# the desired location if needed
+install-data-hook: contrib/ganglia_gmond.xml solaris/pkginfo
+
View
@@ -742,43 +742,37 @@ case $GANGLIA_VERSION in
;;
esac
+AC_CONFIG_FILES([scripts/fixconfig], [chmod +x scripts/fixconfig])
+
AC_OUTPUT(Makefile
- ganglia-config
- contrib/ganglia_gmond.xml
tests/Makefile
ganglia.spec
gmetad/Makefile
lib/default_conf.h
lib/Makefile
gmond/Makefile
gstat/Makefile
- gmond/gmond.solaris.init
gmond/modules/Makefile
- gmond/modules/conf.d/modpython.conf
gmond/modules/example/Makefile
gmond/modules/cpu/Makefile
gmond/modules/disk/Makefile
gmond/modules/memory/Makefile
gmond/modules/network/Makefile
gmond/modules/python/Makefile
- gmond/modules/python/README
gmond/modules/status/Makefile
gmond/modules/system/Makefile
gmond/python_modules/Makefile
gmond/python_modules/disk/Makefile
gmond/python_modules/example/Makefile
gmond/python_modules/network/Makefile
- gmetad/gmetad.conf
gmetad/conf.c
gmetad-python/setup.py
gmetad-python/Gmetad/gmetad_config.py
gmetad-python/gmetad-python.conf
gmetad-python/plugins/rrd_plugin.py
gmetric/Makefile
- include/Makefile
- solaris/pkginfo
- web/conf.php
- web/version.php)
+ include/Makefile
+ web/Makefile)
echo ""
echo "Welcome to.."
@@ -10,10 +10,10 @@
<service_fmri value='svc:/network/physical:default'/>
</dependency>
<dependency name='config' grouping='require_all' restart_on='none' type='path'>
- <service_fmri value='file://localhost@prefix@/etc/gmond.conf'/>
+ <service_fmri value='file://localhost@sysconfdir@/gmond.conf'/>
</dependency>
- <exec_method name='start' type='method' exec='@prefix@/sbin/gmond' timeout_seconds='60'/>
+ <exec_method name='start' type='method' exec='@sbindir@/gmond' timeout_seconds='60'/>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60' />
<instance name="default" enabled="true">
View
@@ -1,3 +1,6 @@
+
+include $(top_srcdir)/ganglia.inc
+
if STATIC_BUILD
GCFLAGS = -D_LARGEFILE64_SOURCE
GLDADD =
@@ -20,11 +23,19 @@ gmetad_LDADD = $(top_builddir)/lib/libganglia.la -lrrd -lm \
gmetad_LDFLAGS = $(GLDFLAGS)
-EXTRA_DIST = gmetad.aix.init gmetad.conf gmetad.init gmetad.init.SuSE \
+EXTRA_DIST = gmetad.aix.init gmetad.conf.in gmetad.init gmetad.init.SuSE \
type_hash.gperf xml_hash.gperf gmetad-default
xml_hash.c: xml_hash.gperf
gperf -l -H xml_hash -t -F ', 0' -N in_xml_list -k '1,$$' -W xml_tags xml_hash.gperf > xml_hash.c
type_hash.c: type_hash.gperf
gperf -G -l -H type_hash -t -F ', 0' -N in_type_list -k '1,$$' -W types type_hash.gperf > type_hash.c
+
+gmetad.conf: gmetad.conf.in $(FIXCONFIG)
+ $(FIXCONFIG) gmetad.conf.in
+
+install-data-hook: gmetad.conf
+ mkdir -p $(DESTDIR)$(sysconfdir) && \
+ $(INSTALL_DATA) gmetad.conf $(DESTDIR)$(sysconfdir)/gmetad.conf
+
View
@@ -1,3 +1,6 @@
+
+include $(top_srcdir)/ganglia.inc
+
SUBDIRS = modules python_modules
EXTRA_DIST = gmond.aix.init gmond.init gmond.init.SuSE gmond.conf.5 gmond.conf.html conf.pod
@@ -48,3 +51,15 @@ gmond_LDADD = $(top_builddir)/libmetrics/libmetrics.la \
gmond_DEPENDENCIES = $(gmond_LDADD)
gmond_LDFLAGS = $(GLDFLAGS)
+
+gmond.solaris.init: gmond.solaris.init.in $(FIXCONFIG)
+ $(FIXCONFIG) gmond.solaris.init.in
+
+# we declare the hook so that gmond.solaris.init will be created within the
+# build tree during the install phase
+# however, the action to install it is commented out, as it is likely
+# the SA will use some other script to put this file into a package or
+# something
+install-exec-hook: gmond.solaris.init
+# $(INSTALL_SCRIPT) gmond.solaris.init
+
@@ -1,7 +1,7 @@
#!/bin/sh
GANGLIA_BASEDIR=@prefix@
-GMOND=${GANGLIA_BASEDIR}/sbin/gmond
+GMOND=@sbindir@/gmond
test -f /etc/default/gmond && . /etc/default/gmond
@@ -1,3 +1,6 @@
+
+include $(top_srcdir)/ganglia.inc
+
AM_CFLAGS = -D_LARGEFILE64_SOURCE -I$(top_builddir)/include -I$(top_builddir)/lib
if STATIC_BUILD
@@ -9,7 +12,19 @@ pkglib_LTLIBRARIES = modpython.la
modpython_la_SOURCES = mod_python.c
modpython_la_LDFLAGS = -module -avoid-version -lpython@PYTHON_VERSION@
-EXTRA_DIST = ../conf.d/modpython.conf
+EXTRA_DIST = README.in ../conf.d/modpython.conf.in
endif
+README: README.in $(FIXCONFIG)
+ $(FIXCONFIG) README.in
+
+../conf.d/modpython.conf: ../conf.d/modpython.conf.in $(FIXCONFIG)
+ $(FIXCONFIG) ../conf.d/modpython.conf.in
+
+# Note that README is listed as a dependency to be generated, but it
+# is not currently installed anywhere
+install-exec-hook: ../conf.d/modpython.conf README
+ mkdir -p $(DESTDIR)/$(sysconfdir)/conf.d && \
+ $(INSTALL_DATA) ../conf.d/modpython.conf $(DESTDIR)/$(sysconfdir)/conf.d/modpython.conf
+
INCLUDES = @APR_INCLUDES@ @PYTHON_INCLUDES@
@@ -105,7 +105,7 @@ follows:
}
}
- include ('/etc/ganglia/conf.d/*.pyconf')
+ include ('@sysconfdir@/conf.d/*.pyconf')
The most significant part of this configuration is the 'params'
directive. The path that has been assigned to this directive will
View
@@ -0,0 +1,86 @@
+#! /bin/sh
+
+## $Id$
+##
+## Make variable substitutions in configuration files.
+##
+## This script does something very similar to what config.status does, but
+## it fully resolves the various path variables (prefix, exec_prefix, etc.)
+## so that they don't contain any variable substitutions. It's easier to
+## do this in a separate script than try to use eval or the like to resolve
+## the variable names inside configure, particularly since prefix and
+## exec_prefix aren't set until the end of the script.
+##
+## The original form of this script was taken from the INN project
+## which is under a BSD-style license
+##
+
+# The paths set by configure.
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+bindir="@bindir@"
+libexecdir="@libexecdir@"
+libdir="@libdir@"
+sbindir="@sbindir@"
+sysconfdir="@sysconfdir@"
+includedir="@includedir@"
+
+# Additional variables set by configure
+CFLAGS="@CFLAGS@"
+LDFLAGS="@LDFLAGS@"
+LIBS="@LIBS@"
+VERSION="@VERSION@"
+host_cpu="@host_cpu@"
+
+# Additional paths specific to Ganglia.
+moduledir="@moduledir@"
+varstatedir="@varstatedir@"
+
+# Additional variables that are substituted into configuration files.
+GANGLIA_MAJOR_VERSION="@GANGLIA_MAJOR_VERSION@"
+GANGLIA_MICRO_VERSION="@GANGLIA_MICRO_VERSION@"
+GANGLIA_MINOR_VERSION="@GANGLIA_MINOR_VERSION@"
+GANGLIA_VERSION="@GANGLIA_VERSION@"
+REL="@REL@"
+
+# We can probably just assume sed is on the path, but since we have it, we may
+# as well use it.
+SED="@SED@"
+
+input="$1"
+if [ -z "$input" ] ; then
+ echo "No input file specified" >&2
+ exit 1
+fi
+
+output="$2"
+if [ -z "$output" ] ; then
+ output=`echo "$input" | $SED -e 's/\.in$//'`
+fi
+if [ x"$input" = x"$output" ] ; then
+ echo "No output file specified and input file doesn't end in .in" >&2
+ exit 1
+fi
+
+$SED -e "s,@prefix[@],$prefix,g" \
+ -e "s,@exec_prefix[@],$exec_prefix,g" \
+ -e "s,@bindir[@],$bindir,g" \
+ -e "s,@libexecdir[@],$libexecdir,g" \
+ -e "s,@libdir[@],$libdir,g" \
+ -e "s,@sbindir[@],$sbindir,g" \
+ -e "s,@sysconfdir[@],$sysconfdir,g" \
+ -e "s,@includedir[@],$includedir,g" \
+ -e "s,@CFLAGS[@],$CFLAGS,g" \
+ -e "s,@LDFLAGS[@],$LDFLAGS,g" \
+ -e "s,@LIBS[@],$LIBS,g" \
+ -e "s,@VERSION[@],$VERSION,g" \
+ -e "s,@host_cpu[@],$host_cpu,g" \
+ -e "s,@moduledir[@],$moduledir,g" \
+ -e "s,@varstatedir[@],$varstatedir,g" \
+ -e "s,@GANGLIA_MAJOR_VERSION[@],$GANGLIA_MAJOR_VERSION,g" \
+ -e "s,@GANGLIA_MICRO_VERSION[@],$GANGLIA_MICRO_VERSION,g" \
+ -e "s,@GANGLIA_MINOR_VERSION[@],$GANGLIA_MINOR_VERSION,g" \
+ -e "s,@GANGLIA_VERSION[@],$GANGLIA_VERSION,g" \
+ -e "s,@REL[@],$REL,g" \
+ < "$input" > "$output"
+
View
@@ -1,4 +1,13 @@
-install:
+
+include $(top_srcdir)/ganglia.inc
+
+conf.php: conf.php.in $(FIXCONFIG)
+ $(FIXCONFIG) conf.php.in
+
+version.php: version.php.in $(FIXCONFIG)
+ $(FIXCONFIG) version.php.in
+
+install: conf.php version.php
@echo
@echo "================================================================================="
@echo " The PHP scripts are not installed by running 'make install'"

0 comments on commit 6e21604

Please sign in to comment.