From 3d22f52ad0c880d183f719a266a5380c26641a20 Mon Sep 17 00:00:00 2001 From: David Grove Date: Fri, 17 Jun 2016 11:39:48 -0400 Subject: [PATCH] Avoid overwriting config.h with generated header Change name of generated header file to config_ac.h and use __has_include to prefer the generated file if it is present. Avoids stomping on the config.h used by XCode when building using autotools. --- configure.ac | 2 +- src/internal.h | 4 ++++ src/shims/linux_stubs.c | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 87346354a..d4143bce0 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ AC_PREREQ(2.69) AC_INIT([libdispatch], [1.3], [libdispatch@macosforge.org], [libdispatch], [http://libdispatch.macosforge.org]) AC_REVISION([$$]) AC_CONFIG_AUX_DIR(config) -AC_CONFIG_HEADER([config/config.h]) +AC_CONFIG_HEADER([config/config_ac.h]) AC_CONFIG_MACRO_DIR([m4]) ac_clean_files=a.out.dSYM AM_MAINTAINER_MODE diff --git a/src/internal.h b/src/internal.h index f745113cd..1d092334f 100644 --- a/src/internal.h +++ b/src/internal.h @@ -27,7 +27,11 @@ #ifndef __DISPATCH_INTERNAL__ #define __DISPATCH_INTERNAL__ +#if __has_include() +#include +#else #include +#endif #define __DISPATCH_BUILDING_DISPATCH__ #define __DISPATCH_INDIRECT__ diff --git a/src/shims/linux_stubs.c b/src/shims/linux_stubs.c index b209e6f10..dad96eb17 100644 --- a/src/shims/linux_stubs.c +++ b/src/shims/linux_stubs.c @@ -18,7 +18,12 @@ #include #include + +#if __has_include() +#include +#else #include +#endif #include "pthread.h" #include "os/linux_base.h"