From 1dc317d49e3aa849f6c93100fffeb6ca86f8b5e8 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Mon, 13 Jul 2020 13:24:30 -0300 Subject: [PATCH] Fixing windows executable format. --- configure.ac | 8 +++++++- src/main/main.c | 18 ++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index bab460e..ff09cb9 100644 --- a/configure.ac +++ b/configure.ac @@ -206,7 +206,13 @@ AC_ARG_ENABLE([pie], [ app_cv_pie="$enableval" ],[ - app_cv_pie="yes" + + if test "$app_cv_osname" == "linux"; then + app_cv_pie="yes" + else + app_cv_pie="no" + fi + ]) if test "$app_cv_pie" == "yes"; then diff --git a/src/main/main.c b/src/main/main.c index 62f7e5e..d0c1806 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -71,13 +71,17 @@ static gboolean quit_signal(GtkApplication *app) { #endif // G_OS_UNIX static void g_log_to_lib3270(const gchar *log_domain,GLogLevelFlags G_GNUC_UNUSED(log_level),const gchar *message,gpointer G_GNUC_UNUSED(user_data)) { + debug("%s",message); lib3270_write_log(NULL,log_domain ? log_domain : G_STRINGIFY(PRODUCT_NAME),"%s",message); } int main (int argc, char **argv) { + int status = -1; + + debug("Process %s running on pid %u\n",argv[0],(unsigned int) GetCurrentProcessId()); + GtkApplication *app; - int status; // Setup locale #ifdef LC_ALL @@ -92,24 +96,26 @@ int main (int argc, char **argv) { } #endif // _WIN32 +#ifndef DEBUG g_log_set_default_handler(g_log_to_lib3270,NULL); +#endif // !DEBUG bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); textdomain(PACKAGE_NAME); +#ifdef G_OS_UNIX + g_unix_signal_add(SIGTERM, (GSourceFunc) quit_signal, app); +#endif // G_OS_UNIX + // Setup and start application. g_set_application_name(G_STRINGIFY(PRODUCT_NAME)); app = pw3270_application_new("br.com.bb." G_STRINGIFY(PRODUCT_NAME),G_APPLICATION_HANDLES_OPEN); -#ifdef G_OS_UNIX - // Termination - g_unix_signal_add(SIGTERM, (GSourceFunc) quit_signal, app); -#endif // G_OS_UNIX - status = g_application_run(G_APPLICATION (app), argc, argv); g_object_unref (app); + debug("%s ends with RC=%d",__FUNCTION__,status); return status; } -- libgit2 0.21.2