diff -ruN klic-3.003-2002-02-26b/compiler/klic.c klic-3.003-2002-02-26c/compiler/klic.c
--- klic-3.003-2002-02-26b/compiler/klic.c	Mon Jan 21 20:55:25 2002
+++ klic-3.003-2002-02-26c/compiler/klic.c	Tue Feb 26 16:48:44 2002
@@ -507,7 +507,7 @@
     }
     /*** for Distributed KLIC system ***/
     if (distklic) {
-      DIST_COMPILER_FLAG(name, inf->ext);
+      sprintf(bufp, DIST_COMPILER_FLAG, klic_incdir, name, inf->ext);
     } else if ( shmklic ) {
       sprintf(bufp, " -DSHM -I%s -I. %s%s",
         klic_incdir, name, inf->ext);
@@ -651,7 +651,8 @@
     bufp += strlen(bufp);
   }
   if (distklic) {
-    DIST_LINKAGE_FLAG();
+    sprintf(bufp, DIST_LINKAGE_FLAG);
+    bufp += strlen(bufp);
   }
   exec_command("Linkage failed", NULL, noop);
 }
diff -ruN klic-3.003-2002-02-26b/config.h.sh klic-3.003-2002-02-26c/config.h.sh
--- klic-3.003-2002-02-26b/config.h.sh	Thu Dec 27 19:15:58 2001
+++ klic-3.003-2002-02-26c/config.h.sh	Tue Feb 26 16:48:37 2002
@@ -7,13 +7,8 @@
 
 cat <<GAZONK >>config.h
 
-#define DIST_COMPILER_FLAG(name, ext) \
-do{ \
-  (void) sprintf(bufp, " -DDIST -I%s -I. %s%s", \
-    klic_incdir, (name), (ext) ); \
-}while(0)
-
-#define DIST_LINKAGE_FLAG() 
+#define DIST_COMPILER_FLAG  " -DDIST -I%s -I. %s%s"
+#define DIST_LINKAGE_FLAG  ""
 
 GAZONK
 echo " "
diff -ruN klic-3.003-2002-02-26b/runtime/config/pvm/config.h.sh klic-3.003-2002-02-26c/runtime/config/pvm/config.h.sh
--- klic-3.003-2002-02-26b/runtime/config/pvm/config.h.sh	Thu Dec 27 19:15:57 2001
+++ klic-3.003-2002-02-26c/runtime/config/pvm/config.h.sh	Tue Feb 26 16:50:38 2002
@@ -5,46 +5,34 @@
 #       (Read COPYRIGHT-JIPDEC for detailed information.)
 # ----------------------------------------------------------
 
-if test "$PVM_ARCH" = "VPP300" -o "$PVM_ARCH" = "VPP700"; then
-DEFINEVPP="#define"
-else
-DEFINEVPP="#undef"
-fi
-
-if test "$PVM_ARCH" = "AP3000"; then
-DEFINEAP="#define"
-else
-DEFINEAP="#undef"
-fi
-
 if ( test "$PVM_ARCH" = "VPP300" || test "$PVM_ARCH" = "VPP700" ); then
   PVMLIBDIR=$PVM_ROOT/lib/$PVM_ARCH
-  DISTCOMPILERFLAG="{(void)sprintf(bufp, \" -DDIST -I%s -I. -I%s %s%s -Wl,-P -dy -J\", klic_incdir, PVMINC, (name), (ext)); }"
-  DISTLINKAGEFLAG="{ (void)sprintf(bufp, \" -Wl,-P,-dy -J -Wv,-sc,-ad -Oe,-P -L%s \",PVMLIBDIR);     bufp += strlen(bufp);     (void)sprintf(bufp, \" -l%s /usr/lang/pvm/lib/VPP300/libmp.a -lgen -lelf -lsocket -lpx -lm -lc\",PVMLIB);     bufp += strlen(bufp); }"
+  DISTCOMPILERFLAG="-Wl,-P -dy -J"
+  DISTLINKAGEFLAG="-Wl,-P,-dy -J -Wv,-sc,-ad -Oe,-P -L%s -l%s /usr/lang/pvm/lib/VPP300/libmp.a -lgen -lelf -lsocket -lpx -lm -lc"
 
 elif test "$PVM_ARCH" = "AP3000"; then
   PVMLIBDIR=$PVM_ROOT/lib
-  DISTCOMPILERFLAG="{(void)sprintf(bufp, \" -DDIST -I%s -I. -I%s %s%s\", klic_incdir, PVMINC, (name), (ext)); }"
-  DISTLINKAGEFLAG="{(void)sprintf(bufp, \" -L%s\",PVMLIBDIR); bufp += strlen(bufp); (void)sprintf(bufp, \" -l%s -lmpl -lemi -lthread\",PVMLIB); bufp += strlen(bufp); }"
+  DISTCOMPILERFLAG=""
+  DISTLINKAGEFLAG="-L%s -l%s -lmpl -lemi -lthread"
 
 else
    PVMLIBDIR=$PVM_ROOT/lib/$PVM_ARCH
-   DISTCOMPILERFLAG="{(void)sprintf(bufp, \" -DDIST -I%s -I. -I%s %s%s\", klic_incdir, PVMINC, (name), (ext)); }"
-   DISTLINKAGEFLAG="{(void)sprintf(bufp, \" -L%s\",PVMLIBDIR); bufp += strlen(bufp); (void)sprintf(bufp, \" -l%s\",PVMLIB); bufp += strlen(bufp); }"
+   DISTCOMPILERFLAG=""
+   DISTLINKAGEFLAG="-L%s -l%s"
 fi
 
 cat <<GAZONK >>config.h
 
-$DEFINEVPP VPP
-$DEFINEAP AP3000
+#define PVM_ARCH  $PVM_ARCH
+#define VPPAP  (PVM_ARCH==VPP || PVM_ARCH==AP3000)
+enum pvm_arch { VPP300, VPP700, AP3000 };
 
 #define PVMINC  "$PVM_ROOT/include"
 #define PVMLIBDIR  "$PVMLIBDIR"
 #define PVMLIB  "$PVMLIB"
 
-#define DIST_COMPILER_FLAG(name, ext) $DISTCOMPILERFLAG
-#define DIST_LINKAGE_FLAG() $DISTLINKAGEFLAG
-
+#define DIST_COMPILER_FLAG  " -DDIST -I%s -I. -I" PVMINC " %s%s $DISTCOMPILERFLAG"
+#define DIST_LINKAGE_FLAG  " $DISTLINKAGEFLAG", PVMLIBDIR, PVMLIB
 GAZONK
 echo " "
 
diff -ruN klic-3.003-2002-02-26b/runtime/config/pvm/distproc.c klic-3.003-2002-02-26c/runtime/config/pvm/distproc.c
--- klic-3.003-2002-02-26b/runtime/config/pvm/distproc.c	Sun Jan 13 15:56:44 2002
+++ klic-3.003-2002-02-26c/runtime/config/pvm/distproc.c	Tue Feb 26 15:57:39 2002
@@ -487,18 +487,12 @@
 {
   declare_globals;
 
-#if defined(VPP) || defined(AP3000)
-  int mytid = pvm_mytid();
-  if ( pvm_parent() == PvmNoParent )
-#else
-  if ( parent_tid == 0 )
-#endif
-
+  if( (VPPAP && pvm_parent() != PvmNoParent) || parent_tid == 0 )
   {	/* original process */
-#ifdef AP3000
-    parent_tid = 0;
-    __pvm_set_node_name(main);
-#endif
+    if( PVM_ARCH == AP3000 ){
+      parent_tid = 0;
+      __pvm_set_node_name(main);
+    }
 
     io_spawn_children(num_child, opttable, prog_name, argc, argv);
     return 0;
diff -ruN klic-3.003-2002-02-26b/runtime/config/pvm/distrmon.c klic-3.003-2002-02-26c/runtime/config/pvm/distrmon.c
--- klic-3.003-2002-02-26b/runtime/config/pvm/distrmon.c	Sun Jan 13 16:32:16 2002
+++ klic-3.003-2002-02-26c/runtime/config/pvm/distrmon.c	Tue Feb 26 16:19:29 2002
@@ -17,7 +17,7 @@
 #include "interpe.h"
 #include "rmon.h"
 
-#if defined(VPP) || defined(AP3000)
+#if VPPAP
 #include <sys/socket.h>
 #endif
 
@@ -25,7 +25,7 @@
   Shoen outputs profile information to rmon server using PVM
   */
 
-#if defined(VPP) || defined(AP3000)
+#if VPPAP
 static FILE* rmonfile;
 #else
 static int rmon_tid;
@@ -38,13 +38,6 @@
   int  i;
   int  bufindex = 0;
 
-#if defined(VPP) || defined(AP3000)
-  int req_size, n;
-  char* rmon_buf = (char*) send_pbuf;
-#else
-  int  info;
-#endif
-
   send_pbuf[bufindex++] = SHOEN_OUTPUT_PROF_TAG;
   send_pbuf[bufindex++] = total_node;
   for(i = 0; i < total_node ; i++){
@@ -55,91 +48,88 @@
     send_pbuf[bufindex++] = shoen_profile[i].mrtimes;
   }
 
-#if defined(VPP) || defined(AP3000)
-  req_size = bufindex * sizeof(long);
-
-  while ((n = fwrite((char*) rmon_buf, 1, req_size, rmonfile)) < req_size) {
-    if (n <= 0 ) {
-      fclose(rmonfile);
-      fatal("Cannot send to 'pg-server'!!");
+  if( VPPAP ){
+    int n;
+    char* rmon_buf = (char*) send_pbuf;
+    int req_size = bufindex * sizeof(long);
+
+    while( (n = fwrite((char*) rmon_buf, 1, req_size, rmonfile)) < req_size ){
+      if( n <= 0 ){
+	fclose(rmonfile);
+	fatal("Cannot send to 'pg-server'!!");
+      }
+      req_size -= n;
+      rmon_buf += n;
     }
-    req_size -= n;
-    rmon_buf += n;
+    fflush(rmonfile);
+  }else{
+    if( pvm_initsend(PvmDataDefault) < 0 )
+      fatal("Error in pvm_initsend\n");
+    if( pvm_pklong(send_pbuf, bufindex, 1) < 0 )
+      fatal("Error in pvm_pklong\n");
+    if( pvm_send(rmon_tid, 3) < 0 )
+      fatal("Error in pvm_send\n");
   }
-  fflush(rmonfile);
-#else
-  info = pvm_initsend(PvmDataDefault);
-  if (info < 0)
-    fatal("Error in pvm_initsend\n");
-  info = pvm_pklong(send_pbuf, bufindex, 1);
-  if (info < 0)
-    fatal("Error in pvm_pklong\n");
-  info = pvm_send(rmon_tid, 3);
-  if (info < 0)
-    fatal("Error in pvm_send\n");
-#endif
 }
 
 static void
 profiling_ctr_tag(tag)
   long tag;
 {
-#if defined(VPP) || defined(AP3000)
-  declare_globals;
-  int req_size = sizeof(long), n;
-  union { long v; char b[sizeof(long)]; } tagb;
-  char* buf = (char*) &tagb;
-
-  tagb.v = tag;
-
-  while ((n = fwrite(buf,1,req_size,rmonfile)) < req_size) {
-    if (n <= 0) {
-      fclose(rmonfile);
-      fatal("Cannot send to 'pg-server'!!");
+  if( VPPAP ){
+    declare_globals;
+    int n;
+    int req_size = sizeof(long);
+    union { long v; char b[sizeof(long)]; } tagb;
+    char* buf = (char*) &tagb;
+
+    tagb.v = tag;
+
+    while( (n = fwrite(buf, 1, req_size, rmonfile)) < req_size ){
+      if( n <= 0 ){
+	fclose(rmonfile);
+	fatal("Cannot send to 'pg-server'!!");
+      }
+      req_size -= n;
+      buf += n;
     }
-    req_size -= n;  buf += n;
+    fflush(rmonfile);
+  }else{
+    if( pvm_initsend(PvmDataDefault) < 0 )
+      fatal("Error in pvm_initsend\n");
+    if( pvm_pklong(&tag, 1, 1) < 0 )
+      fatal("Error in pvm_pklong\n");
+    if( pvm_send(rmon_tid, 3) < 0 )
+      fatal("Error in pvm_send\n");
   }
-  fflush(rmonfile);
-#else
-  int info;
-  info = pvm_initsend(PvmDataDefault);
-  if (info < 0)
-    fatal("Error in pvm_initsend\n");
-  info = pvm_pklong(&tag, 1, 1);
-  if (info < 0)
-    fatal("Error in pvm_pklong\n");
-  info = pvm_send(rmon_tid,3);
-  if (info < 0)
-    fatal("Error in pvm_send\n");
-#endif
 }
 
 static void
 start_profiling()
 {
-#if defined(VPP) || defined(AP3000)
-  declare_globals;
-  int family = PF_UNIX, n, max, req_size, i, j, sock;
-  struct sockaddr addr;
-  char* path;
-
-  max = total_node;
-  path = rmonnode;
-
-  addr.sa_family = family;
-  strcpy(addr.sa_data, "/tmp/");
-  strcat(addr.sa_data, path);
-
-  sock = socket(family, SOCK_STREAM, 0);
-  if (sock < 0) {
-    fatal("Cannot make a socket!!");
-  }
-  if (connect(sock, &addr, sizeof(struct sockaddr)) < 0) {
-    fatal("Cannot be connected with 'pg-server'!!");
-  }
+  if( VPPAP ){
+    declare_globals;
+    int family = PF_UNIX, n, max, req_size, i, j, sock;
+    struct sockaddr addr;
+    char* path;
+
+    max = total_node;
+    path = rmonnode;
+
+    addr.sa_family = family;
+    strcpy(addr.sa_data, "/tmp/");
+    strcat(addr.sa_data, path);
+
+    sock = socket(family, SOCK_STREAM, 0);
+    if( sock < 0 ){
+      fatal("Cannot make a socket!!");
+    }
+    if( connect(sock, &addr, sizeof(struct sockaddr)) < 0 ){
+      fatal("Cannot be connected with 'pg-server'!!");
+    }
 
-  rmonfile = fdopen(sock, "w+");
-#endif
+    rmonfile = fdopen(sock, "w+");
+  }
 
   profiling_ctr_tag(SHOEN_START_TAG);
 }
@@ -147,15 +137,12 @@
 extern void
 terminate_profiling()
 {
-#if defined(VPP) || defined(AP3000)
   declare_globals;
-#endif
 
   profiling_ctr_tag(SHOEN_TERMINATE_TAG);
 
-#if defined(VPP) || defined(AP3000)
-  fclose(rmonfile);
-#endif
+  if( VPPAP )
+    fclose(rmonfile);
 }
 
 
@@ -168,9 +155,8 @@
 {
   declare_globals;
   if( IS_SHOEN_NODE(my_node) && rmonnode ){
-#if !defined(VPP) && !defined(AP3000)
-    sscanf(rmonnode,"%x", &rmon_tid);
-#endif
+    if( ! VPPAP )
+      sscanf(rmonnode, "%x", &rmon_tid);
 
     start_profiling();
 
diff -ruN klic-3.003-2002-02-26b/runtime/config/pvm/rmon_server.c klic-3.003-2002-02-26c/runtime/config/pvm/rmon_server.c
--- klic-3.003-2002-02-26b/runtime/config/pvm/rmon_server.c	Sun Jan 13 17:13:38 2002
+++ klic-3.003-2002-02-26c/runtime/config/pvm/rmon_server.c	Tue Feb 26 16:21:05 2002
@@ -5,11 +5,7 @@
 %       (Read COPYRIGHT-JIPDEC for detailed information.)
 ----------------------------------------------------------- */
 
-#if defined(VPP) || defined(AP3000)
-#define VPPAP
-#endif
-
-#ifndef VPPAP
+#if ! VPPAP
 #include <pvm3.h>
 #endif
 
@@ -19,7 +15,7 @@
 #include <klic/basic.h>
 #include "rmon.h"
 
-#ifdef VPPAP
+#if VPPAP
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -29,7 +25,7 @@
 
 #define MAXNUM    256
 
-#ifdef VPPAP
+#if VPPAP
 static int sock;
 static char* filename;
 
diff -ruN klic-3.003-2002-02-26b/runtime/config/shm/config.h.sh klic-3.003-2002-02-26c/runtime/config/shm/config.h.sh
--- klic-3.003-2002-02-26b/runtime/config/shm/config.h.sh	Thu Dec 27 19:15:57 2001
+++ klic-3.003-2002-02-26c/runtime/config/shm/config.h.sh	Tue Feb 26 16:49:22 2002
@@ -11,10 +11,8 @@
 #define CPU_TYPE $CPU_TYPE
 #define $CPU_TYPE
 
-#define DIST_COMPILER_FLAG(name, ext) \
-    {	(void)sprintf(bufp, " -DDIST -DSHM_DIST -I%s -I. %s%s", \
-		                   klic_incdir, (name), (ext)); }
-#define DIST_LINKAGE_FLAG() 
+#define DIST_COMPILER_FLAG  " -DDIST -DSHM_DIST -I%s -I. %s%s"
+#define DIST_LINKAGE_FLAG  ""
 
 GAZONK
 echo " "
