[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #14350 [Tor]: configure.ac: fix disabling systemd notification support
#14350: configure.ac: fix disabling systemd notification support
--------------------------+--------------------------------
Reporter: blueness | Owner:
Type: defect | Status: needs_review
Priority: normal | Milestone: Tor: 0.2.6.x-final
Component: Tor | Version:
Resolution: | Keywords:
Actual Points: | Parent ID:
Points: |
--------------------------+--------------------------------
Comment (by blueness):
Okay a couple of points about how autoconf works.
AC_ARG_ENABLE(systemd ...) automatically sets $enable_systemd to "yes" if
--enable-systemd is passed, to "no" if --disable-systemd is given and to
"foo" if -enable-systemd="foo" is given. Its equal to "" if niether
--enable-systemd nor --disable-systemd are given. So the code is
inconsistent but works int that it uses $systemd in one palce and
$enable_systemd in another. I can make that consistant.
You should never use $enableval becuase it is not reset between instances
of AC_ARG_ENABLE(). However, in this case it works because you are uisng
it in the 3rd parameter which is only run because you gave
--{enable,disable}-systemd. So its net effect is to set shadow variable
$systemd to true or false and make sure soemone didn't pass something like
--enable-systemd="silly".
Convince yourself of how AC_ARG_ENABLE() works by playing with
AC_PREREQ([2.69])
AC_INIT([x],[1],[])
AC_ARG_ENABLE(a, [],
[case "${enableval}" inyes) echo "a true" ;;no) echo "a false" ;;*)
echo "a bad" ;;esac], [a=true])
echo "enableval="${enableval}
echo "enable_a="${enable_a}
AC_ARG_ENABLE(b, [],
[case "${enableval}" inyes) echo "b true" ;;no) echo "b false" ;;*)
echo "b bad" ;;esac], [b=true])
echo "enableval="${enableval}"
echo "enable_b="${enable_b}"
AC_OUTPUT
Try running it with `./configure --enable-a` and you'll see the second
echo of ${enableval} is yes because it was never reset.
Looking at the whole configure.a, there are a few places you make use of
these shadowing variables like $systemd and $enable_system probably
because whoever wrote that isn't aware of what AC_ARG_ENABLE() does behind
the scenes. If you want, I can clean that up, but I try not to be too
intrusive in how upstream likes to do things.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/14350#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs