mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 10:35:12 +08:00
0bcda68539
Use AX_CXX_COMPILE_STDCXX to detect if the compiler supports C++11, and if -std=xxx switches are necessary to enable C++11. We need to tweak AX_CXX_COMPILE_STDCXX a bit though. Pristine upstream AX_CXX_COMPILE_STDCXX appends -std=gnu++11 to CXX directly. That doesn't work for us, because the top level Makefile passes CXX down to subdirs, and that overrides whatever gdb/Makefile may set CXX to. The result would be that a make invocation from the build/gdb/ directory would use "g++ -std=gnu++11" as expected, while a make invocation at the top level would not. So instead of having AX_CXX_COMPILE_STDCXX set CXX directly, tweak it to AC_SUBST a separate variable -- CXX_DIALECT -- and use '$(CXX) (CXX_DIALECT)' to compile/link. Confirmed that this enables C++11 starting with gcc 4.8, the first gcc release with full C++11 support. Also confirmed that configure errors out gracefully with older GCC releases: checking whether /opt/gcc-4.7/bin/g++ supports C++11 features by default... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=gnu++11... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=gnu++0x... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=c++11... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=c++0x... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with +std=c++11... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -h std=c++11... no configure: error: *** A compiler with support for C++11 language features is required. Makefile:9451: recipe for target 'configure-gdb' failed make[1]: *** [configure-gdb] Error 1 make[1]: Leaving directory '/home/pedro/brno/pedro/gdb/mygit/cxx-convertion/build-gcc-4.7' If we need to revert back to making C++11 optional, all that's necessary is to change the "mandatory" to "optional" in configure.ac and regenerate configure (both gdb and gdbserver). gdb/ChangeLog: 2016-10-28 Pedro Alves <palves@redhat.com> * Makefile.in (CXX_DIALECT): Get from configure. (COMPILE.pre, CC_LD): Append $(CXX_DIALECT). (FLAGS_TO_PASS): Pass CXX_DIALECT. * acinclude.m4: Include ax_cxx_compile_stdcxx.m4. * ax_cxx_compile_stdcxx.m4: Add FSF copyright header. Set and AC_SUBST CXX_DIALECT instead of changing CXX/CXXCPP. * configure.ac: Call AX_CXX_COMPILE_STDCXX. * config.in: Regenerate. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2016-10-28 Pedro Alves <palves@redhat.com> * Makefile.in (CXX_DIALECT): Get from configure. (COMPILE.pre, CC_LD): Append $(CXX_DIALECT). * acinclude.m4: Include ../ax_cxx_compile_stdcxx.m4. * configure.ac: Call AX_CXX_COMPILE_STDCXX. * config.in: Regenerate. * configure: Regenerate.
52 lines
1.3 KiB
Plaintext
52 lines
1.3 KiB
Plaintext
dnl gdb/gdbserver/configure.in uses BFD_HAVE_SYS_PROCFS_TYPE.
|
|
sinclude(../../bfd/bfd.m4)
|
|
|
|
sinclude(../acx_configure_dir.m4)
|
|
|
|
# This gets GDB_AC_LIBMCHECK.
|
|
sinclude(../libmcheck.m4)
|
|
|
|
# This gets AM_GDB_WARNINGS.
|
|
sinclude(../warning.m4)
|
|
|
|
dnl This gets autoconf bugfixes
|
|
sinclude(../../config/override.m4)
|
|
|
|
dnl For ACX_PKGVERSION and ACX_BUGURL.
|
|
sinclude(../../config/acx.m4)
|
|
|
|
m4_include(../../config/depstand.m4)
|
|
m4_include(../../config/lead-dot.m4)
|
|
|
|
dnl codeset.m4 is needed for common.m4, but not for
|
|
dnl anything else in gdbserver.
|
|
m4_include(../../config/codeset.m4)
|
|
m4_include(../common/common.m4)
|
|
|
|
dnl For libiberty_INIT.
|
|
m4_include(../libiberty.m4)
|
|
|
|
dnl For GDB_AC_PTRACE.
|
|
m4_include(../ptrace.m4)
|
|
|
|
m4_include(../ax_cxx_compile_stdcxx.m4)
|
|
|
|
dnl Check for existence of a type $1 in libthread_db.h
|
|
dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
|
|
|
|
AC_DEFUN([GDBSERVER_HAVE_THREAD_DB_TYPE],
|
|
[AC_MSG_CHECKING([for $1 in thread_db.h])
|
|
AC_CACHE_VAL(gdbserver_cv_have_thread_db_type_$1,
|
|
[AC_TRY_COMPILE([
|
|
#include <thread_db.h>],
|
|
[$1 avar],
|
|
gdbserver_cv_have_thread_db_type_$1=yes,
|
|
gdbserver_cv_have_thread_db_type_$1=no
|
|
)])
|
|
if test $gdbserver_cv_have_thread_db_type_$1 = yes; then
|
|
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
|
|
[Define if <thread_db.h> has $1.])
|
|
fi
|
|
AC_MSG_RESULT($gdbserver_cv_have_thread_db_type_$1)
|
|
])
|