diff -uNr tcc-0.9.26.orig/configure tcc-0.9.26-1crosscompilefixes/configure
--- tcc-0.9.26.orig/configure 2013-02-15 08:24:00.000000000 -0600
+++ tcc-0.9.26-1crosscompilefixes/configure 2014-05-18 16:05:09.907516999 -0500
@@ -46,16 +46,8 @@
tcc_lddir=
confvars=
-cpu=`uname -m`
-
-# OS specific
targetos=`uname -s`
-case $targetos in
- MINGW32*) mingw32=yes;;
- DragonFly) noldl=yes;;
- OpenBSD) noldl=yes;;
- *) ;;
-esac
+cpu=`uname -m`
# find source path
# XXX: we assume an absolute path is given when launching configure,
@@ -68,47 +60,6 @@
source_path_used="no"
fi
-case "$cpu" in
- i386|i486|i586|i686|i86pc|BePC|i686-AT386)
- cpu="x86"
- ;;
- x86_64)
- cpu="x86-64"
- ;;
- arm*)
- case "$cpu" in
- arm|armv4l)
- cpuver=4
- ;;
- armv5tel|armv5tejl)
- cpuver=5
- ;;
- armv6j|armv6l)
- cpuver=6
- ;;
- armv7a|armv7l)
- cpuver=7
- ;;
- esac
- cpu="armv4l"
- ;;
- alpha)
- cpu="alpha"
- ;;
- "Power Macintosh"|ppc|ppc64)
- cpu="powerpc"
- ;;
- mips)
- cpu="mips"
- ;;
- s390)
- cpu="s390"
- ;;
- *)
- cpu="unknown"
- ;;
-esac
-
for opt do
eval opt=\"$opt\"
case "$opt" in
@@ -156,6 +107,8 @@
;;
--cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
;;
+ --os=*) targetos=`echo $opt | cut -d '=' -f 2-`
+ ;;
--enable-gprof) gprof="yes"
;;
--enable-mingw32) mingw32="yes" ; cross_prefix="i686-pc-mingw32-" ; cpu=x86
@@ -181,6 +134,66 @@
esac
done
+# OS specific
+case $targetos in
+ MINGW32*|mingw32*) mingw32=yes;;
+ DragonFly) noldl=yes;;
+ OpenBSD) noldl=yes;;
+ *) ;;
+esac
+
+case "$cpu" in
+ i386|i486|i586|i686|i86pc|BePC|i686-AT386)
+ cpu="x86"
+ case " ${cc} ${CFLAGS} " in
+ *' -m64 '*)
+ cpu="x86-64"
+ ;;
+ esac
+
+ ;;
+ x86_64)
+ cpu="x86-64"
+ case " ${cc} ${CFLAGS} " in
+ *' -m32 '*)
+ cpu="x86"
+ ;;
+ esac
+ ;;
+ arm*)
+ case "$cpu" in
+ arm|armv4l)
+ cpuver=4
+ ;;
+ armv5tel|armv5tejl)
+ cpuver=5
+ ;;
+ armv6j|armv6l)
+ cpuver=6
+ ;;
+ armv7a|armv7l)
+ cpuver=7
+ ;;
+ esac
+ cpu="armv4l"
+ ;;
+ alpha)
+ cpu="alpha"
+ ;;
+ "Power Macintosh"|ppc|ppc64)
+ cpu="powerpc"
+ ;;
+ mips)
+ cpu="mips"
+ ;;
+ s390)
+ cpu="s390"
+ ;;
+ *)
+ cpu="unknown"
+ ;;
+esac
+
# Checking for CFLAGS
if test -z "$CFLAGS"; then
CFLAGS="-Wall -g -O2"
@@ -270,6 +283,8 @@
--disable-static make libtcc.so instead of libtcc.a
--disable-rpath disable use of -rpath with the above
--with-libgcc use /lib/libgcc_s.so.1 instead of libtcc.a
+ --cpu=... Specify CPU
+ --os=... Specify OS
--enable-mingw32 build windows version on linux with mingw32
--enable-cygwin build windows version on windows with cygwin
--enable-cross build cross compilers
@@ -283,7 +298,6 @@
exit 1
fi
-cc="${cross_prefix}${cc}"
ar="${cross_prefix}${ar}"
strip="${cross_prefix}${strip}"
@@ -446,8 +460,16 @@
echo "CONFIG_NOLDL=yes" >> config.mak
fi
if test "$mingw32" = "yes" ; then
- echo "CONFIG_WIN32=yes" >> config.mak
- echo "#define CONFIG_WIN32 1" >> $TMPH
+ case "$cpu" in
+ x86-64)
+ echo "CONFIG_WIN64=yes" >> config.mak
+ echo "#define CONFIG_WIN64 1" >> $TMPH
+ ;;
+ *)
+ echo "CONFIG_WIN32=yes" >> config.mak
+ echo "#define CONFIG_WIN32 1" >> $TMPH
+ ;;
+ esac
fi
if test "$cygwin" = "yes" ; then
echo "#ifndef _WIN32" >> $TMPH
diff -uNr tcc-0.9.26.orig/lib/Makefile tcc-0.9.26-1crosscompilefixes/lib/Makefile
--- tcc-0.9.26.orig/lib/Makefile 2013-02-15 08:24:00.000000000 -0600
+++ tcc-0.9.26-1crosscompilefixes/lib/Makefile 2014-06-21 00:26:03.490011999 -0500
@@ -25,6 +25,12 @@
XCC = $(CC)
endif
endif
+ ifeq ($(ARCH),arm)
+ TARGET = arm
+ ifneq ($(TARGETOS),Darwin)
+ XCC = $(CC)
+ endif
+ endif
endif
endif
endif
@@ -41,20 +47,19 @@
I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O)
X86_64_O = libtcc1.o alloca86_64.o
+ARM_O = dummy.o
WIN32_O = $(I386_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
WIN64_O = $(X86_64_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
ifeq "$(TARGET)" "i386-win32"
OBJ = $(addprefix $(DIR)/,$(WIN32_O))
TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
- XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
- XAR = $(DIR)/tiny_libmaker$(EXESUF)
+ XCC = $(CC) -I$(top_srcdir)/win32 -I$(top_srcdir)/include
else
ifeq "$(TARGET)" "x86_64-win32"
OBJ = $(addprefix $(DIR)/,$(WIN64_O))
TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
- XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
- XAR = $(DIR)/tiny_libmaker$(EXESUF)
+ XCC = $(CC) -I$(top_srcdir)/win32 -I$(top_srcdir)/include
else
ifeq "$(TARGET)" "i386"
OBJ = $(addprefix $(DIR)/,$(I386_O))
@@ -66,11 +71,17 @@
TGT = -DTCC_TARGET_X86_64
XCC ?= $(TCC) -B$(TOP)
else
+ifeq "$(TARGET)" "arm"
+ OBJ = $(addprefix $(DIR)/,$(ARM_O))
+ TGT = -DTCC_TARGET_ARM
+ XCC ?= $(CC) -I$(TOP)
+else
$(error libtcc1.a not supported on target '$(TARGET)')
endif
endif
endif
endif
+endif
XFLAGS = $(CPPFLAGS) $(CFLAGS) $(TGT)
@@ -99,4 +110,4 @@
@echo $@ > $@
clean :
- rm -rfv i386-win32 x86_64-win32 i386 x86_64
+ rm -rfv i386-win32 x86_64-win32 i386 x86_64 arm
diff -uNr tcc-0.9.26.orig/lib/dummy.c tcc-0.9.26-1crosscompilefixes/lib/dummy.c
--- tcc-0.9.26.orig/lib/dummy.c 1969-12-31 18:00:00.000000000 -0600
+++ tcc-0.9.26-1crosscompilefixes/lib/dummy.c 2014-05-16 23:56:33.539016999 -0500
@@ -0,0 +1,2 @@
+void __libtcc_dummy(void) {
+}
diff -uNr tcc-0.9.26.orig/win32/lib/crt1.c tcc-0.9.26-1crosscompilefixes/win32/lib/crt1.c
--- tcc-0.9.26.orig/win32/lib/crt1.c 2013-02-15 08:24:00.000000000 -0600
+++ tcc-0.9.26-1crosscompilefixes/win32/lib/crt1.c 2014-05-02 01:56:11.277140003 -0500
@@ -19,7 +19,6 @@
int _start(void)
{
- __TRY__
int argc; char **argv; char **env; int ret;
_startupinfo start_info = {0};
diff -uNr tcc-0.9.26.orig/win32/lib/wincrt1.c tcc-0.9.26-1crosscompilefixes/win32/lib/wincrt1.c
--- tcc-0.9.26.orig/win32/lib/wincrt1.c 2013-02-15 08:24:00.000000000 -0600
+++ tcc-0.9.26-1crosscompilefixes/win32/lib/wincrt1.c 2014-05-02 01:56:15.197140003 -0500
@@ -11,7 +11,6 @@
int _winstart(void)
{
- __TRY__
char *szCmd;
STARTUPINFO startinfo;
int fShow;