./configure \
--prefix="$(HOST_DIR)/usr" \
--sysconfdir="$(HOST_DIR)/etc" \
- --enable-shared --enable-static \
+ --enable-static \
$(QUIET) $(HOST_GCC_FINAL_CONF_OPT) \
)
endef
$(DISABLE_LARGEFILE) \
--with-build-time-tools=$(HOST_DIR)/usr/$(GNU_TARGET_NAME)/bin
+# Disable shared libs like libstdc++ if we do static since it confuses linking
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+HOST_GCC_FINAL_CONF_OPT += --disable-shared
+else
+HOST_GCC_FINAL_CONF_OPT += --enable-shared
+endif
+
ifeq ($(BR2_GCC_ENABLE_OPENMP),y)
HOST_GCC_FINAL_CONF_OPT += --enable-libgomp
else
endif
ifneq ($(HOST_GCC_FINAL_USR_LIBS),)
-define HOST_GCC_FINAL_INSTALL_USR_LIBS
- mkdir -p $(TARGET_DIR)/usr/lib
+define HOST_GCC_FINAL_INSTALL_STATIC_LIBS
for i in $(HOST_GCC_FINAL_USR_LIBS) ; do \
- cp -dpf $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib*/$${i}.so* \
- $(STAGING_DIR)/usr/lib/ ; \
cp -dpf $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib*/$${i}.a \
$(STAGING_DIR)/usr/lib/ ; \
+ done
+endef
+
+ifeq ($(BR2_PREFER_STATIC_LIB),)
+define HOST_GCC_FINAL_INSTALL_SHARED_LIBS
+ for i in $(HOST_GCC_FINAL_USR_LIBS) ; do \
+ cp -dpf $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib*/$${i}.so* \
+ $(STAGING_DIR)/usr/lib/ ; \
cp -dpf $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib*/$${i}.so* \
$(TARGET_DIR)/usr/lib/ ; \
done
endef
+endif
+
+define HOST_GCC_FINAL_INSTALL_USR_LIBS
+ mkdir -p $(TARGET_DIR)/usr/lib
+ $(HOST_GCC_FINAL_INSTALL_STATIC_LIBS)
+ $(HOST_GCC_FINAL_INSTALL_SHARED_LIBS)
+endef
HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_INSTALL_USR_LIBS
endif