changeset 5843:69f9e31c9ccf

Fix progress bar crashes. Thanks to Ralf Soergel for diagnosis and the configure test. 2015-01-08 Stephen J. Turnbull <stephen@xemacs.org> * config.h.in (HAVE_ATHENA_I18N): New #define. * lwlib/xt-wrappers.h (HAVE_ATHENA_I18N): Define XAW_INTERNATIONALIZATION when needed. * configure.ac (Athena widgets): Test for international resource in SimpleWidgetClass in libXaw3d.
author Stephen J. Turnbull <stephen@xemacs.org>
date Sat, 10 Jan 2015 17:11:19 +0900
parents 9e5f3a0d4e66
children 83e5c3cd6be6
files ChangeLog configure configure.ac lwlib/ChangeLog lwlib/xt-wrappers.h src/ChangeLog src/config.h.in
diffstat 7 files changed, 112 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Jan 03 16:24:56 2015 +0100
+++ b/ChangeLog	Sat Jan 10 17:11:19 2015 +0900
@@ -1,3 +1,12 @@
+2015-01-08  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	Fix progress bar crashes.
+	Thanks to Ralf Soergel for diagnosis and a patch.
+
+	* configure.ac (Athena widgets):
+	Test for "international" resource in SimpleWidgetClass in libXaw3d.
+	* configure: Rebuild.
+
 2014-11-09  Jeff Sparkes  <jsparkes@gmail.com>
 
 	* configure.ac (HAVE_GNUTLS): Add SSL/TLS libraries to $LIBS, not
--- a/configure	Sat Jan 03 16:24:56 2015 +0100
+++ b/configure	Sat Jan 10 17:11:19 2015 +0900
@@ -16802,6 +16802,52 @@
 
     if test -n "$athena_lib" -a -n "$athena_h_path"; then
     have_xaw=yes
+    have_athena_i18n=unset
+                    if test "$athena_variant" = "Xaw3d"; then
+      save_libs_x=$libs_x
+      libs_x="-lXaw3d $libs_x" &&  if test "$verbose" = "yes"; then echo "    Prepending \"-lXaw3d\" to \$libs_x"; fi
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"international\" resource in Xaw3d SimpleWidget" >&5
+$as_echo_n "checking for \"international\" resource in Xaw3d SimpleWidget... " >&6; }
+      if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+        #include <string.h>
+        #undef XAW_INTERNATIONALIZATION
+        #include <$athena_h_path/Simple.h>
+
+int
+main ()
+{
+int i = simpleWidgetClass->core_class.num_resources;
+         while (i-- > 0)
+           if (!strcmp(simpleWidgetClass->core_class.resources[i].resource_name,
+                       "international"))
+             exit(0);
+         exit(253);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  have_athena_i18n=yes
+else
+  have_athena_i18n=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+      libs_x=$save_libs_x
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_athena_i18n" >&5
+$as_echo "$have_athena_i18n" >&6; }
+    fi
   else
     have_xaw=no
   fi
@@ -17006,10 +17052,13 @@
     $as_echo "#define NEED_ATHENA 1" >>confdefs.h
 
     need_athena="yes"
-
     if test "$athena_3d" = "yes"; then
       $as_echo "#define HAVE_ATHENA_3D 1" >>confdefs.h
 
+      if test "$have_athena_i18n" = "yes"; then
+        $as_echo "#define HAVE_ATHENA_I18N 1" >>confdefs.h
+
+      fi
     fi
   ;;
 esac
--- a/configure.ac	Sat Jan 03 16:24:56 2015 +0100
+++ b/configure.ac	Sat Jan 10 17:11:19 2015 +0900
@@ -4053,6 +4053,35 @@
   dnl Do we actually have a usable Athena widget set? Please?
   if test -n "$athena_lib" -a -n "$athena_h_path"; then
     have_xaw=yes
+    have_athena_i18n=unset
+    dnl   X.org at some point added .international to SimplePart, protected
+    dnl by #ifdef XAW_INTERNATIONALIZATION in Xaw3d (only?).  Unfortunately,
+    dnl the distributed headers for Xaw3d don't set this to correspond to
+    dnl the distributed library.  (pkg-config does, if present.)
+    if test "$athena_variant" = "Xaw3d"; then
+      save_libs_x=$libs_x
+      XE_PREPEND(-lXaw3d, libs_x)
+      dnl The test below was provided by Ralf Soergel.
+      AC_MSG_CHECKING([for "international" resource in Xaw3d SimpleWidget])
+      AC_RUN_IFELSE(
+      [AC_LANG_PROGRAM(
+       [#include <stdlib.h>
+        #include <string.h>
+        #undef XAW_INTERNATIONALIZATION
+        #include <$athena_h_path/Simple.h>
+       ],
+       [[int i = simpleWidgetClass->core_class.num_resources;
+         while (i-- > 0)
+           if (!strcmp(simpleWidgetClass->core_class.resources[i].resource_name,
+                       "international"))
+             exit(0);
+         exit(253);
+       ]])],
+      [have_athena_i18n=yes],
+      [have_athena_i18n=no])
+      libs_x=$save_libs_x
+      AC_MSG_RESULT([$have_athena_i18n])
+    fi
   else
     have_xaw=no
   fi
@@ -4185,9 +4214,11 @@
     AC_DEFINE(LWLIB_USES_ATHENA)
     AC_DEFINE(NEED_ATHENA)
     need_athena="yes"
-
     if test "$athena_3d" = "yes"; then
       AC_DEFINE(HAVE_ATHENA_3D)
+      if test "$have_athena_i18n" = "yes"; then
+        AC_DEFINE(HAVE_ATHENA_I18N)
+      fi
     fi
   ;;
 esac
--- a/lwlib/ChangeLog	Sat Jan 03 16:24:56 2015 +0100
+++ b/lwlib/ChangeLog	Sat Jan 10 17:11:19 2015 +0900
@@ -1,3 +1,11 @@
+2015-01-08  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	Fix progress bar crashes.
+	Thanks to Ralf Soergel for diagnosis and a patch.
+
+	* xt-wrappers.h (HAVE_ATHENA_I18N):
+	Define XAW_INTERNATIONALIZATION when needed.
+
 2013-06-23  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* XEmacs 21.5.34 "kale" is released.
--- a/lwlib/xt-wrappers.h	Sat Jan 03 16:24:56 2015 +0100
+++ b/lwlib/xt-wrappers.h	Sat Jan 10 17:11:19 2015 +0900
@@ -21,6 +21,11 @@
 
 /* Original author: Stephen J. Turnbull for 21.5.29 */
 
+/* #### Factor out into xaw-wrappers (which would #include this file)? */
+#ifdef HAVE_ATHENA_I18N
+#define XAW_INTERNATIONALIZATION 1
+#endif
+
 /* Generic utility macros, including coping with G++ whining.
    Used in lwlib via lwlib.h and X consoles via console-x.h.
 
--- a/src/ChangeLog	Sat Jan 03 16:24:56 2015 +0100
+++ b/src/ChangeLog	Sat Jan 10 17:11:19 2015 +0900
@@ -1,3 +1,10 @@
+2015-01-08  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	Fix progress bar crashes.
+	Thanks to Ralf Soergel for diagnosis and a patch.
+
+	* config.h.in (HAVE_ATHENA_I18N): New #define.
+
 2014-12-13  Marcus Crestani  <crestani@xemacs.org>
 
 	* dumper.c (pdump_register_sub): Don't leave fields uninitialized.
--- a/src/config.h.in	Sat Jan 03 16:24:56 2015 +0100
+++ b/src/config.h.in	Sat Jan 10 17:11:19 2015 +0900
@@ -868,6 +868,7 @@
 #undef LWLIB_WIDGETS_MOTIF
 #undef LWLIB_WIDGETS_ATHENA
 #undef HAVE_ATHENA_3D
+#undef HAVE_ATHENA_I18N
 
 /* Other things that can be disabled by configure. */
 #undef HAVE_MENUBARS