bug 403224 - build config fixes to build spidermonkey with icc. r=bsmedberg
authorted.mielczarek@gmail.com
Tue, 18 Mar 2008 10:37:00 -0700
changeset 13232 395b42a9c5d938614534957690c0f6aa4c7d9002
parent 13231 ed336accd93a8421834f83a98aee8bbbef90d275
child 13233 9b095d793312303ee68d4451eb646f863d75f5bf
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg
bugs403224
milestone1.9b5pre
bug 403224 - build config fixes to build spidermonkey with icc. r=bsmedberg
build/macosx/js-icc-flight.mk
build/macosx/universal/mozconfig
config/autoconf.mk.in
configure.in
new file mode 100644
--- /dev/null
+++ b/build/macosx/js-icc-flight.mk
@@ -0,0 +1,16 @@
+OBJDIR_ICC = $(MOZ_OBJDIR)/js-icc
+OBJDIR_X86 = $(MOZ_OBJDIR)/i386
+
+include $(OBJDIR_X86)/config/autoconf.mk
+include $(TOPSRCDIR)/config/config.mk
+
+ifdef MOZ_DEBUG
+DBGTAG = Debug
+else
+DBGTAG =
+endif
+
+# Just copy the icc-produced libmozjs.dylib over
+postflight_all:
+	echo "Postflight: copying libmozjs.dylib..."
+	$(INSTALL) $(OBJDIR_ICC)/dist/bin/libmozjs.dylib $(OBJDIR_X86)/dist/$(MOZ_APP_DISPLAYNAME)$(DBGTAG).app/Contents/MacOS/
--- a/build/macosx/universal/mozconfig
+++ b/build/macosx/universal/mozconfig
@@ -47,16 +47,17 @@ ac_add_app_options ppc  --target=powerpc
 ac_add_app_options i386 --target=i386-apple-darwin$DARWIN_VERSION
 
 ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.4u.sdk
 
 # $MOZ_BUILD_APP is only defined when sourced by configure.  That's not a
 # problem, because the variables it affects only need to be set for
 # configure.
 if test -n "$MOZ_BUILD_APP" ; then
+if test "$MOZ_BUILD_APP" = "i386" -o  "$MOZ_BUILD_APP" = "ppc"; then
   TARGET_CPU=$MOZ_BUILD_APP
   GCC_VERSION=4.0
 
   # It's not strictly necessary to specify -arch during native builds, but it
   # makes the merged about:buildconfig easier to follow, and it reduces
   # conditionalized differences between builds.
   CC="gcc-$GCC_VERSION -arch $TARGET_CPU"
   CXX="g++-$GCC_VERSION -arch $TARGET_CPU"
@@ -84,8 +85,9 @@ if test -n "$MOZ_BUILD_APP" ; then
     CROSS_COMPILE=1
   fi
 
   # Each per-CPU build should be entirely oblivious to the fact that a
   # universal binary will be produced.  The exception is packager.mk, which
   # needs to know to look for universal bits when building the .dmg.
   UNIVERSAL_BINARY=1
 fi
+fi
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -338,16 +338,18 @@ NS_USE_NATIVE = @NS_USE_NATIVE@
 CC		    = @CC@
 CXX		    = @CXX@
 
 GNU_AS		= @GNU_AS@
 GNU_LD		= @GNU_LD@
 GNU_CC		= @GNU_CC@
 GNU_CXX		= @GNU_CXX@
 HAVE_GCC3_ABI	= @HAVE_GCC3_ABI@
+INTEL_CC	= @INTEL_CC@
+INTEL_CXX	= @INTEL_CXX@
 
 HOST_CC		= @HOST_CC@
 HOST_CXX	= @HOST_CXX@
 HOST_CFLAGS	= @HOST_CFLAGS@
 HOST_CXXFLAGS	= @HOST_CXXFLAGS@
 HOST_OPTIMIZE_FLAGS = @HOST_OPTIMIZE_FLAGS@
 HOST_NSPR_MDCPUCFG = @HOST_NSPR_MDCPUCFG@
 HOST_AR		= @HOST_AR@
--- a/configure.in
+++ b/configure.in
@@ -370,16 +370,30 @@ if test "`echo | $LD -v 2>&1 | grep -c G
     GNU_LD=1
 fi
 if test "$GNU_CC"; then
     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
         GCC_USE_GNU_LD=1
     fi
 fi
 
+INTEL_CC=
+INTEL_CXX=
+if test "$GCC" = yes; then
+   if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
+     INTEL_CC=1
+   fi
+fi
+
+if test "$GXX" = yes; then
+   if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
+     INTEL_CXX=1
+   fi
+fi
+
 dnl Special win32 checks
 dnl ========================================================
 case "$target" in
 *-wince)
     WINVER=500
     ;;
 *)
     if test -n "$GNU_CC"; then  
@@ -605,16 +619,18 @@ fi # COMPILE_ENVIRONMENT
 
 AC_SUBST(MIDL_FLAGS)
 AC_SUBST(_MSC_VER)
 
 AC_SUBST(GNU_AS)
 AC_SUBST(GNU_LD)
 AC_SUBST(GNU_CC)
 AC_SUBST(GNU_CXX)
+AC_SUBST(INTEL_CC)
+AC_SUBST(INTEL_CXX)
 
 dnl ========================================================
 dnl Checks for programs.
 dnl ========================================================
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PATH_PROGS(PERL, $PERL perl5 perl )
 if test -z "$PERL" || test "$PERL" = ":"; then
@@ -738,16 +754,17 @@ MOZ_ARG_ENABLE_STRING(macos-target,
                           Set the minimum MacOS version needed at runtime],
                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
 
 case "$target" in
 *-darwin*)
     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
         dnl Use the specified value
         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
+        AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
         dnl No value specified on the command line or in the environment,
         dnl use the lesser of the application's minimum or the architecture's
         dnl minimum.
         export MACOSX_DEPLOYMENT_TARGET=10.4
     fi
     ;;
 esac
@@ -1270,24 +1287,33 @@ if test "$GNU_CC"; then
     # -Wall - turn on all warnings
     # -pedantic - make compiler warn about non-ANSI stuff, and
     #             be a little bit stricter
     # Warnings slamm took out for now (these were giving more noise than help):
     # -Wbad-function-cast - warns when casting a function to a new return type
     # -Wconversion - complained when char's or short's were used a function args
     # -Wshadow - removed because it generates more noise than help --pete
     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
-    if test "$CPU_ARCH" != "ia64" && test "$CPU_ARCH" != "sparc"; then
+    if test "$CPU_ARCH" != "ia64" && test "$CPU_ARCH" != "sparc" \
+       && test -z "$INTEL_CC"; then
         # don't use -Wcast-align on ia64 or sparc, it's noisy on those platforms
+        # icc doesn't support this flag.
         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
     fi
 
     dnl Turn pedantic on but disable the warnings for long long
     _PEDANTIC=1
-    _IGNORE_LONG_LONG_WARNINGS=1
+
+    if test -z "$INTEL_CC"; then
+      _IGNORE_LONG_LONG_WARNINGS=1
+      _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
+    else
+      _IGNORE_LONG_LONG_WARNINGS=
+    fi
+
 
     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
     _USE_CPP_INCLUDE_FLAG=1
 else
     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
 
     DSO_LDOPTS='-shared'
@@ -1301,18 +1327,20 @@ else
     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
 fi
 
 if test "$GNU_CXX"; then
     # FIXME: Let us build with strict aliasing. bug 414641.
     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
     # Turn on GNU specific features
     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wconversion -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
-    if test "$CPU_ARCH" != "ia64" && test "$CPU_ARCH" != "sparc"; then
+    if test "$CPU_ARCH" != "ia64" && test "$CPU_ARCH" != "sparc" \
+       && test -z "$INTEL_CC"; then
         # don't use -Wcast-align on ia64 or sparc, it's noisy on those platforms
+        # icc doesn't support this flag.
         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
     fi
 
     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
     _USE_CPP_INCLUDE_FLAG=1
 else
     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
 fi
@@ -6634,16 +6662,23 @@ else
   fi
   # don't really care, this is an old GCC
   PROFILE_GEN_LDFLAGS=
   PROFILE_USE_LDFLAGS=
 fi
 
 CFLAGS="$_SAVE_CFLAGS"
 
+if test -n $INTEL_CC; then
+  PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
+  PROFILE_GEN_LDFLAGS=
+  PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
+  PROFILE_USE_LDFLAGS=
+fi
+
 AC_SUBST(PROFILE_GEN_CFLAGS)
 AC_SUBST(PROFILE_GEN_LDFLAGS)
 AC_SUBST(PROFILE_USE_CFLAGS)
 AC_SUBST(PROFILE_USE_LDFLAGS)
 
 AC_LANG_CPLUSPLUS
 
 dnl ========================================================