From 302b09dd18b51274992b07e0819700a063f0c05f Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Mon, 17 Jun 2024 20:33:30 +0000 Subject: [PATCH 1/6] may have ncursesw6-config but not ncurses6-config --- config/sst_check_curses.m4 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/config/sst_check_curses.m4 b/config/sst_check_curses.m4 index 47699427b..429392598 100644 --- a/config/sst_check_curses.m4 +++ b/config/sst_check_curses.m4 @@ -1,3 +1,5 @@ +dnl -*- mode: autoconf; -*- + AC_DEFUN([SST_CHECK_CURSES], [ sst_check_curses_happy="yes" @@ -18,8 +20,12 @@ AC_DEFUN([SST_CHECK_CURSES], dnl test ncursesN-config AS_IF([test $NCURSES_CONFIG_EXE = "no"], [AS_IF([test -n "$with_curses"], - [AC_PATH_PROGS([NCURSES_CONFIG_EXE], ["ncurses6-config" "ncurses5.4-config" "ncurses5-config"], ["no"], ["$with_curses/bin"])], - [AC_PATH_PROGS([NCURSES_CONFIG_EXE], ["ncurses6-config" "ncurses5.4-config" "ncurses5-config"], ["no"])])]) + [AC_PATH_PROGS([NCURSES_CONFIG_EXE], + ["ncurses6-config" "ncursesw6-config" "ncurses5.4-config" "ncurses5-config"], + ["no"], ["$with_curses/bin"])], + [AC_PATH_PROGS([NCURSES_CONFIG_EXE], + ["ncurses6-config" "ncursesw6-config" "ncurses5.4-config" "ncurses5-config"], + ["no"])])]) dnl don't continue if ncursesN-config can't be found rather than look for the dnl specific libraries From 5e9c24c60dbed3912f13edc27726894bf84a147f Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Fri, 21 Jun 2024 12:15:23 -0600 Subject: [PATCH 2/6] go back to hardcoded lib checks --- config/sst_check_curses.m4 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/config/sst_check_curses.m4 b/config/sst_check_curses.m4 index 429392598..ae1296640 100644 --- a/config/sst_check_curses.m4 +++ b/config/sst_check_curses.m4 @@ -50,10 +50,20 @@ AC_DEFUN([SST_CHECK_CURSES], CPPFLAGS="$CPPFLAGS $CURSES_CPPFLAGS" LDFLAGS="$LDFLAGS $CURSES_LIBS" - dnl Check that the specific header exists and that the config-provided lib locations are correct. + dnl Check that the specific header exists and that plausible lib + dnl locations are correct. AC_LANG_PUSH([C++]) AC_CHECK_HEADER([ncurses.h], [], [sst_check_curses_happy="no"]) - AC_SEARCH_LIBS([initscr], [$CURSES_LIBS], [], [sst_check_curses_happy="no"]) + dnl We cannot check that the config-provided lib names are + dnl correct, since those are not available at macro expansion + dnl time. This is only necessary for platforms where libs are + dnl reported but are broken or don't actually exist. + AS_IF([test "$sst_check_curses_happy" != "no"], + [AC_CHECK_LIB([ncursesw], [initscr], [], + [AC_CHECK_LIB([ncurses], [initscr], [], + [AC_CHECK_LIB([curses], [initscr], [], + [sst_check_curses_happy="no"])])]) + ]) AC_LANG_POP([C++]) CPPFLAGS="$CPPFLAGS_saved" From 1877c1d939f5de38078878848f0ce44dabdb7c0b Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Fri, 26 Jul 2024 07:24:05 -0600 Subject: [PATCH 3/6] fix using --with-ncurses --- config/sst_check_curses.m4 | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/config/sst_check_curses.m4 b/config/sst_check_curses.m4 index ae1296640..b87576d45 100644 --- a/config/sst_check_curses.m4 +++ b/config/sst_check_curses.m4 @@ -4,29 +4,32 @@ AC_DEFUN([SST_CHECK_CURSES], [ sst_check_curses_happy="yes" - AC_ARG_WITH([curses], + AC_ARG_WITH([ncurses], [AS_HELP_STRING([--with-ncurses@<:@=DIR or EXEC@:>@], [Use ncurses library found in DIR or associated with the ncursesN-config utility specified by EXEC])]) - AS_IF([test "$with_curses" = "no"], [sst_check_curses_happy="no"]) + AS_IF([test "$with_ncurses" = "no"], [sst_check_curses_happy="no"]) NCURSES_CONFIG_EXE="no" dnl check if user provided a specific ncursesN-config - AS_IF([test ! -d "$with_curses"], - [AS_IF([test -x "$with_curses"], - [NCURSES_CONFIG_EXE=$with_curses])]) + AS_IF([test ! -d "$with_ncurses"], + [AS_IF([test -x "$with_ncurses"], + [NCURSES_CONFIG_EXE=$with_ncurses])]) dnl test ncursesN-config AS_IF([test $NCURSES_CONFIG_EXE = "no"], - [AS_IF([test -n "$with_curses"], + [AS_IF([test -n "$with_ncurses"], [AC_PATH_PROGS([NCURSES_CONFIG_EXE], ["ncurses6-config" "ncursesw6-config" "ncurses5.4-config" "ncurses5-config"], - ["no"], ["$with_curses/bin"])], + ["no"], ["$with_ncurses/bin"])], [AC_PATH_PROGS([NCURSES_CONFIG_EXE], ["ncurses6-config" "ncursesw6-config" "ncurses5.4-config" "ncurses5-config"], ["no"])])]) + AC_MSG_CHECKING([ncurses config binary exists]) + AC_MSG_RESULT([$NCURSES_CONFIG_EXE]) + dnl don't continue if ncursesN-config can't be found rather than look for the dnl specific libraries AS_IF([test $NCURSES_CONFIG_EXE = "no"], @@ -79,6 +82,6 @@ AC_DEFUN([SST_CHECK_CURSES], AC_MSG_CHECKING([for curses library]) AC_MSG_RESULT([$sst_check_curses_happy]) - AS_IF([test "$sst_check_curses_happy" = "no" -a ! -z "$with_curses" -a "$with_curses" != "no"], [$3]) + AS_IF([test "$sst_check_curses_happy" = "no" -a ! -z "$with_ncurses" -a "$with_ncurses" != "no"], [$3]) AS_IF([test "$sst_check_curses_happy" = "yes"], [$1], [$2]) ]) From 686c6234914623a6351055a6fb755a5db981ace8 Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Fri, 26 Jul 2024 07:52:31 -0600 Subject: [PATCH 4/6] avoid bad default usage of AC_CHECK_LIB --- config/sst_check_curses.m4 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/config/sst_check_curses.m4 b/config/sst_check_curses.m4 index b87576d45..4e5b352f2 100644 --- a/config/sst_check_curses.m4 +++ b/config/sst_check_curses.m4 @@ -61,10 +61,14 @@ AC_DEFUN([SST_CHECK_CURSES], dnl correct, since those are not available at macro expansion dnl time. This is only necessary for platforms where libs are dnl reported but are broken or don't actually exist. + dnl + dnl If nothing is specified for `action-if-found`, the library + dnl will be added to LIBS, which is not correct for our use case. + curses_check_lib_tmp="" AS_IF([test "$sst_check_curses_happy" != "no"], - [AC_CHECK_LIB([ncursesw], [initscr], [], - [AC_CHECK_LIB([ncurses], [initscr], [], - [AC_CHECK_LIB([curses], [initscr], [], + [AC_CHECK_LIB([ncursesw], [initscr], [curses_check_lib_tmp="ncursesw is valid"], + [AC_CHECK_LIB([ncurses], [initscr], [curses_check_lib_tmp="ncurses is valid"], + [AC_CHECK_LIB([curses], [initscr], [curses_check_lib_tmp="curses is valid"], [sst_check_curses_happy="no"])])]) ]) AC_LANG_POP([C++]) From 5a2ffaf79bba6fa86fc68e940418194181562123 Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Fri, 26 Jul 2024 07:53:02 -0600 Subject: [PATCH 5/6] add curses variables to sst.conf --- src/sst/sst.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sst/sst.conf b/src/sst/sst.conf index 13adb0020..c30afb0b9 100644 --- a/src/sst/sst.conf +++ b/src/sst/sst.conf @@ -30,6 +30,8 @@ PYTHON_VERSION3=@PYTHON_VERSION3@ LIBZ_CPPFLAGS=@LIBZ_CPPFLAGS@ LIBZ_LDFLAGS=@LIBZ_LDFLAGS@ LIBZ_LIBS=@LIBZ_LIBS@ +CURSES_CPPFLAGS=@CURSES_CPPFLAGS@ +CURSES_LIBS=@CURSES_LIBS@ ELEMENT_CXXFLAGS=@SST_EXPORT_CXXFLAGS@ @SST_ELEMENT_FPIC_FLAGS@ -DHAVE_CONFIG_H -I@prefix@/include ELEMENT_LDFLAGS=-shared -fno-common -Wl,-undefined -Wl,dynamic_lookup pkgconfig=@prefix@/lib/pkgconfig/SST-@PACKAGE_VERSION@.pc From 3c6c47a864deaaccde2ef7ba40b30d0dd1405ec0 Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Fri, 26 Jul 2024 08:22:10 -0600 Subject: [PATCH 6/6] unset CURSES_CPPFLAGS and CURSES_LIBS if they're actually wrong --- config/sst_check_curses.m4 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/sst_check_curses.m4 b/config/sst_check_curses.m4 index 4e5b352f2..1dbe0dcf6 100644 --- a/config/sst_check_curses.m4 +++ b/config/sst_check_curses.m4 @@ -69,7 +69,10 @@ AC_DEFUN([SST_CHECK_CURSES], [AC_CHECK_LIB([ncursesw], [initscr], [curses_check_lib_tmp="ncursesw is valid"], [AC_CHECK_LIB([ncurses], [initscr], [curses_check_lib_tmp="ncurses is valid"], [AC_CHECK_LIB([curses], [initscr], [curses_check_lib_tmp="curses is valid"], - [sst_check_curses_happy="no"])])]) + [sst_check_curses_happy="no" + CURSES_CPPFLAGS="" + CURSES_LIBS="" + ])])]) ]) AC_LANG_POP([C++])