summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2021-01-17 17:21:51 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2021-01-17 17:21:51 +0000
commita3011be0d267a090c8bfa01a4ebe093bc203a1c4 (patch)
tree990fbfa2a16bd0c975679ece1bca5e8a21e96056
parentdc1e1125a55af9a928a7cbe99026ad500c4271b1 (diff)
Look for libevent2 differently from libevent for platforms with both.
-rw-r--r--alerts.c1
-rw-r--r--client.c1
-rw-r--r--compat.h13
-rw-r--r--configure.ac81
-rw-r--r--control.c1
-rw-r--r--osdep-cygwin.c1
-rw-r--r--osdep-darwin.c1
-rw-r--r--osdep-dragonfly.c1
-rw-r--r--osdep-freebsd.c1
-rw-r--r--osdep-haiku.c1
-rw-r--r--osdep-hpux.c2
-rw-r--r--osdep-linux.c1
-rw-r--r--osdep-netbsd.c1
-rw-r--r--osdep-openbsd.c3
-rw-r--r--osdep-sunos.c1
-rw-r--r--osdep-unknown.c2
-rw-r--r--proc.c1
-rw-r--r--screen-write.c1
-rw-r--r--server-client.c1
-rw-r--r--server.c1
-rw-r--r--tmux.c1
-rw-r--r--tmux.h1
22 files changed, 48 insertions, 70 deletions
diff --git a/alerts.c b/alerts.c
index 0f2eb179..4cc5c3eb 100644
--- a/alerts.c
+++ b/alerts.c
@@ -18,7 +18,6 @@
#include <sys/types.h>
-#include <event.h>
#include <stdlib.h>
#include "tmux.h"
diff --git a/client.c b/client.c
index 757e4aa8..8b17aa22 100644
--- a/client.c
+++ b/client.c
@@ -24,7 +24,6 @@
#include <sys/file.h>
#include <errno.h>
-#include <event.h>
#include <fcntl.h>
#include <signal.h>
#include <stdlib.h>
diff --git a/compat.h b/compat.h
index 6e26a02c..828c956d 100644
--- a/compat.h
+++ b/compat.h
@@ -27,6 +27,19 @@
#include <termios.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
#include <malloc.h>
#endif
diff --git a/configure.ac b/configure.ac
index 8dd00d79..80e8be9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,88 +182,72 @@ AC_SEARCH_LIBS(clock_gettime, rt)
# implementations.
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(
LIBEVENT,
- libevent,
+ [libevent_core >= 2 libevent >= 2],
[
- AM_CFLAGS="$LIBEVENT_CFLAGS $AM_CFLAGS"
- CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
+ AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS"
+ CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
LIBS="$LIBEVENT_LIBS $LIBS"
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(
- event_init,
- [event event-1.4 event2],
- found_libevent=yes,
+ AC_CHECK_HEADER(
+ event.h,
+ AC_DEFINE(HAVE_EVENT_H),
found_libevent=no
)
]
)
-AC_CHECK_HEADER(
- event.h,
- ,
- found_libevent=no
-)
if test "x$found_libevent" = xno; then
AC_MSG_ERROR("libevent not found")
fi
-# Look for ncurses.
+# Look for ncurses or curses. Try pkg-config first then directly for the
+# library.
PKG_CHECK_MODULES(
- LIBTINFO,
- tinfo,
+ LIBNCURSES,
+ [tinfo ncurses ncursesw],
found_ncurses=yes,
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
- AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $AM_CFLAGS"
- CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $CFLAGS"
+ AM_CPPFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $AM_CPPFLAGS"
+ CPPFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $SAVED_CPPFLAGS"
LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBS"
else
- # pkg-config didn't work, try ncurses.
- AC_CHECK_LIB(
- tinfo,
+ AC_SEARCH_LIBS(
+ [tinfo ncurses ncursesw],
setupterm,
found_ncurses=yes,
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
AC_CHECK_HEADER(
ncurses.h,
LIBS="$LIBS -lncurses",
- found_ncurses=no)
+ found_ncurses=no
+ )
fi
fi
if test "x$found_ncurses" = xyes; then
AC_DEFINE(HAVE_NCURSES_H)
else
- # No ncurses, try curses.
AC_CHECK_LIB(
curses,
setupterm,
@@ -273,7 +257,8 @@ else
AC_CHECK_HEADER(
curses.h,
,
- found_curses=no)
+ found_curses=no
+ )
if test "x$found_curses" = xyes; then
LIBS="$LIBS -lcurses"
AC_DEFINE(HAVE_CURSES_H)
diff --git a/control.c b/control.c
index e86429cf..7a5b9eb2 100644
--- a/control.c
+++ b/control.c
@@ -19,7 +19,6 @@
#include <sys/types.h>
-#include <event.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
diff --git a/osdep-cygwin.c b/osdep-cygwin.c
index 60630b33..4346373c 100644
--- a/osdep-cygwin.c
+++ b/osdep-cygwin.c
@@ -19,7 +19,6 @@
#include <sys/param.h>
#include <sys/stat.h>
-#include <event.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/osdep-darwin.c b/osdep-darwin.c
index 6b2b1d72..85e5470b 100644
--- a/osdep-darwin.c
+++ b/osdep-darwin.c
@@ -20,7 +20,6 @@
#include <sys/sysctl.h>
#include <Availability.h>
-#include <event.h>
#include <libproc.h>
#include <stdlib.h>
#include <string.h>
diff --git a/osdep-dragonfly.c b/osdep-dragonfly.c
index 879034e8..02a4d18e 100644
--- a/osdep-dragonfly.c
+++ b/osdep-dragonfly.c
@@ -23,7 +23,6 @@
#include <err.h>
#include <errno.h>
-#include <event.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
diff --git a/osdep-freebsd.c b/osdep-freebsd.c
index a7d02930..0f347f9a 100644
--- a/osdep-freebsd.c
+++ b/osdep-freebsd.c
@@ -24,7 +24,6 @@
#include <err.h>
#include <errno.h>
-#include <event.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
diff --git a/osdep-haiku.c b/osdep-haiku.c
index 298dc05e..7b1f800a 100644
--- a/osdep-haiku.c
+++ b/osdep-haiku.c
@@ -18,7 +18,6 @@
#include <sys/types.h>
-#include <event.h>
#include <unistd.h>
#include <kernel/OS.h>
diff --git a/osdep-hpux.c b/osdep-hpux.c
index 16993b93..64e33784 100644
--- a/osdep-hpux.c
+++ b/osdep-hpux.c
@@ -18,8 +18,6 @@
#include <sys/types.h>
-#include <event.h>
-
#include "tmux.h"
char *
diff --git a/osdep-linux.c b/osdep-linux.c
index 5f0d9352..7dbab1f0 100644
--- a/osdep-linux.c
+++ b/osdep-linux.c
@@ -20,7 +20,6 @@
#include <sys/stat.h>
#include <sys/param.h>
-#include <event.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/osdep-netbsd.c b/osdep-netbsd.c
index 67894175..b473e017 100644
--- a/osdep-netbsd.c
+++ b/osdep-netbsd.c
@@ -22,7 +22,6 @@
#include <sys/sysctl.h>
#include <errno.h>
-#include <event.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
diff --git a/osdep-openbsd.c b/osdep-openbsd.c
index b21a6628..f5c61372 100644
--- a/osdep-openbsd.c
+++ b/osdep-openbsd.c
@@ -23,11 +23,12 @@
#include <sys/stat.h>
#include <errno.h>
-#include <event.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include "compat.h"
+
#ifndef nitems
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
#endif
diff --git a/osdep-sunos.c b/osdep-sunos.c
index 07043a9b..138e6bad 100644
--- a/osdep-sunos.c
+++ b/osdep-sunos.c
@@ -19,7 +19,6 @@
#include <sys/param.h>
#include <sys/stat.h>
-#include <event.h>
#include <fcntl.h>
#include <procfs.h>
#include <stdio.h>
diff --git a/osdep-unknown.c b/osdep-unknown.c
index bc59f569..440f619e 100644
--- a/osdep-unknown.c
+++ b/osdep-unknown.c
@@ -18,8 +18,6 @@
#include <sys/types.h>
-#include <event.h>
-
#include "tmux.h"
char *
diff --git a/proc.c b/proc.c
index 592d8e05..6d64b0bb 100644
--- a/proc.c
+++ b/proc.c
@@ -21,7 +21,6 @@
#include <sys/utsname.h>
#include <errno.h>
-#include <event.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
diff --git a/screen-write.c b/screen-write.c
index 92f1aa39..f374630c 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -259,7 +259,6 @@ screen_write_start_callback(struct screen_write_ctx *ctx, struct screen *s,
}
}
-
/* Initialize writing. */
void
screen_write_start(struct screen_write_ctx *ctx, struct screen *s)
diff --git a/server-client.c b/server-client.c
index 451fe2eb..75a5719c 100644
--- a/server-client.c
+++ b/server-client.c
@@ -21,7 +21,6 @@
#include <sys/uio.h>
#include <errno.h>
-#include <event.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
diff --git a/server.c b/server.c
index 9a1875f4..6aee61fc 100644
--- a/server.c
+++ b/server.c
@@ -24,7 +24,6 @@
#include <sys/wait.h>
#include <errno.h>
-#include <event.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
diff --git a/tmux.c b/tmux.c
index 066714df..96b94e01 100644
--- a/tmux.c
+++ b/tmux.c
@@ -21,7 +21,6 @@
#include <sys/utsname.h>
#include <errno.h>
-#include <event.h>
#include <fcntl.h>
#include <langinfo.h>
#include <locale.h>
diff --git a/tmux.h b/tmux.h
index 2fdf7eb6..0d7d8f48 100644
--- a/tmux.h
+++ b/tmux.h
@@ -22,7 +22,6 @@
#include <sys/time.h>
#include <sys/uio.h>
-#include <event.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>