From 96d22e4f099f381409c7a7fb64e98813870b1ca4 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Fri, 9 Aug 2019 13:25:46 -0300 Subject: [PATCH] Delaying load of lib3270 on windows. --- client/Makefile.in | 2 ++ client/sdk/ipc3270-static.pc.in | 2 +- client/sdk/ipc3270.pc.in | 2 +- client/src/core/session.cc | 2 +- client/src/testprogram/testprogram.cc | 3 ++- common/src/include/config.h.in | 3 +++ common/src/include/lib3270/ipc.h | 3 +-- configure.ac | 24 ++++++++++++------------ 8 files changed, 23 insertions(+), 18 deletions(-) diff --git a/client/Makefile.in b/client/Makefile.in index f44f926..9565129 100644 --- a/client/Makefile.in +++ b/client/Makefile.in @@ -97,6 +97,8 @@ CFLAGS= \ @LIB3270_CFLAGS@ \ @DBUS_CFLAGS@ +LDFLAGS=@LDFLAGS@ + LIBS= \ @LIBS@ \ @LIBICONV@ \ diff --git a/client/sdk/ipc3270-static.pc.in b/client/sdk/ipc3270-static.pc.in index 88db5c1..0d28757 100644 --- a/client/sdk/ipc3270-static.pc.in +++ b/client/sdk/ipc3270-static.pc.in @@ -6,6 +6,6 @@ includedir=@includedir@ Name: @PACKAGE_NAME@-static Description: @PACKAGE_DESCRIPTION@ (static library) Version: @PACKAGE_VERSION@ -Libs: -L\@libdir@ -lipc3270-static @LIB3270_LIBS@ @DBUS_LIBS@ @LIBS@ +Libs: -lipc3270-static @LIB3270_LIBS@ @DBUS_LIBS@ @LIBS@ Cflags: -I@includedir@ diff --git a/client/sdk/ipc3270.pc.in b/client/sdk/ipc3270.pc.in index cc565a3..6146f93 100644 --- a/client/sdk/ipc3270.pc.in +++ b/client/sdk/ipc3270.pc.in @@ -6,7 +6,7 @@ includedir=@includedir@ Name: @PACKAGE_NAME@ Description: @PACKAGE_DESCRIPTION@ Version: @PACKAGE_VERSION@ -Libs: -L\@libdir@ -lipc3270 +Libs: -lipc3270 Libs.private: @LIBS@ @LIBICONV@ @INTL_LIBS@ @LIB3270_LIBS@ @DBUS_LIBS@ Cflags: -I@includedir@ diff --git a/client/src/core/session.cc b/client/src/core/session.cc index 49e9d58..b9a2b0c 100644 --- a/client/src/core/session.cc +++ b/client/src/core/session.cc @@ -48,7 +48,7 @@ debug("Creating session with ID \"",id,"\""); - if(!id) { + if(!(id && *id)) { return new Local::Session(); } diff --git a/client/src/testprogram/testprogram.cc b/client/src/testprogram/testprogram.cc index 02b6ef2..42119f1 100644 --- a/client/src/testprogram/testprogram.cc +++ b/client/src/testprogram/testprogram.cc @@ -39,6 +39,7 @@ #include #include #include + #include using namespace std; @@ -46,7 +47,7 @@ int main(int argc, char **argv) { - const char * session = "pw3270:a"; + const char * session = ""; // "pw3270:a"; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" diff --git a/common/src/include/config.h.in b/common/src/include/config.h.in index 0cf8256..ea13970 100644 --- a/common/src/include/config.h.in +++ b/common/src/include/config.h.in @@ -38,6 +38,9 @@ #undef HAVE_ICONV #undef ICONV_CONST + #undef LIB3270_DELAYED + #undef LIB3270_DYNAMIC + #undef HAVE_VASPRINTF diff --git a/common/src/include/lib3270/ipc.h b/common/src/include/lib3270/ipc.h index 6146362..e08fd10 100644 --- a/common/src/include/lib3270/ipc.h +++ b/common/src/include/lib3270/ipc.h @@ -178,7 +178,7 @@ SELECT_ALL, UNSELECT, RESELECT, - DELETE, + CHAR_DELETE, DUP, FIELDMARK, BACKSPACE, @@ -193,7 +193,6 @@ WORD_DELETE, ///< @brief Backspaces the cursor until it hits the front of a word (does a ^W). FIELD_DELETE, ///< @brief Delete field key (does a ^U). SYSREQ - }; /// @brief TN3270 Session. diff --git a/configure.ac b/configure.ac index 6f1fdf8..c453660 100644 --- a/configure.ac +++ b/configure.ac @@ -79,9 +79,9 @@ DLLPREFIX="lib" case "$host" in *-mingw32|*-pc-msys) app_cv_osname="windows" - CFLAGS="$CFLAGS -pthread -D_WIN32_WINNT=0x0600" + CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0600" LIBS="$LIBS -lws2_32 -lwtsapi32 -lcomdlg32" - LDFLAGS="$LDFLAGS -pthread" + LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++" DLLEXT=".dll" DLLPREFIX="" @@ -211,31 +211,31 @@ dnl --------------------------------------------------------------------------- dnl Check for LIB3270 dnl --------------------------------------------------------------------------- -AC_ARG_WITH([static-lib3270], - [AS_HELP_STRING([--with-static-lib3270], [Uses static version of lib3270])], +AC_ARG_WITH([delayed-lib3270], + [AS_HELP_STRING([--with-delayed-lib3270], [Uses delayed version of lib3270 (WIN32 Only)])], [ - app_cv_static_lib3270=$withval + app_cv_delayed_lib3270=$withval ],[ - app_cv_static_lib3270=auto + app_cv_delayed_lib3270="auto" ]) -if test "$app_cv_static_lib3270" == "auto"; then +if test "$app_cv_delayed_lib3270" == "auto"; then case "$host" in *-mingw32|*-pc-msys) - app_cv_static_lib3270="yes" + app_cv_delayed_lib3270="yes" ;; *) - app_cv_static_lib3270="no" + app_cv_delayed_lib3270="no" esac fi -if test "$app_cv_static_lib3270" == "yes"; then - PKG_CHECK_MODULES( [LIB3270], [lib3270-static], AC_DEFINE(HAVE_LIB3270), AC_MSG_ERROR([LIB3270 not present.])) +if test "$app_cv_delayed_lib3270" == "yes"; then + PKG_CHECK_MODULES( [LIB3270], [lib3270-delayed], AC_DEFINE(LIB3270_DELAYED), AC_MSG_ERROR([LIB3270 delayed module is not present.])) else - PKG_CHECK_MODULES( [LIB3270], [lib3270], AC_DEFINE(HAVE_LIB3270), AC_MSG_ERROR([LIB3270 not present.])) + PKG_CHECK_MODULES( [LIB3270], [lib3270], AC_DEFINE(LIB3270_DYNAMIC), AC_MSG_ERROR([LIB3270 dynamic module is not present.])) fi AC_SUBST(LIB3270_LIBS) -- libgit2 0.21.2