From 4a9cc66d1e6f8b6a0ab00f4d2c1c71a79777e197 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sat, 22 Jun 2019 14:13:03 +0200 Subject: [PATCH 1/2] Use the compiler to find libftdi The libfdti detection, using ldconfig, only searches for the build architecture libftdi, which means infnoise can't be cross-compiled. By checking whether the compiler knows about the library we can check for the host architecture's library and support build scenarios which ldconfig doesn't know about, in particular cross-building. --- software/Makefile.linux | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/software/Makefile.linux b/software/Makefile.linux index 1e3b7c1..85320c7 100644 --- a/software/Makefile.linux +++ b/software/Makefile.linux @@ -10,7 +10,7 @@ CFLAGS = -Wall -Wextra -Werror -std=c99 -O3 -fPIC -I Keccak -I /usr/include/libf -DGIT_DATE=\"$(GIT_DATE)\"\ -DLINUX -FOUND = $(shell /sbin/ldconfig -p | grep --silent libftdi.so && echo found) +FOUND = $(shell $(CC) -o /dev/null -x c /dev/null -shared -lftdi 2>/dev/null && echo found) ifeq ($(FOUND), found) FTDI= -lftdi else From 132683d4b5ce0902468b666cba63baea36e97f0c Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Sat, 22 Jun 2019 14:17:44 +0200 Subject: [PATCH 2/2] Merge the FTDI construction Since there's already a conditional in the shell invocation, it might as well be used to determine the value of FTDI directly. Signed-off-by: Stephen Kitt --- software/Makefile.linux | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/software/Makefile.linux b/software/Makefile.linux index 85320c7..db48aa5 100644 --- a/software/Makefile.linux +++ b/software/Makefile.linux @@ -10,12 +10,7 @@ CFLAGS = -Wall -Wextra -Werror -std=c99 -O3 -fPIC -I Keccak -I /usr/include/libf -DGIT_DATE=\"$(GIT_DATE)\"\ -DLINUX -FOUND = $(shell $(CC) -o /dev/null -x c /dev/null -shared -lftdi 2>/dev/null && echo found) -ifeq ($(FOUND), found) - FTDI= -lftdi -else - FTDI= -lftdi1 -endif +FTDI = $(shell $(CC) -o /dev/null -x c /dev/null -shared -lftdi 2>/dev/null && echo -lftdi || echo -lftdi1) all: libinfnoise.a libinfnoise.so infnoise