From c0842e6444aa96d16dade9e6e17bb9187ec21a74 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Wed, 14 Apr 2004 17:39:55 +0000 Subject: [PATCH] Install example config file by default if there isn't one already. --- Makefile.in | 2 +- configure | 17 +++++++++++++++-- configure.in | 7 +++++++ doc/Makefile.in | 29 +++++++++++++++++++++++++++++ make.tmpl.in | 1 + 5 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 doc/Makefile.in diff --git a/Makefile.in b/Makefile.in index 479d49214..4d9597b36 100644 --- a/Makefile.in +++ b/Makefile.in @@ -16,7 +16,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -SUBDIRS = include man +SUBDIRS = doc include man ifeq ("@INTL@", "yes") SUBDIRS += po diff --git a/configure b/configure index cba1df8ef..8aa7dab41 100755 --- a/configure +++ b/configure @@ -309,7 +309,7 @@ ac_includes_default="\ #endif" ac_default_prefix=/usr -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CPP EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os MSGFMT JOBS STATIC_LINK LVM1 OWNER GROUP CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LD_DEPS LD_FLAGS SOFLAG LVM_VERSION LVM1_FALLBACK DEBUG DEVMAPPER HAVE_LIBDL HAVE_SELINUX CMDLIB LOCALEDIR INTL_PACKAGE INTL LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CPP EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os MSGFMT JOBS STATIC_LINK LVM1 OWNER GROUP CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LD_DEPS LD_FLAGS SOFLAG LVM_VERSION LVM1_FALLBACK DEBUG DEVMAPPER HAVE_LIBDL HAVE_SELINUX CMDLIB LOCALEDIR CONFDIR INTL_PACKAGE INTL LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -865,6 +865,7 @@ Optional Packages: --with-lvm1=TYPE LVM1 metadata support: internal/shared/none TYPE=internal --with-localedir=DIR Translation files in DIR PREFIX/share/locale + --with-confdir=DIR Configuration files in DIR EXEC_PREFIX/etc Some influential environment variables: CC C compiler command @@ -5056,6 +5057,15 @@ else fi; fi + +# Check whether --with-confdir or --without-confdir was given. +if test "${with_confdir+set}" = set; then + withval="$with_confdir" + CONFDIR="$withval" +else + CONFDIR='${exec_prefix}/etc' +fi; + if test "-f VERSION"; then LVM_VERSION="\"`cat VERSION`\"" else @@ -5087,7 +5097,8 @@ fi - ac_config_files="$ac_config_files Makefile make.tmpl include/Makefile lib/Makefile lib/format1/Makefile man/Makefile po/Makefile tools/Makefile tools/version.h test/mm/Makefile test/device/Makefile test/format1/Makefile test/regex/Makefile test/filters/Makefile" + + ac_config_files="$ac_config_files Makefile make.tmpl doc/Makefile include/Makefile lib/Makefile lib/format1/Makefile man/Makefile po/Makefile tools/Makefile tools/version.h test/mm/Makefile test/device/Makefile test/format1/Makefile test/regex/Makefile test/filters/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -5640,6 +5651,7 @@ do # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "make.tmpl" ) CONFIG_FILES="$CONFIG_FILES make.tmpl" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "lib/format1/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/format1/Makefile" ;; @@ -5784,6 +5796,7 @@ s,@HAVE_LIBDL@,$HAVE_LIBDL,;t t s,@HAVE_SELINUX@,$HAVE_SELINUX,;t t s,@CMDLIB@,$CMDLIB,;t t s,@LOCALEDIR@,$LOCALEDIR,;t t +s,@CONFDIR@,$CONFDIR,;t t s,@INTL_PACKAGE@,$INTL_PACKAGE,;t t s,@INTL@,$INTL,;t t s,@LIBOBJS@,$LIBOBJS,;t t diff --git a/configure.in b/configure.in index 1897d9b8f..d31199dd9 100644 --- a/configure.in +++ b/configure.in @@ -258,6 +258,11 @@ if test x$INTL = xyes; then [ LOCALEDIR='${prefix}/share/locale' ]) fi +AC_ARG_WITH(confdir, + [ --with-confdir=DIR Configuration files in DIR [EXEC_PREFIX/etc]], + [ CONFDIR="$withval" ], + [ CONFDIR='${exec_prefix}/etc' ]) + if test "-f VERSION"; then LVM_VERSION="\"`cat VERSION`\"" else @@ -286,6 +291,7 @@ AC_SUBST(HAVE_SELINUX) AC_SUBST(CMDLIB) AC_SUBST(MSGFMT) AC_SUBST(LOCALEDIR) +AC_SUBST(CONFDIR) AC_SUBST(INTL_PACKAGE) AC_SUBST(INTL) @@ -294,6 +300,7 @@ dnl keep utility scripts running properly AC_OUTPUT( \ Makefile \ make.tmpl \ +doc/Makefile \ include/Makefile \ lib/Makefile \ lib/format1/Makefile \ diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 000000000..554f9eda6 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,29 @@ +# +# Copyright (C) 2004 Red Hat, Inc. All rights reserved. +# +# This file is part of the LVM2. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions +# of the GNU General Public License v.2. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +CONFSRC=example.conf +CONFDEST=lvm.conf + +include ../make.tmpl + +install: + @if [ ! -e $(confdir)/$(CONFDEST) ]; then \ + echo "Installing $(CONFSRC) as $(confdir)/$(CONFDEST)"; \ + @INSTALL@ -D -o $(OWNER) -g $(GROUP) -m 644 $(CONFSRC) \ + $(confdir)/$(CONFDEST); \ + fi + diff --git a/make.tmpl.in b/make.tmpl.in index 5e51ea83b..b87b3b91a 100644 --- a/make.tmpl.in +++ b/make.tmpl.in @@ -36,6 +36,7 @@ SOFLAG += @SOFLAG@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = $(DESTDIR)@bindir@ +confdir = $(DESTDIR)@CONFDIR@/lvm includedir = $(DESTDIR)@includedir@ libdir = $(DESTDIR)@libdir@ sbindir = $(DESTDIR)@sbindir@