]> code.delx.au - gnu-emacs/blobdiff - configure.ac
Port to GNU/Linux systems with tinfo but not ncurses.
[gnu-emacs] / configure.ac
index f0cee74169794a6eb41dc615ee5d56479e2507c5..f48822480e4607e2c45ca55c90cf6f3c4975582f 100644 (file)
@@ -2319,62 +2319,50 @@ if test "${with_ns}" = yes && test ${with_file_notification} = yes; then
   with_file_notification=no
 fi
 
-if test "${with_file_notification}" != "no"; then
-
-  dnl MS Windows native file monitor is available for mingw32 only.
-  if test "${with_file_notification}" = "w32" || \
-     ( test "${opsys}" = "mingw32" && \
-       test "${with_file_notification}" = "yes" ); then
-     AC_CHECK_HEADER(windows.h)
-     if test "$ac_cv_header_windows_h" = yes ; then
-        AC_DEFINE(HAVE_W32NOTIFY, 1, [Define to 1 to use w32notify.])
-        NOTIFY_OBJ=w32notify.o
-        NOTIFY_SUMMARY="yes (w32)"
-     elif test "${with_file_notification}" = "w32"; then
-       AC_MSG_ERROR([File notification `w32' requested but requirements not found.])
-     elif test "${opsys}" = "mingw32"; then
-       dnl Do not try any further.
-       with_file_notification=no
-     fi
-  fi
-  
-  dnl g_file_monitor exists since glib 2.18.  G_FILE_MONITOR_EVENT_MOVED
-  dnl has been added in glib 2.24.  It has been tested under
-  dnl GNU/Linux only.  We take precedence over inotify, but this makes
-  dnl only sense when glib has been compiled with inotify support.  How
-  dnl to check?
-  if test "${with_file_notification}" = "gfile" || \
-    test "${with_file_notification}" = "yes"; then
-     PKG_CHECK_MODULES(GFILENOTIFY, gio-2.0 >= 2.24, HAVE_GFILENOTIFY=yes, HAVE_GFILENOTIFY=no)
-     if test "$HAVE_GFILENOTIFY" = "yes"; then
-        AC_DEFINE(HAVE_GFILENOTIFY, 1, [Define to 1 if using GFile.])
-        NOTIFY_OBJ=gfilenotify.o
-        NOTIFY_SUMMARY="yes -lgio (gfile)"
-        with_file_notification=gfile
-     elif test "${with_file_notification}" = "gfile"; then
-        AC_MSG_ERROR([File notification `gfile' requested but requirements not found.])
-     fi
-  fi
+dnl MS Windows native file monitor is available for mingw32 only.
+case $with_file_notification,$opsys in
+  w32,* | yes,mingw32)
+    AC_CHECK_HEADER(windows.h)
+    if test "$ac_cv_header_windows_h" = yes ; then
+       AC_DEFINE(HAVE_W32NOTIFY, 1, [Define to 1 to use w32notify.])
+       NOTIFY_OBJ=w32notify.o
+       NOTIFY_SUMMARY="yes (w32)"
+    fi ;;
+esac
 
-  dnl inotify is only available on GNU/Linux.
-  if test "${with_file_notification}" = "inotify" || \
-    test "${with_file_notification}" = "yes"; then
-     AC_CHECK_HEADER(sys/inotify.h)
-     if test "$ac_cv_header_sys_inotify_h" = yes ; then
-         AC_CHECK_FUNC(inotify_init1)
-         if test "$ac_cv_func_inotify_init1" = yes; then
-             AC_DEFINE(HAVE_INOTIFY, 1, [Define to 1 to use inotify.])
-          NOTIFY_OBJ=inotify.o
-          NOTIFY_SUMMARY="yes -lglibc (inotify)"
-          with_file_notification=inotify
-        fi
-     fi
-     if test "${with_file_notification}" = "inotify" && \
-       test -z "${NOTIFY_OBJ}"; then
-        AC_MSG_ERROR([File notification `inotify' requested but requirements not found.])
-     fi
-  fi
-fi                              dnl ${with_file_notification} != no
+dnl g_file_monitor exists since glib 2.18.  G_FILE_MONITOR_EVENT_MOVED
+dnl has been added in glib 2.24.  It has been tested under
+dnl GNU/Linux only.  We take precedence over inotify, but this makes
+dnl only sense when glib has been compiled with inotify support.  How
+dnl to check?
+case $with_file_notification,$NOTIFY_OBJ in
+  gfile, | yes,)
+    PKG_CHECK_MODULES(GFILENOTIFY, gio-2.0 >= 2.24, HAVE_GFILENOTIFY=yes, HAVE_GFILENOTIFY=no)
+    if test "$HAVE_GFILENOTIFY" = "yes"; then
+       AC_DEFINE(HAVE_GFILENOTIFY, 1, [Define to 1 if using GFile.])
+       NOTIFY_OBJ=gfilenotify.o
+       NOTIFY_SUMMARY="yes -lgio (gfile)"
+    fi ;;
+esac
+
+dnl inotify is only available on GNU/Linux.
+case $with_file_notification,$NOTIFY_OBJ in
+  inotify, | yes,)
+    AC_CHECK_HEADER(sys/inotify.h)
+    if test "$ac_cv_header_sys_inotify_h" = yes ; then
+       AC_CHECK_FUNC(inotify_init1)
+       if test "$ac_cv_func_inotify_init1" = yes; then
+         AC_DEFINE(HAVE_INOTIFY, 1, [Define to 1 to use inotify.])
+         NOTIFY_OBJ=inotify.o
+         NOTIFY_SUMMARY="yes -lglibc (inotify)"
+       fi
+    fi ;;
+esac
+
+case $with_file_notification,$NOTIFY_OBJ in
+  yes,* | no,* | *,?*) ;;
+  *) AC_MSG_ERROR([File notification `$with_file_notification' requested but requirements not found.]) ;;
+esac
 
 if test -n "$NOTIFY_OBJ"; then
    AC_DEFINE(USE_FILE_NOTIFY, 1, [Define to 1 if using file notifications.])
@@ -3418,6 +3406,9 @@ if test $TERMINFO = yes; then
   AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.])
   TERMCAP_OBJ=terminfo.o
 fi
+if test "X$LIBS_TERMCAP" = "X-lncurses"; then
+  AC_DEFINE(USE_NCURSES, 1, [Define to 1 if you use ncurses.])
+fi
 AC_SUBST(LIBS_TERMCAP)
 AC_SUBST(TERMCAP_OBJ)
 
@@ -3950,7 +3941,7 @@ case $opsys in
       AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
       dnl Note that grantpt and unlockpt may fork.  We must block SIGCHLD
       dnl to prevent sigchld_handler from intercepting the child's death.
-      AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }])
+      AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
       dnl if HAVE_POSIX_OPENPT
       if test "x$ac_cv_func_posix_openpt" = xyes; then
         AC_DEFINE(PTY_OPEN, [fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY)])
@@ -3998,12 +3989,12 @@ case $opsys in
     dnl On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler()
     dnl from intercepting that death.  If any child but grantpt's should die
     dnl within, it should be caught after sigrelse(2).
-    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }])
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
     ;;
 
   unixware )
     dnl Comments are as per sol2*.
-    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal("could not grant slave pty"); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }])
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal("could not grant slave pty"); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
     ;;
 esac