From 2ae815391d70681e8940490ea141e8f16582b4bc Mon Sep 17 00:00:00 2001
From: midipix <writeonce@midipix.org>
Date: Tue, 15 Jun 2021 14:12:02 +0000
Subject: build system: configure: config_ccenv(): refined --sysroot related
 logic.

---
 configure | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index eca4c0c..807d556 100755
--- a/configure
+++ b/configure
@@ -846,15 +846,18 @@ config_ccenv()
 		exit 2
 	fi
 
-	# add the library directory to the linker library path
+	# add the include and library directories to the compiler and linker search path
 	if [ "$mb_cchost" = "$mb_native_cchost" ]; then
+		mb_cflags_last="$mb_cflags_last -I$mb_includedir"
 		mb_ldflags_last="$mb_ldflags_last -L$mb_libdir"
 	else
 		case "$mb_libdir" in
 			/*)
+				mb_ldflags_last="$mb_cflags_last -I$mb_sysroot/.$mb_includedir"
 				mb_ldflags_last="$mb_ldflags_last -L$mb_sysroot/.$mb_libdir"
 				;;
 			*)
+				mb_ldflags_last="$mb_cflags_last -I$mb_includedir"
 				mb_ldflags_last="$mb_ldflags_last -L$mb_libdir"
 		esac
 	fi
-- 
cgit v1.2.3