[Glibc-bsd-devel] Gcc status

Robert Millan zeratul2@wanadoo.es
Thu, 4 Dec 2003 16:40:33 +0100


--AqsLC8rIMeq19msA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Dec 04, 2003 at 04:13:58PM +0100, Robert Millan wrote:
>    For now, I've been using a /usr/bin/gcc wrapper which works quite well.
>    I'm attaching my current version of gcc.c in this mail.

It'd help if I actualy attached it ;)

-- 
Robert Millan

"[..] but the delight and pride of Aule is in the deed of making, and in the
thing made, and neither in possession nor in his own mastery; wherefore he
gives and hoards not, and is free from care, passing ever on to some new work."

 -- J.R.R.T, Ainulindale (Silmarillion)

--AqsLC8rIMeq19msA
Content-Type: text/x-csrc; charset=us-ascii
Content-Disposition: attachment; filename="gcc.c"

#include <stdio.h>
#include <unistd.h>
#include <string.h>

#undef macro_kernel

/* this obviously needs bootstrap */
#if defined(__NetBSD_kernel__)
#define macro_kernel "-D__NetBSD_kernel__"
#elif defined(__FreeBSD_kernel__)
#define macro_kernel "-D__FreeBSD_kernel__"
#elif defined(__linux__)
#define macro_kernel "-D__linux__"
#else
#error unknown kernel
#endif

int
main (int argc, char **argv)
{
  int i;
  char *new_argv[argc + 6];
  new_argv[0] = strdup ("gcc-3.4");
  new_argv[1] = strdup (macro_kernel);
  new_argv[2] = strdup ("-D__GNU_userland__");
  new_argv[3] = strdup ("-Dunix");
  new_argv[4] = strdup ("-D__unix__");
  new_argv[5] = strdup ("-D__i386__");
  for (i = 1 ; i != argc; i++)
    new_argv[i + 5] = strdup (argv[i]);
  new_argv[argc + 5] = NULL;

  execvp ("gcc-3.4", new_argv);
}

--AqsLC8rIMeq19msA--