From 572a6b21b5a4d4e9587ddfc933449bb89fafeab1 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 3 Nov 2020 08:41:24 +0000 Subject: Back to 3.3. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 768d3db3..93246fc8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # configure.ac -AC_INIT([tmux], 3.2-rc3) +AC_INIT([tmux], next-3.3) AC_PREREQ([2.60]) AC_CONFIG_AUX_DIR(etc) -- cgit From 72c46aa15e50ef6391ab3fe6e230ed3abc9485b0 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 9 Nov 2020 09:00:41 +0000 Subject: Add support for Haiku, from David Carlier. GitHub issue 2453. --- configure.ac | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 93246fc8..cf621835 100644 --- a/configure.ac +++ b/configure.ac @@ -296,12 +296,25 @@ AC_TRY_LINK( found_b64_ntop=yes, found_b64_ntop=no ) +OLD_LIBS="$LIBS" if test "x$found_b64_ntop" = xno; then AC_MSG_RESULT(no) - AC_MSG_CHECKING(for b64_ntop with -lresolv) - OLD_LIBS="$LIBS" - LIBS="$LIBS -lresolv" + LIBS="$OLD_LIBS -lresolv" + AC_TRY_LINK( + [ + #include + #include + #include + ], + [b64_ntop(NULL, 0, NULL, 0);], + found_b64_ntop=yes, + found_b64_ntop=no + ) +fi +if test "x$found_b64_ntop" = xno; then + AC_MSG_CHECKING(for b64_ntop with -lnetwork) + LIBS="$OLD_LIBS -lnetwork" AC_TRY_LINK( [ #include @@ -312,16 +325,14 @@ if test "x$found_b64_ntop" = xno; then found_b64_ntop=yes, found_b64_ntop=no ) - if test "x$found_b64_ntop" = xno; then - LIBS="$OLD_LIBS" - AC_MSG_RESULT(no) - fi fi if test "x$found_b64_ntop" = xyes; then AC_DEFINE(HAVE_B64_NTOP) AC_MSG_RESULT(yes) else + LIBS="$OLD_LIBS" AC_LIBOBJ(base64) + AC_MSG_RESULT(no) fi # Look for networking libraries. @@ -656,6 +667,10 @@ case "$host_os" in AC_MSG_RESULT(cygwin) PLATFORM=cygwin ;; + *haiku*) + AC_MSG_RESULT(haiku) + PLATFORM=haiku + ;; *) AC_MSG_RESULT(unknown) PLATFORM=unknown @@ -671,6 +686,7 @@ 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_HAIKU, test "x$PLATFORM" = xhaiku) AM_CONDITIONAL(IS_UNKNOWN, test "x$PLATFORM" = xunknown) # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user -- cgit From 3eb1519bd784076f63fed6678b88f918317a2124 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 9 Nov 2020 16:41:55 +0000 Subject: Scaffold for oss-fuzz, from Sergey Nizovtsev. --- configure.ac | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index cf621835..97010df4 100644 --- a/configure.ac +++ b/configure.ac @@ -21,6 +21,26 @@ SAVED_CFLAGS="$CFLAGS" SAVED_CPPFLAGS="$CPPFLAGS" SAVED_LDFLAGS="$LDFLAGS" +# Is this oss-fuzz build? +AC_ARG_ENABLE( + fuzzing, + AC_HELP_STRING(--enable-fuzzing, build fuzzers) +) +AC_ARG_VAR( + FUZZING_LIBS, + AC_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) + test "x$CC" == x && CC=clang + test "x$FUZZING_LIBS" == x && \ + FUZZING_LIBS="-fsanitize=fuzzer" + test "x$SAVED_CFLAGS" == x && \ + AM_CFLAGS="-g -fsanitize=fuzzer-no-link,address" +fi + # Set up the compiler in two different ways and say yes we may want to install. AC_PROG_CC AM_PROG_CC_C_O @@ -54,8 +74,11 @@ if test "x$enable_static" = xyes; then LDFLAGS="$AM_LDFLAGS $SAVED_LDFLAGS" fi +# Do we need fuzzers? +AM_CONDITIONAL(NEED_FUZZING, test "x$enable_fuzzing" = xyes) + # Is this gcc? -AM_CONDITIONAL(IS_GCC, test "x$GCC" = xyes) +AM_CONDITIONAL(IS_GCC, test "x$GCC" = xyes -a "x$enable_fuzzing" != xyes) # Is this Sun CC? AC_EGREP_CPP( @@ -117,8 +140,6 @@ AC_REPLACE_FUNCS([ \ getline \ getprogname \ memmem \ - recallocarray \ - reallocarray \ setenv \ setproctitle \ strcasestr \ @@ -130,6 +151,26 @@ AC_REPLACE_FUNCS([ \ ]) AC_FUNC_STRNLEN +# 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 ], + [return (reallocarray(NULL, 1, 1) == NULL);] + )], + AC_MSG_RESULT(yes), + [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])] +) +AC_MSG_CHECKING([for working recallocarray]) +AC_RUN_IFELSE([AC_LANG_PROGRAM( + [#include ], + [return (recallocarray(NULL, 1, 1, 1) == NULL);] + )], + AC_MSG_RESULT(yes), + [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])] +) + # Look for clock_gettime. Must come before event_init. AC_SEARCH_LIBS(clock_gettime, rt) -- cgit From bfdc4373d71895a5f454834da4b0bd92ab964dd4 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 17 Nov 2020 17:56:55 +0000 Subject: Update closefrom from OpenSSH for macOS code which is now needed. --- configure.ac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 97010df4..8dd00d79 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,7 @@ AC_CHECK_HEADERS([ \ dirent.h \ fcntl.h \ inttypes.h \ + libproc.h \ libutil.h \ ndir.h \ paths.h \ @@ -124,7 +125,8 @@ AC_CHECK_FUNCS([ \ dirfd \ flock \ prctl \ - sysconf \ + proc_pidinfo \ + sysconf ]) # Check for functions with a compatibility implementation. -- cgit From a3011be0d267a090c8bfa01a4ebe093bc203a1c4 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 17 Jan 2021 17:21:51 +0000 Subject: Look for libevent2 differently from libevent for platforms with both. --- configure.ac | 81 +++++++++++++++++++++++++----------------------------------- 1 file changed, 33 insertions(+), 48 deletions(-) (limited to 'configure.ac') 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) -- cgit From d4866d5fe6214064882244ddb32f05480e9d8d91 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 17 Jan 2021 17:55:14 +0000 Subject: Fix SEARCH_LIBS. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 80e8be9e..1bd91eb4 100644 --- a/configure.ac +++ b/configure.ac @@ -232,8 +232,8 @@ if test "x$found_ncurses" = xyes; then LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBS" else AC_SEARCH_LIBS( - [tinfo ncurses ncursesw], setupterm, + [tinfo ncurses ncursesw], found_ncurses=yes, found_ncurses=no ) -- cgit From c6bcf3dba52fe0f5e161a9a7cedaae27c7a30845 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 17 Jan 2021 18:19:50 +0000 Subject: Fix yes/no for b64_ntop check. --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 1bd91eb4..e70e3147 100644 --- a/configure.ac +++ b/configure.ac @@ -324,6 +324,7 @@ AC_TRY_LINK( found_b64_ntop=yes, found_b64_ntop=no ) +AC_MSG_RESULT($found_b64_ntop) OLD_LIBS="$LIBS" if test "x$found_b64_ntop" = xno; then AC_MSG_RESULT(no) @@ -339,6 +340,7 @@ if test "x$found_b64_ntop" = xno; then found_b64_ntop=yes, found_b64_ntop=no ) + AC_MSG_RESULT($found_b64_ntop) fi if test "x$found_b64_ntop" = xno; then AC_MSG_CHECKING(for b64_ntop with -lnetwork) @@ -353,14 +355,13 @@ if test "x$found_b64_ntop" = xno; then found_b64_ntop=yes, found_b64_ntop=no ) + AC_MSG_RESULT($found_b64_ntop) fi if test "x$found_b64_ntop" = xyes; then AC_DEFINE(HAVE_B64_NTOP) - AC_MSG_RESULT(yes) else LIBS="$OLD_LIBS" AC_LIBOBJ(base64) - AC_MSG_RESULT(no) fi # Look for networking libraries. -- cgit From 032723c8740710cd34bdf6e7a0124f8fb18f6d70 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 17 Jan 2021 18:21:54 +0000 Subject: Set CFLAGS also. --- configure.ac | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index e70e3147..d18a584d 100644 --- a/configure.ac +++ b/configure.ac @@ -190,6 +190,8 @@ PKG_CHECK_MODULES( [ AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS" CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS" + AM_CFLAGS="$LIBEVENT_CFLAGS $AM_CFLAGS" + CFLAGS="$AM_CFLAGS $SAVED_CFLAGS" LIBS="$LIBEVENT_LIBS $LIBS" found_libevent=yes ], @@ -229,6 +231,8 @@ PKG_CHECK_MODULES( if test "x$found_ncurses" = xyes; then AM_CPPFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $AM_CPPFLAGS" CPPFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $SAVED_CPPFLAGS" + AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $AM_CFLAGS" + CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $SAVED_CFLAGS" LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBS" else AC_SEARCH_LIBS( -- cgit From b18834be8aadbf133206e5db256d76acac398da7 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 17 Jan 2021 18:24:52 +0000 Subject: Revert "Set CFLAGS also." This reverts commit 032723c8740710cd34bdf6e7a0124f8fb18f6d70. --- configure.ac | 4 ---- 1 file changed, 4 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index d18a584d..e70e3147 100644 --- a/configure.ac +++ b/configure.ac @@ -190,8 +190,6 @@ PKG_CHECK_MODULES( [ AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS" CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS" - AM_CFLAGS="$LIBEVENT_CFLAGS $AM_CFLAGS" - CFLAGS="$AM_CFLAGS $SAVED_CFLAGS" LIBS="$LIBEVENT_LIBS $LIBS" found_libevent=yes ], @@ -231,8 +229,6 @@ PKG_CHECK_MODULES( if test "x$found_ncurses" = xyes; then AM_CPPFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $AM_CPPFLAGS" CPPFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $SAVED_CPPFLAGS" - AM_CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $AM_CFLAGS" - CFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $SAVED_CFLAGS" LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBS" else AC_SEARCH_LIBS( -- cgit From 4148417a2a0fdf2cc839568185150bb4a9203d5d Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 17 Jan 2021 19:03:18 +0000 Subject: PKG_CHECK_MODULES needs to be separate. --- configure.ac | 64 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 12 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index e70e3147..a2591857 100644 --- a/configure.ac +++ b/configure.ac @@ -185,16 +185,29 @@ AC_LIBOBJ(getopt) # Look for libevent. Try libevent_core or libevent with pkg-config first then # look for the library. PKG_CHECK_MODULES( - LIBEVENT, - [libevent_core >= 2 libevent >= 2], + LIBEVENT_CORE, + [libevent_core >= 2], [ - AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS" + AM_CPPFLAGS="$LIBEVENT_CORE_CFLAGS $AM_CPPFLAGS" CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS" - LIBS="$LIBEVENT_LIBS $LIBS" + LIBS="$LIBEVENT_CORE_LIBS $LIBS" 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, @@ -221,16 +234,43 @@ fi # Look for ncurses or curses. Try pkg-config first then directly for the # library. PKG_CHECK_MODULES( - LIBNCURSES, - [tinfo ncurses ncursesw], - found_ncurses=yes, + LIBTINFO, + tinfo, + [ + AM_CPPFLAGS="$LIBTINFO_CFLAGS $AM_CPPFLAGS" + CPPFLAGS="$LIBTINFO_CFLAGS $SAVED_CPPFLAGS" + LIBS="$LIBTINFO_LIBS $LIBS" + found_ncurses=yes + ], found_ncurses=no ) -if test "x$found_ncurses" = xyes; then - AM_CPPFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $AM_CPPFLAGS" - CPPFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $SAVED_CPPFLAGS" - LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBS" -else +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 + ], + 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 ncurses ncursesw], -- cgit From 63f4a3c4e53b7d6aeb09917c0971af2df6549f31 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 18 Jan 2021 10:48:49 +0000 Subject: Extra result message. --- configure.ac | 1 - 1 file changed, 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index a2591857..269dd5aa 100644 --- a/configure.ac +++ b/configure.ac @@ -367,7 +367,6 @@ AC_TRY_LINK( AC_MSG_RESULT($found_b64_ntop) OLD_LIBS="$LIBS" if test "x$found_b64_ntop" = xno; then - AC_MSG_RESULT(no) AC_MSG_CHECKING(for b64_ntop with -lresolv) LIBS="$OLD_LIBS -lresolv" AC_TRY_LINK( -- cgit From e3d71d9bdfa31fb658794759f07af43d53253e5f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 5 Feb 2021 11:00:45 +0000 Subject: Add compat clock_gettime for older macOS. GitHub issue 2555. --- configure.ac | 1 + 1 file changed, 1 insertion(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 269dd5aa..4175f5c8 100644 --- a/configure.ac +++ b/configure.ac @@ -133,6 +133,7 @@ AC_CHECK_FUNCS([ \ AC_REPLACE_FUNCS([ \ asprintf \ cfmakeraw \ + clock_gettime \ closefrom \ explicit_bzero \ fgetln \ -- cgit