diff options
-rw-r--r-- | aclocal.m4 | 18 | ||||
-rw-r--r-- | configure.ac | 22 | ||||
-rw-r--r-- | libffi/ghc.mk | 6 | ||||
-rw-r--r-- | mk/config.mk.in | 10 | ||||
-rw-r--r-- | rules/build-package-data.mk | 2 | ||||
-rw-r--r-- | rules/distdir-way-opts.mk | 4 |
6 files changed, 43 insertions, 19 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index fe83327fe7..53bd165bec 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -4,6 +4,24 @@ # ensure we don't clash with any pre-supplied autoconf ones. +# FPTOOLS_SET_C_LD_FLAGS +# ---------------------------------- +# Set the C and LD flags for a given platform +AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS], +[ + case $$1 in + i386-apple-darwin|powerpc-apple-darwin) + $2="$$2 -m32" + $3="$$3 -m32" + ;; + x86_64-apple-darwin) + $2="$$2 -m64" + $3="$$3 -m64" + ;; + esac +]) + + # FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN # ---------------------------------- # Little endian Arm on Linux with some ABIs has big endian word order diff --git a/configure.ac b/configure.ac index c0ca168787..2be74e64e9 100644 --- a/configure.ac +++ b/configure.ac @@ -313,20 +313,18 @@ case $host in ;; i386-apple-darwin|powerpc-apple-darwin) soext='.dylib' - CFLAGS="$CFLAGS -m32" - LDFLAGS="$LDFLAGS -m32" - CONF_CC_OPTS="$CONF_CC_OPTS -m32" - CONF_LD_OPTS="$CONF_LD_OPTS -m32" ;; x86_64-apple-darwin) soext='.dylib' - CFLAGS="$CFLAGS -m64" - LDFLAGS="$LDFLAGS -m64" - CONF_CC_OPTS="$CONF_CC_OPTS -m64" - CONF_LD_OPTS="$CONF_LD_OPTS -m64" ;; esac +FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS]) +FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_LD_OPTS_STAGE0]) +FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_LD_OPTS_STAGE1]) +# Stage 3 won't be supported by cross-compilation +FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_LD_OPTS_STAGE2]) + checkArch() { case $1 in alpha|arm|hppa|hppa1_1|i386|ia64|m68k|mips|mipseb|mipsel|powerpc|powerpc64|rs6000|s390|sparc|sparc64|vax|x86_64) @@ -569,8 +567,12 @@ FP_GCC_EXTRA_FLAGS dnl ** figure out how to invoke cpp directly (gcc -E is no good) AC_PROG_CPP -AC_SUBST(CONF_CC_OPTS) -AC_SUBST(CONF_LD_OPTS) +AC_SUBST(CONF_CC_OPTS_STAGE0) +AC_SUBST(CONF_CC_OPTS_STAGE1) +AC_SUBST(CONF_CC_OPTS_STAGE2) +AC_SUBST(CONF_LD_OPTS_STAGE0) +AC_SUBST(CONF_LD_OPTS_STAGE1) +AC_SUBST(CONF_LD_OPTS_STAGE2) dnl ** figure out how to do context diffs FP_PROG_CONTEXT_DIFF diff --git a/libffi/ghc.mk b/libffi/ghc.mk index f136600060..d8a3d27a5e 100644 --- a/libffi/ghc.mk +++ b/libffi/ghc.mk @@ -116,8 +116,8 @@ $(libffi_STAMP_CONFIGURE): LD=$(LD) \ AR=$(AR) \ NM=$(NM) \ - CFLAGS="$(SRC_CC_OPTS) $(CONF_CC_OPTS) -w" \ - LDFLAGS="$(SRC_LD_OPTS) $(CONF_LD_OPTS) -w" \ + CFLAGS="$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE1) -w" \ + LDFLAGS="$(SRC_LD_OPTS) $(CONF_LD_OPTS_STAGE1) -w" \ "$(SHELL)" configure \ --enable-static=yes \ --enable-shared=$(libffi_EnableShared) \ @@ -173,7 +173,7 @@ $(eval $(call all-target,libffi,$(INSTALL_HEADERS) $(INSTALL_LIBS))) libffi/dist-install/build/HSffi.o: libffi/dist-install/build/libHSffi.a cd libffi/dist-install/build && \ touch empty.c && \ - "$(CC)" $(SRC_CC_OPTS) $(CONF_CC_OPTS) -c empty.c -o HSffi.o + "$(CC)" $(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE1) -c empty.c -o HSffi.o $(eval $(call all-target,libffi,libffi/dist-install/build/HSffi.o)) diff --git a/mk/config.mk.in b/mk/config.mk.in index 4d9e01b836..2daf62354c 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -535,14 +535,18 @@ endif # C compiler and linker flags from configure (e.g. -m<blah> to select # correct C compiler backend). -CONF_CC_OPTS = @CONF_CC_OPTS@ -CONF_LD_OPTS = @CONF_LD_OPTS@ +CONF_CC_OPTS_STAGE0 = @CONF_CC_OPTS_STAGE0@ +CONF_CC_OPTS_STAGE1 = @CONF_CC_OPTS_STAGE1@ +CONF_CC_OPTS_STAGE2 = @CONF_CC_OPTS_STAGE2@ +CONF_LD_OPTS_STAGE0 = @CONF_LD_OPTS_STAGE0@ +CONF_LD_OPTS_STAGE1 = @CONF_LD_OPTS_STAGE1@ +CONF_LD_OPTS_STAGE2 = @CONF_LD_OPTS_STAGE2@ ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux" CONF_CC_OPTS += -G0 endif -SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS) $(CONF_CC_OPTS))) +SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE0))) SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d)) #----------------------------------------------------------------------------- diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk index f508b8163a..2732aa3738 100644 --- a/rules/build-package-data.mk +++ b/rules/build-package-data.mk @@ -31,7 +31,7 @@ endif # We filter out -Werror from SRC_CC_OPTS, because when configure tests # for a feature it may not generate warning-free C code, and thus may # think that the feature doesn't exist if -Werror is on. -$1_$2_CONFIGURE_OPTS += --configure-option=CFLAGS="$$(filter-out -Werror,$$(SRC_CC_OPTS)) $$(CONF_CC_OPTS) $$($1_CC_OPTS) $$($1_$2_CC_OPTS)" +$1_$2_CONFIGURE_OPTS += --configure-option=CFLAGS="$$(filter-out -Werror,$$(SRC_CC_OPTS)) $$(CONF_CC_OPTS_STAGE$3) $$($1_CC_OPTS) $$($1_$2_CC_OPTS)" $1_$2_CONFIGURE_OPTS += --configure-option=LDFLAGS="$$(SRC_LD_OPTS) $$($1_LD_OPTS) $$($1_$2_LD_OPTS)" ifneq "$$(ICONV_INCLUDE_DIRS)" "" diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk index a81aa22597..06fbb0b811 100644 --- a/rules/distdir-way-opts.mk +++ b/rules/distdir-way-opts.mk @@ -82,7 +82,7 @@ $1_$2_CC_INC_FLAGS:=$$(shell for i in $$($1_$2_DEP_INCLUDE_DIRS); do echo $$($1_ endif $1_$2_DIST_CC_OPTS = \ - $$(CONF_CC_OPTS) \ + $$(CONF_CC_OPTS_STAGE$4) \ $$(SRC_CC_OPTS) \ $$($1_CC_OPTS) \ $$(foreach dir,$$(filter-out /%,$$($1_$2_INCLUDE_DIRS)),-I$1/$$(dir)) \ @@ -97,7 +97,7 @@ $1_$2_DIST_LD_LIB_DIRS:=$$(shell for i in $$($1_$2_DEP_LIB_DIRS); do echo \"-L$$ endif $1_$2_DIST_LD_OPTS = \ - $$(CONF_LD_OPTS) \ + $$(CONF_LD_OPTS_STAGE$4) \ $$(SRC_LD_OPTS) \ $$($1_LD_OPTS) \ $$($1_$2_LD_OPTS) \ |