History

macos: more adjustments for OSX systems

* 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

Michael Matz committed 6 years ago

Commit 4eff2b51 parent f18f8655 files · +10 −11Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t