Download raw body.
portable: configure.ac: honor HOMEBREW_PREFIX env variable
Hello list, I happen to own a Mac M1 for $DAYJOB. I tried to build got in there with no success, as configure uses some hardcoded paths in /usr/local that correspond to Homebrew packages. Somewhere along the path, Homebrew changed the default installation path from /usr/local to /opt/homebrew. Instead of trying to guess, given that Homebrew does recommend running `brew shellenv` in your shell rc file, check and use for the existence of HOMEBREW_PREFIX in the environment, and default to /usr/local if it's not the case. With this, I'm able to build and run got in my Mac M1. -Lucas diff --git a/configure.ac b/configure.ac index 554ab266..7a742348 100644 --- a/configure.ac +++ b/configure.ac @@ -228,16 +228,17 @@ AM_CONDITIONAL([HOST_NETBSD], [test "$PLATFORM" = "netbsd"]) AM_CONDITIONAL([HOST_DRAGONFLYBSD], [test "$PLATFORM" = "dragonflybsd"]) if test x"$PLATFORM" = "xdarwin"; then - if ! test -x "/usr/local/opt/bison/bin/bison"; then + : ${HOMEBREW_PREFIX:=/usr/local} + if ! test -x "$HOMEBREW_PREFIX/opt/bison/bin/bison"; then AC_MSG_ERROR("GNU Bison not found") fi # Override YACC here to point to the GNU version of bison. - export YACC="/usr/local/opt/bison/bin/bison -y" - export LDFLAGS="-L/usr/local/opt/ncurses/lib -L/usr/local/opt/openssl@3/lib $LDFLAGS" - export CPPFLAGS="-I/usr/local/opt/ncurses/include -I/usr/local/opt/openssl@3/include $CPPFLAGS" - export PKG_CONFIG_PATH="/usr/local/opt/ncurses/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openssl@3/lib/pkgconfig" + export YACC="$HOMEBREW_PREFIX/opt/bison/bin/bison -y" + export LDFLAGS="-L$HOMEBREW_PREFIX/opt/ncurses/lib -L$HOMEBREW_PREFIX/opt/openssl@3/lib $LDFLAGS" + export CPPFLAGS="-I$HOMEBREW_PREFIX/opt/ncurses/include -I$HOMEBREW_PREFIX/opt/openssl@3/include $CPPFLAGS" + export PKG_CONFIG_PATH="$HOMEBREW_PREFIX/opt/ncurses/lib/pkgconfig" + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$HOMEBREW_PREFIX/opt/openssl@3/lib/pkgconfig" fi # Landlock detection.
portable: configure.ac: honor HOMEBREW_PREFIX env variable