Bug 493008 - Port |Bug 472093 - fix build system to use NTDDI_VERSION instead of random checks| to comm-central; (Bv1a) Part 2, define MOZ_WINSDK_TARGETVER and error out if the SDK is too old; r=kairo sr=Standard8
authorSerge Gautherie <sgautherie.bz@free.fr>
Thu, 04 Jun 2009 00:16:37 +0200
changeset 2762 dda9efe767998d07641828848b6eba54d385bb2a
parent 2761 81998e37543abff75a46152b22b8a2be76f399e0
child 2763 a4ee7c0f12ecd3924d1dd1e610096a656c1dbc5d
push idunknown
push userunknown
push dateunknown
reviewerskairo, Standard8
bugs493008, 472093
Bug 493008 - Port |Bug 472093 - fix build system to use NTDDI_VERSION instead of random checks| to comm-central; (Bv1a) Part 2, define MOZ_WINSDK_TARGETVER and error out if the SDK is too old; r=kairo sr=Standard8
configure.in
--- a/configure.in
+++ b/configure.in
@@ -224,16 +224,41 @@ if test ! -z "$L10NBASEDIR"; then
     elif test -d "$L10NBASEDIR"; then
         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
     else
         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
     fi
 fi
 AC_SUBST(L10NBASEDIR)
 
+dnl Check for Perl first -- needed for win32 SDK checks
+AC_PATH_PROGS(PERL, $PERL perl5 perl)
+if test -z "$PERL" || test "$PERL" = ":"; then
+    AC_MSG_ERROR([perl not found in \$PATH])
+fi
+
+
+dnl Get mozilla version from central milestone file
+MOZILLA_VERSION=`$PERL $MOZILLA_SRCDIR/config/milestone.pl -topsrcdir $MOZILLA_SRCDIR`
+
+changequote(,)
+MOZILLA_BRANCH_VERSION=`echo ${MOZILLA_VERSION} | sed -e 's/^\([0-9]\.[0-9]\.[0-9]\).*/\1/;'`
+changequote([,])
+
+MOZILLA_1_9_1_BRANCH=
+
+dnl Set the Gecko 1.9.1 branch version
+if test "$MOZILLA_BRANCH_VERSION" = "1.9.1"; then
+    MOZILLA_1_9_1_BRANCH=1
+    AC_DEFINE(MOZILLA_1_9_1_BRANCH)
+fi
+
+AC_SUBST(MOZILLA_1_9_1_BRANCH)
+
+
 dnl ========================================================
 dnl Checks for compilers.
 dnl ========================================================
 dnl Set CROSS_COMPILE in the environment when running configure
 dnl to use the cross-compile setup for now
 dnl ========================================================
 
 if test "$COMPILE_ENVIRONMENT"; then
@@ -463,16 +488,18 @@ case "$target" in
     if test -n "$GNU_CC"; then  
         WINVER=501
     else    
         WINVER=500
     fi
     ;;
 esac
 
+if test "$MOZILLA_1_9_1_BRANCH" = "1"; then
+
 MOZ_ARG_WITH_STRING(windows-version,
 [  --with-windows-version=WINVER
                           Minimum Windows version (WINVER) to support
                               400: Windows 95
                               500: Windows 2000
                               501: Windows XP],
   WINVER=$withval)
 
@@ -481,16 +508,67 @@ 400|500|501)
     ;;
 
 *)
     AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
     ;;
 
 esac
 
+dnl MOZILLA_1_9_1_BRANCH.
+else
+dnl Not MOZILLA_1_9_1_BRANCH.
+
+dnl Target the Windows Vista SDK by default
+WINSDK_TARGETVER=600
+
+MOZ_ARG_WITH_STRING(windows-version,
+[  --with-windows-version=WINSDK_TARGETVER
+                          Highest Windows version to target using this SDK
+                              502: Windows Server 2003
+                              600: Windows Vista
+                              601: Windows 7],
+  WINSDK_TARGETVER=$withval)
+
+case "$WINSDK_TARGETVER" in
+502|600|601)
+    MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
+    ;;
+
+*)
+    AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
+    ;;
+
+esac
+
+dnl Vista SDK specific api (deprecated)
+MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
+[  --disable-vista-sdk-requirements
+                           Do not build Vista SDK specific code],
+   MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
+   MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
+if test -n "$COMPILE_ENVIRONMENT"; then
+if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
+    AC_MSG_WARN([--disable-vista-sdk-requirements is deprecated, use --with-windows-version=502 instead])
+    MOZ_WINSDK_TARGETVER=05020000
+fi
+
+if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
+    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
+    AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
+    # We can't build parental controls either
+    MOZ_DISABLE_PARENTAL_CONTROLS=1
+fi
+fi
+
+AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
+
+dnl Not MOZILLA_1_9_1_BRANCH.
+fi
+
 case "$target" in
 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
     if test "$GCC" != "yes"; then
         # Check to see if we are really running in a msvc environemnt
         _WIN32_MSVC=1
         AC_CHECK_PROGS(MIDL, midl)
 
         # Make sure compilers are valid
@@ -694,16 +772,34 @@ EOF
         # Server 2003 is the highest version supported
         MOZ_WINSDK_MAXVER=0x05020000
     fi # !GNU_CC
 
     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
     # Require OS features provided by IE 5.0
     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
+
+    if test "$MOZILLA_1_9_1_BRANCH" != "1"; then
+
+    # If the maximum version supported by this SDK is lower than the target
+    # version, error out
+    AC_MSG_CHECKING([for Windows SDK being recent enough])
+    if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
+        AC_MSG_RESULT("yes")
+    else
+        AC_MSG_RESULT("no")
+        AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
+    fi
+
+    AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
+
+    # Not MOZILLA_1_9_1_BRANCH.
+    fi
+
     ;;
 esac
 
 dnl Test breaks icc on OS/2 && MSVC
 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
     AC_PROG_CC_C_O
     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
         USING_HCC=1
@@ -735,20 +831,16 @@ 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
-    AC_MSG_ERROR([perl not found in \$PATH])
-fi
 
 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
 _perl_res=$?
 AC_MSG_RESULT([$_perl_version])
 
 if test "$_perl_res" != 0; then
@@ -1663,33 +1755,16 @@ case "$host" in
     ;;
 
 *)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
     ;;
 esac
 
-dnl Get mozilla version from central milestone file
-MOZILLA_VERSION=`$PERL $MOZILLA_SRCDIR/config/milestone.pl -topsrcdir $MOZILLA_SRCDIR`
-
-changequote(,)
-MOZILLA_BRANCH_VERSION=`echo ${MOZILLA_VERSION} | sed -e 's/^\([0-9]\.[0-9]\.[0-9]\).*/\1/;'`
-changequote([,])
-
-MOZILLA_1_9_1_BRANCH=
-
-dnl Set the Gecko 1.9.1 branch version
-if test "$MOZILLA_BRANCH_VERSION" = "1.9.1"; then
-    MOZILLA_1_9_1_BRANCH=1
-    AC_DEFINE(MOZILLA_1_9_1_BRANCH)
-fi
-
-AC_SUBST(MOZILLA_1_9_1_BRANCH)
-
 dnl Get version of various core apps from the version files.
 SUNBIRD_VERSION=`cat $topsrcdir/calendar/sunbird/config/version.txt`
 SEAMONKEY_VERSION=`cat $topsrcdir/suite/config/version.txt`
 
 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
 
 dnl ========================================================
@@ -5516,16 +5591,18 @@ MOZ_ARG_DISABLE_BOOL(parental-controls,
 [  --disable-parental-controls
                            Do not build parental controls],
    MOZ_DISABLE_PARENTAL_CONTROLS=1,
    MOZ_DISABLE_PARENTAL_CONTROLS=)
 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
 fi
 
+if test "$MOZILLA_1_9_1_BRANCH" = "1"; then
+
 dnl ========================================================
 dnl Vista SDK specific api
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
 [  --disable-vista-sdk-requirements
                            Do not build Vista SDK specific code],
    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
@@ -5542,18 +5619,21 @@ case "$target" in
 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
     if test "$ac_cv_header_wpcapi_h" = "no"; then
         AC_MSG_ERROR([System header wpcapi.h is not available. See updated http://developer.mozilla.org/en/docs/wpcapi.h for details on fixing this problem.])
     fi
     ;;
 esac
 fi
 fi
+AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
+
+dnl MOZILLA_1_9_1_BRANCH.
+fi
 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
-AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
 
 dnl ========================================================
 dnl =
 dnl = Module specific options
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Individual module options)