automake: assume we can always pass '-o' to the C compiler
authorPeter Rosin <peda@lysator.liu.se>
Thu, 30 May 2013 09:31:02 +0000 (11:31 +0200)
committerPeter Rosin <peda@lysator.liu.se>
Thu, 30 May 2013 09:31:02 +0000 (11:31 +0200)
It is assumed that we can pass -c -o to the C compiler, so remove
some special casing and always do that.

This change is similar in spirit to v1.13.1d-217-g7299c4d "depend: assume
we can always pass '-o' to the C compiler"

This change also happen to fix a testsuite failure
(t/silent-many-languages.sh) when mixing MSVC and GNU fortran, which
have different default object file extensions (.obj vs. .o). This
difference in object file extension is not handled well and caused
Automake to look for MSVC objects with .o extension. Always using -o
makes MSVC create .o object files and linking succeeds. Not that
anybody recommends mixing toolchains or anything.

* bin/automake.in (handle_languages): Remove conditional modification
of 'output_flag' entry for 'c'.
(register_language ('name' => 'c')): Add 'output_flag' entry set to '-o'.

Signed-off-by: Peter Rosin <peda@lysator.liu.se>
bin/automake.in

index 24ff2a6..40b3181 100644 (file)
@@ -632,6 +632,7 @@ register_language ('name' => 'c',
                   'linker' => 'LINK',
                   'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'compile_flag' => '-c',
+                  'output_flag' => '-o',
                   'libtool_tag' => 'CC',
                   'extensions' => ['.c']);
 
@@ -1313,14 +1314,6 @@ sub handle_languages ()
        if (((! option 'no-dependencies') && $lang->autodep ne 'no')
            || defined $lang->compile)
        {
-           # Some C compilers don't support -c -o.  Use it only if really
-           # needed.
-           my $output_flag = $lang->output_flag || '';
-           $output_flag = '-o'
-             if (! $output_flag
-                 && $lang->name eq 'c'
-                 && option 'subdir-objects');
-
            # Compute a possible derived extension.
            # This is not used by depend2.am.
            my $der_ext = ($lang->output_extensions->($ext))[0];
@@ -1364,7 +1357,7 @@ sub handle_languages ()
 
                             COMPILE   => '$(' . $lang->compiler . ')',
                             LTCOMPILE => '$(LT' . $lang->compiler . ')',
-                            -o        => $output_flag,
+                            -o        => $lang->output_flag,
                             SUBDIROBJ => !! option 'subdir-objects');
        }