diff --git a/erts/configure b/erts/configure index d99cc5192050..9cea09ff81c2 100755 --- a/erts/configure +++ b/erts/configure @@ -643,6 +643,7 @@ ac_func_c_list= enable_year2038=yes ac_subst_vars='LTLIBOBJS LIBOBJS +DEBUG_CXXFLAGS DEBUG_CFLAGS ERL_DETERMINISTIC CFLAGS32 @@ -26834,11 +26835,6 @@ fi -printf "%s\n" "#define ERTS_EMU_CMDLINE_FLAGS \"$STATIC_CFLAGS $CFLAGS $DEBUG_CFLAGS $EMU_THR_DEFS $DEFS $WERRORFLAGS $WFLAGS\"" >>confdefs.h - - - - @@ -26912,6 +26908,15 @@ printf "%s\n" "yes" >&6; } DEBUG_CFLAGS="-g -O0 $no_opt_CFLAGS" +no_opt_CXXFLAGS=$(echo " $CXXFLAGS" | sed 's/ -O[^ ]*/ /g') +DEBUG_CXXFLAGS="-g -O0 $no_opt_CXXFLAGS" + + + + +printf "%s\n" "#define ERTS_EMU_CMDLINE_FLAGS \"$STATIC_CFLAGS $CFLAGS $CXXFLAGS $DEBUG_CFLAGS $DEBUG_CXXFLAGS $EMU_THR_DEFS $DEFS $WERRORFLAGS $WFLAGS\"" >>confdefs.h + + ac_config_files="$ac_config_files emulator/$host/Makefile:emulator/Makefile.in epmd/src/$host/Makefile:epmd/src/Makefile.in etc/common/$host/Makefile:etc/common/Makefile.in include/internal/$host/ethread.mk:include/internal/ethread.mk.in include/internal/$host/erts_internal.mk:include/internal/erts_internal.mk.in lib_src/$host/Makefile:lib_src/Makefile.in ../make/$host/otp.mk:../make/otp.mk.in" diff --git a/erts/configure.ac b/erts/configure.ac index ce8a7da678d2..e79def7c42bf 100644 --- a/erts/configure.ac +++ b/erts/configure.ac @@ -3556,17 +3556,6 @@ fi AC_SUBST(CC32) AC_SUBST(CFLAGS32) -dnl -dnl ERTS_EMU_CMDLINE_FLAGS will force modification of config.h when -dnl the emulator command line flags are modified by configure, which -dnl in turn will make 'make' detect that files depending on config.h -dnl needs to be rebuilt. -dnl - -AC_DEFINE_UNQUOTED(ERTS_EMU_CMDLINE_FLAGS, -"$STATIC_CFLAGS $CFLAGS $DEBUG_CFLAGS $EMU_THR_DEFS $DEFS $WERRORFLAGS $WFLAGS", -[The only reason ERTS_EMU_CMDLINE_FLAGS exists is to force modification of config.h when the emulator command line flags are modified by configure]) - AC_SUBST(STATIC_CFLAGS) dnl --------------------------------------------------------------------- @@ -3667,6 +3656,21 @@ AC_MSG_RESULT([yes]) DEBUG_CFLAGS="-g -O0 $no_opt_CFLAGS" AC_SUBST(DEBUG_CFLAGS) +no_opt_CXXFLAGS=$(echo " $CXXFLAGS" | sed 's/ -O[[^ ]]*/ /g') +DEBUG_CXXFLAGS="-g -O0 $no_opt_CXXFLAGS" +AC_SUBST(DEBUG_CXXFLAGS) + +dnl +dnl ERTS_EMU_CMDLINE_FLAGS will force modification of config.h when +dnl the emulator command line flags are modified by configure, which +dnl in turn will make 'make' detect that files depending on config.h +dnl needs to be rebuilt. +dnl + +AC_DEFINE_UNQUOTED(ERTS_EMU_CMDLINE_FLAGS, +"$STATIC_CFLAGS $CFLAGS $CXXFLAGS $DEBUG_CFLAGS $DEBUG_CXXFLAGS $EMU_THR_DEFS $DEFS $WERRORFLAGS $WFLAGS", +[The only reason ERTS_EMU_CMDLINE_FLAGS exists is to force modification of config.h when the emulator command line flags are modified by configure]) + dnl ---------------------------------------------------------------------- dnl Output the result. dnl ---------------------------------------------------------------------- diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index 788784d04b93..2183ec84dde3 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -80,9 +80,11 @@ OPCODE_TABLES += \ beam/emu/trace_instrs.tab endif - -DEBUG_CFLAGS = @DEBUG_CFLAGS@ +## These are here for ease of debugging purposes, they are not used anywher CONFIGURE_CFLAGS = @CFLAGS@ +CONFIGURE_CXXFLAGS = @CXXFLAGS@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEBUG_CXXFLAGS = @DEBUG_CXXFLAGS@ # # Run this make file with TYPE set to the type of emulator you want. @@ -124,7 +126,8 @@ DIRTY_SCHEDULER_TEST=@DIRTY_SCHEDULER_TEST@ ifeq ($(TYPE),debug) TYPEMARKER = .debug -TYPE_FLAGS = $(DEBUG_CFLAGS) -DDEBUG +TYPE_FLAGS = @DEBUG_CFLAGS@ -DDEBUG +TYPE_CXXFLAGS = @DEBUG_CXXFLAGS@ ENABLE_ALLOC_TYPE_VARS += debug ifeq ($(TARGET),win32) TYPE_FLAGS += -DNO_JUMP_TABLE @@ -134,7 +137,8 @@ else ifeq ($(TYPE),gcov) TYPEMARKER = .gcov -TYPE_FLAGS = $(DEBUG_CFLAGS) -DERTS_GCOV -DNO_JUMP_TABLE -fprofile-arcs -ftest-coverage -O0 -DERTS_CAN_INLINE=0 -DERTS_INLINE= +TYPE_FLAGS = @DEBUG_CFLAGS@ -DERTS_GCOV -DNO_JUMP_TABLE -fprofile-arcs -ftest-coverage -O0 -DERTS_CAN_INLINE=0 -DERTS_INLINE= +TYPE_CXXFLAGS = @DEBUG_CXXFLAGS@ ifneq ($(findstring solaris,$(TARGET)),solaris) TYPE_LIBS = -lgcov endif @@ -143,14 +147,16 @@ else ifeq ($(TYPE),valgrind) TYPEMARKER = .valgrind -TYPE_FLAGS = $(DEBUG_CFLAGS) -DVALGRIND -DNO_JUMP_TABLE +TYPE_FLAGS = @DEBUG_CFLAGS@ -DVALGRIND -DNO_JUMP_TABLE +TYPE_CXXFLAGS = @DEBUG_CXXFLAGS@ ENABLE_ALLOC_TYPE_VARS += valgrind else ifeq ($(TYPE),asan) PURIFY = TYPEMARKER = .asan -TYPE_FLAGS = $(DEBUG_CFLAGS) -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer -DADDRESS_SANITIZER +TYPE_FLAGS = @DEBUG_CFLAGS@ -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer -DADDRESS_SANITIZER +TYPE_CXXFLAGS = @DEBUG_CXXFLAGS@ LDFLAGS += -fsanitize=address ENABLE_ALLOC_TYPE_VARS += asan else @@ -158,6 +164,7 @@ else ifeq ($(TYPE),gprof) TYPEMARKER = .gprof TYPE_FLAGS = @CFLAGS@ -DGPROF -pg -DERTS_CAN_INLINE=0 -DERTS_INLINE= +TYPE_CXXFLAGS = @CXXFLAGS@ LDFLAGS += -pg ENABLE_ALLOC_TYPE_VARS += gprof NO_INLINE_FUNCTIONS=true @@ -167,23 +174,27 @@ ifeq ($(TYPE),lcnt) TYPEMARKER = .lcnt TYPE_FLAGS = @CFLAGS@ -DERTS_ENABLE_LOCK_COUNT ENABLE_ALLOC_TYPE_VARS += lcnt +TYPE_CXXFLAGS = @CXXFLAGS@ else ifeq ($(TYPE),frmptr) OMIT_OMIT_FP=yes TYPEMARKER = .frmptr TYPE_FLAGS = @CFLAGS@ -DERTS_FRMPTR +TYPE_CXXFLAGS = @CXXFLAGS@ else ifeq ($(TYPE),icount) TYPEMARKER = .icount TYPE_FLAGS = @CFLAGS@ -DERTS_OPCODE_COUNTER_SUPPORT +TYPE_CXXFLAGS = @CXXFLAGS@ else # If type isn't one of the above, it *is* opt type... override TYPE=opt TYPEMARKER = TYPE_FLAGS = @CFLAGS@ +TYPE_CXXFLAGS = @CXXFLAGS@ endif endif endif @@ -276,7 +287,7 @@ ifeq ($(FLAVOR),jit) CFLAGS += -DBEAMASM=1 ENABLE_ALLOC_TYPE_VARS += beamasm endif -CXXFLAGS = $(filter-out -Werror=implicit -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement,$(CFLAGS)) @CXXFLAGS@ +CXXFLAGS = $(filter-out -Werror=implicit -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement,$(CFLAGS)) $(TYPE_CXXFLAGS) HCC = @HCC@ LD = @LD@ DEXPORT = @DEXPORT@