--- configure.ac.orig	2014-02-21 05:24:30.000000000 -0800
+++ configure.ac	2014-03-28 08:44:04.000000000 -0700
@@ -504,6 +504,7 @@
 AC_CHECK_LIB(pam, pam_syslog, [AC_DEFINE(HAVE_PAM_SYSLOG, [], [Define to 1 if you have the pam_syslog function])])
 
 dnl test whether struct pam_message is const (Linux) or not (Sun)
+ac_pam_includes="/usr/include"
 if test "x$have_pam" = "xyes"; then
    pam_appl_h="$ac_pam_includes/security/pam_appl.h"
    AC_MSG_CHECKING(for const pam_message)
@@ -1239,7 +1240,17 @@
 # and /usr/X11 since they often symlink to each other, and configure
 # should use the more stable location (the real directory) if possible.
 #
-if test -x /usr/X11/bin/Xserver; then
+if test -x @MP_PREFIX@/bin/Xquartz; then
+   X_PATH="@MP_PREFIX@/bin"
+   X_SERVER_PATH="@MP_PREFIX@/bin"
+   X_SERVER="@MP_PREFIX@/bin/Xquartz"
+   X_CONFIG_OPTIONS="-audit 0"
+elif test -x /opt/X11/bin/Xquartz; then
+   X_PATH="/opt/X11/bin"
+   X_SERVER_PATH="/opt/X11/bin"
+   X_SERVER="/opt/X11/bin/Xquartz"
+   X_CONFIG_OPTIONS="-audit 0"
+elif test -x /usr/X11/bin/Xserver; then
    X_PATH="/usr/X11/bin"
    X_SERVER_PATH="/usr/X11/bin"
    X_SERVER="/usr/X11/bin/Xserver"
