From 5e79d651caee6b7a81097ae432b829e3da952261 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Tue, 6 Dec 2016 23:10:58 +0100 Subject: all: Compile globally without _GNU_SOURCE, define _BSD_SOURCE or _GNU_SOURCE where needed --- src/Makefile | 2 +- src/cal.c | 6 ++++++ src/disk.c | 6 ++++++ src/libusb-sniff.c | 4 ++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 6b8ef08..94a8790 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,7 +9,7 @@ CC = gcc CROSS_CC = $(CROSS_COMPILE)$(CC) HOST_CC = $(HOST_COMPILE)$(CC) -CPPFLAGS += -DVERSION=\"$(VERSION)\" -DBUILD_DATE="\"$(BUILD_DATE)\"" -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L +CPPFLAGS += -DVERSION=\"$(VERSION)\" -DBUILD_DATE="\"$(BUILD_DATE)\"" -D_POSIX_C_SOURCE=200809L CFLAGS += -W -Wall -O2 -pedantic -std=c99 LIBS += -lusb diff --git a/src/cal.c b/src/cal.c index 60a2de1..a90546f 100644 --- a/src/cal.c +++ b/src/cal.c @@ -20,6 +20,12 @@ /* This is simple CAL parser form Calvaria */ +#ifdef __linux__ +#ifndef _BSD_SOURCE +#define _BSD_SOURCE +#endif +#endif + #include #include #include diff --git a/src/disk.c b/src/disk.c index b8e9f51..11df4af 100644 --- a/src/disk.c +++ b/src/disk.c @@ -16,6 +16,12 @@ along with this program. If not, see . */ +#ifdef __linux__ +#ifndef _BSD_SOURCE +#define _BSD_SOURCE +#endif +#endif + #include #include #include diff --git a/src/libusb-sniff.c b/src/libusb-sniff.c index ea7ef48..91f7872 100644 --- a/src/libusb-sniff.c +++ b/src/libusb-sniff.c @@ -21,7 +21,11 @@ /* usage: sudo USBSNIFF_WAIT=1 LD_PRELOAD=./libusb-sniff.so flasher-3.5 ... */ /* usage: sudo USBSNIFF_SKIP_READ=1 USBSNIFF_SKIP_WRITE=1 LD_PRELOAD=./libusb-sniff.so flasher-3.5 ... */ +/* Enable RTLD_NEXT for glibc */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif + #include #include #include -- cgit v1.2.3