From 90693c6d045b8af9854d347605dd9b437680ddf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Wed, 26 Jul 2023 10:12:29 -0300 Subject: [PATCH] Fix build on older glibc versions. _POSIX_C_SOURCE is necessary for getopt(3), and _DEFAULT_SOURCE is necessary for the d_type enumerations in struct dirent. Since we are here, use the C11 standard explicitly. These fixes only allow us to build with glibc>=2.28, which is when the header was added [1], necessary to access the thread_local macro. [1] https://stackoverflow.com/a/22875599 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3f8207d..bd814f7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ OPT = -O2 -CFLAGS = -Wall -Wextra $(OPT) +CFLAGS = -std=c11 -D_POSIX_C_SOURCE=200809UL -D_DEFAULT_SOURCE -Wall -Wextra $(OPT) .PHONY: all