Use the proper C++ compiler to run C++ tests Running the C compiler with -shared-libgcc -lstdc++ does not work on non-GCC compilers.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
diff --git a/.travis.yml b/.travis.yml
index 6cf0791..6c14fcd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,4 @@
-language: c
+language: cpp
compiler:
- gcc
- clang
@@ -12,7 +12,7 @@ matrix:
before_script:
- 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:
- ./autogen.sh
diff --git a/configure.ac b/configure.ac
index 0369b30..3058095 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,7 @@ m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
save_CFLAGS=$CFLAGS
AC_PROG_CC
+AC_PROG_CXX
CFLAGS=$save_CFLAGS
m4_undefine([_AC_ARG_VAR_PRECIOUS])
m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
@@ -57,6 +58,7 @@ fi
cat > local.exp <<EOF
set CC_FOR_TARGET "$CC"
+set CXX_FOR_TARGET "$CXX"
EOF
AM_MAINTAINER_MODE
diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp
index 28d6036..dbdd1a2 100644
--- a/testsuite/lib/libffi.exp
+++ b/testsuite/lib/libffi.exp
@@ -222,6 +222,10 @@ proc libffi_target_compile { source dest type options } {
lappend options "libs= -lpthread"
}
+ if { [string match "*.cc" $source] } {
+ lappend options "c++"
+ }
+
verbose "options: $options"
return [target_compile $source $dest $type $options]
}
diff --git a/testsuite/libffi.call/call.exp b/testsuite/libffi.call/call.exp
index 90e400f..36d13d8 100644
--- a/testsuite/libffi.call/call.exp
+++ b/testsuite/libffi.call/call.exp
@@ -19,10 +19,7 @@ libffi-init
global srcdir subdir
-run-many-tests [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] ""
-if { [string match $using_gcc "yes"] } {
- run-many-tests [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] "-shared-libgcc -lstdc++"
-}
+run-many-tests [lsort [glob -nocomplain -- $srcdir/$subdir/*.{c,cc}]] ""
dg-finish