diff --git a/CMakeLists.txt b/CMakeLists.txt index 31c0a70..065a612 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,11 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) # GET_TARGET_PROPERTY. This should no longer be required. # CMAKE_POLICY(SET CMP0026 OLD) +# With a recent cmake, you can provide a rootdir to look for non +# standard installed library dependencies, but to do so, the policy +# needs to be set to new (by uncommenting the following) +# CMAKE_POLICY(SET CMP0074 NEW) + # For FindReadline.cmake. This was changed to allow setting CMAKE_MODULE_PATH # on the command line. # SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) @@ -312,7 +317,11 @@ IF(EDITLINE_FOUND) ENDIF(PCRE2_SUPPORT_LIBEDIT) ELSE(EDITLINE_FOUND) IF(PCRE2_SUPPORT_LIBEDIT) - MESSAGE(FATAL_ERROR "libedit not found, set Editline_ROOT if needed") + MESSAGE(FATAL_ERROR + " libedit not found, set EDITLINE_INCLUDE_DIR to a compatible header\n" + " or set Editline_ROOT to a full libedit installed tree, as needed\n" + " Might need to enable policy CMP0074 in CMakeLists.txt" + ) ENDIF(PCRE2_SUPPORT_LIBEDIT) ENDIF(EDITLINE_FOUND) diff --git a/cmake/FindEditline.cmake b/cmake/FindEditline.cmake index 37eeb3e..1f0c951 100644 --- a/cmake/FindEditline.cmake +++ b/cmake/FindEditline.cmake @@ -1,8 +1,8 @@ # Modified from FindReadline.cmake (PH Feb 2012) -if(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY AND NCURSES_LIBRARY) +if(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY) set(EDITLINE_FOUND TRUE) -else(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY AND NCURSES_LIBRARY) +else(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY) FIND_PATH(EDITLINE_INCLUDE_DIR readline.h PATH_SUFFIXES editline edit/readline @@ -10,7 +10,7 @@ else(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY AND NCURSES_LIBRARY) FIND_LIBRARY(EDITLINE_LIBRARY NAMES edit) include(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(Editline DEFAULT_MSG EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY ) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(Editline DEFAULT_MSG EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY) MARK_AS_ADVANCED(EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY) -endif(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY AND NCURSES_LIBRARY) +endif(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY) diff --git a/configure.ac b/configure.ac index 7f22640..3cbd7ee 100644 --- a/configure.ac +++ b/configure.ac @@ -601,7 +601,7 @@ fi # headers in different places. Try to cover the most common ones. if test "$enable_pcre2test_libedit" = "yes"; then - AC_CHECK_HEADERS([editline/readline.h edit/readline/readline.h], [ + AC_CHECK_HEADERS([editline/readline.h edit/readline/readline.h readline.h], [ HAVE_LIBEDIT_HEADER=1 break ]) @@ -941,8 +941,8 @@ if test "$enable_pcre2test_libedit" = "yes"; then exit 1 fi if test -z "$HAVE_LIBEDIT_HEADER"; then - echo "** Cannot --enable-pcre2test-libedit because neither editline/readline.h" - echo "** nor edit/readline/readline.h was found." + echo "** Cannot --enable-pcre2test-libedit because neither editline/readline.h," + echo "** edit/readline/readline.h nor a compatible header was found." exit 1 fi if test -z "$LIBEDIT"; then diff --git a/maint/ucptest.c b/maint/ucptest.c index 638f6af..48475bb 100644 --- a/maint/ucptest.c +++ b/maint/ucptest.c @@ -110,6 +110,9 @@ type, gbreak or bidi. The defined values for that property are listed. */ #include #else #include +#ifdef RL_VERSION_MAJOR +#include +#endif #endif #endif #endif diff --git a/src/pcre2test.c b/src/pcre2test.c index 3de92b4..ee35c3b 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -82,11 +82,7 @@ from www.cbttape.org. */ /* #define DEBUG_SHOW_MALLOC_ADDRESSES */ -/* Both libreadline and libedit are optionally supported. The user-supplied -original patch uses readline/readline.h for libedit, but in at least one system -it is installed as editline/readline.h, so the configuration code now looks for -that first, falling back to readline/readline.h. */ - +/* Both libreadline and libedit are optionally supported */ #if defined(SUPPORT_LIBREADLINE) || defined(SUPPORT_LIBEDIT) #if defined(SUPPORT_LIBREADLINE) #include @@ -98,6 +94,11 @@ that first, falling back to readline/readline.h. */ #include #else #include +/* GNU readline defines this macro but libedit doesn't, if that ever changes +this needs to be updated or the build could break */ +#ifdef RL_VERSION_MAJOR +#include +#endif #endif #endif #endif