]> The Tcpdump Group git mirrors - tcpdump/commit
Autoconf: Fix --with-user and --with-chroot. [skip appveyor]
authorDenis Ovsienko <[email protected]>
Sat, 11 Feb 2023 22:17:33 +0000 (22:17 +0000)
committerDenis Ovsienko <[email protected]>
Sat, 11 Feb 2023 22:17:33 +0000 (22:17 +0000)
commit3aa65743dde584106c3b5b13a67ae45bcfd7c16c
tree53d357b5a7c6d93cd722378c62d5bafc46a2c3ec
parent7ae7fa15f805bae9b15d7dc9c011fc02a4d3ddbb
Autoconf: Fix --with-user and --with-chroot. [skip appveyor]

Refine two blocks in configure.ac such that each option correctly
handles both of the Autoconf-supplied values ("yes" and "no") and, when
the option is properly enabled, the message is easier to understand.
See also commit 9aca99a.  While at it, use $withval more to unify the
code and squelch the following warnings from Autoconf 2.71:

configure.ac:188: warning: back quotes and double quotes must not be
  escaped in: $as_me:${as_lineno-$LINENO}: result: to \"$withval\"
configure.ac:188: warning: back quotes and double quotes must not be
  escaped in: to \"$withval\"
configure.ac:198: warning: back quotes and double quotes must not be
  escaped in: $as_me:${as_lineno-$LINENO}: result: to \"$withval\"
configure.ac:198: warning: back quotes and double quotes must not be
  escaped in: to \"$withval\"

User experience before:

./configure
checking whether to drop root privileges by default... no
checking whether to chroot... no

./configure --with-user=someuser --with-chroot=/some/dir/
checking whether to drop root privileges by default... to "someuser"
checking whether to chroot... to "/some/dir/"

./configure --without-user --without-chroot
checking whether to drop root privileges by default... to "no"
checking whether to chroot... no

./configure --with-user
checking whether to drop root privileges by default... to "yes"

./configure --with-chroot
checking whether to chroot... to "yes"

User experience after:

./configure
checking whether to drop root privileges by default... no
checking whether to chroot... no

./configure --with-user=someuser --with-chroot=/some/dir/
checking whether to drop root privileges by default... yes, to user
  "someuser"
checking whether to chroot... yes, to directory "/some/dir/"

./configure --without-user --without-chroot
checking whether to drop root privileges by default... no
checking whether to chroot... no

./configure --with-user
configure: error: --with-user requires a username

./configure --with-chroot
configure: error: --with-chroot requires a directory
configure.ac