Patchwork [3/3] configure: add --confsuffix option

login
register
mail settings
Submitter Eduardo Habkost
Date March 20, 2012, 8:15 p.m.
Message ID <1332274504-10437-4-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/147831/
State New
Headers show

Comments

Eduardo Habkost - March 20, 2012, 8:15 p.m.
This way we can choose a configuration file path different from
${sysconfdir}/PACKAGE.

This also changes the configure output to show the full configuration
dir path (including $confsuffix), instead of just $sysconfdir.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 configure |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Paolo Bonzini - March 21, 2012, 12:39 p.m.
Il 20/03/2012 21:15, Eduardo Habkost ha scritto:
> This way we can choose a configuration file path different from
> ${sysconfdir}/PACKAGE.
> 
> This also changes the configure output to show the full configuration
> dir path (including $confsuffix), instead of just $sysconfdir.

Can you please apply this to datadir too?  (i.e. set the datadir default
to just $prefix/share, and later add $confsuffix).

Paolo
Eduardo Habkost - March 21, 2012, 2:42 p.m.
On Wed, Mar 21, 2012 at 01:39:39PM +0100, Paolo Bonzini wrote:
> Il 20/03/2012 21:15, Eduardo Habkost ha scritto:
> > This way we can choose a configuration file path different from
> > ${sysconfdir}/PACKAGE.
> > 
> > This also changes the configure output to show the full configuration
> > dir path (including $confsuffix), instead of just $sysconfdir.
> 
> Can you please apply this to datadir too?  (i.e. set the datadir default
> to just $prefix/share, and later add $confsuffix).

I will do it, and send v3 of the series.

I guess we don't want to change the meaning of
'./configure --datadir=PATH' (that currently expects the full path), to
keep compatibility, right?


To make sure the expected semantics are clear:

This is straightforward:

./configure
  qemu data dir: /usr/share/qemu
  qemu conf dir: /etc/qemu


For this one, we would have compatibility issues to take care of:

./configure --datadir=FOO --sysconfdir=SYS
  qemu data dir: FOO
    (it would be better if it was FOO/qemu, but needed for compatibility)
  qemu conf dir: SYS/qemu


On the following cases, I don't know what would be the best behavior:

./configure --datadir=FOO --confsuffix=/BAR
  qemu data dir: FOO/BAR
   (maybe it should be just FOO, to keep the rules easier to understand?)
  qemu conf dir: /etc/BAR

./configure --datadir=FOO --confsuffix=/BAR --sysconfdir=SYS
  qemu data dir: FOO/BAR
   (maybe it should be just FOO, to keep the rules easier to understand?)
  qemu conf dir: SYS/BAR
Paolo Bonzini - March 21, 2012, 10:23 p.m.
Il 21/03/2012 15:42, Eduardo Habkost ha scritto:
> On Wed, Mar 21, 2012 at 01:39:39PM +0100, Paolo Bonzini wrote:
>> Il 20/03/2012 21:15, Eduardo Habkost ha scritto:
>>> This way we can choose a configuration file path different from
>>> ${sysconfdir}/PACKAGE.
>>>
>>> This also changes the configure output to show the full configuration
>>> dir path (including $confsuffix), instead of just $sysconfdir.
>>
>> Can you please apply this to datadir too?  (i.e. set the datadir default
>> to just $prefix/share, and later add $confsuffix).
> 
> I will do it, and send v3 of the series.
> 
> I guess we don't want to change the meaning of
> './configure --datadir=PATH' (that currently expects the full path), to
> keep compatibility, right?
> 
> 
> To make sure the expected semantics are clear:
> 
> This is straightforward:
> 
> ./configure
>   qemu data dir: /usr/share/qemu
>   qemu conf dir: /etc/qemu
> 
> 
> For this one, we would have compatibility issues to take care of:
> 
> ./configure --datadir=FOO --sysconfdir=SYS
>   qemu data dir: FOO
>     (it would be better if it was FOO/qemu, but needed for compatibility)
>   qemu conf dir: SYS/qemu

Hmm, perhaps we can break it...  I checked Fedora, Debian
(http://cdn.debian.net/debian/pool/main/q/qemu/qemu_1.0.1+dfsg-1.debian.tar.gz),
Arch Linux
(http://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/qemu),
Gentoo
(http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-emulation/qemu-kvm/qemu-kvm-0.15.1-r1.ebuild?view=markup),
FreeBSD
(http://www.freebsd.org/cgi/cvsweb.cgi/ports/emulators/qemu/Makefile?rev=1.122;content-type=text%2Fplain)
and none of them use it.

And since we are at it, let's call the option --with-confsuffix so it is
a bit more autoconfy.

Paolo
Eduardo Habkost - March 22, 2012, 12:54 p.m.
On Wed, Mar 21, 2012 at 11:23:00PM +0100, Paolo Bonzini wrote:
> Il 21/03/2012 15:42, Eduardo Habkost ha scritto:
> > For this one, we would have compatibility issues to take care of:
> > 
> > ./configure --datadir=FOO --sysconfdir=SYS
> >   qemu data dir: FOO
> >     (it would be better if it was FOO/qemu, but needed for compatibility)
> >   qemu conf dir: SYS/qemu
> 
> Hmm, perhaps we can break it...  I checked Fedora, Debian
> (http://cdn.debian.net/debian/pool/main/q/qemu/qemu_1.0.1+dfsg-1.debian.tar.gz),
> Arch Linux
> (http://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/qemu),
> Gentoo
> (http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-emulation/qemu-kvm/qemu-kvm-0.15.1-r1.ebuild?view=markup),
> FreeBSD
> (http://www.freebsd.org/cgi/cvsweb.cgi/ports/emulators/qemu/Makefile?rev=1.122;content-type=text%2Fplain)
> and none of them use it.
> 
> And since we are at it, let's call the option --with-confsuffix so it is
> a bit more autoconfy.

Excellent. I'll do it.

Patch

diff --git a/configure b/configure
index 8b4e3c1..1170466 100755
--- a/configure
+++ b/configure
@@ -595,6 +595,8 @@  for opt do
   ;;
   --sysconfdir=*) sysconfdir="$optarg"
   ;;
+  --confsuffix=*) confsuffix="$optarg"
+  ;;
   --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\
   --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
   --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
@@ -1010,7 +1012,8 @@  echo "  --mandir=PATH            install man pages in PATH"
 echo "  --datadir=PATH           install firmware in PATH"
 echo "  --docdir=PATH            install documentation in PATH"
 echo "  --bindir=PATH            install binaries in PATH"
-echo "  --sysconfdir=PATH        install config in PATH/qemu"
+echo "  --sysconfdir=PATH        install config in PATH$confsuffix"
+echo "  --confsuffix=SUFFIX      install config in \${sysconfdir}SUFFIX [$confsuffix]"
 echo "  --enable-debug-tcg       enable TCG debugging"
 echo "  --disable-debug-tcg      disable TCG debugging (default)"
 echo "  --enable-debug           enable common debug build options"
@@ -2869,7 +2872,7 @@  echo "BIOS directory    `eval echo $datadir`"
 echo "binary directory  `eval echo $bindir`"
 echo "library directory `eval echo $libdir`"
 echo "include directory `eval echo $includedir`"
-echo "config directory  `eval echo $sysconfdir`"
+echo "config directory  `eval echo $confdir`"
 if test "$mingw32" = "no" ; then
 echo "Manual directory  `eval echo $mandir`"
 echo "ELF interp prefix $interp_prefix"