Submitted by:            Zeckma
Date:                    2026-03-06
Initial Package Version: 2.3.8
Origin:                  Gentoo via
                         https://dev.gentoo.org/~ulm/distfiles/motif-2.3.8-patches-5.tar.xz
Upstream Status:         Not applied, abandoned
Description:             Multiple fixes ranging from runtime to buildtime.

diff '--color=auto' -Naur motif-2.3.8.orig/acinclude.m4 motif-2.3.8/acinclude.m4
--- motif-2.3.8.orig/acinclude.m4	2017-08-27 20:29:50.000000000 -0600
+++ motif-2.3.8/acinclude.m4	2026-03-06 18:54:16.121242645 -0700
@@ -18,6 +18,7 @@
 CFLAGS="$X_CFLAGS $CFLAGS"
 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
 AC_TRY_RUN([
+#include <stdlib.h>
 #include <X11/Intrinsic.h>
 int main() {
 Boolean brc;
@@ -50,7 +51,8 @@
 AC_DEFUN([AM_FUNC_VOID_SPRINTF],
 [AC_CACHE_CHECK(whether sprintf returns void, ac_cv_func_void_sprintf,
 [AC_TRY_RUN([#include <stdio.h>
-int sprintf(); main() { exit(sprintf(".")); }],
+#include <stdlib.h>
+int main() { exit(sprintf(".")); }],
   ac_cv_func_void_sprintf=no, ac_cv_func_void_sprintf=yes, ac_cv_func_void_sprintf=yes)])
 if test $ac_cv_func_void_sprintf = no; then
   AC_DEFINE(VOID_SPRINTF,1,
diff '--color=auto' -Naur motif-2.3.8.orig/bindings/xmbind.alias motif-2.3.8/bindings/xmbind.alias
--- motif-2.3.8.orig/bindings/xmbind.alias	2016-03-15 20:10:08.000000000 -0600
+++ motif-2.3.8/bindings/xmbind.alias	2026-03-06 18:54:16.114449535 -0700
@@ -62,3 +62,4 @@
 "Sun Microsystems, Inc."				sun
 ! "Sun Microsystems, Inc."				sun_at
 "Tektronix, Inc."					tek
+"The X.Org Foundation"					pc
diff '--color=auto' -Naur motif-2.3.8.orig/clients/mwm/WmError.c motif-2.3.8/clients/mwm/WmError.c
--- motif-2.3.8.orig/clients/mwm/WmError.c	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/clients/mwm/WmError.c	2026-03-06 18:54:16.122633774 -0700
@@ -131,7 +131,7 @@
     XSetIOErrorHandler (WmXIOErrorHandler);
 
     XtSetWarningHandler (WmXtWarningHandler);
-    XtSetErrorHandler (WmXtErrorHandler);
+    XtSetErrorHandler ((XtErrorHandler _X_NORETURN)WmXtErrorHandler);
 
 } /* END OF FUNCTION WmInitErrorHandler */
 
diff '--color=auto' -Naur motif-2.3.8.orig/clients/uil/UilDefI.h motif-2.3.8/clients/uil/UilDefI.h
--- motif-2.3.8.orig/clients/uil/UilDefI.h	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/clients/uil/UilDefI.h	2026-03-06 18:54:16.101716786 -0700
@@ -263,7 +263,7 @@
 #include "UilIODef.h"
 #include "UilDiagDef.h"
 #include "UilSarDef.h"
-#if defined(linux) || defined(__APPLE__)
+#if defined(linux) || defined(__APPLE__) || defined(sun)
 #define YYSTYPE yystype
 #endif
 #include "UilLexPars.h"
diff '--color=auto' -Naur motif-2.3.8.orig/clients/uil/UilDefI.h.orig motif-2.3.8/clients/uil/UilDefI.h.orig
--- motif-2.3.8.orig/clients/uil/UilDefI.h.orig	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/clients/uil/UilDefI.h.orig	2017-08-16 18:38:43.000000000 -0600
@@ -0,0 +1,610 @@
+/* 
+ * Motif
+ *
+ * Copyright (c) 1987-2012, The Open Group. All rights reserved.
+ *
+ * These libraries and programs are free software; you can
+ * redistribute them and/or modify them under the terms of the GNU
+ * Lesser General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * These libraries and programs are distributed in the hope that
+ * they will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with these librararies and programs; if not, write
+ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301 USA
+*/ 
+
+/*
+**++
+**  FACILITY:
+**
+**      User Interface Language Compiler (UIL)
+**
+**  ABSTRACT:
+**
+**      This include file defines the set of definitions used by all of
+**	modules of the UIL compiler.
+**
+**--
+**/
+
+#ifndef UilDefI_h
+#define UilDefI_h
+
+
+/*
+**
+**  INCLUDE FILES
+**
+**/
+
+#define X_INCLUDE_TIME_H
+#define XOS_USE_XT_LOCKING
+#ifdef HAVE_X11_XOS_R_H
+#include <X11/Xos_r.h>
+#else
+#include <Xm/Xmos_r.h>
+#endif
+
+#include <Mrm/MrmAppl.h>
+#include <Mrm/Mrm.h>
+
+/*
+**                                    
+**  Universal Definitions
+**
+*/
+
+#define _compiler_version "V2.0-000"
+#define _compiler_version_int 2
+#define _data_version 2
+#define _host_compiler "Motif Uil Compiler"
+
+#ifdef TRUE
+#undef TRUE
+#endif
+#define TRUE	 	1
+
+#ifdef FALSE
+#undef FALSE
+#endif
+#define FALSE	  	0
+
+#ifndef debug_version
+#define debug_version	FALSE
+#endif
+
+#define NOSTRING_DIRECTION 2
+
+#define k_normal  	1
+#define k_error   	0
+
+typedef int status;
+typedef int boolean;
+
+/*
+**  Copy const handling from XmP.h.
+*/
+
+#ifndef XmConst
+#if defined(__STDC__) || !defined( NO_CONST )
+#define XmConst const
+#else
+#define XmConst
+#endif /* __STDC__ */
+#endif /* XmConst */
+
+/* Uil will automatically strip this prefix when saving name of automatically
+ * created child.  This is used to prevent name conflicts in existing uil 
+ * files.  Children names without this prefix will be saved as is.
+ */
+#define AUTO_CHILD_PREFIX "Xm_"
+
+/*
+**
+**  Constants controlling limits in the compiler
+**
+*/
+
+#define src_k_max_source_files		101
+#define src_k_max_source_line_length	132
+#define lex_k_unprint_sub		'?'
+#define sym_k_max_list_count		1000
+#define sym_k_max_color_count		256
+#define Uil_k_max_include_dir_count	32
+
+/*
+**
+**  Definition of Compiler Termination Statuses
+**
+*/
+
+#define uil_k_min_status	Uil_k_min_status
+#define uil_k_success_status	Uil_k_success_status
+#define uil_k_info_status	Uil_k_info_status
+#define uil_k_warning_status	Uil_k_warning_status
+#define uil_k_error_status	Uil_k_error_status
+#define uil_k_severe_status	Uil_k_severe_status
+#define uil_k_max_status	Uil_k_max_status
+
+
+/*
+**
+**  Macros to access bit vectors
+**
+*/
+
+/* MOVED TO DBDef.h */
+
+
+/*
+**
+**  Upper and Lower Case Translation Macros
+**
+*/
+
+#define _upper(c)	((c) >= 'a' && (c) <= 'z' ? (c) & 0x5F:(c))
+#define _lower(c)	((c) >= 'A' && (c) <= 'Z' ? (c) | 0x20:(c))
+
+
+/*
+**
+**  Assert Macro
+**
+*/
+
+#if debug_version
+#define _assert( __condition, __text )			\
+	if (!(__condition))				\
+	{  diag_issue_internal_error( (__text)); }
+#else
+#define _assert( __condition, __text )			\
+	if (!(__condition))				\
+	{  diag_issue_internal_error( NULL ); }
+#endif
+
+/*
+**
+**  _error and _okay macro
+**
+*/
+
+#define _error( __status )	\
+	((__status & 1)==0)
+
+#define _success( __status )	\
+	((__status & 1)==1)
+
+
+/*
+**
+**  Memory allocation definitions
+**
+*/
+
+#define _get_memory XtMalloc
+
+#define _free_memory XtFree
+
+/*
+**
+**  Move macro
+**
+*/
+
+#ifdef NO_MEMMOVE
+/* For fixing the bug CR 4581 */
+extern char* uil_mmove(char*, char*, int);
+
+#define _move uil_mmove
+#else
+#define _move memmove
+#endif /* NO_MEMMOVE */
+
+/*
+**
+**  Compare macro
+**
+*/
+
+#define _compare strcmp
+
+/*
+**
+**  Fill macro
+**
+*/
+
+#define _fill( __string, __char, __len )	\
+    {						\
+      register int i = __len; 			\
+      while (--i >= 0)				\
+	(__string)[i] = __char;			\
+    }
+
+/*
+**
+**  Index macro
+**
+*/
+
+#define _index( __char, __string, __len ) \
+    ((int)((char *)memchr( __string, __char, __len ) - (char *)__string ))
+
+/*
+**
+**  Debug output macro
+**
+*/
+#if debug_version
+#define _debug_output lst_debug_output
+#else
+#define _debug_output printf
+#endif
+
+
+/*
+**
+** Common includes needed by most modules
+**
+*/
+#include "Uil.h"
+#include "UilDBDef.h"                      /* for binary database */
+#include "UilMess.h"
+#include "UilSymDef.h"			/* must come before UilKeyDef.h */
+#include "UilSrcDef.h"			/* must come before UilIODef.h */
+#include "UilIODef.h"
+#include "UilDiagDef.h"
+#include "UilSarDef.h"
+#if defined(linux) || defined(__APPLE__)
+#define YYSTYPE yystype
+#endif
+#include "UilLexPars.h"
+#include "UilCmdDef.h"
+#include "UilLexDef.h"
+
+/*
+** Global declarations
+*/
+#include "UilSymGl.h"
+#include "UilCompGl.h"
+
+/* Needed for following macro. */
+#include "UilSymGen.h"
+
+#define DEFAULT_TAG uil_charset_names[sym_k_XmFONTLIST_DEFAULT_TAG_charset]
+
+/*
+** Function declarations not defined elsewhere
+*/
+#define _ARGUMENTS(arglist) arglist
+
+/* uilcmd.c */
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+extern void diag_issue_diagnostic  
+	_ARGUMENTS(( int d_message_number , 
+		    src_source_record_type *az_src_rec ,
+		    int l_start_column, ... ));
+extern void lst_debug_output  _ARGUMENTS(( char *format, ... ));
+
+
+void cmd_decode_command_line  _ARGUMENTS(( int l_arg_count , char *rac_arg_value []));
+
+/* uildb.c */
+extern void db_incorporate _ARGUMENTS(( void ));
+extern void db_read_ints_and_string _ARGUMENTS((_db_header_ptr header));
+extern void db_read_char_table _ARGUMENTS((_db_header_ptr header));
+extern void db_read_length_and_string _ARGUMENTS((_db_header_ptr header));
+extern void db_read_int_and_shorts _ARGUMENTS((_db_header_ptr header));
+extern void db_open_file _ARGUMENTS(( void ));
+extern String get_root_dir_name _ARGUMENTS(( void ));
+extern String init_wmd_path _ARGUMENTS((String filename));
+
+/* uildiags.c */
+extern void diag_issue_summary  _ARGUMENTS(( void ));
+extern char *diag_tag_text  _ARGUMENTS(( int XmConst b_tag ));
+extern char *diag_object_text  _ARGUMENTS(( int XmConst b_type ));
+extern char *diag_value_text  _ARGUMENTS(( int XmConst b_type ));
+extern char *diag_charset_text  _ARGUMENTS(( int XmConst b_type ));
+extern void diag_initialize_diagnostics  _ARGUMENTS(( void ));
+extern void diag_restore_diagnostics  _ARGUMENTS(( void ));
+extern void diag_reset_overflow_handler  _ARGUMENTS(( void ));
+extern void diag_handler  _ARGUMENTS(( int l_error ));
+extern void diag_issue_internal_error  _ARGUMENTS(( char *error_text ));
+extern void write_msg_to_standard_error  _ARGUMENTS(( XmConst int message_number , XmConst char *src_buffer , XmConst char *ptr_buffer , XmConst char *msg_buffer , XmConst char *loc_buffer ));
+extern char XmConst *diag_get_message_abbrev  _ARGUMENTS(( int d_message_number ));
+extern void diag_report_status  _ARGUMENTS(( void ));
+
+/* uilkeytab.c */
+extern key_keytable_entry_type *key_find_keyword  _ARGUMENTS(( unsigned int symbol_length , char *symbol_ptr ));
+extern void key_initialize  _ARGUMENTS(( void ));
+
+/* uillexana.c */
+extern int yylex  _ARGUMENTS(( void ));
+extern void lex_initialize_analyzer  _ARGUMENTS(( void ));
+extern void Uil_lex_cleanup_analyzer  _ARGUMENTS(( void ));
+extern void lex_issue_error  _ARGUMENTS(( int restart_token ));
+extern void issue_control_char_diagnostic  _ARGUMENTS(( unsigned char c_char ));
+extern void lex_filter_unprintable_chars  _ARGUMENTS(( unsigned char *buffer , int length , unsigned long flags ));
+extern long cvt_ascii_to_long  _ARGUMENTS(( unsigned char XmConst *c_text ));
+extern sym_value_entry_type *create_str_entry  _ARGUMENTS(( int l_size , int l_charset , sym_value_entry_type *az_charset_entry ));
+
+/* uillstlst.c */
+extern void lst_open_listing  _ARGUMENTS(( void ));
+extern void Uil_lst_cleanup_listing  _ARGUMENTS(( void ));
+extern status create_listing_file  _ARGUMENTS(( uil_fcb_type *az_fcb ));
+extern void lst_output_line  _ARGUMENTS(( char *ac_line , boolean v_new_page ));
+extern char *current_time  _ARGUMENTS(( _Xctimeparams *ctime_buf ));
+extern void lst_output_listing  _ARGUMENTS(( void ));
+extern void lst_output_messages  _ARGUMENTS(( src_message_item_type *az_message_item ));
+extern void lst_output_machine_code  _ARGUMENTS(( src_source_record_type *az_src_rec ));
+extern void lst_output_message_ptr_line  _ARGUMENTS(( src_source_record_type *az_src_rec , char *src_buffer ));
+
+/* uillstmac.c */
+extern void save_widget_machine_code  _ARGUMENTS(( sym_widget_entry_type *widget_entry , URMResourceContext *az_context ));
+extern void unload_stack  _ARGUMENTS(( char *rec , int rec_size , src_source_record_type *az_src_rec ));
+extern void save_value_machine_code  _ARGUMENTS(( sym_value_entry_type *value_entry , URMResourceContext *az_context ));
+extern void save_module_machine_code  _ARGUMENTS(( src_source_record_type *az_src_rec , URMResourceContext *az_context ));
+extern void off_put  _ARGUMENTS(( unsigned short off_type , unsigned short off_offset ));
+extern void off_get  _ARGUMENTS(( unsigned short *off_type , unsigned short *off_offset ));
+extern char *type_from_code  _ARGUMENTS(( MrmType type_code ));
+extern char *access_from_code  _ARGUMENTS(( MrmFlag access_code ));
+extern char *group_from_code  _ARGUMENTS(( MrmGroup group_code ));
+extern void format_arg_value  _ARGUMENTS(( RGMArgValuePtr argval_ptr , char *buffer ));
+extern char *class_name_from_code  _ARGUMENTS(( MrmCode mrm_class ));
+extern char *resource_name_from_code  _ARGUMENTS(( MrmCode resource ));
+
+/* uilmain.c */
+extern void uil_exit  _ARGUMENTS(( int severity ));
+extern Uil_status_type Uil _ARGUMENTS((Uil_command_type
+*comand_desc,Uil_compile_desc_type *compile_desc,Uil_continue_type
+(*message_cb)(), char *message_data, Uil_continue_type (*status_cb)(),
+char *status_data));
+
+
+/* uilp2out.c */
+extern void sem_output_uid_file  _ARGUMENTS(( void ));
+extern void push  _ARGUMENTS(( sym_entry_type *sym_entry ));
+extern sym_entry_type *pop  _ARGUMENTS(( void ));
+extern void out_emit_widget  _ARGUMENTS(( sym_widget_entry_type *widget_entry ));
+extern void extract_subtree_control  _ARGUMENTS(( sym_list_entry_type *list_entry , sym_control_entry_type **menu_entry , int *count ));
+extern void extract_create_callback  _ARGUMENTS(( sym_list_entry_type *list_entry , sym_callback_entry_type **create_entry ));
+extern void process_all_callbacks  _ARGUMENTS(( sym_list_entry_type *list_entry , int *arglist_index ));
+extern void process_all_arguments  _ARGUMENTS(( sym_list_entry_type *list_entry , int *arglist_index , int *related_count ));
+extern void process_all_controls  _ARGUMENTS(( sym_list_entry_type *list_entry , int *widget_index ));
+extern void out_emit_value  _ARGUMENTS(( sym_value_entry_type *value_entry ));
+extern void emit_callback  _ARGUMENTS(( sym_callback_entry_type *callback_entry , int *arglist_index , boolean emit_create ));
+extern void emit_callback_procedures _ARGUMENTS(( sym_proc_ref_entry_type *proc_ref_entry_next, int *proc_ref_index, MrmOffset callback_offset ));
+extern int count_proc _ARGUMENTS(( sym_list_entry_type *proc_list, int count));
+extern void emit_argument  _ARGUMENTS(( sym_argument_entry_type *argument_entry , int arglist_index , int *related_arg_count ));
+extern void emit_control  _ARGUMENTS(( sym_control_entry_type *control_entry , int control_offset ));
+extern MrmCode ref_value  _ARGUMENTS(( sym_value_entry_type *value_entry , MrmCode *arg_type , long *arg_value , MrmCode *arg_access , char **arg_index , MrmResource_id *arg_id , MrmCode *arg_group ));
+extern MrmCode ref_control  _ARGUMENTS(( sym_control_entry_type *control_entry , MrmCode *access , char **index , MrmResource_id *id ));
+extern void issue_urm_error  _ARGUMENTS(( char *problem ));
+extern MrmCode Urm_code_from_uil_type  _ARGUMENTS(( int uil_type ));
+extern int compute_color_table_size  _ARGUMENTS(( sym_value_entry_type *table_entry ));
+extern void create_color_table  _ARGUMENTS(( sym_value_entry_type *table_entry , char *buffer ));
+extern int compute_icon_size  _ARGUMENTS(( sym_value_entry_type *icon_entry ));
+extern void create_icon  _ARGUMENTS(( sym_value_entry_type *icon_entry , char *buffer ));
+extern int compute_list_size  _ARGUMENTS(( sym_list_entry_type *list_entry , int type ));
+extern void create_int_compression_codes  _ARGUMENTS(( void ));
+extern void create_ext_compression_codes  _ARGUMENTS(( void ));
+
+/* uilp2reslv.c */
+extern void sem_resolve_forward_refs  _ARGUMENTS(( void ));
+
+/* uilsarcomp.c */
+extern sym_value_entry_type *sem_create_cstr  _ARGUMENTS(( void ));
+extern sym_value_entry_type *sem_create_wchar_str  _ARGUMENTS(( void ));
+extern void sem_append_str_to_cstr  _ARGUMENTS(( sym_value_entry_type *az_cstr_entry , sym_value_entry_type *az_str_entry , boolean op2_temporary ));
+extern void sem_append_cstr_to_cstr  _ARGUMENTS(( sym_value_entry_type *az_cstr1_entry , sym_value_entry_type *az_cstr2_entry , boolean op2_temporary ));
+extern sym_value_entry_type *sem_cat_str_to_str  _ARGUMENTS(( sym_value_entry_type *az_str1_entry , boolean op1_temporary , sym_value_entry_type *az_str2_entry , boolean op2_temporary ));
+extern int sem_map_subclass_to_charset  _ARGUMENTS(( int charset_as_subclass ));
+extern void sar_charset_verify  _ARGUMENTS(( yystype *charset_frame ));
+extern void sar_make_fallback_charset _ARGUMENTS((yystype *name_frame)); 
+extern void sar_chk_charset_attr  _ARGUMENTS(( yystype *target_frame , yystype *value_frame , yystype *prior_value_frame ));
+extern void sar_make_charset  _ARGUMENTS(( yystype *target_frame , yystype *value_frame , yystype *attr_frame , yystype *keyword_frame ));
+
+/* uilsarexp.c */
+extern void sar_binary_op  _ARGUMENTS(( yystype *operator_frame , yystype *op1_frame , yystype *op2_frame ));
+extern void sar_unary_op  _ARGUMENTS(( yystype *operator_frame , yystype *op1_frame ));
+
+/* uilsarinc.c */
+extern void sar_include_file  _ARGUMENTS(( yystype *file_frame , yystype *include_frame , yystype *semi_frame ));
+
+/* uilsarmod.c */
+extern void sar_initialize  _ARGUMENTS(( void ));
+extern void sar_create_root  _ARGUMENTS(( yystype *root_frame ));
+extern void sar_create_module  _ARGUMENTS(( yystype *target_frame , yystype *id_frame , yystype *module_frame ));
+extern void sar_process_module_version  _ARGUMENTS(( yystype *value_frame , yystype *start_frame ));
+extern void sar_process_module_sensitivity  _ARGUMENTS(( yystype *token_frame , yystype *start_frame ));
+extern void sar_process_module_charset  _ARGUMENTS(( yystype *token_frame , yystype *start_frame ));
+extern void sar_save_module_source  _ARGUMENTS(( void ));
+extern void sar_make_def_obj  _ARGUMENTS(( yystype *object_frame ));
+extern void sar_process_module_variant  _ARGUMENTS(( yystype *obj_type_frame , yystype *variant_frame ));
+extern void sar_save_section_source  _ARGUMENTS(( yystype *header_frame , int section_type ));
+
+/* uilsarobj.c */
+extern void sar_assoc_comment  _ARGUMENTS(( sym_obj_entry_type    *object ));
+extern void sar_create_object  _ARGUMENTS(( yystype *object_frame , unsigned char object_type ));
+extern void sar_create_child  _ARGUMENTS(( yystype *object_frame ));
+extern void sar_link_section  _ARGUMENTS(( yystype *id_frame ));
+extern void sar_save_src_semicolon_pos  _ARGUMENTS(( yystype *semi_frame ));
+extern void sar_save_list_end  _ARGUMENTS(( yystype *close_frame ));
+extern void sar_save_src_entry_end  _ARGUMENTS(( yystype *close_frame , yystype *entry_frame ));
+extern void sar_set_object_flags  _ARGUMENTS(( yystype *current_frame , unsigned char mask ));
+extern void sar_unset_object_flags  _ARGUMENTS(( yystype *current_frame , unsigned char mask ));
+extern void sar_set_list_type  _ARGUMENTS(( yystype *current_frame ));
+extern void sar_set_object_class  _ARGUMENTS(( yystype *current_frame ));
+extern void sar_set_object_variant  _ARGUMENTS(( yystype *current_frame ));
+extern yystype *sem_find_object  _ARGUMENTS(( yystype *current_frame ));
+extern void sar_object_reference  _ARGUMENTS(( yystype *ref_frame ));
+extern void sar_update_parent_list  _ARGUMENTS(( yystype *control_list_frame ));
+extern void parent_list_traverse  _ARGUMENTS(( sym_widget_entry_type *widget_entry , sym_list_entry_type *control_list_entry ));
+extern void sar_save_feature  _ARGUMENTS(( yystype *feature_frame ));
+extern void sar_save_argument_pair  _ARGUMENTS(( yystype *argument_frame , yystype *value_frame , yystype *equals_frame ));
+extern void sar_save_reason_binding  _ARGUMENTS(( yystype *reason_frame , yystype *proc_ref_frame , yystype *equals_frame ));
+extern void sar_save_control_item  _ARGUMENTS(( yystype *managed_frame , yystype *item_frame ));
+extern void sar_save_control_widget  _ARGUMENTS(( yystype *control_frame , yystype *item_frame ));
+extern void sar_save_user_proc_ref_src  _ARGUMENTS(( yystype *procedure_frame , yystype *proc_id_frame , yystype *proc_arg_frame ));
+extern void sar_process_proc_ref  _ARGUMENTS(( yystype *proc_id_frame , yystype *proc_arg_frame , int context ));
+extern void sar_add_list_entry  _ARGUMENTS(( yystype *entry_frame ));
+extern void sar_add_forward_list_entry  _ARGUMENTS(( yystype *entry_frame ));
+extern void sar_verify_object  _ARGUMENTS(( yystype *current_frame ));
+extern sym_entry_type *sem_allocate_node  _ARGUMENTS(( unsigned char node_tag , unsigned short node_size ));
+extern void sem_free_node  _ARGUMENTS(( sym_entry_type *node_ptr ));
+
+/* uilsarproc.c */
+extern void sar_create_procedure  _ARGUMENTS(( XmConst yystype *id_frame , XmConst yystype *param_frame , XmConst yystype *class_frame , XmConst yystype *semi_frame ));
+extern sym_proc_ref_entry_type *sem_reference_procedure  _ARGUMENTS(( yystype *id_frame , XmConst yystype *value_frame , XmConst int context ));
+extern sym_entry_type *sem_ref_name  _ARGUMENTS(( yystype *id_frame , XmConst int tag ));
+
+/* uilsarval.c */
+extern void sar_map_keyword_to_name  _ARGUMENTS(( yystype *target_frame , yystype *keyword_frame ));
+extern void sar_process_id  _ARGUMENTS(( yystype *target_frame , yystype *id_frame ));
+extern void sar_process_id_ref  _ARGUMENTS(( yystype *id_frame ));
+extern void sar_make_private_value  _ARGUMENTS(( yystype *value_frame , yystype *token_frame , int value_type , yystype *keyword_frame , int arg_type ));
+extern void sar_make_rgb_private_value  _ARGUMENTS(( yystype *value_frame , yystype *token_frame , int value_type , yystype *keyword_frame , int arg_type ));
+extern void sar_append_table_value  _ARGUMENTS(( yystype *value_frame , yystype *table_frame , int table_type , yystype *comma_frame ));
+extern void sar_value_not_implemented  _ARGUMENTS(( yystype *value_frame , yystype *token_frame , char *error_text ));
+extern void sar_cat_value  _ARGUMENTS(( yystype *operator_frame , yystype *op1_frame , yystype *op2_frame ));
+extern void sar_chk_comp_str_attr  _ARGUMENTS(( yystype *target_frame , yystype *value_frame , yystype *prior_value_frame ));
+extern void sar_make_comp_str  _ARGUMENTS(( yystype *target_frame , yystype *value_frame , yystype *attr_frame , yystype *keyword_frame ));
+extern void sar_make_comp_str_comp _ARGUMENTS((yystype *target_frame, yystype *type_frame, yystype *value_frame, yystype *keyword_frame));
+extern void sar_make_wchar_str  _ARGUMENTS(( yystype *target_frame , yystype *value_frame , yystype *attr_frame , yystype *keyword_frame ));
+extern void sar_value_type_error  _ARGUMENTS(( yystype *value_frame , int expected_type ));
+extern void sar_private_error  _ARGUMENTS(( yystype *value_frame ));
+extern void sar_import_value_entry  _ARGUMENTS(( yystype *target_frame , yystype *token_frame ));
+extern void sar_bind_value_name  _ARGUMENTS(( yystype *id_frame , yystype *value_frame , yystype *semi_frame ));
+extern sym_name_entry_type *sem_dcl_name  _ARGUMENTS(( XmConst yystype *id_frame ));
+extern sym_value_entry_type *sem_create_value_entry  _ARGUMENTS(( char *value , int length , int value_type ));
+extern void sar_create_identifier  _ARGUMENTS(( XmConst yystype *id_frame , XmConst yystype *semi_frame ));
+extern void sar_make_font_table  _ARGUMENTS(( yystype *target_frame , yystype *font_frame , yystype *prior_target_frame , yystype *keyword_frame ));
+extern void sar_make_font_item  _ARGUMENTS(( yystype *target_frame , yystype *charset_frame , yystype *font_frame ));
+extern void sar_make_font  _ARGUMENTS(( yystype *target_frame , yystype *charset_frame , yystype *value_frame , yystype *keyword_frame ));
+extern void sar_make_fontset  _ARGUMENTS(( yystype *target_frame , yystype *charset_frame , yystype *value_frame , yystype *keyword_frame ));
+extern void sar_make_color_item  _ARGUMENTS(( yystype *target_frame , yystype *color_frame , yystype *letter_frame ));
+extern void sar_append_color_item  _ARGUMENTS(( yystype *target_frame , yystype *item_frame , yystype *prior_target_frame ));
+extern void sar_make_color_table  _ARGUMENTS(( yystype *target_frame , yystype *list_frame , yystype *keyword_frame ));
+extern void sar_make_color  _ARGUMENTS(( yystype *target_frame , yystype *color_frame , yystype *mono_frame , yystype *keyword_frame ));
+extern void sar_make_icon  _ARGUMENTS(( yystype *target_frame , yystype *list_frame , yystype *table_frame , yystype *keyword_frame ));
+
+/* uilsemcset.c */
+extern char *sem_charset_name  _ARGUMENTS(( int l_charset , sym_value_entry_type *az_charset_entry ));
+extern void sem_charset_info  _ARGUMENTS(( int l_charset , sym_value_entry_type *az_charset_entry , int *write_direction , int *parse_direction , int *sixteen_bit ));
+extern int sem_charset_lang_name  _ARGUMENTS(( char *lang_charset ));
+
+/* uilsemval.c */
+typedef	union  	{
+	    boolean	boolean_value;
+	    int		integer_value;
+	    double	real_value;
+	    char        character_value;   /* character data type RAP */
+	    float       single_float_value; /* single float data type RAP */
+	} data_value_type;
+
+extern void sem_validation  _ARGUMENTS(( void ));
+extern void sem_validate_node  _ARGUMENTS(( sym_entry_type *node ));
+extern sym_value_entry_type *sem_validate_value_node  _ARGUMENTS(( sym_value_entry_type *value_node ));
+extern void sem_validate_widget_node  _ARGUMENTS(( sym_widget_entry_type *widget_node ));
+extern void sem_validate_argument_list  _ARGUMENTS(( sym_widget_entry_type *widget_node , unsigned int widget_type , sym_list_entry_type *list_entry , sym_argument_entry_type **seen ));
+extern void sem_validate_argument_entry  _ARGUMENTS(( sym_widget_entry_type *widget_node , unsigned int widget_type , sym_list_entry_type *list_entry , sym_argument_entry_type *argument_entry , sym_argument_entry_type **seen ));
+extern void sem_validate_argument_enumset  _ARGUMENTS(( sym_argument_entry_type *argument_entry , int arg_code , sym_value_entry_type *arg_value_entry ));
+extern void sem_validate_constraint_entry  _ARGUMENTS(( sym_widget_entry_type *widget_node , sym_argument_entry_type *argument_entry, unsigned int widget_type ));
+extern void sem_validate_callback_list  _ARGUMENTS(( sym_widget_entry_type *widget_node , unsigned int widget_type , sym_list_entry_type *list_entry , sym_callback_entry_type **seen ));
+extern void sem_validate_callback_entry  _ARGUMENTS(( sym_widget_entry_type *widget_node , unsigned int widget_type , sym_list_entry_type *list_entry , sym_callback_entry_type *callback_entry , sym_callback_entry_type **seen ));
+extern void sem_validate_control_list  _ARGUMENTS(( sym_widget_entry_type *widget_node , unsigned int widget_type , sym_list_entry_type *list_entry , int *count ));
+extern void sem_validate_control_entry  _ARGUMENTS(( sym_widget_entry_type *widget_node , unsigned int widget_type , sym_list_entry_type *list_entry , sym_control_entry_type *control_entry , int *gadget_count ));
+extern void sem_validate_widget_cycle  _ARGUMENTS(( sym_list_entry_type *list_entry , sym_name_entry_type *cycle_name ));
+extern boolean sem_validate_widget_cycle_aux  _ARGUMENTS(( sym_list_entry_type *list_entry , sym_name_entry_type *cycle_name ));
+extern boolean sem_validate_verify_cycle  _ARGUMENTS(( sym_widget_entry_type *cycle_obj , sym_list_entry_type *list_entry ));
+extern void sem_validate_procref_list  _ARGUMENTS(( sym_list_entry_type *list_entry ));
+extern void sem_validate_procref_entry  _ARGUMENTS(( sym_proc_ref_entry_type *procref_entry ));
+extern boolean sem_argument_allowed  _ARGUMENTS(( unsigned int arg_code , unsigned int class_code ));
+extern boolean sem_reason_allowed  _ARGUMENTS(( unsigned int rsn_code , unsigned int class_code ));
+extern boolean sem_control_allowed  _ARGUMENTS(( unsigned int ctl_code , unsigned int class_code ));
+extern boolean sem_child_allowed  _ARGUMENTS(( unsigned int ctl_code , unsigned int class_code ));
+extern sym_value_entry_type *sem_evaluate_value  _ARGUMENTS(( sym_value_entry_type *val_entry ));
+extern sym_value_entry_type *sem_evaluate_value_cs  _ARGUMENTS(( sym_value_entry_type *csval_entry ));
+/* BEGIN OSF Fix CR 4859 */
+/* END OSF Fix CR 4859 */
+extern sym_value_entry_type *sem_evaluate_value_expr  _ARGUMENTS(( sym_value_entry_type *value_entry ));
+extern int validate_arg  _ARGUMENTS(( sym_value_entry_type *operand_entry , int v_operator ));
+extern int sem_convert_to_float  _ARGUMENTS(( sym_value_entry_type *operand_entry , data_value_type *data_value ));
+extern int sem_convert_to_integer  _ARGUMENTS(( sym_value_entry_type *operand_entry , data_value_type *data_value ));
+extern int sem_convert_to_single_float  _ARGUMENTS(( sym_value_entry_type *operand_entry , data_value_type *data_value ));
+extern int sem_convert_to_error  _ARGUMENTS(( sym_value_entry_type *operand_entry , data_value_type *data_value ));
+extern void sar_cat_value_entry  _ARGUMENTS(( sym_value_entry_type **target_entry , sym_value_entry_type *op1_entry , sym_value_entry_type *op2_entry ));
+
+/* uilsrcsrc.c */
+extern void src_initialize_source  _ARGUMENTS(( void ));
+extern void Uil_src_cleanup_source  _ARGUMENTS(( void ));
+extern void src_open_file  _ARGUMENTS(( XmConst char *c_file_name , char *full_file_name ));
+extern status src_get_source_line  _ARGUMENTS(( void ));
+extern status open_source_file  _ARGUMENTS(( XmConst char *c_file_name , uil_fcb_type *az_fcb , src_source_buffer_type *az_source_buffer ));
+extern status close_source_file  _ARGUMENTS(( uil_fcb_type *az_fcb ));
+extern status get_line  _ARGUMENTS(( uil_fcb_type *az_fcb ));
+extern boolean reget_line  _ARGUMENTS(( uil_fcb_type *az_fcb , char *c_buffer , XmConst z_key *z_access_key ));
+extern char *src_get_file_name  _ARGUMENTS(( XmConst src_source_record_type *az_src_rec ));
+extern boolean src_retrieve_source  _ARGUMENTS(( XmConst src_source_record_type *az_src_rec , char *c_buffer ));
+extern void src_append_diag_info  _ARGUMENTS(( XmConst src_source_record_type *az_src_rec , XmConst int l_src_pos , XmConst char *c_msg_text , XmConst int l_msg_number ));
+extern void src_append_machine_code  _ARGUMENTS(( src_source_record_type *az_src_rec , XmConst int l_offset , XmConst int l_code_len , XmConst char *c_code , XmConst char *c_text_arg ));
+
+/* uilsymnam.c */
+extern sym_name_entry_type *sym_find_name  _ARGUMENTS(( int l_length , char *c_text ));
+extern sym_name_entry_type *sym_insert_name  _ARGUMENTS(( int l_length , char *c_text ));
+extern int hash_function  _ARGUMENTS(( int l_length , char *c_value ));
+#if debug_version
+extern void sym_dump_hash_table  _ARGUMENTS(( void ));
+#endif
+
+/* uilsymstor.c */
+extern void sym_initialize_storage  _ARGUMENTS(( void ));
+extern void Uil_sym_cleanup_storage  _ARGUMENTS(( boolean freealloc ));
+extern void sym_make_external_def  _ARGUMENTS(( XmConst sym_name_entry_type *az_name ));
+extern void sym_make_forward_ref  _ARGUMENTS(( XmConst yystype *az_id_frame , XmConst int l_widget_type , XmConst char *a_location ));
+extern void sym_make_value_forward_ref  _ARGUMENTS(( XmConst yystype *az_value_frame , XmConst char *a_location , XmConst unsigned char fwd_ref_flags ));
+extern void UilDumpSymbolTable  _ARGUMENTS(( sym_entry_type *node_entry ));
+extern void sym_dump_symbols  _ARGUMENTS(( void ));
+extern void sym_dump_symbol  _ARGUMENTS(( sym_entry_type *az_symbol_entry ));
+extern void sym_dump_widget  _ARGUMENTS(( XmConst sym_widget_entry_type *az_widget_entry ));
+extern void sym_dump_argument  _ARGUMENTS(( XmConst sym_argument_entry_type *az_argument_entry ));
+extern void sym_dump_control  _ARGUMENTS(( XmConst sym_control_entry_type *az_control_entry ));
+extern void sym_dump_callback  _ARGUMENTS(( XmConst sym_callback_entry_type *az_callback_entry ));
+extern void sym_dump_list  _ARGUMENTS(( XmConst sym_list_entry_type *az_list_entry ));
+extern void sym_dump_name  _ARGUMENTS(( XmConst sym_name_entry_type *az_name_entry ));
+extern void sym_dump_module  _ARGUMENTS(( XmConst sym_module_entry_type *az_module_entry ));
+extern void sym_dump_color_item  _ARGUMENTS(( XmConst sym_color_item_entry_type *az_color_item_entry ));
+extern void sym_dump_parent_list_item  _ARGUMENTS(( XmConst sym_parent_list_type *az_parent_list_item ));
+extern void sym_dump_external_def  _ARGUMENTS(( XmConst sym_external_def_entry_type *az_external_def_entry ));
+extern void sym_dump_proc_def  _ARGUMENTS(( XmConst sym_proc_def_entry_type *az_proc_def_entry ));
+extern void sym_dump_proc_ref  _ARGUMENTS(( XmConst sym_proc_ref_entry_type *az_proc_ref_entry ));
+extern void sym_dump_forward_ref  _ARGUMENTS(( XmConst sym_forward_ref_entry_type *az_forward_ref_entry ));
+extern void sym_dump_value  _ARGUMENTS(( XmConst sym_value_entry_type *az_value_entry ));
+extern void output_text  _ARGUMENTS(( XmConst int length , XmConst char *text ));
+extern void sym_dump_source_info  _ARGUMENTS(( sym_entry_header_type *hdr ));
+extern void sym_dump_obj_header  _ARGUMENTS(( XmConst sym_obj_entry_type *az_obj_entry ));
+extern void sym_dump_include_file  _ARGUMENTS(( sym_include_file_entry_type *az_symbol_entry ));
+extern void sym_dump_section  _ARGUMENTS(( sym_section_entry_type *az_symbol_entry ));
+extern void sym_dump_object_variant  _ARGUMENTS(( sym_def_obj_entry_type *az_symbol_entry ));
+extern void sym_dump_root_entry  _ARGUMENTS(( sym_root_entry_type *az_symbol_entry ));
+extern char *sym_section_text  _ARGUMENTS(( int b_type ));
+extern void dump_free_list  _ARGUMENTS(( void ));
+extern int sar_get_units_type (yystype *parse_frame);
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* UilDefI_h */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff '--color=auto' -Naur motif-2.3.8.orig/configure.ac motif-2.3.8/configure.ac
--- motif-2.3.8.orig/configure.ac	2017-12-05 05:43:54.000000000 -0700
+++ motif-2.3.8/configure.ac	2026-03-06 18:54:16.109665714 -0700
@@ -159,7 +159,7 @@
 
 if test x$GCC = xyes
 then
-    CFLAGS="$CFLAGS -Wall -g -fno-strict-aliasing -Wno-unused -Wno-comment"
+    CFLAGS="$CFLAGS -Wall -fno-strict-aliasing -Wno-unused -Wno-comment"
     if test ` $CC -dumpversion | sed -e 's/\(^.\).*/\1/'` = "4" ; then
         CFLAGS="$CFLAGS -fno-tree-ter"
     fi
@@ -175,13 +175,13 @@
 LIBDIR="${libdir}/X11"
 AC_SUBST(LIBDIR)
 
-MWMRCDIR="${libdir}/X11"
+MWMRCDIR="${sysconfdir}/X11/mwm"
 AC_SUBST(MWMRCDIR)
 
 INCDIR="${includedir}/X11"
 AC_SUBST(INCDIR)
 
-XMBINDDIR_FALLBACK="${libdir}/X11/bindings"
+XMBINDDIR_FALLBACK="${datadir}/X11/bindings"
 AC_SUBST(XMBINDDIR_FALLBACK)
 
 RM="rm -f"
@@ -194,21 +194,8 @@
 
 case "$host_os" in
     freebsd*) CFLAGS="$CFLAGS -DCSRG_BASED -DXNO_MTSAFE_API -DXNO_MTSAFE_PWDAPI";
-        LDFLAGS="$LDFLAGS -L/usr/local/lib";;
+        ;;
     cygwin*) CFLAGS="$CFLAGS -DXNO_MTSAFE_DIRENTDAPI";;
-    solaris* | sunos*) X_LIBS="$X_LIBS -L/usr/X/lib" &&
-        if test x$enable_motif22_compatibility = x
-        then
-            enable_motif22_compatibility="no"
-        fi;
-        if test x$enable_utf8 = x
-        then
-            enable_utf8="no"
-        fi;
-        if test x$enable_xft = x
-        then
-            enable_xft="no"
-        fi;;
 esac
 
 if test x$enable_motif22_compatibility = x
diff '--color=auto' -Naur motif-2.3.8.orig/configure.ac.orig motif-2.3.8/configure.ac.orig
--- motif-2.3.8.orig/configure.ac.orig	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/configure.ac.orig	2026-03-06 18:54:16.108169949 -0700
@@ -0,0 +1,381 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT
+AC_CONFIG_SRCDIR([lib/Xm/Form.c])
+AC_PREREQ(2.52)
+AC_CONFIG_AUX_DIR(.)
+AC_CHECK_FILE(/usr/X/include/X11/X.h,
+  AC_PREFIX_DEFAULT(/usr/X),
+  AC_PREFIX_DEFAULT(/usr))
+AC_CHECK_FILE(/usr/X11R6/include/X11/X.h,
+  AC_PREFIX_DEFAULT(/usr/X11R6),
+  AC_PREFIX_DEFAULT(/usr))
+
+dnl AM_MAINTAINER_MODE
+AC_CANONICAL_TARGET
+
+dnl The version of the Motif libraries
+CURRENT=4
+REVISION=4
+AGE=0
+AC_SUBST(CURRENT)
+AC_SUBST(REVISION)
+AC_SUBST(AGE)
+
+dnl This is really dumb but it seems to be bug
+AM_INIT_AUTOMAKE(motif,2.3.8,no-define)
+
+LIBTOOL_VERSION=$CURRENT:$REVISION:$AGE
+
+dnl
+dnl Override a default in libtool.
+dnl
+dnl AC_DISABLE_STATIC
+
+AC_CONFIG_HEADERS(include/config.h lib/Xm/Xm.h)
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CPP
+AM_PROG_LIBTOOL
+
+AC_EXEEXT
+
+dnl AC_PROG_YACC
+dnl Do this the old fashioned way. 'bison -y' doesn't cut it
+AC_CHECK_PROGS(YACC, byacc, yacc)
+
+dnl AC_PROG_SPLINT
+AC_CHECK_PROGS(SPLINT, splint)
+
+AM_PROG_LEX
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+
+dnl Checks for libraries.
+
+AC_PATH_X
+AC_PATH_XTRA
+LT_LIB_XTHREADS
+
+dnl Checks for Xos_r.h
+
+AC_CHECK_HEADERS([X11/Xos_r.h])
+AC_CHECK_HEADERS([X11/Xpoll.h])
+
+dnl Compile in EditRes support if we can find Xmu
+
+save_LIBS="$LIBS"
+save_CFLAGS="$CFLAGS"
+LIBS="$X_LIBS $LIBS"
+CFLAGS="$X_CFLAGS $CFLAGS"
+AC_CHECK_HEADERS(X11/Xmu/Editres.h,
+AC_CHECK_LIB(Xmu, _XEditResCheckMessages,
+X_XMU=-lXmu
+AC_DEFINE(HAVE_LIBXMU, 1, This System has libXmu)
+, X_XMU="", -lXt -lX11)
+AC_CHECK_LIB(Xmu,XmuNCopyISOLatin1Lowered ,
+AC_DEFINE(HAVE_XMU_N_COPY_ISO,1,Have XmuNCopyISOLatin1Lowered)
+, , -lXt -lX11)
+,,[[#include <X11/Intrinsic.h>]]
+)
+
+
+AC_SUBST(X_XMU)
+LIBS="$save_LIBS"
+CFLAGS="$save_CFLAGS"
+AM_CONDITIONAL(OM_XMU, test x$X_XMU != x)
+
+dnl Checks for header files.
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/malloc.h strings.h sys/file.h sys/time.h unistd.h wchar.h)
+AC_CHECK_HEADERS(wctype.h, AC_DEFINE(HAS_WIDECHAR_FUNCTIONS,1,System supports wchar))
+AC_CHECK_HEADER(langinfo.h,,AC_DEFINE(CSRG_BASED,1,System Has langinfo.h))
+AC_CHECK_HEADER(X11/Xos_r.h,,AC_DEFINE(NEED_XOS_R_H,1,System Missing Xos_r.h))
+AC_CHECK_HEADER(X11/Xpoll.h,,AC_DEFINE(NEED_XPOLL_H,1,system Missing X11/Xpoll.h))
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_MODE_T
+AC_TYPE_OFF_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+AC_STRUCT_TM
+AC_TYPE_UID_T
+WEAK_ALIAS_SUPPORT
+
+dnl Checks for library functions.
+AC_FUNC_ALLOCA
+AC_FUNC_MEMCMP
+AC_FUNC_SETPGRP
+AC_TYPE_SIGNAL
+AC_FUNC_STRCOLL
+AC_FUNC_STRFTIME
+AC_FUNC_FORK([])
+AC_FUNC_VPRINTF
+AM_FUNC_VOID_SPRINTF
+AC_CHECK_FUNCS(wcslen wcscpy wcsncpy wcschr wcscat wcsncat getcwd gettimeofday mkdir re_comp regcmp select strcspn strerror strstr strtod strtol uname)
+AC_CHECK_FUNCS(strdup,,AC_DEFINE(NEED_STRDUP, 1, no strdup))
+AC_CHECK_FUNCS(strcasecmp,,AC_DEFINE(NEED_STRCASECMP, 1, no strcasecmp))
+AC_CHECK_FUNCS(putenv,,AC_DEFINE(NO_PUTENV, 1, No PUTENV))
+AC_CHECK_FUNCS(regcomp,,AC_DEFINE(NO_REGCOMP, 1, no regcmp))
+AC_CHECK_FUNCS(memmove,,AC_DEFINE(NO_MEMMOVE, 1, no memmove))
+AC_CHECK_TYPE(XICProc,,AC_DEFINE(NO_XICPROC, 1, XICProc isn't defined), [#include <X11/Xlib.h>])
+
+AC_ARG_ENABLE(message-catalog, [  --enable-message-catalog
+                          Enable building of the message catalog (default=no)])
+if test "$enable_message_catalog" != "yes"
+then
+    AC_DEFINE(NO_MESSAGE_CATALOG, 1, No Defined Message Catalog)
+fi
+AM_CONDITIONAL(MessageCatalog, test x$enable_message_catalog = xyes)
+
+AC_ARG_ENABLE(themes, [  --enable-themes         Enable themes (default=no)])
+if test "$enable_themes" = "yes"
+then
+    if test -f $srcdir/lib/Xm/Theme.h
+    then
+	AC_DEFINE(USE_XMTHEMES, 1, "Use XmThemes")
+	XMTHEME_DIST = "Theme.h ThemeP.h DynLibP.h Theme.c DynLib.c"
+    else
+	AC_MSG_WARN([--enable-themes specified, but I don't have the code. Disabled])
+	enable_themes="no"
+    fi
+fi
+AC_SUBST(XMTHEME_DIST)
+AM_CONDITIONAL(OM_XMTHEMES, test "$enable_themes" = "yes")
+
+AC_ARG_ENABLE(debug-themes, [  --enable-debug-themes   Enable themes debugging (default=no)])
+if test "$enable_themes" = "yes"
+then
+    if test "$enable_debug_themes" = "yes"
+    then
+	AC_DEFINE(DEBUGTHEMES, 1, "Debug Themes")
+    fi
+fi
+
+if test x$GCC = xyes
+then
+    CFLAGS="$CFLAGS -Wall -g -fno-strict-aliasing -Wno-unused -Wno-comment"
+    if test ` $CC -dumpversion | sed -e 's/\(^.\).*/\1/'` = "4" ; then
+        CFLAGS="$CFLAGS -fno-tree-ter"
+    fi
+fi
+AC_DEFINE(NO_OL_COMPAT, 1, "No OL Compatability")
+
+CDE_INSTALLATION_TOP="\${prefix}/dt"
+AC_SUBST(CDE_INSTALLATION_TOP)
+
+CDE_CONFIGURATION_TOP="\${prefix}/etc/dt"
+AC_SUBST(CDE_CONFIGURATION_TOP)
+
+LIBDIR="${libdir}/X11"
+AC_SUBST(LIBDIR)
+
+MWMRCDIR="${sysconfdir}/X11/mwm"
+AC_SUBST(MWMRCDIR)
+
+INCDIR="${includedir}/X11"
+AC_SUBST(INCDIR)
+
+XMBINDDIR_FALLBACK="${datadir}/X11/bindings"
+AC_SUBST(XMBINDDIR_FALLBACK)
+
+RM="rm -f"
+AC_SUBST(RM)
+
+AC_ARG_ENABLE(motif22-compatibility, [  --disable-motif22-compatibility
+                       Disable binary compatibility with OpenMotif 2.2])
+AC_ARG_ENABLE(utf8, [  --disable-utf8
+                       Disable UTF-8 support])
+
+case "$host_os" in
+    freebsd*) CFLAGS="$CFLAGS -DCSRG_BASED -DXNO_MTSAFE_API -DXNO_MTSAFE_PWDAPI";
+        ;;
+    cygwin*) CFLAGS="$CFLAGS -DXNO_MTSAFE_DIRENTDAPI";;
+esac
+
+if test x$enable_motif22_compatibility = x
+then
+    enable_motif22_compatibility="yes"
+fi
+
+if test "$enable_motif22_compatibility" = "yes"
+then
+  AC_DEFINE([OM22_COMPATIBILITY], [1], [Compatibility with OpenMotif 2.2])
+  OM22_COMPATIBILITY_FALSE=!
+  OM22_COMPATIBILITY_TRUE=
+else
+  OM22_COMPATIBILITY_FALSE=
+  OM22_COMPATIBILITY_TRUE=!
+fi
+AC_SUBST(OM22_COMPATIBILITY_FALSE)
+AC_SUBST(OM22_COMPATIBILITY_TRUE)
+
+if test x$enable_utf8 = x
+then
+    enable_utf8="yes"
+fi
+
+if test "$enable_utf8" = "yes"
+then
+  AC_DEFINE([UTF8_SUPPORTED], [1], [UTF8 is supported])
+  AC_SEARCH_LIBS([iconv_open], [iconv], ,
+    AC_SEARCH_LIBS([libiconv_open], [iconv]))
+fi
+
+AC_ARG_ENABLE(printing, [  --disable-printing
+                       Disable printing support])
+
+if test x$enable_printing = x
+then
+    enable_printing="yes"
+fi
+
+if test "$enable_printing" = "yes"
+then
+  AC_MSG_CHECKING([for libXp])
+  AC_CHECK_HEADERS(X11/extensions/Print.h,
+    AC_CHECK_LIB(Xp, XpCreateContext, ,enable_printing="no"),
+  enable_printing="no")
+fi
+
+if test "$enable_printing" = "yes"
+then
+  LIB_XP=-lXp
+  AC_DEFINE([PRINTING_SUPPORTED], [1], [Printing is supported])
+  PRINTING_SUPPORTED_FALSE=!
+  PRINTING_SUPPORTED_TRUE=
+else
+  LIB_XP=
+  PRINTING_SUPPORTED_FALSE=
+  PRINTING_SUPPORTED_TRUE=!
+fi
+AC_SUBST(PRINTING_SUPPORTED_FALSE)
+AC_SUBST(PRINTING_SUPPORTED_TRUE)
+
+AM_CONDITIONAL(PRINTING, test "$enable_printing" = "yes")
+AC_SUBST(LIB_XP)
+
+AC_FIND_XFT
+AC_IMAGE_SUPPORT
+
+
+
+# AM_CONDITIONAL(Motif22Compatibility, test x$enable_motif22_compatibility = xyes)
+
+AC_CONFIG_FILES([Makefile \
+bindings/Makefile \
+bitmaps/Makefile \
+clients/Makefile \
+clients/mwm/Makefile \
+clients/mwm/WmWsmLib/Makefile \
+clients/uil/Makefile \
+clients/xmbind/Makefile \
+config/Makefile \
+config/util/Makefile \
+include/Makefile \
+include/Dt/Makefile \
+lib/Makefile \
+lib/Xm/Makefile \
+lib/Mrm/Makefile \
+localized/Makefile \
+localized/util/Makefile \
+doc/Makefile \
+doc/man/Makefile \
+doc/man/man1/Makefile \
+doc/man/man3/Makefile \
+doc/man/man4/Makefile \
+doc/man/man5/Makefile \
+tools/Makefile \
+tools/wml/Makefile \
+demos/Makefile \
+demos/lib/Makefile \
+demos/lib/Xmd/Makefile \
+demos/lib/Wsm/Makefile \
+demos/lib/Exm/Makefile \
+demos/lib/Exm/wml/Makefile \
+demos/programs/Makefile \
+demos/programs/Exm/Makefile \
+demos/programs/Exm/app_in_c/Makefile \
+demos/programs/Exm/app_in_uil/Makefile \
+demos/programs/Exm/simple_app/Makefile \
+demos/programs/airport/Makefile \
+demos/programs/animate/Makefile \
+demos/programs/drag_and_drop/Makefile \
+demos/programs/draw/Makefile \
+demos/programs/earth/Makefile \
+demos/programs/filemanager/Makefile \
+demos/programs/fileview/Makefile \
+demos/programs/getsubres/Makefile \
+demos/programs/hellomotif/Makefile \
+demos/programs/hellomotifi18n/Makefile \
+demos/programs/hellomotifi18n/C/Makefile \
+demos/programs/hellomotifi18n/C/uid/Makefile \
+demos/programs/hellomotifi18n/english/Makefile \
+demos/programs/hellomotifi18n/english/uid/Makefile \
+demos/programs/hellomotifi18n/french/Makefile \
+demos/programs/hellomotifi18n/french/uid/Makefile \
+demos/programs/hellomotifi18n/hebrew/Makefile \
+demos/programs/hellomotifi18n/hebrew/uid/Makefile \
+demos/programs/hellomotifi18n/japan/Makefile \
+demos/programs/hellomotifi18n/japan/uid/Makefile \
+demos/programs/hellomotifi18n/japanese/Makefile \
+demos/programs/hellomotifi18n/japanese/uid/Makefile \
+demos/programs/hellomotifi18n/swedish/Makefile \
+demos/programs/hellomotifi18n/swedish/uid/Makefile \
+demos/programs/i18ninput/Makefile \
+demos/programs/panner/Makefile \
+demos/programs/periodic/Makefile \
+demos/programs/piano/Makefile \
+demos/programs/popups/Makefile \
+demos/programs/sampler2_0/Makefile \
+demos/programs/setdate/Makefile \
+demos/programs/todo/Makefile \
+demos/programs/workspace/Makefile \
+demos/programs/tooltips/Makefile \
+demos/programs/FontSel/Makefile \
+demos/programs/ButtonBox/Makefile \
+demos/programs/ColorSel/Makefile \
+demos/programs/Column/Makefile \
+demos/programs/Combo2/Makefile \
+demos/programs/Ext18List/Makefile \
+demos/programs/Ext18List/pixmaps/Makefile \
+demos/programs/IconB/Makefile \
+demos/programs/Outline/Makefile \
+demos/programs/Paned/Makefile \
+demos/programs/TabStack/Makefile \
+demos/programs/Tree/Makefile \
+demos/programs/pixmaps/Makefile \
+demos/unsupported/Makefile \
+demos/unsupported/Exm/Makefile \
+demos/unsupported/aicon/Makefile \
+demos/unsupported/dainput/Makefile \
+demos/unsupported/dogs/Makefile \
+demos/unsupported/hellomotif/Makefile \
+demos/unsupported/motifshell/Makefile \
+demos/unsupported/uilsymdump/Makefile \
+demos/unsupported/xmapdef/Makefile \
+demos/unsupported/xmfonts/Makefile \
+demos/unsupported/xmforc/Makefile \
+demos/unsupported/xmform/Makefile \
+demos/doc/Makefile \
+demos/doc/programGuide/Makefile \
+demos/doc/programGuide/ch05/Makefile \
+demos/doc/programGuide/ch05/Scale/Makefile \
+demos/doc/programGuide/ch06/Makefile \
+demos/doc/programGuide/ch06/spin_box/Makefile \
+demos/doc/programGuide/ch06/combo_box/Makefile \
+demos/doc/programGuide/ch08/Makefile \
+demos/doc/programGuide/ch08/Notebook/Makefile \
+demos/doc/programGuide/ch08/Container/Makefile \
+demos/doc/programGuide/ch16/Makefile \
+demos/doc/programGuide/ch17/Makefile \
+demos/doc/programGuide/ch17/simple_drop/Makefile \
+demos/doc/programGuide/ch17/simple_drag/Makefile \
+lib/Xm/xmstring.list \
+])
+AC_OUTPUT
diff '--color=auto' -Naur motif-2.3.8.orig/demos/doc/programGuide/ch05/Scale/Makefile.am motif-2.3.8/demos/doc/programGuide/ch05/Scale/Makefile.am
--- motif-2.3.8.orig/demos/doc/programGuide/ch05/Scale/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/doc/programGuide/ch05/Scale/Makefile.am	2026-03-06 18:54:16.115873716 -0700
@@ -8,4 +8,4 @@
 
 INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
 
-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
+LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
diff '--color=auto' -Naur motif-2.3.8.orig/demos/doc/programGuide/ch06/combo_box/Makefile.am motif-2.3.8/demos/doc/programGuide/ch06/combo_box/Makefile.am
--- motif-2.3.8.orig/demos/doc/programGuide/ch06/combo_box/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/doc/programGuide/ch06/combo_box/Makefile.am	2026-03-06 18:54:16.115959026 -0700
@@ -9,4 +9,4 @@
 
 INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
 
-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
+LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
diff '--color=auto' -Naur motif-2.3.8.orig/demos/doc/programGuide/ch06/spin_box/Makefile.am motif-2.3.8/demos/doc/programGuide/ch06/spin_box/Makefile.am
--- motif-2.3.8.orig/demos/doc/programGuide/ch06/spin_box/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/doc/programGuide/ch06/spin_box/Makefile.am	2026-03-06 18:54:16.116059545 -0700
@@ -9,4 +9,4 @@
 
 INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
 
-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
+LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
diff '--color=auto' -Naur motif-2.3.8.orig/demos/doc/programGuide/ch08/Container/Makefile.am motif-2.3.8/demos/doc/programGuide/ch08/Container/Makefile.am
--- motif-2.3.8.orig/demos/doc/programGuide/ch08/Container/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/doc/programGuide/ch08/Container/Makefile.am	2026-03-06 18:54:16.116153661 -0700
@@ -8,4 +8,4 @@
 
 INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
 
-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
+LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
diff '--color=auto' -Naur motif-2.3.8.orig/demos/doc/programGuide/ch08/Notebook/Makefile.am motif-2.3.8/demos/doc/programGuide/ch08/Notebook/Makefile.am
--- motif-2.3.8.orig/demos/doc/programGuide/ch08/Notebook/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/doc/programGuide/ch08/Notebook/Makefile.am	2026-03-06 18:54:16.116231597 -0700
@@ -8,4 +8,4 @@
 
 INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
 
-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
+LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
diff '--color=auto' -Naur motif-2.3.8.orig/demos/doc/programGuide/ch16/Makefile.am motif-2.3.8/demos/doc/programGuide/ch16/Makefile.am
--- motif-2.3.8.orig/demos/doc/programGuide/ch16/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/doc/programGuide/ch16/Makefile.am	2026-03-06 18:54:16.116311728 -0700
@@ -9,4 +9,4 @@
 
 INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
 
-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
+LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
diff '--color=auto' -Naur motif-2.3.8.orig/demos/doc/programGuide/ch17/simple_drag/Makefile.am motif-2.3.8/demos/doc/programGuide/ch17/simple_drag/Makefile.am
--- motif-2.3.8.orig/demos/doc/programGuide/ch17/simple_drag/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/doc/programGuide/ch17/simple_drag/Makefile.am	2026-03-06 18:54:16.116399763 -0700
@@ -9,4 +9,4 @@
 
 INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
 
-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
+LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
diff '--color=auto' -Naur motif-2.3.8.orig/demos/doc/programGuide/ch17/simple_drop/Makefile.am motif-2.3.8/demos/doc/programGuide/ch17/simple_drop/Makefile.am
--- motif-2.3.8.orig/demos/doc/programGuide/ch17/simple_drop/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/doc/programGuide/ch17/simple_drop/Makefile.am	2026-03-06 18:54:16.116480474 -0700
@@ -9,4 +9,4 @@
 
 INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
 
-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
+LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
diff '--color=auto' -Naur motif-2.3.8.orig/demos/lib/Xmd/Makefile.am motif-2.3.8/demos/lib/Xmd/Makefile.am
--- motif-2.3.8.orig/demos/lib/Xmd/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/lib/Xmd/Makefile.am	2026-03-06 18:54:16.116572958 -0700
@@ -1,10 +1,10 @@
 MAINTAINERCLEANFILES = Makefile.in
 
-noinst_LIBRARIES = libXmd.a
+noinst_LTLIBRARIES = libXmd.la
 
 noinst_PROGRAMS = onHelp
 
-libXmd_a_SOURCES = Help.c Menus.c Print.c RegEdit.c AdjView.c
+libXmd_la_SOURCES = Help.c Menus.c Print.c RegEdit.c AdjView.c
 
 noinst_HEADERS = AdjView.h \
 Help.h HelpP.h \
@@ -12,7 +12,7 @@
 Print.h PrintP.h \
 RegEdit.h RegEditI.h
 
-LDADD = libXmd.a ../../../lib/Xm/libXm.la
+LDADD = libXmd.la ../../../lib/Xm/libXm.la
 
 INCLUDES = -I$(top_builddir)/lib -I$(srcdir)/../../../lib ${X_CFLAGS} 
 
diff '--color=auto' -Naur motif-2.3.8.orig/demos/programs/animate/Makefile.am motif-2.3.8/demos/programs/animate/Makefile.am
--- motif-2.3.8.orig/demos/programs/animate/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/programs/animate/Makefile.am	2026-03-06 18:54:16.116671272 -0700
@@ -17,7 +17,7 @@
 
 bin_PROGRAMS = xmanimate
 
-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Mrm/libMrm.la ../../../lib/Xm/libXm.la
+LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Mrm/libMrm.la ../../../lib/Xm/libXm.la
 
 INCLUDES = -I$(srcdir)/../../../lib \
            -I$(srcdir)/../../lib \
diff '--color=auto' -Naur motif-2.3.8.orig/demos/programs/draw/Makefile.am motif-2.3.8/demos/programs/draw/Makefile.am
--- motif-2.3.8.orig/demos/programs/draw/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/programs/draw/Makefile.am	2026-03-06 18:54:16.116754759 -0700
@@ -7,5 +7,5 @@
 draw_SOURCES = draw.c
 EXTRA_DIST = XmdDraw.ad README draw.help draw.man
 data_DATA = $(EXTRA_DIST) $(draw_SOURCES)
-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
+LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
 INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
diff '--color=auto' -Naur motif-2.3.8.orig/demos/programs/filemanager/Makefile.am motif-2.3.8/demos/programs/filemanager/Makefile.am
--- motif-2.3.8.orig/demos/programs/filemanager/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/programs/filemanager/Makefile.am	2026-03-06 18:54:16.116844597 -0700
@@ -11,7 +11,7 @@
            obj.xpm pix.xpm s_dir.xpm s_exec.xpm s_file.xpm \
            s_none.xpm s_pix.xpm
 data_DATA = $(EXTRA_DIST) $(filemanager_SOURCES)
-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
+LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
 INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
 
 
diff '--color=auto' -Naur motif-2.3.8.orig/demos/programs/getsubres/Makefile.am motif-2.3.8/demos/programs/getsubres/Makefile.am
--- motif-2.3.8.orig/demos/programs/getsubres/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/programs/getsubres/Makefile.am	2026-03-06 18:54:16.116923365 -0700
@@ -7,5 +7,5 @@
 EXTRA_DIST = getsubres.help getsubres.man README
 getsubres_SOURCES = getsubres.c
 data_DATA = $(EXTRA_DIST) $(getsubres_SOURCES)
-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
+LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
 INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
diff '--color=auto' -Naur motif-2.3.8.orig/demos/programs/i18ninput/Makefile.am motif-2.3.8/demos/programs/i18ninput/Makefile.am
--- motif-2.3.8.orig/demos/programs/i18ninput/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/programs/i18ninput/Makefile.am	2026-03-06 18:54:16.117021619 -0700
@@ -7,6 +7,6 @@
 i18ninput_SOURCES = i18ninput.c input.c 
 EXTRA_DIST = XmdI18nInput.ad README i18ninput.man i18ninput.help
 data_DATA = $(EXTRA_DIST) $(i18ninput_SOURCES)
-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
+LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
 
 INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
diff '--color=auto' -Naur motif-2.3.8.orig/demos/programs/sampler2_0/Makefile.am motif-2.3.8/demos/programs/sampler2_0/Makefile.am
--- motif-2.3.8.orig/demos/programs/sampler2_0/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/programs/sampler2_0/Makefile.am	2026-03-06 18:54:16.117104765 -0700
@@ -10,6 +10,6 @@
 bin_PROGRAMS = sampler2_0
 sampler2_0_SOURCES = sampler2_0.c
 data_DATA = $(sampler2_0_SOURCES) $(EXTRA_DIST)
-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
+LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
 
 INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
diff '--color=auto' -Naur motif-2.3.8.orig/demos/programs/todo/Makefile.am motif-2.3.8/demos/programs/todo/Makefile.am
--- motif-2.3.8.orig/demos/programs/todo/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/programs/todo/Makefile.am	2026-03-06 18:54:16.117183432 -0700
@@ -9,4 +9,4 @@
 data_DATA = $(EXTRA_DIST) $(todo_SOURCES)
 
 INCLUDES = -I$(srcdir)/../../../lib -I$(srcdir)/../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
-LDADD = -L../../lib/Xmd -lXmd -L../../lib/Exm -lExm ../../../lib/Xm/libXm.la 
+LDADD = ../../lib/Xmd/libXmd.la -L../../lib/Exm -lExm ../../../lib/Xm/libXm.la
diff '--color=auto' -Naur motif-2.3.8.orig/demos/unsupported/aicon/Makefile.am motif-2.3.8/demos/unsupported/aicon/Makefile.am
--- motif-2.3.8.orig/demos/unsupported/aicon/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/demos/unsupported/aicon/Makefile.am	2026-03-06 18:54:16.117266128 -0700
@@ -2,7 +2,7 @@
 
 noinst_PROGRAMS = aicon
  
-LDADD = -L../../lib/Xmd -lXmd ../../../lib/Xm/libXm.la 
+LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
 
 INCLUDES = -I$(srcdir)/../../../lib -I$(srcdir)/../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
 
diff '--color=auto' -Naur motif-2.3.8.orig/lib/Xm/Makefile.am motif-2.3.8/lib/Xm/Makefile.am
--- motif-2.3.8.orig/lib/Xm/Makefile.am	2017-10-30 14:56:18.000000000 -0600
+++ motif-2.3.8/lib/Xm/Makefile.am	2026-03-06 18:54:16.106398957 -0700
@@ -284,7 +284,9 @@
 $(top_builddir)/config/util/makestrs:
 	( cd $(top_builddir)/config/util && $(MAKE) $(AM_MAKEFLAGS) makestrs )
 
-$(STRING_FILES): Makefile $(XMSTRING_LIST) XmStrDefs.ht XmStrDefsI.ht XmStrDefs.ct $(top_builddir)/config/util/makestrs
+XmStrDefs.h XmStrDefs22.h XmStrDefs23.h XmStrDefsI.h: XmStrDefs.c
+
+XmStrDefs.c: Makefile $(XMSTRING_LIST) XmStrDefs.ht XmStrDefsI.ht XmStrDefs.ct $(top_builddir)/config/util/makestrs
 	test -f $(XMSTRING_LIST) || $(LN_S) $(srcdir)/$(XMSTRING_LIST) $(XMSTRING_LIST)
 	test -f XmStrDefs.ht || $(LN_S) $(srcdir)/XmStrDefs.ht XmStrDefs.ht
 	test -f XmStrDefs22.ht || $(LN_S) $(srcdir)/XmStrDefs22.ht XmStrDefs22.ht
diff '--color=auto' -Naur motif-2.3.8.orig/lib/Xm/Makefile.am.orig motif-2.3.8/lib/Xm/Makefile.am.orig
--- motif-2.3.8.orig/lib/Xm/Makefile.am.orig	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/lib/Xm/Makefile.am.orig	2017-10-30 14:56:18.000000000 -0600
@@ -0,0 +1,312 @@
+XMSTRING_LIST = xmstring.list
+
+MAINTAINERCLEANFILES = Makefile.in
+CLEANFILES = $(BUILT_SOURCES)
+EXTRA_DIST = xmstring.list Xm.msg \
+             XmStrDefs.ct
+
+INCLUDES = -I.. -I$(srcdir)/.. -DXMBINDDIR_FALLBACK=\"@XMBINDDIR_FALLBACK@\" \
+           -DINCDIR=\"@INCDIR@\" \
+           -DLIBDIR=\"@LIBDIR@\" \
+           ${X_CFLAGS}
+xmdir = $(includedir)/Xm
+
+libXm_la_LDFLAGS = -version-info @CURRENT@:@REVISION@:@AGE@
+
+lib_LTLIBRARIES = libXm.la
+
+TIP_SRCS = ToolTip.c
+TIP_HDRS = ToolTipI.h
+
+
+EXTRA_HDRS = Ext.h ExtP.h  \
+             Column.h ColumnP.h \
+             ButtonBox.h ButtonBoxP.h \
+             ColorS.h ColorSP.h \
+             Picture.h PictureP.h DataF.h DataFP.h DataFSelP.h \
+             Ext18List.h Ext18ListP.h MultiList.h MultiListP.h \
+             Paned.h PanedP.h FontS.h FontSP.h \
+             IconBox.h IconBoxP.h IconButton.h IconButtonP.h xmlist.h \
+             Hierarchy.h HierarchyP.h Outline.h OutlineP.h \
+             TabBox.h TabBoxP.h TabStack.h TabStackP.h \
+             TabList.h DrawUtils.h Tree.h TreeP.h \
+             ComboBox2.h ComboBox2P.h DropDown.h DropDownP.h \
+             ToolTipT.h ToolTipCT.h
+
+EXTRA_SRCS = XmExtUtil.c \
+             Column.c ButtonBox.c ColorS.c Picture.c DataFSel.c DataF.c \
+             MultiList.c I18List.c Paned.c FontS.c IconBox.c IconButton.c xmlist.c \
+             Hierarchy.c Outline.c TabBox.c TabList.c TabStack.c \
+             DrawUtils.c Tree.c DropDown.c \
+             XmStrDefs.ht XmStrDefs22.ht XmStrDefs23.ht XmStrDefsI.ht
+
+SLIDE_HDRS = SlideC.h SlideCP.h
+SLIDE_SRCS = SlideC.c
+
+if OM_XMU
+EDITRES_SRCS = EditresCom.c
+else
+EDITRES_SRCS =
+endif
+
+if OM_LIBJPEG
+JPEG_SRCS = Jpeg.c
+JPEG_HDRS = JpegI.h
+else
+JPEG_SRCS =
+JPEG_HDRS =
+endif
+
+if OM_LIBPNG
+PNG_SRCS = Png.c
+PNG_HDRS = PngI.h
+else
+PNG_SRCS =
+PNG_HDRS =
+endif
+
+if PRINTING
+PRINTS_SRC = PrintS.c
+else
+PRINTS_SRC =
+endif
+
+libXm_la_LIBADD = ${X_LIBS} ${X_XMU} -lXt -lXext ${LIB_XP} -lX11 ${X_EXTRA_LIBS}
+
+noinst_HEADERS = BaseClassI.h \
+BitmapsI.h \
+BulletinBI.h \
+CacheI.h \
+CallbackI.h \
+CareVisualTI.h \
+CascadeBGI.h \
+CascadeBI.h \
+ClipWindTI.h \
+CntrbmI.h \
+ColorI.h \
+ColorObjI.h \
+CommandI.h \
+CutPasteI.h \
+DestI.h \
+DisplayI.h \
+DragBSI.h \
+DragCI.h \
+DragICCI.h \
+DragIconI.h \
+DragOverSI.h \
+DragUnderI.h \
+DrawI.h \
+DrawingAI.h \
+DropSMgrI.h \
+ExtObjectI.h \
+GMUtilsI.h \
+GadgetI.h \
+GadgetUtiI.h \
+GeoUtilsI.h \
+HashI.h \
+IconGI.h \
+ImageCachI.h \
+LabelGI.h \
+LabelI.h \
+ManagerI.h \
+MapEventsI.h \
+MenuProcI.h \
+MenuShellI.h \
+MenuStateI.h \
+MenuUtilI.h \
+MessageBI.h \
+MessagesI.h \
+PixConvI.h \
+PrimitiveI.h \
+PrintSI.h \
+ProtocolsI.h \
+RCHookI.h \
+RCLayoutI.h \
+RCMenuI.h \
+ReadImageI.h \
+RegionI.h \
+RepTypeI.h \
+ResConverI.h \
+ResEncodI.h \
+ResIndI.h \
+RowColumnI.h \
+ScreenI.h \
+ScrollFramTI.h \
+ScrolledWI.h \
+SelectioBI.h \
+SeparatoGI.h \
+SyntheticI.h \
+TearOffI.h \
+TextDIconI.h \
+TextFI.h \
+TextFSelI.h \
+TextI.h \
+TextInI.h \
+TextOutI.h \
+TextSelI.h \
+TextStrSoI.h \
+ToggleBGI.h \
+TraitI.h \
+TransferI.h \
+TravActI.h \
+TraversalI.h \
+UniqueEvnI.h \
+VaSimpleI.h \
+VendorSEI.h \
+VendorSI.h \
+VirtKeysI.h \
+XmI.h \
+XmImI.h \
+XmMsgI.h \
+XmRenderTI.h \
+XmStrDefsI.h \
+XmStringI.h \
+XmTabListI.h \
+XmosI.h \
+XpmI.h \
+EditresComI.h \
+$(JPEG_HDRS) \
+$(PNG_HDRS) \
+$(TIP_HDRS)
+
+xm_HEADERS = ArrowB.h      ArrowBG.h       ArrowBGP.h      ArrowBP.h \
+        BulletinB.h     BulletinBP.h    CacheP.h        CascadeB.h \
+        CascadeBG.h     CascadeBGP.h    CascadeBP.h     Command.h \
+        CommandP.h      CutPaste.h      DialogS.h \
+        DialogSP.h      DialogSEP.h     DragC.h         DragCP.h \
+        DragDrop.h      DragIcon.h      DragIconP.h     DragOverS.h \
+        DragOverSP.h    DropTransP.h    DropSMgr.h      DropSMgrP.h \
+        DropTrans.h     DrawingA.h      DrawingAP.h     DrawnB.h \
+        DrawnBP.h       FileSB.h        FileSBP.h       Form.h \
+        FormP.h         Frame.h         FrameP.h        Label.h \
+        LabelG.h        LabelGP.h       LabelP.h        List.h \
+        ListP.h         MainW.h         MainWP.h        MenuShell.h \
+        MenuShellP.h    MessageB.h      MessageBP.h     PanedW.h \
+        PanedWP.h       PushB.h         PushBG.h        PushBGP.h \
+        PushBP.h        RCLayoutP.h     RowColumn.h     RowColumnP.h \
+        SashP.h         Scale.h         ScaleP.h        ScrollBar.h \
+        ScrollBarP.h    ScrolledW.h     ScrolledWP.h    SelectioB.h \
+        SelectioBP.h    SeparatoG.h     SeparatoGP.h    Separator.h \
+        SeparatorP.h    TextF.h         TextFP.h        TextFSelP.h \
+        TextSelP.h      Text.h          TextInP.h       TextOutP.h \
+        TextP.h         TextStrSoP.h    ToggleB.h       ToggleBG.h \
+        ToggleBGP.h     ToggleBP.h      XmP.h \
+        BaseClassP.h    ManagerP.h      PrimitiveP.h    GadgetP.h \
+        XmStrDefs.h     XmStrDefs22.h   XmStrDefs23.h \
+        VaSimpleP.h     VirtKeys.h      VirtKeysP.h \
+        ExtObjectP.h    Display.h       DisplayP.h      Screen.h \
+        ScreenP.h       ShellEP.h       VendorS.h       VendorSP.h \
+        VendorSEP.h     DesktopP.h      AtomMgr.h \
+        Protocols.h     ProtocolsP.h    MwmUtil.h       TransltnsP.h \
+        RepType.h       XmosP.h         Xmos_r.h       DrawP.h   \
+        Xmpoll.h        TearOffP.h \
+        TearOffBP.h     MenuUtilP.h     MenuT.h         XmAll.h \
+        TraitP.h        SpinB.h         SpinBP.h        SSpinB.h \
+        SSpinBP.h \
+        Container.h     ContainerP.h    IconG.h         IconGP.h \
+        Notebook.h      NotebookP.h     ContItemT.h     ContainerT.h \
+        RCMenuP.h       ClipWindowP.h   TransferT.h \
+        Transfer.h      AccTextT.h      NavigatorT.h    IconFileP.h\
+        ScrollFrameT.h  GrabShell.h     GrabShellP.h    ComboBox.h \
+        ComboBoxP.h     XmIm.h          IconFile.h      AccColorT.h\
+        ActivatableT.h  JoinSideT.h     SpecRenderT.h \
+        CareVisualT.h   DialogSavvyT.h  TransferP.h     TakesDefT.h \
+        ColorP.h        Primitive.h     Manager.h \
+        Gadget.h        LayoutT.h       IconH.h         IconHP.h \
+        UnitTypeT.h     TxtPropCv.h     MenuProcP.h     MenuStateP.h\
+        ColorObjP.h     TravConT.h      UnhighlightT.h  PointInT.h \
+        Print.h         PrintSP.h       XpmP.h		Xmfuncs.h \
+        ${SLIDE_HDRS}	${EXTRA_HDRS}
+
+nodist_xm_HEADERS = Xm.h
+
+SRCS1 = XmStrDefs.c ArrowB.c        ArrowBG.c       BulletinB.c     CallbackI.c \
+        CascadeB.c      CascadeBG.c     Command.c       CutPaste.c \
+        Dest.c          DialogS.c       DialogSE.c      DragBS.c \
+        DragC.c         DragOverS.c     DragICC.c       DragIcon.c \
+        DragUnder.c     DrawingA.c      DrawnB.c        DropSMgr.c \
+        DropSMgrI.c     DropTrans.c     ExtObject.c     FileSB.c \
+        Form.c          Frame.c         Gadget.c        GadgetUtil.c \
+        GeoUtils.c      ImageCache.c    Label.c         LabelG.c \
+        List.c          MainW.c         MapEvents.c     MenuShell.c \
+        MenuUtil.c      MessageB.c      PanedW.c        PushB.c \
+        PushBG.c        ReadImage.c     Region.c        ResConvert.c \
+        ResInd.c        RowColumn.c     Sash.c          \
+        Scale.c         ScrollBar.c     ScrolledW.c     SelectioB.c \
+        SeparatoG.c     Separator.c     Simple.c        Text.c \
+        TextIn.c        TextOut.c       TextStrSo.c     TextSel.c \
+        ToggleB.c       ToggleBG.c      TrackLoc.c      UniqueEvnt.c \
+        VaSimple.c      VirtKeys.c      XmString.c      ResEncod.c\
+        TextF.c         TextFSel.c      AtomMgr.c \
+        Cache.c         Protocols.c     Primitive.c     Manager.c \
+        Traversal.c     TravAct.c       TraversalI.c    BaseClass.c
+
+SRCS2 = Desktop.c       Messages.c      Transltns.c     RepType.c \
+        Xmos.c          Draw.c          TearOff.c       TearOffB.c \
+        XmIm.c          GMUtils.c       Display.c       Screen.c \
+        ShellE.c        VendorS.c       VendorSE.c      RCMenu.c  \
+        RCLayout.c      GetPixData.c    RCPopup.c       Trait.c  \
+        Synthetic.c     XmFontList.c    ClipWindow.c    Transfer.c \
+        Hash.c          ScrollFrameT.c  \
+        XmTabList.c     Resolve.c       XmStringFunc.c \
+        XmRenderT.c     PixConv.c       Color.c         Xm.c \
+        CareVisualT.c   Direction.c     XmStringObso.c  XmStringGet.c \
+        IsMwmRun.c      MenuProc.c      MenuState.c     TextFind.c \
+        TextFunc.c      ColorObj.c      IconFile.c      RCHook.c \
+        GetRes.c        BBUtil.c        ChColor.c       ColObjFunc.c \
+        DrTog.c         DrArrow.c       DrPoly.c        DrHiDash.c \
+        ValTime.c       FocusAct.c      CvtUnit.c       ScalTics.c \
+        ScroVis.c       WidGet.c        $(PRINTS_SRC)
+
+OBSO_SRCS = Obso1_2.c ObsoStr.c ObsoXme.c Obso2_0.c
+
+XPM_SRCS = \
+        XpmAttrib.c    XpmCrIFrDat.c  XpmInfo.c      XpmWrFFrDat.c  Xpmmisc.c \
+        XpmCrBufFrI.c  XpmCrIFrP.c    XpmRdFToBuf.c  XpmWrFFrI.c    Xpmparse.c\
+        XpmCrBufFrP.c  XpmCrPFrBuf.c  XpmRdFToDat.c  XpmWrFFrP.c    Xpmrgb.c \
+        XpmCrDatFrI.c  XpmCrPFrDat.c  XpmRdFToI.c    Xpmcreate.c    Xpmscan.c \
+        Xpms_popen.c   XpmCrDatFrP.c  XpmCrPFrI.c    XpmRdFToP.c    Xpmdata.c \
+        XpmCrIFrBuf.c  XpmImage.c     XpmWrFFrBuf.c  Xpmhashtab.c
+
+NEW_WID_SRCS =         IconH.c        Container.c     IconG.c  \
+        Notebook.c     ComboBox.c     GrabShell.c     SpinB.c  \
+        SSpinB.c       TxtPropCv.c    XmStringSeg.c   TranslNew.c
+
+libXm_la_SOURCES = $(SRCS1) $(SRCS2) $(OBSO_SRCS) $(XPM_SRCS) $(NEW_WID_SRCS) $(SLIDE_SRCS) \
+        $(TIP_SRCS) $(EDITRES_SRCS) $(EXTRA_SRCS) $(JPEG_SRCS) $(PNG_SRCS)
+
+EXTRA_libXm_la_SOURCES = $(SLIDE_SRCS) $(TIP_SRCS)
+
+STRING_FILES = XmStrDefs.h XmStrDefs22.h XmStrDefs23.h XmStrDefsI.h XmStrDefs.c
+
+BUILT_SOURCES = $(STRING_FILES) $(CAT_FILES)
+
+$(top_builddir)/config/util/makestrs:
+	( cd $(top_builddir)/config/util && $(MAKE) $(AM_MAKEFLAGS) makestrs )
+
+$(STRING_FILES): Makefile $(XMSTRING_LIST) XmStrDefs.ht XmStrDefsI.ht XmStrDefs.ct $(top_builddir)/config/util/makestrs
+	test -f $(XMSTRING_LIST) || $(LN_S) $(srcdir)/$(XMSTRING_LIST) $(XMSTRING_LIST)
+	test -f XmStrDefs.ht || $(LN_S) $(srcdir)/XmStrDefs.ht XmStrDefs.ht
+	test -f XmStrDefs22.ht || $(LN_S) $(srcdir)/XmStrDefs22.ht XmStrDefs22.ht
+	test -f XmStrDefs23.ht || $(LN_S) $(srcdir)/XmStrDefs23.ht XmStrDefs23.ht
+	test -f XmStrDefsI.ht || $(LN_S) $(srcdir)/XmStrDefsI.ht XmStrDefsI.ht
+	test -f XmStrDefs.ct || $(LN_S) $(srcdir)/XmStrDefs.ct XmStrDefs.ct
+	$(top_builddir)/config/util/makestrs -f $(XMSTRING_LIST) >XmStrDefs.c
+
+if MessageCatalog
+
+CAT_FILES = Xm.cat XmMsgCatI.h
+
+$(CAT_FILES): Xm.msg
+	$(mkinstalldirs) $(top_builddir)/localized/C/msg
+	$(top_builddir)/localized/util/mkcatdefs XmMsgCatI.h $(srcdir)/Xm.msg >$(top_builddir)/localized/C/msg/Xm.msg
+	gencat Xm.cat $(top_builddir)/localized/C/msg/Xm.msg
+    SPLINT_EXTRAFLAGS = -I/usr/include -I. +posixlib -nestcomment
+else
+    SPLINT_EXTRAFLAGS = -I/usr/include -I. -DNO_MESSAGE_CATALOG +posixlib -nestcomment
+endif
+
+splint: $(STRING_FILES)
+	$(SPLINT) $(INCLUDES) $(SPLINT_EXTRAFLAGS) $(top_srcdir)/lib/Xm/*.c
+
+#include $(srcdir)/check_headers.am
diff '--color=auto' -Naur motif-2.3.8.orig/lib/Xm/Xmos_r.h motif-2.3.8/lib/Xm/Xmos_r.h
--- motif-2.3.8.orig/lib/Xm/Xmos_r.h	2016-03-15 20:10:08.000000000 -0600
+++ motif-2.3.8/lib/Xm/Xmos_r.h	2026-03-06 18:54:16.104739164 -0700
@@ -602,7 +602,7 @@
 # endif
 } _Xreaddirparams;
 
-# if defined(AIXV3) || defined(AIXV4) || defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+# if defined(AIXV3) || defined(AIXV4) || defined(HAVE_READDIR_R_3) || defined(_POSIX_THREAD_SAFE_FUNCTIONS)
 /* AIX defines the draft POSIX symbol, but uses the final API. */
 /* POSIX final API, returns (int)0 on success. */
 #  if defined(__osf__)
diff '--color=auto' -Naur motif-2.3.8.orig/lib/Xm/Xpmcreate.c motif-2.3.8/lib/Xm/Xpmcreate.c
--- motif-2.3.8.orig/lib/Xm/Xpmcreate.c	2016-03-15 20:10:08.000000000 -0600
+++ motif-2.3.8/lib/Xm/Xpmcreate.c	2026-03-06 18:54:16.125764836 -0700
@@ -954,10 +954,14 @@
 #ifndef FOR_MSW
     if (height != 0 && (*image_return)->bytes_per_line >= INT_MAX / height) {
   	XDestroyImage(*image_return);
+	*image_return = NULL;
         return (XpmNoMemory);
     }
-    if((*image_return)->bytes_per_line == 0 ||  height == 0)
+    if((*image_return)->bytes_per_line == 0 ||  height == 0) {
+	XDestroyImage(*image_return);
+	*image_return = NULL;
         return XpmNoMemory;
+    }
     /* now that bytes_per_line must have been set properly alloc data */
     (*image_return)->data =
 	(char *) XpmMalloc((*image_return)->bytes_per_line * height);
diff '--color=auto' -Naur motif-2.3.8.orig/lib/Xm/Xpmdata.c motif-2.3.8/lib/Xm/Xpmdata.c
--- motif-2.3.8.orig/lib/Xm/Xpmdata.c	2016-03-15 20:10:08.000000000 -0600
+++ motif-2.3.8/lib/Xm/Xpmdata.c	2026-03-06 18:54:16.126120303 -0700
@@ -171,6 +171,10 @@
 		notend = 0;
 		ungetc(*s, file);
 	    }
+	    else if (c == EOF) {
+		/* hit end of file before the end of the comment */
+		return XpmFileInvalid;
+	    }
 	}
 	return 0;
     }
@@ -189,19 +193,23 @@
 	register char c;
 
 	/* get to the end of the current string */
-	if (mdata->Eos)
-	    while ((c = *mdata->cptr++) && c != mdata->Eos);
+	if (mdata->Eos) {
+	    while ((c = *mdata->cptr++) && c != mdata->Eos && c != '\0');
+
+	    if (c == '\0')
+		return XpmFileInvalid;
+	}
 
 	/*
 	 * then get to the beginning of the next string looking for possible
 	 * comment
 	 */
 	if (mdata->Bos) {
-	    while ((c = *mdata->cptr++) && c != mdata->Bos)
+	    while ((c = *mdata->cptr++) && c != mdata->Bos && c != '\0')
 		if (mdata->Bcmt && c == mdata->Bcmt[0])
 		    ParseComment(mdata);
 	} else if (mdata->Bcmt) {	/* XPM2 natural */
-	    while ((c = *mdata->cptr++) == mdata->Bcmt[0])
+	    while (((c = *mdata->cptr++) == mdata->Bcmt[0]) && c != '\0')
 		ParseComment(mdata);
 	    mdata->cptr--;
 	}
@@ -210,9 +218,13 @@
 	FILE *file = mdata->stream.file;
 
 	/* get to the end of the current string */
-	if (mdata->Eos)
+	if (mdata->Eos) {
 	    while ((c = getc(file)) != mdata->Eos && c != EOF);
 
+	    if (c == EOF)
+		return XpmFileInvalid;
+	}
+
 	/*
 	 * then get to the beginning of the next string looking for possible
 	 * comment
@@ -228,7 +240,7 @@
 	    ungetc(c, file);
 	}
     }
-    return 0;
+    return XpmSuccess;
 }
 
 
diff '--color=auto' -Naur motif-2.3.8.orig/lib/Xm/XpmI.h motif-2.3.8/lib/Xm/XpmI.h
--- motif-2.3.8.orig/lib/Xm/XpmI.h	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/lib/Xm/XpmI.h	2026-03-06 18:54:16.119779110 -0700
@@ -129,7 +129,7 @@
 extern FILE *popen();
 #endif
 
-#if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(WIN32) || defined (_SVID_SOURCE)
+#if defined(HAVE_STRING_H)
 #include <string.h>
 
 #ifndef index
@@ -140,7 +140,7 @@
 #define rindex strrchr
 #endif
 
-#else  /* defined(SYSV) || defined(SVR4) || defined(VMS) */
+#else
 #include <strings.h>
 #endif
 
diff '--color=auto' -Naur motif-2.3.8.orig/lib/Xm/Xpmparse.c motif-2.3.8/lib/Xm/Xpmparse.c
--- motif-2.3.8.orig/lib/Xm/Xpmparse.c	2017-03-27 16:24:31.000000000 -0600
+++ motif-2.3.8/lib/Xm/Xpmparse.c	2026-03-06 18:54:16.126323464 -0700
@@ -523,6 +523,13 @@
 {
     unsigned int *iptr, *iptr2 = NULL; /* found by Egbert Eich */
     unsigned int a, x, y;
+    int ErrorStatus;
+
+    if ((width == 0) && (height != 0))
+	return (XpmFileInvalid);
+
+    if ((height == 0) && (width != 0))
+	return (XpmFileInvalid);
 
     if ((height > 0 && width >= UINT_MAX / height) ||
 	width * height >= UINT_MAX / sizeof(unsigned int)) 
@@ -560,7 +567,11 @@
 		colidx[(unsigned char)colorTable[a].string[0]] = a + 1;
 
 	    for (y = 0; y < height; y++) {
-		xpmNextString(data);
+		ErrorStatus = xpmNextString(data);
+		if (ErrorStatus != XpmSuccess) {
+		    XpmFree(iptr2);
+		    return (ErrorStatus);
+		}
 		for (x = 0; x < width; x++, iptr++) {
 		    int c = xpmGetC(data);
 
@@ -607,7 +618,11 @@
 	    }
 
 	    for (y = 0; y < height; y++) {
-		xpmNextString(data);
+		ErrorStatus = xpmNextString(data);
+		if (ErrorStatus != XpmSuccess) {
+		    XpmFree(iptr2);
+		    return (ErrorStatus);
+		}
 		for (x = 0; x < width; x++, iptr++) {
 		    int cc1 = xpmGetC(data);
 		    if (cc1 > 0 && cc1 < 256) {
@@ -646,7 +661,11 @@
 		xpmHashAtom *slot;
 
 		for (y = 0; y < height; y++) {
-		    xpmNextString(data);
+		    ErrorStatus = xpmNextString(data);
+		    if (ErrorStatus != XpmSuccess) {
+			XpmFree(iptr2);
+			return (ErrorStatus);
+		    }
 		    for (x = 0; x < width; x++, iptr++) {
 			for (a = 0, s = buf; a < cpp; a++, s++)
 			    *s = xpmGetC(data); /* int assigned to char, not a problem here */
@@ -660,7 +679,11 @@
 		}
 	    } else {
 		for (y = 0; y < height; y++) {
-		    xpmNextString(data);
+		    ErrorStatus = xpmNextString(data);
+		    if (ErrorStatus != XpmSuccess) {
+			XpmFree(iptr2);
+			return (ErrorStatus);
+		    }
 		    for (x = 0; x < width; x++, iptr++) {
 			for (a = 0, s = buf; a < cpp; a++, s++)
 			    *s = xpmGetC(data); /* int assigned to char, not a problem here */
diff '--color=auto' -Naur motif-2.3.8.orig/Makefile.am motif-2.3.8/Makefile.am
--- motif-2.3.8.orig/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/Makefile.am	2026-03-06 18:54:16.112050914 -0700
@@ -27,7 +27,6 @@
              include \
              tools \
              clients \
-             doc \
-             demos
+             doc
 AUTOMAKE_OPTIONS = 1.4
 ACLOCAL_AMFLAGS = -I .
diff '--color=auto' -Naur motif-2.3.8.orig/patch/01_all_solaris.patch motif-2.3.8/patch/01_all_solaris.patch
--- motif-2.3.8.orig/patch/01_all_solaris.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/01_all_solaris.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,17 @@
+http://bugs.motifzone.net/showattachment.cgi?attach_id=259
+http://bugs.motifzone.net/long_list.cgi?buglist=1479
+
+Extend the patch to include guard for sun to solve the exact same
+compilation issue on Solaris.
+
+--- motif-2.3.4-orig/clients/uil/UilDefI.h
++++ motif-2.3.4/clients/uil/UilDefI.h
+@@ -270,7 +270,7 @@
+ #include "UilIODef.h"
+ #include "UilDiagDef.h"
+ #include "UilSarDef.h"
+-#if defined(linux) || defined(__APPLE__)
++#if defined(linux) || defined(__APPLE__) || defined(sun)
+ #define YYSTYPE yystype
+ #endif
+ #include "UilLexPars.h"
diff '--color=auto' -Naur motif-2.3.8.orig/patch/02_all_sanitise-paths.patch motif-2.3.8/patch/02_all_sanitise-paths.patch
--- motif-2.3.8.orig/patch/02_all_sanitise-paths.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/02_all_sanitise-paths.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,27 @@
+* don't do automagic guessing of paths
+
+--- motif-2.3.4-orig/configure.ac
++++ motif-2.3.4/configure.ac
+@@ -183,21 +183,8 @@
+ 
+ case "$host_os" in
+     freebsd*) CFLAGS="$CFLAGS -DCSRG_BASED -DXNO_MTSAFE_API -DXNO_MTSAFE_PWDAPI";
+-        LDFLAGS="$LDFLAGS -L/usr/local/lib";;
++        ;;
+     cygwin*) CFLAGS="$CFLAGS -DXNO_MTSAFE_DIRENTDAPI";;
+-    solaris* | sunos*) X_LIBS="$X_LIBS -L/usr/X/lib" &&
+-        if test x$enable_motif22_compatibility = x
+-        then
+-            enable_motif22_compatibility="no"
+-        fi;
+-        if test x$enable_utf8 = x
+-        then
+-            enable_utf8="no"
+-        fi;
+-        if test x$enable_xft = x
+-        then
+-            enable_xft="no"
+-        fi;;
+ esac
+ 
+ if test x$enable_motif22_compatibility = x
diff '--color=auto' -Naur motif-2.3.8.orig/patch/03_all_solaris-11.patch motif-2.3.8/patch/03_all_solaris-11.patch
--- motif-2.3.8.orig/patch/03_all_solaris-11.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/03_all_solaris-11.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,13 @@
+https://bugs.gentoo.org/465426
+
+--- motif-2.3.4-orig/lib/Xm/Xmos_r.h
++++ motif-2.3.4/lib/Xm/Xmos_r.h
+@@ -602,7 +602,7 @@
+ # endif
+ } _Xreaddirparams;
+ 
+-# if defined(AIXV3) || defined(AIXV4) || defined(_POSIX_THREAD_SAFE_FUNCTIONS)
++# if defined(AIXV3) || defined(AIXV4) || defined(HAVE_READDIR_R_3) || defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+ /* AIX defines the draft POSIX symbol, but uses the final API. */
+ /* POSIX final API, returns (int)0 on success. */
+ #  if defined(__osf__)
diff '--color=auto' -Naur motif-2.3.8.orig/patch/04_all_parallel-make.patch motif-2.3.8/patch/04_all_parallel-make.patch
--- motif-2.3.8.orig/patch/04_all_parallel-make.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/04_all_parallel-make.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,15 @@
+http://bugs.motifzone.net/show_bug.cgi?id=1592
+
+--- motif-2.3.4-orig/lib/Xm/Makefile.am
++++ motif-2.3.4/lib/Xm/Makefile.am
+@@ -283,7 +283,9 @@
+ $(top_builddir)/config/util/makestrs:
+ 	( cd $(top_builddir)/config/util && $(MAKE) $(AM_MAKEFLAGS) makestrs )
+ 
+-$(STRING_FILES): Makefile $(XMSTRING_LIST) XmStrDefs.ht XmStrDefsI.ht XmStrDefs.ct $(top_builddir)/config/util/makestrs
++XmStrDefs.h XmStrDefs22.h XmStrDefs23.h XmStrDefsI.h: XmStrDefs.c
++
++XmStrDefs.c: Makefile $(XMSTRING_LIST) XmStrDefs.ht XmStrDefsI.ht XmStrDefs.ct $(top_builddir)/config/util/makestrs
+ 	test -f $(XMSTRING_LIST) || $(LN_S) $(srcdir)/$(XMSTRING_LIST) $(XMSTRING_LIST)
+ 	test -f XmStrDefs.ht || $(LN_S) $(srcdir)/XmStrDefs.ht XmStrDefs.ht
+ 	test -f XmStrDefs22.ht || $(LN_S) $(srcdir)/XmStrDefs22.ht XmStrDefs22.ht
diff '--color=auto' -Naur motif-2.3.8.orig/patch/05_all_install-dirs.patch motif-2.3.8/patch/05_all_install-dirs.patch
--- motif-2.3.8.orig/patch/05_all_install-dirs.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/05_all_install-dirs.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,18 @@
+--- motif-2.3.4-orig/configure.ac
++++ motif-2.3.4/configure.ac
+@@ -179,13 +179,13 @@
+ LIBDIR="${libdir}/X11"
+ AC_SUBST(LIBDIR)
+ 
+-MWMRCDIR="${libdir}/X11"
++MWMRCDIR="${sysconfdir}/X11/mwm"
+ AC_SUBST(MWMRCDIR)
+ 
+ INCDIR="${includedir}/X11"
+ AC_SUBST(INCDIR)
+ 
+-XMBINDDIR_FALLBACK="${libdir}/X11/bindings"
++XMBINDDIR_FALLBACK="${datadir}/X11/bindings"
+ AC_SUBST(XMBINDDIR_FALLBACK)
+ 
+ RM="rm -f"
diff '--color=auto' -Naur motif-2.3.8.orig/patch/06_all_cflags.patch motif-2.3.8/patch/06_all_cflags.patch
--- motif-2.3.8.orig/patch/06_all_cflags.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/06_all_cflags.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,14 @@
+https://bugs.gentoo.org/604242
+Do not add -g to the user's CFLAGS.
+
+--- motif-2.3.6-orig/configure.ac
++++ motif-2.3.6/configure.ac
+@@ -158,7 +158,7 @@
+ 
+ if test x$GCC = xyes
+ then
+-    CFLAGS="$CFLAGS -Wall -g -fno-strict-aliasing -Wno-unused -Wno-comment"
++    CFLAGS="$CFLAGS -Wall -fno-strict-aliasing -Wno-unused -Wno-comment"
+     if test ` $CC -dumpversion | sed -e 's/\(^.\).*/\1/'` = "4" ; then
+         CFLAGS="$CFLAGS -fno-tree-ter"
+     fi
diff '--color=auto' -Naur motif-2.3.8.orig/patch/07_all_no-demos.patch motif-2.3.8/patch/07_all_no-demos.patch
--- motif-2.3.8.orig/patch/07_all_no-demos.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/07_all_no-demos.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,13 @@
+Disable compilation of demo binaries.
+
+--- motif-2.3.8-orig/Makefile.am
++++ motif-2.3.8/Makefile.am
+@@ -27,7 +27,6 @@
+              include \
+              tools \
+              clients \
+-             doc \
+-             demos
++             doc
+ AUTOMAKE_OPTIONS = 1.4
+ ACLOCAL_AMFLAGS = -I .
diff '--color=auto' -Naur motif-2.3.8.orig/patch/08_all_xmbind-xorg.patch motif-2.3.8/patch/08_all_xmbind-xorg.patch
--- motif-2.3.8.orig/patch/08_all_xmbind-xorg.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/08_all_xmbind-xorg.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,9 @@
+Add X.Org vendor string to aliases for virtual bindings.
+
+--- motif-2.3.8-orig/bindings/xmbind.alias
++++ motif-2.3.8/bindings/xmbind.alias
+@@ -62,3 +62,4 @@
+ "Sun Microsystems, Inc."				sun
+ ! "Sun Microsystems, Inc."				sun_at
+ "Tektronix, Inc."					tek
++"The X.Org Foundation"					pc
diff '--color=auto' -Naur motif-2.3.8.orig/patch/09_all_slibtool.patch motif-2.3.8/patch/09_all_slibtool.patch
--- motif-2.3.8.orig/patch/09_all_slibtool.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/09_all_slibtool.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,276 @@
+https://bugs.gentoo.org/778050
+Patches taken from http://bugs.motifzone.net/show_bug.cgi?id=1720
+
+From 27c113b0361c3f8c41e84de3a4b1ced4e47717ef Mon Sep 17 00:00:00 2001
+From: orbea <orbea@riseup.net>
+Date: Thu, 25 Mar 2021 08:20:26 -0700
+Subject: [PATCH 1/2] build: Create libwml.la.
+
+---
+ tools/wml/Makefile.am | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/tools/wml/Makefile.am b/tools/wml/Makefile.am
+index 8ac04669..f99c8a71 100644
+--- a/tools/wml/Makefile.am
++++ b/tools/wml/Makefile.am
+@@ -27,15 +27,14 @@ wmluiltok_SOURCES = wmluiltok.l
+ wmluiltok_LDADD = @LEXLIB@
+ 
+ wml_SOURCES = wml.c
+-wml_LDADD = -L. -lwml
+-wml_DEPENDENCIES = libwml.a
++wml_LDADD = libwml.la
+ 
+ wmldbcreate_LDADD = ../../lib/Xm/libXm.la
+ 
+ INCLUDES = -I../../lib -I$(srcdir)/../../lib -I$(srcdir)/../../include ${X_CFLAGS} 
+ 
+-noinst_LIBRARIES = libwml.a
+-libwml_a_SOURCES = wmlparse.y wml.c wmloutkey.c wmlouth.c wmloutmm.c wmloutp1.c wmlresolve.c wmlsynbld.c wmlutils.c
++noinst_LTLIBRARIES = libwml.la
++libwml_la_SOURCES = wmlparse.y wmloutkey.c wmlouth.c wmloutmm.c wmloutp1.c wmlresolve.c wmlsynbld.c wmlutils.c
+ 
+ wmlparse.c: wmllex.c
+ 
+@@ -66,7 +65,7 @@ motif.wmd: wmldbcreate
+ 	./wmldbcreate -o motif.wmd
+ 
+ clean-local:
+-	$(RM) $(WMLTARGETS) $(WMDTABLE) $(REPORT) lex.yy.c libwml.a wml \
++	$(RM) $(WMLTARGETS) $(WMDTABLE) $(REPORT) lex.yy.c libwml.la wml \
+ 	*.mm *.sdml *.txt wmlparse.c wmlparse.h wmluiltok wmllex.c \
+ 	tokens.dat DONE wmluiltok.c Uil.c Uil.h wml.report UilLexPars.[ch] ylwrap
+  
+-- 
+2.26.3
+
+From 1c987ae37ca01da44a323b8e8866c3f43226a4b1 Mon Sep 17 00:00:00 2001
+From: orbea <orbea@riseup.net>
+Date: Thu, 25 Mar 2021 08:32:40 -0700
+Subject: [PATCH 2/2] build: Create libXmd.la.
+
+---
+ demos/doc/programGuide/ch05/Scale/Makefile.am       | 2 +-
+ demos/doc/programGuide/ch06/combo_box/Makefile.am   | 2 +-
+ demos/doc/programGuide/ch06/spin_box/Makefile.am    | 2 +-
+ demos/doc/programGuide/ch08/Container/Makefile.am   | 2 +-
+ demos/doc/programGuide/ch08/Notebook/Makefile.am    | 2 +-
+ demos/doc/programGuide/ch16/Makefile.am             | 2 +-
+ demos/doc/programGuide/ch17/simple_drag/Makefile.am | 2 +-
+ demos/doc/programGuide/ch17/simple_drop/Makefile.am | 2 +-
+ demos/lib/Xmd/Makefile.am                           | 6 +++---
+ demos/programs/animate/Makefile.am                  | 2 +-
+ demos/programs/draw/Makefile.am                     | 2 +-
+ demos/programs/filemanager/Makefile.am              | 2 +-
+ demos/programs/getsubres/Makefile.am                | 2 +-
+ demos/programs/i18ninput/Makefile.am                | 2 +-
+ demos/programs/sampler2_0/Makefile.am               | 2 +-
+ demos/programs/todo/Makefile.am                     | 2 +-
+ demos/unsupported/aicon/Makefile.am                 | 2 +-
+ 17 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/demos/doc/programGuide/ch05/Scale/Makefile.am b/demos/doc/programGuide/ch05/Scale/Makefile.am
+index 666240bc..03474cc7 100644
+--- a/demos/doc/programGuide/ch05/Scale/Makefile.am
++++ b/demos/doc/programGuide/ch05/Scale/Makefile.am
+@@ -8,4 +8,4 @@ tic_mark_SOURCES = tic_mark.c interface.c
+ 
+ INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
+ 
+-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
++LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
+diff --git a/demos/doc/programGuide/ch06/combo_box/Makefile.am b/demos/doc/programGuide/ch06/combo_box/Makefile.am
+index 59a0b9e5..dcc8890f 100644
+--- a/demos/doc/programGuide/ch06/combo_box/Makefile.am
++++ b/demos/doc/programGuide/ch06/combo_box/Makefile.am
+@@ -9,4 +9,4 @@ combo_box_SOURCES = combo_box.c interface.c
+ 
+ INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
+ 
+-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
++LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
+diff --git a/demos/doc/programGuide/ch06/spin_box/Makefile.am b/demos/doc/programGuide/ch06/spin_box/Makefile.am
+index 3f83854d..4d15b82a 100644
+--- a/demos/doc/programGuide/ch06/spin_box/Makefile.am
++++ b/demos/doc/programGuide/ch06/spin_box/Makefile.am
+@@ -9,4 +9,4 @@ spin_box_SOURCES = spin_box.c interface.c
+ 
+ INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
+ 
+-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
++LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
+diff --git a/demos/doc/programGuide/ch08/Container/Makefile.am b/demos/doc/programGuide/ch08/Container/Makefile.am
+index 59ec0cbe..96970e38 100644
+--- a/demos/doc/programGuide/ch08/Container/Makefile.am
++++ b/demos/doc/programGuide/ch08/Container/Makefile.am
+@@ -8,4 +8,4 @@ container_SOURCES = container.c  interface.c
+ 
+ INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
+ 
+-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
++LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
+diff --git a/demos/doc/programGuide/ch08/Notebook/Makefile.am b/demos/doc/programGuide/ch08/Notebook/Makefile.am
+index 3daefe3e..633246d7 100644
+--- a/demos/doc/programGuide/ch08/Notebook/Makefile.am
++++ b/demos/doc/programGuide/ch08/Notebook/Makefile.am
+@@ -8,4 +8,4 @@ notebook_SOURCES = interface.c  notebook.c
+ 
+ INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
+ 
+-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
++LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
+diff --git a/demos/doc/programGuide/ch16/Makefile.am b/demos/doc/programGuide/ch16/Makefile.am
+index 24d900de..5be02d5f 100644
+--- a/demos/doc/programGuide/ch16/Makefile.am
++++ b/demos/doc/programGuide/ch16/Makefile.am
+@@ -9,4 +9,4 @@ UTMXmText_SOURCES = UTMXmText.c
+ 
+ INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
+ 
+-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
++LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
+diff --git a/demos/doc/programGuide/ch17/simple_drag/Makefile.am b/demos/doc/programGuide/ch17/simple_drag/Makefile.am
+index 607827d4..49d9991c 100644
+--- a/demos/doc/programGuide/ch17/simple_drag/Makefile.am
++++ b/demos/doc/programGuide/ch17/simple_drag/Makefile.am
+@@ -9,4 +9,4 @@ simple_drag_SOURCES = simple_drag.c
+ 
+ INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
+ 
+-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
++LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
+diff --git a/demos/doc/programGuide/ch17/simple_drop/Makefile.am b/demos/doc/programGuide/ch17/simple_drop/Makefile.am
+index 21905f1b..30d45673 100644
+--- a/demos/doc/programGuide/ch17/simple_drop/Makefile.am
++++ b/demos/doc/programGuide/ch17/simple_drop/Makefile.am
+@@ -9,4 +9,4 @@ simple_drop_SOURCES = simple_drop.c
+ 
+ INCLUDES = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/demos/lib $(X_CFLAGS)
+ 
+-LDADD = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la
++LDADD = $(top_builddir)/demos/lib/Xmd/libXmd.la $(top_builddir)/lib/Xm/libXm.la
+diff --git a/demos/lib/Xmd/Makefile.am b/demos/lib/Xmd/Makefile.am
+index 34f1aa82..2a432bbb 100644
+--- a/demos/lib/Xmd/Makefile.am
++++ b/demos/lib/Xmd/Makefile.am
+@@ -1,10 +1,10 @@
+ MAINTAINERCLEANFILES = Makefile.in
+ 
+-noinst_LIBRARIES = libXmd.a
++noinst_LTLIBRARIES = libXmd.la
+ 
+ noinst_PROGRAMS = onHelp
+ 
+-libXmd_a_SOURCES = Help.c Menus.c Print.c RegEdit.c AdjView.c
++libXmd_la_SOURCES = Help.c Menus.c Print.c RegEdit.c AdjView.c
+ 
+ noinst_HEADERS = AdjView.h \
+ Help.h HelpP.h \
+@@ -12,7 +12,7 @@ Menus.h \
+ Print.h PrintP.h \
+ RegEdit.h RegEditI.h
+ 
+-LDADD = libXmd.a ../../../lib/Xm/libXm.la
++LDADD = libXmd.la ../../../lib/Xm/libXm.la
+ 
+ INCLUDES = -I$(top_builddir)/lib -I$(srcdir)/../../../lib ${X_CFLAGS} 
+ 
+diff --git a/demos/programs/animate/Makefile.am b/demos/programs/animate/Makefile.am
+index 61d3dd12..5677bce7 100644
+--- a/demos/programs/animate/Makefile.am
++++ b/demos/programs/animate/Makefile.am
+@@ -17,7 +17,7 @@ data_DATA = dog.uid plane.uid superman.uid xmanimate.uid $(xmanimate_SOURCES) \
+ 
+ bin_PROGRAMS = xmanimate
+ 
+-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Mrm/libMrm.la ../../../lib/Xm/libXm.la
++LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Mrm/libMrm.la ../../../lib/Xm/libXm.la
+ 
+ INCLUDES = -I$(srcdir)/../../../lib \
+            -I$(srcdir)/../../lib \
+diff --git a/demos/programs/draw/Makefile.am b/demos/programs/draw/Makefile.am
+index 69388278..8a7ba950 100644
+--- a/demos/programs/draw/Makefile.am
++++ b/demos/programs/draw/Makefile.am
+@@ -7,5 +7,5 @@ bin_PROGRAMS = draw
+ draw_SOURCES = draw.c
+ EXTRA_DIST = XmdDraw.ad README draw.help draw.man
+ data_DATA = $(EXTRA_DIST) $(draw_SOURCES)
+-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
++LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
+ INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
+diff --git a/demos/programs/filemanager/Makefile.am b/demos/programs/filemanager/Makefile.am
+index cd71be28..26415896 100644
+--- a/demos/programs/filemanager/Makefile.am
++++ b/demos/programs/filemanager/Makefile.am
+@@ -11,7 +11,7 @@ EXTRA_DIST = filemanager.man filemanager.help XmdFilemanager.ad \
+            obj.xpm pix.xpm s_dir.xpm s_exec.xpm s_file.xpm \
+            s_none.xpm s_pix.xpm
+ data_DATA = $(EXTRA_DIST) $(filemanager_SOURCES)
+-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
++LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
+ INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
+ 
+ 
+diff --git a/demos/programs/getsubres/Makefile.am b/demos/programs/getsubres/Makefile.am
+index c61a46e3..50e093ca 100644
+--- a/demos/programs/getsubres/Makefile.am
++++ b/demos/programs/getsubres/Makefile.am
+@@ -7,5 +7,5 @@ bin_PROGRAMS = getsubres
+ EXTRA_DIST = getsubres.help getsubres.man README
+ getsubres_SOURCES = getsubres.c
+ data_DATA = $(EXTRA_DIST) $(getsubres_SOURCES)
+-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
++LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
+ INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
+diff --git a/demos/programs/i18ninput/Makefile.am b/demos/programs/i18ninput/Makefile.am
+index 3751fcef..3124fd23 100644
+--- a/demos/programs/i18ninput/Makefile.am
++++ b/demos/programs/i18ninput/Makefile.am
+@@ -7,6 +7,6 @@ bin_PROGRAMS = i18ninput
+ i18ninput_SOURCES = i18ninput.c input.c 
+ EXTRA_DIST = XmdI18nInput.ad README i18ninput.man i18ninput.help
+ data_DATA = $(EXTRA_DIST) $(i18ninput_SOURCES)
+-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
++LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
+ 
+ INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
+diff --git a/demos/programs/sampler2_0/Makefile.am b/demos/programs/sampler2_0/Makefile.am
+index bfb22862..950a6cc5 100644
+--- a/demos/programs/sampler2_0/Makefile.am
++++ b/demos/programs/sampler2_0/Makefile.am
+@@ -10,6 +10,6 @@ EXTRA_DIST = bee.xpm bomb.xpm cherry.xpm da.xpm girlface.xpm k7.xpm \
+ bin_PROGRAMS = sampler2_0
+ sampler2_0_SOURCES = sampler2_0.c
+ data_DATA = $(sampler2_0_SOURCES) $(EXTRA_DIST)
+-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
++LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
+ 
+ INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
+diff --git a/demos/programs/todo/Makefile.am b/demos/programs/todo/Makefile.am
+index 138662e3..afc311af 100644
+--- a/demos/programs/todo/Makefile.am
++++ b/demos/programs/todo/Makefile.am
+@@ -9,4 +9,4 @@ todo_SOURCES = todo.c io.c actions.c page.h
+ data_DATA = $(EXTRA_DIST) $(todo_SOURCES)
+ 
+ INCLUDES = -I$(srcdir)/../../../lib -I$(srcdir)/../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
+-LDADD = -L../../lib/Xmd -lXmd -L../../lib/Exm -lExm ../../../lib/Xm/libXm.la 
++LDADD = ../../lib/Xmd/libXmd.la -L../../lib/Exm -lExm ../../../lib/Xm/libXm.la
+diff --git a/demos/unsupported/aicon/Makefile.am b/demos/unsupported/aicon/Makefile.am
+index 6b351ade..2985dd3f 100644
+--- a/demos/unsupported/aicon/Makefile.am
++++ b/demos/unsupported/aicon/Makefile.am
+@@ -2,7 +2,7 @@ MAINTAINERCLEANFILES = Makefile.in
+ 
+ noinst_PROGRAMS = aicon
+  
+-LDADD = -L../../lib/Xmd -lXmd ../../../lib/Xm/libXm.la 
++LDADD = ../../lib/Xmd/libXmd.la ../../../lib/Xm/libXm.la
+ 
+ INCLUDES = -I$(srcdir)/../../../lib -I$(srcdir)/../../lib -I$(top_builddir)/lib ${X_CFLAGS} 
+ 
+-- 
+2.26.3
+
diff '--color=auto' -Naur motif-2.3.8.orig/patch/10_all_string_h.patch motif-2.3.8/patch/10_all_string_h.patch
--- motif-2.3.8.orig/patch/10_all_string_h.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/10_all_string_h.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,22 @@
+https://bugs.gentoo.org/870799
+
+--- motif-2.3.8/lib/Xm/XpmI.h
++++ motif-2.3.8/lib/Xm/XpmI.h
+@@ -129,7 +129,7 @@
+ extern FILE *popen();
+ #endif
+ 
+-#if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(WIN32) || defined (_SVID_SOURCE)
++#if defined(HAVE_STRING_H)
+ #include <string.h>
+ 
+ #ifndef index
+@@ -140,7 +140,7 @@
+ #define rindex strrchr
+ #endif
+ 
+-#else  /* defined(SYSV) || defined(SVR4) || defined(VMS) */
++#else
+ #include <strings.h>
+ #endif
+ 
diff '--color=auto' -Naur motif-2.3.8.orig/patch/11_all_acinclude.patch motif-2.3.8/patch/11_all_acinclude.patch
--- motif-2.3.8.orig/patch/11_all_acinclude.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/11_all_acinclude.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,22 @@
+https://bugs.gentoo.org/870799
+
+--- motif-2.3.8/acinclude.m4
++++ motif-2.3.8/acinclude.m4
+@@ -18,6 +18,7 @@
+ CFLAGS="$X_CFLAGS $CFLAGS"
+ CPPFLAGS="$X_CFLAGS $CPPFLAGS"
+ AC_TRY_RUN([
++#include <stdlib.h>
+ #include <X11/Intrinsic.h>
+ int main() {
+ Boolean brc;
+@@ -50,7 +51,8 @@
+ AC_DEFUN([AM_FUNC_VOID_SPRINTF],
+ [AC_CACHE_CHECK(whether sprintf returns void, ac_cv_func_void_sprintf,
+ [AC_TRY_RUN([#include <stdio.h>
+-int sprintf(); main() { exit(sprintf(".")); }],
++#include <stdlib.h>
++int main() { exit(sprintf(".")); }],
+   ac_cv_func_void_sprintf=no, ac_cv_func_void_sprintf=yes, ac_cv_func_void_sprintf=yes)])
+ if test $ac_cv_func_void_sprintf = no; then
+   AC_DEFINE(VOID_SPRINTF,1,
diff '--color=auto' -Naur motif-2.3.8.orig/patch/12_all_noreturn.patch motif-2.3.8/patch/12_all_noreturn.patch
--- motif-2.3.8.orig/patch/12_all_noreturn.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/12_all_noreturn.patch	2023-03-11 01:02:30.000000000 -0700
@@ -0,0 +1,13 @@
+https://bugs.gentoo.org/883075
+
+--- motif-2.3.8/clients/mwm/WmError.c
++++ motif-2.3.8/clients/mwm/WmError.c
+@@ -131,7 +131,7 @@
+     XSetIOErrorHandler (WmXIOErrorHandler);
+ 
+     XtSetWarningHandler (WmXtWarningHandler);
+-    XtSetErrorHandler (WmXtErrorHandler);
++    XtSetErrorHandler ((XtErrorHandler _X_NORETURN)WmXtErrorHandler);
+ 
+ } /* END OF FUNCTION WmInitErrorHandler */
+ 
diff '--color=auto' -Naur motif-2.3.8.orig/patch/13_all_xpm-comments.patch motif-2.3.8/patch/13_all_xpm-comments.patch
--- motif-2.3.8.orig/patch/13_all_xpm-comments.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/13_all_xpm-comments.patch	2023-03-11 01:54:55.000000000 -0700
@@ -0,0 +1,22 @@
+https://bugs.gentoo.org/900763
+CVE-2022-46285
+Patch ported from the following commit for libXpm:
+
+From a3a7c6dcc3b629d765014816c566c63165c63ca8 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sat, 17 Dec 2022 12:23:45 -0800
+Subject: [PATCH] Fix CVE-2022-46285: Infinite loop on unclosed comments
+
+--- motif-2.3.8/lib/Xm/Xpmdata.c
++++ motif-2.3.8/lib/Xm/Xpmdata.c
+@@ -171,6 +171,10 @@
+ 		notend = 0;
+ 		ungetc(*s, file);
+ 	    }
++	    else if (c == EOF) {
++		/* hit end of file before the end of the comment */
++		return XpmFileInvalid;
++	    }
+ 	}
+ 	return 0;
+     }
diff '--color=auto' -Naur motif-2.3.8.orig/patch/14_all_xpm-width-0.patch motif-2.3.8/patch/14_all_xpm-width-0.patch
--- motif-2.3.8.orig/patch/14_all_xpm-width-0.patch	1969-12-31 17:00:00.000000000 -0700
+++ motif-2.3.8/patch/14_all_xpm-width-0.patch	2023-03-11 01:54:50.000000000 -0700
@@ -0,0 +1,155 @@
+https://bugs.gentoo.org/900763
+CVE-2022-44617
+Patch ported from the following commits for libXpm:
+
+From f80fa6ae47ad4a5beacb287c0030c9913b046643 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sat, 7 Jan 2023 12:44:28 -0800
+Subject: [PATCH] Fix CVE-2022-44617: Runaway loop with width of 0 and enormous
+ height
+
+From c5ab17bcc34914c0b0707d2135dbebe9a367c5f0 Mon Sep 17 00:00:00 2001
+From: Matthieu Herrb <matthieu@herrb.eu>
+Date: Thu, 12 Jan 2023 15:05:39 +1000
+Subject: [PATCH] Prevent a double free in the error code path
+
+--- motif-2.3.8/lib/Xm/Xpmcreate.c
++++ motif-2.3.8/lib/Xm/Xpmcreate.c
+@@ -954,10 +954,14 @@
+ #ifndef FOR_MSW
+     if (height != 0 && (*image_return)->bytes_per_line >= INT_MAX / height) {
+   	XDestroyImage(*image_return);
++	*image_return = NULL;
+         return (XpmNoMemory);
+     }
+-    if((*image_return)->bytes_per_line == 0 ||  height == 0)
++    if((*image_return)->bytes_per_line == 0 ||  height == 0) {
++	XDestroyImage(*image_return);
++	*image_return = NULL;
+         return XpmNoMemory;
++    }
+     /* now that bytes_per_line must have been set properly alloc data */
+     (*image_return)->data =
+ 	(char *) XpmMalloc((*image_return)->bytes_per_line * height);
+--- motif-2.3.8/lib/Xm/Xpmdata.c
++++ motif-2.3.8/lib/Xm/Xpmdata.c
+@@ -193,19 +193,23 @@
+ 	register char c;
+ 
+ 	/* get to the end of the current string */
+-	if (mdata->Eos)
+-	    while ((c = *mdata->cptr++) && c != mdata->Eos);
++	if (mdata->Eos) {
++	    while ((c = *mdata->cptr++) && c != mdata->Eos && c != '\0');
++
++	    if (c == '\0')
++		return XpmFileInvalid;
++	}
+ 
+ 	/*
+ 	 * then get to the beginning of the next string looking for possible
+ 	 * comment
+ 	 */
+ 	if (mdata->Bos) {
+-	    while ((c = *mdata->cptr++) && c != mdata->Bos)
++	    while ((c = *mdata->cptr++) && c != mdata->Bos && c != '\0')
+ 		if (mdata->Bcmt && c == mdata->Bcmt[0])
+ 		    ParseComment(mdata);
+ 	} else if (mdata->Bcmt) {	/* XPM2 natural */
+-	    while ((c = *mdata->cptr++) == mdata->Bcmt[0])
++	    while (((c = *mdata->cptr++) == mdata->Bcmt[0]) && c != '\0')
+ 		ParseComment(mdata);
+ 	    mdata->cptr--;
+ 	}
+@@ -214,9 +218,13 @@
+ 	FILE *file = mdata->stream.file;
+ 
+ 	/* get to the end of the current string */
+-	if (mdata->Eos)
++	if (mdata->Eos) {
+ 	    while ((c = getc(file)) != mdata->Eos && c != EOF);
+ 
++	    if (c == EOF)
++		return XpmFileInvalid;
++	}
++
+ 	/*
+ 	 * then get to the beginning of the next string looking for possible
+ 	 * comment
+@@ -232,7 +240,7 @@
+ 	    ungetc(c, file);
+ 	}
+     }
+-    return 0;
++    return XpmSuccess;
+ }
+ 
+ 
+--- motif-2.3.8/lib/Xm/Xpmparse.c
++++ motif-2.3.8/lib/Xm/Xpmparse.c
+@@ -523,6 +523,13 @@
+ {
+     unsigned int *iptr, *iptr2 = NULL; /* found by Egbert Eich */
+     unsigned int a, x, y;
++    int ErrorStatus;
++
++    if ((width == 0) && (height != 0))
++	return (XpmFileInvalid);
++
++    if ((height == 0) && (width != 0))
++	return (XpmFileInvalid);
+ 
+     if ((height > 0 && width >= UINT_MAX / height) ||
+ 	width * height >= UINT_MAX / sizeof(unsigned int)) 
+@@ -560,7 +567,11 @@
+ 		colidx[(unsigned char)colorTable[a].string[0]] = a + 1;
+ 
+ 	    for (y = 0; y < height; y++) {
+-		xpmNextString(data);
++		ErrorStatus = xpmNextString(data);
++		if (ErrorStatus != XpmSuccess) {
++		    XpmFree(iptr2);
++		    return (ErrorStatus);
++		}
+ 		for (x = 0; x < width; x++, iptr++) {
+ 		    int c = xpmGetC(data);
+ 
+@@ -607,7 +618,11 @@
+ 	    }
+ 
+ 	    for (y = 0; y < height; y++) {
+-		xpmNextString(data);
++		ErrorStatus = xpmNextString(data);
++		if (ErrorStatus != XpmSuccess) {
++		    XpmFree(iptr2);
++		    return (ErrorStatus);
++		}
+ 		for (x = 0; x < width; x++, iptr++) {
+ 		    int cc1 = xpmGetC(data);
+ 		    if (cc1 > 0 && cc1 < 256) {
+@@ -646,7 +661,11 @@
+ 		xpmHashAtom *slot;
+ 
+ 		for (y = 0; y < height; y++) {
+-		    xpmNextString(data);
++		    ErrorStatus = xpmNextString(data);
++		    if (ErrorStatus != XpmSuccess) {
++			XpmFree(iptr2);
++			return (ErrorStatus);
++		    }
+ 		    for (x = 0; x < width; x++, iptr++) {
+ 			for (a = 0, s = buf; a < cpp; a++, s++)
+ 			    *s = xpmGetC(data); /* int assigned to char, not a problem here */
+@@ -660,7 +679,11 @@
+ 		}
+ 	    } else {
+ 		for (y = 0; y < height; y++) {
+-		    xpmNextString(data);
++		    ErrorStatus = xpmNextString(data);
++		    if (ErrorStatus != XpmSuccess) {
++			XpmFree(iptr2);
++			return (ErrorStatus);
++		    }
+ 		    for (x = 0; x < width; x++, iptr++) {
+ 			for (a = 0, s = buf; a < cpp; a++, s++)
+ 			    *s = xpmGetC(data); /* int assigned to char, not a problem here */
diff '--color=auto' -Naur motif-2.3.8.orig/tools/wml/Makefile.am motif-2.3.8/tools/wml/Makefile.am
--- motif-2.3.8.orig/tools/wml/Makefile.am	2017-08-16 18:38:43.000000000 -0600
+++ motif-2.3.8/tools/wml/Makefile.am	2026-03-06 18:54:16.115759993 -0700
@@ -27,15 +27,14 @@
 wmluiltok_LDADD = @LEXLIB@
 
 wml_SOURCES = wml.c
-wml_LDADD = -L. -lwml
-wml_DEPENDENCIES = libwml.a
+wml_LDADD = libwml.la
 
 wmldbcreate_LDADD = ../../lib/Xm/libXm.la
 
 INCLUDES = -I../../lib -I$(srcdir)/../../lib -I$(srcdir)/../../include ${X_CFLAGS} 
 
-noinst_LIBRARIES = libwml.a
-libwml_a_SOURCES = wmlparse.y wml.c wmloutkey.c wmlouth.c wmloutmm.c wmloutp1.c wmlresolve.c wmlsynbld.c wmlutils.c
+noinst_LTLIBRARIES = libwml.la
+libwml_la_SOURCES = wmlparse.y wmloutkey.c wmlouth.c wmloutmm.c wmloutp1.c wmlresolve.c wmlsynbld.c wmlutils.c
 
 wmlparse.c: wmllex.c
 
@@ -66,7 +65,7 @@
 	./wmldbcreate -o motif.wmd
 
 clean-local:
-	$(RM) $(WMLTARGETS) $(WMDTABLE) $(REPORT) lex.yy.c libwml.a wml \
+	$(RM) $(WMLTARGETS) $(WMDTABLE) $(REPORT) lex.yy.c libwml.la wml \
 	*.mm *.sdml *.txt wmlparse.c wmlparse.h wmluiltok wmllex.c \
 	tokens.dat DONE wmluiltok.c Uil.c Uil.h wml.report UilLexPars.[ch] ylwrap
  
