tmux/configure.ac

1025 lines
22 KiB
Plaintext
Raw Normal View History

2015-09-14 14:59:21 +00:00
# configure.ac
2024-09-27 07:58:00 +00:00
AC_INIT([tmux], next-3.6)
AC_PREREQ([2.60])
Support use as a Windows program outside of Cygwin If `getenv("SHELL")` is `NULL`, use the function `win32_setenv_shell()` added to `osdep-win32-cpp.cpp` to set it using the command line of the parent process, which is retrieved using WMI WIN32 API. This is a C++ file because the OLE/WMI API is only available for C++. Adjust the autotools code to add this file and link the necessary Windows DLLs. Include some fixed/missing MINGW headers necessary to compile this file. This will be fixed in the relevant places and they will be removed. Add a new macro WIN32_PLATFORM for Windows specific functionality, currently Cygwin and MSYS2, in the future for the native port as well. When spawning commands using the shell, check for cmd.exe on Windows and use the `/c` switch, otherwise use `-c` which works for PowerShell, MSYS2, Cygwin and Git Bash etc.. Adjust code that uses `/tmp/` to use `$env:USERPROFILE/AppData/Local/Temp/` outside of a Cygwin virtual filesystem when `/tmp/` is not available, add the function `win32_get_tmpdir()` and related functions to `osdep-win32.c` for this. Use `getenv("USERPROFILE")` when `getenv("HOME")` is `NULL`. When outside of a Cygwin virtual filesystem, use `C:\ProgramData\tmux\tmux.conf:$USERPROFILE\.tmux.conf:$LOCALAPPDATA\tmux\tmux.conf` as the config search order. Use the ncurses term-driver with `TERM="#win32con"` when a terminfo database is not available. This will require patches to ncurses as well as MSYS2 and Cygwin to work. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-08-24 05:44:45 +00:00
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_CONFIG_AUX_DIR(etc)
2017-03-22 19:22:32 +00:00
AC_CONFIG_LIBOBJ_DIR(compat)
AM_INIT_AUTOMAKE([foreign subdir-objects])
# When CFLAGS isn't set at this stage and gcc is detected by the macro below,
# autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
# empty default.
: ${CFLAGS=""}
# Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
# AC_CHECK_HEADER doesn't give us any other way to update the include
# paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
SAVED_CFLAGS="$CFLAGS"
SAVED_CPPFLAGS="$CPPFLAGS"
SAVED_LDFLAGS="$LDFLAGS"
# Is this oss-fuzz build?
AC_ARG_ENABLE(
fuzzing,
AS_HELP_STRING(--enable-fuzzing, build fuzzers)
)
AC_ARG_VAR(
FUZZING_LIBS,
AS_HELP_STRING(libraries to link fuzzing targets with)
)
# Set up convenient fuzzing defaults before initializing compiler.
if test "x$enable_fuzzing" = xyes; then
AC_DEFINE(NEED_FUZZING)
2021-04-18 07:48:03 +00:00
test "x$CC" = x && CC=clang
test "x$FUZZING_LIBS" = x && \
FUZZING_LIBS="-fsanitize=fuzzer"
2021-04-18 07:48:03 +00:00
test "x$SAVED_CFLAGS" = x && \
AM_CFLAGS="-g -fsanitize=fuzzer-no-link,address"
fi
Support use as a Windows program outside of Cygwin If `getenv("SHELL")` is `NULL`, use the function `win32_setenv_shell()` added to `osdep-win32-cpp.cpp` to set it using the command line of the parent process, which is retrieved using WMI WIN32 API. This is a C++ file because the OLE/WMI API is only available for C++. Adjust the autotools code to add this file and link the necessary Windows DLLs. Include some fixed/missing MINGW headers necessary to compile this file. This will be fixed in the relevant places and they will be removed. Add a new macro WIN32_PLATFORM for Windows specific functionality, currently Cygwin and MSYS2, in the future for the native port as well. When spawning commands using the shell, check for cmd.exe on Windows and use the `/c` switch, otherwise use `-c` which works for PowerShell, MSYS2, Cygwin and Git Bash etc.. Adjust code that uses `/tmp/` to use `$env:USERPROFILE/AppData/Local/Temp/` outside of a Cygwin virtual filesystem when `/tmp/` is not available, add the function `win32_get_tmpdir()` and related functions to `osdep-win32.c` for this. Use `getenv("USERPROFILE")` when `getenv("HOME")` is `NULL`. When outside of a Cygwin virtual filesystem, use `C:\ProgramData\tmux\tmux.conf:$USERPROFILE\.tmux.conf:$LOCALAPPDATA\tmux\tmux.conf` as the config search order. Use the ncurses term-driver with `TERM="#win32con"` when a terminfo database is not available. This will require patches to ncurses as well as MSYS2 and Cygwin to work. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-08-24 05:44:45 +00:00
AC_ARG_ENABLE(
utf8proc,
AS_HELP_STRING(--enable-utf8proc, use utf8proc if it is installed)
)
# Figure out the platform.
AC_MSG_CHECKING(platform)
case "$target_os" in
*aix*)
AC_MSG_RESULT(aix)
PLATFORM=aix
;;
*darwin*)
AC_MSG_RESULT(darwin)
PLATFORM=darwin
#
# macOS uses __dead2 instead of __dead, like FreeBSD. But it defines
# __dead away so it needs to be removed before we can replace it.
#
AC_DEFINE(BROKEN___DEAD)
#
# macOS CMSG_FIRSTHDR is broken, so redefine it with a working one.
# daemon works but has some stupid side effects, so use our internal
# version which has a workaround.
#
AC_DEFINE(BROKEN_CMSG_FIRSTHDR)
AC_LIBOBJ(daemon)
AC_LIBOBJ(daemon-darwin)
#
# macOS wcwidth(3) is bad, so complain and suggest using utf8proc
# instead.
#
if test "x$enable_utf8proc" = x; then
AC_MSG_NOTICE([])
AC_MSG_NOTICE([ macOS library support for Unicode is very poor,])
AC_MSG_NOTICE([ particularly for complex codepoints like emojis;])
AC_MSG_NOTICE([ to use these correctly, configuring with])
AC_MSG_NOTICE([ --enable-utf8proc is recommended. To build])
AC_MSG_NOTICE([ without anyway, use --disable-utf8proc])
AC_MSG_NOTICE([])
AC_MSG_ERROR([must give --enable-utf8proc or --disable-utf8proc])
fi
;;
*dragonfly*)
AC_MSG_RESULT(dragonfly)
PLATFORM=dragonfly
;;
*linux*)
AC_MSG_RESULT(linux)
PLATFORM=linux
;;
*freebsd*)
AC_MSG_RESULT(freebsd)
PLATFORM=freebsd
;;
*netbsd*)
AC_MSG_RESULT(netbsd)
PLATFORM=netbsd
;;
*openbsd*)
AC_MSG_RESULT(openbsd)
PLATFORM=openbsd
;;
*sunos*)
AC_MSG_RESULT(sunos)
PLATFORM=sunos
;;
*solaris*)
AC_MSG_RESULT(sunos)
PLATFORM=sunos
case `/usr/bin/nroff --version 2>&1` in
*GNU*)
# Solaris 11.4 and later use GNU groff.
MANFORMAT=mdoc
;;
*)
if test `uname -o 2>/dev/null` = illumos; then
# Illumos uses mandoc.
MANFORMAT=mdoc
else
# Solaris 2.0 to 11.3 use AT&T nroff.
MANFORMAT=man
fi
;;
esac
;;
*hpux*)
AC_MSG_RESULT(hpux)
PLATFORM=hpux
;;
*cygwin*|*msys*)
AC_MSG_RESULT(cygwin)
PLATFORM=cygwin
TARGET_WIN32=yes
AC_DEFINE(TARGET_WIN32)
AM_CONDITIONAL(TARGET_WIN32, test "x$TARGET_WIN32" = xyes)
;;
*haiku*)
AC_MSG_RESULT(haiku)
PLATFORM=haiku
;;
*)
AC_MSG_RESULT(unknown)
PLATFORM=unknown
;;
esac
AC_SUBST(PLATFORM)
AM_CONDITIONAL(IS_AIX, test "x$PLATFORM" = xaix)
AM_CONDITIONAL(IS_DARWIN, test "x$PLATFORM" = xdarwin)
AM_CONDITIONAL(IS_DRAGONFLY, test "x$PLATFORM" = xdragonfly)
AM_CONDITIONAL(IS_LINUX, test "x$PLATFORM" = xlinux)
AM_CONDITIONAL(IS_FREEBSD, test "x$PLATFORM" = xfreebsd)
AM_CONDITIONAL(IS_NETBSD, test "x$PLATFORM" = xnetbsd)
AM_CONDITIONAL(IS_OPENBSD, test "x$PLATFORM" = xopenbsd)
AM_CONDITIONAL(IS_SUNOS, test "x$PLATFORM" = xsunos)
AM_CONDITIONAL(IS_HPUX, test "x$PLATFORM" = xhpux)
AM_CONDITIONAL(IS_CYGWIN, test "x$PLATFORM" = xcygwin)
AM_CONDITIONAL(IS_HAIKU, test "x$PLATFORM" = xhaiku)
AM_CONDITIONAL(IS_UNKNOWN, test "x$PLATFORM" = xunknown)
# Set up the compiler in two different ways and say yes we may want to install.
2023-09-07 17:24:28 +00:00
m4_version_prereq(2.70, [AC_PROG_CC], [AC_PROG_CC_C99])
Support use as a Windows program outside of Cygwin If `getenv("SHELL")` is `NULL`, use the function `win32_setenv_shell()` added to `osdep-win32-cpp.cpp` to set it using the command line of the parent process, which is retrieved using WMI WIN32 API. This is a C++ file because the OLE/WMI API is only available for C++. Adjust the autotools code to add this file and link the necessary Windows DLLs. Include some fixed/missing MINGW headers necessary to compile this file. This will be fixed in the relevant places and they will be removed. Add a new macro WIN32_PLATFORM for Windows specific functionality, currently Cygwin and MSYS2, in the future for the native port as well. When spawning commands using the shell, check for cmd.exe on Windows and use the `/c` switch, otherwise use `-c` which works for PowerShell, MSYS2, Cygwin and Git Bash etc.. Adjust code that uses `/tmp/` to use `$env:USERPROFILE/AppData/Local/Temp/` outside of a Cygwin virtual filesystem when `/tmp/` is not available, add the function `win32_get_tmpdir()` and related functions to `osdep-win32.c` for this. Use `getenv("USERPROFILE")` when `getenv("HOME")` is `NULL`. When outside of a Cygwin virtual filesystem, use `C:\ProgramData\tmux\tmux.conf:$USERPROFILE\.tmux.conf:$LOCALAPPDATA\tmux\tmux.conf` as the config search order. Use the ncurses term-driver with `TERM="#win32con"` when a terminfo database is not available. This will require patches to ncurses as well as MSYS2 and Cygwin to work. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-08-24 05:44:45 +00:00
if test "x$TARGET_WIN32" = xyes; then
AC_PROG_CXX
CFLAGS="$CFLAGS -isystem $(dirname $(readlink -f $0))/third_party/mingw_headers"
CXXFLAGS="$CXXFLAGS -std=c++17 -isystem $(dirname $(readlink -f $0))/third_party/mingw_headers -O2 -fpermissive -Wno-write-strings -Wno-class-conversion"
fi
AC_PROG_CPP
AC_PROG_EGREP
AC_PROG_INSTALL
2019-05-23 12:04:41 +00:00
AC_PROG_YACC
PKG_PROG_PKG_CONFIG
AC_USE_SYSTEM_EXTENSIONS
# Default tmux.conf goes in /etc not ${prefix}/etc.
test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
2015-09-11 12:16:35 +00:00
# Is this --enable-debug?
2010-12-31 22:31:45 +00:00
AC_ARG_ENABLE(
debug,
AS_HELP_STRING(--enable-debug, enable debug build flags),
,
[case "x$VERSION" in xnext*) enable_debug=yes;; esac]
2010-12-31 22:31:45 +00:00
)
AM_CONDITIONAL(IS_DEBUG, test "x$enable_debug" = xyes)
2011-01-04 09:43:14 +00:00
# Is this a static build?
AC_ARG_ENABLE(
2014-12-06 00:07:55 +00:00
static,
AS_HELP_STRING(--enable-static, create a static build)
2011-01-04 09:43:14 +00:00
)
if test "x$enable_static" = xyes; then
2022-02-16 12:26:23 +00:00
case "$host_os" in
*darwin*)
AC_MSG_ERROR([static linking is not supported on macOS])
;;
esac
test "x$PKG_CONFIG" != x && PKG_CONFIG="$PKG_CONFIG --static"
AM_LDFLAGS="-static $AM_LDFLAGS"
LDFLAGS="$AM_LDFLAGS $SAVED_LDFLAGS"
fi
2011-01-04 09:43:14 +00:00
# Allow default TERM to be set.
AC_ARG_WITH(
TERM,
AS_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)
# Is this gcc?
AM_CONDITIONAL(IS_GCC, test "x$GCC" = xyes -a "x$enable_fuzzing" != xyes)
# Is this Sun CC?
2010-12-31 22:31:45 +00:00
AC_EGREP_CPP(
yes,
[
#ifdef __SUNPRO_C
yes
#endif
],
found_suncc=yes,
2010-12-31 22:31:45 +00:00
found_suncc=no
)
AM_CONDITIONAL(IS_SUNCC, test "x$found_suncc" = xyes)
2014-12-06 00:07:55 +00:00
# Check for various headers. Alternatives included from compat.h.
2017-03-22 19:22:32 +00:00
AC_CHECK_HEADERS([ \
bitstring.h \
dirent.h \
fcntl.h \
inttypes.h \
libproc.h \
2017-03-22 19:22:32 +00:00
libutil.h \
ndir.h \
paths.h \
pty.h \
stdint.h \
sys/dir.h \
sys/ndir.h \
sys/tree.h \
ucred.h \
2017-03-22 19:22:32 +00:00
util.h \
])
2014-12-06 00:07:55 +00:00
2020-04-16 09:08:16 +00:00
# Look for sys_signame.
2020-04-16 09:15:33 +00:00
AC_SEARCH_LIBS(sys_signame, , AC_DEFINE(HAVE_SYS_SIGNAME))
2020-04-16 09:08:16 +00:00
2020-03-11 16:33:55 +00:00
# Look for fmod.
AC_CHECK_LIB(m, fmod)
# Look for library needed for flock.
AC_SEARCH_LIBS(flock, bsd)
2017-03-22 19:22:32 +00:00
# Check for functions that are replaced or omitted.
AC_CHECK_FUNCS([ \
dirfd \
flock \
prctl \
proc_pidinfo \
getpeerucred \
2024-01-17 10:57:32 +00:00
sysconf
2017-03-22 19:22:32 +00:00
])
# Check for functions with a compatibility implementation.
AC_REPLACE_FUNCS([ \
asprintf \
cfmakeraw \
clock_gettime \
2017-03-22 19:22:32 +00:00
closefrom \
explicit_bzero \
2017-03-22 19:22:32 +00:00
fgetln \
2017-04-11 10:51:25 +00:00
freezero \
getdtablecount \
getdtablesize \
2022-03-08 11:02:17 +00:00
getpeereid \
2020-06-18 20:01:55 +00:00
getline \
2017-03-22 19:22:32 +00:00
getprogname \
2024-01-17 10:57:32 +00:00
htonll \
2017-06-09 07:52:45 +00:00
memmem \
2024-01-17 10:57:32 +00:00
ntohll \
2017-03-22 19:22:32 +00:00
setenv \
setproctitle \
strcasestr \
strlcat \
strlcpy \
strndup \
strsep \
2017-03-22 19:22:32 +00:00
])
AC_FUNC_STRNLEN
2014-12-06 00:07:55 +00:00
# Check if strtonum works.
AC_MSG_CHECKING([for working strtonum])
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[#include <stdlib.h>],
[return (strtonum("0", 0, 1, NULL) == 0 ? 0 : 1);]
)],
[AC_DEFINE(HAVE_STRTONUM) AC_MSG_RESULT(yes)],
[AC_LIBOBJ(strtonum) AC_MSG_RESULT(no)],
[AC_LIBOBJ(strtonum) AC_MSG_RESULT(no)]
)
# Clang sanitizers wrap reallocarray even if it isn't available on the target
# system. When compiled it always returns NULL and crashes the program. To
# detect this we need a more complicated test.
AC_MSG_CHECKING([for working reallocarray])
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[#include <stdlib.h>],
[return (reallocarray(NULL, 1, 1) == NULL);]
)],
AC_MSG_RESULT(yes),
[AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])],
[AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])]
)
AC_MSG_CHECKING([for working recallocarray])
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[#include <stdlib.h>],
[return (recallocarray(NULL, 1, 1, 1) == NULL);]
)],
AC_MSG_RESULT(yes),
[AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])],
[AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])]
)
2011-01-04 09:43:14 +00:00
# Look for clock_gettime. Must come before event_init.
AC_SEARCH_LIBS(clock_gettime, rt)
2011-01-04 09:43:14 +00:00
# Always use our getopt because 1) glibc's doesn't enforce argument order 2)
# musl does not set optarg to NULL for flags without arguments (although it is
# not required to, but it is helpful) 3) there are probably other weird
# implementations.
AC_LIBOBJ(getopt)
# Look for libevent. Try libevent_core or libevent with pkg-config first then
# look for the library.
2011-10-27 23:00:45 +00:00
PKG_CHECK_MODULES(
LIBEVENT_CORE,
[libevent_core >= 2],
2011-10-27 23:00:45 +00:00
[
AM_CPPFLAGS="$LIBEVENT_CORE_CFLAGS $AM_CPPFLAGS"
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
LIBS="$LIBEVENT_CORE_LIBS $LIBS"
2011-10-27 23:00:45 +00:00
found_libevent=yes
],
found_libevent=no
)
if test x$found_libevent = xno; then
PKG_CHECK_MODULES(
LIBEVENT,
[libevent >= 2],
[
AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS"
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
LIBS="$LIBEVENT_LIBS $LIBS"
found_libevent=yes
],
found_libevent=no
)
fi
if test x$found_libevent = xno; then
AC_SEARCH_LIBS(
event_init,
[event_core event event-1.4],
found_libevent=yes,
found_libevent=no
)
fi
AC_CHECK_HEADER(
event2/event.h,
AC_DEFINE(HAVE_EVENT2_EVENT_H),
2011-10-27 23:00:45 +00:00
[
AC_CHECK_HEADER(
event.h,
AC_DEFINE(HAVE_EVENT_H),
2011-10-27 23:00:45 +00:00
found_libevent=no
)
]
)
if test "x$found_libevent" = xno; then
AC_MSG_ERROR("libevent not found")
fi
# Look for yacc.
AC_CHECK_PROG(found_yacc, $YACC, yes, no)
if test "x$found_yacc" = xno; then
AC_MSG_ERROR("yacc not found")
fi
# Look for ncurses or curses. Try pkg-config first then directly for the
# library.
PKG_CHECK_MODULES(
2017-02-07 13:40:36 +00:00
LIBTINFO,
tinfo,
[
AM_CPPFLAGS="$LIBTINFO_CFLAGS $AM_CPPFLAGS"
CPPFLAGS="$LIBTINFO_CFLAGS $SAVED_CPPFLAGS"
LIBS="$LIBTINFO_LIBS $LIBS"
found_ncurses=yes
],
found_ncurses=no
2011-01-02 15:49:31 +00:00
)
2017-02-07 13:40:36 +00:00
if test "x$found_ncurses" = xno; then
PKG_CHECK_MODULES(
LIBNCURSES,
ncurses,
[
AM_CPPFLAGS="$LIBNCURSES_CFLAGS $AM_CPPFLAGS"
CPPFLAGS="$LIBNCURSES_CFLAGS $SAVED_CPPFLAGS"
LIBS="$LIBNCURSES_LIBS $LIBS"
found_ncurses=yes
],
2017-02-07 13:40:36 +00:00
found_ncurses=no
)
fi
if test "x$found_ncurses" = xno; then
PKG_CHECK_MODULES(
LIBNCURSESW,
ncursesw,
[
AM_CPPFLAGS="$LIBNCURSESW_CFLAGS $AM_CPPFLAGS"
CPPFLAGS="$LIBNCURSESW_CFLAGS $SAVED_CPPFLAGS"
LIBS="$LIBNCURSESW_LIBS $LIBS"
found_ncurses=yes
],
found_ncurses=no
)
fi
if test "x$found_ncurses" = xno; then
AC_SEARCH_LIBS(
setupterm,
[tinfo terminfo ncurses ncursesw],
found_ncurses=yes,
found_ncurses=no
)
if test "x$found_ncurses" = xyes; then
AC_CHECK_HEADER(
ncurses.h,
LIBS="$LIBS -lncurses",
found_ncurses=no
)
fi
fi
if test "x$found_ncurses" = xyes; then
CPPFLAGS="$CPPFLAGS -DHAVE_NCURSES_H"
AC_DEFINE(HAVE_NCURSES_H)
else
AC_CHECK_LIB(
curses,
setupterm,
found_curses=yes,
found_curses=no
)
AC_CHECK_HEADER(
curses.h,
,
found_curses=no
)
if test "x$found_curses" = xyes; then
LIBS="$LIBS -lcurses"
CPPFLAGS="$CPPFLAGS -DHAVE_CURSES_H"
AC_DEFINE(HAVE_CURSES_H)
else
2017-02-07 13:40:36 +00:00
AC_MSG_ERROR("curses not found")
fi
fi
AC_CHECK_FUNCS([ \
tiparm \
tiparm_s \
])
2014-02-24 23:09:19 +00:00
# Look for utempter.
AC_ARG_ENABLE(
utempter,
AS_HELP_STRING(--enable-utempter, use utempter if it is installed)
)
if test "x$enable_utempter" = xyes; then
AC_CHECK_HEADER(utempter.h, enable_utempter=yes, enable_utempter=no)
if test "x$enable_utempter" = xyes; then
AC_SEARCH_LIBS(
utempter_add_record,
utempter,
enable_utempter=yes,
enable_utempter=no
)
fi
if test "x$enable_utempter" = xyes; then
AC_DEFINE(HAVE_UTEMPTER)
else
AC_MSG_ERROR("utempter not found")
fi
fi
# Look for utf8proc.
if test "x$enable_utf8proc" = xyes; then
PKG_CHECK_MODULES(
LIBUTF8PROC,
libutf8proc,
[
AM_CPPFLAGS="$LIBUTF8PROC_CFLAGS $AM_CPPFLAGS"
CPPFLAGS="$LIBUTF8PROC_CFLAGS $SAVED_CPPFLAGS"
LIBS="$LIBUTF8PROC_LIBS $LIBS"
]
)
AC_CHECK_HEADER(utf8proc.h, enable_utf8proc=yes, enable_utf8proc=no)
if test "x$enable_utf8proc" = xyes; then
AC_SEARCH_LIBS(
utf8proc_charwidth,
utf8proc,
enable_utf8proc=yes,
enable_utf8proc=no
)
fi
if test "x$enable_utf8proc" = xyes; then
AC_DEFINE(HAVE_UTF8PROC)
else
AC_MSG_ERROR("utf8proc not found")
fi
fi
AM_CONDITIONAL(HAVE_UTF8PROC, [test "x$enable_utf8proc" = xyes])
# Check for systemd support.
AC_ARG_ENABLE(
systemd,
AS_HELP_STRING(--enable-systemd, enable systemd integration)
)
if test x"$enable_systemd" = xyes; then
PKG_CHECK_MODULES(
SYSTEMD,
libsystemd,
[
AM_CPPFLAGS="$SYSTEMD_CFLAGS $AM_CPPFLAGS"
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
LIBS="$SYSTEMD_LIBS $LIBS"
found_systemd=yes
],
found_systemd=no
)
if test "x$found_systemd" = xyes; then
AC_DEFINE(HAVE_SYSTEMD)
else
AC_MSG_ERROR("systemd not found")
fi
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$found_systemd" = xyes])
AC_ARG_ENABLE(
cgroups,
AS_HELP_STRING(--disable-cgroups, disable adding panes to new cgroups with systemd)
)
if test "x$enable_cgroups" = x; then
# Default to the same as $enable_systemd.
enable_cgroups=$enable_systemd
fi
if test "x$enable_cgroups" = xyes; then
if test "x$found_systemd" = xyes; then
AC_DEFINE(ENABLE_CGROUPS)
else
AC_MSG_ERROR("cgroups requires systemd to be enabled")
fi
fi
Merge SIXEL branch. Squashed commit of the following: commit 6ebc3feb4671d9b25b3db99d3c16b2323b8e3d02 Author: topcat001 <anindya49@hotmail.com> Date: Sun Aug 20 16:09:51 2023 -0700 Remove redundant {}. commit 6f013fce39602c259a5be2d690d548c73e51cccc Author: topcat001 <anindya49@hotmail.com> Date: Sun Aug 20 16:02:15 2023 -0700 Revert "Do not defer redraw if it is just the status line (will need to do more here I" This reverts commit 0a15bbf3f1972dc84c5c84d5128024c1bc4c0074. commit e6322b4196d73c975ba2e73633e6de9c46779059 Author: topcat001 <anindya49@hotmail.com> Date: Sun Aug 20 15:46:59 2023 -0700 Fix placeholder label and clean up. commit 5896ac52a1f72056a75480b3e1ada328f239df9b Merge: ad982330 e3a8b843 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Fri Aug 18 17:00:03 2023 +0100 Merge branch 'master' into sixel commit ad98233066b72547aee7fa0c87838847ee7f1ece Author: topcat001 <anindya49@hotmail.com> Date: Tue Aug 15 13:57:08 2023 -0700 Better text placeholder. commit 312d83252c27fc4d09d09d121bf7573336e3cdca Merge: 14b8b524 3d93b0c5 Author: topcat001 <anindya49@hotmail.com> Date: Tue Aug 15 13:39:22 2023 -0700 Merge remote-tracking branch 'origin/master' into sixel commit 14b8b524523a7d5a4e42f7dfa346905c604c91e2 Merge: 4baf7642 fda39377 Author: topcat001 <anindya49@hotmail.com> Date: Sat Jul 22 17:29:10 2023 -0700 Merge branch 'master' into sixel commit 4baf76422fadb216bf27b47645b52da3379e7dea Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Jun 21 07:43:53 2023 +0100 Both files can go on one line. commit 4c92acf6ff24dde37ad41cd168ea2d3bcefb8567 Author: topcat001 <anindya49@hotmail.com> Date: Sat Jun 17 17:53:01 2023 -0700 Merge topcat001/tmux/sixel. commit 6794facc82e98f8448c192913cf62fe6e10fde63 Merge: 7b85f5ad f41c536f Author: topcat001 <anindya49@hotmail.com> Date: Sat Jun 17 17:21:02 2023 -0700 Merge remote-tracking branch 'origin/master' into sixel commit 7b85f5adf9a5094db580ca98e4d2231d8d5b5a4f Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jun 8 12:55:03 2023 +0100 Do not require passthrough for SIXEL. commit a6ee55e0925cac35d011c188db2da0421fc09be1 Merge: 6da391f4 fe385b18 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jun 8 12:19:55 2023 +0100 Merge branch 'master' into sixel commit 6da391f460414ed3dde23e5ab6ca3fe8e988ce51 Merge: 0d71e585 0eb5d254 Author: topcat001 <anindya49@hotmail.com> Date: Sat May 20 17:05:55 2023 -0700 Merge branch 'master' into sixel commit 0d71e5853ffe797f90b815ac3af25ac0ad92ab07 Merge: 64368a1a fbe6fe7f Author: topcat001 <anindya49@hotmail.com> Date: Sat Apr 29 17:32:07 2023 -0700 Merge branch 'master' into sixel commit 64368a1a63f04fb877b57e4286c9a2e1efe966c9 Merge: c630a56a 22eb0334 Author: topcat001 <anindya49@hotmail.com> Date: Thu Mar 30 14:21:09 2023 -0700 Merge branch 'master' into sixel commit c630a56a621b9761eed558cbd566a36cb09adf8f Merge: 34c96c4c aaa043a2 Author: topcat001 <anindya49@hotmail.com> Date: Thu Nov 10 18:53:01 2022 -0800 Merge branch 'master' into sixel commit 34c96c4c4a33f86b49c8a53dc48b2b817db24e95 Merge: 2a1e16a2 50f4e0fa Author: topcat001 <anindya49@hotmail.com> Date: Sat Nov 5 18:05:36 2022 -0700 Merge branch 'master' into sixel commit 2a1e16a24dc75741c66f5d72fa5bf26b73507993 Merge: a82f14c7 d001a94d Author: topcat001 <anindya49@hotmail.com> Date: Thu Oct 27 16:01:35 2022 -0700 Merge branch 'master' into sixel commit a82f14c7b23a239a2114c756ef73bba8609ebe33 Merge: 742c0634 f7b30ed3 Author: topcat001 <anindya49@hotmail.com> Date: Sun Aug 28 13:43:07 2022 -0700 Merge branch 'master' into sixel commit 742c0634734e6b2840762e58b0bf27626b5ac24b Merge: 906c92a5 87b248f3 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Fri Apr 1 10:14:15 2022 +0100 Merge branch 'master' into sixel commit 906c92a5f458b8843e7abd1d6f419dc091f8063c Merge: 6680a024 138ffc7c Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Dec 8 10:37:33 2021 +0000 Merge branch 'master' into sixel commit 6680a024be5e173a27c10e9a0be6c9072576086d Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Oct 7 13:59:08 2021 +0100 Fix build. commit ebd2c585937f18045d334226d4a0cc788fe14353 Merge: 90dc0519 fed7b29c Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Oct 7 13:19:48 2021 +0100 Merge branch 'master' into sixel commit 90dc05191cbba8de6d9d77ee7f9726325abe844e Merge: a282439f 4694afbe Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Feb 20 20:37:32 2020 +0000 Merge branch 'master' into sixel commit a282439fcb2f597927a5ba33d2c378c90eec8b42 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jan 30 09:12:53 2020 +0000 Add missing declarations. commit 3a741aacd108538f99239c68bfa2cd416bf0eb46 Merge: 40ad0107 339832b9 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jan 30 09:11:01 2020 +0000 Merge branch 'sixel-passthrough' into sixel commit 339832b92c298538f398754f6d3fc21d15d13326 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jan 30 09:04:51 2020 +0000 Bad merge. commit 92ed9fc0b20440f2bc553757e6bfe3126fe84be4 Merge: 5bb07548 32be954b Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jan 30 09:03:38 2020 +0000 Merge branch 'master' into sixel-passthrough commit 40ad01073d73a531b4e85b0138f78bf0b472b354 Merge: dd3c72f1 61b075a2 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Sun Jan 12 20:03:41 2020 +0000 Merge branch 'master' into sixel commit 5bb075487f5897d7402adb880e678043c0f7f3e0 Merge: 7c033a74 54efe337 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Dec 18 20:24:42 2019 +0000 Merge branch 'master' into sixel-passthrough commit dd3c72f132c911b0ba61b56a56f46510704d3392 Merge: 1a0e5fe9 54efe337 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Dec 18 20:24:26 2019 +0000 Merge branch 'master' into sixel commit 1a0e5fe933e89932f2f658936c52eb50644fbef4 Merge: cf071ffe 15d7e564 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Tue Dec 10 16:34:11 2019 +0000 Merge branch 'master' into sixel commit cf071ffecd5a0d33008fd0a8b66a22f6855c7a8d Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Mon Dec 9 15:41:56 2019 +0000 Remove images when reflow happens. commit 2006b7a5631787a7086c6bae364e62d0a0b5948a Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 09:27:15 2019 +0000 More invalidation of images. commit b642eac4503cc89cde01103f7bacca57cc9c1a2b Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 09:11:24 2019 +0000 Redraw and scroll images and part of invalidating them. commit 7566e37a461bf245bd2e54e1d522e919071e9c44 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 08:51:24 2019 +0000 Call sixel_scale with the right number of arguments. commit 62c0280b23cf67fc43f691392a8eca5cd7ff0727 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 08:48:58 2019 +0000 Correctly remove when not visible. commit 86c5098a887f2cd09b828e051ccf0fab21bf4f6a Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 08:32:25 2019 +0000 Add helpers to scroll image up and a flag to copy the colours. commit 49f2f0a8f1e72389f4128aa38119ed124cdc31c5 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 00:02:55 2019 +0000 Store images, currently at most 10. commit 3aebcc67099ccbc5964c744fc1435931c1a78583 Merge: 146ee3f6 92ecd611 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Dec 4 19:27:16 2019 +0000 Merge branch 'master' into sixel commit 7c033a74e25957d333217cb71a7658b860583501 Merge: 0a15bbf3 92ecd611 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Dec 4 12:41:09 2019 +0000 Merge branch 'master' into sixel-passthrough commit 146ee3f6f8ee2629c6a88b6900a71f3e6fd14e4d Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Sat Nov 30 09:47:53 2019 +0000 Don't write image as text yet. commit 0a15bbf3f1972dc84c5c84d5128024c1bc4c0074 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Sat Nov 30 09:15:35 2019 +0000 Do not defer redraw if it is just the status line (will need to do more here I think). commit a5b1e209417b7d3f5b0099642dd317c312f79377 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 14:20:22 2019 +0000 Add a flag to disable blocking while sending a SIXEL image (turned off when the buffer hits 0 size). commit 968382aa6a4b9c71fbc221aa4f0e899f6a83a260 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 12:35:18 2019 +0000 Pass through SIXEL DCS sequences (treat similarly to the passthrough escape sequence) if it appears the terminal outside supports them. commit b1904c9b8db514133d3372aac13b2ff0b2093cc3 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Sat Nov 30 09:17:18 2019 +0000 Store SIXELs as a box for the moment. commit 5d8dbcdf3d76d0e69b8f2d21eff48f819dcec199 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Sat Nov 30 09:15:35 2019 +0000 Do not defer redraw if it is just the status line (will need to do more here I think). commit 0c999a402ece7b40e6ae84547893421b52d508ff Merge: 28961dd5 866b053f Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Fri Nov 29 18:54:09 2019 +0000 Merge branch 'master' into sixel commit 28961dd5a38dd5a7b703ed0e6625fa9a65556d35 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 14:24:57 2019 +0000 Add an image. commit d2e3f3c1cca5410570c5392340d14e96ae7a354c Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 14:20:22 2019 +0000 Add a flag to disable blocking while sending a SIXEL image (turned off when the buffer hits 0 size). commit e01df67ca106e57f5c689e75f313f8cda6f8b805 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 13:21:40 2019 +0000 Crop and scale images as needed when drawing them. commit e24acc0b5c3ac19dcacebdea243dcc7784215ffa Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 12:38:02 2019 +0000 Simple SIXEL parse and modify API. commit b34111b3da1e4b1769a976cd40486144f7b4f5a2 Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 12:35:18 2019 +0000 Pass through SIXEL DCS sequences (treat similarly to the passthrough escape sequence) if it appears the terminal outside supports them.
2023-08-22 07:43:35 +00:00
# Enable sixel support.
AC_ARG_ENABLE(
sixel,
AS_HELP_STRING(--enable-sixel, enable sixel images)
)
if test "x$enable_sixel" = xyes; then
AC_DEFINE(ENABLE_SIXEL)
fi
AM_CONDITIONAL(ENABLE_SIXEL, [test "x$enable_sixel" = xyes])
2017-01-22 19:12:15 +00:00
# Check for b64_ntop. If we have b64_ntop, we assume b64_pton as well.
AC_MSG_CHECKING(for b64_ntop)
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[
#include <sys/types.h>
#include <netinet/in.h>
#include <resolv.h>
],
[
b64_ntop(NULL, 0, NULL, 0);
])],
found_b64_ntop=yes,
found_b64_ntop=no
)
2021-01-17 18:19:50 +00:00
AC_MSG_RESULT($found_b64_ntop)
OLD_LIBS="$LIBS"
if test "x$found_b64_ntop" = xno; then
AC_MSG_CHECKING(for b64_ntop with -lresolv)
LIBS="$OLD_LIBS -lresolv"
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[
#include <sys/types.h>
#include <netinet/in.h>
#include <resolv.h>
],
[
b64_ntop(NULL, 0, NULL, 0);
])],
found_b64_ntop=yes,
found_b64_ntop=no
)
2021-01-17 18:19:50 +00:00
AC_MSG_RESULT($found_b64_ntop)
fi
if test "x$found_b64_ntop" = xno; then
AC_MSG_CHECKING(for b64_ntop with -lnetwork)
LIBS="$OLD_LIBS -lnetwork"
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[
#include <sys/types.h>
#include <netinet/in.h>
#include <resolv.h>
],
[
b64_ntop(NULL, 0, NULL, 0);
])],
found_b64_ntop=yes,
found_b64_ntop=no
)
2021-01-17 18:19:50 +00:00
AC_MSG_RESULT($found_b64_ntop)
fi
if test "x$found_b64_ntop" = xyes; then
AC_DEFINE(HAVE_B64_NTOP)
2017-03-22 19:22:32 +00:00
else
LIBS="$OLD_LIBS"
2017-03-22 19:22:32 +00:00
AC_LIBOBJ(base64)
fi
# Look for networking libraries.
2011-01-04 09:43:14 +00:00
AC_SEARCH_LIBS(inet_ntoa, nsl)
AC_SEARCH_LIBS(socket, socket)
2011-01-21 20:35:20 +00:00
AC_CHECK_LIB(xnet, socket)
# Check if using glibc and have malloc_trim(3). The glibc free(3) is pretty bad
# about returning memory to the kernel unless the application tells it when to
# with malloc_trim(3).
AC_MSG_CHECKING(if free doesn't work very well)
AC_LINK_IFELSE([AC_LANG_SOURCE(
[
#include <stdlib.h>
#ifdef __GLIBC__
#include <malloc.h>
int main(void) {
malloc_trim (0);
exit(0);
}
#else
no
#endif
])],
found_malloc_trim=yes,
found_malloc_trim=no
)
AC_MSG_RESULT($found_malloc_trim)
if test "x$found_malloc_trim" = xyes; then
AC_DEFINE(HAVE_MALLOC_TRIM)
fi
# Build against jemalloc if requested.
AC_ARG_ENABLE(
jemalloc,
AS_HELP_STRING(--enable-jemalloc, use jemalloc if it is installed)
)
if test "x$enable_jemalloc" = xyes; then
PKG_CHECK_MODULES(
JEMALLOC,
jemalloc,
[
AM_CPPFLAGS="$JEMALLOC_CFLAGS $AM_CPPFLAGS"
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
LIBS="$LIBS $JEMALLOC_LIBS"
],
AC_MSG_ERROR("jemalloc not found")
)
fi
# Check for CMSG_DATA. On some platforms like HP-UX this requires UNIX 95
# (_XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED) (see xopen_networking(7)). On
# others, UNIX 03 (_XOPEN_SOURCE 600, see standards(7) on Solaris).
2011-01-21 20:35:20 +00:00
XOPEN_DEFINES=
AC_MSG_CHECKING(for CMSG_DATA)
AC_EGREP_CPP(
yes,
[
#include <sys/socket.h>
#ifdef CMSG_DATA
yes
#endif
],
found_cmsg_data=yes,
found_cmsg_data=no
)
AC_MSG_RESULT($found_cmsg_data)
if test "x$found_cmsg_data" = xno; then
AC_MSG_CHECKING(if CMSG_DATA needs _XOPEN_SOURCE_EXTENDED)
AC_EGREP_CPP(
yes,
[
#define _XOPEN_SOURCE 1
#define _XOPEN_SOURCE_EXTENDED 1
#include <sys/socket.h>
#ifdef CMSG_DATA
yes
#endif
],
found_cmsg_data=yes,
found_cmsg_data=no
)
AC_MSG_RESULT($found_cmsg_data)
if test "x$found_cmsg_data" = xyes; then
XOPEN_DEFINES="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED"
fi
fi
if test "x$found_cmsg_data" = xno; then
AC_MSG_CHECKING(if CMSG_DATA needs _XOPEN_SOURCE 600)
AC_EGREP_CPP(
yes,
[
#define _XOPEN_SOURCE 600
#include <sys/socket.h>
#ifdef CMSG_DATA
yes
#endif
],
found_cmsg_data=yes,
found_cmsg_data=no
)
AC_MSG_RESULT($found_cmsg_data)
if test "x$found_cmsg_data" = xyes; then
XOPEN_DEFINES="-D_XOPEN_SOURCE=600"
2011-01-21 20:35:20 +00:00
else
2014-12-06 00:07:55 +00:00
AC_MSG_ERROR("CMSG_DATA not found")
2011-01-21 20:35:20 +00:00
fi
fi
AC_SUBST(XOPEN_DEFINES)
# Look for err and friends in err.h.
AC_CHECK_FUNC(err, found_err_h=yes, found_err_h=no)
AC_CHECK_FUNC(errx, , found_err_h=no)
AC_CHECK_FUNC(warn, , found_err_h=no)
AC_CHECK_FUNC(warnx, , found_err_h=no)
if test "x$found_err_h" = xyes; then
AC_CHECK_HEADER(err.h, , found_err_h=no)
2017-03-22 19:22:32 +00:00
else
AC_LIBOBJ(err)
fi
2017-03-22 21:29:07 +00:00
# Look for imsg_init in libutil.
AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
if test "x$found_imsg_init" = xyes; then
AC_DEFINE(HAVE_IMSG)
2017-03-22 19:22:32 +00:00
else
AC_LIBOBJ(imsg)
AC_LIBOBJ(imsg-buffer)
fi
2017-03-22 21:29:07 +00:00
# Look for daemon, compat/daemon.c used if missing. Solaris 10 has it in
# libresolv, but no declaration anywhere, so check for declaration as well as
# function.
AC_CHECK_FUNC(daemon, found_daemon=yes, found_daemon=no)
AC_CHECK_DECL(
daemon,
,
found_daemon=no,
[
#include <stdlib.h>
#include <unistd.h>
]
)
if test "x$found_daemon" = xyes; then
AC_DEFINE(HAVE_DAEMON)
2017-03-22 19:22:32 +00:00
else
AC_LIBOBJ(daemon)
fi
2015-09-01 20:08:19 +00:00
# Look for stravis, compat/{vis,unvis}.c used if missing.
AC_CHECK_FUNC(stravis, found_stravis=yes, found_stravis=no)
if test "x$found_stravis" = xyes; then
AC_MSG_CHECKING(if strnvis is broken)
AC_EGREP_HEADER([strnvis\(char \*, const char \*, size_t, int\)],
2015-01-25 16:51:49 +00:00
vis.h,
AC_MSG_RESULT(no),
2015-09-01 20:08:19 +00:00
[found_stravis=no])
if test "x$found_stravis" = xno; then
AC_MSG_RESULT(yes)
fi
fi
2017-01-16 15:01:14 +00:00
if test "x$found_stravis" = xyes; then
AC_CHECK_DECL(
VIS_DQ,
,
2017-01-16 18:20:50 +00:00
found_stravis=no,
[
#include <stdlib.h>
#include <vis.h>
]
)
2017-01-16 15:01:14 +00:00
fi
2015-09-01 20:08:19 +00:00
if test "x$found_stravis" = xyes; then
AC_DEFINE(HAVE_VIS)
2017-03-22 19:22:32 +00:00
else
AC_LIBOBJ(vis)
AC_LIBOBJ(unvis)
fi
2015-11-18 12:54:29 +00:00
2017-04-20 18:09:07 +00:00
# Look for fdforkpty and forkpty in libutil.
AC_SEARCH_LIBS(fdforkpty, util, found_fdforkpty=yes, found_fdforkpty=no)
if test "x$found_fdforkpty" = xyes; then
AC_DEFINE(HAVE_FDFORKPTY)
else
AC_LIBOBJ(fdforkpty)
fi
2017-03-22 19:22:32 +00:00
AC_SEARCH_LIBS(forkpty, util, found_forkpty=yes, found_forkpty=no)
if test "x$found_forkpty" = xyes; then
AC_DEFINE(HAVE_FORKPTY)
fi
AM_CONDITIONAL(NEED_FORKPTY, test "x$found_forkpty" = xno)
# Look for kinfo_getfile in libutil.
AC_SEARCH_LIBS(kinfo_getfile, [util util-freebsd])
# Look for a suitable queue.h.
2017-02-06 10:05:56 +00:00
AC_CHECK_DECL(
TAILQ_CONCAT,
found_queue_h=yes,
found_queue_h=no,
[#include <sys/queue.h>]
)
2010-12-31 22:31:45 +00:00
AC_CHECK_DECL(
TAILQ_PREV,
2021-07-14 10:09:28 +00:00
,
found_queue_h=no,
2010-12-31 22:31:45 +00:00
[#include <sys/queue.h>]
)
AC_CHECK_DECL(
TAILQ_REPLACE,
,
found_queue_h=no,
2010-12-31 22:31:45 +00:00
[#include <sys/queue.h>]
)
if test "x$found_queue_h" = xyes; then
AC_DEFINE(HAVE_QUEUE_H)
fi
# Look for __progname.
AC_MSG_CHECKING(for __progname)
AC_LINK_IFELSE([AC_LANG_SOURCE(
2010-12-31 22:31:45 +00:00
[
2011-01-10 22:12:31 +00:00
#include <stdio.h>
#include <stdlib.h>
2010-12-31 22:31:45 +00:00
extern char *__progname;
2011-01-10 22:12:31 +00:00
int main(void) {
const char *cp = __progname;
printf("%s\n", cp);
exit(0);
}
2014-12-06 00:07:55 +00:00
])],
[AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
2010-12-31 22:31:45 +00:00
AC_MSG_RESULT(no)
)
# Look for program_invocation_short_name.
AC_MSG_CHECKING(for program_invocation_short_name)
AC_LINK_IFELSE([AC_LANG_SOURCE(
[
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
const char *cp = program_invocation_short_name;
printf("%s\n", cp);
exit(0);
}
])],
[AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME) AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no)
)
# Look for prctl(PR_SET_NAME).
AC_CHECK_DECL(
PR_SET_NAME,
AC_DEFINE(HAVE_PR_SET_NAME),
,
[#include <sys/prctl.h>]
)
2022-03-08 11:02:17 +00:00
# Look for setsockopt(SO_PEERCRED).
AC_CHECK_DECL(
SO_PEERCRED,
AC_DEFINE(HAVE_SO_PEERCRED),
,
[#include <sys/socket.h>]
)
# Look for fcntl(F_CLOSEM).
2011-01-03 23:43:35 +00:00
AC_CHECK_DECL(
F_CLOSEM,
AC_DEFINE(HAVE_FCNTL_CLOSEM),
,
[#include <fcntl.h>]
)
# Look for /proc/$$.
AC_MSG_CHECKING(for /proc/\$\$)
if test -d /proc/$$; then
AC_DEFINE(HAVE_PROC_PID)
AC_MSG_RESULT(yes)
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],
,
[DEFAULT_TERM=screen]
)
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],
,
[DEFAULT_TERM=screen]
)
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],
,
[DEFAULT_TERM=screen]
)
AC_MSG_RESULT($DEFAULT_TERM)
fi
AC_SUBST(DEFAULT_TERM)
# Man page defaults to mdoc.
MANFORMAT=mdoc
AC_SUBST(MANFORMAT)
# Set the default lock command
DEFAULT_LOCK_CMD="lock -np"
AC_MSG_CHECKING(lock-command)
if test "x$PLATFORM" = xlinux; then
AC_CHECK_PROG(found_vlock, vlock, yes, no)
if test "x$found_vlock" = xyes; then
DEFAULT_LOCK_CMD="vlock"
fi
fi
AC_MSG_RESULT($DEFAULT_LOCK_CMD)
AC_SUBST(DEFAULT_LOCK_CMD)
# Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
# variables.
AC_SUBST(AM_CPPFLAGS)
CPPFLAGS="$SAVED_CPPFLAGS"
AC_SUBST(AM_CFLAGS)
CFLAGS="$SAVED_CFLAGS"
AC_SUBST(AM_LDFLAGS)
LDFLAGS="$SAVED_LDFLAGS"
2014-09-08 22:33:41 +00:00
# autoconf should create a Makefile.
AC_CONFIG_FILES(Makefile)
AC_OUTPUT