Patchwork [1/3] Support --sysconfdir in configure to specify path to configuration files (v2)

login
register
mail settings
Submitter Anthony Liguori
Date Jan. 22, 2010, 4:09 p.m.
Message ID <1264176542-5316-2-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/43495/
State New
Headers show

Comments

Anthony Liguori - Jan. 22, 2010, 4:09 p.m.
The default value is ${prefix}/etc/qemu.  --sysconfdir can be used to override
the default to an absolute path.  The expectation is that when installed to
/usr, --sysconfdir=/etc/qemu will be used.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - rename to sysconf
---
 configure |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
Paolo Bonzini - Jan. 22, 2010, 4:32 p.m.
On 01/22/2010 05:09 PM, Anthony Liguori wrote:
> The default value is ${prefix}/etc/qemu.  --sysconfdir can be used to override
> the default to an absolute path.  The expectation is that when installed to
> /usr, --sysconfdir=/etc/qemu will be used.

Sorry for not being precise; --sysconfdir in Autoconf is just ${prefix}/etc.

Paolo
Anthony Liguori - Jan. 22, 2010, 4:59 p.m.
On 01/22/2010 10:32 AM, Paolo Bonzini wrote:
> On 01/22/2010 05:09 PM, Anthony Liguori wrote:
>> The default value is ${prefix}/etc/qemu.  --sysconfdir can be used to 
>> override
>> the default to an absolute path.  The expectation is that when 
>> installed to
>> /usr, --sysconfdir=/etc/qemu will be used.
>
> Sorry for not being precise; --sysconfdir in Autoconf is just 
> ${prefix}/etc.

That's tough for us because on Windows, we store everything in a single 
directory.  That is, ${sysconfdir}/qemu wouldn't be a good base for us.  
We would need to have sysconfdir and then a confdir that we could make 
different for win32.

Regards,

Anthony Liguori

> Paolo
Paolo Bonzini - Jan. 22, 2010, 5 p.m.
> That's tough for us because on Windows, we store everything in a single
> directory. That is, ${sysconfdir}/qemu wouldn't be a good base for us.
> We would need to have sysconfdir and then a confdir that we could make
> different for win32.

That makes sense.  sysconf for system, conf for qemu.

Paolo

Patch

diff --git a/configure b/configure
index 5631bbb..7f8c636 100755
--- a/configure
+++ b/configure
@@ -32,6 +32,7 @@  cpu=""
 prefix=""
 interp_prefix="/usr/gnemul/qemu-%M"
 static="no"
+sysconfdir=""
 sparc_cpu=""
 cross_prefix=""
 cc="gcc"
@@ -453,6 +454,8 @@  for opt do
   ;;
   --static) static="yes"
   ;;
+  --sysconfdir) sysconfdir="$optarg"
+  ;;
   --disable-sdl) sdl="no"
   ;;
   --enable-sdl) sdl="yes"
@@ -686,6 +689,7 @@  echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
 echo "  --make=MAKE              use specified make [$make]"
 echo "  --install=INSTALL        use specified install [$install]"
 echo "  --static                 enable static build [$static]"
+echo "  --sysconfdir=PATH        install config in PATH"
 echo "  --enable-debug-tcg       enable TCG debugging"
 echo "  --disable-debug-tcg      disable TCG debugging (default)"
 echo "  --enable-debug           enable common debug build options"
@@ -1828,6 +1832,7 @@  if test "$mingw32" = "yes" ; then
   fi
   mansuffix=""
   datasuffix=""
+  confsuffix=""
   docsuffix=""
   binsuffix=""
 else
@@ -1838,6 +1843,9 @@  else
   datasuffix="/share/qemu"
   docsuffix="/share/doc/qemu"
   binsuffix="/bin"
+  if test -z "$sysconfdir" ; then
+      sysconfdir="${prefix}/etc/qemu"
+  fi
 fi
 
 echo "Install prefix    $prefix"
@@ -1914,6 +1922,7 @@  printf " '%s'" "$0" "$@" >> $config_host_mak
 echo >> $config_host_mak
 
 echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
+echo "CONFIG_QEMU_SYSCONFDIR=\"$sysconfdir\"" >> $config_host_mak
 
 case "$cpu" in
   i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
@@ -2159,6 +2168,7 @@  echo "prefix=$prefix" >> $config_host_mak
 echo "bindir=\${prefix}$binsuffix" >> $config_host_mak
 echo "mandir=\${prefix}$mansuffix" >> $config_host_mak
 echo "datadir=\${prefix}$datasuffix" >> $config_host_mak
+echo "sysconfdir=$sysconfdir" >> $config_host_mak
 echo "docdir=\${prefix}$docsuffix" >> $config_host_mak
 echo "MAKE=$make" >> $config_host_mak
 echo "INSTALL=$install" >> $config_host_mak