drop libreadline dependency. Use libedit instead.
This commit is contained in:
parent
af921a9df8
commit
70e3ed2354
|
@ -0,0 +1,89 @@
|
|||
# - Try to find libedit
|
||||
# Once done this will define
|
||||
#
|
||||
# Libedit_FOUND - system has libedit
|
||||
# Libedit_INCLUDE_DIRS - the libedit include directory
|
||||
# Libedit_LIBRARIES - Link these to use libedit
|
||||
# Libedit_DEFINITIONS - Compiler switches required for using libedit
|
||||
#
|
||||
# Copyright (c) 2014 Yuichi Nishiwaki <yuichi@idylls.jp>
|
||||
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
|
||||
# Modified for other libraries by Lasse Kärkkäinen <tronic>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
#
|
||||
|
||||
|
||||
if (Libedit_LIBRARIES AND Libedit_INCLUDE_DIRS)
|
||||
# in cache already
|
||||
set(Libedit_FOUND TRUE)
|
||||
else (Libedit_LIBRARIES AND Libedit_INCLUDE_DIRS)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
|
||||
include(UsePkgConfig)
|
||||
pkgconfig(libedit _Libedit_INCLUDEDIR _Libedit_LIBDIR _Libedit_LDFLAGS _Libedit_CFLAGS)
|
||||
else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_LIBEDIT libedit)
|
||||
endif (PKG_CONFIG_FOUND)
|
||||
endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
|
||||
find_path(Libedit_INCLUDE_DIR
|
||||
NAMES
|
||||
histedit.h
|
||||
PATHS
|
||||
${_Libedit_INCLUDEDIR}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
PATH_SUFFIXES
|
||||
editline
|
||||
)
|
||||
|
||||
find_library(Libedit_LIBRARY
|
||||
NAMES
|
||||
edit
|
||||
PATHS
|
||||
${_Libedit_LIBDIR}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
|
||||
if (Libedit_LIBRARY)
|
||||
set(Libedit_FOUND TRUE)
|
||||
endif (Libedit_LIBRARY)
|
||||
|
||||
set(Libedit_INCLUDE_DIRS
|
||||
${Libedit_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
if (Libedit_FOUND)
|
||||
set(Libedit_LIBRARIES
|
||||
${Libedit_LIBRARIES}
|
||||
${Libedit_LIBRARY}
|
||||
)
|
||||
endif (Libedit_FOUND)
|
||||
|
||||
if (Libedit_INCLUDE_DIRS AND Libedit_LIBRARIES)
|
||||
set(Libedit_FOUND TRUE)
|
||||
endif (Libedit_INCLUDE_DIRS AND Libedit_LIBRARIES)
|
||||
|
||||
if (Libedit_FOUND)
|
||||
if (NOT Libedit_FIND_QUIETLY)
|
||||
message(STATUS "Found libedit: ${Libedit_LIBRARY}")
|
||||
endif (NOT Libedit_FIND_QUIETLY)
|
||||
else (Libedit_FOUND)
|
||||
if (Libedit_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find libedit")
|
||||
endif (Libedit_FIND_REQUIRED)
|
||||
endif (Libedit_FOUND)
|
||||
|
||||
# show the Libedit_INCLUDE_DIRS and Libedit_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(Libedit_INCLUDE_DIRS Libedit_LIBRARIES)
|
||||
|
||||
endif (Libedit_LIBRARIES AND Libedit_INCLUDE_DIRS)
|
|
@ -1,113 +0,0 @@
|
|||
# This file used to be a part of LuaJit project.
|
||||
|
||||
# ===============================================================================
|
||||
# Picrin Scheme -- a lightweight scheme implementation.
|
||||
|
||||
# Copyright (C) 2014 Yuichi Nishiwaki. All rights reserved.
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
|
||||
|
||||
# ===============================================================================
|
||||
# LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
|
||||
|
||||
# Copyright (C) 2005-2013 Mike Pall. All rights reserved.
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
|
||||
|
||||
# ===============================================================================
|
||||
# [ LuaJIT includes code from Lua 5.1/5.2, which has this license statement: ]
|
||||
|
||||
# Copyright (C) 1994-2012 Lua.org, PUC-Rio.
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# ===============================================================================
|
||||
# [ LuaJIT includes code from dlmalloc, which has this license statement: ]
|
||||
|
||||
# This is a version (aka dlmalloc) of malloc/free/realloc written by
|
||||
# Doug Lea and released to the public domain, as explained at
|
||||
# http://creativecommons.org/licenses/publicdomain
|
||||
|
||||
# ===============================================================================
|
||||
|
||||
|
||||
|
||||
# - Try to find Readline
|
||||
# Once done this will define
|
||||
# READLINE_FOUND - System has readline
|
||||
# READLINE_INCLUDE_DIRS - The readline include directories
|
||||
# READLINE_LIBRARIES - The libraries needed to use readline
|
||||
# READLINE_DEFINITIONS - Compiler switches required for using readline
|
||||
|
||||
find_package ( PkgConfig )
|
||||
pkg_check_modules ( PC_READLINE QUIET readline )
|
||||
set ( READLINE_DEFINITIONS ${PC_READLINE_CFLAGS_OTHER} )
|
||||
|
||||
find_path ( READLINE_INCLUDE_DIR readline/readline.h
|
||||
HINTS ${PC_READLINE_INCLUDEDIR} ${PC_READLINE_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES readline )
|
||||
|
||||
find_library ( READLINE_LIBRARY NAMES readline
|
||||
HINTS ${PC_READLINE_LIBDIR} ${PC_READLINE_LIBRARY_DIRS} )
|
||||
|
||||
set ( READLINE_LIBRARIES ${READLINE_LIBRARY} )
|
||||
set ( READLINE_INCLUDE_DIRS ${READLINE_INCLUDE_DIR} )
|
||||
|
||||
include ( FindPackageHandleStandardArgs )
|
||||
# handle the QUIETLY and REQUIRED arguments and set READLINE_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args ( readline DEFAULT_MSG READLINE_LIBRARY READLINE_INCLUDE_DIR )
|
||||
|
||||
mark_as_advanced ( READLINE_INCLUDE_DIR READLINE_LIBRARY )
|
|
@ -1,10 +1,10 @@
|
|||
list(APPEND REPL_LIBRARIES picrin)
|
||||
|
||||
find_package(READLINE)
|
||||
if (READLINE_FOUND)
|
||||
include_directories(${READLINE_INCLUDE_DIRS})
|
||||
add_definitions(${READLINE_DEFINITIONS} -DPIC_READLINE_FOUND=1)
|
||||
list(APPEND REPL_LIBRARIES ${READLINE_LIBRARIES})
|
||||
find_package(LIBEDIT)
|
||||
if (Libedit_FOUND)
|
||||
include_directories(${Libedit_INCLUDE_DIRS})
|
||||
add_definitions(${Libedit_DEFINITIONS} -DPIC_READLINE_FOUND=1)
|
||||
list(APPEND REPL_LIBRARIES ${Libedit_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# build
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
#include "picrin/error.h"
|
||||
|
||||
#if PIC_ENABLE_READLINE
|
||||
# include <readline/readline.h>
|
||||
# include <readline/history.h>
|
||||
# include <editline/readline.h>
|
||||
#endif
|
||||
|
||||
#define CODE_MAX_LENGTH 1024
|
||||
|
|
Loading…
Reference in New Issue