mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Pick default-terminal from the first of tmux-256color, tmux, screen-256color,
screen that is available on the build system.
This commit is contained in:
parent
bb4bc8caf4
commit
d723466df2
@ -13,7 +13,8 @@ dist_EXTRA_tmux_SOURCES = compat/*.[ch]
|
||||
# Preprocessor flags.
|
||||
AM_CPPFLAGS += @XOPEN_DEFINES@ \
|
||||
-DTMUX_VERSION='"@VERSION@"' \
|
||||
-DTMUX_CONF='"$(sysconfdir)/tmux.conf:~/.tmux.conf:$$XDG_CONFIG_HOME/tmux/tmux.conf:~/.config/tmux/tmux.conf"'
|
||||
-DTMUX_CONF='"$(sysconfdir)/tmux.conf:~/.tmux.conf:$$XDG_CONFIG_HOME/tmux/tmux.conf:~/.config/tmux/tmux.conf"' \
|
||||
-DTMUX_TERM='"@DEFAULT_TERM@"'
|
||||
|
||||
# Additional object files.
|
||||
LDADD = $(LIBOBJS)
|
||||
|
82
configure.ac
82
configure.ac
@ -74,6 +74,21 @@ if test "x$enable_static" = xyes; then
|
||||
LDFLAGS="$AM_LDFLAGS $SAVED_LDFLAGS"
|
||||
fi
|
||||
|
||||
# Allow default TERM to be set.
|
||||
AC_ARG_WITH(
|
||||
TERM,
|
||||
AC_HELP_STRING(--with-TERM, set default TERM),
|
||||
[DEFAULT_TERM=$withval],
|
||||
[DEFAULT_TERM=]
|
||||
)
|
||||
case "x$DEFAULT_TERM" in
|
||||
xscreen*|xtmux*|x)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR("unsuitable TERM (must be screen* or tmux*)")
|
||||
;;
|
||||
esac
|
||||
|
||||
# Do we need fuzzers?
|
||||
AM_CONDITIONAL(NEED_FUZZING, test "x$enable_fuzzing" = xyes)
|
||||
|
||||
@ -299,6 +314,7 @@ if test "x$found_ncurses" = xno; then
|
||||
fi
|
||||
fi
|
||||
if test "x$found_ncurses" = xyes; then
|
||||
CPPFLAGS="$CPPFLAGS -DHAVE_NCURSES_H"
|
||||
AC_DEFINE(HAVE_NCURSES_H)
|
||||
else
|
||||
AC_CHECK_LIB(
|
||||
@ -314,6 +330,7 @@ else
|
||||
)
|
||||
if test "x$found_curses" = xyes; then
|
||||
LIBS="$LIBS -lcurses"
|
||||
CPPFLAGS="$CPPFLAGS -DHAVE_CURSES_H"
|
||||
AC_DEFINE(HAVE_CURSES_H)
|
||||
else
|
||||
AC_MSG_ERROR("curses not found")
|
||||
@ -673,6 +690,71 @@ else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Try to figure out what the best value for TERM might be.
|
||||
if test "x$DEFAULT_TERM" = x; then
|
||||
DEFAULT_TERM=screen
|
||||
AC_MSG_CHECKING(TERM)
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE(
|
||||
[
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if defined(HAVE_CURSES_H)
|
||||
#include <curses.h>
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
#include <ncurses.h>
|
||||
#endif
|
||||
#include <term.h>
|
||||
int main(void) {
|
||||
if (setupterm("screen-256color", -1, NULL) != OK)
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
])],
|
||||
[DEFAULT_TERM=screen-256color],
|
||||
,
|
||||
)
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE(
|
||||
[
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if defined(HAVE_CURSES_H)
|
||||
#include <curses.h>
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
#include <ncurses.h>
|
||||
#endif
|
||||
#include <term.h>
|
||||
int main(void) {
|
||||
if (setupterm("tmux", -1, NULL) != OK)
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
])],
|
||||
[DEFAULT_TERM=tmux],
|
||||
,
|
||||
)
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE(
|
||||
[
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if defined(HAVE_CURSES_H)
|
||||
#include <curses.h>
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
#include <ncurses.h>
|
||||
#endif
|
||||
#include <term.h>
|
||||
int main(void) {
|
||||
if (setupterm("tmux-256color", -1, NULL) != OK)
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
])],
|
||||
[DEFAULT_TERM=tmux-256color],
|
||||
,
|
||||
)
|
||||
AC_MSG_RESULT($DEFAULT_TERM)
|
||||
fi
|
||||
AC_SUBST(DEFAULT_TERM)
|
||||
|
||||
# Man page defaults to mdoc.
|
||||
MANFORMAT=mdoc
|
||||
AC_SUBST(MANFORMAT)
|
||||
|
Loading…
Reference in New Issue
Block a user