Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/cddl/osnet/dist/lib/libdtrace/common Make the defau...
details: https://anonhg.NetBSD.org/src/rev/369ad51d53cd
branches: trunk
changeset: 343752:369ad51d53cd
user: joerg <joerg%NetBSD.org@localhost>
date: Wed Feb 24 21:11:34 2016 +0000
description:
Make the default CPP path a list and check if they are access(2)able.
If no match is found, fallback to looking for cpp in PATH.
diffstat:
external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diffs (34 lines):
diff -r da6f44e4d168 -r 369ad51d53cd external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c Wed Feb 24 19:45:48 2016 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c Wed Feb 24 21:11:34 2016 +0000
@@ -788,10 +788,10 @@
};
#ifdef illumos
-const char *_dtrace_defcpp = "/usr/ccs/lib/cpp"; /* default cpp(1) to invoke */
+const char *_dtrace_defcpps[] = { "/usr/ccs/lib/cpp" }; /* default cpp(1) to invoke */
const char *_dtrace_defld = "/usr/ccs/bin/ld"; /* default ld(1) to invoke */
#else
-const char *_dtrace_defcpp = "cpp"; /* default cpp(1) to invoke */
+const char *_dtrace_defcpps[] = { "/usr/bin/cpp", "/usr/bin/clang-cpp" }; /* default cpp(1) to invoke */
const char *_dtrace_defld = "ld"; /* default ld(1) to invoke */
const char *_dtrace_defobjcopy = "objcopy"; /* default objcopy(1) to invoke */
#endif
@@ -1195,7 +1195,16 @@
dtp->dt_provs = calloc(dtp->dt_provbuckets, sizeof (dt_provider_t *));
dt_proc_hash_create(dtp);
dtp->dt_vmax = DT_VERS_LATEST;
- dtp->dt_cpp_path = strdup(_dtrace_defcpp);
+ dtp->dt_cpp_path = NULL;
+ for (i = 0; i < (int)sizeof(_dtrace_defcpps) / sizeof(_dtrace_defcpps[0]); ++i) {
+ if (access(_dtrace_defcpps[i], X_OK) == 0) {
+ dtp->dt_cpp_path = strdup(_dtrace_defcpps[i]);
+ break;
+ }
+ }
+ if (dtp->dt_cpp_path == NULL)
+ dtp->dt_cpp_path = strdup("cpp");
+
dtp->dt_cpp_argv = malloc(sizeof (char *));
dtp->dt_cpp_argc = 1;
dtp->dt_cpp_args = 1;
Home |
Main Index |
Thread Index |
Old Index