Bug 1421159 - Unbreak JS shell build on BSDs after bug bug 1410528. r?sfink draft
authorJan Beich <jbeich@FreeBSD.org>
Tue, 09 Jan 2018 03:20:37 +0000
changeset 717482 e5335a10bedb36d99fde134e7a400ce258213bf4
parent 717472 d22a9bb3302a812d7f05e44d9c44fd74515f426a
child 745274 f7f3be1f17b0cbcac27044ee8e78a89336873c32
push id94698
push userbmo:jbeich@FreeBSD.org
push dateTue, 09 Jan 2018 03:23:03 +0000
reviewerssfink
bugs1421159, 1410528
milestone59.0a1
Bug 1421159 - Unbreak JS shell build on BSDs after bug bug 1410528. r?sfink
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -14,17 +14,17 @@
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/mozalloc.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/ScopeExit.h"
 #include "mozilla/Sprintf.h"
 #include "mozilla/TimeStamp.h"
 
 #include <chrono>
-#if defined(__linux__) || defined(XP_MACOSX)
+#ifdef JS_POSIX_NSPR
 # include <dlfcn.h>
 #endif
 #ifdef XP_WIN
 # include <direct.h>
 # include <process.h>
 #endif
 #include <errno.h>
 #include <fcntl.h>
@@ -60,17 +60,17 @@
 #include "jsprf.h"
 #include "jsscript.h"
 #include "jstypes.h"
 #include "jsutil.h"
 #ifdef XP_WIN
 # include "jswin.h"
 #endif
 #include "jswrapper.h"
-#if !defined(__linux__) && !defined(XP_MACOSX)
+#ifndef JS_POSIX_NSPR
 # include "prerror.h"
 # include "prlink.h"
 #endif
 #include "shellmoduleloader.out.h"
 
 #include "builtin/ModuleObject.h"
 #include "builtin/RegExp.h"
 #include "builtin/TestingFunctions.h"
@@ -137,17 +137,17 @@ using mozilla::Maybe;
 using mozilla::Nothing;
 using mozilla::NumberEqualsInt32;
 using mozilla::PodCopy;
 using mozilla::PodEqual;
 using mozilla::TimeDuration;
 using mozilla::TimeStamp;
 
 // Avoid an unnecessary NSPR dependency on Linux and OS X just for the shell.
-#if defined(__linux__) || defined(XP_MACOSX)
+#ifdef JS_POSIX_NSPR
 typedef void PRLibrary;
 
 static PRLibrary*
 PR_LoadLibrary(const char* path)
 {
     return dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
 }
 
@@ -8759,17 +8759,17 @@ class AutoLibraryLoader {
         for (auto dll : libraries) {
             PR_UnloadLibrary(dll);
         }
     }
 
     PRLibrary* load(const char* path) {
         PRLibrary* dll = PR_LoadLibrary(path);
         if (!dll) {
-#if defined(__linux__) || defined(XP_MACOSX)
+#ifdef JS_POSIX_NSPR
             fprintf(stderr, "LoadLibrary '%s' failed: %s\n", path, dlerror());
 #else
             fprintf(stderr, "LoadLibrary '%s' failed with code %d\n", path, PR_GetError());
 #endif
             MOZ_CRASH("Failed to load library");
         }
 
         MOZ_ALWAYS_TRUE(libraries.append(dll));