Module Name:    src
Committed By:   joerg
Date:           Wed Jun  5 13:54:26 UTC 2013

Modified Files:
        src/doc: HACKS
        src/usr.bin/rpcgen: rpc_main.c

Log Message:
If /usr/bin/cpp is not executable and RPCGEN_CPP was not set, try
/usr/bin/clang-cpp. This allows rpcgen to work in a clang-only release
build. Document hack to be resolved when the final decision about
/usr/bin/cpp and friends is made.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/doc/HACKS
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/rpcgen/rpc_main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.129 src/doc/HACKS:1.130
--- src/doc/HACKS:1.129	Mon Jun  3 23:02:43 2013
+++ src/doc/HACKS	Wed Jun  5 13:54:26 2013
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.129 2013/06/03 23:02:43 christos Exp $
+# $NetBSD: HACKS,v 1.130 2013/06/05 13:54:26 joerg Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -790,3 +790,14 @@ port	x68k
 		workaround for:
 		internal compiler error: in cselib_record_set, at cselib.c:1999
 	kcah
+
+hack	fallback to /usr/bin/clang-cpp in rpcgen
+cdate	Wed Jun  5 15:49:27 CEST 2013
+who	joerg
+file	src/usr.bin/rpcgen/rpc_main.c
+descr
+	It is undecided which compiler owns /usr/bin/cpp whether it should
+	exist in a MKGCC=no world. To allow rpcgen to work out-of-the-box,
+	if either gcc or clang is installed, use /usr/bin/clang-cpp as fallback.
+	This applies only if RPCGEN_CPP is not set and /usr/bin/cpp is not executable.
+kcah

Index: src/usr.bin/rpcgen/rpc_main.c
diff -u src/usr.bin/rpcgen/rpc_main.c:1.34 src/usr.bin/rpcgen/rpc_main.c:1.35
--- src/usr.bin/rpcgen/rpc_main.c:1.34	Wed Aug 31 16:24:58 2011
+++ src/usr.bin/rpcgen/rpc_main.c	Wed Jun  5 13:54:26 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpc_main.c,v 1.34 2011/08/31 16:24:58 plunky Exp $	*/
+/*	$NetBSD: rpc_main.c,v 1.35 2013/06/05 13:54:26 joerg Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
 #else
-__RCSID("$NetBSD: rpc_main.c,v 1.34 2011/08/31 16:24:58 plunky Exp $");
+__RCSID("$NetBSD: rpc_main.c,v 1.35 2013/06/05 13:54:26 joerg Exp $");
 #endif
 #endif
 
@@ -164,8 +164,11 @@ main(argc, argv)
 	struct commandline cmd;
 
 	setprogname(argv[0]);
-	if (!(CPP = getenv("RPCGEN_CPP")))
+	if ((CPP = getenv("RPCGEN_CPP")) == NULL) {
 		CPP = "/usr/bin/cpp";
+		if (access(CPP, X_OK))
+			CPP = "/usr/bin/clang-cpp";
+	}
 
 	(void) memset((char *) &cmd, 0, sizeof(struct commandline));
 	clear_args();

Reply via email to