Skip to content

Commit a4642fa

Browse files
committed
configure: replace AC_PATH_PROG to AC_CHECK_PROG
Bitcoin Core's `configure` script uses `AC_CHECK_PROG` to find brew in the `PATH` [1]. If found, this macro will set `BREW=brew`. When building with dependencies however the `BREW` variable is set to `no` on macOS via `depends/<host_prefix>/share/config.site` [2] and this overrides `AC_CHECK_PROG` results [3]. Ideally, secp256k1's `configure` script should follow the same logic but this is not what happens because secp256k1's `configure` uses `AC_PATH_PROG` instead which respects preset variable values (in this case for variable `BREW`) only if they are a valid path (i.e., they match `[\\/*] | ?:[\\/]*` [4]), and `no` is not a path. This commit changes `AC_PATH_PROG` to `AC_CHECK_PROG` to be consistent with Core's `AC_CHECK_PROG`. Both of these macros are supposed to find executables in the `PATH` but the difference is that former is supposed to return the full path whereas the latter is supposed to find only the program. As a result, the latter will accept even non-paths `no` as an override. Not knowing the full path is not an issue for the `configure` script because it will only execute `BREW` immediately afterwards, which works fine without the full path. (In particular, `PATH` cannot have changed in between [5].) [1] https://github.com/bitcoin/bitcoin/blob/master/configure.ac#L684 [2] https://github.com/bitcoin/bitcoin/blob/master/depends/config.site.in#L73-L76 [3] https://github.com/autotools-mirror/autoconf/blob/6d38e9fa2b39b3c3a8e4d6d7da38c59909d3f39d/lib/autoconf/programs.m4#L47 [4] https://github.com/autotools-mirror/autoconf/blob/6d38e9fa2b39b3c3a8e4d6d7da38c59909d3f39d/lib/autoconf/programs.m4#L127 [5] [3ab1178](3ab1178)
1 parent 1758a92 commit a4642fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

configure.ac

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ AM_PROG_AS
4242
case $host_os in
4343
*darwin*)
4444
if test x$cross_compiling != xyes; then
45-
AC_PATH_PROG([BREW],brew,)
46-
if test x$BREW != x; then
45+
AC_CHECK_PROG([BREW], brew, brew)
46+
if test x$BREW = xbrew; then
4747
# These Homebrew packages may be keg-only, meaning that they won't be found
4848
# in expected paths because they may conflict with system files. Ask
4949
# Homebrew where each one is located, then adjust paths accordingly.
@@ -58,10 +58,10 @@ case $host_os in
5858
VALGRIND_CPPFLAGS="-I$valgrind_prefix/include"
5959
fi
6060
else
61-
AC_PATH_PROG([PORT],port,)
61+
AC_CHECK_PROG([PORT], port, port)
6262
# If homebrew isn't installed and macports is, add the macports default paths
6363
# as a last resort.
64-
if test x$PORT != x; then
64+
if test x$PORT = xport; then
6565
CPPFLAGS="$CPPFLAGS -isystem /opt/local/include"
6666
LDFLAGS="$LDFLAGS -L/opt/local/lib"
6767
fi

0 commit comments

Comments
 (0)