+### Use Mac OS X Carbon API to implement GUI.
+HAVE_CARBON=no
+if test "${with_carbon}" != "no"; then
+ echo "$as_me:7645: checking for Carbon/Carbon.h" >&5
+echo $ECHO_N "checking for Carbon/Carbon.h... $ECHO_C" >&6
+if test "${ac_cv_header_Carbon_Carbon_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 7651 "configure"
+#include "confdefs.h"
+#include <Carbon/Carbon.h>
+_ACEOF
+if { (eval echo "$as_me:7655: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:7661: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_cv_header_Carbon_Carbon_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_header_Carbon_Carbon_h=no
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:7680: result: $ac_cv_header_Carbon_Carbon_h" >&5
+echo "${ECHO_T}$ac_cv_header_Carbon_Carbon_h" >&6
+if test $ac_cv_header_Carbon_Carbon_h = yes; then
+ HAVE_CARBON=yes
+fi
+
+fi
+
+if test "${HAVE_CARBON}" = "yes"; then
+
+cat >>confdefs.h <<\EOF
+#define HAVE_CARBON 1
+EOF
+
+fi
+
+### Use session management (-lSM -lICE) if available
+HAVE_X_SM=no
+if test "${HAVE_X11}" = "yes"; then
+ echo "$as_me:7699: checking for X11/SM/SMlib.h" >&5
+echo $ECHO_N "checking for X11/SM/SMlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_SM_SMlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 7705 "configure"
+#include "confdefs.h"
+#include <X11/SM/SMlib.h>
+_ACEOF
+if { (eval echo "$as_me:7709: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:7715: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_cv_header_X11_SM_SMlib_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_header_X11_SM_SMlib_h=no
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:7734: result: $ac_cv_header_X11_SM_SMlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_SM_SMlib_h" >&6
+if test $ac_cv_header_X11_SM_SMlib_h = yes; then
+ echo "$as_me:7737: checking for SmcOpenConnection in -lSM" >&5
+echo $ECHO_N "checking for SmcOpenConnection in -lSM... $ECHO_C" >&6
+if test "${ac_cv_lib_SM_SmcOpenConnection+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lSM $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 7745 "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char SmcOpenConnection ();
+int
+main ()
+{
+SmcOpenConnection ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:7764: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:7767: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:7770: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:7773: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_SM_SmcOpenConnection=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_SM_SmcOpenConnection=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:7784: result: $ac_cv_lib_SM_SmcOpenConnection" >&5
+echo "${ECHO_T}$ac_cv_lib_SM_SmcOpenConnection" >&6
+if test $ac_cv_lib_SM_SmcOpenConnection = yes; then
+ HAVE_X_SM=yes
+else
+ -lICE
+fi
+
+fi
+
+ if test "${HAVE_X_SM}" = "yes"; then
+
+cat >>confdefs.h <<\EOF
+#define HAVE_X_SM 1
+EOF
+
+ case "$LIBS" in
+ *-lSM*) ;;
+ *) LIBS="-lSM -lICE $LIBS" ;;
+ esac
+ fi
+fi
+