summaryrefslogtreecommitdiff
path: root/extra/motif
diff options
context:
space:
mode:
Diffstat (limited to 'extra/motif')
-rw-r--r--extra/motif/02-fix-format-security.patch607
-rw-r--r--extra/motif/03-no-demos.patch53
-rw-r--r--extra/motif/06-cast-size_t-to-int.patch17
-rw-r--r--extra/motif/07-fix_lintian_reported_manpage_typos.patch118
-rw-r--r--extra/motif/08-fix_hyphen_in_man_pages.patch156
-rw-r--r--extra/motif/09-fix_typo_in_libxm.patch25
-rw-r--r--extra/motif/10-fix_manpage-has-bad-whatis-entry.patch49
-rw-r--r--extra/motif/11-fix_underlinking.patch564
-rw-r--r--extra/motif/13-fix_hardcoded_x11rgb_path.patch54
-rw-r--r--extra/motif/15-link_uil_against_libuil.patch29
-rw-r--r--extra/motif/16-fix-undefined-use-of-sprintf.patch17
-rw-r--r--extra/motif/17-switch-to-system-iswspace.patch384
-rw-r--r--extra/motif/18-option-main.patch9
13 files changed, 2082 insertions, 0 deletions
diff --git a/extra/motif/02-fix-format-security.patch b/extra/motif/02-fix-format-security.patch
new file mode 100644
index 0000000..18c4abd
--- /dev/null
+++ b/extra/motif/02-fix-format-security.patch
@@ -0,0 +1,607 @@
+Description: Fix unsafe uses of fprintf and sprintf
+ prevent 'format not a string literal and no format arguments' errors
+Forwarded: http://bugs.motifzone.net/show_bug.cgi?id=1574
+Author: Graham Inggs <graham@nerve.org.za>
+Last-Update: 2012-12-25
+--- a/lib/Mrm/Mrmhier.c
++++ b/lib/Mrm/Mrmhier.c
+@@ -264,10 +264,10 @@
+ case MrmSUCCESS:
+ break;
+ case MrmNOT_VALID:
+- sprintf (err_stg, _MrmMMsg_0113);
++ sprintf (err_stg, "%s", _MrmMMsg_0113);
+ break;
+ default:
+- sprintf (err_stg, _MrmMMsg_0114);
++ sprintf (err_stg, "%s", _MrmMMsg_0114);
+ break;
+ }
+ }
+--- a/lib/Mrm/Mrmicon.c
++++ b/lib/Mrm/Mrmicon.c
+@@ -1176,7 +1176,7 @@
+ }
+ break;
+ default:
+- sprintf(err_msg, _MrmMMsg_0040);
++ sprintf(err_msg, "%s", _MrmMMsg_0040);
+ return Urm__UT_Error ("Urm__RelizeColorTable",
+ err_msg, NULL, NULL, MrmFAILURE) ;
+ }
+@@ -1252,7 +1252,7 @@
+ break;
+ default:
+ result = MrmFAILURE;
+- sprintf (err_msg, _MrmMMsg_0040);
++ sprintf (err_msg, "%s", _MrmMMsg_0040);
+ Urm__UT_Error ("Urm__RelizeColorTable",
+ err_msg, NULL, NULL, MrmFAILURE) ;
+ }
+--- a/lib/Mrm/Mrmlread.c
++++ b/lib/Mrm/Mrmlread.c
+@@ -698,7 +698,7 @@
+ XBlackPixelOfScreen(XDefaultScreenOfDisplay(display)));
+ break;
+ default:
+- sprintf(err_msg, _MrmMMsg_0040);
++ sprintf(err_msg, "%s", _MrmMMsg_0040);
+ result = Urm__UT_Error ("MrmFetchColorLiteral",
+ err_msg, NULL, NULL, MrmFAILURE) ;
+ _MrmAppUnlock(app);
+--- a/lib/Mrm/Mrmwcrw.c
++++ b/lib/Mrm/Mrmwcrw.c
+@@ -1390,7 +1390,7 @@
+ }
+ break;
+ default:
+- sprintf (err_msg, _MrmMMsg_0040);
++ sprintf (err_msg, "%s", _MrmMMsg_0040);
+ result = Urm__UT_Error ("Urm__CW_ConvertValue",
+ err_msg, NULL, NULL, MrmFAILURE) ;
+ };
+@@ -2426,7 +2426,7 @@
+ }
+ break;
+ default:
+- sprintf(err_msg, _MrmMMsg_0040);
++ sprintf(err_msg, "%s", _MrmMMsg_0040);
+ return Urm__UT_Error ("Urm__CW_ConvertValue",
+ err_msg, NULL, NULL, MrmFAILURE) ;
+ };
+--- a/tools/wml/wmlouth.c
++++ b/tools/wml/wmlouth.c
+@@ -225,12 +225,12 @@
+ printf ("\nCouldn't open UilSymGen.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
++fprintf (outfil, "%s", canned_warn);
+
+ /*
+ * Write the sym_k..._object literals
+ */
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned1);
+ for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
+ {
+ clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
+@@ -244,7 +244,7 @@
+ /*
+ * Define the sym_k_..._reason literals
+ */
+-fprintf (outfil, canned3);
++fprintf (outfil, "%s", canned3);
+ for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
+ {
+ resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
+@@ -258,7 +258,7 @@
+ /*
+ * Define the sym_k_..._arg literals
+ */
+-fprintf (outfil, canned4);
++fprintf (outfil, "%s", canned4);
+ for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
+ {
+ resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
+@@ -272,7 +272,7 @@
+ /*
+ * Define the sym_k_..._enumset structs and literals
+ */
+-fprintf (outfil, canned5);
++fprintf (outfil, "%s", canned5);
+ for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
+ {
+ enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
+@@ -286,7 +286,7 @@
+ /*
+ * Define the sym_k_..._enumval literals
+ */
+-fprintf (outfil, canned6);
++fprintf (outfil, "%s", canned6);
+ for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
+ {
+ enumvalobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
+@@ -301,7 +301,7 @@
+ * Define the sym_k_..._charsize literals
+ * Define the sym_k_..._charset literals
+ */
+-fprintf (outfil, canned7);
++fprintf (outfil, "%s", canned7);
+ for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
+ {
+ charsetobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
+@@ -315,7 +315,7 @@
+ /*
+ * Define the sym_k_..._child literals
+ */
+-fprintf (outfil, canned8);
++fprintf (outfil, "%s", canned8);
+ for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
+ {
+ childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
+@@ -379,12 +379,12 @@
+ printf ("\nCouldn't open UilSymChCL.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
++fprintf (outfil, "%s", canned_warn);
+
+ /*
+ * Create table entries, similar to writing sym_k...
+ */
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned1);
+ for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
+ {
+ childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
+@@ -392,7 +392,7 @@
+ fprintf (outfil, " sym_k_%s_object,\n",
+ classobj->tkname);
+ }
+-fprintf (outfil, canned1a);
++fprintf (outfil, "%s", canned1a);
+
+ /*
+ * close the output file
+@@ -446,12 +446,12 @@
+ printf ("\nCouldn't open UilSymArTy.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
++fprintf (outfil, "%s", canned_warn);
+
+ /*
+ * Create table entries, similar to writing sym_k...
+ */
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned1);
+ for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
+ {
+ resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
+@@ -459,7 +459,7 @@
+ fprintf (outfil, " sym_k_%s_value,\n",
+ datobj->tkname);
+ }
+-fprintf (outfil, canned1a);
++fprintf (outfil, "%s", canned1a);
+
+ /*
+ * close the output file
+@@ -509,19 +509,19 @@
+ printf ("\nCouldn't open UilSymRArg.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
++fprintf (outfil, "%s", canned_warn);
+
+ /*
+ * Create table entries, similar to writing sym_k...
+ */
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned1);
+ for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
+ {
+ resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
+ fprintf (outfil, " %d,\n",
+ resobj->related_code);
+ }
+-fprintf (outfil, canned1a);
++fprintf (outfil, "%s", canned1a);
+
+ /*
+ * close the output file
+@@ -621,12 +621,12 @@
+ printf ("\nCouldn't open UilUrmClas.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
++fprintf (outfil, "%s", canned_warn);
+
+ /*
+ * Write entries for widgets
+ */
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned1);
+ for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
+ {
+ clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
+@@ -637,7 +637,7 @@
+ else
+ fprintf (outfil, " \"%s\",\t\n", synobj->convfunc);
+ }
+-fprintf (outfil, canned2);
++fprintf (outfil, "%s", canned2);
+
+ /*
+ * Write entries for gadget variants of widget classes
+@@ -661,7 +661,7 @@
+ synobj->name);
+ }
+ }
+-fprintf (outfil, canned3);
++fprintf (outfil, "%s", canned3);
+
+ /*
+ * Write entries for non-dialog widgets
+@@ -685,7 +685,7 @@
+ synobj->name);
+ }
+ }
+-fprintf (outfil, canned4);
++fprintf (outfil, "%s", canned4);
+
+ /*
+ * Write entries for the resource a widget's controls map to
+@@ -701,7 +701,7 @@
+ else
+ fprintf (outfil, " sym_k_%s_arg,\n", mapresobj->tkname);
+ }
+-fprintf (outfil, canned5);
++fprintf (outfil, "%s", canned5);
+
+ /*
+ * Write entries for arguments
+@@ -714,7 +714,7 @@
+ fprintf (outfil, " %s,\n",
+ synres->resliteral);
+ }
+-fprintf (outfil, canned6);
++fprintf (outfil, "%s", canned6);
+
+ /*
+ * Write entries for reasons
+@@ -727,7 +727,7 @@
+ fprintf (outfil, " %s,\n",
+ synres->resliteral);
+ }
+-fprintf (outfil, canned7);
++fprintf (outfil, "%s", canned7);
+
+ /*
+ * close the output file
+@@ -781,13 +781,13 @@
+ printf ("\nCouldn't open UilConst.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
++fprintf (outfil, "%s", canned_warn);
+
+ /*
+ * Process the arguments in code order. We start with 1, and write out
+ * the mask after processing 8 codes.
+ */
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned1);
+ strcpy (maskbuf, "0");
+ for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
+ {
+@@ -805,7 +805,7 @@
+ }
+ if ( bitno != 8 )
+ fprintf (outfil, "%s", maskbuf);
+-fprintf (outfil, canned1a);
++fprintf (outfil, "%s", canned1a);
+
+ /*
+ * close the output file
+@@ -878,8 +878,8 @@
+ printf ("\nCouldn't open UilSymReas.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned_warn);
++fprintf (outfil, "%s", canned1);
+
+ /*
+ * Generate the bit vectors for each class. Outer loop on the reason code,
+@@ -925,13 +925,13 @@
+ /*
+ * Write the vector of vectors.
+ */
+-fprintf (outfil, canned2);
++fprintf (outfil, "%s", canned2);
+ for ( resndx=0 ; resndx<wml_obj_reason_ptr->cnt ; resndx++ )
+ {
+ resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr;
+ fprintf (outfil, " reason_class_vec%d,\n", resobj->sym_code);
+ }
+-fprintf (outfil, canned3);
++fprintf (outfil, "%s", canned3);
+
+ /*
+ * close the output file
+@@ -1004,8 +1004,8 @@
+ printf ("\nCouldn't open UilSymArTa.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned_warn);
++fprintf (outfil, "%s", canned1);
+
+ /*
+ * Generate the bit vectors for each class. Outer loop on the argument code,
+@@ -1051,13 +1051,13 @@
+ /*
+ * Write the vector of vectors.
+ */
+-fprintf (outfil, canned2);
++fprintf (outfil, "%s", canned2);
+ for ( resndx=0 ; resndx<wml_obj_arg_ptr->cnt ; resndx++ )
+ {
+ resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr;
+ fprintf (outfil, " arg_class_vec%d,\n", resobj->sym_code);
+ }
+-fprintf (outfil, canned3);
++fprintf (outfil, "%s", canned3);
+
+ /*
+ * close the output file
+@@ -1129,8 +1129,8 @@
+ printf ("\nCouldn't open UilSymChTa.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned_warn);
++fprintf (outfil, "%s", canned1);
+
+ /*
+ * Generate the bit vectors for each class. Outer loop on the child code,
+@@ -1174,13 +1174,13 @@
+ /*
+ * Write the vector of vectors.
+ */
+-fprintf (outfil, canned2);
++fprintf (outfil, "%s", canned2);
+ for ( childndx=0 ; childndx<wml_obj_child_ptr->cnt ; childndx++ )
+ {
+ childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr;
+ fprintf (outfil, " child_class_vec%d,\n", childobj->sym_code);
+ }
+-fprintf (outfil, canned3);
++fprintf (outfil, "%s", canned3);
+
+ /*
+ * close the output file
+@@ -1251,8 +1251,8 @@
+ printf ("\nCouldn't open UilSymCtl.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned_warn);
++fprintf (outfil, "%s", canned1);
+
+ /*
+ * Generate the bit vectors for each class. Outer loop on the class code,
+@@ -1296,13 +1296,13 @@
+ /*
+ * Write the vector of vectors.
+ */
+-fprintf (outfil, canned2);
++fprintf (outfil, "%s", canned2);
+ for ( ctlndx=0 ; ctlndx<wml_obj_class_ptr->cnt ; ctlndx++ )
+ {
+ clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr;
+ fprintf (outfil, " object_class_vec%d,\n", clsobj->sym_code);
+ }
+-fprintf (outfil, canned3);
++fprintf (outfil, "%s", canned3);
+
+ /*
+ * close the output file
+@@ -1438,7 +1438,7 @@
+ printf ("\nCouldn't open UilSymNam.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
++fprintf (outfil, "%s", canned_warn);
+
+ /*
+ * Write entries for widgets
+@@ -1517,7 +1517,7 @@
+ fprintf (outfil, " \"%s\",\n",
+ synch->name);
+ }
+-fprintf (outfil, canned7);
++fprintf (outfil, "%s", canned7);
+
+ /*
+ * close the output file
+@@ -1621,12 +1621,12 @@
+ printf ("\nCouldn't open UilSymEnum.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
++fprintf (outfil, "%s", canned_warn);
+
+ /*
+ * Generate the enumeration value vectors for each enumeration set.
+ */
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned1);
+ for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
+ {
+ enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
+@@ -1643,7 +1643,7 @@
+ /*
+ * Generate the enumeration set tables
+ */
+-fprintf (outfil, canned3);
++fprintf (outfil, "%s", canned3);
+ for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
+ {
+ enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
+@@ -1655,7 +1655,7 @@
+ /*
+ * Create enumset table entries for arguments, similar to writing sym_k...
+ */
+-fprintf (outfil, canned4);
++fprintf (outfil, "%s", canned4);
+ for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
+ {
+ resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
+@@ -1669,13 +1669,13 @@
+ /*
+ * Create the enumval values table.
+ */
+-fprintf (outfil, canned5);
++fprintf (outfil, "%s", canned5);
+ for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
+ {
+ evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
+ fprintf (outfil, " %s,\n", evobj->syndef->enumlit);
+ }
+-fprintf (outfil, canned5a);
++fprintf (outfil, "%s", canned5a);
+
+ /*
+ * close the output file
+@@ -1813,12 +1813,12 @@
+ printf ("\nCouldn't open UilSymCSet.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
++fprintf (outfil, "%s", canned_warn);
+
+ /*
+ * Generate the standards name table
+ */
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned1);
+ for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
+ {
+ csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
+@@ -1836,7 +1836,7 @@
+ /*
+ * Generate the writing direction table
+ */
+-fprintf (outfil, canned2);
++fprintf (outfil, "%s", canned2);
+ for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
+ {
+ csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
+@@ -1858,7 +1858,7 @@
+ /*
+ * Generate the parsing direction table
+ */
+-fprintf (outfil, canned3);
++fprintf (outfil, "%s", canned3);
+ for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
+ {
+ csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
+@@ -1880,7 +1880,7 @@
+ /*
+ * Generate the character size table
+ */
+-fprintf (outfil, canned4);
++fprintf (outfil, "%s", canned4);
+ for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
+ {
+ csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
+@@ -1906,7 +1906,7 @@
+ /*
+ * Generate the $LANG name recognition table
+ */
+-fprintf (outfil, canned5);
++fprintf (outfil, "%s", canned5);
+ lang_max = 0;
+ for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
+ {
+@@ -1936,7 +1936,7 @@
+ /*
+ * Generate the $LANG code lookup table, in upper case
+ */
+-fprintf (outfil, canned6);
++fprintf (outfil, "%s", canned6);
+ for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
+ {
+ csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
+--- a/tools/wml/wmloutkey.c
++++ b/tools/wml/wmloutkey.c
+@@ -574,16 +574,16 @@
+ printf ("\nCouldn't open UilKeyTab.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
++fprintf (outfil, "%s", canned_warn);
+
+ /*
+ * Print the case sensitive and insensitive tables
+ */
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned1);
+ wmlOutputUilKeyTabBody (outfil, wml_tok_sens_ptr, &maxlen, &maxkey);
+ fprintf (outfil, canned2, maxlen, maxkey);
+ wmlOutputUilKeyTabBody (outfil, wml_tok_insens_ptr, &maxlen, &maxkey);
+-fprintf (outfil, canned3);
++fprintf (outfil, "%s", canned3);
+
+ /*
+ * close the output file
+@@ -812,8 +812,8 @@
+ printf ("\nCouldn't open UilTokName.h");
+ return;
+ }
+-fprintf (outfil, canned_warn);
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned_warn);
++fprintf (outfil, "%s", canned1);
+
+ /*
+ * Print the token name entries
+--- a/tools/wml/wmloutmm.c
++++ b/tools/wml/wmloutmm.c
+@@ -209,9 +209,9 @@
+ /*
+ * Write out header information
+ */
+-fprintf (outfil, canned1);
++fprintf (outfil, "%s", canned1);
+ fprintf (outfil, "%s\n", name);
+-fprintf (outfil, canned2);
++fprintf (outfil, "%s", canned2);
+
+ /*
+ * Alphabetize the controls, reason, and argument lists
+@@ -287,7 +287,7 @@
+ else
+ fprintf (outfil, "\n");
+ }
+-fprintf (outfil, canned3);
++fprintf (outfil, "%s", canned3);
+
+ /*
+ * Write out the argument table
+@@ -323,7 +323,7 @@
+ }
+ argndx += 1;
+ }
+-fprintf (outfil, canned4);
++fprintf (outfil, "%s", canned4);
+
+ }
+
diff --git a/extra/motif/03-no-demos.patch b/extra/motif/03-no-demos.patch
new file mode 100644
index 0000000..03953c4
--- /dev/null
+++ b/extra/motif/03-no-demos.patch
@@ -0,0 +1,53 @@
+Description: Add option to disable building of demos
+Forwarded: http://bugs.motifzone.net/show_bug.cgi?id=1575
+Author: Graham Inggs <graham@nerve.org.za>
+Last-Update: 2013-01-09
+--- a/configure.ac
++++ b/configure.ac
+@@ -311,7 +311,20 @@
+ doc/man/man5/Makefile \
+ tools/Makefile \
+ tools/wml/Makefile \
+-demos/Makefile \
++lib/Xm/xmstring.list \
++])
++
++AC_ARG_ENABLE(demos, [ --disable-demos
++ Disable building demos])
++
++if test x$enable_demos = x
++then
++ enable_demos="yes"
++fi
++
++if test "$enable_demos" = "yes"
++then
++ AC_CONFIG_FILES([demos/Makefile
+ demos/lib/Makefile \
+ demos/lib/Xmd/Makefile \
+ demos/lib/Wsm/Makefile \
+@@ -395,6 +408,11 @@
+ demos/doc/programGuide/ch17/Makefile \
+ demos/doc/programGuide/ch17/simple_drop/Makefile \
+ demos/doc/programGuide/ch17/simple_drag/Makefile \
+-lib/Xm/xmstring.list \
+-])
++ ])
++ MAYBE_DEMOS=demos
++else
++ MAYBE_DEMOS=
++fi
++AC_SUBST(MAYBE_DEMOS)
++
+ AC_OUTPUT
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -29,6 +29,7 @@
+ tools \
+ clients \
+ doc \
+- demos
++ $(MAYBE_DEMOS)
++
+ AUTOMAKE_OPTIONS = 1.4
+ ACLOCAL_AMFLAGS = -I .
diff --git a/extra/motif/06-cast-size_t-to-int.patch b/extra/motif/06-cast-size_t-to-int.patch
new file mode 100644
index 0000000..b5ce9c6
--- /dev/null
+++ b/extra/motif/06-cast-size_t-to-int.patch
@@ -0,0 +1,17 @@
+Description: To prevent build failure during building with Hardening options
+ enabled due to "format '%d' expects argument of type 'int', but argument 5 has
+ type 'size_t'", the fifth argument is cast to integer on the input.
+Author: Paul Gevers <elbrus@debian.org>
+Updated: 13-01-2013
+
+--- a/tools/wml/wmloutkey.c
++++ b/tools/wml/wmloutkey.c
+@@ -627,7 +627,7 @@
+ fprintf (outfil, " {%s, %s, %d, %s, \"%s\"},\n",
+ tkclass,
+ tksym,
+- strlen(tokstg),
++ (int)strlen(tokstg),
+ tktoken,
+ tokstg);
+ if ( (int)strlen(tokstg) > *maxlen )
diff --git a/extra/motif/07-fix_lintian_reported_manpage_typos.patch b/extra/motif/07-fix_lintian_reported_manpage_typos.patch
new file mode 100644
index 0000000..5ddfd76
--- /dev/null
+++ b/extra/motif/07-fix_lintian_reported_manpage_typos.patch
@@ -0,0 +1,118 @@
+Description: lintian reports several typos in manpages. This patch fixes those
+ reported
+Author: Paul Gevers <elbrus@debian.org>
+Forwarded: http://bugs.motifzone.net/show_bug.cgi?id=1587
+Last-reviewed: 14 Jan 2013
+
+--- a/doc/man/man1/mwm.1
++++ b/doc/man/man1/mwm.1
+@@ -359,7 +359,7 @@
+ (and other associated messages) by saving the geometries of its clients to a state file\&.
+ \fBmwm\fP can then be restarted by the XSMP session manager\&.
+ The default location for the state file is \fB$HOME/\&.mwmclientdb\fP\&.
+-This location can be overriden with the resource \fBsessionClientDB\fP\&.
++This location can be overridden with the resource \fBsessionClientDB\fP\&.
+ .SS "X Resources"
+ .PP
+ The \fBmwm\fP command is configured from its resource
+--- a/doc/man/man3/VendorShell.3
++++ b/doc/man/man3/VendorShell.3
+@@ -76,7 +76,7 @@
+ to the VendorShell resources for controlling toolTips. VendorShell displays
+ the XmNtooTipString in an XmLabel that is a child of a transientShell. The name
+ of the transientShell is TipShell, and the name of the XmLabel is TipLabel.
+-The appearance of the tip can be controlled by specifing resources on these
++The appearance of the tip can be controlled by specifying resources on these
+ widgets.
+ .PP
+ If an application uses the \fBXmNmwmDecorations\fP,
+--- a/doc/man/man3/XmComboBox.3
++++ b/doc/man/man3/XmComboBox.3
+@@ -581,7 +581,7 @@
+ ComboBox \fBXmNcomboBoxType\fP is
+ \fBXmDROP_DOWN_LIST\fP,
+ \fB<osfActivate>\fP, \fB<osfCancel>\fP, and
+-\fBReturn\fP are overriden by ComboBox actions\&.
++\fBReturn\fP are overridden by ComboBox actions\&.
+ .IP "\fB:c\fP <Key>\fB<osfDown>\fP:" 10
+ CBDropDownList()
+ .IP "\fB:c\fP <Key>\fB<osfUp>\fP:" 10
+--- a/doc/man/man3/XmGetPixmap.3
++++ b/doc/man/man3/XmGetPixmap.3
+@@ -109,7 +109,7 @@
+ In addition to X bitmap files (XBM), Motif also supports XPM (X
+ Pixmap) file formats and, from version 2.3, JPEG and PNG image formats\&.
+ (Note that support of JPEG and PNG image format is an optional feature
+-of Motif, in order to check if current version supports PNG ang JPEG
++of Motif, in order to check if current version supports PNG and JPEG
+ image formats the PNG_SUPPORT and JPEG_SUPPORT macros should be checked
+ correspondingly.)
+ The \fBXBMLANGPATH\fP specifies the path for
+--- a/doc/man/man3/XmGetPixmapByDepth.3
++++ b/doc/man/man3/XmGetPixmapByDepth.3
+@@ -111,7 +111,7 @@
+ In addition to X bitmap files (XBM), Motif also supports XPM (X
+ Pixmap) file formats, and, from version 2.3, JPEG and PNG image formats\&.
+ (Note that support of JPEG and PNG image format is an optional feature
+-of Motif, in order to check if current version supports PNG ang JPEG
++of Motif, in order to check if current version supports PNG and JPEG
+ image formats the PNG_SUPPORT and JPEG_SUPPORT macros should be checked
+ correspondingly.)
+ The \fBXBMLANGPATH\fP specifies the path for
+--- a/doc/man/man3/XmHierarchyGetChildNodes.3
++++ b/doc/man/man3/XmHierarchyGetChildNodes.3
+@@ -69,8 +69,8 @@
+ \fBXmHierarchy\fP(3)\&.
+ .SH "RETURN"
+ .PP
+-Returns WidgetList with child nodes of the hierachy, or NULL
+-if the hierachy contains no children\&.
++Returns WidgetList with child nodes of the hierarchy, or NULL
++if the hierarchy contains no children\&.
+ .SH "RELATED"
+ .PP
+ \fBXmHierarchy\fP(3)\&.
+--- a/doc/man/man3/XmManager.3
++++ b/doc/man/man3/XmManager.3
+@@ -502,7 +502,7 @@
+ Indicates whether the posting process should continue\&. The
+ application may modify this field\&.
+ .IP "\fItarget\fP" 10
+-Specifies the most specific widget or gadget that the menu sytem found
++Specifies the most specific widget or gadget that the menu system found
+ from the event that matches the event\&.
+ .SS "Translations"
+ .PP
+--- a/doc/man/man3/XmPrimitive.3
++++ b/doc/man/man3/XmPrimitive.3
+@@ -609,7 +609,7 @@
+ Indicates whether the posting process should continue\&. The
+ application may modify this field\&.
+ .IP "\fItarget\fP" 10
+-Specifies the most specific widget or gadget that the menu sytem found
++Specifies the most specific widget or gadget that the menu system found
+ from the event that matches the event\&.
+ .SS "Translations"
+ .PP
+--- a/doc/man/man3/XmRendition.3
++++ b/doc/man/man3/XmRendition.3
+@@ -71,7 +71,7 @@
+ If a resource in a rendition is unspecified, usually by setting it to
+ \fBXmAS_IS\fP or \fBXmUNSPECIFIED_PIXEL\fP,
+ then the value to be used for that resource is the value of the
+-immediately preceeding rendition in \fBXmString\fR\&. If that value
++immediately preceding rendition in \fBXmString\fR\&. If that value
+ is unspecified, then the preceding value is used, and so on\&. If
+ no renditions specify a value for a resource, then a default value
+ will be used\&.
+--- a/doc/man/man3/XmStringGetNextComponent.3
++++ b/doc/man/man3/XmStringGetNextComponent.3
+@@ -111,7 +111,7 @@
+ \fBXmSTRING_COMPONENT_UNKNOWN\fP\&. The data returned by these
+ components is returned in the \fIunknown_tag\fP, \fIunknown_length\fP,
+ and \fIunknown_value\fP fields\&. This apparent inconsistency is
+-designed to accomodate older applications that may not be equipped to
++designed to accommodate older applications that may not be equipped to
+ handle the newer component types of Motif version 2\&.0 and beyond\&.
+ Consequently, the use of this procedure is not recommended\&. Instead,
+ use the \fBXmStringGetNextTriple\fP procedure, which provides all the
diff --git a/extra/motif/08-fix_hyphen_in_man_pages.patch b/extra/motif/08-fix_hyphen_in_man_pages.patch
new file mode 100644
index 0000000..bc1beb0
--- /dev/null
+++ b/extra/motif/08-fix_hyphen_in_man_pages.patch
@@ -0,0 +1,156 @@
+Description: lintian reports hyphen misuse in manpages. This patch fixes those
+ reported.
+Author: Paul Gevers <elbrus@debian.org>
+Forwarded: http://bugs.motifzone.net/show_bug.cgi?id=1588
+Last-reviewed: 06 Feb 2013
+
+--- a/doc/man/man1/mwm.1
++++ b/doc/man/man1/mwm.1
+@@ -904,7 +904,7 @@
+ resizeCursorsResizeCursorsT/FT
+ transientDecorationTransientDecorationstringmenu title
+ transientFunctionsTransientFunctionsstringT{
+--minimize-maximize
++\-minimize-maximize
+ T}
+ useIconBoxUseIconBoxT/FF
+ .TE
+@@ -941,7 +941,7 @@
+ screen size of the icon box window depends on the iconImageMaximum (size)
+ and \fIiconDecoration\fP resources\&. The default value for size
+ is (6 * iconWidth + padding) wide by (1 * iconHeight + padding) high\&. The
+-default value of the location is +0 -0\&.
++default value of the location is +0 \-0\&.
+ .IP "\fIiconBoxName\fP\ (class\ \fIIconBoxName\fP)" 10
+ This resource specifies the name that is used to look up icon box resources\&.
+ The default name is iconbox\&.
+@@ -1059,7 +1059,7 @@
+ This resource is used to indicate which window management functions
+ are applicable (or not applicable) to transient windows\&. The function specification
+ is exactly the same as for the \fIclientFunctions\fP (client
+-specific) resource\&. The default value for this resource is -minimize -maximize\&.
++specific) resource\&. The default value for this resource is \-minimize \-maximize\&.
+ .IP "" 10
+ An application can also specify which functions \fBmwm\fP
+ should apply to its windows\&. If it does so, \fBmwm\fP applies
+@@ -1176,7 +1176,7 @@
+ titleTitle bar (includes border)\&.
+ .TE
+ .PP
+-Examples: \fIMwm*XClock\&.clientDecoration: -resizeh -maximize\fP This removes the resize handles and maximize button from XClock
++Examples: \fIMwm*XClock\&.clientDecoration: \-resizeh \-maximize\fP This removes the resize handles and maximize button from XClock
+ windows\&. \fIMwm*XClock\&.clientDecoration: menu minimize border\fP This does the same thing as above\&. Note that either \fImenu\fP or \fIminimize\fP implies
+ \fItitle\fP\&.
+ .IP "\fIclientFunctions\fP\ (class\ \fIClientFunctions\fP)" 10
+--- a/doc/man/man4/mwmrc.4
++++ b/doc/man/man4/mwmrc.4
+@@ -84,7 +84,7 @@
+ be specified from the command line:
+ .PP
+ .nf
+-\f(CW/usr/X11R6/bin/X11/mwm -xrm "mwm*configFile: mymwmrc"\fR
++\f(CW/usr/X11R6/bin/X11/mwm \-xrm "mwm*configFile: mymwmrc"\fR
+ .fi
+ .PP
+ .SS "Resource Types"
+--- a/doc/man/man3/XmFontList.3
++++ b/doc/man/man3/XmFontList.3
+@@ -119,7 +119,7 @@
+ without a font list entry tag;
+ .PP
+ .nf
+-\f(CW*fontList: -Adobe-Times-Medium-I-Normal--10*\fR
++\f(CW*fontList: \-Adobe\-Times\-Medium\-I\-Normal\-\-10*\fR
+ .fi
+ .PP
+ .PP
+@@ -138,9 +138,9 @@
+ and an explicit font list entry tag\&.
+ .PP
+ .nf
+-\f(CW*fontList: -Adobe-Courier-Bold-R-Normal--25-180-100-100-M-150;\
+--JIS-Fixed-Medium-R-Normal--26-180-100-100-C-240;\
+--JIS-Fixed-Medium-R-Normal--26-180-100-100-C-120:MY_TAG\fR
++\f(CW*fontList: \-Adobe\-Courier\-Bold\-R\-Normal\-\-25\-180\-100\-100\-M\-150;\
++\-JIS\-Fixed\-Medium\-R\-Normal\-\-26\-180\-100\-100\-C\-240;\
++\-JIS\-Fixed\-Medium\-R\-Normal\-\-26\-180\-100\-100\-C\-120:MY_TAG\fR
+ .fi
+ .PP
+ .PP
+--- a/doc/man/man3/XmGetPixmapByDepth.3
++++ b/doc/man/man3/XmGetPixmapByDepth.3
+@@ -245,8 +245,8 @@
+ \f(CW/* XBM file */
+ #define plaid_width 22
+ #define plaid_height 22
+-#define plaid_x_hot -1
+-#define plaid_y_hot -1
++#define plaid_x_hot \-1
++#define plaid_y_hot \-1
+ static char plaid_bits[] = {
+ 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e,
+ 0x75, 0xfd, 0x3f, 0xff, 0x57, 0x15, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e,
+--- a/doc/man/man3/XmList.3
++++ b/doc/man/man3/XmList.3
+@@ -182,7 +182,7 @@
+ A value of 1 transfers the first item in the List; a value of 2
+ transfers the second item; and so on\&.
+ If the entire contents of the List are being transferred, the value is
+--1\&.
++\-1\&.
+ .PP
+ As a source of data, List supports the following targets and associated
+ conversions of data to these targets:
+--- a/doc/man/man3/XmScreen.3
++++ b/doc/man/man3/XmScreen.3
+@@ -300,7 +300,7 @@
+ startup time, either by placing it within a defaults file or by using the
+ \fB-xrm\fP command line argument\&. For example:
+ .IP "" 10
+-\fBmyProg -xrm "*menuCursor: arrow"\fP
++\fBmyProg \-xrm "*menuCursor: arrow"\fP
+ .IP "" 10
+ The menu cursor can also be selected in the program through
+ the function \fBXmSetMenuCursor\fP\&.
+--- a/doc/man/man3/XmTabListCopy.3
++++ b/doc/man/man3/XmTabListCopy.3
+@@ -71,7 +71,7 @@
+ Specifies where to start copying\&. A value of 0 (zero) indicates begin
+ at the beginning, a value of 1 indicates to skip the first tab, and so
+ on\&. A negative indicates to begin counting backwards from the end\&.
+-A value of -1 indicates to start copying from the last tab\&.
++A value of \-1 indicates to start copying from the last tab\&.
+ .IP "\fIcount\fP" 10
+ Specifies the number of tabs to copy\&. A value of 0 (zero) indicates
+ to copy all elements from the starting point to the end (beginning if
+--- a/doc/man/man3/XmTabListInsertTabs.3
++++ b/doc/man/man3/XmTabListInsertTabs.3
+@@ -83,7 +83,7 @@
+ value of 1 makes it the second tab, and so on\&. If \fIposition\fP is
+ greater than the number of tabs in \fIoldlist\fP, then the tabs will
+ be inserted at the end\&. If \fIposition\fP is negative, the count will
+-be backwards from the end\&. A value of -1 makes the first new tab
++be backwards from the end\&. A value of \-1 makes the first new tab
+ the last tab, and so on\&.
+ .SH "RETURN"
+ .PP
+--- a/doc/man/man5/UIL.5
++++ b/doc/man/man5/UIL.5
+@@ -1211,7 +1211,7 @@
+ 3\&.1415E-2 (equals \&.031415)
+ T}2\&.87 e6 (embedded blanks)
+ T{
+--6\&.29e7 (equals -62900000)
++\-6\&.29e7 (equals \-62900000)
+ T}2\&.0e100 (out of range)
+ .TE
+ .PP
+@@ -1322,7 +1322,7 @@
+ You can use parentheses to override the normal precedence of operators\&.
+ In a sequence of unary operators, the operations are performed in
+ right-to-left
+-order\&. For example, \fB- + -A\fP is equivalent to \fB-(+(-A))\fP\&.
++order\&. For example, \fB- + \-A\fP is equivalent to \fB\-(+(\-A))\fP\&.
+ In a sequence of binary operators of the same precedence, the operations
+ are performed in left-to-right order\&. For example, \fBA*B/C*D\fP is
+ equivalent to \fB((A*B)/C)*D\fP\&.
diff --git a/extra/motif/09-fix_typo_in_libxm.patch b/extra/motif/09-fix_typo_in_libxm.patch
new file mode 100644
index 0000000..90d39a3
--- /dev/null
+++ b/extra/motif/09-fix_typo_in_libxm.patch
@@ -0,0 +1,25 @@
+Description: lintian reports a typo in libXm. This patch fixes it.
+Author: Paul Gevers <elbrus@debian.org>
+Forwarded: http://bugs.motifzone.net/show_bug.cgi?id=1589
+Last-reviewed: 06 Feb 2013
+
+--- a/lib/Xm/FontS.c
++++ b/lib/Xm/FontS.c
+@@ -1225,7 +1225,7 @@
+
+ if ((fontdata = XLoadQueryFont(XtDisplay((Widget) fsw), font)) == NULL)
+ {
+- sprintf(buf, "Font '%s'\nis not availiable on this machine", font);
++ sprintf(buf, "Font '%s'\nis not available on this machine", font);
+ DisplayUserError(fsw, buf);
+ err = True;
+ }
+@@ -1275,7 +1275,7 @@
+ fbuf)) == NULL)
+ {
+ sprintf(buf,
+- "Font '%s'\nis not availiable on this machine",
++ "Font '%s'\nis not available on this machine",
+ font);
+ DisplayUserError(fsw, buf);
+ err = True;
diff --git a/extra/motif/10-fix_manpage-has-bad-whatis-entry.patch b/extra/motif/10-fix_manpage-has-bad-whatis-entry.patch
new file mode 100644
index 0000000..cf51d1f
--- /dev/null
+++ b/extra/motif/10-fix_manpage-has-bad-whatis-entry.patch
@@ -0,0 +1,49 @@
+Description: lintian reports bad whatis entries in manpages. Fixing here
+Author: Paul Gevers <elbrus@debian.org>
+Forwarded: http://bugs.motifzone.net/show_bug.cgi?id=1590
+Last-reviewed: 17 Feb 2013
+
+--- a/doc/man/man3/XmColorSelector.3
++++ b/doc/man/man3/XmColorSelector.3
+@@ -1,7 +1,7 @@
+ .DT
+ .TH XmColorSelector 3X ""
+ .SH NAME
+-The Color Selector widget
++XmColorSelector \- The Color Selector widget
+ .SH SYNOPSIS
+ #include <Xm/ColorS.h>
+ .SH DESCRIPTION
+--- a/doc/man/man3/XmExt18List.3
++++ b/doc/man/man3/XmExt18List.3
+@@ -1,7 +1,7 @@
+ .DT
+ .TH XxExt18LIst 3x ""
+ .SH NAME
+-The Internationalized Extended List widget
++XmExt18List \- The Internationalized Extended List widget
+ .SH SYNOPSIS
+ #include <Xm/Ext18List.h>
+ .SH DESCRIPTION
+--- a/doc/man/man3/XmFontSelector.3
++++ b/doc/man/man3/XmFontSelector.3
+@@ -1,7 +1,7 @@
+ .DT
+ .TH XmFontSelector 3X ""
+ .SH NAME
+-The Font Selector widget
++XmFontSelector \- The Font Selector widget
+ .SH SYNOPSIS
+ #include <Xm/FontS.h>
+ .SH DESCRIPTION
+--- a/doc/man/man3/XmIconButton.3
++++ b/doc/man/man3/XmIconButton.3
+@@ -1,7 +1,7 @@
+ .DT
+ .TH XmIconButton 3X "15 July 1992"
+ .SH NAME
+-The Icon Button widget
++XmIconButton \- The Icon Button widget
+ .SH SYNOPSIS
+ Documents the XmIconButton widget
+ .SH DESCRIPTION
diff --git a/extra/motif/11-fix_underlinking.patch b/extra/motif/11-fix_underlinking.patch
new file mode 100644
index 0000000..601b091
--- /dev/null
+++ b/extra/motif/11-fix_underlinking.patch
@@ -0,0 +1,564 @@
+Description: Fix underlinking of libXt, libXext and libX11
+ Recent changes to default linker behaviour prevent shared libraries from being
+ indirectly linked, resulting in FTBFS in Ubuntu Raring.
+ .
+ This patch fixes this by explicitly linking libXt, libXext and libX11 wherever
+ necessary. Demos are patched even though they are not built for distribution.
+Author: Graham Inggs <graham@nerve.org.za>
+Forwarded: http://bugs.motifzone.net/show_bug.cgi?id=1583
+Last-Update: 2013-02-26
+--- a/clients/mwm/Makefile.am
++++ b/clients/mwm/Makefile.am
+@@ -9,7 +9,7 @@
+ rc_DATA = system.mwmrc
+
+ bin_PROGRAMS = mwm
+-mwm_LDADD = ./WmWsmLib/libWsm.a ../../lib/Xm/libXm.la
++mwm_LDADD = ./WmWsmLib/libWsm.a ../../lib/Xm/libXm.la -lXt -lXext -lX11
+
+ INCLUDES = -DLARGECURSORS -DR2_COMPAT -DUNMAP_ON_RESTART \
+ -DCDE_INSTALLATION_TOP=\"@CDE_INSTALLATION_TOP@\" \
+--- a/clients/uil/Makefile.am
++++ b/clients/uil/Makefile.am
+@@ -11,9 +11,9 @@
+ UilParser.lo: UilParser.c
+ $(LTCOMPILE) -DCALLABLE -c UilParser.c
+
+-libUil_la_LIBADD = UilParser.lo ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la
++libUil_la_LIBADD = UilParser.lo ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la -lXt
+
+-uil_LDADD = ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la
++uil_LDADD = ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la -lXt
+
+ INCLUDES = -DINCDIR=\"@INCDIR@\" \
+ -DLIBDIR=\"@LIBDIR@\" \
+--- a/clients/xmbind/Makefile.am
++++ b/clients/xmbind/Makefile.am
+@@ -2,6 +2,6 @@
+
+ bin_PROGRAMS = xmbind
+
+-LDADD = ../../lib/Xm/libXm.la
++LDADD = ../../lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/doc/programGuide/ch05/Scale/Makefile.am
++++ b/demos/doc/programGuide/ch05/Scale/Makefile.am
+@@ -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 = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la -lXt -lX11
+--- a/demos/doc/programGuide/ch06/combo_box/Makefile.am
++++ b/demos/doc/programGuide/ch06/combo_box/Makefile.am
+@@ -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 = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la -lXt -lX11
+--- a/demos/doc/programGuide/ch06/spin_box/Makefile.am
++++ b/demos/doc/programGuide/ch06/spin_box/Makefile.am
+@@ -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 = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la -lXt -lX11
+--- a/demos/doc/programGuide/ch08/Container/Makefile.am
++++ b/demos/doc/programGuide/ch08/Container/Makefile.am
+@@ -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 = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la -lXt -lX11
+--- a/demos/doc/programGuide/ch08/Notebook/Makefile.am
++++ b/demos/doc/programGuide/ch08/Notebook/Makefile.am
+@@ -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 = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la -lXt -lX11
+--- a/demos/doc/programGuide/ch16/Makefile.am
++++ b/demos/doc/programGuide/ch16/Makefile.am
+@@ -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 = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la -lXt -lX11
+--- a/demos/doc/programGuide/ch17/simple_drag/Makefile.am
++++ b/demos/doc/programGuide/ch17/simple_drag/Makefile.am
+@@ -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 = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la -lXt -lX11
+--- a/demos/doc/programGuide/ch17/simple_drop/Makefile.am
++++ b/demos/doc/programGuide/ch17/simple_drop/Makefile.am
+@@ -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 = -L$(top_builddir)/demos/lib/Xmd -lXmd $(top_builddir)/lib/Xm/libXm.la -lXt -lX11
+--- a/demos/lib/Exm/wml/Makefile.am
++++ b/demos/lib/Exm/wml/Makefile.am
+@@ -18,7 +18,7 @@
+ -I$(top_builddir)/clients/uil \
+ ${X_CFLAGS}
+
+-LDADD = $(top_builddir)/lib/Xm/libXm.la
++LDADD = $(top_builddir)/lib/Xm/libXm.la -lXt
+
+ DISTCLEANFILES = motif.wmd
+
+--- a/demos/lib/Xmd/Makefile.am
++++ b/demos/lib/Xmd/Makefile.am
+@@ -12,7 +12,7 @@
+ Print.h PrintP.h \
+ RegEdit.h RegEditI.h
+
+-LDADD = libXmd.a ../../../lib/Xm/libXm.la
++LDADD = libXmd.a ../../../lib/Xm/libXm.la -lXt
+
+ INCLUDES = -I$(top_builddir)/lib -I$(srcdir)/../../../lib ${X_CFLAGS}
+
+--- a/demos/programs/ButtonBox/Makefile.am
++++ b/demos/programs/ButtonBox/Makefile.am
+@@ -8,6 +8,6 @@
+ bboxdemo_SOURCES = bboxdemo.c
+ data_DATA = $(EXTRA_DIST) $(bboxdemo_SOURCES)
+ TOPDIR = ../../..
+-LDADD = $(TOPDIR)/lib/Xm/libXm.la
++LDADD = $(TOPDIR)/lib/Xm/libXm.la -lXt
+
+ INCLUDES = -I$(TOPDIR)/lib -I$(srcdir)/$(TOPDIR)/lib ${X_CFLAGS}
+--- a/demos/programs/ColorSel/Makefile.am
++++ b/demos/programs/ColorSel/Makefile.am
+@@ -7,6 +7,6 @@
+ colordemo_SOURCES = util-c.c colordemo.c
+ EXTRA_DIST = Imakefile
+ data_DATA = $(colordemo_SOURCES) $(EXTRA_DIST)
+-LDADD = $(TOPDIR)/lib/Xm/libXm.la
++LDADD = $(TOPDIR)/lib/Xm/libXm.la -lXt -lX11
+ TOPDIR = ../../..
+ INCLUDES = -I$(TOPDIR)/lib -I$(srcdir)/$(TOPDIR)/lib ${X_CFLAGS}
+--- a/demos/programs/Column/Makefile.am
++++ b/demos/programs/Column/Makefile.am
+@@ -8,5 +8,5 @@
+ EXTRA_DIST = Imakefile Column.ad
+ data_DATA = $(EXTRA_DIST) $(column_SOURCES)
+ TOPDIR = ../../..
+-LDADD = $(TOPDIR)/lib/Xm/libXm.la
++LDADD = $(TOPDIR)/lib/Xm/libXm.la -lXt -lX11
+ INCLUDES = -I$(TOPDIR)/lib -I$(srcdir)/$(TOPDIR)/lib ${X_CFLAGS}
+--- a/demos/programs/Combo2/Makefile.am
++++ b/demos/programs/Combo2/Makefile.am
+@@ -8,5 +8,5 @@
+ combo_SOURCES = combo.c
+ data_DATA = $(EXTRA_DIST) $(combo_SOURCES)
+ TOPDIR = ../../..
+-LDADD = $(TOPDIR)/lib/Xm/libXm.la
++LDADD = $(TOPDIR)/lib/Xm/libXm.la -lXt
+ INCLUDES = -I$(TOPDIR)/lib -I$(srcdir)/$(TOPDIR)/lib ${X_CFLAGS}
+--- a/demos/programs/Exm/app_in_c/Makefile.am
++++ b/demos/programs/Exm/app_in_c/Makefile.am
+@@ -14,4 +14,4 @@
+ -I$(top_builddir)/lib \
+ ${X_CFLAGS}
+ LDADD = ../../../lib/Exm/libExm.a \
+- ../../../../lib/Xm/libXm.la
++ ../../../../lib/Xm/libXm.la -lXt -lXext -lX11
+--- a/demos/programs/Exm/simple_app/Makefile.am
++++ b/demos/programs/Exm/simple_app/Makefile.am
+@@ -14,5 +14,6 @@
+ -I$(srcdir)/../../../lib \
+ -I$(top_builddir)/lib \
+ ${X_CFLAGS}
+-LDADD = ../../../../lib/Xm/libXm.la \
+- ../../../lib/Exm/libExm.a
++LDADD = ../../../lib/Exm/libExm.a \
++ ../../../../lib/Xm/libXm.la -lXt -lX11
++
+--- a/demos/programs/Ext18List/Makefile.am
++++ b/demos/programs/Ext18List/Makefile.am
+@@ -10,6 +10,6 @@
+ EXTRA_DIST = Imakefile
+ data_DATA = $(EXTRA_DIST) $(ext18list_SOURCES)
+ TOPDIR = ../../..
+-LDADD = $(TOPDIR)/lib/Xm/libXm.la
++LDADD = $(TOPDIR)/lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(TOPDIR)/lib -I.. -I$(srcdir)/$(TOPDIR)/lib ${X_CFLAGS}
+--- a/demos/programs/FontSel/Makefile.am
++++ b/demos/programs/FontSel/Makefile.am
+@@ -7,6 +7,6 @@
+ fontsel_SOURCES = callbacks-c.c creation-c.c fontsel.c fontsel.h
+ EXTRA_DIST = Imakefile
+ data_DATA = $(EXTRA_DIST) $(fontsel_SOURCES)
+-LDADD = $(TOPDIR)/lib/Xm/libXm.la
++LDADD = $(TOPDIR)/lib/Xm/libXm.la -lXt
+ TOPDIR = ../../..
+ INCLUDES = -I$(TOPDIR)/lib -I$(srcdir)/$(TOPDIR)/lib ${X_CFLAGS}
+--- a/demos/programs/IconB/Makefile.am
++++ b/demos/programs/IconB/Makefile.am
+@@ -8,7 +8,7 @@
+ iconbuttondemo_SOURCES = misc.c iconbuttondemo.c
+ data_DATA = $(iconbuttondemo_SOURCES) $(EXTRA_DIST)
+ TOPDIR = ../../..
+-LDADD = $(TOPDIR)/lib/Xm/libXm.la
++LDADD = $(TOPDIR)/lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(TOPDIR)/lib -I$(srcdir)/.. \
+ -I$(srcdir)/$(TOPDIR)/lib \
+--- a/demos/programs/Outline/Makefile.am
++++ b/demos/programs/Outline/Makefile.am
+@@ -7,6 +7,6 @@
+ bin_PROGRAMS = outline
+ outline_SOURCES = outline.c
+ data_DATA = $(outline_SOURCES) $(EXTRA_DIST)
+-LDADD = $(TOPDIR)/lib/Xm/libXm.la
++LDADD = $(TOPDIR)/lib/Xm/libXm.la -lXt
+ TOPDIR = ../../..
+ INCLUDES = -I$(TOPDIR)/lib -I$(srcdir)/$(TOPDIR)/lib ${X_CFLAGS}
+--- a/demos/programs/Paned/Makefile.am
++++ b/demos/programs/Paned/Makefile.am
+@@ -8,6 +8,6 @@
+ paned_SOURCES = creation-c.c paned.c
+ data_DATA = $(EXTRA_DIST) $(paned_SOURCES)
+ TOPDIR = ../../..
+-LDADD = $(TOPDIR)/lib/Xm/libXm.la
++LDADD = $(TOPDIR)/lib/Xm/libXm.la -lXt
+
+ INCLUDES = -I$(TOPDIR)/lib -I$(srcdir)/$(TOPDIR)/lib ${X_CFLAGS}
+--- a/demos/programs/TabStack/Makefile.am
++++ b/demos/programs/TabStack/Makefile.am
+@@ -8,6 +8,6 @@
+ EXTRA_DIST = Imakefile
+ data_DATA = $(tabstack_SOURCES) $(EXTRA_DIST)
+ TOPDIR = ../../..
+-LDADD = $(TOPDIR)/lib/Xm/libXm.la
++LDADD = $(TOPDIR)/lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(TOPDIR)/lib -I$(srcdir)/$(TOPDIR)/lib ${X_CFLAGS}
+--- a/demos/programs/Tree/Makefile.am
++++ b/demos/programs/Tree/Makefile.am
+@@ -8,6 +8,6 @@
+ tree_SOURCES = bxutil-c.c tree.c
+ data_DATA = $(EXTRA_DIST) $(tree_SOURCES)
+ TOPDIR = ../../..
+-LDADD = $(TOPDIR)/lib/Xm/libXm.la
++LDADD = $(TOPDIR)/lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(TOPDIR)/lib -I$(srcdir)/.. -I$(srcdir)/$(TOPDIR)/lib ${X_CFLAGS}
+--- a/demos/programs/airport/Makefile.am
++++ b/demos/programs/airport/Makefile.am
+@@ -8,5 +8,5 @@
+ dragsource.h dropsite.h main.h
+ EXTRA_DIST = Imakefile XmdAirport.ad README
+ data_DATA = $(airport_SOURCES) $(EXTRA_DIST)
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt -lX11
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/animate/Makefile.am
++++ b/demos/programs/animate/Makefile.am
+@@ -17,7 +17,7 @@
+
+ bin_PROGRAMS = xmanimate
+
+-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Mrm/libMrm.la ../../../lib/Xm/libXm.la
++LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Mrm/libMrm.la ../../../lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../../lib \
+ -I$(srcdir)/../../lib \
+--- a/demos/programs/drag_and_drop/Makefile.am
++++ b/demos/programs/drag_and_drop/Makefile.am
+@@ -10,6 +10,6 @@
+ simpledrop_SOURCES = simpledrop.c
+ data_DATA = $(EXTRA_DIST) $(DNDDemo_SOURCES) $(simpledrop_SOURCES)
+ noinst_HEADERS = DNDDemo.h
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/draw/Makefile.am
++++ b/demos/programs/draw/Makefile.am
+@@ -7,5 +7,5 @@
+ draw_SOURCES = draw.c
+ EXTRA_DIST = Imakefile 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.a ../../../lib/Xm/libXm.la -lXt -lX11
+ INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/earth/Makefile.am
++++ b/demos/programs/earth/Makefile.am
+@@ -7,5 +7,5 @@
+ earth_SOURCES = earth.c
+ EXTRA_DIST = terre.xbm earth.man Imakefile README
+ data_DATA = $(EXTRA_DIST) $(earth_SOURCES)
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt -lXext -lX11
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/filemanager/Makefile.am
++++ b/demos/programs/filemanager/Makefile.am
+@@ -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.a ../../../lib/Xm/libXm.la -lXt -lX11
+ INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+
+
+--- a/demos/programs/fileview/Makefile.am
++++ b/demos/programs/fileview/Makefile.am
+@@ -11,7 +11,7 @@
+
+ UILS= French.uil German.uil English.uil
+
+-LDADD = ../../../lib/Xm/libXm.la ../../../lib/Mrm/libMrm.la
++LDADD = ../../../lib/Xm/libXm.la ../../../lib/Mrm/libMrm.la -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+
+--- a/demos/programs/getsubres/Makefile.am
++++ b/demos/programs/getsubres/Makefile.am
+@@ -7,5 +7,5 @@
+ EXTRA_DIST = getsubres.help getsubres.man README Imakefile
+ getsubres_SOURCES = getsubres.c
+ data_DATA = $(EXTRA_DIST) $(getsubres_SOURCES)
+-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
++LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la -lXt -lX11
+ INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/hellomotif/Makefile.am
++++ b/demos/programs/hellomotif/Makefile.am
+@@ -7,7 +7,7 @@
+ EXTRA_DIST = hellomotif.uil Imakefile README
+ hellomotif_SOURCES = hellomotif.c
+ data_DATA = $(EXTRA_DIST) $(hellomotif_SOURCES) hellomotif.uid
+-LDADD = ../../../lib/Xm/libXm.la ../../../lib/Mrm/libMrm.la
++LDADD = ../../../lib/Xm/libXm.la ../../../lib/Mrm/libMrm.la -lXt
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+
+ all: hellomotif.uid
+--- a/demos/programs/hellomotifi18n/Makefile.am
++++ b/demos/programs/hellomotifi18n/Makefile.am
+@@ -12,7 +12,7 @@
+ helloint_DEPENDENCIES = helloint.uid C/uid/l_strings.uid english/uid/l_strings.uid french/uid/l_strings.uid hebrew/uid/l_strings.uid japan/uid/l_strings.uid japanese/uid/l_strings.uid swedish/uid/l_strings.uid
+
+ INCLUDES = -I$(top_srcdir)/lib -I$(top_builddir)/lib ${X_CFLAGS}
+-LDADD = $(top_builddir)/lib/Mrm/libMrm.la $(top_builddir)/lib/Xm/libXm.la
++LDADD = $(top_builddir)/lib/Mrm/libMrm.la $(top_builddir)/lib/Xm/libXm.la -lXt
+
+ SUFFIXES = .uil .uid
+
+--- a/demos/programs/i18ninput/Makefile.am
++++ b/demos/programs/i18ninput/Makefile.am
+@@ -8,6 +8,6 @@
+ EXTRA_DIST = XmdI18nInput.ad README i18ninput.man i18ninput.help \
+ Imakefile
+ data_DATA = $(EXTRA_DIST) $(i18ninput_SOURCES)
+-LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la
++LDADD = ../../lib/Xmd/libXmd.a ../../../lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/panner/Makefile.am
++++ b/demos/programs/panner/Makefile.am
+@@ -7,5 +7,5 @@
+ panner_SOURCES = panner.c
+ EXTRA_DIST = README panner.man Imakefile
+ data_DATA = $(EXTRA_DIST) $(panner_SOURCES)
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt -lX11
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/periodic/Makefile.am
++++ b/demos/programs/periodic/Makefile.am
+@@ -7,7 +7,7 @@
+ EXTRA_DIST = periodic.uil periodic_l.uil XmdPeriodic.ad Imakefile README
+ periodic_SOURCES = periodic.c
+ data_DATA = $(EXTRA_DIST) $(periodic_SOURCES) periodic.uid
+-LDADD = ../../../lib/Xm/libXm.la ../../../lib/Mrm/libMrm.la
++LDADD = ../../../lib/Xm/libXm.la ../../../lib/Mrm/libMrm.la -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+
+--- a/demos/programs/piano/Makefile.am
++++ b/demos/programs/piano/Makefile.am
+@@ -8,6 +8,6 @@
+ EXTRA_DIST = piano.images README Inv8_part1.piano Inv8_part2.piano \
+ piano.man Imakefile
+ data_DATA = $(EXTRA_DIST) $(piano_SOURCES)
+-LDADD = ../../../lib/Xm/libXm.la -lm
++LDADD = ../../../lib/Xm/libXm.la -lm -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/popups/Makefile.am
++++ b/demos/programs/popups/Makefile.am
+@@ -7,6 +7,6 @@
+ autopopups_SOURCES = autopopups.c
+ EXTRA_DIST = README autopopups.man Imakefile
+ data_DATA = $(EXTRA_DIST) $(autopopups_SOURCES)
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/sampler2_0/Makefile.am
++++ b/demos/programs/sampler2_0/Makefile.am
+@@ -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.a ../../../lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../lib -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/setdate/Makefile.am
++++ b/demos/programs/setdate/Makefile.am
+@@ -7,6 +7,6 @@
+ EXTRA_DIST = XmdSetDate.ad README setDate.man Imakefile
+ setDate_SOURCES = setDate.c
+ data_DATA = $(EXTRA_DIST) $(setDate_SOURCES)
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/todo/Makefile.am
++++ b/demos/programs/todo/Makefile.am
+@@ -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 = -L../../lib/Xmd -lXmd -L../../lib/Exm -lExm ../../../lib/Xm/libXm.la -lXt -lXext -lX11
+--- a/demos/programs/tooltips/Makefile.am
++++ b/demos/programs/tooltips/Makefile.am
+@@ -7,6 +7,6 @@
+ bin_PROGRAMS = tooltips
+ tooltips_SOURCES = tooltips.c
+ data_DATA = $(tooltips_SOURCES) $(EXTRA_DIST)
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt
+
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/demos/programs/workspace/Makefile.am
++++ b/demos/programs/workspace/Makefile.am
+@@ -11,4 +11,4 @@
+ wsm.h wsmSend.h wsmStruct.h wsm_ui.h xrmLib.h
+ data_DATA = $(wsm_SOURCES) $(EXTRA_DIST)
+ INCLUDES = -I$(srcdir)/../../../lib -I$(srcdir)/../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+-LDADD = ../../../lib/Xm/libXm.la -L../../lib/Wsm -lWsm
++LDADD = ../../../lib/Xm/libXm.la -L../../lib/Wsm -lWsm -lXt -lX11
+--- a/demos/unsupported/aicon/Makefile.am
++++ b/demos/unsupported/aicon/Makefile.am
+@@ -2,7 +2,7 @@
+
+ noinst_PROGRAMS = aicon
+
+-LDADD = -L../../lib/Xmd -lXmd ../../../lib/Xm/libXm.la
++LDADD = -L../../lib/Xmd -lXmd ../../../lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../../lib -I$(srcdir)/../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+
+--- a/demos/unsupported/dainput/Makefile.am
++++ b/demos/unsupported/dainput/Makefile.am
+@@ -4,7 +4,7 @@
+
+ dainput_SOURCES = dainput.c dainput_dlg.c dainput_ui.c
+
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt -lX11
+
+ EXTRA_DIST = Imakefile
+
+--- a/demos/unsupported/dogs/Makefile.am
++++ b/demos/unsupported/dogs/Makefile.am
+@@ -16,7 +16,7 @@
+
+ dogs_DEPENDENCIES = dogs.uid
+
+-LDADD = $(top_builddir)/lib/Mrm/libMrm.la $(top_builddir)/lib/Xm/libXm.la
++LDADD = $(top_builddir)/lib/Mrm/libMrm.la $(top_builddir)/lib/Xm/libXm.la -lXt -lX11
+
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+
+--- a/demos/unsupported/hellomotif/Makefile.am
++++ b/demos/unsupported/hellomotif/Makefile.am
+@@ -4,7 +4,7 @@
+
+ SOURCES = hellomotif.c
+
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt
+
+ EXTRA_DIST = Imakefile
+
+--- a/demos/unsupported/motifshell/Makefile.am
++++ b/demos/unsupported/motifshell/Makefile.am
+@@ -4,7 +4,7 @@
+
+ SOURCES = motifshell.c
+
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt -lX11
+
+ EXTRA_DIST = Imakefile
+
+--- a/demos/unsupported/xmapdef/Makefile.am
++++ b/demos/unsupported/xmapdef/Makefile.am
+@@ -4,7 +4,7 @@
+
+ SOURCES = xmapdef.c
+
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt -lX11
+
+ EXTRA_DIST = Imakefile
+
+--- a/demos/unsupported/xmfonts/Makefile.am
++++ b/demos/unsupported/xmfonts/Makefile.am
+@@ -4,7 +4,7 @@
+
+ SOURCES = xmfonts.c
+
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt -lX11
+
+ EXTRA_DIST = Imakefile
+
+--- a/demos/unsupported/xmforc/Makefile.am
++++ b/demos/unsupported/xmforc/Makefile.am
+@@ -4,7 +4,7 @@
+
+ SOURCES = xmforc.c
+
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt
+
+ EXTRA_DIST = Imakefile
+
+--- a/demos/unsupported/xmform/Makefile.am
++++ b/demos/unsupported/xmform/Makefile.am
+@@ -6,6 +6,6 @@
+
+ EXTRA_DIST = Imakefile
+
+-LDADD = ../../../lib/Xm/libXm.la
++LDADD = ../../../lib/Xm/libXm.la -lXt
+
+ INCLUDES = -I$(srcdir)/../../../lib -I$(top_builddir)/lib ${X_CFLAGS}
+--- a/tools/wml/Makefile.am
++++ b/tools/wml/Makefile.am
+@@ -30,7 +30,7 @@
+ wml_LDADD = -L. -lwml
+ wml_DEPENDENCIES = libwml.a
+
+-wmldbcreate_LDADD = ../../lib/Xm/libXm.la
++wmldbcreate_LDADD = ../../lib/Xm/libXm.la -lXt
+
+ INCLUDES = -I../../lib -I$(srcdir)/../../lib -I$(srcdir)/../../include ${X_CFLAGS}
+
diff --git a/extra/motif/13-fix_hardcoded_x11rgb_path.patch b/extra/motif/13-fix_hardcoded_x11rgb_path.patch
new file mode 100644
index 0000000..6d53285
--- /dev/null
+++ b/extra/motif/13-fix_hardcoded_x11rgb_path.patch
@@ -0,0 +1,54 @@
+Description: Fix hardcoded path to /usr/lib/X11/rgb.txt in lib/Xm/ColorS.c
+ LibXm is hardcoded to read rgb.txt from /usr/lib/X11 but this file, provided
+ by x11-common in Debian, is located in /etc/X11 and /usr/share/X11 via symlink.
+ .
+ This patch fixes this by allowing the directory in which rgb.txt resides to be
+ customized by the --with-x11rgbdir=DIR configure option.
+Author: Graham Inggs <graham@nerve.org.za>
+Forwarded: http://bugs.motifzone.net/show_bug.cgi?id=1585
+Last-Update: 2013-03-12
+--- a/configure.ac
++++ b/configure.ac
+@@ -189,6 +189,10 @@
+ XMBINDDIR_FALLBACK="$xmbinddir"
+ AC_SUBST(XMBINDDIR_FALLBACK)
+
++AC_ARG_WITH(x11rgbdir, [ --with-x11rgbdir=DIR rgb.txt is located in DIR], x11rgbdir=$withval, x11rgbdir="/usr/lib/X11")
++X11RGBPATH="$x11rgbdir/rgb.txt"
++AC_SUBST(X11RGBPATH)
++
+ RM="rm -f"
+ AC_SUBST(RM)
+
+--- a/lib/Xm/ColorS.c
++++ b/lib/Xm/ColorS.c
+@@ -123,6 +123,10 @@
+ * STATIC DECLARATIONS
+ ************************************************************/
+
++#ifndef X11RGBPATH
++#define X11RGBPATH "/usr/lib/X11/rgb.txt"
++#endif
++
+ static XtResource resources[] =
+ {
+ {
+@@ -146,7 +150,7 @@
+ {
+ XmNrgbFile, XmCString, XmRString,
+ sizeof(String), XtOffsetOf(XmColorSelectorRec, cs.rgb_file),
+- XmRString, (XtPointer) "/usr/lib/X11/rgb.txt"
++ XmRString, (XtPointer) X11RGBPATH
+ },
+ #endif
+ {
+--- a/lib/Xm/Makefile.am
++++ b/lib/Xm/Makefile.am
+@@ -8,6 +8,7 @@
+ INCLUDES = -I.. -I$(srcdir)/.. -DXMBINDDIR_FALLBACK=\"@XMBINDDIR_FALLBACK@\" \
+ -DINCDIR=\"@INCDIR@\" \
+ -DLIBDIR=\"@LIBDIR@\" \
++ -DX11RGBPATH=\"@X11RGBPATH@\" \
+ ${X_CFLAGS}
+ xmdir = $(includedir)/Xm
+
diff --git a/extra/motif/15-link_uil_against_libuil.patch b/extra/motif/15-link_uil_against_libuil.patch
new file mode 100644
index 0000000..11792a7
--- /dev/null
+++ b/extra/motif/15-link_uil_against_libuil.patch
@@ -0,0 +1,29 @@
+Description: Link the uil executable against libUil
+ Linking the uil executable againt libUil instead of compiling with the libUil
+ code results in a reduction in size of the uil executable from about 348KB
+ to about 16KB.
+ .
+ This patch originates from Red Hat.
+Author: Graham Inggs <graham@nerve.org.za>
+Forwarded: http://bugs.motifzone.net/show_bug.cgi?id=1586
+Last-Update: 2013-03-12
+--- a/clients/uil/Makefile.am
++++ b/clients/uil/Makefile.am
+@@ -13,7 +13,7 @@
+
+ libUil_la_LIBADD = UilParser.lo ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la -lXt
+
+-uil_LDADD = ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la -lXt
++uil_LDADD = libUil.la ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la -lXt
+
+ INCLUDES = -DINCDIR=\"@INCDIR@\" \
+ -DLIBDIR=\"@LIBDIR@\" \
+@@ -42,7 +42,7 @@
+ UilLstMac.c UilSemVal.c UilSemCSet.c UilDB.c
+
+ SRCS = $(COMMON_SRC)
+-SRCS2 = $(COMMON_SRC) UilMain.c
++SRCS2 = UilMain.c
+
+ HEADERS_1 = Uil.h UilSymGl.h UilSymDef.h \
+ UilDef.h XmAppl.uil
diff --git a/extra/motif/16-fix-undefined-use-of-sprintf.patch b/extra/motif/16-fix-undefined-use-of-sprintf.patch
new file mode 100644
index 0000000..95a753e
--- /dev/null
+++ b/extra/motif/16-fix-undefined-use-of-sprintf.patch
@@ -0,0 +1,17 @@
+Description: Fix undefined use of sprintf
+ This patch fixes the undefined use of sprintf when the
+ source and destination buffers overlap.
+Author: Graham Inggs <graham@nerve.org.za>
+Forwarded: http://bugs.motifzone.net/show_bug.cgi?id=1628
+Last-Update: 2013-09-24
+--- a/lib/Xm/XmRenderT.c
++++ b/lib/Xm/XmRenderT.c
+@@ -2703,7 +2703,7 @@
+ number = tlist -> count;
+ tab = (_XmTab) tlist -> start;
+ while(number > 0) {
+- sprintf(temp, "%s %f %d %d %d, ", temp, tab -> value,
++ sprintf(temp + strlen(temp), " %f %d %d %d, ", tab -> value,
+ tab -> units, tab -> alignment, tab -> offsetModel);
+ tab = (_XmTab) tab -> next;
+ number--;
diff --git a/extra/motif/17-switch-to-system-iswspace.patch b/extra/motif/17-switch-to-system-iswspace.patch
new file mode 100644
index 0000000..a77b879
--- /dev/null
+++ b/extra/motif/17-switch-to-system-iswspace.patch
@@ -0,0 +1,384 @@
+Description: Switch to system iswspace() function
+ This patch replaces calls to _XmDataFieldIsWSpace() in lib/Xm/DataF.c
+ and _XmTextFieldIsWSpace() in lib/Xm/TextF.c with calls to the system
+ iswspace() function.
+ .
+ It fixes an array bounds error in lib/Xm/DataF.c where
+ _XmDataFieldIsWSpace() is called with num_entries = 3.
+Author: Graham Inggs <graham@nerve.org.za>
+Forwarded: http://bugs.motifzone.net/show_bug.cgi?id=1629
+Last-Update: 2013-11-18
+--- a/lib/Xm/DataF.c
++++ b/lib/Xm/DataF.c
+@@ -208,7 +208,6 @@
+ static Boolean df_VerifyLeave() ;
+ static Boolean _XmDataFieldIsWordBoundary() ;
+ static int _XmGetImage(Screen *, char *, XImage **);
+-static Boolean _XmDataFieldIsWSpace() ;
+ static void df_FindWord() ;
+ static void df_FindPrevWord() ;
+ static void df_FindNextWord() ;
+@@ -549,10 +548,6 @@
+ XmDataFieldWidget tf,
+ XmTextPosition pos1,
+ XmTextPosition pos2) ;
+-static Boolean _XmDataFieldIsWSpace(
+- wchar_t wide_char,
+- wchar_t *white_space,
+- int num_entries) ;
+ static void df_FindWord(
+ XmDataFieldWidget tf,
+ XmTextPosition begin,
+@@ -4549,40 +4544,6 @@
+ return False;
+ }
+
+-/* This routine accepts an array of wchar_t's containing wchar encodings
+- * of whitespace characters (and the number of array elements), comparing
+- * the wide character passed to each element of the array. If a match
+- * is found, we got a white space. This routine exists only because
+- * iswspace(3c) is not yet standard. If a system has isw* available,
+- * calls to this routine should be changed to iswspace(3c) (and callers
+- * should delete initialization of the array), and this routine should
+- * be deleted. Its a stop gap measure to avoid allocating an instance
+- * variable for the white_space array and/or declaring a widget wide
+- * global for the data and using a macro. Its ugly, but it works and
+- * in the long run will be replaced by standard functionality. */
+-
+-/* ARGSUSED */
+-static Boolean
+-#ifdef _NO_PROTO
+-_XmDataFieldIsWSpace( wide_char, white_space, num_entries )
+- wchar_t wide_char ;
+- wchar_t * white_space ;
+- int num_entries ;
+-#else
+-_XmDataFieldIsWSpace(
+- wchar_t wide_char,
+- wchar_t * white_space ,
+- int num_entries )
+-#endif /* _NO_PROTO */
+-{
+- int i;
+-
+- for (i=num_entries; i > 0; i--){
+- if (wide_char == white_space[i]) return True;
+- }
+- return False;
+-}
+-
+ static void
+ #ifdef _NO_PROTO
+ df_FindWord( tf, begin, left, right )
+@@ -4599,7 +4560,6 @@
+ #endif /* _NO_PROTO */
+ {
+ XmTextPosition start, end;
+- wchar_t white_space[3];
+
+ if (XmTextF_max_char_size(tf) == 1) {
+ for (start = begin; start > 0; start--) {
+@@ -4617,11 +4577,8 @@
+ }
+ *right = end - 1;
+ } else { /* check for iswspace and iswordboundary in each direction */
+- (void)mbtowc(&white_space[0], " ", 1);
+- (void)mbtowc(&white_space[1], "\n", 1);
+- (void)mbtowc(&white_space[2], "\t", 1);
+ for (start = begin; start > 0; start --) {
+- if (_XmDataFieldIsWSpace(XmTextF_wc_value(tf)[start-1],white_space, 3)
++ if (iswspace(XmTextF_wc_value(tf)[start-1])
+ || _XmDataFieldIsWordBoundary(tf, (XmTextPosition) start - 1,
+ start)) {
+ break;
+@@ -4630,7 +4587,7 @@
+ *left = start;
+
+ for (end = begin; end <= XmTextF_string_length(tf); end++) {
+- if (_XmDataFieldIsWSpace(XmTextF_wc_value(tf)[end], white_space, 3)){
++ if (iswspace(XmTextF_wc_value(tf)[end])){
+ end++;
+ break;
+ } else if (end < XmTextF_string_length(tf)) {
+@@ -4659,14 +4616,6 @@
+ {
+
+ XmTextPosition start = XmTextF_cursor_position(tf);
+- wchar_t white_space[3];
+-
+- if (XmTextF_max_char_size(tf) != 1) {
+- (void)mbtowc(&white_space[0], " ", 1);
+- (void)mbtowc(&white_space[1], "\n", 1);
+- (void)mbtowc(&white_space[2], "\t", 1);
+- }
+-
+
+ if (XmTextF_max_char_size(tf) == 1) {
+ if ((start > 0) &&
+@@ -4680,11 +4629,9 @@
+ }
+ df_FindWord(tf, start, left, right);
+ } else {
+- if ((start > 0) && (_XmDataFieldIsWSpace(XmTextF_wc_value(tf)[start - 1],
+- white_space, 3))) {
++ if ((start > 0) && (iswspace(XmTextF_wc_value(tf)[start - 1]))) {
+ for (; start > 0; start--) {
+- if (!_XmDataFieldIsWSpace(XmTextF_wc_value(tf)[start -1],
+- white_space, 3)){
++ if (!iswspace(XmTextF_wc_value(tf)[start -1])){
+ start--;
+ break;
+ }
+@@ -4713,14 +4660,6 @@
+ {
+
+ XmTextPosition end = XmTextF_cursor_position(tf);
+- wchar_t white_space[3];
+-
+- if (XmTextF_max_char_size(tf) != 1) {
+- (void)mbtowc(&white_space[0], " ", 1);
+- (void)mbtowc(&white_space[1], "\n", 1);
+- (void)mbtowc(&white_space[2], "\t", 1);
+- }
+-
+
+ if(XmTextF_max_char_size(tf) == 1) {
+ if (isspace((int)(unsigned char)XmTextF_value(tf)[end])) {
+@@ -4742,9 +4681,9 @@
+ if (*right < XmTextF_string_length(tf))
+ *right = *right - 1;
+ } else {
+- if (_XmDataFieldIsWSpace(XmTextF_wc_value(tf)[end], white_space, 3)) {
++ if (iswspace(XmTextF_wc_value(tf)[end])) {
+ for ( ; end < XmTextF_string_length(tf); end ++) {
+- if (!_XmDataFieldIsWSpace(XmTextF_wc_value(tf)[end], white_space, 3)) {
++ if (!iswspace(XmTextF_wc_value(tf)[end])) {
+ break;
+ }
+ }
+@@ -4758,10 +4697,9 @@
+ * If word boundary caused by whitespace, set right to the last
+ * whitespace following the end of the current word.
+ */
+- if (_XmDataFieldIsWSpace(XmTextF_wc_value(tf)[(int)*right], white_space, 3)) {
++ if (iswspace(XmTextF_wc_value(tf)[(int)*right])) {
+ while (*right < XmTextF_string_length(tf) &&
+- _XmDataFieldIsWSpace(XmTextF_wc_value(tf)[(int)*right],
+- white_space, 3)) {
++ iswspace(XmTextF_wc_value(tf)[(int)*right])) {
+ *right = *right + 1;
+ }
+ if (*right < XmTextF_string_length(tf))
+@@ -5872,13 +5810,6 @@
+ {
+ XmDataFieldWidget tf = (XmDataFieldWidget) w;
+ XmTextPosition cursorPos, position, dummy;
+- wchar_t white_space[3];
+-
+- if (XmTextF_max_char_size(tf) != 1) {
+- (void)mbtowc(&white_space[0], " ", 1);
+- (void)mbtowc(&white_space[1], "\n", 1);
+- (void)mbtowc(&white_space[2], "\t", 1);
+- }
+
+ cursorPos = XmTextF_cursor_position(tf);
+
+@@ -5896,16 +5827,13 @@
+ }
+ }
+ } else {
+- if (_XmDataFieldIsWSpace(XmTextF_wc_value(tf)[cursorPos],
+- white_space, 3))
++ if (iswspace(XmTextF_wc_value(tf)[cursorPos]))
+ df_FindWord(tf, cursorPos, &dummy, &position);
+ else
+ df_FindNextWord(tf, &dummy, &position);
+- if (_XmDataFieldIsWSpace(XmTextF_wc_value(tf)[position],
+- white_space, 3)){
++ if (iswspace(XmTextF_wc_value(tf)[position])){
+ for (; position < XmTextF_string_length(tf); position++) {
+- if (!_XmDataFieldIsWSpace(XmTextF_wc_value(tf)[position],
+- white_space, 3))
++ if (!iswspace(XmTextF_wc_value(tf)[position]))
+ break;
+ }
+ }
+--- a/lib/Xm/TextF.c
++++ b/lib/Xm/TextF.c
+@@ -360,10 +360,6 @@
+ XmTextPosition pos1,
+ XmTextPosition pos2);
+
+-static Boolean _XmTextFieldIsWSpace(wchar_t wide_char,
+- wchar_t *white_space,
+- int num_entries);
+-
+ static void FindWord(XmTextFieldWidget tf,
+ XmTextPosition begin,
+ XmTextPosition *left,
+@@ -3514,32 +3510,6 @@
+ return False;
+ }
+
+-/* This routine accepts an array of wchar_t's containing wchar encodings
+- * of whitespace characters (and the number of array elements), comparing
+- * the wide character passed to each element of the array. If a match
+- * is found, we got a white space. This routine exists only because
+- * iswspace(3c) is not yet standard. If a system has isw* available,
+- * calls to this routine should be changed to iswspace(3c) (and callers
+- * should delete initialization of the array), and this routine should
+- * be deleted. Its a stop gap measure to avoid allocating an instance
+- * variable for the white_space array and/or declaring a widget wide
+- * global for the data and using a macro. Its ugly, but it works and
+- * in the long run will be replaced by standard functionality. */
+-
+-/* ARGSUSED */
+-static Boolean
+-_XmTextFieldIsWSpace(wchar_t wide_char,
+- wchar_t * white_space ,
+- int num_entries)
+-{
+- int i;
+-
+- for (i=0; i < num_entries; i++) {
+- if (wide_char == white_space[i]) return True;
+- }
+- return False;
+-}
+-
+ static void
+ FindWord(XmTextFieldWidget tf,
+ XmTextPosition begin,
+@@ -3547,7 +3517,6 @@
+ XmTextPosition *right)
+ {
+ XmTextPosition start, end;
+- wchar_t white_space[3];
+
+ if (tf->text.max_char_size == 1) {
+ for (start = begin; start > 0; start--) {
+@@ -3565,11 +3534,8 @@
+ }
+ *right = end - 1;
+ } else { /* check for iswspace and iswordboundary in each direction */
+- (void)mbtowc(&white_space[0], " ", 1);
+- (void)mbtowc(&white_space[1], "\n", 1);
+- (void)mbtowc(&white_space[2], "\t", 1);
+ for (start = begin; start > 0; start --) {
+- if (_XmTextFieldIsWSpace(TextF_WcValue(tf)[start-1],white_space, 3)
++ if (iswspace(TextF_WcValue(tf)[start-1])
+ || _XmTextFieldIsWordBoundary(tf, (XmTextPosition) start - 1,
+ start)) {
+ break;
+@@ -3578,7 +3544,7 @@
+ *left = start;
+
+ for (end = begin; end <= tf->text.string_length; end++) {
+- if (_XmTextFieldIsWSpace(TextF_WcValue(tf)[end], white_space, 3)) {
++ if (iswspace(TextF_WcValue(tf)[end])) {
+ end++;
+ break;
+ } else if (end < tf->text.string_length) {
+@@ -3599,14 +3565,6 @@
+ {
+
+ XmTextPosition start = TextF_CursorPosition(tf);
+- wchar_t white_space[3];
+-
+- if (tf->text.max_char_size != 1) {
+- (void)mbtowc(&white_space[0], " ", 1);
+- (void)mbtowc(&white_space[1], "\n", 1);
+- (void)mbtowc(&white_space[2], "\t", 1);
+- }
+-
+
+ if (tf->text.max_char_size == 1) {
+ if ((start > 0) &&
+@@ -3620,11 +3578,9 @@
+ }
+ FindWord(tf, start, left, right);
+ } else {
+- if ((start > 0) && (_XmTextFieldIsWSpace(TextF_WcValue(tf)[start - 1],
+- white_space, 3))) {
++ if ((start > 0) && (iswspace(TextF_WcValue(tf)[start - 1]))) {
+ for (; start > 0; start--) {
+- if (!_XmTextFieldIsWSpace(TextF_WcValue(tf)[start -1],
+- white_space, 3)) {
++ if (!iswspace(TextF_WcValue(tf)[start -1])) {
+ start--;
+ break;
+ }
+@@ -3645,14 +3601,6 @@
+ {
+
+ XmTextPosition end = TextF_CursorPosition(tf);
+- wchar_t white_space[3];
+-
+- if (tf->text.max_char_size != 1) {
+- (void)mbtowc(&white_space[0], " ", 1);
+- (void)mbtowc(&white_space[1], "\n", 1);
+- (void)mbtowc(&white_space[2], "\t", 1);
+- }
+-
+
+ if(tf->text.max_char_size == 1) {
+ if (isspace((unsigned char)TextF_Value(tf)[end])) {
+@@ -3674,9 +3622,9 @@
+ if (*right < tf->text.string_length)
+ *right = *right - 1;
+ } else {
+- if (_XmTextFieldIsWSpace(TextF_WcValue(tf)[end], white_space, 3)) {
++ if (iswspace(TextF_WcValue(tf)[end])) {
+ for (; end < tf->text.string_length; end ++) {
+- if (!_XmTextFieldIsWSpace(TextF_WcValue(tf)[end], white_space, 3)) {
++ if (!iswspace(TextF_WcValue(tf)[end])) {
+ break;
+ }
+ }
+@@ -3690,10 +3638,9 @@
+ * If word boundary caused by whitespace, set right to the last
+ * whitespace following the end of the current word.
+ */
+- if (_XmTextFieldIsWSpace(TextF_WcValue(tf)[(int)*right], white_space, 3)) {
++ if (iswspace(TextF_WcValue(tf)[(int)*right])) {
+ while (*right < tf->text.string_length &&
+- _XmTextFieldIsWSpace(TextF_WcValue(tf)[(int)*right],
+- white_space, 3)) {
++ iswspace(TextF_WcValue(tf)[(int)*right])) {
+ *right = *right + 1;
+ }
+ if (*right < tf->text.string_length)
+@@ -4546,13 +4493,6 @@
+ {
+ XmTextFieldWidget tf = (XmTextFieldWidget) w;
+ XmTextPosition cursorPos, position, dummy;
+- wchar_t white_space[3];
+-
+- if (tf->text.max_char_size != 1) {
+- (void)mbtowc(&white_space[0], " ", 1);
+- (void)mbtowc(&white_space[1], "\n", 1);
+- (void)mbtowc(&white_space[2], "\t", 1);
+- }
+
+ cursorPos = TextF_CursorPosition(tf);
+
+@@ -4570,16 +4510,13 @@
+ }
+ }
+ } else {
+- if (_XmTextFieldIsWSpace(TextF_WcValue(tf)[cursorPos],
+- white_space, 3))
++ if (iswspace(TextF_WcValue(tf)[cursorPos]))
+ FindWord(tf, cursorPos, &dummy, &position);
+ else
+ FindNextWord(tf, &dummy, &position);
+- if (_XmTextFieldIsWSpace(TextF_WcValue(tf)[position],
+- white_space, 3)) {
++ if (iswspace(TextF_WcValue(tf)[position])) {
+ for (; position < tf->text.string_length; position++) {
+- if (!_XmTextFieldIsWSpace(TextF_WcValue(tf)[position],
+- white_space, 3))
++ if (!iswspace(TextF_WcValue(tf)[position]))
+ break;
+ }
+ }
diff --git a/extra/motif/18-option-main.patch b/extra/motif/18-option-main.patch
new file mode 100644
index 0000000..3ad059c
--- /dev/null
+++ b/extra/motif/18-option-main.patch
@@ -0,0 +1,9 @@
+diff -urN motif-2.3.8.orig/tools/wml/wmluiltok.l motif-2.3.8/tools/wml/wmluiltok.l
+--- motif-2.3.8.orig/tools/wml/wmluiltok.l 2021-05-25 13:51:53.464073407 -0600
++++ motif-2.3.8/tools/wml/wmluiltok.l 2021-05-25 13:52:25.354192799 -0600
+@@ -1,3 +1,5 @@
++%option main
++
+ %{
+ /*
+ * Motif