| 1 | dnl Copyright (C) 2014-2016 Free Software Foundation, Inc. |
| 2 | dnl |
| 3 | dnl This file is part of GDB. |
| 4 | dnl |
| 5 | dnl This program is free software; you can redistribute it and/or modify |
| 6 | dnl it under the terms of the GNU General Public License as published by |
| 7 | dnl the Free Software Foundation; either version 3 of the License, or |
| 8 | dnl (at your option) any later version. |
| 9 | dnl |
| 10 | dnl This program is distributed in the hope that it will be useful, |
| 11 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | dnl GNU General Public License for more details. |
| 14 | dnl |
| 15 | dnl You should have received a copy of the GNU General Public License |
| 16 | dnl along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | dnl GDB_AC_BUILD_WITH_CXX() |
| 19 | dnl Provide an --enable-build-with-cxx/--disable-build-with-cxx set of options |
| 20 | dnl allowing a user to build with a C++ compiler. |
| 21 | |
| 22 | AC_DEFUN([GDB_AC_BUILD_WITH_CXX], |
| 23 | [ |
| 24 | AC_ARG_ENABLE(build-with-cxx, |
| 25 | AS_HELP_STRING([--enable-build-with-cxx], [build with C++ compiler instead of C compiler]), |
| 26 | [case $enableval in |
| 27 | yes | no) |
| 28 | ;; |
| 29 | *) |
| 30 | AC_MSG_ERROR([bad value $enableval for --enable-build-with-cxx]) ;; |
| 31 | esac], |
| 32 | [enable_build_with_cxx=no]) |
| 33 | |
| 34 | if test "$enable_build_with_cxx" = "yes"; then |
| 35 | COMPILER='$(CXX)' |
| 36 | COMPILER_CFLAGS='$(CXXFLAGS)' |
| 37 | else |
| 38 | COMPILER='$(CC)' |
| 39 | COMPILER_CFLAGS='$(CFLAGS)' |
| 40 | fi |
| 41 | AC_SUBST(COMPILER) |
| 42 | AC_SUBST(COMPILER_CFLAGS) |
| 43 | ]) |