From e3e897ee8308b69a3c5b7b50eb8fd5004ccffb79 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Wed, 7 Jun 2017 16:47:48 +0000 Subject: [PATCH] changed build files to detect a library containing setupterm() --- moo/Makefile.in | 1 + moo/configure | 62 +++++++++++++++++++++++++++++++++++++++++++++ moo/configure.ac | 6 +++++ moo/kernel/X11.moo | 48 +++++++++++++++++++++++++---------- moo/lib/Makefile.in | 1 + moo/mod/Makefile.am | 2 +- moo/mod/Makefile.in | 6 +++-- 7 files changed, 110 insertions(+), 16 deletions(-) diff --git a/moo/Makefile.in b/moo/Makefile.in index 0d684ae..93aa608 100644 --- a/moo/Makefile.in +++ b/moo/Makefile.in @@ -312,6 +312,7 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +TERMINAL_LIBS = @TERMINAL_LIBS@ UNICOWS_LIBS = @UNICOWS_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ diff --git a/moo/configure b/moo/configure index fe3bf86..f22a7bb 100755 --- a/moo/configure +++ b/moo/configure @@ -674,6 +674,7 @@ PACKAGE_VERSION_MINOR PACKAGE_VERSION_MAJOR QUADMATH_LIBS UNICOWS_LIBS +TERMINAL_LIBS DYNCALL_LIBS LIBM WIN32_FALSE @@ -18998,6 +18999,67 @@ fi +save_LIBS="$LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setupterm" >&5 +$as_echo_n "checking for library containing setupterm... " >&6; } +if ${ac_cv_search_setupterm+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char setupterm (); +int +main () +{ +return setupterm (); + ; + return 0; +} +_ACEOF +for ac_lib in '' tinfo termcap curses ncurses ncursesw; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_setupterm=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_setupterm+:} false; then : + break +fi +done +if ${ac_cv_search_setupterm+:} false; then : + +else + ac_cv_search_setupterm=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_setupterm" >&5 +$as_echo "$ac_cv_search_setupterm" >&6; } +ac_res=$ac_cv_search_setupterm +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + TERMINAL_LIBS="$ac_cv_search_setupterm" +fi + +LIBS="$save_LIBS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lunicows" >&5 $as_echo_n "checking for main in -lunicows... " >&6; } if ${ac_cv_lib_unicows_main+:} false; then : diff --git a/moo/configure.ac b/moo/configure.ac index 67b9e0a..be53fe6 100644 --- a/moo/configure.ac +++ b/moo/configure.ac @@ -178,6 +178,12 @@ AC_CHECK_LIB([dyncall_s], [dcNewCallVM], ) AC_SUBST(DYNCALL_LIBS) +save_LIBS="$LIBS" +AC_SEARCH_LIBS([setupterm], [tinfo termcap curses ncurses ncursesw], [TERMINAL_LIBS="$ac_cv_search_setupterm"]) +LIBS="$save_LIBS" +AC_SUBST(TERMINAL_LIBS) + + dnl check is the import library for unicows.dll exists dnl this check doesn't look for a particular symbol dnl but for the symbol 'main' since i want to check diff --git a/moo/kernel/X11.moo b/moo/kernel/X11.moo index 6098b43..227347d 100644 --- a/moo/kernel/X11.moo +++ b/moo/kernel/X11.moo @@ -35,8 +35,13 @@ class X11.Exception(System.Exception) class X11.Rectangle(Object) { - var x := 0, y := 0, width := 0, height := 0. + var(#get,#set) + x := 0, + y := 0, + width := 0, + height := 0. +(* method x { ^self.x } method y { ^self.y } method width { ^self.width } @@ -46,6 +51,7 @@ class X11.Rectangle(Object) method y: y { self.y := y } method width: width { self.width := width } method height: height { self.height := height } +*) method x: x y: y width: width height: height { @@ -94,19 +100,24 @@ pooldic X11.MouseButton class X11.MouseEvent(X11.Event) { - var x, y, button. + var(#get,#set) + x := 0, + y := 0, + button := 0. ## X11.MouseButton - method x { ^self.x } - method y { ^self.y } - method button { ^self.button } ## X11.MouseButton - - method initialize +(* + method initialize { self.x := 0. self.y := 0. self.button := 0. } - + + method x { ^self.x } + method y { ^self.y } + method button { ^self.button } ## X11.MouseButton +*) + method x: x y: y button: button { self.x := x. @@ -117,19 +128,25 @@ class X11.MouseEvent(X11.Event) class X11.MouseWheelEvent(X11.Event) { - var x, y, amount. + var(#get) + x := 0, + y := 0, + amount := 0. - method x { ^self.x } +(* method x { ^self.x } method y { ^self.y } method amount { ^self.amount } +*) +(* method initialize { self.x := 0. self.y := 0. self.amount := 0. } - +*) + method x: x y: y amount: amount { self.x := x. @@ -140,8 +157,13 @@ class X11.MouseWheelEvent(X11.Event) class X11.ExposeEvent(X11.Event) { - var x, y, width, height. + var(#get) + x := 0, + y := 0, + width := 0, + height := 0. +(* method x { ^self.x } method y { ^self.y } method width { ^self.width } @@ -153,7 +175,7 @@ class X11.ExposeEvent(X11.Event) self.y := 0. self.width := 0. self.height := 0. - } + }*) method x: x y: y width: width height: height { diff --git a/moo/lib/Makefile.in b/moo/lib/Makefile.in index 0405223..096a43b 100644 --- a/moo/lib/Makefile.in +++ b/moo/lib/Makefile.in @@ -345,6 +345,7 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +TERMINAL_LIBS = @TERMINAL_LIBS@ UNICOWS_LIBS = @UNICOWS_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ diff --git a/moo/mod/Makefile.am b/moo/mod/Makefile.am index e03d8d0..96e8d6e 100644 --- a/moo/mod/Makefile.am +++ b/moo/mod/Makefile.am @@ -55,7 +55,7 @@ endif libmoo_console_la_SOURCES = console.c console.h libmoo_console_la_CPPFLAGS = $(CPPFLAGS_COMMON) libmoo_console_la_LDFLAGS = $(LDFLAGS_COMMON) -libmoo_console_la_LIBADD = $(LIBADD_COMMON) -ltermcap +libmoo_console_la_LIBADD = $(LIBADD_COMMON) $(TERMINAL_LIBS) if ENABLE_MOD_FFI libmoo_ffi_la_SOURCES = ffi.c _ffi.h diff --git a/moo/mod/Makefile.in b/moo/mod/Makefile.in index 1b74286..c03bbfe 100644 --- a/moo/mod/Makefile.in +++ b/moo/mod/Makefile.in @@ -142,7 +142,8 @@ am__uninstall_files_from_dir = { \ am__installdirs = "$(DESTDIR)$(pkgmodexecdir)" LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkgmodexec_LTLIBRARIES) am__DEPENDENCIES_1 = -libmoo_console_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +libmoo_console_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) am_libmoo_console_la_OBJECTS = libmoo_console_la-console.lo libmoo_console_la_OBJECTS = $(am_libmoo_console_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -358,6 +359,7 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +TERMINAL_LIBS = @TERMINAL_LIBS@ UNICOWS_LIBS = @UNICOWS_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ @@ -443,7 +445,7 @@ CPPFLAGS_COMMON = -I$(abs_builddir) -I$(abs_builddir)/../lib \ libmoo_console_la_SOURCES = console.c console.h libmoo_console_la_CPPFLAGS = $(CPPFLAGS_COMMON) libmoo_console_la_LDFLAGS = $(LDFLAGS_COMMON) -libmoo_console_la_LIBADD = $(LIBADD_COMMON) -ltermcap +libmoo_console_la_LIBADD = $(LIBADD_COMMON) $(TERMINAL_LIBS) @ENABLE_MOD_FFI_TRUE@libmoo_ffi_la_SOURCES = ffi.c _ffi.h @ENABLE_MOD_FFI_TRUE@libmoo_ffi_la_CPPFLAGS = $(CPPFLAGS_COMMON) @ENABLE_MOD_FFI_TRUE@libmoo_ffi_la_LDFLAGS = $(LDFLAGS_COMMON)