about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-11-24 00:36:09 +0100
committerGitHub <noreply@github.com>2021-11-24 00:36:09 +0100
commit6d2f929950c12c7e19b4315973164b44f9c52b8b (patch)
tree18bbd8e73ae4f3cd825c2d18fe2acf917b57fb4b
parent9a9122c148a8462eb612c7a28ab0f2e3f2f0464e (diff)
parent1194a9b85e29dc8d421e6a3a12760de0e7c8ac20 (diff)
downloadprofani-tty-6d2f929950c12c7e19b4315973164b44f9c52b8b.tar.gz
Merge pull request #1617 from carlocab/osx-configure
Make readline check more portable
-rw-r--r--configure.ac17
1 files changed, 13 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 566c3c80..4a6a8ba2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -210,12 +210,21 @@ 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:/opt/homebrew/bin:/usr/local/bin])
+        AS_IF([test "x$BREW" = xfailed],
+            [AC_CHECK_FILE([/opt/local/lib/libreadline.dylib],
+                [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/libreadline.dylib],
         [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])])],
+        [AC_MSG_ERROR([libreadline is required for profanity. Install it with Homebrew, MacPorts, or manually into /usr/local])])],
 
       [test "x$PLATFORM" = xopenbsd],
       [AC_CHECK_FILE([/usr/local/include/ereadline],