From 2c4d653df0ae16bb221eb2a08314a051301236b5 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 1 Nov 2018 21:58:31 -0400 Subject: util: Wrap __has_include() --- mtab.c | 6 +----- util.c | 2 +- util.h | 6 ++++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mtab.c b/mtab.c index 4d9e1d8..a35641d 100644 --- a/mtab.c +++ b/mtab.c @@ -24,11 +24,7 @@ #include #include -#ifndef __has_include -# define __has_include(header) 0 -#endif - -#if __GLIBC__ || __has_include() +#if __GLIBC__ || BFS_HAS_INCLUDE() # define BFS_MNTENT 1 #elif BSD # define BFS_MNTINFO 1 diff --git a/util.c b/util.c index 64785be..7f68e7c 100644 --- a/util.c +++ b/util.c @@ -30,7 +30,7 @@ #include #include -#if __GLIBC__ || __has_include() +#if __GLIBC__ || BFS_HAS_INCLUDE() # include #endif diff --git a/util.h b/util.h index 18fc318..920d6e9 100644 --- a/util.h +++ b/util.h @@ -28,6 +28,12 @@ // Some portability concerns +#ifdef __has_include +# define BFS_HAS_INCLUDE(header) __has_include(header) +#else +# define BFS_HAS_INCLUDE(header) false +#endif + #if !defined(FNM_CASEFOLD) && defined(FNM_IGNORECASE) # define FNM_CASEFOLD FNM_IGNORECASE #endif -- cgit v1.2.3