On Sat, Jun 23, 2007 at 05:25:54PM -0700, Ian Lance Taylor wrote: > > At Cygnus, in the early and mid- 90s, we did this routinely, starting > with the native compilers shipped with various Unix variants. As Unix > variants generally no longer come with a free (as in beer) compiler > other than gcc, this is harder to test today. Still, not too hard: > you would just start with some other free compiler.
Examples welcome. I use a Fedora GNU/Linux x86 6.92 system on which neither of the following works: 1) lcc 2) vbcc 3) gcc -ansi (!) The problem is mostly header files which are not ANSI compliant. Lcc also creates an executable which segfaults in the gcc/build directory. Vbcc needs this patch. Without it, the object files end up in the source directory. (This is not something I have a clue about, I just copied from the gcc directory and did s/AM_PROG_CC_C_O/AC_PROG_CC_C_O/.) Index: fixincludes/Makefile.in =================================================================== --- fixincludes/Makefile.in (revision 127373) +++ fixincludes/Makefile.in (working copy) @@ -34,6 +34,10 @@ INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../include FIXINC_CFLAGS = -DHAVE_CONFIG_H $(INCLUDES) +# Some compilers can't handle cc -c blah.c -o foo/blah.o. Others, such as +# vbcc, need it to put the object files in the build directory. +OUTPUT_OPTION = @OUTPUT_OPTION@ + # Directory where sources are, from where we are. srcdir = @srcdir@ VPATH = $(srcdir) @@ -69,7 +73,7 @@ # Now figure out from those variables how to compile and link. .c.o: - $(CC) -c $(CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CFLAGS) $< + $(CC) -c $(CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CFLAGS) $< $(OUTPUT_OPTION) # The only suffixes we want for implicit rules are .c and .o. .SUFFIXES: Index: fixincludes/configure.ac =================================================================== --- fixincludes/configure.ac (revision 127373) +++ fixincludes/configure.ac (working copy) @@ -5,6 +5,15 @@ AC_CONFIG_AUX_DIR(..) AC_CANONICAL_SYSTEM AC_PROG_CC +AC_PROG_CC_C_O +# autoconf is lame and doesn't give us any substitution variable for this. +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then + NO_MINUS_C_MINUS_O=yes +else + OUTPUT_OPTION='-o $@' +fi +AC_SUBST(NO_MINUS_C_MINUS_O) +AC_SUBST(OUTPUT_OPTION) # Figure out what compiler warnings we can enable. # See config/warnings.m4 for details. -- Rask Ingemann Lambertsen