configure: detect ARM variants

Using gnu make's variable variable-names.
This commit is contained in:
grischka 2013-02-14 21:15:56 +01:00
parent b9f089fc4a
commit c4397b2b02
2 changed files with 37 additions and 33 deletions

View File

@ -8,11 +8,6 @@ VPATH = $(top_srcdir)
CPPFLAGS = -I$(TOP) # for config.h
CPPFLAGS_P=$(CPPFLAGS) -DCONFIG_TCC_STATIC
CFLAGS_P=$(CFLAGS) -pg -static
LIBS_P=
LDFLAGS_P=$(LDFLAGS)
ifeq (-$(findstring $(GCC_MAJOR),01)-,--)
CFLAGS+=-fno-strict-aliasing
ifeq (-$(findstring $(GCC_MAJOR),23)-,--)
@ -23,12 +18,17 @@ else
CFLAGS+=-Wno-unused-result
endif
endif
endif
else # not GCC
ifeq (-$(findstring clang,$(CC))-,-clang-)
# make clang accept gnuisms in libtcc1.c
ifeq ($(CC),clang)
CFLAGS+=-fheinous-gnu-extensions
endif
endif
CPPFLAGS_P=$(CPPFLAGS) -DCONFIG_TCC_STATIC
CFLAGS_P=$(CFLAGS) -pg -static
LIBS_P=
LDFLAGS_P=$(LDFLAGS)
ifdef CONFIG_WIN64
CONFIG_WIN32=yes
@ -41,31 +41,6 @@ LIBS+=-ldl
endif
endif
ifeq ($(ARCH),i386)
NATIVE_DEFINES+=-DTCC_TARGET_I386
else ifeq ($(ARCH),x86-64)
NATIVE_DEFINES+=-DTCC_TARGET_X86_64
endif
ifeq ($(ARCH),arm)
NATIVE_DEFINES+=-DTCC_TARGET_ARM
NATIVE_DEFINES+=-DWITHOUT_LIBTCC
ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 /lib/arm-linux-gnueabihf/ld-linux.so.3))
NATIVE_DEFINES+=-DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
else ifneq (,$(wildcard /lib/ld-linux.so.3))
NATIVE_DEFINES+=-DTCC_ARM_EABI
endif
NATIVE_DEFINES+=$(if $(shell grep -l "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo),-DTCC_ARM_VFP)
endif
ifdef CONFIG_WIN32
NATIVE_DEFINES+=-DTCC_TARGET_PE
endif
ifneq ($(wildcard /lib/ld-uClibc.so.0),)
NATIVE_DEFINES+=-DTCC_UCLIBC
endif
# make libtcc as static or dynamic library?
ifdef DISABLE_STATIC
LIBTCC=libtcc.so.1.0
@ -78,6 +53,17 @@ LIBTCC=libtcc.a
LINK_LIBTCC=
endif
CONFIG_$(ARCH) = yes
NATIVE_DEFINES_$(CONFIG_i386) += -DTCC_TARGET_I386
NATIVE_DEFINES_$(CONFIG_x86-64) += -DTCC_TARGET_X86_64
NATIVE_DEFINES_$(CONFIG_WIN32) += -DTCC_TARGET_PE
NATIVE_DEFINES_$(CONFIG_uClibc) += -DTCC_UCLIBC
NATIVE_DEFINES_$(CONFIG_arm) += -DTCC_TARGET_ARM -DWITHOUT_LIBTCC
NATIVE_DEFINES_$(CONFIG_arm_eabihf) += -DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
NATIVE_DEFINES_$(CONFIG_arm_eabi) += -DTCC_ARM_EABI
NATIVE_DEFINES_$(CONFIG_arm_vfp) += -DTCC_ARM_VFP
NATIVE_DEFINES += $(NATIVE_DEFINES_yes)
ifeq ($(TOP),.)
PROGS=tcc$(EXESUF)

18
configure vendored
View File

@ -44,6 +44,7 @@ tcc_libpaths=""
tcc_crtprefix=""
tcc_elfinterp=""
tcc_lddir=
confvars=
cpu=`uname -m`
@ -304,6 +305,17 @@ if test -z "$cross_prefix" ; then
tcc_lddir="lib64"
fi
if test "$cpu" = "armv4l" ; then
if test "${triplet%eabihf}" != "$triplet" ; then
confvars="$confvars arm_eabihf"
elif test "${triplet%eabi}" != "$triplet" ; then
confvars="$confvars arm_eabi"
fi
if grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then
confvars="$confvars arm_vfp"
fi
fi
# multiarch_triplet=${libc_dir#*/}
# multiarch_triplet=${multiarch_triplet%/}
# tcc_lddir="${libc_dir%%/*}"
@ -311,6 +323,9 @@ if test -z "$cross_prefix" ; then
# tcc_lddir="$tcc_lddir/$multiarch_triplet"
# fi
if test -f "/lib/ld-uClibc.so.0" ; then
confvars="$confvars uClibc"
fi
# gr: maybe for after the release:
# tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')"
# echo "elfinterp $tcc_elfinterp"
@ -424,6 +439,9 @@ fi
echo "TARGETOS=$targetos" >> config.mak
for v in $confvars ; do
echo "CONFIG_$v=yes" >> config.mak
done
if test "$noldl" = "yes" ; then
echo "CONFIG_NOLDL=yes" >> config.mak
fi