Skip to content

Commit 10c9991

Browse files
dgrove-ossdas
authored andcommitted
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. Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
1 parent 7f2a683 commit 10c9991

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ AC_PREREQ(2.69)
66
AC_INIT([libdispatch], [1.3], [libdispatch@macosforge.org], [libdispatch], [http://libdispatch.macosforge.org])
77
AC_REVISION([$$])
88
AC_CONFIG_AUX_DIR(config)
9-
AC_CONFIG_HEADER([config/config.h])
9+
AC_CONFIG_HEADER([config/config_ac.h])
1010
AC_CONFIG_MACRO_DIR([m4])
1111
ac_clean_files=a.out.dSYM
1212
AM_MAINTAINER_MODE

src/internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
#ifndef __DISPATCH_INTERNAL__
2828
#define __DISPATCH_INTERNAL__
2929

30+
#if __has_include(<config/config_ac.h>)
31+
#include <config/config_ac.h>
32+
#else
3033
#include <config/config.h>
34+
#endif
3135

3236
#define __DISPATCH_BUILDING_DISPATCH__
3337
#define __DISPATCH_INDIRECT__

src/shims/linux_stubs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818

1919
#include <stdint.h>
2020
#include <syscall.h>
21+
22+
#if __has_include(<config/config_ac.h>)
23+
#include <config/config_ac.h>
24+
#else
2125
#include <config/config.h>
26+
#endif
2227

2328
#include "pthread.h"
2429
#include "os/linux_base.h"

0 commit comments

Comments
 (0)