Bug 1906817 - Move MOZ_CONFIGURE_OPTIMIZE_FLAGS check from old-configure to moz.configure r=glandium

This only checks MOZ_CONFIGURE_OPTIMIZE_FLAGS while previous version was
also checking -O2 / -O3 flags, which is probably not necessary.

Differential Revision: https://phabricator.services.mozilla.com/D216097
This commit is contained in:
serge-sans-paille 2024-08-02 06:59:32 +00:00
parent f650da75e7
commit 28c2dc53b1
3 changed files with 17 additions and 34 deletions

View File

@ -3878,3 +3878,20 @@ dtrace = check_header(
set_config("HAVE_DTRACE", True, when=dtrace)
set_define("INCLUDE_MOZILLA_DTRACE", True, when=dtrace)
@depends(
try_compile(
includes=["stdio.h"],
body='puts("demat");',
flags=moz_optimize_flags,
language="C",
check_msg="for valid C compiler optimization flags",
),
moz_optimize_flags,
when=moz_optimize,
)
@imports(_from="mozbuild.shellutil", _import="quote")
def check_optimization_flags(check_result, moz_optimize_flags):
if not check_result:
die(f"Invalid C compiler optimization flags: {quote(*moz_optimize_flags)}")

View File

@ -90,23 +90,6 @@ if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
fi
if test "$COMPILE_ENVIRONMENT"; then
if test -n "$MOZ_OPTIMIZE"; then
AC_MSG_CHECKING([for valid optimization flags])
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
AC_TRY_COMPILE([#include <stdio.h>],
[printf("Hello World\n");],
_results=yes,
_results=no)
AC_MSG_RESULT([$_results])
if test "$_results" = "no"; then
AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
fi
CFLAGS=$_SAVE_CFLAGS
fi
fi # COMPILE_ENVIRONMENT
AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
dnl ========================================================

View File

@ -134,23 +134,6 @@ if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
fi
if test "$COMPILE_ENVIRONMENT"; then
if test -n "$MOZ_OPTIMIZE"; then
AC_MSG_CHECKING([for valid C compiler optimization flags])
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
AC_TRY_COMPILE([#include <stdio.h>],
[printf("Hello World\n");],
_results=yes,
_results=no)
AC_MSG_RESULT([$_results])
if test "$_results" = "no"; then
AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
fi
CFLAGS=$_SAVE_CFLAGS
fi
fi # COMPILE_ENVIRONMENT
AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)