Le jeudi 31 janvier 2013 00:08:19, Ivo van Poorten a écrit : > Error: > > $ ./configure --cc=tcc > Binary directory /usr/local/bin > TinyCC directory /usr/local/lib/tcc > Library directory /usr/local/lib > Include directory /usr/local/include > Manual directory /usr/local/share/man > Info directory /usr/local/share/info > Doc directory /usr/local/share/doc/tcc > Target root prefix > Source path /home/ivo/git/tinycc > C compiler tcc > Target OS Linux > CPU x86 > Big Endian no > gprof enabled no > cross compilers no > use libgcc no > Creating config.mak and config.h > $ make > [..snip..] > gcc -c lib/bcheck.c -o bcheck.o -I. -I/home/ivo/git/tinycc -Wall -g -O2 > -mpreferred-stack-boundary=2 -m386 -malign-functions=0 -m32 cc1: error: > unrecognized command line option "-m386" > > > ----8<----8<----8<----8<----8<----8<----8<----8<---- > > diff --git a/Makefile b/Makefile > index d257464..0333ebe 100644 > --- a/Makefile > +++ b/Makefile > @@ -232,7 +232,7 @@ libtcc1.a : FORCE > lib/%/libtcc1.a : FORCE $(PROGS_CROSS) > @$(MAKE) -C lib cross TARGET=$* > bcheck.o : lib/bcheck.c > - gcc -c $< -o $@ $(CPPFLAGS) $(CFLAGS) > + $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS) > FORCE: > > # install
Unfortunetely it still breaks because of a wrong detection of GCC_MAJOR. Because the test to determine the major version number of gcc fails, GCC_MAJOR is set to 2. I made the following patch but I'm still not sure how to handle flags when the compiler is not gcc. Shall no flag be set and the project fail because of missing -I for instance? I don't have a clear idea for now. Best regards, Thomas
diff --git a/Makefile b/Makefile
index d6a0a28..ce37592 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@ CFLAGS_P=$(CFLAGS) -pg -static
LIBS_P=
LDFLAGS_P=$(LDFLAGS)
+ifdef GCC_MAJOR
ifneq ($(GCC_MAJOR),2)
CFLAGS+=-fno-strict-aliasing
ifneq ($(GCC_MAJOR),3)
@@ -30,6 +31,7 @@ CFLAGS+=-march=i386 -falign-functions=0
endif
endif
endif
+endif
ifdef CONFIG_WIN64
CONFIG_WIN32=yes
@@ -234,7 +236,7 @@ libtcc1.a : FORCE
lib/%/libtcc1.a : FORCE $(PROGS_CROSS)
@$(MAKE) -C lib cross TARGET=$*
bcheck.o : lib/bcheck.c
- gcc -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
+ $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
FORCE:
# install
diff --git a/configure b/configure
index fa2c97d..289b8ca 100755
--- a/configure
+++ b/configure
@@ -231,6 +231,21 @@ esac
fi
+# check compiler is gcc
+cat > $TMPC <<EOF
+int main(void) {
+#ifdef __GNUC__
+return 0;
+#else
+#error compiler is not gcc
+#endif
+}
+EOF
+
+if $cc -o $TMPO $TMPC 2> /dev/null ; then
+ gcc_major="2"
+fi
+
# check gcc version
cat > $TMPC <<EOF
int main(void) {
@@ -242,7 +257,6 @@ return 0;
}
EOF
-gcc_major="2"
if $cc -o $TMPO $TMPC 2> /dev/null ; then
gcc_major="3"
fi
@@ -409,11 +423,13 @@ print_var2 CONFIG_TCC_LIBPATHS "$tcc_libpaths"
print_var2 CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
print_var2 CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
-echo "#define GCC_MAJOR $gcc_major" >> $TMPH
+if [ x"$gcc_major" != x ] ; then
+ echo "#define GCC_MAJOR $gcc_major" >> $TMPH
+ echo "GCC_MAJOR=$gcc_major" >> config.mak
+fi
cat >> config.mak <<EOF
CC=$cc
-GCC_MAJOR=$gcc_major
HOST_CC=$host_cc
AR=$ar
STRIP=$strip -s -R .comment -R .note
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
