aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2025-10-06 18:40:55 +0300
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2025-10-06 18:40:55 +0300
commitbd3d9e6e35608791465cef02813a97407ebd06bb (patch)
treefb095ce69d8a1f7c13413b60d9158443327ccb3e
parent2c85cacdcdcbd13d3dcf9fdb124286bc20a5500d (diff)
downloadsciteco-bd3d9e6e35608791465cef02813a97407ebd06bb.tar.gz
AX_WITH_NCURSES: support $CURSES_CFLAGS and $CURSES_LIBS
* We wouldn't detect the correct flags (ax_cv_curses_enhanced and ax_cv_curses_color) when CURSES_CFLAGS and CURSES_LIBS are given. * Allows to force ncurses to the SDK/system one when building for OS X (20-freebsd14-osx-sciteco).
-rwxr-xr-x.fmsbw/20-freebsd14-osx-sciteco6
-rw-r--r--m4/ax_with_ncurses.m4152
2 files changed, 62 insertions, 96 deletions
diff --git a/.fmsbw/20-freebsd14-osx-sciteco b/.fmsbw/20-freebsd14-osx-sciteco
index 0173924..a3eea1f 100755
--- a/.fmsbw/20-freebsd14-osx-sciteco
+++ b/.fmsbw/20-freebsd14-osx-sciteco
@@ -47,9 +47,12 @@ mkdir build-osx
cd build-osx
# FIXME: Perhaps SciTECO's configure.ac should use PKG_CHECK_MODULES_STATIC()
# whenever --enable-static-executables is used.
+# NOTE: Make sure we pick up the SDK's ncurses instead of the one pulled in
+# via MacPorts.
../configure --host=x86_64-apple-darwin25 --disable-bootstrap --with-interface=ncurses \
--enable-static-executables --with-scitecodatadir=../share/sciteco \
- PKG_CONFIG="x86_64-apple-darwin25-pkg-config --static"
+ PKG_CONFIG="x86_64-apple-darwin25-pkg-config --static" \
+ CURSES_CFLAGS="-D_DARWIN_C_SOURCE -DNCURSES_WIDECHAR" CURSES_LIBS="-lncurses"
gmake install-strip DESTDIR=`pwd`/temp-install
# There are libraries we cannot link against statically.
# We ship them in /usr/local/lib/sciteco so as not to cause collisions with system
@@ -61,6 +64,7 @@ gmake install-strip DESTDIR=`pwd`/temp-install
dylibbundler -b -x temp-install/usr/local/bin/sciteco \
-cd -d temp-install/usr/local/lib/sciteco -p @executable_path/../lib/sciteco \
--no-codesign
+# FIXME: Perhaps create pkg using fpm (https://github.com/jordansissel/fpm)?
(cd temp-install; tar czf ../../sciteco-curses_nightly_macos_x86_64.tar.gz *)
cd ..
diff --git a/m4/ax_with_ncurses.m4 b/m4/ax_with_ncurses.m4
index 056aba5..9e8076f 100644
--- a/m4/ax_with_ncurses.m4
+++ b/m4/ax_with_ncurses.m4
@@ -171,112 +171,74 @@ AC_DEFUN([AX_WITH_NCURSES], [
# Test for NcursesW
AS_IF([test "x$CURSES_LIBS" = x], [
_FIND_CURSES_FLAGS([ncursesw])
-
AS_IF([test "x$ax_cv_ncursesw" = xyes], [
ax_cv_curses=yes
ax_cv_curses_which=ncursesw
CURSES_LIBS="$pkg_cv__ax_cv_ncursesw_libs"
CURSES_CFLAGS="$pkg_cv__ax_cv_ncursesw_cppflags"
- AC_DEFINE([HAVE_NCURSESW], [1], [Define to 1 if the NcursesW library is present])
- AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present])
-
- AC_CACHE_CHECK([for working curses.h], [ax_cv_header_curses_h], [
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- @%:@define _XOPEN_SOURCE_EXTENDED 1
- @%:@include <curses.h>
- @%:@ifndef _XOPEN_CURSES
- @%:@error "this Curses library is not enhanced"
- @%:@endif
- @%:@ifndef NCURSES_VERSION
- @%:@error "the curses library is not an ncurses""
- @%:@endif
- ]], [[
- chtype a = A_BOLD;
- int b = KEY_LEFT;
- chtype c = COLOR_PAIR(1) & A_COLOR;
- attr_t d = WA_NORMAL;
- cchar_t e;
- wint_t f;
- int g = getattrs(stdscr);
- int h = getcurx(stdscr) + getmaxx(stdscr);
- initscr();
- init_pair(1, COLOR_WHITE, COLOR_RED);
- wattr_set(stdscr, d, 0, NULL);
- wget_wch(stdscr, &f);
- ]])],
- [ax_cv_header_curses_h=yes],
- [ax_cv_header_curses_h=no])
- ])
- AS_IF([test "x$ax_cv_header_curses_h" = xyes], [
- ax_cv_curses_enhanced=yes
- ax_cv_curses_color=yes
- ax_cv_curses_obsolete=yes
- AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions])
- AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)])
- AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
- AC_DEFINE([HAVE_CURSES_H], [1], [Define to 1 if <curses.h> is present])
- ], [
- AC_MSG_WARN([could not find a working curses.h])
+ unset pkg_cv__ax_cv_ncursesw_libs
+ unset pkg_cv__ax_cv_ncursesw_cppflags
+ ], [
+ _FIND_CURSES_FLAGS([ncurses])
+ AS_IF([test "x$ax_cv_ncurses" = xyes], [
+ ax_cv_curses=yes
+ ax_cv_curses_which=ncurses
+ CURSES_LIBS="$pkg_cv__ax_cv_ncurses_libs"
+ CURSES_CFLAGS="$pkg_cv__ax_cv_ncurses_cppflags"
+ unset pkg_cv__ax_cv_ncurses_libs
+ unset pkg_cv__ax_cv_ncurses_cppflags
])
])
+ ], [
+ ax_cv_curses=yes
+ ax_cv_curses_which=ncurses
+ LIBS="$ax_saved_LIBS $CURSES_LIBS"
+ CPPFLAGS="$ax_saved_CPPFLAGS $CURSES_CFLAGS"
])
- unset pkg_cv__ax_cv_ncursesw_libs
- unset pkg_cv__ax_cv_ncursesw_cppflags
-
- # Test for Ncurses
- AS_IF([test "x$CURSES_LIBS" = x], [
- _FIND_CURSES_FLAGS([ncurses])
- AS_IF([test "x$ax_cv_ncurses" = xyes], [
- ax_cv_curses=yes
- ax_cv_curses_which=ncurses
- CURSES_LIBS="$pkg_cv__ax_cv_ncurses_libs"
- CURSES_CFLAGS="$pkg_cv__ax_cv_ncurses_cppflags"
- AC_DEFINE([HAVE_NCURSES], [1], [Define to 1 if the Ncurses library is present])
- AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present])
-
- AC_CACHE_CHECK([for working curses.h], [ax_cv_header_curses_h], [
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- @%:@define _XOPEN_SOURCE_EXTENDED 1
- @%:@include <curses.h>
- @%:@ifndef _XOPEN_CURSES
- @%:@error "this Curses library is not enhanced"
- @%:@endif
- @%:@ifndef NCURSES_VERSION
- @%:@error "the curses library is not an ncurses""
- @%:@endif
- ]], [[
- chtype a = A_BOLD;
- int b = KEY_LEFT;
- chtype c = COLOR_PAIR(1) & A_COLOR;
- attr_t d = WA_NORMAL;
- cchar_t e;
- wint_t f;
- int g = getattrs(stdscr);
- int h = getcurx(stdscr) + getmaxx(stdscr);
- initscr();
- init_pair(1, COLOR_WHITE, COLOR_RED);
- wattr_set(stdscr, d, 0, NULL);
- wget_wch(stdscr, &f);
- ]])],
- [ax_cv_header_curses_h=yes],
- [ax_cv_header_curses_h=no])
- ])
- AS_IF([test "x$ax_cv_header_curses_h" = xyes], [
- ax_cv_curses_enhanced=yes
- ax_cv_curses_color=yes
- ax_cv_curses_obsolete=yes
- AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions])
- AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)])
- AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
- AC_DEFINE([HAVE_CURSES_H], [1], [Define to 1 if <curses.h> is present])
- ], [
- AC_MSG_WARN([could not find a working curses.h])
- ])
+ AS_IF([test "x$ax_cv_curses" = xyes], [
+ AC_DEFINE([HAVE_NCURSESW], [1], [Define to 1 if the NcursesW library is present])
+ AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present])
+
+ AC_CACHE_CHECK([for working curses.h], [ax_cv_header_curses_h], [
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ @%:@define _XOPEN_SOURCE_EXTENDED 1
+ @%:@include <curses.h>
+ @%:@ifndef _XOPEN_CURSES
+ @%:@error "this Curses library is not enhanced"
+ @%:@endif
+ @%:@ifndef NCURSES_VERSION
+ @%:@error "the curses library is not an ncurses"
+ @%:@endif
+ ]], [[
+ chtype a = A_BOLD;
+ int b = KEY_LEFT;
+ chtype c = COLOR_PAIR(1) & A_COLOR;
+ attr_t d = WA_NORMAL;
+ cchar_t e;
+ wint_t f;
+ int g = getattrs(stdscr);
+ int h = getcurx(stdscr) + getmaxx(stdscr);
+ initscr();
+ init_pair(1, COLOR_WHITE, COLOR_RED);
+ wattr_set(stdscr, d, 0, NULL);
+ wget_wch(stdscr, &f);
+ ]])],
+ [ax_cv_header_curses_h=yes],
+ [ax_cv_header_curses_h=no])
+ ])
+ AS_IF([test "x$ax_cv_header_curses_h" = xyes], [
+ ax_cv_curses_enhanced=yes
+ ax_cv_curses_color=yes
+ ax_cv_curses_obsolete=yes
+ AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions])
+ AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)])
+ AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
+ AC_DEFINE([HAVE_CURSES_H], [1], [Define to 1 if <curses.h> is present])
+ ], [
+ AC_MSG_WARN([could not find a working curses.h])
])
])
- unset pkg_cv__ax_cv_ncurses_libs
- unset pkg_cv__ax_cv_ncurses_cppflags
AS_IF([test "x$ax_cv_curses" != xyes], [ax_cv_curses=no])
AS_IF([test "x$ax_cv_curses_enhanced" != xyes], [ax_cv_curses_enhanced=no])