about summary refs log tree commit diff stats
path: root/configure.ac
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-03-05 00:11:50 +0000
committerJames Booth <boothj5@gmail.com>2014-03-05 00:11:50 +0000
commitd68c5941503e7bbc1a6dbaf56a5ad83d1c9ba744 (patch)
tree58ce397a861946f0a8f3c4075a7f509a7e9dcd7b /configure.ac
parent4d00f788e90d5b0b76a51f21e2d8d87675046066 (diff)
parentb5171cb054c9d9f4efb2ddb69c41a922b14f0aab (diff)
downloadprofani-tty-d68c5941503e7bbc1a6dbaf56a5ad83d1c9ba744.tar.gz
Merge branch 'osx-notify'
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac37
1 files changed, 30 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index b282ee42..fb6698ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,13 @@ AC_PROG_CC
 
 ### Get canonical host
 AC_CANONICAL_HOST
-AS_IF([test "x$host_os" = xcygwin],
+PLATFORM="unknown"
+AS_CASE([$host_os],
+    [darwin*], [PLATFORM="osx"],
+    [cygwin], [PLATFORM="cygwin"],
+    [PLATFORM="nix"])
+
+AS_IF([test "x$PLATFORM" = xcygwin],
     [AC_DEFINE([PLATFORM_CYGWIN], [1], [Cygwin])])
 
 ### Options
@@ -111,12 +117,28 @@ PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.26], [],
     [AC_MSG_ERROR([glib 2.26 or higher is required for profanity])])
 PKG_CHECK_MODULES([curl], [libcurl], [],
     [AC_MSG_ERROR([libcurl is required for profanity])])
-AS_IF([test "x$enable_notifications" != xno],
-    [PKG_CHECK_MODULES([libnotify], [libnotify],
-        [AC_DEFINE([HAVE_LIBNOTIFY], [1], [libnotify module])],
-        [AS_IF([test "x$enable_notifications" = xyes],
-            [AC_MSG_ERROR([libnotify is required but does not exist])],
-            [AC_MSG_NOTICE([libnotify support will be disabled])])])])
+
+### Check for desktop notification support
+### Linux requires libnotify
+### Windows uses native OS calls
+### OSX requires terminal-notifier
+
+AS_IF([test "x$PLATFORM" = xosx],
+        [AS_IF([test "x$enable_notifications" != xno],
+            [NOTIFIER_PATH="no"
+            AC_PATH_PROG(NOTIFIER_PATH, terminal-notifier, no)
+            AS_IF([test "x$NOTIFIER_PATH" = xno],
+                [AS_IF([test "x$enable_notifications" = xyes],
+                    [AC_MSG_ERROR([terminal-notifier not found, required for desktop notifications.])],
+                    [AC_MSG_NOTICE([Desktop notifications not supported.])])],
+                [AC_DEFINE([HAVE_OSXNOTIFY], [1], [terminal notifier])])])],
+    [test "x$PLATFORM" = xnix],
+        [AS_IF([test "x$enable_notifications" != xno],
+            [PKG_CHECK_MODULES([libnotify], [libnotify],
+                [AC_DEFINE([HAVE_LIBNOTIFY], [1], [libnotify module])],
+                [AS_IF([test "x$enable_notifications" = xyes],
+                    [AC_MSG_ERROR([libnotify is required but does not exist])],
+                    [AC_MSG_NOTICE([libnotify support will be disabled])])])])])
 
 # TODO: rewrite this
 if test "x$with_xscreensaver" = xyes; then
@@ -193,6 +215,7 @@ AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 
 echo ""
+echo "PLATFORM       : $host_os"
 echo "PACKAGE_STATUS : $PACKAGE_STATUS"
 echo "AM_CFLAGS      : $AM_CFLAGS"
 echo "AM_CPPFLAGS    : $AM_CPPFLAGS"