diff options
| author | Thomas Preud'homme <robotux@celest.fr> | 2013-02-13 22:35:36 +0100 |
|---|---|---|
| committer | Thomas Preud'homme <robotux@celest.fr> | 2013-02-13 22:35:36 +0100 |
| commit | e298f608385d51911184281f1cdb09addc560c59 (patch) | |
| tree | 8287eec5c504798769673f2b83dbeab9391255a8 /configure | |
| parent | a4cbd9b002ab34023b6e6a3d2afc1f3496247b79 (diff) | |
| download | tinycc-e298f608385d51911184281f1cdb09addc560c59.tar.gz tinycc-e298f608385d51911184281f1cdb09addc560c59.tar.bz2 | |
Create config-print program to test $cc
Create a helper program called config-print to print informations
relative to the BUILD/HOST environment in the case of native
compilation.
Diffstat (limited to 'configure')
| -rwxr-xr-x | configure | 52 |
1 files changed, 6 insertions, 46 deletions
@@ -22,10 +22,7 @@ fi # bashism: TMPN="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.c" TMPN="./conftest-$$" -TMPC=$TMPN.c TMPH=$TMPN.h -TMPO=$TMPN.o -TMPE=$TMPN # default parameters build_cross="no" @@ -206,20 +203,11 @@ fi if test -z "$cross_prefix" ; then -# --- -# big/little endian test -cat > $TMPC << EOF -#include <inttypes.h> -int main(int argc, char ** argv){ - volatile uint32_t i=0x01234567; - return (*((uint8_t*)(&i))) == 0x67; -} -EOF - -if $cc -o $TMPE $TMPC 2>/dev/null ; then - $TMPE && bigendian="yes" +if ! $cc -o config-print config-print.c 2>/dev/null ; then + echo "$cc is not able to compile TCC" else - echo big/little test failed + bigendian="$(./config-print e)" + gcc_major="$(./config-print v)" fi else @@ -231,37 +219,8 @@ esac fi -# check gcc version -cat > $TMPC <<EOF -int main(void) { -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) -return 0; -#else -#error gcc < 3.2 -#endif -} -EOF - -gcc_major="2" -if $cc -o $TMPO $TMPC 2> /dev/null ; then - gcc_major="3" -fi -cat > $TMPC <<EOF -int main(void) { -#if __GNUC__ >= 4 -return 0; -#else -#error gcc < 4 -#endif -} -EOF - -if $cc -o $TMPO $TMPC 2> /dev/null ; then - gcc_major="4" -fi - if test -z "$cross_prefix" ; then - libc_dir="$(ldd $TMPO | grep libc.so | sed 's|[^/]*/\(.*/\)[^/]*|\1|')" + libc_dir="$(ldd ./config-print | grep libc.so | sed 's|[^/]*/\(.*/\)[^/]*|\1|')" multiarch_triplet=${libc_dir#*/} multiarch_triplet=${multiarch_triplet%/} lddir="${libc_dir%%/*}" @@ -269,6 +228,7 @@ if test -z "$cross_prefix" ; then lddir="$lddir/$multiarch_triplet" fi fi +rm config-print if test x"$show_help" = "xyes" ; then cat << EOF |
