2015-09-14 14:59:21 +00:00
|
|
|
# configure.ac
|
2010-12-31 22:12:33 +00:00
|
|
|
|
2020-03-11 06:41:13 +00:00
|
|
|
AC_INIT([tmux], next-3.2)
|
2017-03-22 07:42:45 +00:00
|
|
|
AC_PREREQ([2.60])
|
2010-12-31 22:12:33 +00:00
|
|
|
|
|
|
|
AC_CONFIG_AUX_DIR(etc)
|
2017-03-22 19:22:32 +00:00
|
|
|
AC_CONFIG_LIBOBJ_DIR(compat)
|
2013-10-03 21:31:26 +00:00
|
|
|
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
2010-12-31 22:12:33 +00:00
|
|
|
|
|
|
|
AC_CANONICAL_HOST
|
|
|
|
|
2011-07-09 15:57:56 +00:00
|
|
|
# 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=""}
|
2011-07-27 09:31:08 +00:00
|
|
|
|
2016-10-19 14:20:21 +00:00
|
|
|
# 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"
|
|
|
|
|
2010-12-31 22:12:33 +00:00
|
|
|
# Set up the compiler in two different ways and say yes we may want to install.
|
|
|
|
AC_PROG_CC
|
|
|
|
AM_PROG_CC_C_O
|
2017-03-22 07:49:27 +00:00
|
|
|
AC_PROG_CC_C99
|
2015-03-01 21:46:05 +00:00
|
|
|
AC_PROG_CPP
|
|
|
|
AC_PROG_EGREP
|
2010-12-31 22:12:33 +00:00
|
|
|
AC_PROG_INSTALL
|
2019-05-23 12:04:41 +00:00
|
|
|
AC_PROG_YACC
|
2015-12-12 22:04:25 +00:00
|
|
|
PKG_PROG_PKG_CONFIG
|
2017-03-22 07:42:45 +00:00
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
2010-12-31 22:12:33 +00:00
|
|
|
|
2013-04-24 09:57:03 +00:00
|
|
|
# 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?
|
2018-10-19 07:35:23 +00:00
|
|
|
case "x$VERSION" in xnext*) enable_debug=yes;; esac
|
2010-12-31 22:31:45 +00:00
|
|
|
AC_ARG_ENABLE(
|
|
|
|
debug,
|
2015-09-11 12:16:35 +00:00
|
|
|
AC_HELP_STRING(--enable-debug, enable debug build flags),
|
2010-12-31 22:31:45 +00:00
|
|
|
)
|
2016-10-17 18:09:38 +00:00
|
|
|
AM_CONDITIONAL(IS_DEBUG, test "x$enable_debug" = xyes)
|
2010-12-31 22:12:33 +00:00
|
|
|
|
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,
|
2016-10-17 18:09:38 +00:00
|
|
|
AC_HELP_STRING(--enable-static, create a static build)
|
2011-01-04 09:43:14 +00:00
|
|
|
)
|
2016-10-17 18:09:38 +00:00
|
|
|
if test "x$enable_static" = xyes; then
|
2016-05-05 14:18:58 +00:00
|
|
|
test "x$PKG_CONFIG" != x && PKG_CONFIG="$PKG_CONFIG --static"
|
2016-10-19 14:20:21 +00:00
|
|
|
AM_LDFLAGS="-static $AM_LDFLAGS"
|
|
|
|
LDFLAGS="$AM_LDFLAGS $SAVED_LDFLAGS"
|
2013-03-06 14:58:48 +00:00
|
|
|
fi
|
2011-01-04 09:43:14 +00:00
|
|
|
|
2010-12-31 22:12:33 +00:00
|
|
|
# Is this gcc?
|
|
|
|
AM_CONDITIONAL(IS_GCC, test "x$GCC" = xyes)
|
|
|
|
|
|
|
|
# Is this Sun CC?
|
2010-12-31 22:31:45 +00:00
|
|
|
AC_EGREP_CPP(
|
|
|
|
yes,
|
|
|
|
[
|
|
|
|
#ifdef __SUNPRO_C
|
|
|
|
yes
|
|
|
|
#endif
|
2010-12-31 22:12:33 +00:00
|
|
|
],
|
|
|
|
found_suncc=yes,
|
2010-12-31 22:31:45 +00:00
|
|
|
found_suncc=no
|
|
|
|
)
|
2010-12-31 22:12:33 +00:00
|
|
|
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 \
|
|
|
|
libutil.h \
|
|
|
|
ndir.h \
|
|
|
|
paths.h \
|
|
|
|
pty.h \
|
|
|
|
stdint.h \
|
|
|
|
sys/dir.h \
|
|
|
|
sys/ndir.h \
|
|
|
|
sys/tree.h \
|
|
|
|
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)
|
|
|
|
|
2015-07-13 13:19:50 +00:00
|
|
|
# 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 \
|
|
|
|
sysconf \
|
|
|
|
])
|
|
|
|
|
|
|
|
# Check for functions with a compatibility implementation.
|
|
|
|
AC_REPLACE_FUNCS([ \
|
|
|
|
asprintf \
|
|
|
|
cfmakeraw \
|
|
|
|
closefrom \
|
2017-03-24 10:05:53 +00:00
|
|
|
explicit_bzero \
|
2017-03-22 19:22:32 +00:00
|
|
|
fgetln \
|
2017-04-11 10:51:25 +00:00
|
|
|
freezero \
|
2017-03-24 10:05:53 +00:00
|
|
|
getdtablecount \
|
2017-03-22 19:22:32 +00:00
|
|
|
getprogname \
|
2017-06-09 07:52:45 +00:00
|
|
|
memmem \
|
2017-03-24 10:05:53 +00:00
|
|
|
recallocarray \
|
2017-03-22 19:22:32 +00:00
|
|
|
reallocarray \
|
|
|
|
setenv \
|
|
|
|
setproctitle \
|
|
|
|
strcasestr \
|
|
|
|
strlcat \
|
|
|
|
strlcpy \
|
|
|
|
strndup \
|
|
|
|
strsep \
|
|
|
|
strtonum \
|
|
|
|
])
|
|
|
|
AC_FUNC_STRNLEN
|
2014-12-06 00:07:55 +00:00
|
|
|
|
2011-01-04 09:43:14 +00:00
|
|
|
# Look for clock_gettime. Must come before event_init.
|
2011-07-19 01:35:33 +00:00
|
|
|
AC_SEARCH_LIBS(clock_gettime, rt)
|
2011-01-04 09:43:14 +00:00
|
|
|
|
2020-03-17 16:06:30 +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)
|
|
|
|
|
2010-12-31 22:12:33 +00:00
|
|
|
# Look for libevent.
|
2011-10-27 23:00:45 +00:00
|
|
|
PKG_CHECK_MODULES(
|
|
|
|
LIBEVENT,
|
|
|
|
libevent,
|
|
|
|
[
|
2016-10-19 14:20:21 +00:00
|
|
|
AM_CFLAGS="$LIBEVENT_CFLAGS $AM_CFLAGS"
|
|
|
|
CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
|
2011-10-27 23:00:45 +00:00
|
|
|
LIBS="$LIBEVENT_LIBS $LIBS"
|
|
|
|
found_libevent=yes
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_SEARCH_LIBS(
|
|
|
|
event_init,
|
|
|
|
[event event-1.4 event2],
|
|
|
|
found_libevent=yes,
|
|
|
|
found_libevent=no
|
|
|
|
)
|
|
|
|
]
|
2011-07-22 10:49:33 +00:00
|
|
|
)
|
2016-09-02 21:05:06 +00:00
|
|
|
AC_CHECK_HEADER(
|
|
|
|
event.h,
|
|
|
|
,
|
|
|
|
found_libevent=no
|
|
|
|
)
|
2011-01-02 15:45:43 +00:00
|
|
|
if test "x$found_libevent" = xno; then
|
2011-07-22 10:49:33 +00:00
|
|
|
AC_MSG_ERROR("libevent not found")
|
2011-01-02 15:45:43 +00:00
|
|
|
fi
|
2010-12-31 22:12:33 +00:00
|
|
|
|
2016-09-01 19:40:03 +00:00
|
|
|
# Look for ncurses.
|
2015-12-11 19:58:09 +00:00
|
|
|
PKG_CHECK_MODULES(
|
2017-02-07 13:40:36 +00:00
|
|
|
LIBTINFO,
|
|
|
|
tinfo,
|
2017-01-19 15:31:22 +00:00
|
|
|
found_ncurses=yes,
|
2016-09-08 18:28:56 +00:00
|
|
|
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,
|
|
|
|
found_ncurses=yes,
|
|
|
|
found_ncurses=no
|
|
|
|
)
|
|
|
|
fi
|
2016-09-08 18:28:56 +00:00
|
|
|
if test "x$found_ncurses" = xno; then
|
2017-01-19 15:31:22 +00:00
|
|
|
PKG_CHECK_MODULES(
|
|
|
|
LIBNCURSES,
|
|
|
|
ncursesw,
|
|
|
|
found_ncurses=yes,
|
|
|
|
found_ncurses=no
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
if test "x$found_ncurses" = xyes; then
|
2017-06-09 14:56:50 +00:00
|
|
|
AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $AM_CFLAGS"
|
|
|
|
CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $CFLAGS"
|
2017-02-07 13:40:36 +00:00
|
|
|
LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBS"
|
2017-01-19 15:31:22 +00:00
|
|
|
else
|
2016-09-08 18:28:56 +00:00
|
|
|
# pkg-config didn't work, try ncurses.
|
|
|
|
AC_CHECK_LIB(
|
2017-03-09 22:21:12 +00:00
|
|
|
tinfo,
|
2016-09-08 18:28:56 +00:00
|
|
|
setupterm,
|
|
|
|
found_ncurses=yes,
|
|
|
|
found_ncurses=no
|
|
|
|
)
|
2017-03-09 22:21:12 +00:00
|
|
|
if test "x$found_ncurses" = xno; then
|
|
|
|
AC_CHECK_LIB(
|
|
|
|
ncurses,
|
|
|
|
setupterm,
|
|
|
|
found_ncurses=yes,
|
|
|
|
found_ncurses=no
|
|
|
|
)
|
|
|
|
fi
|
2017-01-19 15:31:22 +00:00
|
|
|
if test "x$found_ncurses" = xyes; then
|
|
|
|
AC_CHECK_HEADER(
|
|
|
|
ncurses.h,
|
|
|
|
LIBS="$LIBS -lncurses",
|
|
|
|
found_ncurses=no)
|
|
|
|
fi
|
2016-09-08 18:28:56 +00:00
|
|
|
fi
|
|
|
|
if test "x$found_ncurses" = xyes; then
|
|
|
|
AC_DEFINE(HAVE_NCURSES_H)
|
|
|
|
else
|
|
|
|
# No ncurses, try curses.
|
|
|
|
AC_CHECK_LIB(
|
|
|
|
curses,
|
|
|
|
setupterm,
|
|
|
|
found_curses=yes,
|
2016-09-02 21:05:06 +00:00
|
|
|
found_curses=no
|
|
|
|
)
|
2016-09-08 18:28:56 +00:00
|
|
|
AC_CHECK_HEADER(
|
|
|
|
curses.h,
|
|
|
|
,
|
|
|
|
found_curses=no)
|
|
|
|
if test "x$found_curses" = xyes; then
|
|
|
|
LIBS="$LIBS -lcurses"
|
|
|
|
AC_DEFINE(HAVE_CURSES_H)
|
|
|
|
else
|
2017-02-07 13:40:36 +00:00
|
|
|
AC_MSG_ERROR("curses not found")
|
2016-09-08 18:28:56 +00:00
|
|
|
fi
|
2011-01-02 15:45:43 +00:00
|
|
|
fi
|
2010-12-31 22:12:33 +00:00
|
|
|
|
2014-02-24 23:09:19 +00:00
|
|
|
# Look for utempter.
|
2016-04-03 22:55:38 +00:00
|
|
|
AC_ARG_ENABLE(
|
|
|
|
utempter,
|
2016-10-17 18:09:38 +00:00
|
|
|
AC_HELP_STRING(--enable-utempter, use utempter if it is installed)
|
2016-04-03 22:55:38 +00:00
|
|
|
)
|
2016-10-17 18:09:38 +00:00
|
|
|
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
|
2016-04-03 22:55:38 +00:00
|
|
|
AC_SEARCH_LIBS(
|
|
|
|
utempter_add_record,
|
|
|
|
utempter,
|
2016-10-17 18:09:38 +00:00
|
|
|
enable_utempter=yes,
|
|
|
|
enable_utempter=no
|
2016-04-03 22:55:38 +00:00
|
|
|
)
|
2017-01-18 14:32:50 +00:00
|
|
|
fi
|
|
|
|
if test "x$enable_utempter" = xyes; then
|
|
|
|
AC_DEFINE(HAVE_UTEMPTER)
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR("utempter not found")
|
2016-03-26 20:17:17 +00:00
|
|
|
fi
|
2014-02-24 23:07:22 +00:00
|
|
|
fi
|
|
|
|
|
2016-09-01 19:40:03 +00:00
|
|
|
# Look for utf8proc.
|
|
|
|
AC_ARG_ENABLE(
|
|
|
|
utf8proc,
|
2016-10-17 18:09:38 +00:00
|
|
|
AC_HELP_STRING(--enable-utf8proc, use utf8proc if it is installed)
|
2016-09-01 19:40:03 +00:00
|
|
|
)
|
2016-10-17 18:09:38 +00:00
|
|
|
if test "x$enable_utf8proc" = xyes; then
|
|
|
|
AC_CHECK_HEADER(utf8proc.h, enable_utf8proc=yes, enable_utf8proc=no)
|
|
|
|
if test "x$enable_utf8proc" = xyes; then
|
2016-09-01 19:40:03 +00:00
|
|
|
AC_SEARCH_LIBS(
|
|
|
|
utf8proc_charwidth,
|
|
|
|
utf8proc,
|
2016-10-17 18:09:38 +00:00
|
|
|
enable_utf8proc=yes,
|
|
|
|
enable_utf8proc=no
|
2016-09-01 19:40:03 +00:00
|
|
|
)
|
2017-01-18 14:32:50 +00:00
|
|
|
fi
|
|
|
|
if test "x$enable_utf8proc" = xyes; then
|
|
|
|
AC_DEFINE(HAVE_UTF8PROC)
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR("utf8proc not found")
|
2016-09-01 19:40:03 +00:00
|
|
|
fi
|
|
|
|
fi
|
2016-10-17 18:09:38 +00:00
|
|
|
AM_CONDITIONAL(HAVE_UTF8PROC, [test "x$enable_utf8proc" = xyes])
|
2016-09-01 19:40:03 +00:00
|
|
|
|
2017-01-22 19:12:15 +00:00
|
|
|
# Check for b64_ntop. If we have b64_ntop, we assume b64_pton as well.
|
2011-07-27 09:31:08 +00:00
|
|
|
AC_MSG_CHECKING(for b64_ntop)
|
|
|
|
AC_TRY_LINK(
|
|
|
|
[
|
|
|
|
#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
|
|
|
|
)
|
|
|
|
if test "x$found_b64_ntop" = xno; then
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(for b64_ntop with -lresolv)
|
2017-10-17 09:35:35 +00:00
|
|
|
OLD_LIBS="$LIBS"
|
2011-07-27 09:31:08 +00:00
|
|
|
LIBS="$LIBS -lresolv"
|
|
|
|
AC_TRY_LINK(
|
|
|
|
[
|
|
|
|
#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
|
|
|
|
)
|
|
|
|
if test "x$found_b64_ntop" = xno; then
|
2017-10-17 09:35:35 +00:00
|
|
|
LIBS="$OLD_LIBS"
|
2011-07-27 09:31:08 +00:00
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test "x$found_b64_ntop" = xyes; then
|
2011-07-22 10:49:33 +00:00
|
|
|
AC_DEFINE(HAVE_B64_NTOP)
|
2011-07-27 09:31:08 +00:00
|
|
|
AC_MSG_RESULT(yes)
|
2017-03-22 19:22:32 +00:00
|
|
|
else
|
|
|
|
AC_LIBOBJ(base64)
|
2011-07-22 10:49:33 +00:00
|
|
|
fi
|
2011-07-27 09:31:08 +00:00
|
|
|
|
|
|
|
# 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 for CMSG_DATA. Some platforms require _XOPEN_SOURCE_EXTENDED (for
|
|
|
|
# example see xopen_networking(7) on HP-UX).
|
|
|
|
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"
|
|
|
|
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)
|
2010-12-31 22:12:33 +00:00
|
|
|
|
2017-03-09 15:39:13 +00:00
|
|
|
# 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)
|
2017-03-09 15:39:13 +00:00
|
|
|
fi
|
|
|
|
|
2017-03-22 21:29:07 +00:00
|
|
|
# Look for imsg_init in libutil.
|
2010-12-31 22:12:33 +00:00
|
|
|
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)
|
2010-12-31 22:12:33 +00:00
|
|
|
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.
|
2010-12-31 22:12:33 +00:00
|
|
|
AC_CHECK_FUNC(daemon, found_daemon=yes, found_daemon=no)
|
2017-03-22 07:42:45 +00:00
|
|
|
AC_CHECK_DECL(
|
|
|
|
daemon,
|
|
|
|
,
|
|
|
|
found_daemon=no,
|
|
|
|
[
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
]
|
|
|
|
)
|
2010-12-31 22:12:33 +00:00
|
|
|
if test "x$found_daemon" = xyes; then
|
|
|
|
AC_DEFINE(HAVE_DAEMON)
|
2017-03-22 19:22:32 +00:00
|
|
|
else
|
|
|
|
AC_LIBOBJ(daemon)
|
2010-12-31 22:12:33 +00:00
|
|
|
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
|
2014-01-06 15:16:57 +00:00
|
|
|
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
|
2014-01-06 15:16:57 +00:00
|
|
|
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
|
2010-12-31 22:12:33 +00:00
|
|
|
AC_DEFINE(HAVE_VIS)
|
2017-03-22 19:22:32 +00:00
|
|
|
else
|
|
|
|
AC_LIBOBJ(vis)
|
|
|
|
AC_LIBOBJ(unvis)
|
2010-12-31 22:12:33 +00:00
|
|
|
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)
|
2010-12-31 22:12:33 +00:00
|
|
|
|
2018-11-21 08:50:22 +00:00
|
|
|
# Look for kinfo_getfile in libutil.
|
|
|
|
AC_SEARCH_LIBS(kinfo_getfile, [util util-freebsd])
|
|
|
|
|
2010-12-31 22:12:33 +00:00
|
|
|
# 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,
|
2010-12-31 22:12:33 +00:00
|
|
|
found_queue_h=yes,
|
|
|
|
found_queue_h=no,
|
2010-12-31 22:31:45 +00:00
|
|
|
[#include <sys/queue.h>]
|
|
|
|
)
|
|
|
|
AC_CHECK_DECL(
|
|
|
|
TAILQ_REPLACE,
|
2010-12-31 22:12:33 +00:00
|
|
|
,
|
|
|
|
found_queue_h=no,
|
2010-12-31 22:31:45 +00:00
|
|
|
[#include <sys/queue.h>]
|
|
|
|
)
|
2010-12-31 22:12:33 +00:00
|
|
|
if test "x$found_queue_h" = xyes; then
|
|
|
|
AC_DEFINE(HAVE_QUEUE_H)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Look for __progname.
|
|
|
|
AC_MSG_CHECKING(for __progname)
|
2011-10-06 12:14:22 +00:00
|
|
|
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
|
|
|
])],
|
2010-12-31 22:12:33 +00:00
|
|
|
[AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
|
2010-12-31 22:31:45 +00:00
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
)
|
2010-12-31 22:12:33 +00:00
|
|
|
|
2016-05-27 17:04:25 +00:00
|
|
|
# Look for program_invocation_short_name.
|
|
|
|
AC_MSG_CHECKING(for program_invocation_short_name)
|
|
|
|
AC_LINK_IFELSE([AC_LANG_SOURCE(
|
|
|
|
[
|
2017-03-18 14:37:37 +00:00
|
|
|
#include <errno.h>
|
2016-05-27 17:04:25 +00:00
|
|
|
#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>]
|
|
|
|
)
|
|
|
|
|
2010-12-31 22:12:33 +00:00
|
|
|
# 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>]
|
|
|
|
)
|
2010-12-31 22:12:33 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2013-04-16 10:33:53 +00:00
|
|
|
# Man page defaults to mdoc.
|
|
|
|
MANFORMAT=mdoc
|
|
|
|
AC_SUBST(MANFORMAT)
|
|
|
|
|
2017-03-22 19:22:32 +00:00
|
|
|
# Figure out the platform.
|
2010-12-31 22:12:33 +00:00
|
|
|
AC_MSG_CHECKING(platform)
|
|
|
|
case "$host_os" in
|
2011-01-10 22:00:47 +00:00
|
|
|
*aix*)
|
|
|
|
AC_MSG_RESULT(aix)
|
|
|
|
PLATFORM=aix
|
|
|
|
;;
|
2010-12-31 22:12:33 +00:00
|
|
|
*darwin*)
|
2010-12-31 22:31:45 +00:00
|
|
|
AC_MSG_RESULT(darwin)
|
|
|
|
PLATFORM=darwin
|
2017-06-06 06:59:53 +00:00
|
|
|
#
|
|
|
|
# OS X 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)
|
2010-12-31 22:31:45 +00:00
|
|
|
;;
|
2011-09-29 08:43:01 +00:00
|
|
|
*dragonfly*)
|
|
|
|
AC_MSG_RESULT(dragonfly)
|
|
|
|
PLATFORM=dragonfly
|
|
|
|
;;
|
2010-12-31 22:12:33 +00:00
|
|
|
*linux*)
|
2010-12-31 22:31:45 +00:00
|
|
|
AC_MSG_RESULT(linux)
|
|
|
|
PLATFORM=linux
|
|
|
|
;;
|
2011-09-29 08:43:01 +00:00
|
|
|
*freebsd*)
|
2010-12-31 22:31:45 +00:00
|
|
|
AC_MSG_RESULT(freebsd)
|
|
|
|
PLATFORM=freebsd
|
|
|
|
;;
|
2010-12-31 22:12:33 +00:00
|
|
|
*netbsd*)
|
2010-12-31 22:31:45 +00:00
|
|
|
AC_MSG_RESULT(netbsd)
|
|
|
|
PLATFORM=netbsd
|
|
|
|
;;
|
2010-12-31 22:12:33 +00:00
|
|
|
*openbsd*)
|
2010-12-31 22:31:45 +00:00
|
|
|
AC_MSG_RESULT(openbsd)
|
|
|
|
PLATFORM=openbsd
|
|
|
|
;;
|
2010-12-31 22:12:33 +00:00
|
|
|
*sunos*)
|
2010-12-31 22:31:45 +00:00
|
|
|
AC_MSG_RESULT(sunos)
|
|
|
|
PLATFORM=sunos
|
|
|
|
;;
|
2011-02-11 23:31:15 +00:00
|
|
|
*solaris*)
|
|
|
|
AC_MSG_RESULT(sunos)
|
|
|
|
PLATFORM=sunos
|
2018-07-02 12:36:44 +00:00
|
|
|
case `/usr/bin/nroff --version 2>&1` in
|
|
|
|
*GNU*)
|
|
|
|
# Solaris 11.4 and later use GNU groff.
|
|
|
|
MANFORMAT=mdoc
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# Solaris 2.0 to 11.3 use AT&T nroff.
|
|
|
|
MANFORMAT=man
|
|
|
|
;;
|
|
|
|
esac
|
2011-02-11 23:31:15 +00:00
|
|
|
;;
|
2011-01-21 20:35:20 +00:00
|
|
|
*hpux*)
|
|
|
|
AC_MSG_RESULT(hpux)
|
|
|
|
PLATFORM=hpux
|
|
|
|
;;
|
2018-01-16 08:29:15 +00:00
|
|
|
*cygwin*|*msys*)
|
2014-03-08 08:44:24 +00:00
|
|
|
AC_MSG_RESULT(cygwin)
|
|
|
|
PLATFORM=cygwin
|
|
|
|
;;
|
2010-12-31 22:12:33 +00:00
|
|
|
*)
|
2010-12-31 22:31:45 +00:00
|
|
|
AC_MSG_RESULT(unknown)
|
|
|
|
PLATFORM=unknown
|
2017-03-22 19:22:32 +00:00
|
|
|
;;
|
2010-12-31 22:12:33 +00:00
|
|
|
esac
|
|
|
|
AC_SUBST(PLATFORM)
|
2011-01-10 22:00:47 +00:00
|
|
|
AM_CONDITIONAL(IS_AIX, test "x$PLATFORM" = xaix)
|
2010-12-31 22:12:33 +00:00
|
|
|
AM_CONDITIONAL(IS_DARWIN, test "x$PLATFORM" = xdarwin)
|
2011-09-29 08:43:01 +00:00
|
|
|
AM_CONDITIONAL(IS_DRAGONFLY, test "x$PLATFORM" = xdragonfly)
|
2010-12-31 22:12:33 +00:00
|
|
|
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)
|
2011-01-21 20:35:20 +00:00
|
|
|
AM_CONDITIONAL(IS_HPUX, test "x$PLATFORM" = xhpux)
|
2010-12-31 22:12:33 +00:00
|
|
|
AM_CONDITIONAL(IS_UNKNOWN, test "x$PLATFORM" = xunknown)
|
|
|
|
|
2016-10-19 14:20:21 +00:00
|
|
|
# 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.
|
2010-12-31 22:12:33 +00:00
|
|
|
AC_OUTPUT(Makefile)
|