Look for libevent2 differently from libevent for platforms with both.

pull/2546/head
Nicholas Marriott 2021-01-17 17:21:51 +00:00
parent dc1e1125a5
commit a3011be0d2
22 changed files with 48 additions and 70 deletions

View File

@ -18,7 +18,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <event.h>
#include <stdlib.h> #include <stdlib.h>
#include "tmux.h" #include "tmux.h"

View File

@ -24,7 +24,6 @@
#include <sys/file.h> #include <sys/file.h>
#include <errno.h> #include <errno.h>
#include <event.h>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -27,6 +27,19 @@
#include <termios.h> #include <termios.h>
#include <wchar.h> #include <wchar.h>
#ifdef HAVE_EVENT2_EVENT_H
#include <event2/event.h>
#include <event2/event_compat.h>
#include <event2/event_struct.h>
#include <event2/buffer.h>
#include <event2/buffer_compat.h>
#include <event2/bufferevent.h>
#include <event2/bufferevent_struct.h>
#include <event2/bufferevent_compat.h>
#else
#include <event.h>
#endif
#ifdef HAVE_MALLOC_TRIM #ifdef HAVE_MALLOC_TRIM
#include <malloc.h> #include <malloc.h>
#endif #endif

View File

@ -182,88 +182,72 @@ AC_SEARCH_LIBS(clock_gettime, rt)
# implementations. # implementations.
AC_LIBOBJ(getopt) AC_LIBOBJ(getopt)
# Look for libevent. # Look for libevent. Try libevent_core or libevent with pkg-config first then
# look for the library.
PKG_CHECK_MODULES( PKG_CHECK_MODULES(
LIBEVENT, LIBEVENT,
libevent, [libevent_core >= 2 libevent >= 2],
[ [
AM_CFLAGS="$LIBEVENT_CFLAGS $AM_CFLAGS" AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS"
CFLAGS="$AM_CFLAGS $SAVED_CFLAGS" CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
LIBS="$LIBEVENT_LIBS $LIBS" LIBS="$LIBEVENT_LIBS $LIBS"
found_libevent=yes found_libevent=yes
], ],
found_libevent=no
)
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),
[ [
AC_SEARCH_LIBS( AC_CHECK_HEADER(
event_init, event.h,
[event event-1.4 event2], AC_DEFINE(HAVE_EVENT_H),
found_libevent=yes,
found_libevent=no found_libevent=no
) )
] ]
) )
AC_CHECK_HEADER(
event.h,
,
found_libevent=no
)
if test "x$found_libevent" = xno; then if test "x$found_libevent" = xno; then
AC_MSG_ERROR("libevent not found") AC_MSG_ERROR("libevent not found")
fi fi
# Look for ncurses. # Look for ncurses or curses. Try pkg-config first then directly for the
# library.
PKG_CHECK_MODULES( PKG_CHECK_MODULES(
LIBTINFO, LIBNCURSES,
tinfo, [tinfo ncurses ncursesw],
found_ncurses=yes, found_ncurses=yes,
found_ncurses=no found_ncurses=no
) )
if test "x$found_ncurses" = xno; then
PKG_CHECK_MODULES(
LIBNCURSES,
ncurses,
found_ncurses=yes,
found_ncurses=no
)
fi
if test "x$found_ncurses" = xno; then
PKG_CHECK_MODULES(
LIBNCURSES,
ncursesw,
found_ncurses=yes,
found_ncurses=no
)
fi
if test "x$found_ncurses" = xyes; then if test "x$found_ncurses" = xyes; then
AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $AM_CFLAGS" AM_CPPFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $AM_CPPFLAGS"
CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $CFLAGS" CPPFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $SAVED_CPPFLAGS"
LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBS" LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBS"
else else
# pkg-config didn't work, try ncurses. AC_SEARCH_LIBS(
AC_CHECK_LIB( [tinfo ncurses ncursesw],
tinfo,
setupterm, setupterm,
found_ncurses=yes, found_ncurses=yes,
found_ncurses=no found_ncurses=no
) )
if test "x$found_ncurses" = xno; then
AC_CHECK_LIB(
ncurses,
setupterm,
found_ncurses=yes,
found_ncurses=no
)
fi
if test "x$found_ncurses" = xyes; then if test "x$found_ncurses" = xyes; then
AC_CHECK_HEADER( AC_CHECK_HEADER(
ncurses.h, ncurses.h,
LIBS="$LIBS -lncurses", LIBS="$LIBS -lncurses",
found_ncurses=no) found_ncurses=no
)
fi fi
fi fi
if test "x$found_ncurses" = xyes; then if test "x$found_ncurses" = xyes; then
AC_DEFINE(HAVE_NCURSES_H) AC_DEFINE(HAVE_NCURSES_H)
else else
# No ncurses, try curses.
AC_CHECK_LIB( AC_CHECK_LIB(
curses, curses,
setupterm, setupterm,
@ -273,7 +257,8 @@ else
AC_CHECK_HEADER( AC_CHECK_HEADER(
curses.h, curses.h,
, ,
found_curses=no) found_curses=no
)
if test "x$found_curses" = xyes; then if test "x$found_curses" = xyes; then
LIBS="$LIBS -lcurses" LIBS="$LIBS -lcurses"
AC_DEFINE(HAVE_CURSES_H) AC_DEFINE(HAVE_CURSES_H)

View File

@ -19,7 +19,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <event.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>

View File

@ -19,7 +19,6 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <event.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>

View File

@ -20,7 +20,6 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <Availability.h> #include <Availability.h>
#include <event.h>
#include <libproc.h> #include <libproc.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -23,7 +23,6 @@
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <event.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -24,7 +24,6 @@
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <event.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -18,7 +18,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <event.h>
#include <unistd.h> #include <unistd.h>
#include <kernel/OS.h> #include <kernel/OS.h>

View File

@ -18,8 +18,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <event.h>
#include "tmux.h" #include "tmux.h"
char * char *

View File

@ -20,7 +20,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/param.h> #include <sys/param.h>
#include <event.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>

View File

@ -22,7 +22,6 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <errno.h> #include <errno.h>
#include <event.h>
#include <limits.h> #include <limits.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -23,11 +23,12 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <event.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include "compat.h"
#ifndef nitems #ifndef nitems
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
#endif #endif

View File

@ -19,7 +19,6 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <event.h>
#include <fcntl.h> #include <fcntl.h>
#include <procfs.h> #include <procfs.h>
#include <stdio.h> #include <stdio.h>

View File

@ -18,8 +18,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <event.h>
#include "tmux.h" #include "tmux.h"
char * char *

1
proc.c
View File

@ -21,7 +21,6 @@
#include <sys/utsname.h> #include <sys/utsname.h>
#include <errno.h> #include <errno.h>
#include <event.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -259,7 +259,6 @@ screen_write_start_callback(struct screen_write_ctx *ctx, struct screen *s,
} }
} }
/* Initialize writing. */ /* Initialize writing. */
void void
screen_write_start(struct screen_write_ctx *ctx, struct screen *s) screen_write_start(struct screen_write_ctx *ctx, struct screen *s)

View File

@ -21,7 +21,6 @@
#include <sys/uio.h> #include <sys/uio.h>
#include <errno.h> #include <errno.h>
#include <event.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -24,7 +24,6 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <errno.h> #include <errno.h>
#include <event.h>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>

1
tmux.c
View File

@ -21,7 +21,6 @@
#include <sys/utsname.h> #include <sys/utsname.h>
#include <errno.h> #include <errno.h>
#include <event.h>
#include <fcntl.h> #include <fcntl.h>
#include <langinfo.h> #include <langinfo.h>
#include <locale.h> #include <locale.h>

1
tmux.h
View File

@ -22,7 +22,6 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <event.h>
#include <limits.h> #include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>