configure: fix tcc_lddir, cpu

... and other minor cosmetic fixes
master
grischka 2016-10-03 12:29:38 +02:00
parent f795e1be83
commit 78f1c10e0f
6 changed files with 70 additions and 67 deletions

View File

@ -157,7 +157,7 @@ $(WIN32_CROSS) : DEFINES = -DTCC_TARGET_I386 -DTCC_TARGET_PE \
$(WIN64_CROSS) : DEFINES = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE \
-DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \
-DCONFIG_TCC_LIBPATHS="\"{B}/lib/64;{B}/lib\""
$(WINCE_CROSS): DEFINES = -DTCC_TARGET_PE
$(WINCE_CROSS): DEFINES = -DTCC_TARGET_ARM -DTCC_TARGET_PE
$(C67_CROSS): DEFINES = -DTCC_TARGET_C67 -w # disable warnigs
$(ARM_FPA_CROSS): DEFINES = -DTCC_TARGET_ARM
$(ARM_FPA_LD_CROSS)$(EXESUF): DEFINES = -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12

121
configure vendored
View File

@ -69,58 +69,6 @@ if test -z "$source_path" -o "$source_path" = "." ; then
source_path_used="no"
fi
cpu=`uname -m`
if test $mingw32=yes; then
if test "$PROCESSOR_ARCHITEW6432" = "AMD64" \
-o "$PROCESSOR_ARCHITECTURE" = "AMD64"; then
cpu="x86_64"
fi
fi
case "$cpu" in
x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
cpu="x86"
;;
x86_64|amd64)
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"
;;
aarch64)
cpu="aarch64"
;;
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
@ -195,12 +143,61 @@ for opt do
esac
done
if test -z "$cpu" ; then
if test -n "$ARCH" ; then
cpu="$ARCH"
else
cpu=`uname -m`
fi
fi
case "$cpu" in
x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
cpu="x86"
;;
x86_64|amd64)
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"
;;
aarch64)
cpu="aarch64"
;;
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"
if test "$mingw32" = "yes" -a "$cpu" = "x86-64"; then
CFLAGS="-m64 $CFLAGS"
fi
fi
if test "$mingw32" = "yes" ; then
@ -238,11 +235,8 @@ else
if test x"$bindir" = x""; then
bindir="${execprefix}/bin"
fi
if test x"$tccdir" = x""; then
tccdir="tcc"
fi
if test x"$docdir" = x""; then
docdir="${sharedir}/doc/${tccdir}"
docdir="${sharedir}/doc"
fi
if test x"$mandir" = x""; then
mandir="${sharedir}/man"
@ -250,7 +244,9 @@ else
if test x"$infodir" = x""; then
infodir="${sharedir}/info"
fi
tccdir="${libdir}/${tccdir}"
if test x"$tccdir" = x""; then
tccdir="${libdir}/tcc"
fi
fi # mingw32
if test x"$includedir" = x""; then
@ -284,6 +280,7 @@ Advanced options (experts only):
--ar=AR create archives using AR [$ar]
--extra-cflags= specify compiler flags [$CFLAGS]
--extra-ldflags= specify linker options []
--cpu=CPU CPU [$cpu]
--strip-binaries strip symbol tables from resulting binaries
--disable-static make libtcc.so instead of libtcc.a
--disable-rpath disable use of -rpath with the above
@ -317,9 +314,9 @@ if test -z "$cross_prefix" ; then
if test "$mingw32" = "no" ; then
triplet="$($CONFTEST triplet)"
if test -f "/usr/lib/$triplet/crti.o" ; then
tcc_lddir="lib/$triplet"
tcc_lddir="lib"
multiarch_triplet="$triplet"
elif test -f "/usr/lib64/crti.o" ; then
elif test "$cpu" != "x86" -a -f "/usr/lib64/crti.o" ; then
tcc_lddir="lib64"
fi

View File

@ -116,7 +116,7 @@ static void tcc_add_systemdir(TCCState *s)
}
#endif
#ifndef CONFIG_TCC_STATIC
#if defined TCC_IS_NATIVE && !defined CONFIG_TCC_STATIC
static void dlclose(void *p)
{
FreeLibrary((HMODULE)p);
@ -481,8 +481,10 @@ static void tcc_split_path(TCCState *s, void ***p_ary, int *p_nb_ary, const char
cstr_ccat(&str, c);
}
}
cstr_ccat(&str, '\0');
dynarray_add(p_ary, p_nb_ary, tcc_strdup(str.data));
if (str.size) {
cstr_ccat(&str, '\0');
dynarray_add(p_ary, p_nb_ary, tcc_strdup(str.data));
}
cstr_free(&str);
in = p+1;
} while (*p);

2
tcc.h
View File

@ -1535,7 +1535,9 @@ ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str);
ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, int fd);
ST_FUNC int pe_output_file(TCCState * s1, const char *filename);
ST_FUNC int pe_putimport(TCCState *s1, int dllindex, const char *name, addr_t value);
#ifndef TCC_TARGET_ARM
ST_FUNC SValue *pe_getimport(SValue *sv, SValue *v2);
#endif
#ifdef TCC_TARGET_X86_64
ST_FUNC void pe_add_unwind_data(unsigned start, unsigned end, unsigned stack);
#endif

View File

@ -1447,6 +1447,7 @@ static void pe_print_sections(TCCState *s1, const char *fname)
/* ------------------------------------------------------------- */
/* helper function for load/store to insert one more indirection */
#ifndef TCC_TARGET_ARM
ST_FUNC SValue *pe_getimport(SValue *sv, SValue *v2)
{
Sym *sym;
@ -1486,6 +1487,7 @@ ST_FUNC SValue *pe_getimport(SValue *sv, SValue *v2)
v2->r |= sv->r & VT_LVAL;
return v2;
}
#endif
ST_FUNC int pe_putimport(TCCState *s1, int dllindex, const char *name, addr_t value)
{

View File

@ -1069,8 +1069,8 @@ static X86_64_Mode classify_x86_64_inner(CType *ty)
return mode;
}
assert(0);
return 0;
}
static X86_64_Mode classify_x86_64_arg(CType *ty, CType *ret, int *psize, int *palign, int *reg_count)