diff options
Diffstat (limited to 'cmd-line-utils')
-rw-r--r-- | cmd-line-utils/Makefile.am | 3 | ||||
-rw-r--r-- | cmd-line-utils/libedit/CMakeLists.txt | 167 | ||||
-rw-r--r-- | cmd-line-utils/libedit/Makefile.am | 2 | ||||
-rw-r--r-- | cmd-line-utils/readline/.cvsignore | 3 | ||||
-rw-r--r-- | cmd-line-utils/readline/CMakeLists.txt | 60 | ||||
-rw-r--r-- | cmd-line-utils/readline/Makefile.am | 5 |
6 files changed, 229 insertions, 11 deletions
diff --git a/cmd-line-utils/Makefile.am b/cmd-line-utils/Makefile.am index 1a84ce7af38..622aa72fd43 100644 --- a/cmd-line-utils/Makefile.am +++ b/cmd-line-utils/Makefile.am @@ -19,6 +19,3 @@ SUBDIRS= @readline_basedir@ DIST_SUBDIRS= libedit readline - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/cmd-line-utils/libedit/CMakeLists.txt b/cmd-line-utils/libedit/CMakeLists.txt new file mode 100644 index 00000000000..b0e375dfcbd --- /dev/null +++ b/cmd-line-utils/libedit/CMakeLists.txt @@ -0,0 +1,167 @@ +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ) +INCLUDE(CheckIncludeFile) +include(CheckFunctionExists) +CHECK_INCLUDE_FILES(term.h HAVE_TERM_H) + +SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY}) +CHECK_CXX_SOURCE_COMPILES(" +#include <term.h> +int main() +{ + tgoto(0,0,0); + return 0; +}" HAVE_DECL_TGOTO) +SET(CMAKE_REQUIRED_LIBRARIES) + + + +IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") + #On Solaris, default awk is next to unusable while the xpg4 one is ok. + IF(EXISTS /usr/xpg4/bin/awk) + SET(AWK_EXECUTABLE /usr/xpg4/bin/awk) + ENDIF() +ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "OS400") + #Workaround for cases, where /usr/bin/gawk is not executable + IF(EXISTS /QOpenSys/usr/bin/awk) + SET(AWK_EXECUTABLE /QOpenSys/usr/bin/awk) + ENDIF() +ENDIF() + +IF(NOT AWK_EXECUTABLE) + FIND_PROGRAM(AWK_EXECUTABLE NAMES gawk awk DOC "path to the awk executable") +ENDIF() + +MARK_AS_ADVANCED(AWK_EXECUTABLE) +SET(AWK ${AWK_EXECUTABLE}) +CONFIGURE_FILE(makelist.sh ${CMAKE_CURRENT_BINARY_DIR}/makelist @ONLY) + +include(CheckIncludeFile) + +CHECK_INCLUDE_FILE(vis.h HAVE_VIS_H) +IF(HAVE_VIS_H) + CHECK_FUNCTION_EXISTS(strvis HAVE_STRVIS) + IF(NOT HAVE_STRVIS) + SET(HAVE_VIS_H FALSE CACHE INTERNAL "" FORCE) + ENDIF() +ENDIF() + +CHECK_FUNCTION_EXISTS(strvis HAVE_STRVIS) +IF(NOT HAVE_STRVIS) + SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/vis.c) +ENDIF() + +CHECK_FUNCTION_EXISTS(strunvis HAVE_STRUNVIS) +IF(NOT HAVE_STRUNVIS) + SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/unvis.c) +ENDIF() + +CHECK_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY) +IF(NOT HAVE_STRLCPY) + SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/strlcpy.c) +ENDIF() + +CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT) +IF(NOT HAVE_STRLCAT) + SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/strlcat.c) +ENDIF() + +CHECK_FUNCTION_EXISTS(fgetln HAVE_FGETLN) +IF(NOT HAVE_FGETLN) + SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/fgetln.c) +ENDIF() + +# Generate headers +FOREACH(SRCBASENAME vi emacs common) + SET(SRC ${CMAKE_CURRENT_SOURCE_DIR}/${SRCBASENAME}.c) + SET(HDR ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASENAME}.h) + + ADD_CUSTOM_COMMAND( + OUTPUT ${HDR} + COMMAND sh ./makelist -h ${SRC} > ${HDR} + DEPENDS ${SRC}) + + SET(AHDR ${AHDR} ${HDR}) + SET(ASRC ${ASRC} ${SRC}) +ENDFOREACH() + +# Generate source files +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/help.c + COMMAND sh ./makelist -bc ${ASRC} > help.c + DEPENDS ${ASRC} +) + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/help.h + COMMAND sh ./makelist -bh ${ASRC} > help.h + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${ASRC} +) + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fcns.h + COMMAND sh ./makelist -fh ${AHDR} > fcns.h + VERBATIM + DEPENDS ${AHDR} +) + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fcns.c + COMMAND sh ./makelist -fc ${AHDR} > fcns.c + VERBATIM + DEPENDS ${AHDR} +) + + +INCLUDE_DIRECTORIES( +${CMAKE_SOURCE_DIR}/include +${CMAKE_CURRENT_BINARY_DIR} +${CURSES_INCLUDE_PATH} +) + +SET(LIBEDIT_SOURCES + chared.c + el.c + history.c + map.c + prompt.c + readline.c + search.c + tokenizer.c + vi.c + common.c + emacs.c + hist.c + key.c + parse.c + read.c + refresh.c + sig.c + term.c + tty.c + filecomplete.c + ${CMAKE_CURRENT_BINARY_DIR}/help.c + ${CMAKE_CURRENT_BINARY_DIR}/help.h + ${CMAKE_CURRENT_BINARY_DIR}/fcns.c + ${CMAKE_CURRENT_BINARY_DIR}/fcns.h + ${AHDR} + ${LIBEDIT_EXTRA_SOURCES} +) +ADD_LIBRARY(edit ${LIBEDIT_SOURCES}) +TARGET_LINK_LIBRARIES(edit ${CURSES_LIBRARY}) + diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am index ddafa4aab44..88ea97afffd 100644 --- a/cmd-line-utils/libedit/Makefile.am +++ b/cmd-line-utils/libedit/Makefile.am @@ -23,7 +23,7 @@ noinst_HEADERS = chared.h el.h el_term.h histedit.h key.h parse.h refresh.h sig. sys.h config.h hist.h map.h prompt.h read.h \ search.h tty.h filecomplete.h np/vis.h -EXTRA_DIST = makelist.sh +EXTRA_DIST = makelist.sh CMakeLists.txt CLEANFILES = makelist common.h emacs.h vi.h fcns.h help.h fcns.c help.c diff --git a/cmd-line-utils/readline/.cvsignore b/cmd-line-utils/readline/.cvsignore deleted file mode 100644 index e9955884756..00000000000 --- a/cmd-line-utils/readline/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -.deps -Makefile -Makefile.in diff --git a/cmd-line-utils/readline/CMakeLists.txt b/cmd-line-utils/readline/CMakeLists.txt new file mode 100644 index 00000000000..ed6a6b902ea --- /dev/null +++ b/cmd-line-utils/readline/CMakeLists.txt @@ -0,0 +1,60 @@ +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/cmd-line-utils) + +ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNO_KILL_INTR -DMYSQL_CLIENT_NO_THREADS) + +INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PATH}) + +ADD_LIBRARY(readline + readline.c + funmap.c + keymaps.c + vi_mode.c + parens.c + rltty.c + complete.c + bind.c + isearch.c + display.c + signals.c + util.c + kill.c + undo.c + macro.c + input.c + callback.c + terminal.c + xmalloc.c + history.c + histsearch.c + histexpand.c + histfile.c + nls.c + search.c + shell.c + tilde.c + misc.c + text.c + mbutil.c + compat.c + savestring.c +) + +# Declare dependency +# so every executable that links with readline links with curses as well +TARGET_LINK_LIBRARIES(readline ${CURSES_LIBRARY}) diff --git a/cmd-line-utils/readline/Makefile.am b/cmd-line-utils/readline/Makefile.am index e1e9645e238..48d3af34412 100644 --- a/cmd-line-utils/readline/Makefile.am +++ b/cmd-line-utils/readline/Makefile.am @@ -29,9 +29,6 @@ noinst_HEADERS = readline.h chardefs.h keymaps.h \ tilde.h rlconf.h rltty.h ansi_stdlib.h \ tcap.h rlstdc.h -EXTRA_DIST= emacs_keymap.c vi_keymap.c +EXTRA_DIST= emacs_keymap.c vi_keymap.c CMakeLists.txt DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR -D_GNU_SOURCE=1 - -# Don't update the files from bitkeeper -%::SCCS/s.% |