mtd: fix build on riscv
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Tue, 20 Nov 2018 18:52:37 +0000 (19:52 +0100)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Wed, 21 Nov 2018 19:58:51 +0000 (20:58 +0100)
Define _REENTRANT otherwise pthread detection will fail

Fixes:
 - http://autobuild.buildroot.org/results/b0e7978a997a2aae383161455b5d898b8c28e2e1

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/mtd/mtd.mk

index 13e501fc332e8092676cf97f51b4a19e8c53177e..2d627ffa3d62703a1dd065e82a44842c556ad4b9 100644 (file)
@@ -11,6 +11,13 @@ MTD_LICENSE = GPL-2.0
 MTD_LICENSE_FILES = COPYING
 MTD_INSTALL_STAGING = YES
 
+# gcc on riscv doesn't define _REENTRANT when -pthread is passed while
+# it should. Compensate this deficiency here otherwise mtd configure
+# script doesn't find that thread support is enabled.
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS):$(BR2_riscv),y:y)
+MTD_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -D_REENTRANT"
+endif
+
 ifeq ($(BR2_PACKAGE_MTD_JFFS_UTILS),y)
 MTD_DEPENDENCIES += zlib lzo host-pkgconf
 MTD_CONF_OPTS += --with-jffs