Use the proper C++ compiler to run C++ tests

Running the C compiler with -shared-libgcc -lstdc++ does not work on
non-GCC compilers.
This commit is contained in:
Josh Triplett
2014-03-26 23:17:56 -07:00
parent fa5e88f170
commit 7d698125b1
4 changed files with 9 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
language: c language: cpp
compiler: compiler:
- gcc - gcc
- clang - clang
@@ -12,7 +12,7 @@ matrix:
before_script: before_script:
- sudo apt-get install dejagnu texinfo - sudo apt-get install dejagnu texinfo
- if [ "$HOST" = i386-pc-linux-gnu ] ; then sudo apt-get install gcc-multilib g++-multilib && CC="$CC -m32" ; fi - if [ "$HOST" = i386-pc-linux-gnu ] ; then sudo apt-get install gcc-multilib g++-multilib && CC="$CC -m32" && CXX="$CXX -m32" ; fi
script: script:
- ./autogen.sh - ./autogen.sh

View File

@@ -29,6 +29,7 @@ m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[]) m4_define([_AC_ARG_VAR_PRECIOUS],[])
save_CFLAGS=$CFLAGS save_CFLAGS=$CFLAGS
AC_PROG_CC AC_PROG_CC
AC_PROG_CXX
CFLAGS=$save_CFLAGS CFLAGS=$save_CFLAGS
m4_undefine([_AC_ARG_VAR_PRECIOUS]) m4_undefine([_AC_ARG_VAR_PRECIOUS])
m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
@@ -57,6 +58,7 @@ fi
cat > local.exp <<EOF cat > local.exp <<EOF
set CC_FOR_TARGET "$CC" set CC_FOR_TARGET "$CC"
set CXX_FOR_TARGET "$CXX"
EOF EOF
AM_MAINTAINER_MODE AM_MAINTAINER_MODE

View File

@@ -222,6 +222,10 @@ proc libffi_target_compile { source dest type options } {
lappend options "libs= -lpthread" lappend options "libs= -lpthread"
} }
if { [string match "*.cc" $source] } {
lappend options "c++"
}
verbose "options: $options" verbose "options: $options"
return [target_compile $source $dest $type $options] return [target_compile $source $dest $type $options]
} }

View File

@@ -19,10 +19,7 @@ libffi-init
global srcdir subdir global srcdir subdir
run-many-tests [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" run-many-tests [lsort [glob -nocomplain -- $srcdir/$subdir/*.{c,cc}]] ""
if { [string match $using_gcc "yes"] } {
run-many-tests [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] "-shared-libgcc -lstdc++"
}
dg-finish dg-finish