diff options
Diffstat (limited to 'cmd-line-utils')
-rw-r--r-- | cmd-line-utils/Makefile.am | 24 | ||||
-rw-r--r-- | cmd-line-utils/libedit/CMakeLists.txt | 191 | ||||
-rw-r--r-- | cmd-line-utils/libedit/Makefile.am | 96 | ||||
-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 | 37 |
6 files changed, 251 insertions, 160 deletions
diff --git a/cmd-line-utils/Makefile.am b/cmd-line-utils/Makefile.am deleted file mode 100644 index 1a84ce7af38..00000000000 --- a/cmd-line-utils/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2004 MySQL AB -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; version 2 -# of the License. -# -# This library 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 -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public -# License along with this library; if not, write to the Free -# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA - -## Process this file with automake to create Makefile.in - -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..c488fa34512 --- /dev/null +++ b/cmd-line-utils/libedit/CMakeLists.txt @@ -0,0 +1,191 @@ +# 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) +IF(NOT HAVE_DECL_TGOTO) + # On Solaris 11, term.h is broken, curses.h is also required. + CHECK_CXX_SOURCE_COMPILES(" + #include <curses.h> + #include <term.h> + int main() + { + tgoto(0,0,0); + return 0; + }" HAVE_DECL_TGOTO2) + IF(HAVE_DECL_TGOTO2) + SET(HAVE_DECL_TGOTO 1 CACHE INTERNAL "" FORCE) + ENDIF() +ENDIF() + +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() + +CHECK_FUNCTION_EXISTS(fgetln HAVE_WCSDUP) +IF(NOT HAVE_WCSDUP) + SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/wcsdup.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 + chartype.c + el.c + eln.c + history.c + historyn.c + map.c + prompt.c + readline.c + search.c + tokenizer.c + tokenizern.c + vi.c + common.c + emacs.c + hist.c + keymacro.c + parse.c + read.c + refresh.c + sig.c + terminal.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 deleted file mode 100644 index b68eca7f44a..00000000000 --- a/cmd-line-utils/libedit/Makefile.am +++ /dev/null @@ -1,96 +0,0 @@ -## Process this file with automake to create Makefile.in - -ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c -AHDR = vi.h emacs.h common.h - -INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include - -noinst_LIBRARIES = libedit.a - -libedit_a_SOURCES = chared.c el.c eln.c history.c historyn.c map.c prompt.c chartype.c \ - readline.c search.c tokenizer.c tokenizern.c vi.c common.c emacs.c \ - hist.c keymacro.c parse.c read.c refresh.c sig.c terminal.c \ - tty.c help.c fcns.c filecomplete.c \ - np/unvis.c np/strlcpy.c np/vis.c np/strlcat.c \ - np/fgetln.c np/wcsdup.c - -libedit_a_LIBADD = @LIBEDIT_LOBJECTS@ -libedit_a_DEPENDENCIES = @LIBEDIT_LOBJECTS@ - -pkginclude_HEADERS = readline/readline.h - -noinst_HEADERS = chared.h chartype.h el.h el_terminal.h histedit.h keymacro.h parse.h \ - refresh.h sig.h 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 - -CLEANFILES = makelist common.h emacs.h vi.h fcns.h help.h fcns.c help.c - -SUFFIXES = .sh - -.sh: - @RM@ -f $@ $@-t - @SED@ \ - -e 's!@''AWK''@!@AWK@!' \ - $< > $@-t - @MV@ $@-t $@ - -vi.h: $(srcdir)/vi.c makelist - sh ./makelist -h $(srcdir)/vi.c > $@.tmp && \ - mv $@.tmp $@ - -emacs.h: $(srcdir)/emacs.c makelist - sh ./makelist -h $(srcdir)/emacs.c > $@.tmp && \ - mv $@.tmp $@ - -common.h: $(srcdir)/common.c makelist - sh ./makelist -h $(srcdir)/common.c > $@.tmp && \ - mv $@.tmp $@ - -help.c: ${ASRC} makelist - sh ./makelist -bc ${ASRC} > $@.tmp && \ - mv $@.tmp $@ - -help.h: ${ASRC} makelist - sh ./makelist -bh ${ASRC} > $@.tmp && \ - mv $@.tmp $@ - -fcns.h: ${AHDR} makelist - sh ./makelist -fh ${AHDR} > $@.tmp && \ - mv $@.tmp $@ - -fcns.c: ${AHDR} fcns.h makelist - sh ./makelist -fc ${AHDR} > $@.tmp && \ - mv $@.tmp $@ - -#%.o: vi.h emacs.h common.h help.h fcns.h -#objects := $(patsubst %.c,%.o,$(wildcard *.c)) -#$(objects): vi.h emacs.h - -chared.o: vi.h emacs.h common.h help.h fcns.h -el.o: vi.h emacs.h common.h help.h fcns.h -eln.o: vi.h emacs.h common.h help.h fcns.h -history.o: vi.h emacs.h common.h help.h fcns.h -historyn.o: vi.h emacs.h common.h help.h fcns.h -map.o: vi.h emacs.h common.h help.h fcns.h -chartype.o: vi.h emacs.h common.h help.h fcns.h -prompt.o: vi.h emacs.h common.h help.h fcns.h -readline.o: vi.h emacs.h common.h help.h fcns.h -search.o: vi.h emacs.h common.h help.h fcns.h -tokenizer.o: vi.h emacs.h common.h help.h fcns.h -tokenizern.o: vi.h emacs.h common.h help.h fcns.h -vi.o: vi.h emacs.h common.h help.h fcns.h -common.o: vi.h emacs.h common.h help.h fcns.h -emacs.o: vi.h emacs.h common.h help.h fcns.h -hist.o: vi.h emacs.h common.h help.h fcns.h -keymacro.o: vi.h emacs.h common.h help.h fcns.h -parse.o: vi.h emacs.h common.h help.h fcns.h -read.o: vi.h emacs.h common.h help.h fcns.h -refresh.o: vi.h emacs.h common.h help.h fcns.h -sig.o: vi.h emacs.h common.h help.h fcns.h -terminal.o: vi.h emacs.h common.h help.h fcns.h -tty.o: vi.h emacs.h common.h help.h fcns.h -help.o: vi.h emacs.h common.h help.h fcns.h -fcns.o: vi.h emacs.h common.h help.h fcns.h -filecomplete.o: vi.h emacs.h common.h help.h fcns.h 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..abe83b5a85c --- /dev/null +++ b/cmd-line-utils/readline/CMakeLists.txt @@ -0,0 +1,60 @@ +# Copyright (c) 2006, 2011, 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) + +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 deleted file mode 100644 index e1e9645e238..00000000000 --- a/cmd-line-utils/readline/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -## Process this file with automake to create Makefile.in -# Makefile for the GNU readline library. -# Copyright (C) 1994,1996,1997 Free Software Foundation, Inc. - -# Last -I$(top_srcdir) needed for RedHat! -INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ - -I$(top_srcdir) - -noinst_LIBRARIES = libreadline.a - -libreadline_a_SOURCES = 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 - -noinst_HEADERS = readline.h chardefs.h keymaps.h \ - history.h tilde.h rlmbutil.h rltypedefs.h rlprivate.h \ - rlshell.h xmalloc.h \ -\ - config_readline.h rldefs.h histlib.h rlwinsize.h \ - posixstat.h posixdir.h posixjmp.h \ - tilde.h rlconf.h rltty.h ansi_stdlib.h \ - tcap.h rlstdc.h - -EXTRA_DIST= emacs_keymap.c vi_keymap.c - -DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR -D_GNU_SOURCE=1 - -# Don't update the files from bitkeeper -%::SCCS/s.% |