diff options
author | nia <nia@netbsd.org> | 2020-09-04 12:55:20 +0200 |
---|---|---|
committer | nia <nia@netbsd.org> | 2020-09-04 12:55:20 +0200 |
commit | 52e9be4abc7b0de357bc73d2e88696a97de7e4db (patch) | |
tree | 5566787dd84d648afe8dfa779c55c721b4250551 | |
parent | 4f1caeca1ed1f66fd747d9cd67fa5ed90c2bb475 (diff) | |
download | profani-tty-52e9be4abc7b0de357bc73d2e88696a97de7e4db.tar.gz |
Basic support for building on NetBSD.
- Add NetBSD as a recognized platform without -ldl. - Allow building with NetBSD libcurses instead of ncurses. - Portability to NetBSD sh - use POSIX '=' instead of '=='.
-rw-r--r-- | configure.ac | 22 | ||||
-rw-r--r-- | src/common.c | 2 | ||||
-rw-r--r-- | src/config/color.c | 2 | ||||
-rw-r--r-- | src/config/theme.c | 2 | ||||
-rw-r--r-- | src/ui/buffer.c | 2 | ||||
-rw-r--r-- | src/ui/console.c | 2 | ||||
-rw-r--r-- | src/ui/core.c | 2 | ||||
-rw-r--r-- | src/ui/inputwin.c | 2 | ||||
-rw-r--r-- | src/ui/screen.c | 2 | ||||
-rw-r--r-- | src/ui/statusbar.c | 2 | ||||
-rw-r--r-- | src/ui/win_types.h | 2 | ||||
-rw-r--r-- | src/ui/window.c | 2 | ||||
-rw-r--r-- | src/ui/window.h | 2 |
13 files changed, 37 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index 19f51764..fb9fbbb6 100644 --- a/configure.ac +++ b/configure.ac @@ -22,6 +22,7 @@ AC_CANONICAL_HOST PLATFORM="unknown" AS_CASE([$host_os], [freebsd*], [PLATFORM="freebsd"], + [netbsd*], [PLATFORM="netbsd"], [openbsd*], [PLATFORM="openbsd"], [darwin*], [PLATFORM="osx"], [cygwin], [PLATFORM="cygwin"], @@ -81,7 +82,7 @@ elif test "x$enable_python_plugins" != xno; then rm -f Python.framework ln -s $PYTHON_FRAMEWORK Python.framework ]) AC_CHECK_PROG(PYTHON_CONFIG_EXISTS, python-config, yes, no) - if test "$PYTHON_CONFIG_EXISTS" == "yes"; then + if test "$PYTHON_CONFIG_EXISTS" = "yes"; then AX_PYTHON_DEVEL AM_CONDITIONAL([BUILD_PYTHON_API], [true]) AC_DEFINE([HAVE_PYTHON], [1], [Python support]) @@ -106,9 +107,9 @@ else if test "x$enable_plugins" = xno; then AM_CONDITIONAL([BUILD_C_API], [false]) elif test "x$enable_c_plugins" != xno; then - # libdl doesn't exist as a separate library in OpenBSD/FreeBSD and is + # libdl doesn't exist as a separate library in the BSDs and is # provided in the standard libraries. - AS_IF([test "x$PLATFORM" = xopenbsd -o "x$PLATFORM" = xfreebsd], + AS_IF([test "x$PLATFORM" = xopenbsd -o "x$PLATFORM" = xfreebsd -o "x$PLATFORM" = xnetbsd], [AM_CONDITIONAL([BUILD_C_API], [true]) AC_DEFINE([HAVE_C], [1], [C support])], [AC_CHECK_LIB([dl], [main], [AM_CONDITIONAL([BUILD_C_API], [true]) LIBS="$LIBS -ldl" AC_DEFINE([HAVE_C], [1], [C support])], @@ -160,21 +161,23 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([[ [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([${XMPP_LIB} is broken, check config.log for details])]) -### Check for ncurses library +### Check for curses library PKG_CHECK_MODULES([ncursesw], [ncursesw], - [NCURSES_CFLAGS="$ncursesw_CFLAGS"; NCURSES_LIBS="$ncursesw_LIBS"; NCURSES="ncursesw"], + [NCURSES_CFLAGS="$ncursesw_CFLAGS"; NCURSES_LIBS="$ncursesw_LIBS"; CURSES="ncursesw"], [PKG_CHECK_MODULES([ncurses], [ncurses], - [NCURSES_CFLAGS="$ncurses_CFLAGS"; NCURSES_LIBS="$ncurses_LIBS"; NCURSES="ncurses"], + [NCURSES_CFLAGS="$ncurses_CFLAGS"; NCURSES_LIBS="$ncurses_LIBS"; CURSES="ncurses"], [AC_CHECK_LIB([ncursesw], [main], [], [AC_CHECK_LIB([ncurses], [main], [], - [AC_MSG_ERROR([ncurses is required for profanity])])])])]) + [AC_CHECK_LIB([curses], [main], + [LIBS="$LIBS -lcurses"; CURSES="curses"], + [AC_MSG_ERROR([ncurses or curses is required for profanity])])])])])]) AM_CPPFLAGS="$AM_CPPFLAGS $NCURSES_CFLAGS" LIBS="$NCURSES_LIBS $LIBS" -### Check wide characters support in ncurses library +### Check wide characters support in curses library CFLAGS_RESTORE="$CFLAGS" CFLAGS="$CFLAGS $NCURSES_CFLAGS" -AC_CACHE_CHECK([for wget_wch support in $NCURSES], ncurses_cv_wget_wch, +AC_CACHE_CHECK([for wget_wch support in $CURSES], ncurses_cv_wget_wch, [AC_LINK_IFELSE([AC_LANG_SOURCE([ void wget_wch(void); int main() { @@ -354,6 +357,7 @@ AC_CHECK_LIB([expect], [exp_expectl], [AM_CONDITIONAL([HAVE_EXPECT], [true])], ### Check for ncursesw/ncurses.h first, Arch linux uses ncurses.h for ncursesw AC_CHECK_HEADERS([ncursesw/ncurses.h], [], []) AC_CHECK_HEADERS([ncurses.h], [], []) +AC_CHECK_HEADERS([curses.h], [], []) ### Default parameters AM_CFLAGS="-Wall -Wno-deprecated-declarations -std=gnu99" diff --git a/src/common.c b/src/common.c index 5825c0ca..d339a37a 100644 --- a/src/common.c +++ b/src/common.c @@ -54,6 +54,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "log.h" diff --git a/src/config/color.c b/src/config/color.c index 790febc7..63089fd8 100644 --- a/src/config/color.c +++ b/src/config/color.c @@ -46,6 +46,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "config/color.h" diff --git a/src/config/theme.c b/src/config/theme.c index 147b31c2..2ec256ad 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -45,6 +45,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "common.h" diff --git a/src/ui/buffer.c b/src/ui/buffer.c index f78168ac..58399a69 100644 --- a/src/ui/buffer.c +++ b/src/ui/buffer.c @@ -46,6 +46,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "ui/window.h" diff --git a/src/ui/console.c b/src/ui/console.c index bd149f3d..a9966bcd 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -42,6 +42,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "common.h" diff --git a/src/ui/core.c b/src/ui/core.c index d4893f67..4bbb23de 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -55,6 +55,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "log.h" diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index 45cd3313..44a1ac47 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -52,6 +52,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "profanity.h" diff --git a/src/ui/screen.c b/src/ui/screen.c index 8a676082..a7be6c2a 100644 --- a/src/ui/screen.c +++ b/src/ui/screen.c @@ -39,6 +39,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "config/preferences.h" diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c index 146cc1ea..3dfdf086 100644 --- a/src/ui/statusbar.c +++ b/src/ui/statusbar.c @@ -44,6 +44,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "config/theme.h" diff --git a/src/ui/win_types.h b/src/ui/win_types.h index d4196111..7beaca5f 100644 --- a/src/ui/win_types.h +++ b/src/ui/win_types.h @@ -45,6 +45,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "tools/autocomplete.h" diff --git a/src/ui/window.c b/src/ui/window.c index 06194012..860633de 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -48,6 +48,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "log.h" diff --git a/src/ui/window.h b/src/ui/window.h index 17316b05..c731d19b 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -45,6 +45,8 @@ #include <ncursesw/ncurses.h> #elif HAVE_NCURSES_H #include <ncurses.h> +#elif HAVE_CURSES_H +#include <curses.h> #endif #include "ui/ui.h" |