1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-09 21:30:42 +00:00

Make readline check more portable

Currently, `configure.ac` assumes Readline is installed via Homebrew in
`/usr/local`. This doesn't work for Homebrew on Apple Silicon, or
MacPorts.

Let's fix this by checking for a `brew` installation, and querying that
for Readline's prefix if available. If not, it checks for an existing
MacPorts prefix, and finally falls back to checking `/usr/local` in case
a user installed Readline for themselves there.
This commit is contained in:
Carlo Cabrera 2021-11-23 21:57:02 +08:00
parent 9a9122c148
commit 315d862e22
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -210,10 +210,19 @@ AS_IF([test "x$enable_icons_and_clipboard" != xno],
[AC_MSG_NOTICE([gtk+-3.0/gtk+2.0 not found, icons and clipboard not enabled])])])])])
AS_IF([test "x$PLATFORM" = xosx],
[AC_CHECK_FILE([/usr/local/opt/readline/lib],
[AC_PATH_PROG([BREW], [brew], ["failed"],
[$PATH$PATH_SEPARATOR/opt/homebrew/bin$PATH_SEPARATOR/usr/local/bin])
AS_IF([test "x$BREW" = xfailed],
[AC_CHECK_FILE([/opt/local/lib],
[READLINE_PREFIX="/opt/local"],
[READLINE_PREFIX="/usr/local"])],
[READLINE_PREFIX="`$BREW --prefix readline`"])])
AS_IF([test "x$PLATFORM" = xosx],
[AC_CHECK_FILE([$READLINE_PREFIX/lib],
[LIBS="-lreadline $LIBS"
AM_CPPFLAGS="-I/usr/local/opt/readline/include $AM_CPPFLAGS"
AM_LDFLAGS="-L/usr/local/opt/readline/lib $AM_LDFLAGS"
AM_CPPFLAGS="-I$READLINE_PREFIX/include $AM_CPPFLAGS"
AM_LDFLAGS="-L$READLINE_PREFIX/lib $AM_LDFLAGS"
AC_SUBST(AM_LDFLAGS)],
[AC_MSG_ERROR([libreadline is required for profanity])])],