diff --git a/.github/workflows/merge-gate.yml b/.github/workflows/merge-gate.yml index 2cf3514bec..fa24a95404 100644 --- a/.github/workflows/merge-gate.yml +++ b/.github/workflows/merge-gate.yml @@ -149,7 +149,7 @@ jobs: - name: Install conda packages run: | which conda - conda install conda=23.11.0 python=3.10 + conda install conda=24.11.0 python=3.10 conda --version conda env update --file devtools/ci/environment.yml --name base - name: Install cpptraj diff --git a/configure b/configure index 5b30d9c218..ae78a60ec8 100755 --- a/configure +++ b/configure @@ -318,9 +318,9 @@ LIB_D_ON[$LFFTW3]='-DFFTW_FFT' LIB_DOFF[$LFFTW3]='' LIB_TYPE[$LFFTW3]='cpp' -LIB_STAT[$LREADLINE]='bundled' +LIB_STAT[$LREADLINE]='enabled' LIB_CKEY[$LREADLINE]='readline' -LIB_HOME[$LREADLINE]='readline' +LIB_HOME[$LREADLINE]='' LIB_FLAG[$LREADLINE]='-lreadline' LIB_STTC[$LREADLINE]='libreadline.a' LIB_D_ON[$LREADLINE]='' @@ -1073,13 +1073,42 @@ EOF TestReadline() { cat > testp.cpp < -#include +#include static char *line_read = (char *)NULL; // Do not want to actually run this so leave outside main void Unused() { line_read = readline(""); } int main() { return 0; } EOF - TestProgram " Checking Readline" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]}" + + if [ "${LIB_STAT[$LREADLINE]}" = 'specified' ] ; then + TestProgram " Checking Readline" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]}" + else + # Test with just -lreadline + TestProgram silent " Checking Readline" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]}" + lreadline_err=$? + if [ $lreadline_err -ne 0 ] ; then + # Try -ltermcap + TestProgram silent " Checking Readline with termcap" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]} -ltermcap" + lreadline_err=$? + if [ $lreadline_err -eq 0 ] ; then + LIB_FLAG[$LREADLINE]="${LIB_FLAG[$LREADLINE]} -ltermcap" + fi + fi + if [ $lreadline_err -ne 0 ] ; then + # Try -lncurses + TestProgram silent " Checking Readline with ncurses" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]} -lncurses" + lreadline_err=$? + if [ $lreadline_err -eq 0 ] ; then + LIB_FLAG[$LREADLINE]="${LIB_FLAG[$LREADLINE]} -lncurses" + fi + fi + if [ $lreadline_err -ne 0 ] ; then + echo "No readline available; using bundled readline." + LIB_STAT[$LREADLINE]='bundled' + LIB_FLAG[$LREADLINE]='readline/libreadline.a' + LIB_INCL[$LREADLINE]='-I.' + fi + fi } TestXdrfile() { @@ -1503,23 +1532,24 @@ SetupLibraries() { lflag="-L$lhdir ${LIB_FLAG[$i]}" fi # Library-specific CPPTRAJ_INC fixes when home specified. - if [ $i -eq $LREADLINE ] ; then - linc="$linc/readline" - fi + #if [ $i -eq $LREADLINE ] ; then + # linc="$linc/readline" + #fi if [ $i -eq $LXDRFILE ] ; then linc="$linc/xdrfile" fi fi # Library-specific flag fixes - if [ $i -eq $LREADLINE ] ; then +# if [ $i -eq $LREADLINE ] ; then # For external readline, we need to link libtermcap for windows # and libncurses for Linux #if [ $USE_WINDOWS -eq 1 ]; then - lflag="$lflag -ltermcap" +# lflag="$lflag -ltermcap" #else # lflag="$lflag -lncurses" #fi - elif [ $i -eq $LSANDER ] ; then +# elif [ $i -eq $LSANDER ] ; then + if [ $i -eq $LSANDER ] ; then # Always specify libsander location to prevent pulling in # other amber libraries. if [ ! -f "${LIB_FLAG[$LSANDER]}" ] ; then @@ -1671,8 +1701,8 @@ SetupCompilers() { # Check the GNU compiler version CheckCompilerVersion gcc # Set version-specific flags - if [ $cc_version_major -ge 14 ] ; then - # Needed for readline with gcc >= 14 + if [ $cc_version_major -ge 13 ] ; then + # Needed for readline with gcc >= 13 CFLAGS="$CFLAGS -D_DEFAULT_SOURCE -D_XOPEN_SOURCE" fi ;; diff --git a/src/ReadLine.cpp b/src/ReadLine.cpp index 73e11a74e8..04d62a8a44 100644 --- a/src/ReadLine.cpp +++ b/src/ReadLine.cpp @@ -8,8 +8,8 @@ # include #else # define READLINE_LIBRARY -# include -# include +# include +# include #endif #include "ReadLine.h" #include "Command.h" diff --git a/src/readline/CMakeLists.txt b/src/readline/CMakeLists.txt index 556e6f6be7..d4de3f58e2 100644 --- a/src/readline/CMakeLists.txt +++ b/src/readline/CMakeLists.txt @@ -44,3 +44,4 @@ add_library(readline STATIC ${CPPTRAJ_READLINE_SOURCES}) target_compile_definitions(readline PRIVATE HAVE_CONFIG_H=1) # make sure the code uses the premade config.h make_pic_if_needed(readline) target_include_directories(readline PUBLIC .) +target_include_directories(readline PUBLIC ../)