-#
-# ./configure detects whether the host compiler supports
-# -fno-stack-protector but only sets STAGE2_CFLAGS accordingly
-#
-define Build/Compile
- $(MAKE) -C $(PKG_BUILD_DIR) \
- GRUB_CFLAGS="\$$$$(STAGE2_CFLAGS)" \
- STAGE1_CFLAGS="\$$$$(STAGE2_CFLAGS)"
+MY_CONFIGURE_ARGS += \
+ --disable-auto-linux-mem-opt \
+ --disable-hercules \
+ --without-curses \
+
+MY_CONFIGURE_VARS += \
+ grub_cv_prog_objcopy_absolute=yes \
+
+CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS)
+
+CONFIGURE_VARS += $(MY_CONFIGURE_VARS)
+
+ifeq ($(HOST_OS),Darwin)
+ HOST_CFLAGS += $(call host-cc-option,-m32)
+ HOST_CFLAGS += $(call host-cc-option,-fnested-functions)
+endif
+
+HOST_CFLAGS += $(call host-cc-option,-fno-stack-protector)
+HOST_CFLAGS += $(call host-cc-option,-U_FORTIFY_SOURCE)
+
+HOST_CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS) \
+ --sbindir="$(STAGING_DIR_HOST)/bin" \
+ --disable-graphics \
+
+HOST_CONFIGURE_VARS += $(MY_CONFIGURE_VARS)
+
+define Host/Configure
+ (cd $(HOST_BUILD_DIR); aclocal && autoconf && automake)
+ $(call Host/Configure/Default)