Bug 1421159 - Unbreak JS shell build on BSDs after bug
bug 1410528. r?sfink
--- 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));