* instead of /usr/include use the current SDK path as system include directory (/usr/include is empty with current tools) (this also removes the need to add these paths in individual Makefiles) * define _DARWIN_C_SOURCE in tcc.h to get the full set of decls from system headers (e.g. vsnprintf), similar to _GNU_SOURCE (and don't define _ANSI_SOURCE in the main Makefile anymore) * tests/tests2/Makefile: remove the -w flag, it's added when necessary in the rules generating the .expect files
Unified · Split
| @@ -58,9 +58,6 @@ TCCFLAGS-unx = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) · 57 unmodified lines | ||
| 58 | 58 | TCCFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP) |
| 59 | 59 | TCCFLAGS = $(TCCFLAGS$(CFGWIN)) |
| 60 | 60 | TCC = $(TOP)/tcc$(EXESUF) $(TCCFLAGS) |
| 61 | −ifdef CONFIG_OSX | |
| 62 | − TCCFLAGS += -D_ANSI_SOURCE | |
| 63 | −endif | |
| 64 | 61 | |
| 65 | 62 | # cross compiler targets to build |
| 66 | 63 | TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67 |
| @@ -35,6 +35,7 @@ mingw32="no" · 34 unmodified lines | ||
| 35 | 35 | LIBSUF=".a" |
| 36 | 36 | EXESUF="" |
| 37 | 37 | DLLSUF=".so" |
| 38 | +tcc_usrinclude="" | |
| 38 | 39 | tcc_sysincludepaths="" |
| 39 | 40 | tcc_libpaths="" |
| 40 | 41 | tcc_crtprefix="" |
| @@ -53,6 +54,7 @@ targetos=`uname` · 12 unmodified lines | ||
| 53 | 54 | case $targetos in |
| 54 | 55 | Darwin) |
| 55 | 56 | confvars="$confvars OSX" |
| 57 | + tcc_usrinclude="`xcrun --show-sdk-path`/usr/include" | |
| 56 | 58 | DLLSUF=".dylib" |
| 57 | 59 | ;; |
| 58 | 60 | Windows_NT|MINGW*|MSYS*|CYGWIN*) |
| @@ -401,6 +403,7 @@ fcho "Manual directory " "$mandir" · 342 unmodified lines | ||
| 401 | 403 | fcho "Info directory " "$infodir" |
| 402 | 404 | fcho "Doc directory " "$docdir" |
| 403 | 405 | fcho "Target root prefix " "$sysroot" |
| 406 | +fcho "/usr/include dir " "$tcc_usrinclude" | |
| 404 | 407 | echo "Source path $source_path" |
| 405 | 408 | echo "C compiler $cc ($gcc_major.$gcc_minor)" |
| 406 | 409 | echo "Target OS $targetos" |
| @@ -455,6 +458,7 @@ echo "/* Automatically generated by configure - do not modify */" > $TMPH · 48 unmodified lines | ||
| 455 | 458 | |
| 456 | 459 | print_inc CONFIG_SYSROOT "$sysroot" |
| 457 | 460 | print_inc CONFIG_TCCDIR "$tccdir" |
| 461 | +print_mak CONFIG_USR_INCLUDE "$tcc_usrinclude" | |
| 458 | 462 | print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths" |
| 459 | 463 | print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths" |
| 460 | 464 | print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix" |
| @@ -17,10 +17,6 @@ XFLAGS = $(XFLAGS$(XCFG)) -I$(TOP) · 16 unmodified lines | ||
| 17 | 17 | XCFG = $(or $(findstring -win,$T),-unx) |
| 18 | 18 | S = $(if $(findstring yes,$(SILENT)),@$(info * $@)) |
| 19 | 19 | |
| 20 | −ifdef CONFIG_OSX | |
| 21 | − XFLAGS += -I`xcrun --show-sdk-path`/usr/include | |
| 22 | −endif | |
| 23 | − | |
| 24 | 20 | # in order to use gcc, type: make <target>-libtcc1-usegcc=yes |
| 25 | 21 | arm-libtcc1-usegcc ?= no |
| 26 | 22 | |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #define _TCC_H |
| 23 | 23 | |
| 24 | 24 | #define _GNU_SOURCE |
| 25 | +#define _DARWIN_C_SOURCE | |
| 25 | 26 | #include "config.h" |
| 26 | 27 | |
| 27 | 28 | #include <stdarg.h> |
| @@ -217,6 +218,10 @@ extern long double strtold (const char *__nptr, char **__endptr); · 189 unmodified lines | ||
| 217 | 218 | # define CONFIG_TCC_CRTPREFIX USE_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) |
| 218 | 219 | #endif |
| 219 | 220 | |
| 221 | +#ifndef CONFIG_USR_INCLUDE | |
| 222 | +# define CONFIG_USR_INCLUDE "/usr/include" | |
| 223 | +#endif | |
| 224 | + | |
| 220 | 225 | /* Below: {B} is substituted by CONFIG_TCCDIR (rsp. -B option) */ |
| 221 | 226 | |
| 222 | 227 | /* system include paths */ |
| @@ -227,7 +232,7 @@ extern long double strtold (const char *__nptr, char **__endptr); · 4 unmodified lines | ||
| 227 | 232 | # define CONFIG_TCC_SYSINCLUDEPATHS \ |
| 228 | 233 | "{B}/include" \ |
| 229 | 234 | ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \ |
| 230 | − ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/include") | |
| 235 | + ":" ALSO_TRIPLET(CONFIG_SYSROOT CONFIG_USR_INCLUDE) | |
| 231 | 236 | # endif |
| 232 | 237 | #endif |
| 233 | 238 | |
| @@ -15,9 +15,6 @@ endif · 14 unmodified lines | ||
| 15 | 15 | ifdef CONFIG_OSX |
| 16 | 16 | SKIP += 40_stdio.test 42_function_pointer.test |
| 17 | 17 | SKIP += 113_btdll.test # no shared lib support yet |
| 18 | − FLAGS += -w | |
| 19 | − SDK := `xcrun --show-sdk-path` | |
| 20 | − TCCFLAGS += -I$(SDK)/usr/include | |
| 21 | 18 | endif |
| 22 | 19 | ifeq ($(ARCH),x86_64) |
| 23 | 20 | SKIP += 73_arm64.test |