Index: branches/libc-0.6/src/emx/src/emxomf/emxomfld.c
===================================================================
--- branches/libc-0.6/src/emx/src/emxomf/emxomfld.c	(revision 3281)
+++ branches/libc-0.6/src/emx/src/emxomf/emxomfld.c	(revision 3288)
@@ -163,4 +163,13 @@
    var. using any of the values WLINK, VAC365, VAC308 and LINK386. */
 static const char *linker_type = "VAC365";
+
+/* The name of the resource compiler to use.  By default, rc is used. 
+   This can be overridden with the EMXOMFLD_RC environment variable. */
+static const char *rc_name = "rc.exe";
+
+/* The type of resource compiler to use. By default we assume it's 
+   IBM resource compiler. This can be overridden with the EMXOMFLD_RC_TYPE 
+   env. var. using any of the values RC, WRC. */
+static const char *rc_type = "RC";
 
 /* Non-zero if emxomfld should automatically convert a.out objects and
@@ -1526,4 +1535,12 @@
          "    linker name or path is not supported. Quotes are not supported either.\n"
          "The default values for these two variables are VAC365 and ilink.exe.\n", stderr);
+  fputs ("  EMXOMFLD_RC_TYPE:\n"
+         "    The type of resource compiler we're using. Values: RC,WRC.\n"
+         "        RC       rc.exe as shipped with OS/2 or found in the Toolkit\n"
+         "        WRC      wrc.exe from Open Watcom v1.6 or later.\n", stderr);
+  fputs ("  EMXOMFLD_RC:\n"
+         "    Name of the resource compiler to use and optionally extra parameters.\n"
+         "    Spaces or quotes in the name or path are not supported.\n"
+         "The default values for these two variables are RC and rc.exe.\n", stderr);
   exit (1);
 }
@@ -1832,8 +1849,8 @@
   t = getenv ("EMXOMFLD_TYPE");
   if (    t
-      &&  stricmp(t, "WLINK")
-      &&  stricmp(t, "VAC365")
-      &&  stricmp(t, "VAC308")
-      &&  stricmp(t, "LINK386")
+      &&  stricmp (t, "WLINK")
+      &&  stricmp (t, "VAC365")
+      &&  stricmp (t, "VAC308")
+      &&  stricmp (t, "LINK386")
       )
     fprintf (stderr, "emxomfld: warning: '%s' is an invalid value for EMXOMFLD_TYPE.\n", t);
@@ -1845,6 +1862,6 @@
     linker_name = t;
   if (opt_t)
-    fprintf(stderr, "*** Linker     : %s\n"
-                    "*** Linker type: %s\n", linker_name, linker_type);
+    fprintf (stderr, "*** Linker     : %s\n"
+                     "*** Linker type: %s\n", linker_name, linker_type);
 
   /* apply object & library hacks */
@@ -1857,5 +1874,5 @@
       free (pcur->name);
       pcur->name = xstrdup(szname);
-      fclose(phfile);
+      fclose (phfile);
     }
 
@@ -1868,5 +1885,5 @@
       free (pcur->name);
       pcur->name = xstrdup(szname);
-      fclose(phfile);
+      fclose (phfile);
     }
 
@@ -1874,5 +1891,5 @@
 
   if (!def_fname && dll_flag)
-    gen_deffile();
+    gen_deffile ();
 
   /* Do the weak prelinking. Important that this is done after make_env(). */
@@ -2306,15 +2323,53 @@
   if (rc == 0 && res_fname != NULL)
     {
-      arg_init (TRUE);
-      put_arg ("rc.exe", TRUE, FALSE);
-      put_arg ("-n", FALSE, FALSE);
-      put_arg (res_fname, TRUE, FALSE);
-      put_arg (output_fname, TRUE, FALSE);
-      arg_end ();
-      rc = emxomfld_spawn (command_line, "Resource Linker");
-      if (rc < 0)
-        {
-          perror ("emxomfld: rc");
-          exit (2);
+      /* EMXOMFLD_RC_TYPE contains RC or WRC if set. If non of these
+         we assume RC.
+         EMXOMFLD_RC contains the compiler name and perhaps extra 
+         arguments. If not set we'll use the default compiler, rc.exe. */
+
+      t = getenv ("EMXOMFLD_RC_TYPE");
+      if (   t
+          && stricmp (t, "RC")
+          && stricmp (t, "WRC"))
+        fprintf (stderr, "emxomfld: warning: '%s' is an invalid value for EMXOMFLD_RC_TYPE.\n", t);
+      else if (t)
+        rc_type = t;
+
+      t = getenv ("EMXOMFLD_RC");
+      if (t)
+        rc_name = t;
+      if (opt_t)
+        fprintf (stderr, "*** Resource compiler     : %s\n"
+                         "*** Resource compiler type: %s\n", rc_name, rc_type);
+
+      if (!stricmp (linker_type, "RC"))
+        {
+          arg_init (TRUE);
+          put_arg (rc_name, TRUE, FALSE);
+          put_arg ("-n", FALSE, FALSE);
+          put_arg (res_fname, TRUE, FALSE);
+          put_arg (output_fname, TRUE, FALSE);
+          arg_end ();
+          rc = emxomfld_spawn (command_line, "Resource Linker");
+          if (rc < 0)
+            {
+              perror ("emxomfld: rc");
+              exit (2);
+            }
+        }
+      else
+        {
+          arg_init (FALSE);
+          put_arg (rc_name, TRUE, FALSE);
+          put_arg ("-q", FALSE, FALSE);
+          put_arg (res_fname, TRUE, FALSE);
+          put_arg (output_fname, TRUE, FALSE);
+          arg_end ();
+          rc = emxomfld_spawn (command_line, "Resource Linker");
+          if (rc < 0)
+            {
+              perror ("emxomfld: wrc");
+              exit (2);
+            }
         }
     }
