From 9722743aa38475447188dfbbeaf7cabe76475be6 Mon Sep 17 00:00:00 2001 From: Abishek V Ashok Date: Wed, 28 Dec 2022 20:19:41 +0530 Subject: [PATCH 1/2] Bug fix: Linker errors using automake in Mac OS Fix linker issues that prevent compillation with gcc from succeeding using autotools. This allows compilation to succeeed in Mac OS - haven't tested on linux yet. Fixes: #161 Signed-off-by: Abishek V Ashok --- configure.ac | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0565a52..b635b1c 100644 --- a/configure.ac +++ b/configure.ac @@ -6,11 +6,16 @@ AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE AC_CANONICAL_HOST +host_osx=no +native_windows=no case $host in *mingw*) + native_windows=yes + ;; + *darwin*) + host_osx=yes ;; *) - native_windows=no ;; esac @@ -83,6 +88,11 @@ if test x$native_windows != xno; then CFLAGS="$CFLAGS -static" fi +dnl Add -D_XOPEN_SOURCE_EXTENDED to enable wide char support in Mac OS +if test x$host_osx != xno; then + CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" +fi + dnl cmatrix terminal font disable option (default enabled) AC_ARG_WITH([fonts], AS_HELP_STRING([--without-fonts], [Install cmatrix without cmatrix font]), From 52495a1f2027d6cd3c2a5b57b40ce5a6bdfd35e3 Mon Sep 17 00:00:00 2001 From: Abishek V Ashok Date: Thu, 29 Dec 2022 13:26:23 +0530 Subject: [PATCH 2/2] Adds checks for libncursesw Adds checks for libncursesw as some linux distributions like ubuntu package wide character support for ncurses as a seperate library. Display a warning if on linux and the package is absent. Signed-off-by: Abishek V Ashok --- configure.ac | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index b635b1c..38caec3 100644 --- a/configure.ac +++ b/configure.ac @@ -7,11 +7,15 @@ AM_INIT_AUTOMAKE AC_CANONICAL_HOST host_osx=no +host_linux=no native_windows=no case $host in *mingw*) native_windows=yes ;; + *linux*) + host_linux=yes + ;; *darwin*) host_osx=yes ;; @@ -25,9 +29,24 @@ AC_PROG_INSTALL AC_PROG_MAKE_SET dnl Checks for libraries. -dnl Replace `main' with a function in -lncurses: +FOUND_NCURSESW=no +AC_CHECK_LIB(ncursesew, waddnwstr, FOUND_NCURSESW=yes) AC_CHECK_LIB(ncurses, main) +dnl wide character support for ncurses is found in seperate library ncursesw in +dnl some linux distributions like ubuntu, warn if it is not present in that case +if test x$FOUND_NCURSESW = xno; then + if test x$host_linux = xyes; then + AC_MSG_WARN([ + +*** ncurses with wide character support is packaged as a seperate library (ncursesw) +*** on some linux distributions such as ubunutu. If you face compilation errors, +*** please install the library. + +]) + fi +fi + dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h termios.h termio.h getopt.h) @@ -40,7 +59,7 @@ dnl Checks for libraries. AC_CHECK_HEADERS(curses.h ncurses.h) CURSES_LIB_NAME="" -AC_CHECK_LIB(ncurses, tgetent, CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses) +AC_CHECK_LIB(ncurses, tgetent, CURSES_LIB="-lncursesw" CURSES_LIB=ncursesw) if eval "test x$CURSES_LIB_NAME = x" then