sys_id => System identity for systems where that
is difficult to determine automatically.
- cc => The compiler command, usually one of "cc",
+ cc => The C compiler command, usually one of "cc",
"gcc" or "clang". This command is normally
also used to link object files and
libraries into the final program.
+ cxx => The C++ compiler command, usually one of
+ "c++", "g++" or "clang++". This command is
+ also used when linking a program where at
+ least one of the object file is made from
+ C++ source.
cflags => Flags that are used at all times when
- compiling.
+ compiling C object files.
+ cxxflags => Flags that are used at all times when
+ compiling C++ object files. If unset, it
+ gets the same value as cflags.
defines => As an alternative, macro definitions may be
present here instead of in `cflags'. If
given here, they MUST be as an array of the
if defined($configdata::config{cross_compile_prefix});
$ENV{CC} = $configdata::config{cc}
if defined($configdata::config{cc});
+ $ENV{CXX} = $configdata::config{cxx}
+ if defined($configdata::config{cxx});
$ENV{BUILDFILE} = $configdata::config{build_file}
if defined($configdata::config{build_file});
$ENV{$local_config_envname} = $configdata::config{local_config_dir}
print " CROSS_COMPILE = ",$ENV{CROSS_COMPILE},"\n"
if $ENV{CROSS_COMPILE};
print " CC = ",$ENV{CC},"\n" if $ENV{CC};
+ print " CXX = ",$ENV{CXX},"\n" if $ENV{CXX};
print " BUILDFILE = ",$ENV{BUILDFILE},"\n" if $ENV{BUILDFILE};
print " $local_config_envname = ",$ENV{$local_config_envname},"\n"
if $ENV{$local_config_envname};
$config{conf_files} = [ sort keys %conf_files ];
%target = ( %{$table{DEFAULTS}}, %target );
+$target{cxxflags}=$target{cflags} unless defined $target{cxxflags};
$target{exe_extension}="";
$target{exe_extension}=".exe" if ($config{target} eq "DJGPP"
|| $config{target} =~ /^(?:Cygwin|mingw)/);
# Cache information necessary for reconfiguration
$config{cc} = $target{cc};
+$config{cxx} = $target{cxx};
$config{build_file} = $target{build_file};
# For cflags, lflags, plib_lflags, ex_libs and defines, add the debug_
# Do it in such a way that no spurious space is appended (hence the grep).
$config{defines} = [];
$config{cflags} = "";
+$config{cxxflags} = "";
$config{ex_libs} = "";
$config{shared_ldflag} = "";
if (! -f $s) {
$s = cleanfile($buildd, $_, $blddir);
}
- # We recognise C and asm files
- if ($s =~ /\.[csS]\b$/) {
- (my $o = $_) =~ s/\.[csS]\b$/.o/;
+ # We recognise C++, C and asm files
+ if ($s =~ /\.(cc|cpp|c|s|S)$/) {
+ my $o = $_;
+ $o =~ s/\.[csS]$/.o/; # C and assembler
+ $o =~ s/\.(cc|cpp)$/_cc.o/; # C++
$o = cleanfile($buildd, $o, $blddir);
$unified_info{sources}->{$ddest}->{$o} = 1;
$unified_info{sources}->{$o}->{$s} = 1;
if (! -f $s) {
$s = cleanfile($buildd, $_, $blddir);
}
- # We recognise C and asm files
- if ($s =~ /\.[csS]\b$/) {
- (my $o = $_) =~ s/\.[csS]\b$/.o/;
+ # We recognise C++, C and asm files
+ if ($s =~ /\.(cc|cpp|c|s|S)$/) {
+ my $o = $_;
+ $o =~ s/\.[csS]$/.o/; # C and assembler
+ $o =~ s/\.(cc|cpp)$/_cc.o/; # C++
$o = cleanfile($buildd, $o, $blddir);
$unified_info{shared_sources}->{$ddest}->{$o} = 1;
$unified_info{sources}->{$o}->{$s} = 1;
foreach (grep /_(asm|aux)_src$/, keys %target) {
my $src = $_;
(my $obj = $_) =~ s/_(asm|aux)_src$/_obj/;
- ($target{$obj} = $target{$src}) =~ s/\.[csS]\b/.o/g;
+ $target{$obj} = $target{$src};
+ $target{$obj} =~ s/\.[csS]\b/.o/g; # C and assembler
+ $target{$obj} =~ s/\.(cc|cpp)\b/_cc.o/g; # C++
}
# Write down our configuration where it fits #########################
print "HASHBANGPERL =$config{hashbangperl}\n";
print "CC =$config{cross_compile_prefix}$target{cc}\n";
print "CFLAG =$target{cflags} $config{cflags}\n";
+print "CXX =$config{cross_compile_prefix}$target{cxx}\n"
+ if defined $target{cxx};
+print "CXXFLAG =$target{cxxflags} $config{cxxflags}\n"
+ if defined $target{cxx};
print "DEFINES =",join(" ", @{$target{defines}}, @{$config{defines}}),"\n";
#print "RANLIB =", $target{ranlib} eq '$(CROSS_COMPILE)ranlib' ?
# "$config{cross_compile_prefix}ranlib" :