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
5858 TCCFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP)
5959 TCCFLAGS = $(TCCFLAGS$(CFGWIN))
6060 TCC = $(TOP)/tcc$(EXESUF) $(TCCFLAGS)
61−ifdef CONFIG_OSX
62− TCCFLAGS += -D_ANSI_SOURCE
63−endif
6461
6562 # cross compiler targets to build
6663 TCC_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
3535 LIBSUF=".a"
3636 EXESUF=""
3737 DLLSUF=".so"
38+tcc_usrinclude=""
3839 tcc_sysincludepaths=""
3940 tcc_libpaths=""
4041 tcc_crtprefix=""
@@ -53,6 +54,7 @@ targetos=`uname` · 12 unmodified lines
5354 case $targetos in
5455 Darwin)
5556 confvars="$confvars OSX"
57+ tcc_usrinclude="`xcrun --show-sdk-path`/usr/include"
5658 DLLSUF=".dylib"
5759 ;;
5860 Windows_NT|MINGW*|MSYS*|CYGWIN*)
@@ -401,6 +403,7 @@ fcho "Manual directory " "$mandir" · 342 unmodified lines
401403 fcho "Info directory " "$infodir"
402404 fcho "Doc directory " "$docdir"
403405 fcho "Target root prefix " "$sysroot"
406+fcho "/usr/include dir " "$tcc_usrinclude"
404407 echo "Source path $source_path"
405408 echo "C compiler $cc ($gcc_major.$gcc_minor)"
406409 echo "Target OS $targetos"
@@ -455,6 +458,7 @@ echo "/* Automatically generated by configure - do not modify */" > $TMPH · 48 unmodified lines
455458
456459 print_inc CONFIG_SYSROOT "$sysroot"
457460 print_inc CONFIG_TCCDIR "$tccdir"
461+print_mak CONFIG_USR_INCLUDE "$tcc_usrinclude"
458462 print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
459463 print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths"
460464 print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
lib/Makefile+0−4
@@ -17,10 +17,6 @@ XFLAGS = $(XFLAGS$(XCFG)) -I$(TOP) · 16 unmodified lines
1717 XCFG = $(or $(findstring -win,$T),-unx)
1818 S = $(if $(findstring yes,$(SILENT)),@$(info * $@))
1919
20−ifdef CONFIG_OSX
21− XFLAGS += -I`xcrun --show-sdk-path`/usr/include
22−endif
23−
2420 # in order to use gcc, type: make <target>-libtcc1-usegcc=yes
2521 arm-libtcc1-usegcc ?= no
2622
tcc.h+6−1
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #define _TCC_H
2323
2424 #define _GNU_SOURCE
25+#define _DARWIN_C_SOURCE
2526 #include "config.h"
2627
2728 #include <stdarg.h>
@@ -217,6 +218,10 @@ extern long double strtold (const char *__nptr, char **__endptr); · 189 unmodified lines
217218 # define CONFIG_TCC_CRTPREFIX USE_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR)
218219 #endif
219220
221+#ifndef CONFIG_USR_INCLUDE
222+# define CONFIG_USR_INCLUDE "/usr/include"
223+#endif
224+
220225 /* Below: {B} is substituted by CONFIG_TCCDIR (rsp. -B option) */
221226
222227 /* system include paths */
@@ -227,7 +232,7 @@ extern long double strtold (const char *__nptr, char **__endptr); · 4 unmodified lines
227232 # define CONFIG_TCC_SYSINCLUDEPATHS \
228233 "{B}/include" \
229234 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \
230− ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/include")
235+ ":" ALSO_TRIPLET(CONFIG_SYSROOT CONFIG_USR_INCLUDE)
231236 # endif
232237 #endif
233238
tests/tests2/Makefile+0−3
@@ -15,9 +15,6 @@ endif · 14 unmodified lines
1515 ifdef CONFIG_OSX
1616 SKIP += 40_stdio.test 42_function_pointer.test
1717 SKIP += 113_btdll.test # no shared lib support yet
18− FLAGS += -w
19− SDK := `xcrun --show-sdk-path`
20− TCCFLAGS += -I$(SDK)/usr/include
2118 endif
2219 ifeq ($(ARCH),x86_64)
2320 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