summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2016-12-06 23:10:58 +0100
committerPali Rohár <pali.rohar@gmail.com>2016-12-06 23:10:58 +0100
commit5e79d651caee6b7a81097ae432b829e3da952261 (patch)
treeffaeb6d2a7b1618fb6fd78ab8541cc5284ba5373
parent676da477510cb1966a74273f89c8aa64654a1d49 (diff)
download0xFFFF-5e79d651caee6b7a81097ae432b829e3da952261.tar.bz2
all: Compile globally without _GNU_SOURCE, define _BSD_SOURCE or _GNU_SOURCE where needed
-rw-r--r--src/Makefile2
-rw-r--r--src/cal.c6
-rw-r--r--src/disk.c6
-rw-r--r--src/libusb-sniff.c4
4 files changed, 17 insertions, 1 deletions
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
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 <http://www.gnu.org/licenses/>.
*/
+#ifdef __linux__
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#endif
+
#include <fcntl.h>
#include <libgen.h>
#include <unistd.h>
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>