bug 694499 - get rid of jscpucfg binary. r=jimb

This commit is contained in:
Ted Mielczarek 2011-10-19 10:01:24 -04:00
Родитель 660338c172
Коммит 88455fc076
6 изменённых файлов: 35 добавлений и 230 удалений

Просмотреть файл

@ -182,7 +182,7 @@ CPPSRCS = \
# doing!
INSTALLED_HEADERS = \
js-config.h \
jsautocfg.h \
jscpucfg.h \
$(CURDIR)/jsautokw.h \
js.msg \
jsalloc.h \
@ -542,10 +542,6 @@ else
CPPSRCS += pm_stub.cpp
endif
ifeq ($(OS_ARCH),WINNT)
INSTALLED_HEADERS += jscpucfg.h
endif
EXPORTS = $(INSTALLED_HEADERS)
DASH_R = -r
@ -760,12 +756,6 @@ DEFINES += -DIMPL_MFBT
INCLUDES += -I$(srcdir)
GARBAGE += jscpucfg.o jsautocfg.h jsautocfg.tmp jscpucfg
ifneq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH)))
TARGETS += jscpucfg$(HOST_BIN_SUFFIX)
endif
ifdef JS_THREADSAFE
DEFINES += -DJS_THREADSAFE
endif
@ -880,34 +870,6 @@ jsdtoa.o: jsdtoa.cpp Makefile.in
$(CXX) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $<
endif
export:: jsautocfg.h
ifeq (,$(CROSS_COMPILE)$(GNU_CC)$(filter-out WINNT,$(OS_ARCH)))
jsautocfg.h:
$(TOUCH) $@
else
jsautocfg.h: jscpucfg$(HOST_BIN_SUFFIX)
@$(RM) $@ jsautocfg.tmp
./jscpucfg > jsautocfg.tmp
mv jsautocfg.tmp $@
endif
# jscpucfg is a strange target
# Needs to be built with the host compiler but needs to include
# the mdcpucfg for the target so it needs the appropriate target defines
ifdef HOST_NSPR_MDCPUCFG
HOST_CXX := $(HOST_CXX) -DMDCPUCFG=$(TARGET_NSPR_MDCPUCFG)
HOST_CXXFLAGS := $(patsubst -DXP_%,,$(HOST_CXXFLAGS))
endif
ifdef CROSS_COMPILE
# jscpucfg needs to know when it's supposed to produce a config for the target
JSCPUCFG_DEFINES = $(ACDEFINES)
endif
jscpucfg$(HOST_BIN_SUFFIX): jscpucfg.cpp Makefile.in
$(HOST_CXX) $(HOST_CXXFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) $(HOST_OUTOPTION)$@ $<
# Compute the linker flags that programs linking against SpiderMonkey should
# pass to get SpiderMonkey and its dependencies, beyond just the -L and -l
# for the SpiderMonkey library itself.

Просмотреть файл

@ -2718,6 +2718,11 @@ fi
MOZ_ALIGN_OF_TYPE(JS_ALIGN_OF_POINTER, void*, 2 4 8 16)
MOZ_SIZE_OF_TYPE(JS_BYTES_PER_DOUBLE, double, 6 8 10 12 14)
AC_CHECK_HEADERS(endian.h)
if test "$ac_cv_header_endian_h" = yes; then
AC_DEFINE(JS_HAVE_ENDIAN_H)
fi
dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
dnl ========================================================
AC_MSG_CHECKING(for int16_t)

Просмотреть файл

@ -59,6 +59,10 @@
useable. See jstypes.h and jsstdint.h. */
#undef JS_HAVE_STDINT_H
/* Define to 1 if the <endian.h> header is present and
useable. See jscpucfg.h. */
#undef JS_HAVE_ENDIAN_H
/* Define to 1 if the <sys/types.h> defines int8_t, etc. */
#undef JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES

Просмотреть файл

@ -1,182 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* Generate CPU-specific bit-size and similar #defines.
*/
#include <stdio.h>
#include <stdlib.h>
#if defined(CROSS_COMPILE) && !defined(FORCE_BIG_ENDIAN) && !defined(FORCE_LITTLE_ENDIAN)
#include <prtypes.h>
#endif
/************************************************************************/
int main(int argc, char **argv)
{
printf("#ifndef js_cpucfg___\n");
printf("#define js_cpucfg___\n\n");
printf("/* AUTOMATICALLY GENERATED - DO NOT EDIT */\n\n");
#ifdef CROSS_COMPILE
#if defined(__APPLE__) && !defined(FORCE_BIG_ENDIAN) && !defined(FORCE_LITTLE_ENDIAN)
/*
* Darwin NSPR uses the same MDCPUCFG (_darwin.cfg) for multiple
* processors, and determines which processor to configure for based
* on compiler predefined macros. We do the same thing here.
*/
printf("#ifdef __LITTLE_ENDIAN__\n");
printf("#define IS_LITTLE_ENDIAN 1\n");
printf("#undef IS_BIG_ENDIAN\n");
printf("#else\n");
printf("#undef IS_LITTLE_ENDIAN\n");
printf("#define IS_BIG_ENDIAN 1\n");
printf("#endif\n\n");
#elif defined(IS_LITTLE_ENDIAN) || defined(FORCE_LITTLE_ENDIAN)
printf("#define IS_LITTLE_ENDIAN 1\n");
printf("#undef IS_BIG_ENDIAN\n\n");
#elif defined(IS_BIG_ENDIAN) || defined(FORCE_BIG_ENDIAN)
printf("#undef IS_LITTLE_ENDIAN\n");
printf("#define IS_BIG_ENDIAN 1\n\n");
#else
#error "Endianess not defined."
#endif
#else
/*
* We don't handle PDP-endian or similar orders: if a short is big-endian,
* so must int and long be big-endian for us to generate the IS_BIG_ENDIAN
* #define and the IS_LITTLE_ENDIAN #undef.
*/
{
int big_endian = 0, little_endian = 0, ntests = 0;
if (sizeof(short) == 2) {
/* force |volatile| here to get rid of any compiler optimisations
* (var in register etc.) which may be appiled to |auto| vars -
* even those in |union|s...
* (|static| is used to get the same functionality for compilers
* which do not honor |volatile|...).
*/
volatile static union {
short i;
char c[2];
} u;
u.i = 0x0102;
big_endian += (u.c[0] == 0x01 && u.c[1] == 0x02);
little_endian += (u.c[0] == 0x02 && u.c[1] == 0x01);
ntests++;
}
if (sizeof(int) == 4) {
/* force |volatile| here ... */
volatile static union {
int i;
char c[4];
} u;
u.i = 0x01020304;
big_endian += (u.c[0] == 0x01 && u.c[1] == 0x02 &&
u.c[2] == 0x03 && u.c[3] == 0x04);
little_endian += (u.c[0] == 0x04 && u.c[1] == 0x03 &&
u.c[2] == 0x02 && u.c[3] == 0x01);
ntests++;
}
if (sizeof(long) == 8) {
/* force |volatile| here ... */
volatile static union {
long i;
char c[8];
} u;
/*
* Write this as portably as possible: avoid 0x0102030405060708L
* and <<= 32.
*/
u.i = 0x01020304;
u.i <<= 16, u.i <<= 16;
u.i |= 0x05060708;
big_endian += (u.c[0] == 0x01 && u.c[1] == 0x02 &&
u.c[2] == 0x03 && u.c[3] == 0x04 &&
u.c[4] == 0x05 && u.c[5] == 0x06 &&
u.c[6] == 0x07 && u.c[7] == 0x08);
little_endian += (u.c[0] == 0x08 && u.c[1] == 0x07 &&
u.c[2] == 0x06 && u.c[3] == 0x05 &&
u.c[4] == 0x04 && u.c[5] == 0x03 &&
u.c[6] == 0x02 && u.c[7] == 0x01);
ntests++;
}
if (big_endian && big_endian == ntests) {
printf("#undef IS_LITTLE_ENDIAN\n");
printf("#define IS_BIG_ENDIAN 1\n\n");
} else if (little_endian && little_endian == ntests) {
printf("#define IS_LITTLE_ENDIAN 1\n");
printf("#undef IS_BIG_ENDIAN\n\n");
} else {
fprintf(stderr, "%s: unknown byte order"
"(big_endian=%d, little_endian=%d, ntests=%d)!\n",
argv[0], big_endian, little_endian, ntests);
return EXIT_FAILURE;
}
}
#endif /* CROSS_COMPILE */
// PA-RISC is the only platform we try to support on which the stack
// grows towards higher addresses. Trying to detect it here has
// historically led to portability problems, which aren't worth it
// given the near consensus on stack growth direction.
printf("#ifdef __hppa\n"
"# define JS_STACK_GROWTH_DIRECTION (1)\n"
"#else\n"
"# define JS_STACK_GROWTH_DIRECTION (-1)\n"
"#endif\n");
printf("#endif /* js_cpucfg___ */\n");
return EXIT_SUCCESS;
}

Просмотреть файл

@ -68,12 +68,32 @@
#define JS_BITS_PER_WORD_LOG2 5
#define JS_ALIGN_OF_POINTER 4L
#else
#elif defined(__APPLE__)
#if __LITTLE_ENDIAN__
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#elif __BIG_ENDIAN__
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#endif
#error "This file is supposed to be auto-generated on most platforms, but the"
#error "static version for Windows and OS2 platforms is being used."
#error "Something's probably wrong with paths/headers/dependencies/Makefiles."
#elif defined(JS_HAVE_ENDIAN_H)
#include <endian.h>
#if defined(__BYTE_ORDER)
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#elif __BYTE_ORDER == __BIG_ENDIAN
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#endif
#else /* !defined(__BYTE_ORDER) */
#error "endian.h does not define __BYTE_ORDER. Cannot determine endianness."
#endif
#else /* !defined(HAVE_ENDIAN_H) */
#error "Cannot determine endianness of your platform. Please add support to jscpucfg.h."
#endif
#ifndef JS_STACK_GROWTH_DIRECTION

Просмотреть файл

@ -290,11 +290,7 @@
#define JS_MIN(x,y) ((x)<(y)?(x):(y))
#define JS_MAX(x,y) ((x)>(y)?(x):(y))
#ifdef _MSC_VER
# include "jscpucfg.h" /* We can't auto-detect MSVC configuration */
#else
# include "jsautocfg.h" /* Use auto-detected configuration */
#endif
#include "jscpucfg.h"
/*
* Define JS_64BIT iff we are building in an environment with 64-bit