From 9da66f0925818ddb12127bfcb46acf79e354cabc Mon Sep 17 00:00:00 2001
From: Toni Uhlig <matzeton@googlemail.com>
Date: Mon, 18 May 2020 11:36:56 +0200
Subject: [PATCH] configure script honors (C|LD)FLAGS

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
---
 configure | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

--- a/configure
+++ b/configure
@@ -221,8 +221,8 @@ EOF
 		NACL_LIB="nacl"
 	fi
 
-	LDFLAGS="-L $NACL_LIB_DIR"
-	CFLAGS="-I $NACL_INC_DIR"
+	LDFLAGS="$LDFLAGS -L $NACL_LIB_DIR"
+	CFLAGS="$CFLAGS -I $NACL_INC_DIR"
 
 	$CC $CFLAGS $LDFLAGS -o $TMPDIR/nacltest $TMPDIR/nacltest.c >> config.log 2>&1
 	if [ ! -x $TMPDIR/nacltest ] ; then
@@ -268,7 +268,7 @@ int main(void)
 }
 EOF
 
-	$CC \
+	$CC $CFLAGS $LDFLAGS \
 		$($PKG_CONFIG --cflags libnl-3.0 2>> config.log) \
 		$($PKG_CONFIG --cflags libnl-genl-3.0 2>> config.log) \
 		-o $TMPDIR/libnltest \
@@ -315,7 +315,7 @@ int main(void)
 }
 EOF
 
-	$CC \
+	$CC $CFLAGS $LDFLAGS \
 		$($PKG_CONFIG --cflags libnl-route-3.0 2>> config.log) \
 		-o $TMPDIR/libnlroutetest \
 		$TMPDIR/libnlroutetest.c \
@@ -350,7 +350,7 @@ int main(void)
 }
 EOF
 
-	$CC -o $TMPDIR/tpacketv3test $TMPDIR/tpacketv3test.c >> config.log 2>&1
+	$CC $CFLAGS $LDFLAGS -o $TMPDIR/tpacketv3test $TMPDIR/tpacketv3test.c >> config.log 2>&1
 	if [ ! -x $TMPDIR/tpacketv3test ] ; then
 		echo "[NO]"
 		MISSING_DEFS=1
@@ -383,7 +383,7 @@ int main(void)
 }
 EOF
 
-	$CC -o $TMPDIR/tpacketv2test $TMPDIR/tpacketv2test.c >> config.log 2>&1
+	$CC $CFLAGS $LDFLAGS -o $TMPDIR/tpacketv2test $TMPDIR/tpacketv2test.c >> config.log 2>&1
 	if [ ! -x $TMPDIR/tpacketv2test ] ; then
 		echo "[NO]"
 		MISSING_DEFS=1
@@ -410,7 +410,7 @@ int main(void)
 }
 EOF
 
-	$CC -o $TMPDIR/fopencookietest $TMPDIR/fopencookietest.c >> config.log 2>&1
+	$CC $CFLAGS $LDFLAGS -o $TMPDIR/fopencookietest $TMPDIR/fopencookietest.c >> config.log 2>&1
 	if [ ! -x $TMPDIR/fopencookietest ] ; then
 		echo "[NO]"
 		MISSING_DEFS=1
@@ -433,7 +433,7 @@ int main(void)
 }
 EOF
 
-	$CC \
+	$CC $CFLAGS $LDFLAGS \
 		$($PKG_CONFIG --cflags ncurses 2>> config.log) \
 		-o $TMPDIR/ncursestest $TMPDIR/ncursestest.c \
 		$($PKG_CONFIG --libs ncurses 2>> config.log \
@@ -476,7 +476,7 @@ int main(void)
 }
 EOF
 
-	$CC -o $TMPDIR/geoiptest $TMPDIR/geoiptest.c -lGeoIP >> config.log 2>&1
+	$CC $CFLAGS $LDFLAGS -o $TMPDIR/geoiptest $TMPDIR/geoiptest.c -lGeoIP >> config.log 2>&1
 	if [ ! -x $TMPDIR/geoiptest ] ; then
 		echo "[NO]"
 		MISSING_DEFS=1
@@ -503,7 +503,7 @@ int main(void)
 }
 EOF
 
-	$CC \
+	$CC $CFLAGS $LDFLAGS \
 		$($PKG_CONFIG --cflags libnetfilter_conntrack 2>> config.log) \
 		-o $TMPDIR/nfcttest \
 		$TMPDIR/nfcttest.c \
@@ -536,7 +536,7 @@ int main(void)
 }
 EOF
 
-	$CC -o $TMPDIR/ztest $TMPDIR/ztest.c -lz >> config.log 2>&1
+	$CC $CFLAGS $LDFLAGS -o $TMPDIR/ztest $TMPDIR/ztest.c -lz >> config.log 2>&1
 	if [ ! -x $TMPDIR/ztest ] ; then
 		echo "[NO]"
 		echo "CONFIG_LIBZ=0" >> Config
@@ -564,7 +564,7 @@ int main(void)
 }
 EOF
 
-	$CC -o $TMPDIR/urcutest $TMPDIR/urcutest.c -lurcu >> config.log 2>&1
+	$CC $CFLAGS $LDFLAGS -o $TMPDIR/urcutest $TMPDIR/urcutest.c -lurcu >> config.log 2>&1
 	if [ ! -x $TMPDIR/urcutest ] ; then
 		echo "[NO]"
 		MISSING_DEFS=1
@@ -588,7 +588,7 @@ int main(void)
 }
 EOF
 
-	$CC -o $TMPDIR/pcaptest $TMPDIR/pcaptest.c -lpcap >> config.log 2>&1
+	$CC $CFLAGS $LDFLAGS -o $TMPDIR/pcaptest $TMPDIR/pcaptest.c -lpcap >> config.log 2>&1
 	if [ ! -x $TMPDIR/pcaptest ] ; then
 		echo "[NO]"
 		echo "CONFIG_LIBPCAP=0" >> Config
@@ -638,7 +638,7 @@ int main(void)
 }
 EOF
 
-	$CC -o $TMPDIR/hwtstest $TMPDIR/hwtstest.c >> config.log 2>&1
+	$CC $CFLAGS $LDFLAGS -o $TMPDIR/hwtstest $TMPDIR/hwtstest.c >> config.log 2>&1
 	if [ ! -x $TMPDIR/hwtstest ] ; then
 		echo "[NO]"
 		echo "CONFIG_HWTSTAMP=0" >> Config
@@ -663,7 +663,7 @@ int main(void)
 }
 EOF
 
-	$CC -o $TMPDIR/clitest $TMPDIR/clitest.c -lcli >> config.log 2>&1
+	$CC $CFLAGS $LDFLAGS -o $TMPDIR/clitest $TMPDIR/clitest.c -lcli >> config.log 2>&1
 	if [ ! -x $TMPDIR/clitest ] ; then
 		echo "[NO]"
 		MISSING_DEFS=1
@@ -687,7 +687,7 @@ int main(void)
 }
 EOF
 
-	$CC -o $TMPDIR/nettest $TMPDIR/nettest.c -lnet >> config.log 2>&1
+	$CC $CFLAGS $LDFLAGS -o $TMPDIR/nettest $TMPDIR/nettest.c -lnet >> config.log 2>&1
 	if [ ! -x $TMPDIR/nettest ] ; then
 		echo "[NO]"
 		MISSING_DEFS=1
