10

Autoconf/Automake are at pains to support ancient C compilers that didn't understand the simultaneous use of the -c and -o options (create an object file with this name). There's AM_PROG_CC_C_O and a special wrapper script, and the Automake manual warns you to use them if you want to use subdir-objects mode.

There isn't an AM_PROG_CXX_C_O. It is not hard to modify AM_PROG_CC_C_O to test the C++ compiler instead, but I wonder if it's necessary. Was there ever a Unix C++ compiler (Cfront, maybe?) that didn't support simultaneous use of -c and -o? Come to that, just how old are the C compilers that don't support it -- was there ever a C89-supporting compiler with this problem, for instance?

Ed Heal
  • 59,252
  • 17
  • 87
  • 127
zwol
  • 135,547
  • 38
  • 252
  • 361
  • +1: There definitely _were_ such (C) compilers. Whether there are any current (supported) compilers without that facility is an important question. Whether there are still old versions of such compilers in use is harder to assess; software has a tendency to be used long after its 'best before end of' date. – Jonathan Leffler Nov 25 '11 at 18:22
  • 3
    The issue with "-c -o" is that -c potentially makes the compiler build multiple outputs, at which point the -o option becomes nonsensical. – Simon Richter Nov 25 '11 at 18:45
  • @SimonRichter That's an interesting point, and yet, the last compiler that *I* personally know about that didn't do something sensible with `-c -o` is Solaris's K&R-only `/bin/cc`, which isn't even something you can start with and bootstrap yourself a newer compiler, anymore. – zwol Nov 25 '11 at 22:18

1 Answers1

1

There are compilers, mainly those targeted at the embedded industry, where you must manually compile and link. In those cases, the -c option does not make sense.

Given that Linux is more and more used in embedded systems, you should definitely take those into account.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Lindydancer
  • 25,428
  • 4
  • 49
  • 68
  • I don't know what you mean by "manually compile and link." Can you point me at a specific example of a compiler with the property you're thinking of, ideally to its documentation? – zwol Nov 25 '11 at 22:15
  • Also, allow me to emphasise that this is *not* a Linux-specific question I'm asking here. I see it as mostly a historical-interest question. – zwol Nov 25 '11 at 22:19
  • By "manually" I mean that you issue one command to compile to an object file and another to do the link. There is no wrapper that compiles and link, hence there is no point in having a `-c` option. One concrete example is the compilers from `IAR Systems`, which are part of `IAR Embedded Workbench`. I'm not sure the manuals are online, but you can download a so called Kickstart version to get them. – Lindydancer Nov 25 '11 at 22:35